diff --git a/gstreamer-base/src/auto/functions.rs b/gstreamer-base/src/auto/functions.rs index 98edcec45..3a8ed004d 100644 --- a/gstreamer-base/src/auto/functions.rs +++ b/gstreamer-base/src/auto/functions.rs @@ -53,11 +53,11 @@ pub fn type_find_helper_for_extension>(obj: Option<&P>, exte } } -//pub fn type_find_helper_get_range, Q: IsA, R: FnMut(&gst::Object, &Option, u64, u32, &gst::Buffer) -> gst::FlowReturn>(obj: &P, parent: Option<&Q>, func: R, size: u64, extension: Option<&str>) -> (Option, gst::TypeFindProbability) { +//pub fn type_find_helper_get_range, Q: IsA, R: FnMut(&gst::Object, Option<&gst::Object>, u64, u32, &gst::Buffer) -> gst::FlowReturn>(obj: &P, parent: Option<&Q>, func: R, size: u64, extension: Option<&str>) -> (Option, gst::TypeFindProbability) { // unsafe { TODO: call gst_base_sys:gst_type_find_helper_get_range() } //} //#[cfg(any(feature = "v1_14_3", feature = "dox"))] -//pub fn type_find_helper_get_range_full, Q: IsA, R: FnMut(&gst::Object, &Option, u64, u32, &gst::Buffer) -> gst::FlowReturn>(obj: &P, parent: Option<&Q>, func: R, size: u64, extension: Option<&str>) -> (gst::FlowReturn, gst::Caps, gst::TypeFindProbability) { +//pub fn type_find_helper_get_range_full, Q: IsA, R: FnMut(&gst::Object, Option<&gst::Object>, u64, u32, &gst::Buffer) -> gst::FlowReturn>(obj: &P, parent: Option<&Q>, func: R, size: u64, extension: Option<&str>) -> (gst::FlowReturn, gst::Caps, gst::TypeFindProbability) { // unsafe { TODO: call gst_base_sys:gst_type_find_helper_get_range_full() } //} diff --git a/gstreamer-pbutils/src/auto/discoverer.rs b/gstreamer-pbutils/src/auto/discoverer.rs index 69fab2e5c..4771f74e0 100644 --- a/gstreamer-pbutils/src/auto/discoverer.rs +++ b/gstreamer-pbutils/src/auto/discoverer.rs @@ -83,7 +83,7 @@ impl Discoverer { } } - pub fn connect_discovered) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + pub fn connect_discovered) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"discovered\0".as_ptr() as *const _, @@ -128,9 +128,9 @@ impl Discoverer { unsafe impl Send for Discoverer {} unsafe impl Sync for Discoverer {} -unsafe extern "C" fn discovered_trampoline) + Send + Sync + 'static>(this: *mut gst_pbutils_sys::GstDiscoverer, info: *mut gst_pbutils_sys::GstDiscovererInfo, error: *mut glib_sys::GError, f: glib_sys::gpointer) { +unsafe extern "C" fn discovered_trampoline) + Send + Sync + 'static>(this: *mut gst_pbutils_sys::GstDiscoverer, info: *mut gst_pbutils_sys::GstDiscovererInfo, error: *mut glib_sys::GError, f: glib_sys::gpointer) { let f: &F = &*(f as *const F); - f(&from_glib_borrow(this), &from_glib_borrow(info), &from_glib_borrow(error)) + f(&from_glib_borrow(this), &from_glib_borrow(info), Option::::from_glib_borrow(error).as_ref()) } unsafe extern "C" fn finished_trampoline(this: *mut gst_pbutils_sys::GstDiscoverer, f: glib_sys::gpointer) { diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index d50cf7f19..422c7db50 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -166,65 +166,65 @@ pub trait PadExtManual: 'static { fn set_activate_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) -> Result<(), LoggableError> + Send + Sync + 'static; + F: Fn(&Self, Option<&::Object>) -> Result<(), LoggableError> + Send + Sync + 'static; fn set_activatemode_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::PadMode, bool) -> Result<(), LoggableError> + F: Fn(&Self, Option<&::Object>, ::PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static; fn set_chain_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Buffer) -> Result + F: Fn(&Self, Option<&::Object>, ::Buffer) -> Result + Send + Sync + 'static; fn set_chain_list_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::BufferList) -> Result + F: Fn(&Self, Option<&::Object>, ::BufferList) -> Result + Send + Sync + 'static; fn set_event_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Event) -> bool + Send + Sync + 'static; + F: Fn(&Self, Option<&::Object>, ::Event) -> bool + Send + Sync + 'static; fn set_event_full_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Event) -> Result + F: Fn(&Self, Option<&::Object>, ::Event) -> Result + Send + Sync + 'static; fn set_getrange_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowError> + F: Fn(&Self, Option<&::Object>, u64, u32) -> Result<::Buffer, ::FlowError> + Send + Sync + 'static; fn set_iterate_internal_links_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) -> ::Iterator + Send + Sync + 'static; + F: Fn(&Self, Option<&::Object>) -> ::Iterator + Send + Sync + 'static; fn set_link_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + F: Fn(&Self, Option<&::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + Send + Sync + 'static; fn set_query_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static; + F: Fn(&Self, Option<&::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static; fn set_unlink_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) + Send + Sync + 'static; + F: Fn(&Self, Option<&::Object>) + Send + Sync + 'static; fn start_task(&self, func: F) -> Result<(), glib::BoolError>; @@ -522,7 +522,7 @@ impl> PadExtManual for O { fn set_activate_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, + F: Fn(&Self, Option<&::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, { #[allow(clippy::type_complexity)] unsafe { @@ -538,7 +538,7 @@ impl> PadExtManual for O { fn set_activatemode_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::PadMode, bool) -> Result<(), LoggableError> + F: Fn(&Self, Option<&::Object>, ::PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static, @@ -557,7 +557,7 @@ impl> PadExtManual for O { fn set_chain_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Buffer) -> Result + F: Fn(&Self, Option<&::Object>, ::Buffer) -> Result + Send + Sync + 'static, @@ -575,7 +575,7 @@ impl> PadExtManual for O { fn set_chain_list_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::BufferList) -> Result + F: Fn(&Self, Option<&::Object>, ::BufferList) -> Result + Send + Sync + 'static, @@ -593,7 +593,7 @@ impl> PadExtManual for O { fn set_event_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Event) -> bool + Send + Sync + 'static, + F: Fn(&Self, Option<&::Object>, ::Event) -> bool + Send + Sync + 'static, { unsafe { let func_box: Box = Box::new(func); @@ -608,7 +608,7 @@ impl> PadExtManual for O { fn set_event_full_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, ::Event) -> Result + F: Fn(&Self, Option<&::Object>, ::Event) -> Result + Send + Sync + 'static, @@ -626,7 +626,7 @@ impl> PadExtManual for O { fn set_getrange_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, u64, u32) -> Result<::Buffer, FlowError> + F: Fn(&Self, Option<&::Object>, u64, u32) -> Result<::Buffer, FlowError> + Send + Sync + 'static, @@ -644,7 +644,7 @@ impl> PadExtManual for O { fn set_iterate_internal_links_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) -> ::Iterator + Send + Sync + 'static, + F: Fn(&Self, Option<&::Object>) -> ::Iterator + Send + Sync + 'static, { unsafe { let func_box: Box = Box::new(func); @@ -659,7 +659,7 @@ impl> PadExtManual for O { fn set_link_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + F: Fn(&Self, Option<&::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + Send + Sync + 'static, @@ -677,7 +677,7 @@ impl> PadExtManual for O { fn set_query_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static, + F: Fn(&Self, Option<&::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static, { unsafe { let func_box: Box = Box::new(func); @@ -692,7 +692,7 @@ impl> PadExtManual for O { fn set_unlink_function(&self, func: F) where - F: Fn(&Self, &Option<::Object>) + Send + Sync + 'static, + F: Fn(&Self, Option<&::Object>) + Send + Sync + 'static, { unsafe { let func_box: Box = Box::new(func); @@ -1139,7 +1139,7 @@ where unsafe extern "C" fn trampoline_activate_function< T, - F: Fn(&T, &Option<::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1151,7 +1151,7 @@ where match func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), ) { Ok(()) => true, Err(err) => { @@ -1164,7 +1164,7 @@ where unsafe extern "C" fn trampoline_activatemode_function< T, - F: Fn(&T, &Option<::Object>, ::PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, ::PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1178,7 +1178,7 @@ where match func( &&Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), from_glib(mode), from_glib(active), ) { @@ -1193,7 +1193,7 @@ where unsafe extern "C" fn trampoline_chain_function< T, - F: Fn(&T, &Option<::Object>, ::Buffer) -> Result + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, ::Buffer) -> Result + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1206,7 +1206,7 @@ where let res: FlowReturn = func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), from_glib_full(buffer), ) .into(); @@ -1215,7 +1215,7 @@ where unsafe extern "C" fn trampoline_chain_list_function< T, - F: Fn(&T, &Option<::Object>, ::BufferList) -> Result + F: Fn(&T, Option<&::Object>, ::BufferList) -> Result + Send + Sync + 'static, @@ -1231,7 +1231,7 @@ where let res: FlowReturn = func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), from_glib_full(list), ) .into(); @@ -1240,7 +1240,7 @@ where unsafe extern "C" fn trampoline_event_function< T, - F: Fn(&T, &Option<::Object>, ::Event) -> bool + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, ::Event) -> bool + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1253,7 +1253,7 @@ where func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), from_glib_full(event), ) .to_glib() @@ -1261,7 +1261,7 @@ where unsafe extern "C" fn trampoline_event_full_function< T, - F: Fn(&T, &Option<::Object>, ::Event) -> Result + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, ::Event) -> Result + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1274,7 +1274,7 @@ where let res: FlowReturn = func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), from_glib_full(event), ) .into(); @@ -1283,7 +1283,7 @@ where unsafe extern "C" fn trampoline_getrange_function< T, - F: Fn(&T, &Option<::Object>, u64, u32) -> Result<::Buffer, FlowError> + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, u64, u32) -> Result<::Buffer, FlowError> + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1298,7 +1298,7 @@ where match func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), offset, length, ) { @@ -1312,7 +1312,7 @@ where unsafe extern "C" fn trampoline_iterate_internal_links_function< T, - F: Fn(&T, &Option<::Object>) -> ::Iterator + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>) -> ::Iterator + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1325,7 +1325,7 @@ where // Steal the iterator and return it let ret = func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), ); let ptr = ret.to_glib_none().0; mem::forget(ret); @@ -1335,7 +1335,7 @@ where unsafe extern "C" fn trampoline_link_function< T, - F: Fn(&T, &Option<::Object>, &::Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + F: Fn(&T, Option<&::Object>, &::Pad) -> Result<::PadLinkSuccess, ::PadLinkError> + Send + Sync + 'static, @@ -1351,7 +1351,7 @@ where let res: ::PadLinkReturn = func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), &from_glib_borrow(peer), ) .into(); @@ -1360,7 +1360,7 @@ where unsafe extern "C" fn trampoline_query_function< T, - F: Fn(&T, &Option<::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1373,7 +1373,7 @@ where func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), ::QueryRef::from_mut_ptr(query), ) .to_glib() @@ -1381,7 +1381,7 @@ where unsafe extern "C" fn trampoline_unlink_function< T, - F: Fn(&T, &Option<::Object>) + Send + Sync + 'static, + F: Fn(&T, Option<&::Object>) + Send + Sync + 'static, >( pad: *mut gst_sys::GstPad, parent: *mut gst_sys::GstObject, @@ -1392,7 +1392,7 @@ unsafe extern "C" fn trampoline_unlink_function< func( &Pad::from_glib_borrow(pad).unsafe_cast(), - &from_glib_borrow(parent), + Option::<::Object>::from_glib_borrow(parent).as_ref(), ) } diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index 13942532c..0b72d296e 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -156,7 +156,7 @@ impl SampleRef { } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn set_segment(&mut self, segment: &Option<&Segment>) { + pub fn set_segment(&mut self, segment: Option<&Segment>) { unsafe { gst_sys::gst_sample_set_segment(self.as_mut_ptr(), segment.to_glib_none().0) } } diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 173d6461e..72f67dd4b 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -100,7 +100,7 @@ pub trait ElementImplExt { ) -> R; fn catch_panic_pad_function R, G: FnOnce() -> R>( - parent: &Option<::Object>, + parent: Option<&::Object>, fallback: G, f: F, ) -> R; @@ -222,7 +222,7 @@ where } fn catch_panic_pad_function R, G: FnOnce() -> R>( - parent: &Option<::Object>, + parent: Option<&::Object>, fallback: G, f: F, ) -> R { diff --git a/tutorials/src/bin/basic-tutorial-9.rs b/tutorials/src/bin/basic-tutorial-9.rs index 2dbdaa57f..eef229fbf 100644 --- a/tutorials/src/bin/basic-tutorial-9.rs +++ b/tutorials/src/bin/basic-tutorial-9.rs @@ -81,10 +81,10 @@ fn print_topology(info: &DiscovererStreamInfo, depth: usize) { } } -fn on_connect_discovered( +fn on_discovered( _discoverer: &Discoverer, discoverer_info: &DiscovererInfo, - error: &Option, + error: Option<&glib::Error>, ) { let uri = discoverer_info.get_uri().unwrap(); match discoverer_info.get_result() { @@ -156,7 +156,7 @@ fn run_discoverer() -> Result<(), Error> { let loop_ = glib::MainLoop::new(None, false); let timeout = 5 * gst::SECOND; let discoverer = gst_pbutils::Discoverer::new(timeout)?; - discoverer.connect_discovered(on_connect_discovered); + discoverer.connect_discovered(on_discovered); let loop_clone = loop_.clone(); discoverer.connect_finished(move |_| { println!("\nFinished discovering");