Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
18 changes: 9 additions & 9 deletions src/sink/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ struct State {
}

#[derive(Default)]
pub struct HangSink {
pub struct MoqSink {
settings: Mutex<Settings>,
state: Arc<Mutex<State>>,
}

#[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 {
Self::default()
}
}

impl ObjectImpl for HangSink {
impl ObjectImpl for MoqSink {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
Expand Down Expand Up @@ -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<gst::subclass::ElementMetadata> = Lazy::new(|| {
gst::subclass::ElementMetadata::new(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -164,7 +164,7 @@ impl BaseSinkImpl for HangSink {
}
}

impl HangSink {
impl MoqSink {
fn setup(&self) -> anyhow::Result<()> {
let settings = self.settings.lock().unwrap();

Expand Down
4 changes: 2 additions & 2 deletions src/sink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use gst::prelude::*;
mod imp;

glib::wrapper! {
pub struct HangSink(ObjectSubclass<imp::HangSink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
pub struct MoqSink(ObjectSubclass<imp::MoqSink>) @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())
}
20 changes: 10 additions & 10 deletions src/source/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::LazyLock;
use std::sync::Mutex;

static CAT: Lazy<gst::DebugCategory> =
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<tokio::runtime::Runtime> = Lazy::new(|| {
tokio::runtime::Builder::new_multi_thread()
Expand All @@ -28,25 +28,25 @@ struct Settings {
}

#[derive(Default)]
pub struct HangSrc {
pub struct MoqSrc {
settings: Mutex<Settings>,
}

#[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 {
Self::default()
}
}

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<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
Expand Down Expand Up @@ -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<gst::subclass::ElementMetadata> = Lazy::new(|| {
gst::subclass::ElementMetadata::new(
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use gst::prelude::*;
mod imp;

glib::wrapper! {
pub struct HangSrc(ObjectSubclass<imp::HangSrc>) @extends gst::Bin, gst::Element, gst::Object;
pub struct MoqSrc(ObjectSubclass<imp::MoqSrc>) @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())
}