Skip to content

Commit 3d2999a

Browse files
authored
Generic sink; no more fMP4 (#34)
* A sink without fMP4. * Make the sink generic. * Small AI PR changes.
1 parent c9e71aa commit 3d2999a

6 files changed

Lines changed: 226 additions & 117 deletions

File tree

CLAUDE.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

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.
7+
This is a GStreamer plugin for Media over QUIC (MoQ), written in Rust. It provides `moqsink` and `moqsrc` elements that enable publishing and subscribing to media streams using the MoQ protocol over QUIC transport.
88

99
## Development Setup
1010

@@ -50,7 +50,7 @@ just fix
5050
just relay
5151

5252
# Publish video stream with broadcast name
53-
just pub-gst bbb
53+
just pub bbb
5454

5555
# Subscribe to video stream with broadcast name
5656
just sub bbb
@@ -59,35 +59,29 @@ just sub bbb
5959
## Architecture
6060

6161
### 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
62+
- **lib.rs**: Main plugin entry point, registers both sink and source elements as "moq" plugin
63+
- **sink/**: MoQ sink element (`moqsink`) for publishing streams
64+
- `mod.rs`: GStreamer element wrapper for MoqSink
6565
- `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
66+
- **source/**: MoQ source element (`moqsrc`) for consuming streams
67+
- `mod.rs`: GStreamer element wrapper for MoqSrc
6868
- `imp.rs`: Core implementation with async Tokio runtime
6969

7070
### Key Dependencies
71-
- **hang**: Higher-level hang protocol utilities and CMAF handling
71+
- **hang**: Higher-level protocol utilities and catalog/container handling
7272
- **moq-mux**: MoQ muxing/demuxing for media streams
7373
- **moq-lite**: Lightweight MoQ protocol types
7474
- **moq-native**: Core MoQ protocol implementation with QUIC/TLS
7575
- **gstreamer**: GStreamer bindings for Rust
76-
- **tokio**: Async runtime (single-threaded worker pool)
76+
- **tokio**: Async runtime
7777

7878
### Plugin Elements
79-
- `hangsink`: BaseSink element that accepts media data and publishes via MoQ with broadcast name
80-
- `hangsrc`: Bin element that receives MoQ streams and outputs GStreamer buffers
79+
- `moqsink`: Element with request pads (`video_%u`, `audio_%u`) that accepts media data and publishes via MoQ
80+
- `moqsrc`: Bin element that receives MoQ streams and outputs GStreamer buffers
8181

82-
Both elements use a shared Tokio runtime and support TLS configuration options. They require broadcast names for operation.
82+
Both elements use a shared Tokio runtime and support TLS configuration options (url, broadcast, tls-disable-verify).
8383

8484
## Environment Variables
85-
- `RUST_LOG=info`: Controls logging level
86-
- `URL=http://localhost:4443`: Default relay server URL
87-
- `GST_PLUGIN_PATH`: Must include the built plugin directory
88-
89-
## Notable Changes from moq-gst
90-
- Renamed from moq-gst to hang-gst
91-
- Element names changed from moqsink/moqsrc to hangsink/hangsrc
92-
- Added broadcast parameter requirement for both elements
93-
- Updated justfile commands to include broadcast parameters
85+
- `RUST_LOG`: Controls logging level (default: info, overridable via environment)
86+
- `URL`: Relay server URL (default: http://localhost:4443)
87+
- `GST_PLUGIN_PATH_1_0`: Must include the built plugin directory (handled automatically by justfile)

Cargo.lock

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ moq-native = "0.13.1"
2828
anyhow = { version = "1", features = ["backtrace"] }
2929
bytes = "1"
3030
gst = { package = "gstreamer", version = "0.23" }
31-
gst-base = { package = "gstreamer-base", version = "0.23" }
3231
#gst-app = { package = "gstreamer-app", version = "0.23", features = ["v1_20"] }
3332

3433
tokio = { version = "1", features = ["full"] }

justfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Using Just: https://github.com/casey/just?tab=readme-ov-file#installation
44

55
export RUST_BACKTRACE := "1"
6-
export RUST_LOG := "info"
7-
export URL := "http://localhost:4443"
6+
export RUST_LOG := env_var_or_default("RUST_LOG", "info")
7+
export URL := "http://localhost:4443/anon"
88
#export GST_DEBUG:="*:4"
99

1010
# List all of the available commands.
@@ -44,10 +44,11 @@ pub broadcast: (download "bbb" "http://commondatastorage.googleapis.com/gtv-vide
4444
cargo build
4545

4646
# Run gstreamer and pipe the output to our plugin
47-
GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}" \
48-
gst-launch-1.0 -v -e multifilesrc location="dev/bbb.fmp4" loop=true ! qtdemux name=demux \
49-
demux.video_0 ! h264parse ! queue ! identity sync=true ! isofmp4mux name=mux chunk-duration=1 fragment-duration=1 ! moqsink url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true \
50-
demux.audio_0 ! aacparse ! queue ! mux.
47+
GST_PLUGIN_PATH_1_0="${PWD}/target/debug${GST_PLUGIN_PATH_1_0:+:$GST_PLUGIN_PATH_1_0}" \
48+
gst-launch-1.0 -v -e multifilesrc location="dev/bbb.fmp4" loop=true ! parsebin name=parse \
49+
parse. ! queue ! identity sync=true ! mux.sink_0 \
50+
parse. ! queue ! identity sync=true ! mux.sink_1 \
51+
moqsink name=mux url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true
5152

5253
# Subscribe to a video using gstreamer
5354
sub broadcast:
@@ -56,7 +57,7 @@ sub broadcast:
5657

5758
# Run gstreamer and pipe the output to our plugin
5859
# This will render the video to the screen
59-
GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}" \
60+
GST_PLUGIN_PATH_1_0="${PWD}/target/debug${GST_PLUGIN_PATH_1_0:+:$GST_PLUGIN_PATH_1_0}" \
6061
gst-launch-1.0 -v -e moqsrc url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true ! decodebin ! videoconvert ! autovideosink
6162

6263
# Run the CI checks

0 commit comments

Comments
 (0)