Update for GLib signal API changes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1936>
This commit is contained in:
Sebastian Dröge 2024-11-22 15:52:41 +02:00
parent dc056213c6
commit 347bee16d4
18 changed files with 39 additions and 39 deletions

View file

@ -125,7 +125,7 @@ impl ObjectImpl for EbuR128Level {
static SIGNALS: LazyLock<Vec<glib::subclass::Signal>> = LazyLock::new(|| {
vec![glib::subclass::Signal::builder("reset")
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let this = args[0].get::<super::EbuR128Level>().unwrap();
let imp = this.imp();

View file

@ -485,7 +485,7 @@ impl ObjectImpl for AppSrc {
.param_types([gst::Buffer::static_type()])
.return_type::<bool>()
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::AppSrc>().expect("signal arg");
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
@ -501,7 +501,7 @@ impl ObjectImpl for AppSrc {
glib::subclass::Signal::builder("end-of-stream")
.return_type::<bool>()
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::AppSrc>().expect("signal arg");
Some(elem.imp().end_of_stream().to_value())

View file

@ -1380,7 +1380,7 @@ impl ObjectImpl for JitterBuffer {
vec![
glib::subclass::Signal::builder("clear-pt-map")
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
let jb = element.imp();
jb.clear_pt_map();

View file

@ -1109,7 +1109,7 @@ impl ObjectImpl for UdpSink {
glib::subclass::Signal::builder("add")
.param_types([String::static_type(), i32::static_type()])
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::UdpSink>().expect("signal arg");
let host = args[1].get::<String>().expect("signal arg");
let port = args[2].get::<i32>().expect("signal arg");
@ -1125,7 +1125,7 @@ impl ObjectImpl for UdpSink {
glib::subclass::Signal::builder("remove")
.param_types([String::static_type(), i32::static_type()])
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::UdpSink>().expect("signal arg");
let host = args[1].get::<String>().expect("signal arg");
let port = args[2].get::<i32>().expect("signal arg");
@ -1140,7 +1140,7 @@ impl ObjectImpl for UdpSink {
.build(),
glib::subclass::Signal::builder("clear")
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::UdpSink>().expect("signal arg");
let imp = elem.imp();

View file

@ -3252,7 +3252,7 @@ impl ObjectImpl for FMP4Mux {
vec![
glib::subclass::Signal::builder(FMP4_SIGNAL_SEND_HEADERS)
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let element = args[0].get::<super::FMP4Mux>().expect("signal arg");
let imp = element.imp();
let mut state = imp.state.lock().unwrap();
@ -3270,7 +3270,7 @@ impl ObjectImpl for FMP4Mux {
glib::subclass::Signal::builder(FMP4_SIGNAL_SPLIT_AT_RUNNING_TIME)
.param_types([gst::ClockTime::static_type()])
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let element = args[0].get::<super::FMP4Mux>().expect("signal arg");
let imp = element.imp();
let mut state = imp.state.lock().unwrap();

View file

@ -204,7 +204,7 @@ impl ObjectImpl for HlsBaseSink {
glib::subclass::Signal::builder(SIGNAL_GET_PLAYLIST_STREAM)
.param_types([String::static_type()])
.return_type::<Option<gio::OutputStream>>()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::HlsBaseSink>().expect("signal arg");
let playlist_location = args[1].get::<String>().expect("signal arg");
let imp = elem.imp();
@ -220,7 +220,7 @@ impl ObjectImpl for HlsBaseSink {
glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM)
.param_types([String::static_type()])
.return_type::<Option<gio::OutputStream>>()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::HlsBaseSink>().expect("signal arg");
let fragment_location = args[1].get::<String>().expect("signal arg");
let imp = elem.imp();
@ -236,7 +236,7 @@ impl ObjectImpl for HlsBaseSink {
glib::subclass::Signal::builder(SIGNAL_DELETE_FRAGMENT)
.param_types([String::static_type()])
.return_type::<bool>()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<super::HlsBaseSink>().expect("signal arg");
let fragment_location = args[1].get::<String>().expect("signal arg");
let imp = elem.imp();

View file

@ -225,7 +225,7 @@ impl ObjectImpl for HlsCmafSink {
glib::subclass::Signal::builder(SIGNAL_GET_INIT_STREAM)
.param_types([String::static_type()])
.return_type::<Option<gio::OutputStream>>()
.class_handler(|_, args| {
.class_handler(|args| {
let elem = args[0].get::<HlsBaseSink>().expect("signal arg");
let init_location = args[1].get::<String>().expect("signal arg");
let imp = elem.imp();
@ -240,7 +240,7 @@ impl ObjectImpl for HlsCmafSink {
.build(),
glib::subclass::Signal::builder(SIGNAL_NEW_PLAYLIST)
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
// Forces hlscmafsink to finish the current playlist and start a new one.
// Meant to be used after changing output location at runtime, which would
// otherwise require changing playback state to READY to make sure that the

View file

@ -1936,7 +1936,7 @@ impl ObjectImpl for RtpBaseDepay2 {
glib::subclass::Signal::builder("add-extension")
.action()
.param_types([gst_rtp::RTPHeaderExtension::static_type()])
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBaseDepay2>().unwrap();
let ext = args[1].get::<&gst_rtp::RTPHeaderExtension>().unwrap();
s.imp().add_extension(ext);
@ -1955,7 +1955,7 @@ impl ObjectImpl for RtpBaseDepay2 {
true
}
})
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBaseDepay2>().unwrap();
let ext_id = args[1].get::<u32>().unwrap();
let uri = args[2].get::<&str>().unwrap();
@ -1966,7 +1966,7 @@ impl ObjectImpl for RtpBaseDepay2 {
.build(),
glib::subclass::Signal::builder("clear-extensions")
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBaseDepay2>().unwrap();
s.imp().clear_extensions();

View file

@ -1974,7 +1974,7 @@ impl ObjectImpl for RtpBasePay2 {
glib::subclass::Signal::builder("add-extension")
.action()
.param_types([gst_rtp::RTPHeaderExtension::static_type()])
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBasePay2>().unwrap();
let ext = args[1].get::<&gst_rtp::RTPHeaderExtension>().unwrap();
s.imp().add_extension(ext);
@ -1993,7 +1993,7 @@ impl ObjectImpl for RtpBasePay2 {
true
}
})
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBasePay2>().unwrap();
let ext_id = args[1].get::<u32>().unwrap();
let uri = args[2].get::<&str>().unwrap();
@ -2004,7 +2004,7 @@ impl ObjectImpl for RtpBasePay2 {
.build(),
glib::subclass::Signal::builder("clear-extensions")
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let s = args[0].get::<super::RtpBasePay2>().unwrap();
s.imp().clear_extensions();

View file

@ -1659,7 +1659,7 @@ impl ObjectImpl for RtpRecv {
.param_types([u32::static_type()])
.return_type::<crate::rtpbin2::config::Rtp2Session>()
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let element = args[0].get::<super::RtpRecv>().expect("signal arg");
let id = args[1].get::<u32>().expect("signal arg");
let bin = element.imp();

View file

@ -595,7 +595,7 @@ impl ObjectImpl for RtpSend {
.param_types([u32::static_type()])
.return_type::<crate::rtpbin2::config::Rtp2Session>()
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let element = args[0].get::<super::RtpSend>().expect("signal arg");
let id = args[1].get::<u32>().expect("signal arg");
let send = element.imp();

View file

@ -159,7 +159,7 @@ impl prelude::ObjectInterface for Signallable {
*/
Signal::builder("request-meta")
.return_type::<Option<gst::Structure>>()
.class_handler(|_token, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -215,7 +215,7 @@ impl prelude::ObjectInterface for Signallable {
Signal::builder("start")
.run_last()
.return_type::<bool>()
.class_handler(|_token, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -241,7 +241,7 @@ impl prelude::ObjectInterface for Signallable {
Signal::builder("stop")
.run_last()
.return_type::<bool>()
.class_handler(|_tokens, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -276,7 +276,7 @@ impl prelude::ObjectInterface for Signallable {
.run_last()
.param_types([str::static_type()])
.return_type::<bool>()
.class_handler(|_tokens, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -341,7 +341,7 @@ impl prelude::ObjectInterface for Signallable {
gst_webrtc::WebRTCSessionDescription::static_type(),
])
.return_type::<gst_webrtc::WebRTCSessionDescription>()
.class_handler(|_tokens, args| {
.class_handler(|args| {
let _ = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -378,7 +378,7 @@ impl prelude::ObjectInterface for Signallable {
gst_webrtc::WebRTCSessionDescription::static_type(),
])
.return_type::<bool>()
.class_handler(|_tokens, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {
@ -421,7 +421,7 @@ impl prelude::ObjectInterface for Signallable {
String::static_type(),
])
.return_type::<bool>()
.class_handler(|_tokens, args| {
.class_handler(|args| {
let this = args[0usize]
.get::<&super::Signallable>()
.unwrap_or_else(|e| {

View file

@ -4864,7 +4864,7 @@ impl ObjectImpl for BaseWebRTCSink {
*/
glib::subclass::Signal::builder("get-sessions")
.action()
.class_handler(|_, args| {
.class_handler(|args| {
let element = args[0].get::<super::BaseWebRTCSink>().expect("signal arg");
let this = element.imp();
@ -4902,7 +4902,7 @@ impl ObjectImpl for BaseWebRTCSink {
])
.return_type::<bool>()
.accumulator(setup_signal_accumulator)
.class_handler(|_, args| {
.class_handler(|args| {
let element = args[0].get::<super::BaseWebRTCSink>().expect("signal arg");
let enc = args[3].get::<gst::Element>().unwrap();
@ -4947,7 +4947,7 @@ impl ObjectImpl for BaseWebRTCSink {
])
.return_type::<bool>()
.accumulator(setup_signal_accumulator)
.class_handler(|_, args| {
.class_handler(|args| {
let pay = args[3].get::<gst::Element>().unwrap();
configure_payloader(&pay);
@ -5014,7 +5014,7 @@ impl ObjectImpl for BaseWebRTCSink {
])
.return_type::<gst::Structure>()
.run_last()
.class_handler(|_token, args| {
.class_handler(|args| {
Some(args[3usize].get::<gst::Structure>().expect("wrong argument").to_value())
})
.accumulator(move |_hint, output, input| {

View file

@ -2061,7 +2061,7 @@ pub(super) mod livekit {
vec![glib::subclass::Signal::builder("set-track-disabled")
.param_types([bool::static_type()])
.action()
.class_handler(|_token, values| {
.class_handler(|values| {
let pad = values[0]
.get::<&super::super::LiveKitWebRTCSrcPad>()
.unwrap();

View file

@ -662,7 +662,7 @@ impl ObjectImpl for FallbackSrc {
glib::subclass::Signal::builder("update-uri")
.param_types([String::static_type()])
.return_type::<String>()
.class_handler(|_token, args| {
.class_handler(|args| {
// Simply return the input by default
Some(args[1].clone())
})
@ -674,7 +674,7 @@ impl ObjectImpl for FallbackSrc {
.build(),
glib::subclass::Signal::builder("unblock")
.action()
.class_handler(|_token, args| {
.class_handler(|args| {
let element = args[0].get::<super::FallbackSrc>().expect("signal arg");
let imp = element.imp();
let mut state_guard = imp.state.lock();

View file

@ -237,7 +237,7 @@ impl ObjectImpl for BufferLateness {
vec![glib::subclass::Signal::builder("write-log")
.action()
.param_types([Option::<String>::static_type()])
.class_handler(|_, args| {
.class_handler(|args| {
let obj = args[0].get::<super::BufferLateness>().unwrap();
obj.imp().write_log(args[1].get::<Option<&str>>().unwrap());

View file

@ -341,7 +341,7 @@ impl ObjectImpl for PipelineSnapshot {
static SIGNALS: LazyLock<Vec<glib::subclass::Signal>> = LazyLock::new(|| {
vec![glib::subclass::Signal::builder("snapshot")
.action()
.class_handler(|_, args| {
.class_handler(|args| {
args[0].get::<super::PipelineSnapshot>().unwrap().snapshot();
None

View file

@ -245,7 +245,7 @@ impl ObjectImpl for QueueLevels {
vec![glib::subclass::Signal::builder("write-log")
.action()
.param_types([Option::<String>::static_type()])
.class_handler(|_, args| {
.class_handler(|args| {
let obj = args[0].get::<super::QueueLevels>().unwrap();
obj.imp().write_log(args[1].get::<Option<&str>>().unwrap());