# antimof/uxplay architecture

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

- Interactive diagram: https://gitdiagram.com/antimof/uxplay
- Repository: https://github.com/antimof/uxplay

## Overview

UxPlay is an AirPlay mirroring, audio, and limited HLS video server. An Apple client discovers the server, establishes a session, and sends media; UxPlay handles AirPlay/RAOP requests and streams media to local renderers or optional external RTP receivers. Pairing, service discovery, Bluetooth LE advertisement, and playback controls are distinct supporting capabilities. The source index and excerpts show the central interfaces, but not every runtime call; uncertain connections are omitted. Additional branches reflect README-documented features, including recording and HLS, without implying unsampled implementation details.

Main entry points: [`lib/raop.c`](https://github.com/antimof/uxplay/blob/master/lib/raop.c) (RAOP session server), [`uxplay.cpp`](https://github.com/antimof/uxplay/blob/master/uxplay.cpp) (Server entry), [`lib/httpd.c`](https://github.com/antimof/uxplay/blob/master/lib/httpd.c) (HTTP server), [`renderers/video_renderer.c`](https://github.com/antimof/uxplay/blob/master/renderers/video_renderer.c) (Video and HLS renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Server and protocols"]
  node_uxplay["Server entry<br/>[uxplay.cpp]"]
  node_raop["RAOP session server<br/>[raop.c]"]
  node_http["AirPlay HTTP handlers<br/>[http_handlers.h]"]
  node_httpd["HTTP server<br/>[httpd.c]"]
  node_llhttp["HTTP parser<br/>[llhttp.c]"]
end

subgraph group_media["Media processing"]
  node_rtp_mirror["Mirror RTP receiver<br/>[raop_rtp_mirror.c]"]
  node_audio_rtp["Audio RTP receiver<br/>[raop_rtp.c]"]
  node_ntp["Media timing<br/>[raop_ntp.c]"]
end

subgraph group_output["Playback and outputs"]
  node_video_renderer["Video and HLS renderer<br/>[video_renderer.c]"]
  node_audio_renderer["Audio renderer<br/>[audio_renderer.c]"]
  node_mux["Media recording<br/>[mux_renderer.c]"]
end

subgraph group_discovery["Discovery and access"]
  node_pairing["Pairing and authentication<br/>[pairing.c]"]
  node_dnssd["DNS-SD discovery<br/>[dnssd.c]"]
  node_beacon["Bluetooth LE beacon<br/>[uxplay-beacon.py]"]
  node_beacon_drivers["BLE platform modules"]
end

node_client(("AirPlay client"))
node_external_rtp(("External RTP receiver"))
node_network(("Network clients"))

node_client -->|"initiates streaming"| node_uxplay
node_uxplay -->|"starts server"| node_raop
node_raop -->|"creates HTTP server"| node_httpd
node_httpd -.->|"dispatches requests"| node_http
node_httpd -.->|"parses requests"| node_llhttp
node_raop -->|"uses pairing"| node_pairing
node_raop -.->|"configures discovery"| node_dnssd
node_network -->|"discovers service"| node_dnssd
node_beacon -.->|"loads platform support"| node_beacon_drivers
node_beacon -->|"advertises endpoint"| node_network
node_raop -->|"starts mirror receiver"| node_rtp_mirror
node_raop -->|"starts audio receiver"| node_audio_rtp
node_rtp_mirror -->|"delivers video frames"| node_video_renderer
node_audio_rtp -.->|"delivers audio"| node_audio_renderer
node_uxplay -->|"configures playback"| node_video_renderer
node_uxplay -->|"configures playback"| node_audio_renderer
node_uxplay -->|"supports recording"| node_mux
node_video_renderer -->|"forwards video RTP"| node_external_rtp
node_audio_renderer -->|"forwards audio RTP"| node_external_rtp
node_raop -.->|"uses media timing"| node_ntp

click node_uxplay "https://github.com/antimof/uxplay/blob/master/uxplay.cpp"
click node_raop "https://github.com/antimof/uxplay/blob/master/lib/raop.c"
click node_http "https://github.com/antimof/uxplay/blob/master/lib/http_handlers.h"
click node_httpd "https://github.com/antimof/uxplay/blob/master/lib/httpd.c"
click node_llhttp "https://github.com/antimof/uxplay/blob/master/lib/llhttp/llhttp.c"
click node_pairing "https://github.com/antimof/uxplay/blob/master/lib/pairing.c"
click node_dnssd "https://github.com/antimof/uxplay/blob/master/lib/dnssd.c"
click node_beacon "https://github.com/antimof/uxplay/blob/master/Bluetooth_LE_beacon/uxplay-beacon.py"
click node_beacon_drivers "https://github.com/antimof/uxplay/tree/master/Bluetooth_LE_beacon"
click node_rtp_mirror "https://github.com/antimof/uxplay/blob/master/lib/raop_rtp_mirror.c"
click node_audio_rtp "https://github.com/antimof/uxplay/blob/master/lib/raop_rtp.c"
click node_ntp "https://github.com/antimof/uxplay/blob/master/lib/raop_ntp.c"
click node_video_renderer "https://github.com/antimof/uxplay/blob/master/renderers/video_renderer.c"
click node_audio_renderer "https://github.com/antimof/uxplay/blob/master/renderers/audio_renderer.c"
click node_mux "https://github.com/antimof/uxplay/blob/master/renderers/mux_renderer.c"

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_uxplay,node_raop,node_http,node_httpd,node_llhttp,node_client,node_network toneBlue
class node_rtp_mirror,node_audio_rtp,node_ntp toneAmber
class node_video_renderer,node_audio_renderer,node_mux toneMint
class node_pairing,node_dnssd,node_beacon,node_beacon_drivers toneRose
class node_external_rtp toneIndigo
```

## Components

### Server and protocols

- [Server entry](https://github.com/antimof/uxplay/blob/master/uxplay.cpp): `uxplay.cpp`
- [RAOP session server](https://github.com/antimof/uxplay/blob/master/lib/raop.c): `lib/raop.c`
- [AirPlay HTTP handlers](https://github.com/antimof/uxplay/blob/master/lib/http_handlers.h): `lib/http_handlers.h`
- [HTTP server](https://github.com/antimof/uxplay/blob/master/lib/httpd.c): `lib/httpd.c`
- [HTTP parser](https://github.com/antimof/uxplay/blob/master/lib/llhttp/llhttp.c): `lib/llhttp/llhttp.c`

### Media processing

- [Mirror RTP receiver](https://github.com/antimof/uxplay/blob/master/lib/raop_rtp_mirror.c): `lib/raop_rtp_mirror.c`
- [Audio RTP receiver](https://github.com/antimof/uxplay/blob/master/lib/raop_rtp.c): `lib/raop_rtp.c`
- [Media timing](https://github.com/antimof/uxplay/blob/master/lib/raop_ntp.c): `lib/raop_ntp.c`

### Playback and outputs

- [Video and HLS renderer](https://github.com/antimof/uxplay/blob/master/renderers/video_renderer.c): `renderers/video_renderer.c`
- [Audio renderer](https://github.com/antimof/uxplay/blob/master/renderers/audio_renderer.c): `renderers/audio_renderer.c`
- [Media recording](https://github.com/antimof/uxplay/blob/master/renderers/mux_renderer.c): `renderers/mux_renderer.c`

### Discovery and access

- [Pairing and authentication](https://github.com/antimof/uxplay/blob/master/lib/pairing.c): `lib/pairing.c`
- [DNS-SD discovery](https://github.com/antimof/uxplay/blob/master/lib/dnssd.c): `lib/dnssd.c`
- [Bluetooth LE beacon](https://github.com/antimof/uxplay/blob/master/Bluetooth_LE_beacon/uxplay-beacon.py): `Bluetooth_LE_beacon/uxplay-beacon.py`
- [BLE platform modules](https://github.com/antimof/uxplay/tree/master/Bluetooth_LE_beacon): `Bluetooth_LE_beacon`

### Other components

- **AirPlay client**
- **External RTP receiver**
- **Network clients**

## Connections

- AirPlay client → Server entry: initiates streaming (evidence: `README.md`)
- Server entry → RAOP session server: starts server (evidence: `lib/raop.c`)
- RAOP session server → HTTP server: creates HTTP server (evidence: `lib/raop.c`)
- HTTP server → AirPlay HTTP handlers: dispatches requests
- HTTP server → HTTP parser: parses requests
- RAOP session server → Pairing and authentication: uses pairing (evidence: `lib/raop.c`)
- RAOP session server → DNS-SD discovery: configures discovery
- Network clients → DNS-SD discovery: discovers service (evidence: `README.md`)
- Bluetooth LE beacon → BLE platform modules: loads platform support
- Bluetooth LE beacon → Network clients: advertises endpoint (evidence: `README.md`)
- RAOP session server → Mirror RTP receiver: starts mirror receiver (evidence: `lib/raop.c`)
- RAOP session server → Audio RTP receiver: starts audio receiver (evidence: `lib/raop.c`)
- Mirror RTP receiver → Video and HLS renderer: delivers video frames (evidence: `lib/raop_rtp_mirror.c`)
- Audio RTP receiver → Audio renderer: delivers audio
- Server entry → Video and HLS renderer: configures playback (evidence: `uxplay.cpp`)
- Server entry → Audio renderer: configures playback (evidence: `uxplay.cpp`)
- Server entry → Media recording: supports recording (evidence: `README.md`)
- Video and HLS renderer → External RTP receiver: forwards video RTP (evidence: `README.md`)
- Audio renderer → External RTP receiver: forwards audio RTP (evidence: `README.md`)
- RAOP session server → Media timing: uses media timing
