# azeolxc/v380decoder architecture

> Architecture diagram of the GitHub repository azeolxc/v380decoder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azeolxc/v380decoder
- Repository: https://github.com/azeolxc/v380decoder

## Overview

V380 Decoder is a camera-stream extraction and serving application. A user configures it through the CLI; the application discovers or connects to a LAN/cloud camera, authenticates and receives encrypted media, then exposes decoded video/audio through RTSP or standard-output modes. Optional branches provide camera control and snapshots through a web API/UI, and ONVIF services and discovery. Source excerpts confirm the main entry point and several server responsibilities; some subsystem wiring is based on the README and is left out where the exact call path is not shown.

Main entry points: [`src/V380Client.cs`](https://github.com/azeolxc/v380decoder/blob/main/src/V380Client.cs) (Camera client), [`Program.cs`](https://github.com/azeolxc/v380decoder/blob/main/Program.cs) (Application entry), [`src/WebServer.cs`](https://github.com/azeolxc/v380decoder/blob/main/src/WebServer.cs) (Web UI and API), [`src/RtspServer.cs`](https://github.com/azeolxc/v380decoder/blob/main/src/RtspServer.cs) (RTSP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_program["Application entry<br/>[Program.cs]"]
  node_args["Argument parsing<br/>[ArgParser.cs]"]
end

subgraph group_media["Camera media"]
  node_discovery["LAN discovery<br/>[DeviceDiscovery.cs]"]
  node_relay["Relay lookup"]
  node_client["Camera client<br/>[V380Client.cs]"]
  node_commands["Camera commands<br/>[V380Commands.cs]"]
  node_frames["Frame data<br/>[FrameData.cs]"]
end

subgraph group_outputs["Stream outputs"]
  node_rtsp_server["RTSP server<br/>[RtspServer.cs]"]
  node_rtsp_session["RTSP sessions<br/>[RtspSession.cs]"]
  node_snapshot["Snapshot manager<br/>[SnapshotManager.cs]"]
end

subgraph group_services["Control and discovery"]
  node_web["Web UI and API<br/>[WebServer.cs]"]
  node_web_page["Control UI<br/>[WebPage.cs]"]
  node_onvif["ONVIF handler<br/>[OnvifHandler.cs]"]
  node_onvif_discovery["ONVIF discovery<br/>[OnvifDiscovery.cs]"]
end

node_user(("Operator"))
node_relay_service{{"Cloud relay"}}
node_camera{{"V380 camera"}}
node_rtsp_consumer(("RTSP clients"))
node_stdout(("Pipe consumers"))
node_onvif_client(("ONVIF clients"))
node_browser(("Web users"))
node_ffmpeg{{"FFmpeg"}}

node_user -->|"configures"| node_program
node_program -->|"parses options"| node_args
node_program -->|"starts discovery"| node_discovery
node_program -->|"resolves cloud"| node_relay
node_relay -->|"queries relay"| node_relay_service
node_program -->|"starts client"| node_client
node_client -->|"authenticates and streams"| node_camera
node_client -.->|"connects via relay"| node_relay_service
node_client -->|"assembles media"| node_frames
node_client -->|"supplies media"| node_rtsp_server
node_program -->|"starts server"| node_rtsp_server
node_rtsp_server -->|"accepts sessions"| node_rtsp_session
node_rtsp_session -->|"serves RTSP"| node_rtsp_consumer
node_client -->|"writes selected output"| node_stdout
node_program -->|"starts web server"| node_web
node_web -->|"serves UI"| node_web_page
node_browser -->|"requests controls"| node_web
node_web -->|"dispatches commands"| node_commands
node_commands -->|"controls camera"| node_client
node_web -->|"requests snapshots"| node_snapshot
node_client -->|"provides frames"| node_snapshot
node_web -->|"routes SOAP"| node_onvif
node_onvif -->|"controls camera"| node_client
node_onvif -->|"reports stream URI"| node_rtsp_server
node_program -->|"starts discovery"| node_onvif_discovery
node_onvif_client -->|"probes device"| node_onvif_discovery
node_onvif_discovery -->|"announces endpoint"| node_onvif_client
node_snapshot -.->|"decodes frames"| node_ffmpeg

click node_program "https://github.com/azeolxc/v380decoder/blob/main/Program.cs"
click node_args "https://github.com/azeolxc/v380decoder/blob/main/src/ArgParser.cs"
click node_discovery "https://github.com/azeolxc/v380decoder/blob/main/src/DeviceDiscovery.cs"
click node_relay "https://github.com/azeolxc/v380decoder/blob/main/src/DispatchRelayServer.cs"
click node_client "https://github.com/azeolxc/v380decoder/blob/main/src/V380Client.cs"
click node_commands "https://github.com/azeolxc/v380decoder/blob/main/src/V380Commands.cs"
click node_frames "https://github.com/azeolxc/v380decoder/blob/main/src/FrameData.cs"
click node_rtsp_server "https://github.com/azeolxc/v380decoder/blob/main/src/RtspServer.cs"
click node_rtsp_session "https://github.com/azeolxc/v380decoder/blob/main/src/RtspSession.cs"
click node_web "https://github.com/azeolxc/v380decoder/blob/main/src/WebServer.cs"
click node_web_page "https://github.com/azeolxc/v380decoder/blob/main/src/WebPage.cs"
click node_snapshot "https://github.com/azeolxc/v380decoder/blob/main/src/SnapshotManager.cs"
click node_onvif "https://github.com/azeolxc/v380decoder/blob/main/src/OnvifHandler.cs"
click node_onvif_discovery "https://github.com/azeolxc/v380decoder/blob/main/src/OnvifDiscovery.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_args,node_rtsp_consumer,node_onvif_client,node_browser toneBlue
class node_discovery,node_relay,node_client,node_commands,node_frames toneAmber
class node_rtsp_server,node_rtsp_session,node_snapshot toneMint
class node_web,node_web_page,node_onvif,node_onvif_discovery toneRose
class node_user,node_relay_service,node_camera,node_stdout,node_ffmpeg toneIndigo
```

## Components

### Runtime orchestration

- [Application entry](https://github.com/azeolxc/v380decoder/blob/main/Program.cs): `Program.cs`
- [Argument parsing](https://github.com/azeolxc/v380decoder/blob/main/src/ArgParser.cs): `src/ArgParser.cs`

### Camera media

- [LAN discovery](https://github.com/azeolxc/v380decoder/blob/main/src/DeviceDiscovery.cs): `src/DeviceDiscovery.cs`
- [Relay lookup](https://github.com/azeolxc/v380decoder/blob/main/src/DispatchRelayServer.cs): `src/DispatchRelayServer.cs`
- [Camera client](https://github.com/azeolxc/v380decoder/blob/main/src/V380Client.cs): `src/V380Client.cs`
- [Camera commands](https://github.com/azeolxc/v380decoder/blob/main/src/V380Commands.cs): `src/V380Commands.cs`
- [Frame data](https://github.com/azeolxc/v380decoder/blob/main/src/FrameData.cs): `src/FrameData.cs`

### Stream outputs

- [RTSP server](https://github.com/azeolxc/v380decoder/blob/main/src/RtspServer.cs): `src/RtspServer.cs`
- [RTSP sessions](https://github.com/azeolxc/v380decoder/blob/main/src/RtspSession.cs): `src/RtspSession.cs`
- [Snapshot manager](https://github.com/azeolxc/v380decoder/blob/main/src/SnapshotManager.cs): `src/SnapshotManager.cs`

### Control and discovery

- [Web UI and API](https://github.com/azeolxc/v380decoder/blob/main/src/WebServer.cs): `src/WebServer.cs`
- [Control UI](https://github.com/azeolxc/v380decoder/blob/main/src/WebPage.cs): `src/WebPage.cs`
- [ONVIF handler](https://github.com/azeolxc/v380decoder/blob/main/src/OnvifHandler.cs): `src/OnvifHandler.cs`
- [ONVIF discovery](https://github.com/azeolxc/v380decoder/blob/main/src/OnvifDiscovery.cs): `src/OnvifDiscovery.cs`

### Other components

- **Operator**
- **Cloud relay**
- **V380 camera**
- **RTSP clients**
- **Pipe consumers**
- **ONVIF clients**
- **Web users**
- **FFmpeg**

## Connections

- Operator → Application entry: configures
- Application entry → Argument parsing: parses options
- Application entry → LAN discovery: starts discovery
- Application entry → Relay lookup: resolves cloud
- Relay lookup → Cloud relay: queries relay
- Application entry → Camera client: starts client
- Camera client → V380 camera: authenticates and streams
- Camera client → Cloud relay: connects via relay
- Camera client → Frame data: assembles media
- Camera client → RTSP server: supplies media
- Application entry → RTSP server: starts server
- RTSP server → RTSP sessions: accepts sessions
- RTSP sessions → RTSP clients: serves RTSP
- Camera client → Pipe consumers: writes selected output
- Application entry → Web UI and API: starts web server
- Web UI and API → Control UI: serves UI
- Web users → Web UI and API: requests controls
- Web UI and API → Camera commands: dispatches commands
- Camera commands → Camera client: controls camera
- Web UI and API → Snapshot manager: requests snapshots
- Camera client → Snapshot manager: provides frames
- Web UI and API → ONVIF handler: routes SOAP
- ONVIF handler → Camera client: controls camera
- ONVIF handler → RTSP server: reports stream URI
- Application entry → ONVIF discovery: starts discovery
- ONVIF clients → ONVIF discovery: probes device
- ONVIF discovery → ONVIF clients: announces endpoint
- Snapshot manager → FFmpeg: decodes frames
