Commit 4561b0bc authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Sebastian Dröge

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.
parent 331374fa
Pipeline #207587 passed with stages
in 14 minutes and 11 seconds
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment