Update dependencies using the new Signall::builder API

This commit is contained in:
Thibault Saunier 2022-08-15 23:20:40 -04:00 committed by Mathieu Duponchelle
parent c0c0d42d9a
commit e0ad7e4c16
2 changed files with 310 additions and 259 deletions

454
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -2480,15 +2480,9 @@ impl ObjectImpl for WebRTCSink {
* This signal can be used to tweak @webrtcbin, creating a data * This signal can be used to tweak @webrtcbin, creating a data
* channel for example. * channel for example.
*/ */
glib::subclass::Signal::builder( glib::subclass::Signal::builder("consumer-added")
"consumer-added", .param_types([String::static_type(), gst::Element::static_type()])
&[ .build(),
String::static_type().into(),
gst::Element::static_type().into(),
],
glib::types::Type::UNIT.into(),
)
.build(),
/* /*
* RsWebRTCSink::consumer_removed: * RsWebRTCSink::consumer_removed:
* @consumer_id: Identifier of the consumer that was removed * @consumer_id: Identifier of the consumer that was removed
@ -2497,43 +2491,34 @@ impl ObjectImpl for WebRTCSink {
* This signal is emitted right after the connection with a consumer * This signal is emitted right after the connection with a consumer
* has been dropped. * has been dropped.
*/ */
glib::subclass::Signal::builder( glib::subclass::Signal::builder("consumer-removed")
"consumer-removed", .param_types([String::static_type(), gst::Element::static_type()])
&[ .build(),
String::static_type().into(),
gst::Element::static_type().into(),
],
glib::types::Type::UNIT.into(),
)
.build(),
/* /*
* RsWebRTCSink::get_consumers: * RsWebRTCSink::get_consumers:
* *
* List all consumers (by ID). * List all consumers (by ID).
*/ */
glib::subclass::Signal::builder( glib::subclass::Signal::builder("get-consumers")
"get-consumers", .action()
&[], .class_handler(|_, args| {
<Vec<String>>::static_type().into(), let element = args[0].get::<super::WebRTCSink>().expect("signal arg");
) let this = element.imp();
.action()
.class_handler(|_, args| {
let element = args[0].get::<super::WebRTCSink>().expect("signal arg");
let this = element.imp();
let res = Some( let res = Some(
this.state this.state
.lock() .lock()
.unwrap() .unwrap()
.consumers .consumers
.keys() .keys()
.cloned() .cloned()
.collect::<Vec<String>>() .collect::<Vec<String>>()
.to_value(), .to_value(),
); );
res res
}) })
.build(), .return_type::<Vec<String>>()
.build(),
/* /*
* RsWebRTCSink::encoder-setup: * RsWebRTCSink::encoder-setup:
* @consumer_id: Identifier of the consumer * @consumer_id: Identifier of the consumer
@ -2545,35 +2530,33 @@ impl ObjectImpl for WebRTCSink {
* Returns: True if the encoder is entirely configured, * Returns: True if the encoder is entirely configured,
* False to let other handlers run * False to let other handlers run
*/ */
glib::subclass::Signal::builder( glib::subclass::Signal::builder("encoder-setup")
"encoder-setup", .param_types([
&[ String::static_type(),
String::static_type().into(), String::static_type(),
String::static_type().into(), gst::Element::static_type(),
gst::Element::static_type().into(), ])
], .return_type::<bool>()
bool::static_type().into(), .accumulator(|_hint, _ret, value| !value.get::<bool>().unwrap())
) .class_handler(|_, args| {
.accumulator(|_hint, _ret, value| !value.get::<bool>().unwrap()) let element = args[0].get::<super::WebRTCSink>().expect("signal arg");
.class_handler(|_, args| { let enc = args[3].get::<gst::Element>().unwrap();
let element = args[0].get::<super::WebRTCSink>().expect("signal arg");
let enc = args[3].get::<gst::Element>().unwrap();
gst::debug!( gst::debug!(
CAT, CAT,
obj: &element, obj: &element,
"applying default configuration on encoder {:?}", "applying default configuration on encoder {:?}",
enc enc
); );
let this = element.imp(); let this = element.imp();
let settings = this.settings.lock().unwrap(); let settings = this.settings.lock().unwrap();
configure_encoder(&enc, settings.cc_info.start_bitrate); configure_encoder(&enc, settings.cc_info.start_bitrate);
// Return false here so that latter handlers get called // Return false here so that latter handlers get called
Some(false.to_value()) Some(false.to_value())
}) })
.build(), .build(),
] ]
}); });