# carguo/gsyvideoplayer architecture

> Architecture diagram of the GitHub repository carguo/gsyvideoplayer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/carguo/gsyvideoplayer
- Repository: https://github.com/carguo/gsyvideoplayer

## Overview

##### Main Components
- Core Player Library:
- “gsyVideoPlayer-java” module that provides a Java layer implementation for the playback functions.
- Player Engine Abstractions:
- Native and ABI-specific Modules:
- Modules like “gsyVideoPlayer-armv5”, “gsyVideoPlayer-armv7a”, “gsyVideoPlayer-armv64”, “gsyVideoPlayer-x86”, etc. These show how the project supports various architectures by including native libraries.
- Caching and Proxy Layers:
- Modules such as “gsyVideoPlayer-proxy_cache” that handle caching and proxying. Indicate its connection to the core player and how it provides “CacheManager” functionality.
- External Dependencies and Integration Points:
- Out integration with third-party technology like IJKPlayer, AndroidVideoCache (and the related patches in “16kpatch”), and Media3/ExoPlayer2. Illustrate how these external dependencies feed into the player core and engine selection.
- Demo and UI Components:
- “app” module that contains the demo activities, UI components, various layouts, adapters, fragments, and custom renderers–all meant to showcase the features (animations, switch play, list play, etc.).
- Additional Features:
- Configuration and Build Infrastructure:
- A sub-section for gradle scripts, CI pipelines (the .github/workflows files), and documentation (doc folder) that indicate a robust build and integration setup.

##### Relationships and Data Flow
– The UI (demo “app” and custom views)
– The caching layer (where video stream caching and proxy logic reside)
– The native libraries (for specific hardware decoding or 16k patch support)
- Connections from the UI layer into adapter and media control components. For example, list adapters and activity controllers communicate with the core player API.

##### Architectural Patterns and Design Principles
- Modularity by highlighting how independent modules (for example, different ABIs or player types) plug into the main framework.
- Use of the Builder pattern for creating video options (as seen with classes like “GSYVideoOptionBuilder”) and the Factory pattern in selecting the playback engine.
- Separation of concerns: player management, caching, rendering and UI are handled in their own distinct modules/components.

##### Technologies and Frameworks
- JNI/native integration (from the various gsyVideoPlayer-<arch> modules).
- External libraries such as AndroidVideoCache (for caching) and refer to third-party media players (IJKPlayer, Media3, etc.).

##### Detailed Capturing
- Do not simplify—represent as many components as possible (each module can be a separate element).
- Inter-module dependencies (e.g., which modules depend on the core player, which provide alternate implementations for specific functionalities, etc.).
- External services and dependencies with labels and interfaces.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Core Library Module
    subgraph "Core Library"
        Core["GSYVideoPlayer Core"]
        JavaLayer["Java-layer Playback"]
    end

    %% Engine Abstractions
    subgraph "Player Engine Abstractions"
        PF["PlayerFactory"]
        Ijk["IjkPlayerManager"]
        System["SystemPlayerManager"]
        Ali["AliPlayerManager"]
    end

    %% Native & ABI-specific Modules
    subgraph "Native Modules"
        ARMv5["ARMv5 Support"]
        ARMv7a["ARMv7a Support"]
        ARMv64["ARMv64 Support"]
        X86["x86 Support"]
        X86_64["x86_64 Support"]
        NativeExtra["Additional Native Libraries"]
    end

    %% Caching and Proxy Layers
    subgraph "Caching Layer"
        ProxyCache["Proxy Cache"]
    end

    %% External Dependencies
    subgraph "External Dependencies"
        IJKPatch["IJKPlayer Patches"]
        Exo["ExoPlayer2 Integration"]
    end

    %% Demo and UI Components
    subgraph "Demo/UI Layer"
        Demo["Demo Application"]
    end

    %% Additional Features
    subgraph "Additional Features"
        Subtitle["Subtitle & Filtering"]
        Render["Custom Renderers/Effects"]
    end

    %% Build and Configuration
    subgraph "Build & Config"
        GradleConfig["Gradle & Build Config"]
        CIPipelines["CI Pipelines"]
        Documentation["Documentation"]
    end

    %% Relationships and Data Flow
    Demo -->|"callsAPI"| Core
    Core -->|"implementsEngine"| PF
    PF -->|"creates"| Ijk
    PF -->|"creates"| System
    PF -->|"creates"| Ali
    Core -->|"cachesStreams"| ProxyCache
    Core -->|"loadsNativeLib"| ARMv7a
    IJKPatch -->|"patches"| Core
    Exo -->|"integrates"| PF
    Demo -->|"rendersSubtitles"| Subtitle
    Demo -->|"usesCustomRender"| Render
    GradleConfig -->|"builds"| Core
    CIPipelines -->|"CI/CD"| Core
    Documentation ---|"providesGuide"| Core

    %% Styling and Classes
    class Core,JavaLayer core;
    class PF,Ijk,System,Ali engine;
    class ARMv5,ARMv7a,ARMv64,X86,X86_64,NativeExtra native;
    class ProxyCache cache;
    class IJKPatch,Exo ext;
    class Demo ui;
    class Subtitle,Render features;
    class GradleConfig,CIPipelines,Documentation config;

    %% Click Events
    click Core "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-base/"
    click JavaLayer "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-java/"
    click PF "https://github.com/carguo/gsyvideoplayer/blob/master/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/PlayerFactory.java"
    click Ijk "https://github.com/carguo/gsyvideoplayer/blob/master/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/IjkPlayerManager.java"
    click System "https://github.com/carguo/gsyvideoplayer/blob/master/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/player/SystemPlayerManager.java"
    click ARMv5 "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-armv5/"
    click ARMv7a "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-armv7a/"
    click ARMv64 "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-armv64/"
    click X86 "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-x86/"
    click X86_64 "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-x86_64/"
    click NativeExtra "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-ex_so/"
    click ProxyCache "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-proxy_cache/"
    click IJKPatch "https://github.com/carguo/gsyvideoplayer/tree/master/16kpatch/"
    click Exo "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-exo_player2/"
    click Demo "https://github.com/carguo/gsyvideoplayer/tree/master/app/"
    click Subtitle "https://github.com/carguo/gsyvideoplayer/tree/master/app/src/main/java/com/example/gsyvideoplayer/exosubtitle/"
    click Render "https://github.com/carguo/gsyvideoplayer/tree/master/gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/render/effect/"
    click CIPipelines "https://github.com/carguo/gsyvideoplayer/tree/master/.github/workflows/"
    click Documentation "https://github.com/carguo/gsyvideoplayer/tree/master/doc/"

    %% Class Definitions for Colors
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef engine fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef native fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef cache fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef ext fill:#E6E6FA,stroke:#333,stroke-width:2px;
    classDef ui fill:#FFE4B5,stroke:#333,stroke-width:2px;
    classDef features fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef config fill:#F0E68C,stroke:#333,stroke-width:2px;
```
