diff --git a/Cargo.lock b/Cargo.lock index 846ab85..6ef13af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -849,25 +849,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hang-gst" -version = "0.2.2" -dependencies = [ - "anyhow", - "bytes", - "gst-plugin-version-helper", - "gstreamer", - "gstreamer-base", - "hang", - "moq-lite", - "moq-native", - "once_cell", - "tokio", - "tracing", - "tracing-subscriber", - "url", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1321,6 +1302,25 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "moq-gst" +version = "0.2.2" +dependencies = [ + "anyhow", + "bytes", + "gst-plugin-version-helper", + "gstreamer", + "gstreamer-base", + "hang", + "moq-lite", + "moq-native", + "once_cell", + "tokio", + "tracing", + "tracing-subscriber", + "url", +] + [[package]] name = "moq-lite" version = "0.10.1" diff --git a/Cargo.toml b/Cargo.toml index 06a449c..e13634f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "hang-gst" +name = "moq-gst" description = "Media over QUIC - Gstreamer plugin" authors = ["Luke Curley"] -repository = "https://github.com/kixelated/hang-gst" +repository = "https://github.com/moq-dev/gstreamer" license = "MIT OR Apache-2.0" version = "0.2.2" @@ -12,7 +12,7 @@ keywords = ["quic", "http3", "webtransport", "media", "live"] categories = ["multimedia", "network-programming", "web-programming"] [lib] -name = "gsthang" +name = "gstmoq" crate-type = ["cdylib", "rlib"] path = "src/lib.rs" diff --git a/README.md b/README.md index 798f54c..8b62c72 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ just relay Now you can publish and subscribe to a video: ```sh # Publish to a localhost moq-relay server -just pub-gst bbb +just pub bbb # Subscribe from a localhost moq-relay server just sub bbb diff --git a/justfile b/justfile index eec622c..3f5d6ad 100644 --- a/justfile +++ b/justfile @@ -39,14 +39,14 @@ download name url: fi # Publish a video using gstreamer to the localhost relay server -pub-gst broadcast: (download "bbb" "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4") +pub broadcast: (download "bbb" "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4") # Build the plugins cargo build # Run gstreamer and pipe the output to our plugin GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}" \ gst-launch-1.0 -v -e multifilesrc location="dev/bbb.fmp4" loop=true ! qtdemux name=demux \ - demux.video_0 ! h264parse ! queue ! identity sync=true ! isofmp4mux name=mux chunk-duration=1 fragment-duration=1 ! hangsink url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true \ + 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 \ demux.audio_0 ! aacparse ! queue ! mux. # Subscribe to a video using gstreamer @@ -57,7 +57,7 @@ sub broadcast: # Run gstreamer and pipe the output to our plugin # This will render the video to the screen GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}" \ - gst-launch-1.0 -v -e hangsrc url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true ! decodebin ! videoconvert ! autovideosink + gst-launch-1.0 -v -e moqsrc url="$URL" broadcast="{{broadcast}}" tls-disable-verify=true ! decodebin ! videoconvert ! autovideosink # Run the CI checks check $RUSTFLAGS="-D warnings": diff --git a/src/lib.rs b/src/lib.rs index eea43ff..69bff0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,7 +28,7 @@ pub fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { } gst::plugin_define!( - hang, + moq, env!("CARGO_PKG_DESCRIPTION"), plugin_init, concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")), diff --git a/src/sink/imp.rs b/src/sink/imp.rs index 0c73504..5d4a8f6 100644 --- a/src/sink/imp.rs +++ b/src/sink/imp.rs @@ -34,15 +34,15 @@ struct State { } #[derive(Default)] -pub struct HangSink { +pub struct MoqSink { settings: Mutex, state: Arc>, } #[glib::object_subclass] -impl ObjectSubclass for HangSink { - const NAME: &'static str = "HangSink"; - type Type = super::HangSink; +impl ObjectSubclass for MoqSink { + const NAME: &'static str = "MoqSink"; + type Type = super::MoqSink; type ParentType = gst_base::BaseSink; fn new() -> Self { @@ -50,7 +50,7 @@ impl ObjectSubclass for HangSink { } } -impl ObjectImpl for HangSink { +impl ObjectImpl for MoqSink { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { vec![ @@ -95,9 +95,9 @@ impl ObjectImpl for HangSink { } } -impl GstObjectImpl for HangSink {} +impl GstObjectImpl for MoqSink {} -impl ElementImpl for HangSink { +impl ElementImpl for MoqSink { fn metadata() -> Option<&'static gst::subclass::ElementMetadata> { static ELEMENT_METADATA: Lazy = Lazy::new(|| { gst::subclass::ElementMetadata::new( @@ -126,7 +126,7 @@ impl ElementImpl for HangSink { } } -impl BaseSinkImpl for HangSink { +impl BaseSinkImpl for MoqSink { fn start(&self) -> Result<(), gst::ErrorMessage> { let _guard = RUNTIME.enter(); self.setup() @@ -164,7 +164,7 @@ impl BaseSinkImpl for HangSink { } } -impl HangSink { +impl MoqSink { fn setup(&self) -> anyhow::Result<()> { let settings = self.settings.lock().unwrap(); diff --git a/src/sink/mod.rs b/src/sink/mod.rs index aa99a7c..17dbc07 100644 --- a/src/sink/mod.rs +++ b/src/sink/mod.rs @@ -4,9 +4,9 @@ use gst::prelude::*; mod imp; glib::wrapper! { - pub struct HangSink(ObjectSubclass) @extends gst_base::BaseSink, gst::Element, gst::Object; + pub struct MoqSink(ObjectSubclass) @extends gst_base::BaseSink, gst::Element, gst::Object; } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { - gst::Element::register(Some(plugin), "hangsink", gst::Rank::NONE, HangSink::static_type()) + gst::Element::register(Some(plugin), "moqsink", gst::Rank::NONE, MoqSink::static_type()) } diff --git a/src/source/imp.rs b/src/source/imp.rs index c68ab9f..aa1ff48 100644 --- a/src/source/imp.rs +++ b/src/source/imp.rs @@ -10,7 +10,7 @@ use std::sync::LazyLock; use std::sync::Mutex; static CAT: Lazy = - Lazy::new(|| gst::DebugCategory::new("hang-src", gst::DebugColorFlags::empty(), Some("Hang Source Element"))); + Lazy::new(|| gst::DebugCategory::new("moq-src", gst::DebugColorFlags::empty(), Some("MoQ Source Element"))); pub static RUNTIME: Lazy = Lazy::new(|| { tokio::runtime::Builder::new_multi_thread() @@ -28,14 +28,14 @@ struct Settings { } #[derive(Default)] -pub struct HangSrc { +pub struct MoqSrc { settings: Mutex, } #[glib::object_subclass] -impl ObjectSubclass for HangSrc { - const NAME: &'static str = "HangSrc"; - type Type = super::HangSrc; +impl ObjectSubclass for MoqSrc { + const NAME: &'static str = "MoqSrc"; + type Type = super::MoqSrc; type ParentType = gst::Bin; fn new() -> Self { @@ -43,10 +43,10 @@ impl ObjectSubclass for HangSrc { } } -impl GstObjectImpl for HangSrc {} -impl BinImpl for HangSrc {} +impl GstObjectImpl for MoqSrc {} +impl BinImpl for MoqSrc {} -impl ObjectImpl for HangSrc { +impl ObjectImpl for MoqSrc { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { vec![ @@ -91,7 +91,7 @@ impl ObjectImpl for HangSrc { } } -impl ElementImpl for HangSrc { +impl ElementImpl for MoqSrc { fn metadata() -> Option<&'static gst::subclass::ElementMetadata> { static ELEMENT_METADATA: Lazy = Lazy::new(|| { gst::subclass::ElementMetadata::new( @@ -156,7 +156,7 @@ impl ElementImpl for HangSrc { } } -impl HangSrc { +impl MoqSrc { async fn setup(&self) -> anyhow::Result<()> { let (client, url, name) = { let settings = self.settings.lock().unwrap(); diff --git a/src/source/mod.rs b/src/source/mod.rs index a398538..b41daca 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -4,9 +4,9 @@ use gst::prelude::*; mod imp; glib::wrapper! { - pub struct HangSrc(ObjectSubclass) @extends gst::Bin, gst::Element, gst::Object; + pub struct MoqSrc(ObjectSubclass) @extends gst::Bin, gst::Element, gst::Object; } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { - gst::Element::register(Some(plugin), "hangsrc", gst::Rank::NONE, HangSrc::static_type()) + gst::Element::register(Some(plugin), "moqsrc", gst::Rank::NONE, MoqSrc::static_type()) }