From 15061eb5844b069687cab719a4b8bbeabd5b65b5 Mon Sep 17 00:00:00 2001 From: Jordan Yelloz Date: Fri, 19 Jan 2024 15:34:14 -0700 Subject: [PATCH] webrtcsink: Added MID and RID pad properties --- docs/plugins/gst_plugins_cache.json | 24 ++++++++++++++++++++++ net/webrtc/src/webrtcsink/pad.rs | 32 +++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 3d4a22b6..a303a249 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -8742,6 +8742,18 @@ ], "kind": "object", "properties": { + "mid": { + "blurb": "The Media Identification (MID) value to produce from this pad", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "ready", + "readable": true, + "type": "gchararray", + "writable": true + }, "msid": { "blurb": "Remote MediaStream ID in use for this pad", "conditionally-available": false, @@ -8753,6 +8765,18 @@ "readable": true, "type": "gchararray", "writable": true + }, + "rid": { + "blurb": "The RtpStreamId (RID) value to produce from this pad", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "ready", + "readable": true, + "type": "gchararray", + "writable": true } } }, diff --git a/net/webrtc/src/webrtcsink/pad.rs b/net/webrtc/src/webrtcsink/pad.rs index 55d12ac7..e20bd766 100644 --- a/net/webrtc/src/webrtcsink/pad.rs +++ b/net/webrtc/src/webrtcsink/pad.rs @@ -12,6 +12,8 @@ pub struct WebRTCSinkPad { #[derive(Debug, Default)] struct Settings { msid: Option, + mid: Option, + rid: Option, } #[glib::object_subclass] @@ -24,10 +26,20 @@ impl ObjectSubclass for WebRTCSinkPad { impl ObjectImpl for WebRTCSinkPad { fn properties() -> &'static [glib::ParamSpec] { static PROPS: Lazy> = Lazy::new(|| { - vec![glib::ParamSpecString::builder("msid") - .flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY) - .blurb("Remote MediaStream ID in use for this pad") - .build()] + vec![ + glib::ParamSpecString::builder("msid") + .flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY) + .blurb("Remote MediaStream ID in use for this pad") + .build(), + glib::ParamSpecString::builder("mid") + .flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY) + .blurb("The Media Identification (MID) value to produce from this pad") + .build(), + glib::ParamSpecString::builder("rid") + .flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY) + .blurb("The RtpStreamId (RID) value to produce from this pad") + .build(), + ] }); PROPS.as_ref() } @@ -39,6 +51,16 @@ impl ObjectImpl for WebRTCSinkPad { .get::>() .expect("type checked upstream") } + "mid" => { + settings.mid = value + .get::>() + .expect("type checked upstream") + } + "rid" => { + settings.rid = value + .get::>() + .expect("type checked upstream") + } name => panic!("no writable property {name:?}"), } } @@ -46,6 +68,8 @@ impl ObjectImpl for WebRTCSinkPad { let settings = self.settings.lock().unwrap(); match pspec.name() { "msid" => settings.msid.to_value(), + "mid" => settings.mid.to_value(), + "rid" => settings.rid.to_value(), name => panic!("no readable property {name:?}"), } }