webrtcsink: Added MID and RID pad properties

This commit is contained in:
Jordan Yelloz 2024-01-19 15:34:14 -07:00
parent 542030fd82
commit 15061eb584
No known key found for this signature in database
2 changed files with 52 additions and 4 deletions

View file

@ -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
}
}
},

View file

@ -12,6 +12,8 @@ pub struct WebRTCSinkPad {
#[derive(Debug, Default)]
struct Settings {
msid: Option<String>,
mid: Option<String>,
rid: Option<String>,
}
#[glib::object_subclass]
@ -24,10 +26,20 @@ impl ObjectSubclass for WebRTCSinkPad {
impl ObjectImpl for WebRTCSinkPad {
fn properties() -> &'static [glib::ParamSpec] {
static PROPS: Lazy<Vec<glib::ParamSpec>> = 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::<Option<String>>()
.expect("type checked upstream")
}
"mid" => {
settings.mid = value
.get::<Option<String>>()
.expect("type checked upstream")
}
"rid" => {
settings.rid = value
.get::<Option<String>>()
.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:?}"),
}
}