|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a GStreamer plugin for Media over QUIC (MoQ), written in Rust. It provides `hangsink` and `hangsrc` elements that enable publishing and subscribing to media streams using the MoQ protocol over QUIC transport. The project has been renamed from moq-gst to hang-gst and uses the updated hang/moq-lite dependencies. |
| 8 | + |
| 9 | +## Development Setup |
| 10 | + |
| 11 | +### Prerequisites |
| 12 | +- Rust toolchain (via `rustup`) |
| 13 | +- Just command runner |
| 14 | +- A running moq-relay server from [moq](https://github.com/kixelated/moq) |
| 15 | + |
| 16 | +### Initial Setup |
| 17 | +```bash |
| 18 | +# Install dependencies and tools |
| 19 | +just setup |
| 20 | + |
| 21 | +# To see all available commands |
| 22 | +just |
| 23 | +``` |
| 24 | + |
| 25 | +## Common Commands |
| 26 | + |
| 27 | +### Building |
| 28 | +```bash |
| 29 | +# Build the plugin |
| 30 | +just build |
| 31 | +# or |
| 32 | +cargo build |
| 33 | +``` |
| 34 | + |
| 35 | +### Testing and Quality Checks |
| 36 | +```bash |
| 37 | +# Run all CI checks (clippy, fmt, cargo check) |
| 38 | +just check |
| 39 | + |
| 40 | +# Run tests |
| 41 | +just test |
| 42 | + |
| 43 | +# Auto-fix issues |
| 44 | +just fix |
| 45 | +``` |
| 46 | + |
| 47 | +### Development Workflow |
| 48 | +```bash |
| 49 | +# Start a relay server (in moq repo) |
| 50 | +just relay |
| 51 | + |
| 52 | +# Publish video stream with broadcast name |
| 53 | +just pub-gst bbb |
| 54 | + |
| 55 | +# Subscribe to video stream with broadcast name |
| 56 | +just sub bbb |
| 57 | +``` |
| 58 | + |
| 59 | +## Architecture |
| 60 | + |
| 61 | +### Plugin Structure |
| 62 | +- **lib.rs**: Main plugin entry point, registers both sink and source elements as "hang" plugin |
| 63 | +- **sink/**: Hang sink element (`hangsink`) for publishing streams |
| 64 | + - `mod.rs`: GStreamer element wrapper for HangSink |
| 65 | + - `imp.rs`: Core implementation with async Tokio runtime |
| 66 | +- **source/**: Hang source element (`hangsrc`) for consuming streams |
| 67 | + - `mod.rs`: GStreamer element wrapper for HangSrc |
| 68 | + - `imp.rs`: Core implementation with async Tokio runtime |
| 69 | + |
| 70 | +### Key Dependencies |
| 71 | +- **hang**: Higher-level hang protocol utilities and CMAF handling (local path dependency) |
| 72 | +- **moq-native**: Core MoQ protocol implementation with QUIC/TLS (local path dependency) |
| 73 | +- **gstreamer**: GStreamer bindings for Rust |
| 74 | +- **tokio**: Async runtime (single-threaded worker pool) |
| 75 | + |
| 76 | +### Plugin Elements |
| 77 | +- `hangsink`: BaseSink element that accepts media data and publishes via MoQ with broadcast name |
| 78 | +- `hangsrc`: Bin element that receives MoQ streams and outputs GStreamer buffers |
| 79 | + |
| 80 | +Both elements use a shared Tokio runtime and support TLS configuration options. They require broadcast names for operation. |
| 81 | + |
| 82 | +## Environment Variables |
| 83 | +- `RUST_LOG=info`: Controls logging level |
| 84 | +- `URL=http://localhost:4443`: Default relay server URL |
| 85 | +- `GST_PLUGIN_PATH`: Must include the built plugin directory |
| 86 | + |
| 87 | +## Notable Changes from moq-gst |
| 88 | +- Renamed from moq-gst to hang-gst |
| 89 | +- Element names changed from moqsink/moqsrc to hangsink/hangsrc |
| 90 | +- Added broadcast parameter requirement for both elements |
| 91 | +- Updated dependencies to use local hang and moq-native packages |
| 92 | +- Updated justfile commands to include broadcast parameters |
0 commit comments