mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-01 23:08:42 +00:00
utils/fallbacksrc: Add update-uri signal
This allows to update the URI just before configuring it on uridecodebin3. It might be necessary to update the original URI because it expired in the meantime, for example.
This commit is contained in:
parent
331374fabe
commit
4561b0bc3c
1 changed files with 23 additions and 0 deletions
|
@ -313,6 +313,21 @@ impl ObjectSubclass for FallbackSrc {
|
|||
klass.add_pad_template(src_pad_template);
|
||||
|
||||
klass.install_properties(&PROPERTIES);
|
||||
|
||||
klass.add_signal_with_class_handler_and_accumulator(
|
||||
"update-uri",
|
||||
glib::SignalFlags::RUN_LAST | glib::SignalFlags::ACTION,
|
||||
&[String::static_type()],
|
||||
String::static_type(),
|
||||
|_token, args| {
|
||||
// Simplify return the input by default
|
||||
Some(args[1].clone())
|
||||
},
|
||||
|_hint, ret, value| {
|
||||
*ret = value.clone();
|
||||
false
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -648,6 +663,14 @@ impl FallbackSrc {
|
|||
let source = gst::ElementFactory::make("uridecodebin3", Some("uridecodebin"))
|
||||
.expect("No uridecodebin3 found");
|
||||
|
||||
let uri = element
|
||||
.emit("update-uri", &[uri])
|
||||
.expect("Failed to emit update-uri signal")
|
||||
.expect("No value returned");
|
||||
let uri = uri
|
||||
.get::<&str>()
|
||||
.expect("Wrong type returned from update-uri signal");
|
||||
|
||||
source.set_property("uri", &uri).unwrap();
|
||||
source.set_property("use-buffering", &true).unwrap();
|
||||
source
|
||||
|
|
Loading…
Reference in a new issue