# tothtot/media_talk_rust architecture

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

- Interactive diagram: https://gitdiagram.com/tothtot/media_talk_rust
- Repository: https://github.com/tothtot/media_talk_rust

## Overview

This is a Linux network-camera media service. Its main workflow discovers ONVIF cameras, obtains profiles and RTSP stream URIs, ingests camera media, then serves browser playback through a web interface and WebRTC signaling. The README describes an earlier fMP4/MSE path, while sampled GStreamer session code and the browser client show WebRTC as the current playback path; this graph follows the sampled implementation where they differ. It also shows documented device utilities and audio playback. Some server orchestration and unsampled subsystems are represented only where the tree or README supports them.

Main entry points: [`crates/media_talk_rust/src/main.rs`](https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/main.rs) (CLI entry), [`crates/web-display/src/lib.rs`](https://github.com/tothtot/media_talk_rust/blob/master/crates/web-display/src/lib.rs) (Web server and sessions), [`crates/ipcam-gst/src/ingest/session.rs`](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs) (RTSP ingest), [`crates/ipcam-discovery/src/lib.rs`](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-discovery/src/lib.rs) (ONVIF discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and orchestration"]
  node_cli_main["CLI entry<br/>[main.rs]"]
  node_serve["Serve command<br/>[serve.rs]"]
  node_discover_cmd["Discover command<br/>[discover.rs]"]
  node_decodebench["Decode benchmark<br/>[decode_bench.rs]"]
end

subgraph group_discovery["Camera discovery"]
  node_discovery["ONVIF discovery<br/>[lib.rs]"]
end

subgraph group_media["Media pipeline"]
  node_core["Media types<br/>[lib.rs]"]
  node_gst_ingest["RTSP ingest<br/>[session.rs]"]
  node_gst_send["RTP sender<br/>[rtp_send.rs]"]
  node_gst_recv["RTP receiver<br/>[rtp_recv.rs]"]
  node_decoder["Decoder backends<br/>[lib.rs]"]
end

subgraph group_web["Web playback"]
  node_webdisplay["Web server and sessions<br/>[lib.rs]"]
  node_signalling["WebRTC signaling<br/>[session.rs]"]
end

subgraph group_devices["Device utilities"]
  node_audio["Audio output<br/>[session.rs]"]
  node_alsa["ALSA devices<br/>[lib.rs]"]
  node_v4l2["V4L2 capabilities<br/>[lib.rs]"]
end

node_operator(("Operator"))
node_onvif_camera(("ONVIF camera"))
node_rtsp_camera(("RTSP camera stream"))
node_browser(("Browser player<br/>[play.js]"))

node_operator -->|"invokes"| node_cli_main
node_cli_main -->|"dispatches"| node_serve
node_cli_main -->|"dispatches"| node_discover_cmd
node_cli_main -->|"dispatches"| node_decodebench
node_serve -->|"starts server"| node_webdisplay
node_discover_cmd -->|"probes cameras"| node_discovery
node_webdisplay -->|"discovers devices"| node_discovery
node_onvif_camera -->|"answers probes"| node_discovery
node_discovery -->|"returns profiles"| node_webdisplay
node_webdisplay -->|"starts sessions"| node_gst_ingest
node_rtsp_camera -->|"sends RTSP media"| node_gst_ingest
node_gst_ingest -->|"uses media types"| node_core
node_gst_ingest -->|"publishes WebRTC"| node_signalling
node_browser -->|"requests sessions"| node_webdisplay
node_browser -->|"consumes streams"| node_signalling
node_gst_send -->|"publishes RTP"| node_signalling
node_gst_recv -->|"uses media types"| node_core
node_decoder -->|"implements decoder"| node_core
node_audio -.->|"plays audio"| node_alsa
node_cli_main -->|"lists devices"| node_alsa
node_cli_main -->|"lists capabilities"| node_v4l2
node_decodebench -->|"benchmarks decode"| node_decoder

click node_cli_main "https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/main.rs"
click node_serve "https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/serve.rs"
click node_discover_cmd "https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/discover.rs"
click node_discovery "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-discovery/src/lib.rs"
click node_core "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-core/src/lib.rs"
click node_gst_ingest "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs"
click node_gst_send "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/rtp_send.rs"
click node_gst_recv "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/rtp_recv.rs"
click node_decoder "https://github.com/tothtot/media_talk_rust/blob/master/crates/hardware-decode/src/lib.rs"
click node_webdisplay "https://github.com/tothtot/media_talk_rust/blob/master/crates/web-display/src/lib.rs"
click node_browser "https://github.com/tothtot/media_talk_rust/blob/master/web/play.js"
click node_signalling "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs"
click node_audio "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs"
click node_alsa "https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-alsa/src/lib.rs"
click node_v4l2 "https://github.com/tothtot/media_talk_rust/blob/master/crates/v4l2-device-cap/src/lib.rs"
click node_decodebench "https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/decode_bench.rs"

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_cli_main,node_serve,node_discover_cmd,node_decodebench,node_browser toneBlue
class node_discovery toneAmber
class node_core,node_gst_ingest,node_gst_send,node_gst_recv,node_decoder toneMint
class node_webdisplay,node_signalling toneRose
class node_audio,node_alsa,node_v4l2,node_operator,node_onvif_camera,node_rtsp_camera toneIndigo
```

## Components

### CLI and orchestration

- [CLI entry](https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/main.rs): `crates/media_talk_rust/src/main.rs`
- [Serve command](https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/serve.rs): `crates/media_talk_rust/src/ipc/serve.rs`
- [Discover command](https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/discover.rs): `crates/media_talk_rust/src/ipc/discover.rs`
- [Decode benchmark](https://github.com/tothtot/media_talk_rust/blob/master/crates/media_talk_rust/src/ipc/decode_bench.rs): `crates/media_talk_rust/src/ipc/decode_bench.rs`

### Camera discovery

- [ONVIF discovery](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-discovery/src/lib.rs): `crates/ipcam-discovery/src/lib.rs`

### Media pipeline

- [Media types](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-core/src/lib.rs): `crates/ipcam-core/src/lib.rs`
- [RTSP ingest](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs): `crates/ipcam-gst/src/ingest/session.rs`
- [RTP sender](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/rtp_send.rs): `crates/ipcam-gst/src/rtp_send.rs`
- [RTP receiver](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/rtp_recv.rs): `crates/ipcam-gst/src/rtp_recv.rs`
- [Decoder backends](https://github.com/tothtot/media_talk_rust/blob/master/crates/hardware-decode/src/lib.rs): `crates/hardware-decode/src/lib.rs`

### Web playback

- [Web server and sessions](https://github.com/tothtot/media_talk_rust/blob/master/crates/web-display/src/lib.rs): `crates/web-display/src/lib.rs`
- [WebRTC signaling](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs): `crates/ipcam-gst/src/ingest/session.rs`

### Device utilities

- [Audio output](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-gst/src/ingest/session.rs): `crates/ipcam-gst/src/ingest/session.rs`
- [ALSA devices](https://github.com/tothtot/media_talk_rust/blob/master/crates/ipcam-alsa/src/lib.rs): `crates/ipcam-alsa/src/lib.rs`
- [V4L2 capabilities](https://github.com/tothtot/media_talk_rust/blob/master/crates/v4l2-device-cap/src/lib.rs): `crates/v4l2-device-cap/src/lib.rs`

### Other components

- **Operator**
- **ONVIF camera**
- **RTSP camera stream**
- [Browser player](https://github.com/tothtot/media_talk_rust/blob/master/web/play.js): `web/play.js`

## Connections

- Operator → CLI entry: invokes
- CLI entry → Serve command: dispatches
- CLI entry → Discover command: dispatches
- CLI entry → Decode benchmark: dispatches
- Serve command → Web server and sessions: starts server
- Discover command → ONVIF discovery: probes cameras
- Web server and sessions → ONVIF discovery: discovers devices
- ONVIF camera → ONVIF discovery: answers probes
- ONVIF discovery → Web server and sessions: returns profiles
- Web server and sessions → RTSP ingest: starts sessions
- RTSP camera stream → RTSP ingest: sends RTSP media
- RTSP ingest → Media types: uses media types
- RTSP ingest → WebRTC signaling: publishes WebRTC
- Browser player → Web server and sessions: requests sessions
- Browser player → WebRTC signaling: consumes streams
- RTP sender → WebRTC signaling: publishes RTP
- RTP receiver → Media types: uses media types
- Decoder backends → Media types: implements decoder
- Audio output → ALSA devices: plays audio
- CLI entry → ALSA devices: lists devices
- CLI entry → V4L2 capabilities: lists capabilities
- Decode benchmark → Decoder backends: benchmarks decode
