diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-02-22 18:17:46 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-02-22 18:20:40 +0300 |
commit | 0616c1870381add9f4583718ff0b963cacf06f0e (patch) | |
tree | 577f3db565fed14a9354078733590738a727e23b | |
parent | 7c61fd9e7a836bc10d105fe46414f43c7c18f4dd (diff) |
Update for changed GLib signals API
-rw-r--r-- | generic/threadshare/src/appsrc/imp.rs | 6 | ||||
-rw-r--r-- | generic/threadshare/src/jitterbuffer/imp.rs | 32 | ||||
-rw-r--r-- | generic/threadshare/src/udpsink/imp.rs | 10 | ||||
-rw-r--r-- | generic/threadshare/tests/appsrc.rs | 24 | ||||
-rw-r--r-- | generic/threadshare/tests/jitterbuffer.rs | 4 | ||||
-rw-r--r-- | generic/threadshare/tests/pipeline.rs | 14 | ||||
-rw-r--r-- | generic/threadshare/tests/proxy.rs | 2 | ||||
-rw-r--r-- | generic/threadshare/tests/queue.rs | 2 | ||||
-rw-r--r-- | generic/threadshare/tests/tcpclientsrc.rs | 2 | ||||
-rw-r--r-- | generic/threadshare/tests/udpsink.rs | 22 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/imp.rs | 6 |
11 files changed, 68 insertions, 56 deletions
diff --git a/generic/threadshare/src/appsrc/imp.rs b/generic/threadshare/src/appsrc/imp.rs index e34ef3150..f264bb30b 100644 --- a/generic/threadshare/src/appsrc/imp.rs +++ b/generic/threadshare/src/appsrc/imp.rs @@ -584,8 +584,8 @@ impl ObjectImpl for AppSrc { vec![ glib::subclass::Signal::builder( "push-buffer", - &[gst::Buffer::static_type()], - bool::static_type(), + &[gst::Buffer::static_type().into()], + bool::static_type().into(), ) .action() .class_handler(|_, args| { @@ -602,7 +602,7 @@ impl ObjectImpl for AppSrc { Some(appsrc.push_buffer(&element, buffer).to_value()) }) .build(), - glib::subclass::Signal::builder("end-of-stream", &[], bool::static_type()) + glib::subclass::Signal::builder("end-of-stream", &[], bool::static_type().into()) .action() .class_handler(|_, args| { let element = args[0] diff --git a/generic/threadshare/src/jitterbuffer/imp.rs b/generic/threadshare/src/jitterbuffer/imp.rs index 19e376900..220273980 100644 --- a/generic/threadshare/src/jitterbuffer/imp.rs +++ b/generic/threadshare/src/jitterbuffer/imp.rs @@ -374,7 +374,7 @@ impl SinkHandler { if state.clock_rate.is_none() { drop(state); let caps = element - .emit("request-pt-map", &[&(pt as u32)]) + .emit_by_name("request-pt-map", &[&(pt as u32)]) .map_err(|_| gst::FlowError::Error)? .ok_or(gst::FlowError::Error)? .get::<gst::Caps>() @@ -1436,20 +1436,22 @@ impl ObjectImpl for JitterBuffer { fn signals() -> &'static [glib::subclass::Signal] { static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| { - vec![ - glib::subclass::Signal::builder("clear-pt-map", &[], glib::types::Type::Unit) - .action() - .class_handler(|_, args| { - let element = args[0] - .get::<super::JitterBuffer>() - .expect("signal arg") - .expect("missing signal arg"); - let jb = JitterBuffer::from_instance(&element); - jb.clear_pt_map(&element); - None - }) - .build(), - ] + vec![glib::subclass::Signal::builder( + "clear-pt-map", + &[], + glib::types::Type::Unit.into(), + ) + .action() + .class_handler(|_, args| { + let element = args[0] + .get::<super::JitterBuffer>() + .expect("signal arg") + .expect("missing signal arg"); + let jb = JitterBuffer::from_instance(&element); + jb.clear_pt_map(&element); + None + }) + .build()] }); SIGNALS.as_ref() diff --git a/generic/threadshare/src/udpsink/imp.rs b/generic/threadshare/src/udpsink/imp.rs index 7636709b3..3b31ac6f8 100644 --- a/generic/threadshare/src/udpsink/imp.rs +++ b/generic/threadshare/src/udpsink/imp.rs @@ -1116,8 +1116,8 @@ impl ObjectImpl for UdpSink { vec![ glib::subclass::Signal::builder( "add", - &[String::static_type(), i32::static_type()], - glib::types::Type::Unit, + &[String::static_type().into(), i32::static_type().into()], + glib::types::Type::Unit.into(), ) .action() .class_handler(|_, args| { @@ -1144,8 +1144,8 @@ impl ObjectImpl for UdpSink { .build(), glib::subclass::Signal::builder( "remove", - &[String::static_type(), i32::static_type()], - glib::types::Type::Unit, + &[String::static_type().into(), i32::static_type().into()], + glib::types::Type::Unit.into(), ) .action() .class_handler(|_, args| { @@ -1170,7 +1170,7 @@ impl ObjectImpl for UdpSink { None }) .build(), - glib::subclass::Signal::builder("clear", &[], glib::types::Type::Unit) + glib::subclass::Signal::builder("clear", &[], glib::types::Type::Unit.into()) .action() .class_handler(|_, args| { let element = args[0] diff --git a/generic/threadshare/tests/appsrc.rs b/generic/threadshare/tests/appsrc.rs index 976bca87f..1d99246fa 100644 --- a/generic/threadshare/tests/appsrc.rs +++ b/generic/threadshare/tests/appsrc.rs @@ -48,7 +48,7 @@ fn push() { let appsrc = h.get_element().unwrap(); for _ in 0..3 { assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() @@ -56,7 +56,7 @@ fn push() { } assert!(appsrc - .emit("end-of-stream", &[]) + .emit_by_name("end-of-stream", &[]) .unwrap() .unwrap() .get_some::<bool>() @@ -114,7 +114,7 @@ fn pause_regular() { // Initial buffer assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) + .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() .unwrap() .get_some::<bool>() @@ -124,7 +124,7 @@ fn pause_regular() { // Pre-pause buffer assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::from_slice(vec![5, 6, 7])]) + .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![5, 6, 7])]) .unwrap() .unwrap() .get_some::<bool>() @@ -136,7 +136,7 @@ fn pause_regular() { // Buffer is queued during Paused assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::from_slice(vec![8, 9])]) + .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![8, 9])]) .unwrap() .unwrap() .get_some::<bool>() @@ -154,7 +154,7 @@ fn pause_regular() { // Can push again assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() @@ -184,7 +184,7 @@ fn flush_regular() { // Initial buffer assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) + .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() .unwrap() .get_some::<bool>() @@ -197,7 +197,7 @@ fn flush_regular() { // Can't push buffer while flushing assert!(!appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() @@ -213,7 +213,7 @@ fn flush_regular() { // Can push again assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() @@ -245,7 +245,7 @@ fn pause_flush() { // Initial buffer assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) + .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() .unwrap() .get_some::<bool>() @@ -262,7 +262,7 @@ fn pause_flush() { // Can't push buffers while flushing assert!(!appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() @@ -282,7 +282,7 @@ fn pause_flush() { // Can push again assert!(appsrc - .emit("push-buffer", &[&gst::Buffer::new()]) + .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() .unwrap() .get_some::<bool>() diff --git a/generic/threadshare/tests/jitterbuffer.rs b/generic/threadshare/tests/jitterbuffer.rs index 431dddf89..a4e79ad80 100644 --- a/generic/threadshare/tests/jitterbuffer.rs +++ b/generic/threadshare/tests/jitterbuffer.rs @@ -79,7 +79,7 @@ fn jb_pipeline() { let (sender, receiver) = mpsc::channel(); appsink.connect_new_sample(move |appsink| { let _sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() @@ -146,7 +146,7 @@ fn jb_ts_pipeline() { let (sender, receiver) = mpsc::channel(); appsink.connect_new_sample(move |appsink| { let _sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs index 3b85012d0..7512f3048 100644 --- a/generic/threadshare/tests/pipeline.rs +++ b/generic/threadshare/tests/pipeline.rs @@ -88,7 +88,7 @@ fn multiple_contexts_queue() { let sender_clone = sender.clone(); appsink.connect_new_sample(move |appsink| { let _sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() @@ -247,7 +247,7 @@ fn multiple_contexts_proxy() { let sender_clone = sender.clone(); appsink.connect_new_sample(move |appsink| { let _sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() @@ -366,7 +366,7 @@ fn eos() { appsink.connect_new_sample(move |appsink| { gst_debug!(CAT, obj: appsink, "eos: pulling sample"); let _ = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() @@ -382,7 +382,7 @@ fn eos() { fn push_buffer(src: &gst::Element) -> bool { gst_debug!(CAT, obj: src, "eos: pushing buffer"); - src.emit("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) + src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) .unwrap() .unwrap() .get_some::<bool>() @@ -398,7 +398,7 @@ fn eos() { sample_notif_rcv.recv().unwrap(); assert!(src - .emit("end-of-stream", &[]) + .emit_by_name("end-of-stream", &[]) .unwrap() .unwrap() .get_some::<bool>() @@ -510,7 +510,7 @@ fn premature_shutdown() { appsink.connect_new_sample(move |appsink| { gst_debug!(CAT, obj: appsink, "premature_shutdown: pulling sample"); let _sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() @@ -529,7 +529,7 @@ fn premature_shutdown() { "premature_shutdown: pushing buffer {}", intent ); - src.emit("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) + src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) .unwrap() .unwrap() .get_some::<bool>() diff --git a/generic/threadshare/tests/proxy.rs b/generic/threadshare/tests/proxy.rs index 67bf59757..807175fc8 100644 --- a/generic/threadshare/tests/proxy.rs +++ b/generic/threadshare/tests/proxy.rs @@ -58,7 +58,7 @@ fn test_push() { let samples_clone = samples.clone(); appsink.connect_new_sample(move |appsink| { let sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() diff --git a/generic/threadshare/tests/queue.rs b/generic/threadshare/tests/queue.rs index 52a571034..cb8535026 100644 --- a/generic/threadshare/tests/queue.rs +++ b/generic/threadshare/tests/queue.rs @@ -53,7 +53,7 @@ fn test_push() { let samples_clone = samples.clone(); appsink.connect_new_sample(move |appsink| { let sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() diff --git a/generic/threadshare/tests/tcpclientsrc.rs b/generic/threadshare/tests/tcpclientsrc.rs index 899d8f7fa..7ad030261 100644 --- a/generic/threadshare/tests/tcpclientsrc.rs +++ b/generic/threadshare/tests/tcpclientsrc.rs @@ -75,7 +75,7 @@ fn test_push() { let samples_clone = samples.clone(); appsink.connect_new_sample(move |appsink| { let sample = appsink - .emit("pull-sample", &[]) + .emit_by_name("pull-sample", &[]) .unwrap() .unwrap() .get::<gst::Sample>() diff --git a/generic/threadshare/tests/udpsink.rs b/generic/threadshare/tests/udpsink.rs index b6bd7536e..ec04207dd 100644 --- a/generic/threadshare/tests/udpsink.rs +++ b/generic/threadshare/tests/udpsink.rs @@ -45,7 +45,9 @@ fn test_client_management() { assert_eq!(clients, "127.0.0.1:5004"); - udpsink.emit("add", &[&"192.168.1.1", &57i32]).unwrap(); + udpsink + .emit_by_name("add", &[&"192.168.1.1", &57i32]) + .unwrap(); let clients = udpsink .get_property("clients") .unwrap() @@ -55,7 +57,9 @@ fn test_client_management() { assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); /* Adding a client twice is not supported */ - udpsink.emit("add", &[&"192.168.1.1", &57i32]).unwrap(); + udpsink + .emit_by_name("add", &[&"192.168.1.1", &57i32]) + .unwrap(); let clients = udpsink .get_property("clients") .unwrap() @@ -64,7 +68,9 @@ fn test_client_management() { .unwrap(); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); - udpsink.emit("remove", &[&"192.168.1.1", &57i32]).unwrap(); + udpsink + .emit_by_name("remove", &[&"192.168.1.1", &57i32]) + .unwrap(); let clients = udpsink .get_property("clients") .unwrap() @@ -74,7 +80,9 @@ fn test_client_management() { assert_eq!(clients, "127.0.0.1:5004"); /* Removing a non-existing client should not be a problem */ - udpsink.emit("remove", &[&"192.168.1.1", &57i32]).unwrap(); + udpsink + .emit_by_name("remove", &[&"192.168.1.1", &57i32]) + .unwrap(); let clients = udpsink .get_property("clients") .unwrap() @@ -84,7 +92,9 @@ fn test_client_management() { assert_eq!(clients, "127.0.0.1:5004"); /* Removing the default client is possible */ - udpsink.emit("remove", &[&"127.0.0.1", &5004i32]).unwrap(); + udpsink + .emit_by_name("remove", &[&"127.0.0.1", &5004i32]) + .unwrap(); let clients = udpsink .get_property("clients") .unwrap() @@ -105,7 +115,7 @@ fn test_client_management() { .unwrap(); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); - udpsink.emit("clear", &[]).unwrap(); + udpsink.emit_by_name("clear", &[]).unwrap(); let clients = udpsink .get_property("clients") .unwrap() diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 4961bb29c..2280016ec 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -557,8 +557,8 @@ impl ObjectImpl for FallbackSrc { static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| { vec![glib::subclass::Signal::builder( "update-uri", - &[String::static_type()], - String::static_type(), + &[String::static_type().into()], + String::static_type().into(), ) .action() .class_handler(|_token, args| { @@ -696,7 +696,7 @@ impl FallbackSrc { .expect("No uridecodebin3 found"); let uri = element - .emit("update-uri", &[uri]) + .emit_by_name("update-uri", &[uri]) .expect("Failed to emit update-uri signal") .expect("No value returned"); let uri = uri |