# moonlight-stream/moonlight-qt architecture

> Architecture diagram of the GitHub repository moonlight-stream/moonlight-qt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moonlight-stream/moonlight-qt
- Repository: https://github.com/moonlight-stream/moonlight-qt

## Overview

##### Main Components

a. Frontend Layer:
- QML-based GUI components (app/gui/)
- User interface views (PcView, SettingsView, StreamSegue)
- Input handling system (app/streaming/input/)

b. Backend Layer:
- Computer management (app/backend/)
- Streaming session handling (app/streaming/)
- Authentication and pairing system (nvpairingmanager)
- Auto-update system (autoupdatechecker)

c. Streaming Components:
- Video pipeline (app/streaming/video/)
- Audio pipeline (app/streaming/audio/)
- Input handling (app/streaming/input/)

d. Hardware Acceleration Layer:
- Multiple renderer implementations:
- CUDA
- D3D11VA
- VAAPI
- VDPAU
- Metal (for macOS)
- Vulkan

**┌─ User Interface Layer ─────────────────────┐**
- QML Frontend                               │
- App View                                 │
- PC View                                 │
- Settings View                           │
- Backend Services ──────────────────────────┤
- Computer Manager                         │
- Identity Manager                         │
- Pairing Manager                         │
- Streaming Core ───────────────────────────┤
- Session Management                         │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐ │
- Video Pipeline│ │  Audio   │ │  Input   │ │
- ┘ └──────────┘ └──────────┘ │
- Hardware Acceleration Layer ──────────────┤
- ┌────────┐ ┌────────┐ ┌────────┐ ┌──────┐ │
- CUDA   │ │D3D11VA │ │ VAAPI  │ │ More │ │
- ┘ └────────┘ └────────┘ └──────┘ │
- ┘

##### Important Relationships

- Bidirectional communication between UI and Backend Services
- Data flow from Backend Services to Streaming Core
- Hardware acceleration integration with video pipeline
- Input system interaction with both UI and streaming components

##### Implementation Details

- Version compatibility notes
- Support matrix for hardware acceleration methods

##### Additional Elements

- Supported platform badges
- Minimum requirements for each component
- Performance-critical paths

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef streaming fill:#e67e22,stroke:#d35400,color:white
    classDef hardware fill:#9b59b6,stroke:#8e44ad,color:white
    classDef settings fill:#95a5a6,stroke:#7f8c8d,color:white

    %% UI Layer
    subgraph UI
        GUI["GUI Components"]
        PCView["PC View"]
        SettingsView["Settings View"]
        StreamSegue["Stream Interface"]
    end

    %% Backend Layer
    subgraph Backend
        CompMgr["Computer Manager"]
        AuthSystem["Authentication System"]
        AutoUpdate["Auto-update System"]
        BoxArt["Box Art Manager"]
        IdentityMgr["Identity Manager"]
    end

    %% Streaming Layer
    subgraph Streaming
        Session["Session Management"]
        subgraph Pipelines
            Video["Video Pipeline"]
            Audio["Audio Pipeline"]
            Input["Input Handling"]
        end
    end

    %% Hardware Layer
    subgraph HWAccel
        CUDA["CUDA Renderer"]
        D3D11VA["D3D11VA Renderer"]
        VAAPI["VAAPI Renderer"]
        VDPAU["VDPAU Renderer"]
        Metal["Metal Renderer"]
    end

    %% Settings Layer
    subgraph Settings
        StreamPrefs["Streaming Preferences"]
        MapMgr["Mapping Manager"]
    end

    %% Relationships
    GUI --> PCView
    GUI --> SettingsView
    GUI --> StreamSegue
    PCView --> CompMgr
    SettingsView --> StreamPrefs
    StreamSegue --> Session
    Session --> Video
    Session --> Audio
    Session --> Input
    CompMgr --> AuthSystem
    CompMgr --> BoxArt
    CompMgr --> IdentityMgr
    Video --> CUDA
    Video --> D3D11VA
    Video --> VAAPI
    Video --> VDPAU
    Video --> Metal
    Input --> MapMgr

    %% Click Events
    click GUI "https://github.com/moonlight-stream/moonlight-qt/tree/master/app/gui/"
    click PCView "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/gui/PcView.qml"
    click SettingsView "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/gui/SettingsView.qml"
    click StreamSegue "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/gui/StreamSegue.qml"
    click CompMgr "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/backend/computermanager.cpp"
    click AuthSystem "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/backend/nvpairingmanager.cpp"
    click AutoUpdate "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/backend/autoupdatechecker.cpp"
    click BoxArt "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/backend/boxartmanager.cpp"
    click IdentityMgr "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/backend/identitymanager.cpp"
    click Session "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/session.cpp"
    click Video "https://github.com/moonlight-stream/moonlight-qt/tree/master/app/streaming/video/"
    click Audio "https://github.com/moonlight-stream/moonlight-qt/tree/master/app/streaming/audio/"
    click Input "https://github.com/moonlight-stream/moonlight-qt/tree/master/app/streaming/input/"
    click CUDA "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/video/ffmpeg-renderers/cuda.cpp"
    click D3D11VA "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/video/ffmpeg-renderers/d3d11va.cpp"
    click VAAPI "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/video/ffmpeg-renderers/vaapi.cpp"
    click VDPAU "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/video/ffmpeg-renderers/vdpau.cpp"
    click Metal "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/video/ffmpeg-renderers/vt_metal.mm"
    click StreamPrefs "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/settings/streamingpreferences.cpp"
    click MapMgr "https://github.com/moonlight-stream/moonlight-qt/blob/master/app/settings/mappingmanager.cpp"

    %% Style Applications
    class GUI,PCView,SettingsView,StreamSegue ui
    class CompMgr,AuthSystem,AutoUpdate,BoxArt,IdentityMgr backend
    class Session,Video,Audio,Input streaming
    class CUDA,D3D11VA,VAAPI,VDPAU,Metal hardware
    class StreamPrefs,MapMgr settings
```
