diff --git a/gstreamer-app/src/auto/app_sink.rs b/gstreamer-app/src/auto/app_sink.rs index 184f36ed5..b917b7cd7 100644 --- a/gstreamer-app/src/auto/app_sink.rs +++ b/gstreamer-app/src/auto/app_sink.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -28,62 +28,63 @@ impl AppSink { #[cfg(any(feature = "v1_12", feature = "dox"))] pub fn get_buffer_list_support(&self) -> bool { unsafe { - from_glib(gst_app_sys::gst_app_sink_get_buffer_list_support(self.to_glib_none().0)) + from_glib(gst_app_sys::gst_app_sink_get_buffer_list_support( + self.to_glib_none().0, + )) } } pub fn get_caps(&self) -> Option { - unsafe { - from_glib_full(gst_app_sys::gst_app_sink_get_caps(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_app_sys::gst_app_sink_get_caps(self.to_glib_none().0)) } } pub fn get_drop(&self) -> bool { - unsafe { - from_glib(gst_app_sys::gst_app_sink_get_drop(self.to_glib_none().0)) - } + unsafe { from_glib(gst_app_sys::gst_app_sink_get_drop(self.to_glib_none().0)) } } pub fn get_emit_signals(&self) -> bool { unsafe { - from_glib(gst_app_sys::gst_app_sink_get_emit_signals(self.to_glib_none().0)) + from_glib(gst_app_sys::gst_app_sink_get_emit_signals( + self.to_glib_none().0, + )) } } pub fn get_max_buffers(&self) -> u32 { - unsafe { - gst_app_sys::gst_app_sink_get_max_buffers(self.to_glib_none().0) - } + unsafe { gst_app_sys::gst_app_sink_get_max_buffers(self.to_glib_none().0) } } pub fn get_wait_on_eos(&self) -> bool { unsafe { - from_glib(gst_app_sys::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) + from_glib(gst_app_sys::gst_app_sink_get_wait_on_eos( + self.to_glib_none().0, + )) } } pub fn is_eos(&self) -> bool { - unsafe { - from_glib(gst_app_sys::gst_app_sink_is_eos(self.to_glib_none().0)) - } + unsafe { from_glib(gst_app_sys::gst_app_sink_is_eos(self.to_glib_none().0)) } } pub fn pull_preroll(&self) -> Option { unsafe { - from_glib_full(gst_app_sys::gst_app_sink_pull_preroll(self.to_glib_none().0)) + from_glib_full(gst_app_sys::gst_app_sink_pull_preroll( + self.to_glib_none().0, + )) } } pub fn pull_sample(&self) -> Option { - unsafe { - from_glib_full(gst_app_sys::gst_app_sink_pull_sample(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_app_sys::gst_app_sink_pull_sample(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_12", feature = "dox"))] pub fn set_buffer_list_support(&self, enable_lists: bool) { unsafe { - gst_app_sys::gst_app_sink_set_buffer_list_support(self.to_glib_none().0, enable_lists.to_glib()); + gst_app_sys::gst_app_sink_set_buffer_list_support( + self.to_glib_none().0, + enable_lists.to_glib(), + ); } } @@ -124,132 +125,242 @@ impl AppSink { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn try_pull_preroll(&self, timeout: gst::ClockTime) -> Option { unsafe { - from_glib_full(gst_app_sys::gst_app_sink_try_pull_preroll(self.to_glib_none().0, timeout.to_glib())) + from_glib_full(gst_app_sys::gst_app_sink_try_pull_preroll( + self.to_glib_none().0, + timeout.to_glib(), + )) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option { unsafe { - from_glib_full(gst_app_sys::gst_app_sink_try_pull_sample(self.to_glib_none().0, timeout.to_glib())) + from_glib_full(gst_app_sys::gst_app_sink_try_pull_sample( + self.to_glib_none().0, + timeout.to_glib(), + )) } } pub fn get_property_buffer_list(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"buffer-list\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"buffer-list\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_buffer_list(&self, buffer_list: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"buffer-list\0".as_ptr() as *const _, Value::from(&buffer_list).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"buffer-list\0".as_ptr() as *const _, + Value::from(&buffer_list).to_glib_none().0, + ); } } pub fn get_property_eos(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"eos\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"eos\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn connect_eos(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn eos_trampoline(this: *mut gst_app_sys::GstAppSink, f: glib_sys::gpointer) { + unsafe extern "C" fn eos_trampoline( + this: *mut gst_app_sys::GstAppSink, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _, - Some(transmute(eos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"eos\0".as_ptr() as *const _, + Some(transmute(eos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_buffer_list_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_buffer_list_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_buffer_list_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_buffer_list_trampoline< + F: Fn(&AppSink) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::buffer-list\0".as_ptr() as *const _, - Some(transmute(notify_buffer_list_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::buffer-list\0".as_ptr() as *const _, + Some(transmute(notify_buffer_list_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_caps_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_caps_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_caps_trampoline( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, - Some(transmute(notify_caps_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::caps\0".as_ptr() as *const _, + Some(transmute(notify_caps_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_drop_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_drop_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_drop_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_drop_trampoline( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::drop\0".as_ptr() as *const _, - Some(transmute(notify_drop_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::drop\0".as_ptr() as *const _, + Some(transmute(notify_drop_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_emit_signals_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_emit_signals_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_emit_signals_trampoline< + F: Fn(&AppSink) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _, - Some(transmute(notify_emit_signals_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::emit-signals\0".as_ptr() as *const _, + Some(transmute(notify_emit_signals_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_eos_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_eos_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_eos_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_eos_trampoline( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::eos\0".as_ptr() as *const _, - Some(transmute(notify_eos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::eos\0".as_ptr() as *const _, + Some(transmute(notify_eos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_max_buffers_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_buffers_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_max_buffers_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_buffers_trampoline< + F: Fn(&AppSink) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-buffers\0".as_ptr() as *const _, - Some(transmute(notify_max_buffers_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-buffers\0".as_ptr() as *const _, + Some(transmute(notify_max_buffers_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_wait_on_eos_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_wait_on_eos_trampoline(this: *mut gst_app_sys::GstAppSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_wait_on_eos_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_wait_on_eos_trampoline< + F: Fn(&AppSink) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::wait-on-eos\0".as_ptr() as *const _, - Some(transmute(notify_wait_on_eos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::wait-on-eos\0".as_ptr() as *const _, + Some(transmute(notify_wait_on_eos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-app/src/auto/app_src.rs b/gstreamer-app/src/auto/app_src.rs index 1b4a0fa11..f702a5591 100644 --- a/gstreamer-app/src/auto/app_src.rs +++ b/gstreamer-app/src/auto/app_src.rs @@ -2,13 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use AppStreamType; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -17,6 +16,7 @@ use gst_base; use libc; use std::boxed::Box as Box_; use std::mem::transmute; +use AppStreamType; glib_wrapper! { pub struct AppSrc(Object) @extends gst_base::BaseSrc, gst::Element, gst::Object, @implements gst::URIHandler; @@ -28,45 +28,39 @@ glib_wrapper! { impl AppSrc { pub fn get_caps(&self) -> Option { - unsafe { - from_glib_full(gst_app_sys::gst_app_src_get_caps(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_app_sys::gst_app_src_get_caps(self.to_glib_none().0)) } } pub fn get_current_level_bytes(&self) -> u64 { - unsafe { - gst_app_sys::gst_app_src_get_current_level_bytes(self.to_glib_none().0) - } + unsafe { gst_app_sys::gst_app_src_get_current_level_bytes(self.to_glib_none().0) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_duration(&self) -> gst::ClockTime { - unsafe { - from_glib(gst_app_sys::gst_app_src_get_duration(self.to_glib_none().0)) - } + unsafe { from_glib(gst_app_sys::gst_app_src_get_duration(self.to_glib_none().0)) } } pub fn get_emit_signals(&self) -> bool { unsafe { - from_glib(gst_app_sys::gst_app_src_get_emit_signals(self.to_glib_none().0)) + from_glib(gst_app_sys::gst_app_src_get_emit_signals( + self.to_glib_none().0, + )) } } pub fn get_max_bytes(&self) -> u64 { - unsafe { - gst_app_sys::gst_app_src_get_max_bytes(self.to_glib_none().0) - } + unsafe { gst_app_sys::gst_app_src_get_max_bytes(self.to_glib_none().0) } } pub fn get_size(&self) -> i64 { - unsafe { - gst_app_sys::gst_app_src_get_size(self.to_glib_none().0) - } + unsafe { gst_app_sys::gst_app_src_get_size(self.to_glib_none().0) } } pub fn get_stream_type(&self) -> AppStreamType { unsafe { - from_glib(gst_app_sys::gst_app_src_get_stream_type(self.to_glib_none().0)) + from_glib(gst_app_sys::gst_app_src_get_stream_type( + self.to_glib_none().0, + )) } } @@ -114,290 +108,537 @@ impl AppSrc { pub fn get_property_block(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"block\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"block\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_block(&self, block: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"block\0".as_ptr() as *const _, Value::from(&block).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"block\0".as_ptr() as *const _, + Value::from(&block).to_glib_none().0, + ); } } pub fn get_property_duration(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_duration(&self, duration: u64) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + Value::from(&duration).to_glib_none().0, + ); } } pub fn get_property_format(&self) -> gst::Format { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"format\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"format\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_format(&self, format: gst::Format) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"format\0".as_ptr() as *const _, Value::from(&format).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"format\0".as_ptr() as *const _, + Value::from(&format).to_glib_none().0, + ); } } pub fn get_property_is_live(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"is-live\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"is-live\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_is_live(&self, is_live: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"is-live\0".as_ptr() as *const _, Value::from(&is_live).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"is-live\0".as_ptr() as *const _, + Value::from(&is_live).to_glib_none().0, + ); } } pub fn get_property_max_latency(&self) -> i64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"max-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"max-latency\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_max_latency(&self, max_latency: i64) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"max-latency\0".as_ptr() as *const _, Value::from(&max_latency).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"max-latency\0".as_ptr() as *const _, + Value::from(&max_latency).to_glib_none().0, + ); } } pub fn get_property_min_latency(&self) -> i64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"min-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"min-latency\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_min_latency(&self, min_latency: i64) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"min-latency\0".as_ptr() as *const _, Value::from(&min_latency).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"min-latency\0".as_ptr() as *const _, + Value::from(&min_latency).to_glib_none().0, + ); } } pub fn get_property_min_percent(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"min-percent\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"min-percent\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_min_percent(&self, min_percent: u32) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"min-percent\0".as_ptr() as *const _, Value::from(&min_percent).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"min-percent\0".as_ptr() as *const _, + Value::from(&min_percent).to_glib_none().0, + ); } } - pub fn connect_enough_data(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn enough_data_trampoline(this: *mut gst_app_sys::GstAppSrc, f: glib_sys::gpointer) { + pub fn connect_enough_data( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn enough_data_trampoline( + this: *mut gst_app_sys::GstAppSrc, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"enough-data\0".as_ptr() as *const _, - Some(transmute(enough_data_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"enough-data\0".as_ptr() as *const _, + Some(transmute(enough_data_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_need_data(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn need_data_trampoline(this: *mut gst_app_sys::GstAppSrc, length: libc::c_uint, f: glib_sys::gpointer) { + pub fn connect_need_data( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn need_data_trampoline( + this: *mut gst_app_sys::GstAppSrc, + length: libc::c_uint, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), length) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"need-data\0".as_ptr() as *const _, - Some(transmute(need_data_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"need-data\0".as_ptr() as *const _, + Some(transmute(need_data_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_seek_data bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn seek_data_trampoline bool + Send + Sync + 'static>(this: *mut gst_app_sys::GstAppSrc, offset: u64, f: glib_sys::gpointer) -> glib_sys::gboolean { + pub fn connect_seek_data bool + Send + Sync + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn seek_data_trampoline< + F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + offset: u64, + f: glib_sys::gpointer, + ) -> glib_sys::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), offset).to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"seek-data\0".as_ptr() as *const _, - Some(transmute(seek_data_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"seek-data\0".as_ptr() as *const _, + Some(transmute(seek_data_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_block_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_block_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_block_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_block_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::block\0".as_ptr() as *const _, - Some(transmute(notify_block_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::block\0".as_ptr() as *const _, + Some(transmute(notify_block_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_caps_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_caps_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_caps_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, - Some(transmute(notify_caps_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::caps\0".as_ptr() as *const _, + Some(transmute(notify_caps_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_current_level_bytes_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_current_level_bytes_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_current_level_bytes_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_current_level_bytes_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::current-level-bytes\0".as_ptr() as *const _, - Some(transmute(notify_current_level_bytes_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::current-level-bytes\0".as_ptr() as *const _, + Some(transmute( + notify_current_level_bytes_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_duration_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_duration_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_emit_signals_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_emit_signals_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_emit_signals_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _, - Some(transmute(notify_emit_signals_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::emit-signals\0".as_ptr() as *const _, + Some(transmute(notify_emit_signals_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_format_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_format_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_format_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_format_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::format\0".as_ptr() as *const _, - Some(transmute(notify_format_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::format\0".as_ptr() as *const _, + Some(transmute(notify_format_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_is_live_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_is_live_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_is_live_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_is_live_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::is-live\0".as_ptr() as *const _, - Some(transmute(notify_is_live_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-live\0".as_ptr() as *const _, + Some(transmute(notify_is_live_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_max_bytes_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_bytes_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_max_bytes_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_bytes_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-bytes\0".as_ptr() as *const _, - Some(transmute(notify_max_bytes_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-bytes\0".as_ptr() as *const _, + Some(transmute(notify_max_bytes_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_max_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_latency_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_max_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_latency_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-latency\0".as_ptr() as *const _, - Some(transmute(notify_max_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-latency\0".as_ptr() as *const _, + Some(transmute(notify_max_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_min_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_min_latency_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_min_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_min_latency_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::min-latency\0".as_ptr() as *const _, - Some(transmute(notify_min_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::min-latency\0".as_ptr() as *const _, + Some(transmute(notify_min_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_min_percent_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_min_percent_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_min_percent_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_min_percent_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::min-percent\0".as_ptr() as *const _, - Some(transmute(notify_min_percent_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::min-percent\0".as_ptr() as *const _, + Some(transmute(notify_min_percent_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_size_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_size_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_size_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_size_trampoline( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::size\0".as_ptr() as *const _, - Some(transmute(notify_size_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::size\0".as_ptr() as *const _, + Some(transmute(notify_size_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_stream_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_stream_type_trampoline(this: *mut gst_app_sys::GstAppSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_stream_type_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_stream_type_trampoline< + F: Fn(&AppSrc) + Send + Sync + 'static, + >( + this: *mut gst_app_sys::GstAppSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _, - Some(transmute(notify_stream_type_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::stream-type\0".as_ptr() as *const _, + Some(transmute(notify_stream_type_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-app/src/auto/enums.rs b/gstreamer-app/src/auto/enums.rs index 74719b291..372c07375 100644 --- a/gstreamer-app/src/auto/enums.rs +++ b/gstreamer-app/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_app_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum AppStreamType { Stream, Seekable, @@ -31,7 +30,7 @@ impl ToGlib for AppStreamType { AppStreamType::Stream => gst_app_sys::GST_APP_STREAM_TYPE_STREAM, AppStreamType::Seekable => gst_app_sys::GST_APP_STREAM_TYPE_SEEKABLE, AppStreamType::RandomAccess => gst_app_sys::GST_APP_STREAM_TYPE_RANDOM_ACCESS, - AppStreamType::__Unknown(value) => value + AppStreamType::__Unknown(value) => value, } } } @@ -72,4 +71,3 @@ impl SetValue for AppStreamType { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-app/src/auto/mod.rs b/gstreamer-app/src/auto/mod.rs index cc575cc49..575cebfe1 100644 --- a/gstreamer-app/src/auto/mod.rs +++ b/gstreamer-app/src/auto/mod.rs @@ -12,5 +12,4 @@ mod enums; pub use self::enums::AppStreamType; #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-app/src/lib.rs b/gstreamer-app/src/lib.rs index 71d89287b..3d118dc0b 100644 --- a/gstreamer-app/src/lib.rs +++ b/gstreamer-app/src/lib.rs @@ -27,7 +27,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-audio/src/auto/audio_stream_align.rs b/gstreamer-audio/src/auto/audio_stream_align.rs index 7c35e56db..834f61013 100644 --- a/gstreamer-audio/src/auto/audio_stream_align.rs +++ b/gstreamer-audio/src/auto/audio_stream_align.rs @@ -21,45 +21,63 @@ glib_wrapper! { impl AudioStreamAlign { #[cfg(any(feature = "v1_14", feature = "dox"))] - pub fn new(rate: i32, alignment_threshold: gst::ClockTime, discont_wait: gst::ClockTime) -> AudioStreamAlign { + pub fn new( + rate: i32, + alignment_threshold: gst::ClockTime, + discont_wait: gst::ClockTime, + ) -> AudioStreamAlign { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_audio_sys::gst_audio_stream_align_new(rate, alignment_threshold.to_glib(), discont_wait.to_glib())) + from_glib_full(gst_audio_sys::gst_audio_stream_align_new( + rate, + alignment_threshold.to_glib(), + discont_wait.to_glib(), + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_alignment_threshold(&mut self) -> gst::ClockTime { unsafe { - from_glib(gst_audio_sys::gst_audio_stream_align_get_alignment_threshold(self.to_glib_none_mut().0)) + from_glib( + gst_audio_sys::gst_audio_stream_align_get_alignment_threshold( + self.to_glib_none_mut().0, + ), + ) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_discont_wait(&mut self) -> gst::ClockTime { unsafe { - from_glib(gst_audio_sys::gst_audio_stream_align_get_discont_wait(self.to_glib_none_mut().0)) + from_glib(gst_audio_sys::gst_audio_stream_align_get_discont_wait( + self.to_glib_none_mut().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_rate(&mut self) -> i32 { - unsafe { - gst_audio_sys::gst_audio_stream_align_get_rate(self.to_glib_none_mut().0) - } + unsafe { gst_audio_sys::gst_audio_stream_align_get_rate(self.to_glib_none_mut().0) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_samples_since_discont(&mut self) -> u64 { unsafe { - gst_audio_sys::gst_audio_stream_align_get_samples_since_discont(self.to_glib_none_mut().0) + gst_audio_sys::gst_audio_stream_align_get_samples_since_discont( + self.to_glib_none_mut().0, + ) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_timestamp_at_discont(&mut self) -> gst::ClockTime { unsafe { - from_glib(gst_audio_sys::gst_audio_stream_align_get_timestamp_at_discont(self.to_glib_none_mut().0)) + from_glib( + gst_audio_sys::gst_audio_stream_align_get_timestamp_at_discont( + self.to_glib_none_mut().0, + ), + ) } } @@ -73,14 +91,20 @@ impl AudioStreamAlign { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn set_alignment_threshold(&mut self, alignment_threshold: gst::ClockTime) { unsafe { - gst_audio_sys::gst_audio_stream_align_set_alignment_threshold(self.to_glib_none_mut().0, alignment_threshold.to_glib()); + gst_audio_sys::gst_audio_stream_align_set_alignment_threshold( + self.to_glib_none_mut().0, + alignment_threshold.to_glib(), + ); } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn set_discont_wait(&mut self, discont_wait: gst::ClockTime) { unsafe { - gst_audio_sys::gst_audio_stream_align_set_discont_wait(self.to_glib_none_mut().0, discont_wait.to_glib()); + gst_audio_sys::gst_audio_stream_align_set_discont_wait( + self.to_glib_none_mut().0, + discont_wait.to_glib(), + ); } } diff --git a/gstreamer-audio/src/auto/enums.rs b/gstreamer-audio/src/auto/enums.rs index b91cafcda..6030ec6ae 100644 --- a/gstreamer-audio/src/auto/enums.rs +++ b/gstreamer-audio/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_audio_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum AudioChannelPosition { None, Mono, @@ -60,34 +59,70 @@ impl ToGlib for AudioChannelPosition { AudioChannelPosition::Mono => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_MONO, AudioChannelPosition::Invalid => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID, AudioChannelPosition::FrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, - AudioChannelPosition::FrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, - AudioChannelPosition::FrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + AudioChannelPosition::FrontRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT + } + AudioChannelPosition::FrontCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER + } AudioChannelPosition::Lfe1 => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_LFE1, AudioChannelPosition::RearLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, AudioChannelPosition::RearRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, - AudioChannelPosition::FrontLeftOfCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, - AudioChannelPosition::FrontRightOfCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, - AudioChannelPosition::RearCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, + AudioChannelPosition::FrontLeftOfCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER + } + AudioChannelPosition::FrontRightOfCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER + } + AudioChannelPosition::RearCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_CENTER + } AudioChannelPosition::Lfe2 => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_LFE2, AudioChannelPosition::SideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, AudioChannelPosition::SideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, - AudioChannelPosition::TopFrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT, - AudioChannelPosition::TopFrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT, - AudioChannelPosition::TopFrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER, + AudioChannelPosition::TopFrontLeft => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT + } + AudioChannelPosition::TopFrontRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT + } + AudioChannelPosition::TopFrontCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER + } AudioChannelPosition::TopCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_CENTER, - AudioChannelPosition::TopRearLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT, - AudioChannelPosition::TopRearRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT, - AudioChannelPosition::TopSideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT, - AudioChannelPosition::TopSideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT, - AudioChannelPosition::TopRearCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER, - AudioChannelPosition::BottomFrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER, - AudioChannelPosition::BottomFrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT, - AudioChannelPosition::BottomFrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT, + AudioChannelPosition::TopRearLeft => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT + } + AudioChannelPosition::TopRearRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT + } + AudioChannelPosition::TopSideLeft => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT + } + AudioChannelPosition::TopSideRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT + } + AudioChannelPosition::TopRearCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER + } + AudioChannelPosition::BottomFrontCenter => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER + } + AudioChannelPosition::BottomFrontLeft => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT + } + AudioChannelPosition::BottomFrontRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT + } AudioChannelPosition::WideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT, AudioChannelPosition::WideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT, - AudioChannelPosition::SurroundLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT, - AudioChannelPosition::SurroundRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT, - AudioChannelPosition::__Unknown(value) => value + AudioChannelPosition::SurroundLeft => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT + } + AudioChannelPosition::SurroundRight => { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT + } + AudioChannelPosition::__Unknown(value) => value, } } } @@ -157,8 +192,7 @@ impl SetValue for AudioChannelPosition { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum AudioFormat { Unknown, Encoded, @@ -234,7 +268,7 @@ impl ToGlib for AudioFormat { AudioFormat::F32be => gst_audio_sys::GST_AUDIO_FORMAT_F32BE, AudioFormat::F64le => gst_audio_sys::GST_AUDIO_FORMAT_F64LE, AudioFormat::F64be => gst_audio_sys::GST_AUDIO_FORMAT_F64BE, - AudioFormat::__Unknown(value) => value + AudioFormat::__Unknown(value) => value, } } } @@ -305,8 +339,7 @@ impl SetValue for AudioFormat { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum AudioLayout { Interleaved, NonInterleaved, @@ -322,7 +355,7 @@ impl ToGlib for AudioLayout { match *self { AudioLayout::Interleaved => gst_audio_sys::GST_AUDIO_LAYOUT_INTERLEAVED, AudioLayout::NonInterleaved => gst_audio_sys::GST_AUDIO_LAYOUT_NON_INTERLEAVED, - AudioLayout::__Unknown(value) => value + AudioLayout::__Unknown(value) => value, } } } @@ -363,8 +396,7 @@ impl SetValue for AudioLayout { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StreamVolumeFormat { Linear, Cubic, @@ -382,7 +414,7 @@ impl ToGlib for StreamVolumeFormat { StreamVolumeFormat::Linear => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_LINEAR, StreamVolumeFormat::Cubic => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_CUBIC, StreamVolumeFormat::Db => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_DB, - StreamVolumeFormat::__Unknown(value) => value + StreamVolumeFormat::__Unknown(value) => value, } } } @@ -399,4 +431,3 @@ impl FromGlib for StreamVolumeFormat { } } } - diff --git a/gstreamer-audio/src/auto/flags.rs b/gstreamer-audio/src/auto/flags.rs index df4c5541b..6886540ed 100644 --- a/gstreamer-audio/src/auto/flags.rs +++ b/gstreamer-audio/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_audio_sys; @@ -158,4 +158,3 @@ impl SetValue for AudioPackFlags { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-audio/src/auto/mod.rs b/gstreamer-audio/src/auto/mod.rs index 04257a030..362aa1144 100644 --- a/gstreamer-audio/src/auto/mod.rs +++ b/gstreamer-audio/src/auto/mod.rs @@ -3,8 +3,8 @@ // DO NOT EDIT mod stream_volume; -pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME}; pub use self::stream_volume::StreamVolumeExt; +pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME}; #[cfg(any(feature = "v1_14", feature = "dox"))] mod audio_stream_align; diff --git a/gstreamer-audio/src/auto/stream_volume.rs b/gstreamer-audio/src/auto/stream_volume.rs index a89adc1df..75d77a5f6 100644 --- a/gstreamer-audio/src/auto/stream_volume.rs +++ b/gstreamer-audio/src/auto/stream_volume.rs @@ -2,16 +2,16 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use StreamVolumeFormat; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst_audio_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use StreamVolumeFormat; glib_wrapper! { pub struct StreamVolume(Interface); @@ -44,61 +44,101 @@ pub trait StreamVolumeExt: 'static { fn set_volume(&self, format: StreamVolumeFormat, val: f64); - fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_mute_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_volume_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_volume_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> StreamVolumeExt for O { fn get_mute(&self) -> bool { unsafe { - from_glib(gst_audio_sys::gst_stream_volume_get_mute(self.as_ref().to_glib_none().0)) + from_glib(gst_audio_sys::gst_stream_volume_get_mute( + self.as_ref().to_glib_none().0, + )) } } fn get_volume(&self, format: StreamVolumeFormat) -> f64 { unsafe { - gst_audio_sys::gst_stream_volume_get_volume(self.as_ref().to_glib_none().0, format.to_glib()) + gst_audio_sys::gst_stream_volume_get_volume( + self.as_ref().to_glib_none().0, + format.to_glib(), + ) } } fn set_mute(&self, mute: bool) { unsafe { - gst_audio_sys::gst_stream_volume_set_mute(self.as_ref().to_glib_none().0, mute.to_glib()); + gst_audio_sys::gst_stream_volume_set_mute( + self.as_ref().to_glib_none().0, + mute.to_glib(), + ); } } fn set_volume(&self, format: StreamVolumeFormat, val: f64) { unsafe { - gst_audio_sys::gst_stream_volume_set_volume(self.as_ref().to_glib_none().0, format.to_glib(), val); + gst_audio_sys::gst_stream_volume_set_volume( + self.as_ref().to_glib_none().0, + format.to_glib(), + val, + ); } } - fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mute_trampoline(this: *mut gst_audio_sys::GstStreamVolume, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_mute_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_mute_trampoline( + this: *mut gst_audio_sys::GstStreamVolume, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&StreamVolume::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, - Some(transmute(notify_mute_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mute\0".as_ptr() as *const _, + Some(transmute(notify_mute_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_volume_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_volume_trampoline(this: *mut gst_audio_sys::GstStreamVolume, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_volume_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_volume_trampoline( + this: *mut gst_audio_sys::GstStreamVolume, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&StreamVolume::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _, - Some(transmute(notify_volume_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::volume\0".as_ptr() as *const _, + Some(transmute(notify_volume_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index a5c9029b6..05e5e9ee2 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -35,7 +35,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-base/src/auto/adapter.rs b/gstreamer-base/src/auto/adapter.rs index 688a48985..f9a660ff3 100644 --- a/gstreamer-base/src/auto/adapter.rs +++ b/gstreamer-base/src/auto/adapter.rs @@ -3,8 +3,8 @@ // DO NOT EDIT use glib; -use glib::ObjectExt; use glib::translate::*; +use glib::ObjectExt; use gst; use gst_base_sys; use std::mem; @@ -20,21 +20,15 @@ glib_wrapper! { impl Adapter { pub fn new() -> Adapter { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_base_sys::gst_adapter_new()) - } + unsafe { from_glib_full(gst_base_sys::gst_adapter_new()) } } pub fn available(&self) -> usize { - unsafe { - gst_base_sys::gst_adapter_available(self.to_glib_none().0) - } + unsafe { gst_base_sys::gst_adapter_available(self.to_glib_none().0) } } pub fn available_fast(&self) -> usize { - unsafe { - gst_base_sys::gst_adapter_available_fast(self.to_glib_none().0) - } + unsafe { gst_base_sys::gst_adapter_available_fast(self.to_glib_none().0) } } pub fn clear(&self) { @@ -45,20 +39,24 @@ impl Adapter { pub fn copy_bytes(&self, offset: usize, size: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_copy_bytes(self.to_glib_none().0, offset, size)) + from_glib_full(gst_base_sys::gst_adapter_copy_bytes( + self.to_glib_none().0, + offset, + size, + )) } } pub fn distance_from_discont(&self) -> u64 { - unsafe { - gst_base_sys::gst_adapter_distance_from_discont(self.to_glib_none().0) - } + unsafe { gst_base_sys::gst_adapter_distance_from_discont(self.to_glib_none().0) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn dts_at_discont(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_adapter_dts_at_discont(self.to_glib_none().0)) + from_glib(gst_base_sys::gst_adapter_dts_at_discont( + self.to_glib_none().0, + )) } } @@ -70,53 +68,85 @@ impl Adapter { pub fn get_buffer(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_get_buffer(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_get_buffer( + self.to_glib_none().0, + nbytes, + )) } } pub fn get_buffer_fast(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_get_buffer_fast(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_get_buffer_fast( + self.to_glib_none().0, + nbytes, + )) } } pub fn get_buffer_list(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_get_buffer_list(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_get_buffer_list( + self.to_glib_none().0, + nbytes, + )) } } pub fn get_list(&self, nbytes: usize) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_get_list(self.to_glib_none().0, nbytes)) + FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_get_list( + self.to_glib_none().0, + nbytes, + )) } } pub fn masked_scan_uint32(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> isize { unsafe { - gst_base_sys::gst_adapter_masked_scan_uint32(self.to_glib_none().0, mask, pattern, offset, size) + gst_base_sys::gst_adapter_masked_scan_uint32( + self.to_glib_none().0, + mask, + pattern, + offset, + size, + ) } } - pub fn masked_scan_uint32_peek(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> (isize, u32) { + pub fn masked_scan_uint32_peek( + &self, + mask: u32, + pattern: u32, + offset: usize, + size: usize, + ) -> (isize, u32) { unsafe { let mut value = mem::uninitialized(); - let ret = gst_base_sys::gst_adapter_masked_scan_uint32_peek(self.to_glib_none().0, mask, pattern, offset, size, &mut value); + let ret = gst_base_sys::gst_adapter_masked_scan_uint32_peek( + self.to_glib_none().0, + mask, + pattern, + offset, + size, + &mut value, + ); (ret, value) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn offset_at_discont(&self) -> u64 { - unsafe { - gst_base_sys::gst_adapter_offset_at_discont(self.to_glib_none().0) - } + unsafe { gst_base_sys::gst_adapter_offset_at_discont(self.to_glib_none().0) } } pub fn prev_dts(&self) -> (gst::ClockTime, u64) { unsafe { let mut distance = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_adapter_prev_dts(self.to_glib_none().0, &mut distance)); + let ret = from_glib(gst_base_sys::gst_adapter_prev_dts( + self.to_glib_none().0, + &mut distance, + )); (ret, distance) } } @@ -124,7 +154,11 @@ impl Adapter { pub fn prev_dts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) { unsafe { let mut distance = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_adapter_prev_dts_at_offset(self.to_glib_none().0, offset, &mut distance)); + let ret = from_glib(gst_base_sys::gst_adapter_prev_dts_at_offset( + self.to_glib_none().0, + offset, + &mut distance, + )); (ret, distance) } } @@ -141,7 +175,10 @@ impl Adapter { pub fn prev_pts(&self) -> (gst::ClockTime, u64) { unsafe { let mut distance = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_adapter_prev_pts(self.to_glib_none().0, &mut distance)); + let ret = from_glib(gst_base_sys::gst_adapter_prev_pts( + self.to_glib_none().0, + &mut distance, + )); (ret, distance) } } @@ -149,7 +186,11 @@ impl Adapter { pub fn prev_pts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) { unsafe { let mut distance = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_adapter_prev_pts_at_offset(self.to_glib_none().0, offset, &mut distance)); + let ret = from_glib(gst_base_sys::gst_adapter_prev_pts_at_offset( + self.to_glib_none().0, + offset, + &mut distance, + )); (ret, distance) } } @@ -157,31 +198,45 @@ impl Adapter { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn pts_at_discont(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_adapter_pts_at_discont(self.to_glib_none().0)) + from_glib(gst_base_sys::gst_adapter_pts_at_discont( + self.to_glib_none().0, + )) } } pub fn take_buffer(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_take_buffer(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_take_buffer( + self.to_glib_none().0, + nbytes, + )) } } pub fn take_buffer_fast(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_take_buffer_fast(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_take_buffer_fast( + self.to_glib_none().0, + nbytes, + )) } } pub fn take_buffer_list(&self, nbytes: usize) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_adapter_take_buffer_list(self.to_glib_none().0, nbytes)) + from_glib_full(gst_base_sys::gst_adapter_take_buffer_list( + self.to_glib_none().0, + nbytes, + )) } } pub fn take_list(&self, nbytes: usize) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_take_list(self.to_glib_none().0, nbytes)) + FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_take_list( + self.to_glib_none().0, + nbytes, + )) } } } diff --git a/gstreamer-base/src/auto/aggregator.rs b/gstreamer-base/src/auto/aggregator.rs index dd7e963e6..f33c4cedc 100644 --- a/gstreamer-base/src/auto/aggregator.rs +++ b/gstreamer-base/src/auto/aggregator.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -53,9 +53,15 @@ pub trait AggregatorExt: 'static { fn set_property_start_time(&self, start_time: u64); #[cfg(any(feature = "v1_14", feature = "dox"))] - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_start_time_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_start_time_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> AggregatorExt for O { @@ -67,78 +73,121 @@ impl> AggregatorExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_aggregator_get_buffer_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_aggregator_get_buffer_pool( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_latency(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_aggregator_get_latency(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_aggregator_get_latency( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { unsafe { - gst_base_sys::gst_aggregator_set_latency(self.as_ref().to_glib_none().0, min_latency.to_glib(), max_latency.to_glib()); + gst_base_sys::gst_aggregator_set_latency( + self.as_ref().to_glib_none().0, + min_latency.to_glib(), + max_latency.to_glib(), + ); } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn set_src_caps(&self, caps: &gst::Caps) { unsafe { - gst_base_sys::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); + gst_base_sys::gst_aggregator_set_src_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn simple_get_next_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_aggregator_simple_get_next_time(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_aggregator_simple_get_next_time( + self.as_ref().to_glib_none().0, + )) } } fn get_property_start_time(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"start-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_start_time(&self, start_time: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"start-time\0".as_ptr() as *const _, Value::from(&start_time).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"start-time\0".as_ptr() as *const _, + Value::from(&start_time).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_14", feature = "dox"))] - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_latency_trampoline(this: *mut gst_base_sys::GstAggregator, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_latency_trampoline( + this: *mut gst_base_sys::GstAggregator, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Aggregator::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, - Some(transmute(notify_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::latency\0".as_ptr() as *const _, + Some(transmute(notify_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_start_time_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_start_time_trampoline(this: *mut gst_base_sys::GstAggregator, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_start_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_start_time_trampoline( + this: *mut gst_base_sys::GstAggregator, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Aggregator::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::start-time\0".as_ptr() as *const _, - Some(transmute(notify_start_time_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::start-time\0".as_ptr() as *const _, + Some(transmute(notify_start_time_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/aggregator_pad.rs b/gstreamer-base/src/auto/aggregator_pad.rs index 2caac8f28..d39a9f9bd 100644 --- a/gstreamer-base/src/auto/aggregator_pad.rs +++ b/gstreamer-base/src/auto/aggregator_pad.rs @@ -2,15 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::StaticType; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; #[cfg(any(feature = "v1_16", feature = "dox"))] use gobject_sys; @@ -55,45 +55,61 @@ pub trait AggregatorPadExt: 'static { #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_property_emit_signals(&self, emit_signals: bool); - fn connect_buffer_consumed(&self, f: F) -> SignalHandlerId; + fn connect_buffer_consumed( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_16", feature = "dox"))] - fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_emit_signals_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> AggregatorPadExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn drop_buffer(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_aggregator_pad_drop_buffer(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_aggregator_pad_drop_buffer( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14_1", feature = "dox"))] fn has_buffer(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_aggregator_pad_has_buffer(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_aggregator_pad_has_buffer( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn is_eos(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_aggregator_pad_is_eos(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_aggregator_pad_is_eos( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn peek_buffer(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_aggregator_pad_peek_buffer(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_aggregator_pad_peek_buffer( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn pop_buffer(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_aggregator_pad_pop_buffer(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_aggregator_pad_pop_buffer( + self.as_ref().to_glib_none().0, + )) } } @@ -101,7 +117,11 @@ impl> AggregatorPadExt for O { fn get_property_emit_signals(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"emit-signals\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"emit-signals\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -109,36 +129,70 @@ impl> AggregatorPadExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_property_emit_signals(&self, emit_signals: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"emit-signals\0".as_ptr() as *const _, Value::from(&emit_signals).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"emit-signals\0".as_ptr() as *const _, + Value::from(&emit_signals).to_glib_none().0, + ); } } - fn connect_buffer_consumed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn buffer_consumed_trampoline(this: *mut gst_base_sys::GstAggregatorPad, object: *mut gst_sys::GstBuffer, f: glib_sys::gpointer) - where P: IsA + fn connect_buffer_consumed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn buffer_consumed_trampoline< + P, + F: Fn(&P, &gst::Buffer) + Send + Sync + 'static, + >( + this: *mut gst_base_sys::GstAggregatorPad, + object: *mut gst_sys::GstBuffer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&AggregatorPad::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &AggregatorPad::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"buffer-consumed\0".as_ptr() as *const _, - Some(transmute(buffer_consumed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"buffer-consumed\0".as_ptr() as *const _, + Some(transmute(buffer_consumed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_emit_signals_trampoline(this: *mut gst_base_sys::GstAggregatorPad, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_emit_signals_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_emit_signals_trampoline( + this: *mut gst_base_sys::GstAggregatorPad, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&AggregatorPad::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _, - Some(transmute(notify_emit_signals_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::emit-signals\0".as_ptr() as *const _, + Some(transmute( + notify_emit_signals_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/base_parse.rs b/gstreamer-base/src/auto/base_parse.rs index 5f1505409..153eafc27 100644 --- a/gstreamer-base/src/auto/base_parse.rs +++ b/gstreamer-base/src/auto/base_parse.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -59,13 +59,22 @@ pub trait BaseParseExt: 'static { fn set_property_disable_passthrough(&self, disable_passthrough: bool); - fn connect_property_disable_passthrough_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_disable_passthrough_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> BaseParseExt for O { fn add_index_entry(&self, offset: u64, ts: gst::ClockTime, key: bool, force: bool) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_parse_add_index_entry(self.as_ref().to_glib_none().0, offset, ts.to_glib(), key.to_glib(), force.to_glib())) + from_glib(gst_base_sys::gst_base_parse_add_index_entry( + self.as_ref().to_glib_none().0, + offset, + ts.to_glib(), + key.to_glib(), + force.to_glib(), + )) } } @@ -78,55 +87,84 @@ impl> BaseParseExt for O { fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) { unsafe { - gst_base_sys::gst_base_parse_merge_tags(self.as_ref().to_glib_none().0, tags.to_glib_none().0, mode.to_glib()); + gst_base_sys::gst_base_parse_merge_tags( + self.as_ref().to_glib_none().0, + tags.to_glib_none().0, + mode.to_glib(), + ); } } fn set_average_bitrate(&self, bitrate: u32) { unsafe { - gst_base_sys::gst_base_parse_set_average_bitrate(self.as_ref().to_glib_none().0, bitrate); + gst_base_sys::gst_base_parse_set_average_bitrate( + self.as_ref().to_glib_none().0, + bitrate, + ); } } fn set_has_timing_info(&self, has_timing: bool) { unsafe { - gst_base_sys::gst_base_parse_set_has_timing_info(self.as_ref().to_glib_none().0, has_timing.to_glib()); + gst_base_sys::gst_base_parse_set_has_timing_info( + self.as_ref().to_glib_none().0, + has_timing.to_glib(), + ); } } fn set_infer_ts(&self, infer_ts: bool) { unsafe { - gst_base_sys::gst_base_parse_set_infer_ts(self.as_ref().to_glib_none().0, infer_ts.to_glib()); + gst_base_sys::gst_base_parse_set_infer_ts( + self.as_ref().to_glib_none().0, + infer_ts.to_glib(), + ); } } fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { unsafe { - gst_base_sys::gst_base_parse_set_latency(self.as_ref().to_glib_none().0, min_latency.to_glib(), max_latency.to_glib()); + gst_base_sys::gst_base_parse_set_latency( + self.as_ref().to_glib_none().0, + min_latency.to_glib(), + max_latency.to_glib(), + ); } } fn set_min_frame_size(&self, min_size: u32) { unsafe { - gst_base_sys::gst_base_parse_set_min_frame_size(self.as_ref().to_glib_none().0, min_size); + gst_base_sys::gst_base_parse_set_min_frame_size( + self.as_ref().to_glib_none().0, + min_size, + ); } } fn set_passthrough(&self, passthrough: bool) { unsafe { - gst_base_sys::gst_base_parse_set_passthrough(self.as_ref().to_glib_none().0, passthrough.to_glib()); + gst_base_sys::gst_base_parse_set_passthrough( + self.as_ref().to_glib_none().0, + passthrough.to_glib(), + ); } } fn set_pts_interpolation(&self, pts_interpolate: bool) { unsafe { - gst_base_sys::gst_base_parse_set_pts_interpolation(self.as_ref().to_glib_none().0, pts_interpolate.to_glib()); + gst_base_sys::gst_base_parse_set_pts_interpolation( + self.as_ref().to_glib_none().0, + pts_interpolate.to_glib(), + ); } } fn set_syncable(&self, syncable: bool) { unsafe { - gst_base_sys::gst_base_parse_set_syncable(self.as_ref().to_glib_none().0, syncable.to_glib()); + gst_base_sys::gst_base_parse_set_syncable( + self.as_ref().to_glib_none().0, + syncable.to_glib(), + ); } } @@ -139,28 +177,52 @@ impl> BaseParseExt for O { fn get_property_disable_passthrough(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"disable-passthrough\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"disable-passthrough\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_disable_passthrough(&self, disable_passthrough: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"disable-passthrough\0".as_ptr() as *const _, Value::from(&disable_passthrough).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"disable-passthrough\0".as_ptr() as *const _, + Value::from(&disable_passthrough).to_glib_none().0, + ); } } - fn connect_property_disable_passthrough_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_disable_passthrough_trampoline(this: *mut gst_base_sys::GstBaseParse, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_disable_passthrough_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_disable_passthrough_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_base_sys::GstBaseParse, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseParse::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::disable-passthrough\0".as_ptr() as *const _, - Some(transmute(notify_disable_passthrough_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::disable-passthrough\0".as_ptr() as *const _, + Some(transmute( + notify_disable_passthrough_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/base_sink.rs b/gstreamer-base/src/auto/base_sink.rs index 5c63cd23f..49a8402f6 100644 --- a/gstreamer-base/src/auto/base_sink.rs +++ b/gstreamer-base/src/auto/base_sink.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -105,30 +105,66 @@ pub trait BaseSinkExt: 'static { fn set_property_qos(&self, qos: bool); - fn connect_property_async_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_async_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_blocksize_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_enable_last_sample_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_enable_last_sample_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_last_sample_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_last_sample_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_max_bitrate_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_bitrate_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_max_lateness_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_lateness_notify( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_16", feature = "dox"))] - fn connect_property_processing_deadline_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_processing_deadline_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_render_delay_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_render_delay_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_sync_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_sync_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_throttle_time_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_throttle_time_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_ts_offset_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_ts_offset_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> BaseSinkExt for O { @@ -137,88 +173,96 @@ impl> BaseSinkExt for O { //} fn get_blocksize(&self) -> u32 { - unsafe { - gst_base_sys::gst_base_sink_get_blocksize(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_sink_get_blocksize(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn get_drop_out_of_segment(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_sink_get_drop_out_of_segment(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_get_drop_out_of_segment( + self.as_ref().to_glib_none().0, + )) } } fn get_last_sample(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_base_sink_get_last_sample(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_base_sink_get_last_sample( + self.as_ref().to_glib_none().0, + )) } } fn get_latency(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_base_sink_get_latency(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_get_latency( + self.as_ref().to_glib_none().0, + )) } } fn get_max_bitrate(&self) -> u64 { - unsafe { - gst_base_sys::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0) } } fn get_max_lateness(&self) -> i64 { - unsafe { - gst_base_sys::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_processing_deadline(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_base_sink_get_processing_deadline(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_get_processing_deadline( + self.as_ref().to_glib_none().0, + )) } } fn get_render_delay(&self) -> gst::ClockTime { unsafe { - from_glib(gst_base_sys::gst_base_sink_get_render_delay(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_get_render_delay( + self.as_ref().to_glib_none().0, + )) } } fn get_sync(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_sink_get_sync(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_get_sync( + self.as_ref().to_glib_none().0, + )) } } fn get_throttle_time(&self) -> u64 { - unsafe { - gst_base_sys::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0) } } fn get_ts_offset(&self) -> gst::ClockTimeDiff { - unsafe { - gst_base_sys::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0) } } fn is_async_enabled(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_sink_is_async_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_is_async_enabled( + self.as_ref().to_glib_none().0, + )) } } fn is_last_sample_enabled(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_sink_is_last_sample_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_is_last_sample_enabled( + self.as_ref().to_glib_none().0, + )) } } fn is_qos_enabled(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_sink_is_qos_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_sink_is_qos_enabled( + self.as_ref().to_glib_none().0, + )) } } @@ -228,14 +272,32 @@ impl> BaseSinkExt for O { let mut upstream_live = mem::uninitialized(); let mut min_latency = mem::uninitialized(); let mut max_latency = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_base_sink_query_latency(self.as_ref().to_glib_none().0, &mut live, &mut upstream_live, &mut min_latency, &mut max_latency)); - if ret { Some((from_glib(live), from_glib(upstream_live), from_glib(min_latency), from_glib(max_latency))) } else { None } + let ret = from_glib(gst_base_sys::gst_base_sink_query_latency( + self.as_ref().to_glib_none().0, + &mut live, + &mut upstream_live, + &mut min_latency, + &mut max_latency, + )); + if ret { + Some(( + from_glib(live), + from_glib(upstream_live), + from_glib(min_latency), + from_glib(max_latency), + )) + } else { + None + } } } fn set_async_enabled(&self, enabled: bool) { unsafe { - gst_base_sys::gst_base_sink_set_async_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_base_sys::gst_base_sink_set_async_enabled( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } @@ -248,44 +310,65 @@ impl> BaseSinkExt for O { #[cfg(any(feature = "v1_12", feature = "dox"))] fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) { unsafe { - gst_base_sys::gst_base_sink_set_drop_out_of_segment(self.as_ref().to_glib_none().0, drop_out_of_segment.to_glib()); + gst_base_sys::gst_base_sink_set_drop_out_of_segment( + self.as_ref().to_glib_none().0, + drop_out_of_segment.to_glib(), + ); } } fn set_last_sample_enabled(&self, enabled: bool) { unsafe { - gst_base_sys::gst_base_sink_set_last_sample_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_base_sys::gst_base_sink_set_last_sample_enabled( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } fn set_max_bitrate(&self, max_bitrate: u64) { unsafe { - gst_base_sys::gst_base_sink_set_max_bitrate(self.as_ref().to_glib_none().0, max_bitrate); + gst_base_sys::gst_base_sink_set_max_bitrate( + self.as_ref().to_glib_none().0, + max_bitrate, + ); } } fn set_max_lateness(&self, max_lateness: i64) { unsafe { - gst_base_sys::gst_base_sink_set_max_lateness(self.as_ref().to_glib_none().0, max_lateness); + gst_base_sys::gst_base_sink_set_max_lateness( + self.as_ref().to_glib_none().0, + max_lateness, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_processing_deadline(&self, processing_deadline: gst::ClockTime) { unsafe { - gst_base_sys::gst_base_sink_set_processing_deadline(self.as_ref().to_glib_none().0, processing_deadline.to_glib()); + gst_base_sys::gst_base_sink_set_processing_deadline( + self.as_ref().to_glib_none().0, + processing_deadline.to_glib(), + ); } } fn set_qos_enabled(&self, enabled: bool) { unsafe { - gst_base_sys::gst_base_sink_set_qos_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_base_sys::gst_base_sink_set_qos_enabled( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } fn set_render_delay(&self, delay: gst::ClockTime) { unsafe { - gst_base_sys::gst_base_sink_set_render_delay(self.as_ref().to_glib_none().0, delay.to_glib()); + gst_base_sys::gst_base_sink_set_render_delay( + self.as_ref().to_glib_none().0, + delay.to_glib(), + ); } } @@ -310,7 +393,11 @@ impl> BaseSinkExt for O { fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff) { unsafe { let mut jitter = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_base_sink_wait_clock(self.as_ref().to_glib_none().0, time.to_glib(), &mut jitter)); + let ret = from_glib(gst_base_sys::gst_base_sink_wait_clock( + self.as_ref().to_glib_none().0, + time.to_glib(), + &mut jitter, + )); (ret, jitter) } } @@ -318,211 +405,383 @@ impl> BaseSinkExt for O { fn get_property_async(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"async\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"async\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_async(&self, async: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"async\0".as_ptr() as *const _, Value::from(&async).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"async\0".as_ptr() as *const _, + Value::from(&async).to_glib_none().0, + ); } } fn get_property_enable_last_sample(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"enable-last-sample\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"enable-last-sample\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_enable_last_sample(&self, enable_last_sample: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"enable-last-sample\0".as_ptr() as *const _, Value::from(&enable_last_sample).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"enable-last-sample\0".as_ptr() as *const _, + Value::from(&enable_last_sample).to_glib_none().0, + ); } } fn get_property_qos(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_qos(&self, qos: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, Value::from(&qos).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + Value::from(&qos).to_glib_none().0, + ); } } - fn connect_property_async_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_async_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_async_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_async_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::async\0".as_ptr() as *const _, - Some(transmute(notify_async_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::async\0".as_ptr() as *const _, + Some(transmute(notify_async_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_blocksize_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_blocksize_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_blocksize_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _, - Some(transmute(notify_blocksize_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::blocksize\0".as_ptr() as *const _, + Some(transmute(notify_blocksize_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_enable_last_sample_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_enable_last_sample_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_enable_last_sample_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_enable_last_sample_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::enable-last-sample\0".as_ptr() as *const _, - Some(transmute(notify_enable_last_sample_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::enable-last-sample\0".as_ptr() as *const _, + Some(transmute( + notify_enable_last_sample_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_last_sample_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_last_sample_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_last_sample_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_last_sample_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::last-sample\0".as_ptr() as *const _, - Some(transmute(notify_last_sample_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::last-sample\0".as_ptr() as *const _, + Some(transmute(notify_last_sample_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_bitrate_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_bitrate_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_bitrate_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_bitrate_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _, - Some(transmute(notify_max_bitrate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-bitrate\0".as_ptr() as *const _, + Some(transmute(notify_max_bitrate_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_lateness_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_lateness_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_lateness_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_lateness_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-lateness\0".as_ptr() as *const _, - Some(transmute(notify_max_lateness_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-lateness\0".as_ptr() as *const _, + Some(transmute( + notify_max_lateness_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - fn connect_property_processing_deadline_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_processing_deadline_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_processing_deadline_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_processing_deadline_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::processing-deadline\0".as_ptr() as *const _, - Some(transmute(notify_processing_deadline_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::processing-deadline\0".as_ptr() as *const _, + Some(transmute( + notify_processing_deadline_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_qos_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_qos_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _, - Some(transmute(notify_qos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::qos\0".as_ptr() as *const _, + Some(transmute(notify_qos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_render_delay_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_render_delay_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_render_delay_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_render_delay_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::render-delay\0".as_ptr() as *const _, - Some(transmute(notify_render_delay_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::render-delay\0".as_ptr() as *const _, + Some(transmute( + notify_render_delay_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_sync_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_sync_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_sync_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_sync_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::sync\0".as_ptr() as *const _, - Some(transmute(notify_sync_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::sync\0".as_ptr() as *const _, + Some(transmute(notify_sync_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_throttle_time_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_throttle_time_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_throttle_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_throttle_time_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::throttle-time\0".as_ptr() as *const _, - Some(transmute(notify_throttle_time_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::throttle-time\0".as_ptr() as *const _, + Some(transmute( + notify_throttle_time_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_ts_offset_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_ts_offset_trampoline(this: *mut gst_base_sys::GstBaseSink, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_ts_offset_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_ts_offset_trampoline( + this: *mut gst_base_sys::GstBaseSink, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::ts-offset\0".as_ptr() as *const _, - Some(transmute(notify_ts_offset_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::ts-offset\0".as_ptr() as *const _, + Some(transmute(notify_ts_offset_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/base_src.rs b/gstreamer-base/src/auto/base_src.rs index 07fc50ea1..36b85dfa0 100644 --- a/gstreamer-base/src/auto/base_src.rs +++ b/gstreamer-base/src/auto/base_src.rs @@ -3,13 +3,13 @@ // DO NOT EDIT use glib; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -72,13 +72,25 @@ pub trait BaseSrcExt: 'static { fn set_property_typefind(&self, typefind: bool); - fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_blocksize_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_do_timestamp_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_do_timestamp_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_num_buffers_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_num_buffers_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_typefind_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_typefind_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> BaseSrcExt for O { @@ -87,38 +99,49 @@ impl> BaseSrcExt for O { //} fn get_blocksize(&self) -> u32 { - unsafe { - gst_base_sys::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) - } + unsafe { gst_base_sys::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) } } fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_base_src_get_buffer_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_base_src_get_buffer_pool( + self.as_ref().to_glib_none().0, + )) } } fn get_do_timestamp(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_src_get_do_timestamp(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_src_get_do_timestamp( + self.as_ref().to_glib_none().0, + )) } } fn is_async(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_src_is_async(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_src_is_async( + self.as_ref().to_glib_none().0, + )) } } fn is_live(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_src_is_live(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_src_is_live( + self.as_ref().to_glib_none().0, + )) } } fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_src_new_seamless_segment(self.as_ref().to_glib_none().0, start, stop, time)) + from_glib(gst_base_sys::gst_base_src_new_seamless_segment( + self.as_ref().to_glib_none().0, + start, + stop, + time, + )) } } @@ -127,8 +150,21 @@ impl> BaseSrcExt for O { let mut live = mem::uninitialized(); let mut min_latency = mem::uninitialized(); let mut max_latency = mem::uninitialized(); - let ret = from_glib(gst_base_sys::gst_base_src_query_latency(self.as_ref().to_glib_none().0, &mut live, &mut min_latency, &mut max_latency)); - if ret { Some((from_glib(live), from_glib(min_latency), from_glib(max_latency))) } else { None } + let ret = from_glib(gst_base_sys::gst_base_src_query_latency( + self.as_ref().to_glib_none().0, + &mut live, + &mut min_latency, + &mut max_latency, + )); + if ret { + Some(( + from_glib(live), + from_glib(min_latency), + from_glib(max_latency), + )) + } else { + None + } } } @@ -140,7 +176,10 @@ impl> BaseSrcExt for O { fn set_automatic_eos(&self, automatic_eos: bool) { unsafe { - gst_base_sys::gst_base_src_set_automatic_eos(self.as_ref().to_glib_none().0, automatic_eos.to_glib()); + gst_base_sys::gst_base_src_set_automatic_eos( + self.as_ref().to_glib_none().0, + automatic_eos.to_glib(), + ); } } @@ -152,19 +191,31 @@ impl> BaseSrcExt for O { fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_base_sys::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0), "Failed to set caps") + glib_result_from_gboolean!( + gst_base_sys::gst_base_src_set_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0 + ), + "Failed to set caps" + ) } } fn set_do_timestamp(&self, timestamp: bool) { unsafe { - gst_base_sys::gst_base_src_set_do_timestamp(self.as_ref().to_glib_none().0, timestamp.to_glib()); + gst_base_sys::gst_base_src_set_do_timestamp( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + ); } } fn set_dynamic_size(&self, dynamic: bool) { unsafe { - gst_base_sys::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.to_glib()); + gst_base_sys::gst_base_src_set_dynamic_size( + self.as_ref().to_glib_none().0, + dynamic.to_glib(), + ); } } @@ -183,84 +234,146 @@ impl> BaseSrcExt for O { fn get_property_num_buffers(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"num-buffers\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"num-buffers\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_num_buffers(&self, num_buffers: i32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"num-buffers\0".as_ptr() as *const _, Value::from(&num_buffers).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"num-buffers\0".as_ptr() as *const _, + Value::from(&num_buffers).to_glib_none().0, + ); } } fn get_property_typefind(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"typefind\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"typefind\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_typefind(&self, typefind: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"typefind\0".as_ptr() as *const _, Value::from(&typefind).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"typefind\0".as_ptr() as *const _, + Value::from(&typefind).to_glib_none().0, + ); } } - fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_blocksize_trampoline(this: *mut gst_base_sys::GstBaseSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_blocksize_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_blocksize_trampoline( + this: *mut gst_base_sys::GstBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _, - Some(transmute(notify_blocksize_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::blocksize\0".as_ptr() as *const _, + Some(transmute(notify_blocksize_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_do_timestamp_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_do_timestamp_trampoline(this: *mut gst_base_sys::GstBaseSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_do_timestamp_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_do_timestamp_trampoline( + this: *mut gst_base_sys::GstBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _, - Some(transmute(notify_do_timestamp_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::do-timestamp\0".as_ptr() as *const _, + Some(transmute( + notify_do_timestamp_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_num_buffers_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_num_buffers_trampoline(this: *mut gst_base_sys::GstBaseSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_num_buffers_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_num_buffers_trampoline( + this: *mut gst_base_sys::GstBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::num-buffers\0".as_ptr() as *const _, - Some(transmute(notify_num_buffers_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::num-buffers\0".as_ptr() as *const _, + Some(transmute(notify_num_buffers_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_typefind_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_typefind_trampoline(this: *mut gst_base_sys::GstBaseSrc, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_typefind_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_typefind_trampoline( + this: *mut gst_base_sys::GstBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::typefind\0".as_ptr() as *const _, - Some(transmute(notify_typefind_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::typefind\0".as_ptr() as *const _, + Some(transmute(notify_typefind_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/base_transform.rs b/gstreamer-base/src/auto/base_transform.rs index d85f9982f..13bd2f14c 100644 --- a/gstreamer-base/src/auto/base_transform.rs +++ b/gstreamer-base/src/auto/base_transform.rs @@ -3,13 +3,13 @@ // DO NOT EDIT use glib; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -63,7 +63,10 @@ pub trait BaseTransformExt: 'static { fn set_property_qos(&self, qos: bool); - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> BaseTransformExt for O { @@ -73,25 +76,33 @@ impl> BaseTransformExt for O { fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(gst_base_sys::gst_base_transform_get_buffer_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_base_sys::gst_base_transform_get_buffer_pool( + self.as_ref().to_glib_none().0, + )) } } fn is_in_place(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_transform_is_in_place(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_transform_is_in_place( + self.as_ref().to_glib_none().0, + )) } } fn is_passthrough(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_transform_is_passthrough(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_transform_is_passthrough( + self.as_ref().to_glib_none().0, + )) } } fn is_qos_enabled(&self) -> bool { unsafe { - from_glib(gst_base_sys::gst_base_transform_is_qos_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_base_sys::gst_base_transform_is_qos_enabled( + self.as_ref().to_glib_none().0, + )) } } @@ -109,71 +120,116 @@ impl> BaseTransformExt for O { fn set_gap_aware(&self, gap_aware: bool) { unsafe { - gst_base_sys::gst_base_transform_set_gap_aware(self.as_ref().to_glib_none().0, gap_aware.to_glib()); + gst_base_sys::gst_base_transform_set_gap_aware( + self.as_ref().to_glib_none().0, + gap_aware.to_glib(), + ); } } fn set_in_place(&self, in_place: bool) { unsafe { - gst_base_sys::gst_base_transform_set_in_place(self.as_ref().to_glib_none().0, in_place.to_glib()); + gst_base_sys::gst_base_transform_set_in_place( + self.as_ref().to_glib_none().0, + in_place.to_glib(), + ); } } fn set_passthrough(&self, passthrough: bool) { unsafe { - gst_base_sys::gst_base_transform_set_passthrough(self.as_ref().to_glib_none().0, passthrough.to_glib()); + gst_base_sys::gst_base_transform_set_passthrough( + self.as_ref().to_glib_none().0, + passthrough.to_glib(), + ); } } fn set_prefer_passthrough(&self, prefer_passthrough: bool) { unsafe { - gst_base_sys::gst_base_transform_set_prefer_passthrough(self.as_ref().to_glib_none().0, prefer_passthrough.to_glib()); + gst_base_sys::gst_base_transform_set_prefer_passthrough( + self.as_ref().to_glib_none().0, + prefer_passthrough.to_glib(), + ); } } fn set_qos_enabled(&self, enabled: bool) { unsafe { - gst_base_sys::gst_base_transform_set_qos_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_base_sys::gst_base_transform_set_qos_enabled( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) { unsafe { - gst_base_sys::gst_base_transform_update_qos(self.as_ref().to_glib_none().0, proportion, diff, timestamp.to_glib()); + gst_base_sys::gst_base_transform_update_qos( + self.as_ref().to_glib_none().0, + proportion, + diff, + timestamp.to_glib(), + ); } } fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_base_sys::gst_base_transform_update_src_caps(self.as_ref().to_glib_none().0, updated_caps.to_glib_none().0), "Failed to update src caps") + glib_result_from_gboolean!( + gst_base_sys::gst_base_transform_update_src_caps( + self.as_ref().to_glib_none().0, + updated_caps.to_glib_none().0 + ), + "Failed to update src caps" + ) } } fn get_property_qos(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_qos(&self, qos: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, Value::from(&qos).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + Value::from(&qos).to_glib_none().0, + ); } } - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_qos_trampoline(this: *mut gst_base_sys::GstBaseTransform, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_qos_trampoline( + this: *mut gst_base_sys::GstBaseTransform, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&BaseTransform::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _, - Some(transmute(notify_qos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::qos\0".as_ptr() as *const _, + Some(transmute(notify_qos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-base/src/auto/flags.rs b/gstreamer-base/src/auto/flags.rs index 5f09306cc..6afbdafc5 100644 --- a/gstreamer-base/src/auto/flags.rs +++ b/gstreamer-base/src/auto/flags.rs @@ -32,4 +32,3 @@ impl FromGlib for BaseParseFrameFlags { BaseParseFrameFlags::from_bits_truncate(value) } } - diff --git a/gstreamer-base/src/auto/functions.rs b/gstreamer-base/src/auto/functions.rs index 3a8ed004d..1f3dbf372 100644 --- a/gstreamer-base/src/auto/functions.rs +++ b/gstreamer-base/src/auto/functions.rs @@ -8,48 +8,84 @@ use gst; use gst_base_sys; use std::mem; - pub fn type_find_helper>(src: &P, size: u64) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_base_sys::gst_type_find_helper(src.as_ref().to_glib_none().0, size)) + from_glib_full(gst_base_sys::gst_type_find_helper( + src.as_ref().to_glib_none().0, + size, + )) } } -pub fn type_find_helper_for_buffer>(obj: Option<&P>, buf: &gst::Buffer) -> (Option, gst::TypeFindProbability) { +pub fn type_find_helper_for_buffer>( + obj: Option<&P>, + buf: &gst::Buffer, +) -> (Option, gst::TypeFindProbability) { assert_initialized_main_thread!(); unsafe { let mut prob = mem::uninitialized(); - let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_buffer(obj.map(|p| p.as_ref()).to_glib_none().0, buf.to_glib_none().0, &mut prob)); + let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_buffer( + obj.map(|p| p.as_ref()).to_glib_none().0, + buf.to_glib_none().0, + &mut prob, + )); (ret, from_glib(prob)) } } #[cfg(any(feature = "v1_16", feature = "dox"))] -pub fn type_find_helper_for_buffer_with_extension>(obj: Option<&P>, buf: &gst::Buffer, extension: Option<&str>) -> (Option, gst::TypeFindProbability) { +pub fn type_find_helper_for_buffer_with_extension>( + obj: Option<&P>, + buf: &gst::Buffer, + extension: Option<&str>, +) -> (Option, gst::TypeFindProbability) { assert_initialized_main_thread!(); unsafe { let mut prob = mem::uninitialized(); - let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_buffer_with_extension(obj.map(|p| p.as_ref()).to_glib_none().0, buf.to_glib_none().0, extension.to_glib_none().0, &mut prob)); + let ret = from_glib_full( + gst_base_sys::gst_type_find_helper_for_buffer_with_extension( + obj.map(|p| p.as_ref()).to_glib_none().0, + buf.to_glib_none().0, + extension.to_glib_none().0, + &mut prob, + ), + ); (ret, from_glib(prob)) } } #[cfg(any(feature = "v1_16", feature = "dox"))] -pub fn type_find_helper_for_data_with_extension>(obj: Option<&P>, data: &[u8], extension: Option<&str>) -> (Option, gst::TypeFindProbability) { +pub fn type_find_helper_for_data_with_extension>( + obj: Option<&P>, + data: &[u8], + extension: Option<&str>, +) -> (Option, gst::TypeFindProbability) { assert_initialized_main_thread!(); let size = data.len() as usize; unsafe { let mut prob = mem::uninitialized(); - let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_data_with_extension(obj.map(|p| p.as_ref()).to_glib_none().0, data.to_glib_none().0, size, extension.to_glib_none().0, &mut prob)); + let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_data_with_extension( + obj.map(|p| p.as_ref()).to_glib_none().0, + data.to_glib_none().0, + size, + extension.to_glib_none().0, + &mut prob, + )); (ret, from_glib(prob)) } } -pub fn type_find_helper_for_extension>(obj: Option<&P>, extension: &str) -> Option { +pub fn type_find_helper_for_extension>( + obj: Option<&P>, + extension: &str, +) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_base_sys::gst_type_find_helper_for_extension(obj.map(|p| p.as_ref()).to_glib_none().0, extension.to_glib_none().0)) + from_glib_full(gst_base_sys::gst_type_find_helper_for_extension( + obj.map(|p| p.as_ref()).to_glib_none().0, + extension.to_glib_none().0, + )) } } diff --git a/gstreamer-base/src/auto/mod.rs b/gstreamer-base/src/auto/mod.rs index c60a15d8e..6e3f20227 100644 --- a/gstreamer-base/src/auto/mod.rs +++ b/gstreamer-base/src/auto/mod.rs @@ -8,32 +8,32 @@ pub use self::adapter::{Adapter, AdapterClass}; #[cfg(any(feature = "v1_14", feature = "dox"))] mod aggregator; #[cfg(any(feature = "v1_14", feature = "dox"))] -pub use self::aggregator::{Aggregator, AggregatorClass, NONE_AGGREGATOR}; -#[cfg(any(feature = "v1_14", feature = "dox"))] pub use self::aggregator::AggregatorExt; +#[cfg(any(feature = "v1_14", feature = "dox"))] +pub use self::aggregator::{Aggregator, AggregatorClass, NONE_AGGREGATOR}; #[cfg(any(feature = "v1_14", feature = "dox"))] mod aggregator_pad; #[cfg(any(feature = "v1_14", feature = "dox"))] -pub use self::aggregator_pad::{AggregatorPad, AggregatorPadClass, NONE_AGGREGATOR_PAD}; -#[cfg(any(feature = "v1_14", feature = "dox"))] pub use self::aggregator_pad::AggregatorPadExt; +#[cfg(any(feature = "v1_14", feature = "dox"))] +pub use self::aggregator_pad::{AggregatorPad, AggregatorPadClass, NONE_AGGREGATOR_PAD}; mod base_parse; -pub use self::base_parse::{BaseParse, BaseParseClass, NONE_BASE_PARSE}; pub use self::base_parse::BaseParseExt; +pub use self::base_parse::{BaseParse, BaseParseClass, NONE_BASE_PARSE}; mod base_sink; -pub use self::base_sink::{BaseSink, BaseSinkClass, NONE_BASE_SINK}; pub use self::base_sink::BaseSinkExt; +pub use self::base_sink::{BaseSink, BaseSinkClass, NONE_BASE_SINK}; mod base_src; -pub use self::base_src::{BaseSrc, BaseSrcClass, NONE_BASE_SRC}; pub use self::base_src::BaseSrcExt; +pub use self::base_src::{BaseSrc, BaseSrcClass, NONE_BASE_SRC}; mod base_transform; -pub use self::base_transform::{BaseTransform, BaseTransformClass, NONE_BASE_TRANSFORM}; pub use self::base_transform::BaseTransformExt; +pub use self::base_transform::{BaseTransform, BaseTransformClass, NONE_BASE_TRANSFORM}; mod push_src; pub use self::push_src::{PushSrc, PushSrcClass, NONE_PUSH_SRC}; diff --git a/gstreamer-base/src/auto/push_src.rs b/gstreamer-base/src/auto/push_src.rs index 6d99c9677..d61afc9a7 100644 --- a/gstreamer-base/src/auto/push_src.rs +++ b/gstreamer-base/src/auto/push_src.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use BaseSrc; use glib::translate::*; use gst; use gst_base_sys; +use BaseSrc; glib_wrapper! { pub struct PushSrc(Object) @extends BaseSrc, gst::Element, gst::Object; diff --git a/gstreamer-base/src/lib.rs b/gstreamer-base/src/lib.rs index 9b336359e..bb70667d8 100644 --- a/gstreamer-base/src/lib.rs +++ b/gstreamer-base/src/lib.rs @@ -38,7 +38,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] -#[rustfmt::skip] mod auto; pub use auto::functions::*; pub use auto::*; diff --git a/gstreamer-check/src/auto/mod.rs b/gstreamer-check/src/auto/mod.rs index 8b013a1db..be1d561ec 100644 --- a/gstreamer-check/src/auto/mod.rs +++ b/gstreamer-check/src/auto/mod.rs @@ -6,5 +6,4 @@ mod test_clock; pub use self::test_clock::{TestClock, TestClockClass}; #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-check/src/auto/test_clock.rs b/gstreamer-check/src/auto/test_clock.rs index be038d0c5..a9a47bbdd 100644 --- a/gstreamer-check/src/auto/test_clock.rs +++ b/gstreamer-check/src/auto/test_clock.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -27,15 +27,16 @@ glib_wrapper! { impl TestClock { pub fn new() -> TestClock { assert_initialized_main_thread!(); - unsafe { - gst::Clock::from_glib_full(gst_check_sys::gst_test_clock_new()).unsafe_cast() - } + unsafe { gst::Clock::from_glib_full(gst_check_sys::gst_test_clock_new()).unsafe_cast() } } pub fn new_with_start_time(start_time: gst::ClockTime) -> TestClock { assert_initialized_main_thread!(); unsafe { - gst::Clock::from_glib_full(gst_check_sys::gst_test_clock_new_with_start_time(start_time.to_glib())).unsafe_cast() + gst::Clock::from_glib_full(gst_check_sys::gst_test_clock_new_with_start_time( + start_time.to_glib(), + )) + .unsafe_cast() } } @@ -46,14 +47,14 @@ impl TestClock { } pub fn crank(&self) -> bool { - unsafe { - from_glib(gst_check_sys::gst_test_clock_crank(self.to_glib_none().0)) - } + unsafe { from_glib(gst_check_sys::gst_test_clock_crank(self.to_glib_none().0)) } } pub fn get_next_entry_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_check_sys::gst_test_clock_get_next_entry_time(self.to_glib_none().0)) + from_glib(gst_check_sys::gst_test_clock_get_next_entry_time( + self.to_glib_none().0, + )) } } @@ -62,9 +63,7 @@ impl TestClock { //} pub fn peek_id_count(&self) -> u32 { - unsafe { - gst_check_sys::gst_test_clock_peek_id_count(self.to_glib_none().0) - } + unsafe { gst_check_sys::gst_test_clock_peek_id_count(self.to_glib_none().0) } } //pub fn peek_next_pending_id(&self, pending_id: /*Ignored*/&mut gst::ClockID) -> bool { @@ -107,21 +106,33 @@ impl TestClock { pub fn get_property_clock_type(&self) -> gst::ClockType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"clock-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"clock-type\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_clock_type(&self, clock_type: gst::ClockType) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"clock-type\0".as_ptr() as *const _, Value::from(&clock_type).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"clock-type\0".as_ptr() as *const _, + Value::from(&clock_type).to_glib_none().0, + ); } } pub fn get_property_start_time(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"start-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -130,15 +141,28 @@ impl TestClock { // unsafe { TODO: call gst_check_sys:gst_test_clock_id_list_get_latest_time() } //} - pub fn connect_property_clock_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_clock_type_trampoline(this: *mut gst_check_sys::GstTestClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_clock_type_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_clock_type_trampoline< + F: Fn(&TestClock) + Send + Sync + 'static, + >( + this: *mut gst_check_sys::GstTestClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::clock-type\0".as_ptr() as *const _, - Some(transmute(notify_clock_type_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::clock-type\0".as_ptr() as *const _, + Some(transmute(notify_clock_type_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-check/src/lib.rs b/gstreamer-check/src/lib.rs index ddaa4099c..7a2c38220 100644 --- a/gstreamer-check/src/lib.rs +++ b/gstreamer-check/src/lib.rs @@ -29,7 +29,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-editing-services/src/auto/asset.rs b/gstreamer-editing-services/src/auto/asset.rs index bdd95fa69..28cc1bbc1 100644 --- a/gstreamer-editing-services/src/auto/asset.rs +++ b/gstreamer-editing-services/src/auto/asset.rs @@ -2,26 +2,26 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use Extractable; #[cfg(feature = "futures")] use futures::future; use ges_sys; use gio; use gio_sys; use glib; -use glib::GString; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; +use glib::Value; use glib_sys; use gobject_sys; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Error; +use Extractable; glib_wrapper! { pub struct Asset(Object); @@ -35,52 +35,88 @@ impl Asset { pub fn needs_reload(extractable_type: glib::types::Type, id: &str) -> bool { assert_initialized_main_thread!(); unsafe { - from_glib(ges_sys::ges_asset_needs_reload(extractable_type.to_glib(), id.to_glib_none().0)) + from_glib(ges_sys::ges_asset_needs_reload( + extractable_type.to_glib(), + id.to_glib_none().0, + )) } } - pub fn request(extractable_type: glib::types::Type, id: Option<&str>) -> Result, Error> { + pub fn request( + extractable_type: glib::types::Type, + id: Option<&str>, + ) -> Result, Error> { assert_initialized_main_thread!(); unsafe { let mut error = ptr::null_mut(); - let ret = ges_sys::ges_asset_request(extractable_type.to_glib(), id.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ges_sys::ges_asset_request( + extractable_type.to_glib(), + id.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } - pub fn request_async, Q: FnOnce(Result) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: Option<&P>, callback: Q) { + pub fn request_async< + P: IsA, + Q: FnOnce(Result) + Send + 'static, + >( + extractable_type: glib::types::Type, + id: &str, + cancellable: Option<&P>, + callback: Q, + ) { assert_initialized_main_thread!(); let user_data: Box = Box::new(callback); - unsafe extern "C" fn request_async_trampoline) + Send + 'static>(_source_object: *mut gobject_sys::GObject, res: *mut gio_sys::GAsyncResult, user_data: glib_sys::gpointer) { + unsafe extern "C" fn request_async_trampoline< + Q: FnOnce(Result) + Send + 'static, + >( + _source_object: *mut gobject_sys::GObject, + res: *mut gio_sys::GAsyncResult, + user_data: glib_sys::gpointer, + ) { let mut error = ptr::null_mut(); let ret = ges_sys::ges_asset_request_finish(res, &mut error); - let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; + let result = if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + }; let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } let callback = request_async_trampoline::; unsafe { - ges_sys::ges_asset_request_async(extractable_type.to_glib(), id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); + ges_sys::ges_asset_request_async( + extractable_type.to_glib(), + id.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box::into_raw(user_data) as *mut _, + ); } } #[cfg(feature = "futures")] - pub fn request_async_future(extractable_type: glib::types::Type, id: &str) -> Box_> + std::marker::Unpin> { - use gio::GioFuture; + pub fn request_async_future( + extractable_type: glib::types::Type, + id: &str, + ) -> Box_> + std::marker::Unpin> { use fragile::Fragile; + use gio::GioFuture; let id = String::from(id); GioFuture::new(&(), move |_obj, send| { let cancellable = gio::Cancellable::new(); let send = Fragile::new(send); - Self::request_async( - extractable_type, - &id, - Some(&cancellable), - move |res| { - let _ = send.into_inner().send(res); - }, - ); + Self::request_async(extractable_type, &id, Some(&cancellable), move |res| { + let _ = send.into_inner().send(res); + }); cancellable }) @@ -112,7 +148,8 @@ pub trait AssetExt: 'static { fn connect_property_proxy_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_proxy_target_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_proxy_target_notify(&self, f: F) + -> SignalHandlerId; } impl> AssetExt for O { @@ -120,89 +157,130 @@ impl> AssetExt for O { unsafe { let mut error = ptr::null_mut(); let ret = ges_sys::ges_asset_extract(self.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } fn get_error(&self) -> Option { - unsafe { - from_glib_none(ges_sys::ges_asset_get_error(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_asset_get_error(self.as_ref().to_glib_none().0)) } } fn get_extractable_type(&self) -> glib::types::Type { unsafe { - from_glib(ges_sys::ges_asset_get_extractable_type(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_asset_get_extractable_type( + self.as_ref().to_glib_none().0, + )) } } fn get_id(&self) -> Option { - unsafe { - from_glib_none(ges_sys::ges_asset_get_id(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_asset_get_id(self.as_ref().to_glib_none().0)) } } fn get_proxy(&self) -> Option { - unsafe { - from_glib_none(ges_sys::ges_asset_get_proxy(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_asset_get_proxy(self.as_ref().to_glib_none().0)) } } fn get_proxy_target(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_asset_get_proxy_target(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_asset_get_proxy_target( + self.as_ref().to_glib_none().0, + )) } } fn list_proxies(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ges_sys::ges_asset_list_proxies(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ges_sys::ges_asset_list_proxies( + self.as_ref().to_glib_none().0, + )) } } fn set_proxy>(&self, proxy: Option<&P>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_asset_set_proxy(self.as_ref().to_glib_none().0, proxy.map(|p| p.as_ref()).to_glib_none().0), "Failed to set proxy") + glib_result_from_gboolean!( + ges_sys::ges_asset_set_proxy( + self.as_ref().to_glib_none().0, + proxy.map(|p| p.as_ref()).to_glib_none().0 + ), + "Failed to set proxy" + ) } } fn unproxy>(&self, proxy: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_asset_unproxy(self.as_ref().to_glib_none().0, proxy.as_ref().to_glib_none().0), "Failed to unproxy asset") + glib_result_from_gboolean!( + ges_sys::ges_asset_unproxy( + self.as_ref().to_glib_none().0, + proxy.as_ref().to_glib_none().0 + ), + "Failed to unproxy asset" + ) } } fn set_property_proxy_target(&self, proxy_target: Option<&Asset>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"proxy-target\0".as_ptr() as *const _, Value::from(proxy_target).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"proxy-target\0".as_ptr() as *const _, + Value::from(proxy_target).to_glib_none().0, + ); } } fn connect_property_proxy_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_proxy_trampoline(this: *mut ges_sys::GESAsset, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_proxy_trampoline( + this: *mut ges_sys::GESAsset, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Asset::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::proxy\0".as_ptr() as *const _, - Some(transmute(notify_proxy_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::proxy\0".as_ptr() as *const _, + Some(transmute(notify_proxy_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_proxy_target_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_proxy_target_trampoline(this: *mut ges_sys::GESAsset, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_proxy_target_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_proxy_target_trampoline( + this: *mut ges_sys::GESAsset, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Asset::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::proxy-target\0".as_ptr() as *const _, - Some(transmute(notify_proxy_target_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::proxy-target\0".as_ptr() as *const _, + Some(transmute( + notify_proxy_target_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/base_effect.rs b/gstreamer-editing-services/src/auto/base_effect.rs index 2be0c98fa..ab4b1614e 100644 --- a/gstreamer-editing-services/src/auto/base_effect.rs +++ b/gstreamer-editing-services/src/auto/base_effect.rs @@ -2,11 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib::translate::*; use Extractable; use TimelineElement; use TrackElement; -use ges_sys; -use glib::translate::*; glib_wrapper! { pub struct BaseEffect(Object) @extends TrackElement, TimelineElement, @implements Extractable; diff --git a/gstreamer-editing-services/src/auto/clip.rs b/gstreamer-editing-services/src/auto/clip.rs index f172e2689..5e1f9db53 100644 --- a/gstreamer-editing-services/src/auto/clip.rs +++ b/gstreamer-editing-services/src/auto/clip.rs @@ -2,6 +2,16 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; use Asset; use BaseEffect; use Container; @@ -11,16 +21,6 @@ use TimelineElement; use Track; use TrackElement; use TrackType; -use ges_sys; -use glib; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Clip(Object) @extends Container, TimelineElement, @implements Extractable; @@ -35,9 +35,18 @@ pub const NONE_CLIP: Option<&Clip> = None; pub trait ClipExt: 'static { fn add_asset>(&self, asset: &P) -> Option; - fn find_track_element>(&self, track: Option<&P>, type_: glib::types::Type) -> Option; + fn find_track_element>( + &self, + track: Option<&P>, + type_: glib::types::Type, + ) -> Option; - fn find_track_elements>(&self, track: Option<&P>, track_type: TrackType, type_: glib::types::Type) -> Vec; + fn find_track_elements>( + &self, + track: Option<&P>, + track_type: TrackType, + type_: glib::types::Type, + ) -> Vec; fn get_layer(&self) -> Option; @@ -53,121 +62,216 @@ pub trait ClipExt: 'static { fn set_supported_formats(&self, supportedformats: TrackType); - fn set_top_effect_index>(&self, effect: &P, newindex: u32) -> Result<(), glib::error::BoolError>; + fn set_top_effect_index>( + &self, + effect: &P, + newindex: u32, + ) -> Result<(), glib::error::BoolError>; - fn set_top_effect_priority>(&self, effect: &P, newpriority: u32) -> Result<(), glib::error::BoolError>; + fn set_top_effect_priority>( + &self, + effect: &P, + newpriority: u32, + ) -> Result<(), glib::error::BoolError>; fn split(&self, position: u64) -> Option; fn connect_property_layer_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> ClipExt for O { fn add_asset>(&self, asset: &P) -> Option { unsafe { - from_glib_none(ges_sys::ges_clip_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_clip_add_asset( + self.as_ref().to_glib_none().0, + asset.as_ref().to_glib_none().0, + )) } } - fn find_track_element>(&self, track: Option<&P>, type_: glib::types::Type) -> Option { + fn find_track_element>( + &self, + track: Option<&P>, + type_: glib::types::Type, + ) -> Option { unsafe { - from_glib_full(ges_sys::ges_clip_find_track_element(self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, type_.to_glib())) + from_glib_full(ges_sys::ges_clip_find_track_element( + self.as_ref().to_glib_none().0, + track.map(|p| p.as_ref()).to_glib_none().0, + type_.to_glib(), + )) } } - fn find_track_elements>(&self, track: Option<&P>, track_type: TrackType, type_: glib::types::Type) -> Vec { + fn find_track_elements>( + &self, + track: Option<&P>, + track_type: TrackType, + type_: glib::types::Type, + ) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_find_track_elements(self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, track_type.to_glib(), type_.to_glib())) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_find_track_elements( + self.as_ref().to_glib_none().0, + track.map(|p| p.as_ref()).to_glib_none().0, + track_type.to_glib(), + type_.to_glib(), + )) } } fn get_layer(&self) -> Option { - unsafe { - from_glib_full(ges_sys::ges_clip_get_layer(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(ges_sys::ges_clip_get_layer(self.as_ref().to_glib_none().0)) } } fn get_supported_formats(&self) -> TrackType { unsafe { - from_glib(ges_sys::ges_clip_get_supported_formats(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_clip_get_supported_formats( + self.as_ref().to_glib_none().0, + )) } } fn get_top_effect_index>(&self, effect: &P) -> i32 { unsafe { - ges_sys::ges_clip_get_top_effect_index(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0) + ges_sys::ges_clip_get_top_effect_index( + self.as_ref().to_glib_none().0, + effect.as_ref().to_glib_none().0, + ) } } fn get_top_effect_position>(&self, effect: &P) -> i32 { unsafe { - ges_sys::ges_clip_get_top_effect_position(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0) + ges_sys::ges_clip_get_top_effect_position( + self.as_ref().to_glib_none().0, + effect.as_ref().to_glib_none().0, + ) } } fn get_top_effects(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_get_top_effects(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_get_top_effects( + self.as_ref().to_glib_none().0, + )) } } fn move_to_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_clip_move_to_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0), "Failed to move clip to specified layer") + glib_result_from_gboolean!( + ges_sys::ges_clip_move_to_layer( + self.as_ref().to_glib_none().0, + layer.as_ref().to_glib_none().0 + ), + "Failed to move clip to specified layer" + ) } } fn set_supported_formats(&self, supportedformats: TrackType) { unsafe { - ges_sys::ges_clip_set_supported_formats(self.as_ref().to_glib_none().0, supportedformats.to_glib()); + ges_sys::ges_clip_set_supported_formats( + self.as_ref().to_glib_none().0, + supportedformats.to_glib(), + ); } } - fn set_top_effect_index>(&self, effect: &P, newindex: u32) -> Result<(), glib::error::BoolError> { + fn set_top_effect_index>( + &self, + effect: &P, + newindex: u32, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_clip_set_top_effect_index(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newindex), "Failed to move effect") + glib_result_from_gboolean!( + ges_sys::ges_clip_set_top_effect_index( + self.as_ref().to_glib_none().0, + effect.as_ref().to_glib_none().0, + newindex + ), + "Failed to move effect" + ) } } - fn set_top_effect_priority>(&self, effect: &P, newpriority: u32) -> Result<(), glib::error::BoolError> { + fn set_top_effect_priority>( + &self, + effect: &P, + newpriority: u32, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_clip_set_top_effect_priority(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newpriority), "Failed to the set top effect priority") + glib_result_from_gboolean!( + ges_sys::ges_clip_set_top_effect_priority( + self.as_ref().to_glib_none().0, + effect.as_ref().to_glib_none().0, + newpriority + ), + "Failed to the set top effect priority" + ) } } fn split(&self, position: u64) -> Option { unsafe { - from_glib_none(ges_sys::ges_clip_split(self.as_ref().to_glib_none().0, position)) + from_glib_none(ges_sys::ges_clip_split( + self.as_ref().to_glib_none().0, + position, + )) } } fn connect_property_layer_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_layer_trampoline(this: *mut ges_sys::GESClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_layer_trampoline( + this: *mut ges_sys::GESClip, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Clip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::layer\0".as_ptr() as *const _, - Some(transmute(notify_layer_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::layer\0".as_ptr() as *const _, + Some(transmute(notify_layer_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_supported_formats_trampoline(this: *mut ges_sys::GESClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_supported_formats_trampoline( + this: *mut ges_sys::GESClip, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Clip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, - Some(transmute(notify_supported_formats_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::supported-formats\0".as_ptr() as *const _, + Some(transmute( + notify_supported_formats_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/container.rs b/gstreamer-editing-services/src/auto/container.rs index 4b4f955ed..6d9dba058 100644 --- a/gstreamer-editing-services/src/auto/container.rs +++ b/gstreamer-editing-services/src/auto/container.rs @@ -2,24 +2,24 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; use Edge; use EditMode; use Extractable; use Layer; use TimelineElement; -use ges_sys; -use glib; -use glib::StaticType; -use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gobject_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Container(Object) @extends TimelineElement, @implements Extractable; @@ -32,9 +32,7 @@ glib_wrapper! { impl Container { pub fn group(containers: &[Container]) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_container_group(containers.to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_container_group(containers.to_glib_none().0)) } } } @@ -43,7 +41,14 @@ pub const NONE_CONTAINER: Option<&Container> = None; pub trait GESContainerExt: 'static { fn add>(&self, child: &P) -> Result<(), glib::error::BoolError>; - fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError>; + fn edit( + &self, + layers: &[Layer], + new_layer_priority: i32, + mode: EditMode, + edge: Edge, + position: u64, + ) -> Result<(), glib::error::BoolError>; fn get_children(&self, recursive: bool) -> Vec; @@ -53,9 +58,15 @@ pub trait GESContainerExt: 'static { fn get_property_height(&self) -> u32; - fn connect_child_added(&self, f: F) -> SignalHandlerId; + fn connect_child_added( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_child_removed(&self, f: F) -> SignalHandlerId; + fn connect_child_removed( + &self, + f: F, + ) -> SignalHandlerId; fn connect_property_height_notify(&self, f: F) -> SignalHandlerId; } @@ -63,81 +74,156 @@ pub trait GESContainerExt: 'static { impl> GESContainerExt for O { fn add>(&self, child: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_container_add(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!( + ges_sys::ges_container_add( + self.as_ref().to_glib_none().0, + child.as_ref().to_glib_none().0 + ), + "Failed to add element" + ) } } - fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError> { + fn edit( + &self, + layers: &[Layer], + new_layer_priority: i32, + mode: EditMode, + edge: Edge, + position: u64, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_container_edit(self.as_ref().to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position), "Failed to edit container") + glib_result_from_gboolean!( + ges_sys::ges_container_edit( + self.as_ref().to_glib_none().0, + layers.to_glib_none().0, + new_layer_priority, + mode.to_glib(), + edge.to_glib(), + position + ), + "Failed to edit container" + ) } } fn get_children(&self, recursive: bool) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_container_get_children(self.as_ref().to_glib_none().0, recursive.to_glib())) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_container_get_children( + self.as_ref().to_glib_none().0, + recursive.to_glib(), + )) } } fn remove>(&self, child: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_container_remove(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!( + ges_sys::ges_container_remove( + self.as_ref().to_glib_none().0, + child.as_ref().to_glib_none().0 + ), + "Failed to remove element" + ) } } fn ungroup(&self, recursive: bool) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_container_ungroup(self.as_ref().to_glib_full(), recursive.to_glib())) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_container_ungroup( + self.as_ref().to_glib_full(), + recursive.to_glib(), + )) } } fn get_property_height(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"height\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"height\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - fn connect_child_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn child_added_trampoline(this: *mut ges_sys::GESContainer, element: *mut ges_sys::GESTimelineElement, f: glib_sys::gpointer) - where P: IsA + fn connect_child_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn child_added_trampoline( + this: *mut ges_sys::GESContainer, + element: *mut ges_sys::GESTimelineElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) + f( + &Container::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"child-added\0".as_ptr() as *const _, - Some(transmute(child_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"child-added\0".as_ptr() as *const _, + Some(transmute(child_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_child_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn child_removed_trampoline(this: *mut ges_sys::GESContainer, element: *mut ges_sys::GESTimelineElement, f: glib_sys::gpointer) - where P: IsA + fn connect_child_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn child_removed_trampoline( + this: *mut ges_sys::GESContainer, + element: *mut ges_sys::GESTimelineElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) + f( + &Container::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"child-removed\0".as_ptr() as *const _, - Some(transmute(child_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"child-removed\0".as_ptr() as *const _, + Some(transmute(child_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_height_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_height_trampoline(this: *mut ges_sys::GESContainer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_height_trampoline( + this: *mut ges_sys::GESContainer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Container::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::height\0".as_ptr() as *const _, - Some(transmute(notify_height_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::height\0".as_ptr() as *const _, + Some(transmute(notify_height_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/effect.rs b/gstreamer-editing-services/src/auto/effect.rs index 1c2e6283e..94c64a672 100644 --- a/gstreamer-editing-services/src/auto/effect.rs +++ b/gstreamer-editing-services/src/auto/effect.rs @@ -2,17 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib::object::IsA; +use glib::translate::*; +use glib::GString; +use glib::StaticType; +use glib::Value; +use gobject_sys; use BaseEffect; use Extractable; use TimelineElement; use TrackElement; -use ges_sys; -use glib::GString; -use glib::StaticType; -use glib::Value; -use glib::object::IsA; -use glib::translate::*; -use gobject_sys; glib_wrapper! { pub struct Effect(Object) @extends BaseEffect, TrackElement, TimelineElement, @implements Extractable; @@ -25,9 +25,7 @@ glib_wrapper! { impl Effect { pub fn new(bin_description: &str) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_effect_new(bin_description.to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_effect_new(bin_description.to_glib_none().0)) } } } @@ -41,7 +39,11 @@ impl> EffectExt for O { fn get_property_bin_description(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"bin-description\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"bin-description\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } diff --git a/gstreamer-editing-services/src/auto/enums.rs b/gstreamer-editing-services/src/auto/enums.rs index 6a6144a7f..3a7511bdc 100644 --- a/gstreamer-editing-services/src/auto/enums.rs +++ b/gstreamer-editing-services/src/auto/enums.rs @@ -3,17 +3,16 @@ // DO NOT EDIT use ges_sys; -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum Edge { EdgeStart, EdgeEnd, @@ -31,7 +30,7 @@ impl ToGlib for Edge { Edge::EdgeStart => ges_sys::GES_EDGE_START, Edge::EdgeEnd => ges_sys::GES_EDGE_END, Edge::EdgeNone => ges_sys::GES_EDGE_NONE, - Edge::__Unknown(value) => value + Edge::__Unknown(value) => value, } } } @@ -73,8 +72,7 @@ impl SetValue for Edge { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum EditMode { EditNormal, EditRipple, @@ -96,7 +94,7 @@ impl ToGlib for EditMode { EditMode::EditRoll => ges_sys::GES_EDIT_MODE_ROLL, EditMode::EditTrim => ges_sys::GES_EDIT_MODE_TRIM, EditMode::EditSlide => ges_sys::GES_EDIT_MODE_SLIDE, - EditMode::__Unknown(value) => value + EditMode::__Unknown(value) => value, } } } @@ -139,4 +137,3 @@ impl SetValue for EditMode { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-editing-services/src/auto/extractable.rs b/gstreamer-editing-services/src/auto/extractable.rs index 05183a2b2..154a4d29f 100644 --- a/gstreamer-editing-services/src/auto/extractable.rs +++ b/gstreamer-editing-services/src/auto/extractable.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Asset; use ges_sys; use glib; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; +use Asset; glib_wrapper! { pub struct Extractable(Interface); @@ -30,19 +30,29 @@ pub trait ExtractableExt: 'static { impl> ExtractableExt for O { fn get_asset(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_extractable_get_asset(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_extractable_get_asset( + self.as_ref().to_glib_none().0, + )) } } fn get_id(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_extractable_get_id(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_extractable_get_id( + self.as_ref().to_glib_none().0, + )) } } fn set_asset>(&self, asset: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_extractable_set_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0), "Failed to set asset") + glib_result_from_gboolean!( + ges_sys::ges_extractable_set_asset( + self.as_ref().to_glib_none().0, + asset.as_ref().to_glib_none().0 + ), + "Failed to set asset" + ) } } } diff --git a/gstreamer-editing-services/src/auto/flags.rs b/gstreamer-editing-services/src/auto/flags.rs index c4fe7bddc..6b3ec3e4d 100644 --- a/gstreamer-editing-services/src/auto/flags.rs +++ b/gstreamer-editing-services/src/auto/flags.rs @@ -3,13 +3,13 @@ // DO NOT EDIT use ges_sys; -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; bitflags! { @@ -113,4 +113,3 @@ impl SetValue for TrackType { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-editing-services/src/auto/group.rs b/gstreamer-editing-services/src/auto/group.rs index 31c6b74c9..a5b17c637 100644 --- a/gstreamer-editing-services/src/auto/group.rs +++ b/gstreamer-editing-services/src/auto/group.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Container; -use Extractable; -use TimelineElement; use ges_sys; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Container; +use Extractable; +use TimelineElement; glib_wrapper! { pub struct Group(Object) @extends Container, TimelineElement, @implements Extractable; @@ -29,9 +29,7 @@ glib_wrapper! { impl Group { pub fn new() -> Group { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_group_new()) - } + unsafe { from_glib_none(ges_sys::ges_group_new()) } } } @@ -68,7 +66,8 @@ pub trait GroupExt: 'static { fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_duration_notify(&self, f: F) + -> SignalHandlerId; fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId; @@ -79,140 +78,225 @@ impl> GroupExt for O { fn get_property_duration(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_duration(&self, duration: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + Value::from(&duration).to_glib_none().0, + ); } } fn get_property_in_point(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"in-point\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"in-point\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_in_point(&self, in_point: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"in-point\0".as_ptr() as *const _, Value::from(&in_point).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"in-point\0".as_ptr() as *const _, + Value::from(&in_point).to_glib_none().0, + ); } } fn get_property_max_duration(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-duration\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_max_duration(&self, max_duration: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-duration\0".as_ptr() as *const _, Value::from(&max_duration).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-duration\0".as_ptr() as *const _, + Value::from(&max_duration).to_glib_none().0, + ); } } fn get_property_priority(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"priority\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"priority\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_priority(&self, priority: u32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"priority\0".as_ptr() as *const _, Value::from(&priority).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"priority\0".as_ptr() as *const _, + Value::from(&priority).to_glib_none().0, + ); } } fn get_property_start(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"start\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"start\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_start(&self, start: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"start\0".as_ptr() as *const _, Value::from(&start).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"start\0".as_ptr() as *const _, + Value::from(&start).to_glib_none().0, + ); } } fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut ges_sys::GESGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_duration_trampoline( + this: *mut ges_sys::GESGroup, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_in_point_trampoline(this: *mut ges_sys::GESGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_in_point_trampoline( + this: *mut ges_sys::GESGroup, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _, - Some(transmute(notify_in_point_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::in-point\0".as_ptr() as *const _, + Some(transmute(notify_in_point_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_duration_trampoline(this: *mut ges_sys::GESGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_duration_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_duration_trampoline( + this: *mut ges_sys::GESGroup, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _, - Some(transmute(notify_max_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-duration\0".as_ptr() as *const _, + Some(transmute( + notify_max_duration_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_priority_trampoline(this: *mut ges_sys::GESGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_priority_trampoline( + this: *mut ges_sys::GESGroup, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, - Some(transmute(notify_priority_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::priority\0".as_ptr() as *const _, + Some(transmute(notify_priority_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_start_trampoline(this: *mut ges_sys::GESGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_start_trampoline( + this: *mut ges_sys::GESGroup, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _, - Some(transmute(notify_start_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::start\0".as_ptr() as *const _, + Some(transmute(notify_start_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/layer.rs b/gstreamer-editing-services/src/auto/layer.rs index b5dc14bb6..846080802 100644 --- a/gstreamer-editing-services/src/auto/layer.rs +++ b/gstreamer-editing-services/src/auto/layer.rs @@ -2,22 +2,22 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Asset; -use Clip; -use Extractable; -use Timeline; -use TrackType; use ges_sys; use glib; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst; use std::boxed::Box as Box_; use std::mem::transmute; +use Asset; +use Clip; +use Extractable; +use Timeline; +use TrackType; glib_wrapper! { pub struct Layer(Object) @implements Extractable; @@ -30,9 +30,7 @@ glib_wrapper! { impl Layer { pub fn new() -> Layer { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_layer_new()) - } + unsafe { from_glib_none(ges_sys::ges_layer_new()) } } } @@ -45,7 +43,14 @@ impl Default for Layer { pub const NONE_LAYER: Option<&Layer> = None; pub trait LayerExt: 'static { - fn add_asset>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option; + fn add_asset>( + &self, + asset: &P, + start: gst::ClockTime, + inpoint: gst::ClockTime, + duration: gst::ClockTime, + track_types: TrackType, + ) -> Option; fn add_clip>(&self, clip: &P) -> Result<(), glib::error::BoolError>; @@ -76,76 +81,116 @@ pub trait LayerExt: 'static { fn connect_clip_removed(&self, f: F) -> SignalHandlerId; - fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_auto_transition_notify( + &self, + f: F, + ) -> SignalHandlerId; #[cfg_attr(feature = "v1_16", deprecated)] fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId; } impl> LayerExt for O { - fn add_asset>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option { + fn add_asset>( + &self, + asset: &P, + start: gst::ClockTime, + inpoint: gst::ClockTime, + duration: gst::ClockTime, + track_types: TrackType, + ) -> Option { unsafe { - from_glib_none(ges_sys::ges_layer_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib())) + from_glib_none(ges_sys::ges_layer_add_asset( + self.as_ref().to_glib_none().0, + asset.as_ref().to_glib_none().0, + start.to_glib(), + inpoint.to_glib(), + duration.to_glib(), + track_types.to_glib(), + )) } } fn add_clip>(&self, clip: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_layer_add_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0), "Failed to add clip") + glib_result_from_gboolean!( + ges_sys::ges_layer_add_clip( + self.as_ref().to_glib_none().0, + clip.as_ref().to_glib_none().0 + ), + "Failed to add clip" + ) } } fn get_auto_transition(&self) -> bool { unsafe { - from_glib(ges_sys::ges_layer_get_auto_transition(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_layer_get_auto_transition( + self.as_ref().to_glib_none().0, + )) } } fn get_clips(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_layer_get_clips(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_layer_get_clips( + self.as_ref().to_glib_none().0, + )) } } fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_layer_get_clips_in_interval(self.as_ref().to_glib_none().0, start.to_glib(), end.to_glib())) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_layer_get_clips_in_interval( + self.as_ref().to_glib_none().0, + start.to_glib(), + end.to_glib(), + )) } } fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_layer_get_duration(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_layer_get_duration( + self.as_ref().to_glib_none().0, + )) } } fn get_priority(&self) -> u32 { - unsafe { - ges_sys::ges_layer_get_priority(self.as_ref().to_glib_none().0) - } + unsafe { ges_sys::ges_layer_get_priority(self.as_ref().to_glib_none().0) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_layer_get_timeline(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_layer_get_timeline( + self.as_ref().to_glib_none().0, + )) } } fn is_empty(&self) -> bool { - unsafe { - from_glib(ges_sys::ges_layer_is_empty(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(ges_sys::ges_layer_is_empty(self.as_ref().to_glib_none().0)) } } fn remove_clip>(&self, clip: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_layer_remove_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0), "Failed to remove clip") + glib_result_from_gboolean!( + ges_sys::ges_layer_remove_clip( + self.as_ref().to_glib_none().0, + clip.as_ref().to_glib_none().0 + ), + "Failed to remove clip" + ) } } fn set_auto_transition(&self, auto_transition: bool) { unsafe { - ges_sys::ges_layer_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib()); + ges_sys::ges_layer_set_auto_transition( + self.as_ref().to_glib_none().0, + auto_transition.to_glib(), + ); } } @@ -157,63 +202,109 @@ impl> LayerExt for O { fn set_timeline>(&self, timeline: &P) { unsafe { - ges_sys::ges_layer_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0); + ges_sys::ges_layer_set_timeline( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_none().0, + ); } } fn connect_clip_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn clip_added_trampoline(this: *mut ges_sys::GESLayer, clip: *mut ges_sys::GESClip, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn clip_added_trampoline( + this: *mut ges_sys::GESLayer, + clip: *mut ges_sys::GESClip, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip)) + f( + &Layer::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(clip), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"clip-added\0".as_ptr() as *const _, - Some(transmute(clip_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"clip-added\0".as_ptr() as *const _, + Some(transmute(clip_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_clip_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn clip_removed_trampoline(this: *mut ges_sys::GESLayer, clip: *mut ges_sys::GESClip, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn clip_removed_trampoline( + this: *mut ges_sys::GESLayer, + clip: *mut ges_sys::GESClip, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip)) + f( + &Layer::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(clip), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"clip-removed\0".as_ptr() as *const _, - Some(transmute(clip_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"clip-removed\0".as_ptr() as *const _, + Some(transmute(clip_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_auto_transition_trampoline(this: *mut ges_sys::GESLayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_auto_transition_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_auto_transition_trampoline( + this: *mut ges_sys::GESLayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Layer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, - Some(transmute(notify_auto_transition_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::auto-transition\0".as_ptr() as *const _, + Some(transmute( + notify_auto_transition_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_priority_trampoline(this: *mut ges_sys::GESLayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_priority_trampoline( + this: *mut ges_sys::GESLayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Layer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, - Some(transmute(notify_priority_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::priority\0".as_ptr() as *const _, + Some(transmute(notify_priority_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/mod.rs b/gstreamer-editing-services/src/auto/mod.rs index 37128b2cd..74401c0fc 100644 --- a/gstreamer-editing-services/src/auto/mod.rs +++ b/gstreamer-editing-services/src/auto/mod.rs @@ -3,71 +3,71 @@ // DO NOT EDIT mod asset; -pub use self::asset::{Asset, AssetClass, NONE_ASSET}; pub use self::asset::AssetExt; +pub use self::asset::{Asset, AssetClass, NONE_ASSET}; mod base_effect; pub use self::base_effect::{BaseEffect, BaseEffectClass, NONE_BASE_EFFECT}; mod clip; -pub use self::clip::{Clip, ClipClass, NONE_CLIP}; pub use self::clip::ClipExt; +pub use self::clip::{Clip, ClipClass, NONE_CLIP}; mod container; -pub use self::container::{Container, ContainerClass, NONE_CONTAINER}; pub use self::container::GESContainerExt; +pub use self::container::{Container, ContainerClass, NONE_CONTAINER}; mod effect; -pub use self::effect::{Effect, EffectClass, NONE_EFFECT}; pub use self::effect::EffectExt; +pub use self::effect::{Effect, EffectClass, NONE_EFFECT}; mod extractable; -pub use self::extractable::{Extractable, NONE_EXTRACTABLE}; pub use self::extractable::ExtractableExt; +pub use self::extractable::{Extractable, NONE_EXTRACTABLE}; mod group; -pub use self::group::{Group, GroupClass, NONE_GROUP}; pub use self::group::GroupExt; +pub use self::group::{Group, GroupClass, NONE_GROUP}; mod layer; -pub use self::layer::{Layer, LayerClass, NONE_LAYER}; pub use self::layer::LayerExt; +pub use self::layer::{Layer, LayerClass, NONE_LAYER}; mod pipeline; -pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; pub use self::pipeline::GESPipelineExt; +pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; mod project; -pub use self::project::{Project, ProjectClass, NONE_PROJECT}; pub use self::project::ProjectExt; +pub use self::project::{Project, ProjectClass, NONE_PROJECT}; mod timeline; -pub use self::timeline::{Timeline, TimelineClass, NONE_TIMELINE}; pub use self::timeline::TimelineExt; +pub use self::timeline::{Timeline, TimelineClass, NONE_TIMELINE}; mod timeline_element; -pub use self::timeline_element::{TimelineElement, TimelineElementClass, NONE_TIMELINE_ELEMENT}; pub use self::timeline_element::TimelineElementExt; +pub use self::timeline_element::{TimelineElement, TimelineElementClass, NONE_TIMELINE_ELEMENT}; mod track; -pub use self::track::{Track, TrackClass, NONE_TRACK}; pub use self::track::GESTrackExt; +pub use self::track::{Track, TrackClass, NONE_TRACK}; mod track_element; -pub use self::track_element::{TrackElement, TrackElementClass, NONE_TRACK_ELEMENT}; pub use self::track_element::TrackElementExt; +pub use self::track_element::{TrackElement, TrackElementClass, NONE_TRACK_ELEMENT}; mod uri_clip; -pub use self::uri_clip::{UriClip, UriClipClass, NONE_URI_CLIP}; pub use self::uri_clip::UriClipExt; +pub use self::uri_clip::{UriClip, UriClipClass, NONE_URI_CLIP}; mod uri_clip_asset; -pub use self::uri_clip_asset::{UriClipAsset, UriClipAssetClass, NONE_URI_CLIP_ASSET}; pub use self::uri_clip_asset::UriClipAssetExt; +pub use self::uri_clip_asset::{UriClipAsset, UriClipAssetClass, NONE_URI_CLIP_ASSET}; mod uri_source_asset; -pub use self::uri_source_asset::{UriSourceAsset, UriSourceAssetClass, NONE_URI_SOURCE_ASSET}; pub use self::uri_source_asset::UriSourceAssetExt; +pub use self::uri_source_asset::{UriSourceAsset, UriSourceAssetClass, NONE_URI_SOURCE_ASSET}; mod enums; pub use self::enums::Edge; @@ -81,18 +81,18 @@ pub use self::flags::TrackType; pub mod traits { pub use super::AssetExt; pub use super::ClipExt; - pub use super::GESContainerExt; pub use super::EffectExt; pub use super::ExtractableExt; + pub use super::GESContainerExt; + pub use super::GESPipelineExt; + pub use super::GESTrackExt; pub use super::GroupExt; pub use super::LayerExt; - pub use super::GESPipelineExt; pub use super::ProjectExt; - pub use super::TimelineExt; pub use super::TimelineElementExt; - pub use super::GESTrackExt; + pub use super::TimelineExt; pub use super::TrackElementExt; - pub use super::UriClipExt; pub use super::UriClipAssetExt; + pub use super::UriClipExt; pub use super::UriSourceAssetExt; } diff --git a/gstreamer-editing-services/src/auto/pipeline.rs b/gstreamer-editing-services/src/auto/pipeline.rs index 0d948d23a..739304b93 100644 --- a/gstreamer-editing-services/src/auto/pipeline.rs +++ b/gstreamer-editing-services/src/auto/pipeline.rs @@ -2,18 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use PipelineFlags; -use Timeline; use ges_sys; use glib; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -21,6 +18,9 @@ use gst_pbutils; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Error; +use PipelineFlags; +use Timeline; glib_wrapper! { pub struct Pipeline(Object) @extends gst::Pipeline, gst::Element, gst::Object; @@ -33,9 +33,7 @@ glib_wrapper! { impl Pipeline { pub fn new() -> Pipeline { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_pipeline_new()) - } + unsafe { from_glib_none(ges_sys::ges_pipeline_new()) } } } @@ -62,11 +60,21 @@ pub trait GESPipelineExt: 'static { fn preview_set_video_sink>(&self, sink: &P); - fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error>; + fn save_thumbnail( + &self, + width: i32, + height: i32, + format: &str, + location: &str, + ) -> Result<(), Error>; fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError>; - fn set_render_settings>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>; + fn set_render_settings>( + &self, + output_uri: &str, + profile: &P, + ) -> Result<(), glib::error::BoolError>; fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError>; @@ -88,7 +96,8 @@ pub trait GESPipelineExt: 'static { fn set_property_video_sink(&self, video_sink: Option<&gst::Element>); - fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_audio_filter_notify(&self, f: F) + -> SignalHandlerId; fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId; @@ -96,7 +105,8 @@ pub trait GESPipelineExt: 'static { fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_video_filter_notify(&self, f: F) + -> SignalHandlerId; fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId; } @@ -104,104 +114,180 @@ pub trait GESPipelineExt: 'static { impl> GESPipelineExt for O { fn get_mode(&self) -> PipelineFlags { unsafe { - from_glib(ges_sys::ges_pipeline_get_mode(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_pipeline_get_mode( + self.as_ref().to_glib_none().0, + )) } } fn get_thumbnail(&self, caps: &gst::Caps) -> Option { unsafe { - from_glib_full(ges_sys::ges_pipeline_get_thumbnail(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) + from_glib_full(ges_sys::ges_pipeline_get_thumbnail( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + )) } } fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option { unsafe { - from_glib_full(ges_sys::ges_pipeline_get_thumbnail_rgb24(self.as_ref().to_glib_none().0, width, height)) + from_glib_full(ges_sys::ges_pipeline_get_thumbnail_rgb24( + self.as_ref().to_glib_none().0, + width, + height, + )) } } fn preview_get_audio_sink(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_pipeline_preview_get_audio_sink(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_pipeline_preview_get_audio_sink( + self.as_ref().to_glib_none().0, + )) } } fn preview_get_video_sink(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_pipeline_preview_get_video_sink(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_pipeline_preview_get_video_sink( + self.as_ref().to_glib_none().0, + )) } } fn preview_set_audio_sink>(&self, sink: &P) { unsafe { - ges_sys::ges_pipeline_preview_set_audio_sink(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0); + ges_sys::ges_pipeline_preview_set_audio_sink( + self.as_ref().to_glib_none().0, + sink.as_ref().to_glib_none().0, + ); } } fn preview_set_video_sink>(&self, sink: &P) { unsafe { - ges_sys::ges_pipeline_preview_set_video_sink(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0); + ges_sys::ges_pipeline_preview_set_video_sink( + self.as_ref().to_glib_none().0, + sink.as_ref().to_glib_none().0, + ); } } - fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error> { + fn save_thumbnail( + &self, + width: i32, + height: i32, + format: &str, + location: &str, + ) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ges_sys::ges_pipeline_save_thumbnail(self.as_ref().to_glib_none().0, width, height, format.to_glib_none().0, location.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = ges_sys::ges_pipeline_save_thumbnail( + self.as_ref().to_glib_none().0, + width, + height, + format.to_glib_none().0, + location.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.to_glib()), "Failed to set mode") + glib_result_from_gboolean!( + ges_sys::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.to_glib()), + "Failed to set mode" + ) } } - fn set_render_settings>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError> { + fn set_render_settings>( + &self, + output_uri: &str, + profile: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_pipeline_set_render_settings(self.as_ref().to_glib_none().0, output_uri.to_glib_none().0, profile.as_ref().to_glib_none().0), "Failed to set render settings") + glib_result_from_gboolean!( + ges_sys::ges_pipeline_set_render_settings( + self.as_ref().to_glib_none().0, + output_uri.to_glib_none().0, + profile.as_ref().to_glib_none().0 + ), + "Failed to set render settings" + ) } } fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_pipeline_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_full()), "Failed to set timeline") + glib_result_from_gboolean!( + ges_sys::ges_pipeline_set_timeline( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_full() + ), + "Failed to set timeline" + ) } } fn get_property_audio_filter(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-filter\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"audio-filter\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } fn set_property_audio_filter(&self, audio_filter: Option<&gst::Element>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-filter\0".as_ptr() as *const _, Value::from(audio_filter).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"audio-filter\0".as_ptr() as *const _, + Value::from(audio_filter).to_glib_none().0, + ); } } fn get_property_audio_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"audio-sink\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } fn set_property_audio_sink(&self, audio_sink: Option<&gst::Element>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-sink\0".as_ptr() as *const _, Value::from(audio_sink).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"audio-sink\0".as_ptr() as *const _, + Value::from(audio_sink).to_glib_none().0, + ); } } fn get_property_timeline(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"timeline\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"timeline\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -209,112 +295,186 @@ impl> GESPipelineExt for O { fn get_property_video_filter(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-filter\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"video-filter\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } fn set_property_video_filter(&self, video_filter: Option<&gst::Element>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-filter\0".as_ptr() as *const _, Value::from(video_filter).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"video-filter\0".as_ptr() as *const _, + Value::from(video_filter).to_glib_none().0, + ); } } fn get_property_video_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"video-sink\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } fn set_property_video_sink(&self, video_sink: Option<&gst::Element>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"video-sink\0".as_ptr() as *const _, + Value::from(video_sink).to_glib_none().0, + ); } } - fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_audio_filter_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_audio_filter_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_audio_filter_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::audio-filter\0".as_ptr() as *const _, - Some(transmute(notify_audio_filter_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::audio-filter\0".as_ptr() as *const _, + Some(transmute( + notify_audio_filter_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_audio_sink_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_audio_sink_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::audio-sink\0".as_ptr() as *const _, - Some(transmute(notify_audio_sink_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::audio-sink\0".as_ptr() as *const _, + Some(transmute(notify_audio_sink_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mode_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_mode_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mode\0".as_ptr() as *const _, - Some(transmute(notify_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mode\0".as_ptr() as *const _, + Some(transmute(notify_mode_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_timeline_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_timeline_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _, - Some(transmute(notify_timeline_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeline\0".as_ptr() as *const _, + Some(transmute(notify_timeline_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_video_filter_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_video_filter_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_video_filter_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::video-filter\0".as_ptr() as *const _, - Some(transmute(notify_video_filter_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::video-filter\0".as_ptr() as *const _, + Some(transmute( + notify_video_filter_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_video_sink_trampoline(this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_video_sink_trampoline( + this: *mut ges_sys::GESPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _, - Some(transmute(notify_video_sink_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::video-sink\0".as_ptr() as *const _, + Some(transmute(notify_video_sink_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/project.rs b/gstreamer-editing-services/src/auto/project.rs index 99ffde515..d99a27be5 100644 --- a/gstreamer-editing-services/src/auto/project.rs +++ b/gstreamer-editing-services/src/auto/project.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Asset; -use Error; -use Timeline; use ges_sys; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst_pbutils; use libc; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Asset; +use Error; +use Timeline; glib_wrapper! { pub struct Project(Object) @extends Asset; @@ -31,9 +31,7 @@ glib_wrapper! { impl Project { pub fn new(uri: Option<&str>) -> Project { assert_initialized_main_thread!(); - unsafe { - from_glib_full(ges_sys::ges_project_new(uri.to_glib_none().0)) - } + unsafe { from_glib_full(ges_sys::ges_project_new(uri.to_glib_none().0)) } } } @@ -42,11 +40,18 @@ pub const NONE_PROJECT: Option<&Project> = None; pub trait ProjectExt: 'static { fn add_asset>(&self, asset: &P) -> bool; - fn add_encoding_profile>(&self, profile: &P) -> Result<(), glib::error::BoolError>; + fn add_encoding_profile>( + &self, + profile: &P, + ) -> Result<(), glib::error::BoolError>; fn create_asset(&self, id: Option<&str>, extractable_type: glib::types::Type) -> bool; - fn create_asset_sync(&self, id: Option<&str>, extractable_type: glib::types::Type) -> Result, Error>; + fn create_asset_sync( + &self, + id: Option<&str>, + extractable_type: glib::types::Type, + ) -> Result, Error>; fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option; @@ -62,7 +67,13 @@ pub trait ProjectExt: 'static { fn remove_asset>(&self, asset: &P) -> Result<(), glib::error::BoolError>; - fn save, Q: IsA>(&self, timeline: &P, uri: &str, formatter_asset: Option<&Q>, overwrite: bool) -> Result<(), Error>; + fn save, Q: IsA>( + &self, + timeline: &P, + uri: &str, + formatter_asset: Option<&Q>, + overwrite: bool, + ) -> Result<(), Error>; fn connect_asset_added(&self, f: F) -> SignalHandlerId; @@ -70,173 +81,336 @@ pub trait ProjectExt: 'static { fn connect_asset_removed(&self, f: F) -> SignalHandlerId; - fn connect_error_loading_asset(&self, f: F) -> SignalHandlerId; + fn connect_error_loading_asset( + &self, + f: F, + ) -> SignalHandlerId; fn connect_loaded(&self, f: F) -> SignalHandlerId; - fn connect_missing_uri Option + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_missing_uri Option + 'static>( + &self, + f: F, + ) -> SignalHandlerId; } impl> ProjectExt for O { fn add_asset>(&self, asset: &P) -> bool { unsafe { - from_glib(ges_sys::ges_project_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_project_add_asset( + self.as_ref().to_glib_none().0, + asset.as_ref().to_glib_none().0, + )) } } - fn add_encoding_profile>(&self, profile: &P) -> Result<(), glib::error::BoolError> { + fn add_encoding_profile>( + &self, + profile: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_project_add_encoding_profile(self.as_ref().to_glib_none().0, profile.as_ref().to_glib_none().0), "Failed to add profile") + glib_result_from_gboolean!( + ges_sys::ges_project_add_encoding_profile( + self.as_ref().to_glib_none().0, + profile.as_ref().to_glib_none().0 + ), + "Failed to add profile" + ) } } fn create_asset(&self, id: Option<&str>, extractable_type: glib::types::Type) -> bool { unsafe { - from_glib(ges_sys::ges_project_create_asset(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) + from_glib(ges_sys::ges_project_create_asset( + self.as_ref().to_glib_none().0, + id.to_glib_none().0, + extractable_type.to_glib(), + )) } } - fn create_asset_sync(&self, id: Option<&str>, extractable_type: glib::types::Type) -> Result, Error> { + fn create_asset_sync( + &self, + id: Option<&str>, + extractable_type: glib::types::Type, + ) -> Result, Error> { unsafe { let mut error = ptr::null_mut(); - let ret = ges_sys::ges_project_create_asset_sync(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib(), &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ges_sys::ges_project_create_asset_sync( + self.as_ref().to_glib_none().0, + id.to_glib_none().0, + extractable_type.to_glib(), + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option { unsafe { - from_glib_full(ges_sys::ges_project_get_asset(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) + from_glib_full(ges_sys::ges_project_get_asset( + self.as_ref().to_glib_none().0, + id.to_glib_none().0, + extractable_type.to_glib(), + )) } } fn get_loading_assets(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_project_get_loading_assets(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_project_get_loading_assets( + self.as_ref().to_glib_none().0, + )) } } fn get_uri(&self) -> Option { - unsafe { - from_glib_full(ges_sys::ges_project_get_uri(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(ges_sys::ges_project_get_uri(self.as_ref().to_glib_none().0)) } } fn list_assets(&self, filter: glib::types::Type) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_project_list_assets(self.as_ref().to_glib_none().0, filter.to_glib())) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_project_list_assets( + self.as_ref().to_glib_none().0, + filter.to_glib(), + )) } } fn list_encoding_profiles(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ges_sys::ges_project_list_encoding_profiles(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ges_sys::ges_project_list_encoding_profiles( + self.as_ref().to_glib_none().0, + )) } } fn load>(&self, timeline: &P) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ges_sys::ges_project_load(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = ges_sys::ges_project_load( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } fn remove_asset>(&self, asset: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_project_remove_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0), "Failed to remove asset") + glib_result_from_gboolean!( + ges_sys::ges_project_remove_asset( + self.as_ref().to_glib_none().0, + asset.as_ref().to_glib_none().0 + ), + "Failed to remove asset" + ) } } - fn save, Q: IsA>(&self, timeline: &P, uri: &str, formatter_asset: Option<&Q>, overwrite: bool) -> Result<(), Error> { + fn save, Q: IsA>( + &self, + timeline: &P, + uri: &str, + formatter_asset: Option<&Q>, + overwrite: bool, + ) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ges_sys::ges_project_save(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0, uri.to_glib_none().0, formatter_asset.map(|p| p.as_ref()).to_glib_none().0, overwrite.to_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = ges_sys::ges_project_save( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_none().0, + uri.to_glib_none().0, + formatter_asset.map(|p| p.as_ref()).to_glib_none().0, + overwrite.to_glib(), + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } fn connect_asset_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn asset_added_trampoline(this: *mut ges_sys::GESProject, asset: *mut ges_sys::GESAsset, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn asset_added_trampoline( + this: *mut ges_sys::GESProject, + asset: *mut ges_sys::GESAsset, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(asset), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"asset-added\0".as_ptr() as *const _, - Some(transmute(asset_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"asset-added\0".as_ptr() as *const _, + Some(transmute(asset_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_asset_loading(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn asset_loading_trampoline(this: *mut ges_sys::GESProject, asset: *mut ges_sys::GESAsset, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn asset_loading_trampoline( + this: *mut ges_sys::GESProject, + asset: *mut ges_sys::GESAsset, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(asset), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"asset-loading\0".as_ptr() as *const _, - Some(transmute(asset_loading_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"asset-loading\0".as_ptr() as *const _, + Some(transmute(asset_loading_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_asset_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn asset_removed_trampoline(this: *mut ges_sys::GESProject, asset: *mut ges_sys::GESAsset, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn asset_removed_trampoline( + this: *mut ges_sys::GESProject, + asset: *mut ges_sys::GESAsset, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(asset), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"asset-removed\0".as_ptr() as *const _, - Some(transmute(asset_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"asset-removed\0".as_ptr() as *const _, + Some(transmute(asset_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_error_loading_asset(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn error_loading_asset_trampoline(this: *mut ges_sys::GESProject, error: *mut glib_sys::GError, id: *mut libc::c_char, extractable_type: glib_sys::GType, f: glib_sys::gpointer) - where P: IsA + fn connect_error_loading_asset( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn error_loading_asset_trampoline< + P, + F: Fn(&P, &Error, &str, glib::types::Type) + 'static, + >( + this: *mut ges_sys::GESProject, + error: *mut glib_sys::GError, + id: *mut libc::c_char, + extractable_type: glib_sys::GType, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error), &GString::from_glib_borrow(id), from_glib(extractable_type)) + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(error), + &GString::from_glib_borrow(id), + from_glib(extractable_type), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"error-loading-asset\0".as_ptr() as *const _, - Some(transmute(error_loading_asset_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"error-loading-asset\0".as_ptr() as *const _, + Some(transmute( + error_loading_asset_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_loaded(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn loaded_trampoline(this: *mut ges_sys::GESProject, timeline: *mut ges_sys::GESTimeline, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn loaded_trampoline( + this: *mut ges_sys::GESProject, + timeline: *mut ges_sys::GESTimeline, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(timeline)) + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(timeline), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"loaded\0".as_ptr() as *const _, - Some(transmute(loaded_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"loaded\0".as_ptr() as *const _, + Some(transmute(loaded_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_missing_uri Option + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn missing_uri_trampoline Option + 'static>(this: *mut ges_sys::GESProject, error: *mut glib_sys::GError, wrong_asset: *mut ges_sys::GESAsset, f: glib_sys::gpointer) -> *mut libc::c_char - where P: IsA + fn connect_missing_uri Option + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn missing_uri_trampoline< + P, + F: Fn(&P, &Error, &Asset) -> Option + 'static, + >( + this: *mut ges_sys::GESProject, + error: *mut glib_sys::GError, + wrong_asset: *mut ges_sys::GESAsset, + f: glib_sys::gpointer, + ) -> *mut libc::c_char + where + P: IsA, { let f: &F = &*(f as *const F); - f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error), &from_glib_borrow(wrong_asset)).to_glib_full() + f( + &Project::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(error), + &from_glib_borrow(wrong_asset), + ) + .to_glib_full() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"missing-uri\0".as_ptr() as *const _, - Some(transmute(missing_uri_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"missing-uri\0".as_ptr() as *const _, + Some(transmute(missing_uri_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/timeline.rs b/gstreamer-editing-services/src/auto/timeline.rs index 60de84345..fd8cc39e0 100644 --- a/gstreamer-editing-services/src/auto/timeline.rs +++ b/gstreamer-editing-services/src/auto/timeline.rs @@ -2,6 +2,18 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib_sys; +use gst; +use std::boxed::Box as Box_; +use std::mem::transmute; +use std::ptr; use Asset; use Error; use Extractable; @@ -10,18 +22,6 @@ use Layer; use TimelineElement; use Track; use TrackElement; -use ges_sys; -use glib; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gst; -use std::boxed::Box as Box_; -use std::mem::transmute; -use std::ptr; glib_wrapper! { pub struct Timeline(Object) @extends gst::Element, gst::Object, @implements Extractable; @@ -34,16 +34,12 @@ glib_wrapper! { impl Timeline { pub fn new() -> Timeline { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_timeline_new()) - } + unsafe { from_glib_none(ges_sys::ges_timeline_new()) } } pub fn new_audio_video() -> Timeline { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_timeline_new_audio_video()) - } + unsafe { from_glib_none(ges_sys::ges_timeline_new_audio_video()) } } pub fn new_from_uri(uri: &str) -> Result, Error> { @@ -51,7 +47,11 @@ impl Timeline { unsafe { let mut error = ptr::null_mut(); let ret = ges_sys::ges_timeline_new_from_uri(uri.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } } @@ -99,15 +99,29 @@ pub trait TimelineExt: 'static { fn load_from_uri(&self, uri: &str) -> Result<(), Error>; - fn move_layer>(&self, layer: &P, new_layer_priority: u32) -> Result<(), glib::error::BoolError>; + fn move_layer>( + &self, + layer: &P, + new_layer_priority: u32, + ) -> Result<(), glib::error::BoolError>; - fn paste_element>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option; + fn paste_element>( + &self, + element: &P, + position: gst::ClockTime, + layer_priority: i32, + ) -> Option; fn remove_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError>; fn remove_track>(&self, track: &P) -> Result<(), glib::error::BoolError>; - fn save_to_uri>(&self, uri: &str, formatter_asset: Option<&P>, overwrite: bool) -> Result<(), Error>; + fn save_to_uri>( + &self, + uri: &str, + formatter_asset: Option<&P>, + overwrite: bool, + ) -> Result<(), Error>; fn set_auto_transition(&self, auto_transition: bool); @@ -125,195 +139,327 @@ pub trait TimelineExt: 'static { //fn connect_select_tracks_for_object(&self, f: F) -> SignalHandlerId; - fn connect_snapping_ended(&self, f: F) -> SignalHandlerId; + fn connect_snapping_ended( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_snapping_started(&self, f: F) -> SignalHandlerId; + fn connect_snapping_started( + &self, + f: F, + ) -> SignalHandlerId; fn connect_track_added(&self, f: F) -> SignalHandlerId; fn connect_track_removed(&self, f: F) -> SignalHandlerId; - fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_auto_transition_notify( + &self, + f: F, + ) -> SignalHandlerId; fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_snapping_distance_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_snapping_distance_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> TimelineExt for O { fn add_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_add_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0), "Failed to add layer") + glib_result_from_gboolean!( + ges_sys::ges_timeline_add_layer( + self.as_ref().to_glib_none().0, + layer.as_ref().to_glib_none().0 + ), + "Failed to add layer" + ) } } fn add_track>(&self, track: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_add_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_full()), "Failed to add track") + glib_result_from_gboolean!( + ges_sys::ges_timeline_add_track( + self.as_ref().to_glib_none().0, + track.as_ref().to_glib_full() + ), + "Failed to add track" + ) } } fn append_layer(&self) -> Layer { unsafe { - from_glib_none(ges_sys::ges_timeline_append_layer(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_timeline_append_layer( + self.as_ref().to_glib_none().0, + )) } } fn commit(&self) -> bool { - unsafe { - from_glib(ges_sys::ges_timeline_commit(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(ges_sys::ges_timeline_commit(self.as_ref().to_glib_none().0)) } } fn commit_sync(&self) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_commit_sync(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_commit_sync( + self.as_ref().to_glib_none().0, + )) } } fn get_auto_transition(&self) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_get_auto_transition(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_get_auto_transition( + self.as_ref().to_glib_none().0, + )) } } fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_get_duration(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_get_duration( + self.as_ref().to_glib_none().0, + )) } } fn get_element(&self, name: &str) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_get_element(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ges_sys::ges_timeline_get_element( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn get_groups(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ges_sys::ges_timeline_get_groups(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ges_sys::ges_timeline_get_groups( + self.as_ref().to_glib_none().0, + )) } } fn get_layer(&self, priority: u32) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_get_layer(self.as_ref().to_glib_none().0, priority)) + from_glib_full(ges_sys::ges_timeline_get_layer( + self.as_ref().to_glib_none().0, + priority, + )) } } fn get_layers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_layers(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_layers( + self.as_ref().to_glib_none().0, + )) } } fn get_pad_for_track>(&self, track: &P) -> Option { unsafe { - from_glib_none(ges_sys::ges_timeline_get_pad_for_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_timeline_get_pad_for_track( + self.as_ref().to_glib_none().0, + track.as_ref().to_glib_none().0, + )) } } fn get_snapping_distance(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_get_snapping_distance(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_get_snapping_distance( + self.as_ref().to_glib_none().0, + )) } } fn get_track_for_pad>(&self, pad: &P) -> Option { unsafe { - from_glib_none(ges_sys::ges_timeline_get_track_for_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_timeline_get_track_for_pad( + self.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0, + )) } } fn get_tracks(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_tracks(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_tracks( + self.as_ref().to_glib_none().0, + )) } } fn is_empty(&self) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_is_empty(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_is_empty( + self.as_ref().to_glib_none().0, + )) } } fn load_from_uri(&self, uri: &str) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ges_sys::ges_timeline_load_from_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = ges_sys::ges_timeline_load_from_uri( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } - fn move_layer>(&self, layer: &P, new_layer_priority: u32) -> Result<(), glib::error::BoolError> { + fn move_layer>( + &self, + layer: &P, + new_layer_priority: u32, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_move_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0, new_layer_priority), "Failed to move layer") + glib_result_from_gboolean!( + ges_sys::ges_timeline_move_layer( + self.as_ref().to_glib_none().0, + layer.as_ref().to_glib_none().0, + new_layer_priority + ), + "Failed to move layer" + ) } } - fn paste_element>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option { + fn paste_element>( + &self, + element: &P, + position: gst::ClockTime, + layer_priority: i32, + ) -> Option { unsafe { - from_glib_none(ges_sys::ges_timeline_paste_element(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0, position.to_glib(), layer_priority)) + from_glib_none(ges_sys::ges_timeline_paste_element( + self.as_ref().to_glib_none().0, + element.as_ref().to_glib_none().0, + position.to_glib(), + layer_priority, + )) } } fn remove_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_remove_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0), "Failed to remove layer") + glib_result_from_gboolean!( + ges_sys::ges_timeline_remove_layer( + self.as_ref().to_glib_none().0, + layer.as_ref().to_glib_none().0 + ), + "Failed to remove layer" + ) } } fn remove_track>(&self, track: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_remove_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_none().0), "Failed to remove track") + glib_result_from_gboolean!( + ges_sys::ges_timeline_remove_track( + self.as_ref().to_glib_none().0, + track.as_ref().to_glib_none().0 + ), + "Failed to remove track" + ) } } - fn save_to_uri>(&self, uri: &str, formatter_asset: Option<&P>, overwrite: bool) -> Result<(), Error> { + fn save_to_uri>( + &self, + uri: &str, + formatter_asset: Option<&P>, + overwrite: bool, + ) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ges_sys::ges_timeline_save_to_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0, formatter_asset.map(|p| p.as_ref()).to_glib_none().0, overwrite.to_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = ges_sys::ges_timeline_save_to_uri( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + formatter_asset.map(|p| p.as_ref()).to_glib_none().0, + overwrite.to_glib(), + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } fn set_auto_transition(&self, auto_transition: bool) { unsafe { - ges_sys::ges_timeline_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib()); + ges_sys::ges_timeline_set_auto_transition( + self.as_ref().to_glib_none().0, + auto_transition.to_glib(), + ); } } fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) { unsafe { - ges_sys::ges_timeline_set_snapping_distance(self.as_ref().to_glib_none().0, snapping_distance.to_glib()); + ges_sys::ges_timeline_set_snapping_distance( + self.as_ref().to_glib_none().0, + snapping_distance.to_glib(), + ); } } fn connect_commited(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn commited_trampoline(this: *mut ges_sys::GESTimeline, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn commited_trampoline( + this: *mut ges_sys::GESTimeline, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _, - Some(transmute(commited_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"commited\0".as_ptr() as *const _, + Some(transmute(commited_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_group_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn group_added_trampoline(this: *mut ges_sys::GESTimeline, group: *mut ges_sys::GESGroup, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn group_added_trampoline( + this: *mut ges_sys::GESTimeline, + group: *mut ges_sys::GESGroup, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(group)) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(group), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"group-added\0".as_ptr() as *const _, - Some(transmute(group_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"group-added\0".as_ptr() as *const _, + Some(transmute(group_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } @@ -322,30 +468,52 @@ impl> TimelineExt for O { //} fn connect_layer_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn layer_added_trampoline(this: *mut ges_sys::GESTimeline, layer: *mut ges_sys::GESLayer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn layer_added_trampoline( + this: *mut ges_sys::GESTimeline, + layer: *mut ges_sys::GESLayer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer)) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(layer), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"layer-added\0".as_ptr() as *const _, - Some(transmute(layer_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"layer-added\0".as_ptr() as *const _, + Some(transmute(layer_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_layer_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn layer_removed_trampoline(this: *mut ges_sys::GESTimeline, layer: *mut ges_sys::GESLayer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn layer_removed_trampoline( + this: *mut ges_sys::GESTimeline, + layer: *mut ges_sys::GESLayer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer)) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(layer), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"layer-removed\0".as_ptr() as *const _, - Some(transmute(layer_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"layer-removed\0".as_ptr() as *const _, + Some(transmute(layer_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } @@ -353,101 +521,199 @@ impl> TimelineExt for O { // Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 16 } //} - fn connect_snapping_ended(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn snapping_ended_trampoline(this: *mut ges_sys::GESTimeline, obj1: *mut ges_sys::GESTrackElement, obj2: *mut ges_sys::GESTrackElement, position: u64, f: glib_sys::gpointer) - where P: IsA + fn connect_snapping_ended( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn snapping_ended_trampoline< + P, + F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static, + >( + this: *mut ges_sys::GESTimeline, + obj1: *mut ges_sys::GESTrackElement, + obj2: *mut ges_sys::GESTrackElement, + position: u64, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(obj1), &from_glib_borrow(obj2), position) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(obj1), + &from_glib_borrow(obj2), + position, + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"snapping-ended\0".as_ptr() as *const _, - Some(transmute(snapping_ended_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"snapping-ended\0".as_ptr() as *const _, + Some(transmute(snapping_ended_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_snapping_started(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn snapping_started_trampoline(this: *mut ges_sys::GESTimeline, obj1: *mut ges_sys::GESTrackElement, obj2: *mut ges_sys::GESTrackElement, position: u64, f: glib_sys::gpointer) - where P: IsA + fn connect_snapping_started( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn snapping_started_trampoline< + P, + F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static, + >( + this: *mut ges_sys::GESTimeline, + obj1: *mut ges_sys::GESTrackElement, + obj2: *mut ges_sys::GESTrackElement, + position: u64, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(obj1), &from_glib_borrow(obj2), position) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(obj1), + &from_glib_borrow(obj2), + position, + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"snapping-started\0".as_ptr() as *const _, - Some(transmute(snapping_started_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"snapping-started\0".as_ptr() as *const _, + Some(transmute(snapping_started_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_track_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn track_added_trampoline(this: *mut ges_sys::GESTimeline, track: *mut ges_sys::GESTrack, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn track_added_trampoline( + this: *mut ges_sys::GESTimeline, + track: *mut ges_sys::GESTrack, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track)) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(track), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"track-added\0".as_ptr() as *const _, - Some(transmute(track_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"track-added\0".as_ptr() as *const _, + Some(transmute(track_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_track_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn track_removed_trampoline(this: *mut ges_sys::GESTimeline, track: *mut ges_sys::GESTrack, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn track_removed_trampoline( + this: *mut ges_sys::GESTimeline, + track: *mut ges_sys::GESTrack, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track)) + f( + &Timeline::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(track), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"track-removed\0".as_ptr() as *const _, - Some(transmute(track_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"track-removed\0".as_ptr() as *const _, + Some(transmute(track_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_auto_transition_trampoline(this: *mut ges_sys::GESTimeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_auto_transition_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_auto_transition_trampoline( + this: *mut ges_sys::GESTimeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, - Some(transmute(notify_auto_transition_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::auto-transition\0".as_ptr() as *const _, + Some(transmute( + notify_auto_transition_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut ges_sys::GESTimeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_duration_trampoline( + this: *mut ges_sys::GESTimeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_snapping_distance_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_snapping_distance_trampoline(this: *mut ges_sys::GESTimeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_snapping_distance_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_snapping_distance_trampoline( + this: *mut ges_sys::GESTimeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::snapping-distance\0".as_ptr() as *const _, - Some(transmute(notify_snapping_distance_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::snapping-distance\0".as_ptr() as *const _, + Some(transmute( + notify_snapping_distance_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/timeline_element.rs b/gstreamer-editing-services/src/auto/timeline_element.rs index c5d108756..e4dd22532 100644 --- a/gstreamer-editing-services/src/auto/timeline_element.rs +++ b/gstreamer-editing-services/src/auto/timeline_element.rs @@ -2,24 +2,24 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Extractable; -use Timeline; -use TrackType; use ges_sys; use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; use std::boxed::Box as Box_; use std::mem::transmute; +use Extractable; +use Timeline; +use TrackType; glib_wrapper! { pub struct TimelineElement(Object) @implements Extractable; @@ -98,7 +98,8 @@ pub trait TimelineElementExt: 'static { fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError>; - fn set_parent>(&self, parent: &P) -> Result<(), glib::error::BoolError>; + fn set_parent>(&self, parent: &P) + -> Result<(), glib::error::BoolError>; fn set_priority(&self, priority: u32) -> bool; @@ -122,7 +123,8 @@ pub trait TimelineElementExt: 'static { fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_duration_notify(&self, f: F) + -> SignalHandlerId; fn connect_property_name_notify(&self, f: F) -> SignalHandlerId; @@ -144,7 +146,10 @@ impl> TimelineElementExt for O { fn copy(&self, deep: bool) -> Option { unsafe { - from_glib_none(ges_sys::ges_timeline_element_copy(self.as_ref().to_glib_none().0, deep.to_glib())) + from_glib_none(ges_sys::ges_timeline_element_copy( + self.as_ref().to_glib_none().0, + deep.to_glib(), + )) } } @@ -166,67 +171,81 @@ impl> TimelineElementExt for O { fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_element_get_duration(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_element_get_duration( + self.as_ref().to_glib_none().0, + )) } } fn get_inpoint(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_element_get_inpoint(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_element_get_inpoint( + self.as_ref().to_glib_none().0, + )) } } fn get_layer_priority(&self) -> u32 { - unsafe { - ges_sys::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) - } + unsafe { ges_sys::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) } } fn get_max_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_element_get_max_duration(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_element_get_max_duration( + self.as_ref().to_glib_none().0, + )) } } fn get_name(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_element_get_name(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_timeline_element_get_name( + self.as_ref().to_glib_none().0, + )) } } fn get_parent(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_element_get_parent(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_timeline_element_get_parent( + self.as_ref().to_glib_none().0, + )) } } fn get_priority(&self) -> u32 { - unsafe { - ges_sys::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) - } + unsafe { ges_sys::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) } } fn get_start(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_timeline_element_get_start(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_element_get_start( + self.as_ref().to_glib_none().0, + )) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_element_get_timeline(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_timeline_element_get_timeline( + self.as_ref().to_glib_none().0, + )) } } fn get_toplevel_parent(&self) -> Option { unsafe { - from_glib_full(ges_sys::ges_timeline_element_get_toplevel_parent(self.as_ref().to_glib_none().0)) + from_glib_full(ges_sys::ges_timeline_element_get_toplevel_parent( + self.as_ref().to_glib_none().0, + )) } } fn get_track_types(&self) -> TrackType { unsafe { - from_glib(ges_sys::ges_timeline_element_get_track_types(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_timeline_element_get_track_types( + self.as_ref().to_glib_none().0, + )) } } @@ -240,7 +259,10 @@ impl> TimelineElementExt for O { fn paste(&self, paste_position: gst::ClockTime) -> Option { unsafe { - from_glib_none(ges_sys::ges_timeline_element_paste(self.as_ref().to_glib_none().0, paste_position.to_glib())) + from_glib_none(ges_sys::ges_timeline_element_paste( + self.as_ref().to_glib_none().0, + paste_position.to_glib(), + )) } } @@ -250,25 +272,49 @@ impl> TimelineElementExt for O { fn ripple(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.to_glib()), "Failed to ripple") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_ripple( + self.as_ref().to_glib_none().0, + start.to_glib() + ), + "Failed to ripple" + ) } } fn ripple_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_ripple_end(self.as_ref().to_glib_none().0, end.to_glib()), "Failed to ripple") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_ripple_end( + self.as_ref().to_glib_none().0, + end.to_glib() + ), + "Failed to ripple" + ) } } fn roll_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.to_glib()), "Failed to roll") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_roll_end( + self.as_ref().to_glib_none().0, + end.to_glib() + ), + "Failed to roll" + ) } } fn roll_start(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_roll_start(self.as_ref().to_glib_none().0, start.to_glib()), "Failed to roll") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_roll_start( + self.as_ref().to_glib_none().0, + start.to_glib() + ), + "Failed to roll" + ) } } @@ -290,83 +336,138 @@ impl> TimelineElementExt for O { fn set_duration(&self, duration: gst::ClockTime) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_element_set_duration(self.as_ref().to_glib_none().0, duration.to_glib())) + from_glib(ges_sys::ges_timeline_element_set_duration( + self.as_ref().to_glib_none().0, + duration.to_glib(), + )) } } fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_element_set_inpoint(self.as_ref().to_glib_none().0, inpoint.to_glib())) + from_glib(ges_sys::ges_timeline_element_set_inpoint( + self.as_ref().to_glib_none().0, + inpoint.to_glib(), + )) } } fn set_max_duration(&self, maxduration: gst::ClockTime) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_element_set_max_duration(self.as_ref().to_glib_none().0, maxduration.to_glib())) + from_glib(ges_sys::ges_timeline_element_set_max_duration( + self.as_ref().to_glib_none().0, + maxduration.to_glib(), + )) } } fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to set name") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_set_name( + self.as_ref().to_glib_none().0, + name.to_glib_none().0 + ), + "Failed to set name" + ) } } - fn set_parent>(&self, parent: &P) -> Result<(), glib::error::BoolError> { + fn set_parent>( + &self, + parent: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_set_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0), "`TimelineElement` already had a parent or its parent was the same as specified") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_set_parent( + self.as_ref().to_glib_none().0, + parent.as_ref().to_glib_none().0 + ), + "`TimelineElement` already had a parent or its parent was the same as specified" + ) } } fn set_priority(&self, priority: u32) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_element_set_priority(self.as_ref().to_glib_none().0, priority)) + from_glib(ges_sys::ges_timeline_element_set_priority( + self.as_ref().to_glib_none().0, + priority, + )) } } fn set_start(&self, start: gst::ClockTime) -> bool { unsafe { - from_glib(ges_sys::ges_timeline_element_set_start(self.as_ref().to_glib_none().0, start.to_glib())) + from_glib(ges_sys::ges_timeline_element_set_start( + self.as_ref().to_glib_none().0, + start.to_glib(), + )) } } fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0), "`Failed to set timeline") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_set_timeline( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_none().0 + ), + "`Failed to set timeline" + ) } } fn trim(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.to_glib()), "`Failed to trim") + glib_result_from_gboolean!( + ges_sys::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.to_glib()), + "`Failed to trim" + ) } } fn get_property_in_point(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"in-point\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"in-point\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_in_point(&self, in_point: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"in-point\0".as_ptr() as *const _, Value::from(&in_point).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"in-point\0".as_ptr() as *const _, + Value::from(&in_point).to_glib_none().0, + ); } } fn get_property_serialize(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"serialize\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"serialize\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_serialize(&self, serialize: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"serialize\0".as_ptr() as *const _, Value::from(&serialize).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"serialize\0".as_ptr() as *const _, + Value::from(&serialize).to_glib_none().0, + ); } } @@ -375,128 +476,205 @@ impl> TimelineElementExt for O { //} fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_duration_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_in_point_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_in_point_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _, - Some(transmute(notify_in_point_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::in-point\0".as_ptr() as *const _, + Some(transmute(notify_in_point_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_duration_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_duration_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_duration_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _, - Some(transmute(notify_max_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-duration\0".as_ptr() as *const _, + Some(transmute( + notify_max_duration_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_name_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_name_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_name_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, - Some(transmute(notify_name_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::name\0".as_ptr() as *const _, + Some(transmute(notify_name_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_parent_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_parent_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::parent\0".as_ptr() as *const _, - Some(transmute(notify_parent_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::parent\0".as_ptr() as *const _, + Some(transmute(notify_parent_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_priority_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_priority_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, - Some(transmute(notify_priority_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::priority\0".as_ptr() as *const _, + Some(transmute(notify_priority_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_serialize_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_serialize_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_serialize_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::serialize\0".as_ptr() as *const _, - Some(transmute(notify_serialize_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::serialize\0".as_ptr() as *const _, + Some(transmute(notify_serialize_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_start_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_start_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _, - Some(transmute(notify_start_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::start\0".as_ptr() as *const _, + Some(transmute(notify_start_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_timeline_trampoline(this: *mut ges_sys::GESTimelineElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_timeline_trampoline( + this: *mut ges_sys::GESTimelineElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _, - Some(transmute(notify_timeline_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeline\0".as_ptr() as *const _, + Some(transmute(notify_timeline_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/track.rs b/gstreamer-editing-services/src/auto/track.rs index 342cfe57b..6d1d2d77a 100644 --- a/gstreamer-editing-services/src/auto/track.rs +++ b/gstreamer-editing-services/src/auto/track.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Timeline; -use TrackElement; -use TrackType; use ges_sys; use glib; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; use std::boxed::Box as Box_; use std::mem::transmute; +use Timeline; +use TrackElement; +use TrackType; glib_wrapper! { pub struct Track(Object) @extends gst::Element, gst::Object; @@ -31,9 +31,7 @@ glib_wrapper! { impl Track { pub fn new(type_: TrackType, caps: &gst::Caps) -> Track { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_track_new(type_.to_glib(), caps.to_glib_full())) - } + unsafe { from_glib_none(ges_sys::ges_track_new(type_.to_glib(), caps.to_glib_full())) } } } @@ -52,7 +50,10 @@ pub trait GESTrackExt: 'static { fn get_timeline(&self) -> Option; - fn remove_element>(&self, object: &P) -> Result<(), glib::error::BoolError>; + fn remove_element>( + &self, + object: &P, + ) -> Result<(), glib::error::BoolError>; //fn set_create_element_for_gap_func gst::Element + 'static>(&self, func: P); @@ -72,57 +73,83 @@ pub trait GESTrackExt: 'static { fn connect_commited(&self, f: F) -> SignalHandlerId; - fn connect_track_element_added(&self, f: F) -> SignalHandlerId; + fn connect_track_element_added( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_track_element_removed(&self, f: F) -> SignalHandlerId; + fn connect_track_element_removed( + &self, + f: F, + ) -> SignalHandlerId; fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; fn connect_property_mixing_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_restriction_caps_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_restriction_caps_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> GESTrackExt for O { fn add_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_track_add_element(self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!( + ges_sys::ges_track_add_element( + self.as_ref().to_glib_none().0, + object.as_ref().to_glib_none().0 + ), + "Failed to add element" + ) } } fn commit(&self) -> bool { - unsafe { - from_glib(ges_sys::ges_track_commit(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(ges_sys::ges_track_commit(self.as_ref().to_glib_none().0)) } } fn get_caps(&self) -> Option { - unsafe { - from_glib_none(ges_sys::ges_track_get_caps(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_track_get_caps(self.as_ref().to_glib_none().0)) } } fn get_elements(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ges_sys::ges_track_get_elements(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ges_sys::ges_track_get_elements( + self.as_ref().to_glib_none().0, + )) } } fn get_mixing(&self) -> bool { unsafe { - from_glib(ges_sys::ges_track_get_mixing(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_track_get_mixing( + self.as_ref().to_glib_none().0, + )) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_track_get_timeline(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_track_get_timeline( + self.as_ref().to_glib_none().0, + )) } } - fn remove_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { + fn remove_element>( + &self, + object: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_track_remove_element(self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!( + ges_sys::ges_track_remove_element( + self.as_ref().to_glib_none().0, + object.as_ref().to_glib_none().0 + ), + "Failed to remove element" + ) } } @@ -138,26 +165,39 @@ impl> GESTrackExt for O { fn set_restriction_caps(&self, caps: &gst::Caps) { unsafe { - ges_sys::ges_track_set_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); + ges_sys::ges_track_set_restriction_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + ); } } fn set_timeline>(&self, timeline: &P) { unsafe { - ges_sys::ges_track_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0); + ges_sys::ges_track_set_timeline( + self.as_ref().to_glib_none().0, + timeline.as_ref().to_glib_none().0, + ); } } fn update_restriction_caps(&self, caps: &gst::Caps) { unsafe { - ges_sys::ges_track_update_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); + ges_sys::ges_track_update_restriction_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + ); } } fn get_property_duration(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -165,7 +205,11 @@ impl> GESTrackExt for O { fn get_property_restriction_caps(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"restriction-caps\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"restriction-caps\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -173,92 +217,167 @@ impl> GESTrackExt for O { fn get_property_track_type(&self) -> TrackType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"track-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"track-type\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn connect_commited(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn commited_trampoline(this: *mut ges_sys::GESTrack, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn commited_trampoline( + this: *mut ges_sys::GESTrack, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _, - Some(transmute(commited_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"commited\0".as_ptr() as *const _, + Some(transmute(commited_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_track_element_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn track_element_added_trampoline(this: *mut ges_sys::GESTrack, effect: *mut ges_sys::GESTrackElement, f: glib_sys::gpointer) - where P: IsA + fn connect_track_element_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn track_element_added_trampoline( + this: *mut ges_sys::GESTrack, + effect: *mut ges_sys::GESTrackElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect)) + f( + &Track::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(effect), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"track-element-added\0".as_ptr() as *const _, - Some(transmute(track_element_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"track-element-added\0".as_ptr() as *const _, + Some(transmute( + track_element_added_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_track_element_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn track_element_removed_trampoline(this: *mut ges_sys::GESTrack, effect: *mut ges_sys::GESTrackElement, f: glib_sys::gpointer) - where P: IsA + fn connect_track_element_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn track_element_removed_trampoline< + P, + F: Fn(&P, &TrackElement) + 'static, + >( + this: *mut ges_sys::GESTrack, + effect: *mut ges_sys::GESTrackElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect)) + f( + &Track::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(effect), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"track-element-removed\0".as_ptr() as *const _, - Some(transmute(track_element_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"track-element-removed\0".as_ptr() as *const _, + Some(transmute( + track_element_removed_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut ges_sys::GESTrack, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_duration_trampoline( + this: *mut ges_sys::GESTrack, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_mixing_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mixing_trampoline(this: *mut ges_sys::GESTrack, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_mixing_trampoline( + this: *mut ges_sys::GESTrack, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mixing\0".as_ptr() as *const _, - Some(transmute(notify_mixing_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mixing\0".as_ptr() as *const _, + Some(transmute(notify_mixing_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_restriction_caps_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_restriction_caps_trampoline(this: *mut ges_sys::GESTrack, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_restriction_caps_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_restriction_caps_trampoline( + this: *mut ges_sys::GESTrack, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::restriction-caps\0".as_ptr() as *const _, - Some(transmute(notify_restriction_caps_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::restriction-caps\0".as_ptr() as *const _, + Some(transmute( + notify_restriction_caps_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/track_element.rs b/gstreamer-editing-services/src/auto/track_element.rs index e4376bf02..41b875ced 100644 --- a/gstreamer-editing-services/src/auto/track_element.rs +++ b/gstreamer-editing-services/src/auto/track_element.rs @@ -2,6 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use ges_sys; +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::GString; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use std::boxed::Box as Box_; +use std::mem::transmute; use Edge; use EditMode; use Extractable; @@ -9,21 +24,6 @@ use Layer; use TimelineElement; use Track; use TrackType; -use ges_sys; -use glib; -use glib::GString; -use glib::StaticType; -use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gobject_sys; -use gst; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct TrackElement(Object) @extends TimelineElement, @implements Extractable; @@ -36,9 +36,21 @@ glib_wrapper! { pub const NONE_TRACK_ELEMENT: Option<&TrackElement> = None; pub trait TrackElementExt: 'static { - fn add_children_props>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]); + fn add_children_props>( + &self, + element: &P, + wanted_categories: &[&str], + blacklist: &[&str], + whitelist: &[&str], + ); - fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError>; + fn edit( + &self, + layers: &[Layer], + mode: EditMode, + edge: Edge, + position: u64, + ) -> Result<(), glib::error::BoolError>; //fn get_all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 83 }; @@ -80,15 +92,42 @@ pub trait TrackElementExt: 'static { } impl> TrackElementExt for O { - fn add_children_props>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]) { + fn add_children_props>( + &self, + element: &P, + wanted_categories: &[&str], + blacklist: &[&str], + whitelist: &[&str], + ) { unsafe { - ges_sys::ges_track_element_add_children_props(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0, wanted_categories.to_glib_none().0, blacklist.to_glib_none().0, whitelist.to_glib_none().0); + ges_sys::ges_track_element_add_children_props( + self.as_ref().to_glib_none().0, + element.as_ref().to_glib_none().0, + wanted_categories.to_glib_none().0, + blacklist.to_glib_none().0, + whitelist.to_glib_none().0, + ); } } - fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError> { + fn edit( + &self, + layers: &[Layer], + mode: EditMode, + edge: Edge, + position: u64, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_track_element_edit(self.as_ref().to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position), "Failed to edit") + glib_result_from_gboolean!( + ges_sys::ges_track_element_edit( + self.as_ref().to_glib_none().0, + layers.to_glib_none().0, + mode.to_glib(), + edge.to_glib(), + position + ), + "Failed to edit" + ) } } @@ -102,37 +141,49 @@ impl> TrackElementExt for O { fn get_element(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_track_element_get_element(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_track_element_get_element( + self.as_ref().to_glib_none().0, + )) } } fn get_gnlobject(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_track_element_get_gnlobject(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_track_element_get_gnlobject( + self.as_ref().to_glib_none().0, + )) } } fn get_nleobject(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_track_element_get_nleobject(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_track_element_get_nleobject( + self.as_ref().to_glib_none().0, + )) } } fn get_track(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_track_element_get_track(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_track_element_get_track( + self.as_ref().to_glib_none().0, + )) } } fn get_track_type(&self) -> TrackType { unsafe { - from_glib(ges_sys::ges_track_element_get_track_type(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_track_element_get_track_type( + self.as_ref().to_glib_none().0, + )) } } fn is_active(&self) -> bool { unsafe { - from_glib(ges_sys::ges_track_element_is_active(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_track_element_is_active( + self.as_ref().to_glib_none().0, + )) } } @@ -142,13 +193,22 @@ impl> TrackElementExt for O { fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ges_sys::ges_track_element_remove_control_binding(self.as_ref().to_glib_none().0, property_name.to_glib_none().0), "Failed to remove control binding") + glib_result_from_gboolean!( + ges_sys::ges_track_element_remove_control_binding( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0 + ), + "Failed to remove control binding" + ) } } fn set_active(&self, active: bool) -> bool { unsafe { - from_glib(ges_sys::ges_track_element_set_active(self.as_ref().to_glib_none().0, active.to_glib())) + from_glib(ges_sys::ges_track_element_set_active( + self.as_ref().to_glib_none().0, + active.to_glib(), + )) } } @@ -158,14 +218,21 @@ impl> TrackElementExt for O { fn set_track_type(&self, type_: TrackType) { unsafe { - ges_sys::ges_track_element_set_track_type(self.as_ref().to_glib_none().0, type_.to_glib()); + ges_sys::ges_track_element_set_track_type( + self.as_ref().to_glib_none().0, + type_.to_glib(), + ); } } fn get_property_active(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"active\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -179,44 +246,68 @@ impl> TrackElementExt for O { //} fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_active_trampoline(this: *mut ges_sys::GESTrackElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_active_trampoline( + this: *mut ges_sys::GESTrackElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _, - Some(transmute(notify_active_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::active\0".as_ptr() as *const _, + Some(transmute(notify_active_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_track_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_track_trampoline(this: *mut ges_sys::GESTrackElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_track_trampoline( + this: *mut ges_sys::GESTrackElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::track\0".as_ptr() as *const _, - Some(transmute(notify_track_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::track\0".as_ptr() as *const _, + Some(transmute(notify_track_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_track_type_trampoline(this: *mut ges_sys::GESTrackElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_track_type_trampoline( + this: *mut ges_sys::GESTrackElement, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::track-type\0".as_ptr() as *const _, - Some(transmute(notify_track_type_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::track-type\0".as_ptr() as *const _, + Some(transmute(notify_track_type_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/uri_clip.rs b/gstreamer-editing-services/src/auto/uri_clip.rs index 6f04ae4b0..ca50bee3d 100644 --- a/gstreamer-editing-services/src/auto/uri_clip.rs +++ b/gstreamer-editing-services/src/auto/uri_clip.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Clip; -use Container; -use Extractable; -use TimelineElement; use ges_sys; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Clip; +use Container; +use Extractable; +use TimelineElement; glib_wrapper! { pub struct UriClip(Object) @extends Clip, Container, TimelineElement, @implements Extractable; @@ -31,9 +31,7 @@ glib_wrapper! { impl UriClip { pub fn new(uri: &str) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(ges_sys::ges_uri_clip_new(uri.to_glib_none().0)) - } + unsafe { from_glib_none(ges_sys::ges_uri_clip_new(uri.to_glib_none().0)) } } } @@ -58,25 +56,34 @@ pub trait UriClipExt: 'static { fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> UriClipExt for O { fn get_uri(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_uri_clip_get_uri(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_uri_clip_get_uri( + self.as_ref().to_glib_none().0, + )) } } fn is_image(&self) -> bool { unsafe { - from_glib(ges_sys::ges_uri_clip_is_image(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_uri_clip_is_image( + self.as_ref().to_glib_none().0, + )) } } fn is_muted(&self) -> bool { unsafe { - from_glib(ges_sys::ges_uri_clip_is_muted(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_uri_clip_is_muted( + self.as_ref().to_glib_none().0, + )) } } @@ -95,7 +102,11 @@ impl> UriClipExt for O { fn get_property_is_image(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"is-image\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"is-image\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -103,50 +114,83 @@ impl> UriClipExt for O { fn get_property_mute(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"mute\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"mute\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn connect_property_is_image_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_is_image_trampoline(this: *mut ges_sys::GESUriClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_is_image_trampoline( + this: *mut ges_sys::GESUriClip, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&UriClip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::is-image\0".as_ptr() as *const _, - Some(transmute(notify_is_image_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-image\0".as_ptr() as *const _, + Some(transmute(notify_is_image_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mute_trampoline(this: *mut ges_sys::GESUriClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_mute_trampoline( + this: *mut ges_sys::GESUriClip, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&UriClip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, - Some(transmute(notify_mute_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mute\0".as_ptr() as *const _, + Some(transmute(notify_mute_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_supported_formats_trampoline(this: *mut ges_sys::GESUriClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_supported_formats_trampoline( + this: *mut ges_sys::GESUriClip, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&UriClip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, - Some(transmute(notify_supported_formats_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::supported-formats\0".as_ptr() as *const _, + Some(transmute( + notify_supported_formats_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/uri_clip_asset.rs b/gstreamer-editing-services/src/auto/uri_clip_asset.rs index 77cc29735..9910923e0 100644 --- a/gstreamer-editing-services/src/auto/uri_clip_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_clip_asset.rs @@ -2,16 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Asset; -use Error; -use UriSourceAsset; use ges_sys; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -19,6 +16,9 @@ use gst_pbutils; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Asset; +use Error; +use UriSourceAsset; glib_wrapper! { pub struct UriClipAsset(Object) @extends Asset; @@ -42,7 +42,11 @@ impl UriClipAsset { unsafe { let mut error = ptr::null_mut(); let ret = ges_sys::ges_uri_clip_asset_request_sync(uri.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } } @@ -66,45 +70,65 @@ pub trait UriClipAssetExt: 'static { impl> UriClipAssetExt for O { fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ges_sys::ges_uri_clip_asset_get_duration(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_uri_clip_asset_get_duration( + self.as_ref().to_glib_none().0, + )) } } fn get_info(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_uri_clip_asset_get_info(const_override(self.as_ref().to_glib_none().0))) + from_glib_none(ges_sys::ges_uri_clip_asset_get_info(const_override( + self.as_ref().to_glib_none().0, + ))) } } fn get_stream_assets(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ges_sys::ges_uri_clip_asset_get_stream_assets(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ges_sys::ges_uri_clip_asset_get_stream_assets( + self.as_ref().to_glib_none().0, + )) } } fn is_image(&self) -> bool { unsafe { - from_glib(ges_sys::ges_uri_clip_asset_is_image(self.as_ref().to_glib_none().0)) + from_glib(ges_sys::ges_uri_clip_asset_is_image( + self.as_ref().to_glib_none().0, + )) } } fn set_property_duration(&self, duration: u64) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"duration\0".as_ptr() as *const _, + Value::from(&duration).to_glib_none().0, + ); } } fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut ges_sys::GESUriClipAsset, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn notify_duration_trampoline( + this: *mut ges_sys::GESUriClipAsset, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&UriClipAsset::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-editing-services/src/auto/uri_source_asset.rs b/gstreamer-editing-services/src/auto/uri_source_asset.rs index 63c5de77a..aa64fa306 100644 --- a/gstreamer-editing-services/src/auto/uri_source_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_source_asset.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Asset; -use UriClipAsset; use ges_sys; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_pbutils; +use Asset; +use UriClipAsset; glib_wrapper! { pub struct UriSourceAsset(Object) @extends Asset; @@ -31,19 +31,25 @@ pub trait UriSourceAssetExt: 'static { impl> UriSourceAssetExt for O { fn get_filesource_asset(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_uri_source_asset_get_filesource_asset(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_uri_source_asset_get_filesource_asset( + self.as_ref().to_glib_none().0, + )) } } fn get_stream_info(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_uri_source_asset_get_stream_info(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_uri_source_asset_get_stream_info( + self.as_ref().to_glib_none().0, + )) } } fn get_stream_uri(&self) -> Option { unsafe { - from_glib_none(ges_sys::ges_uri_source_asset_get_stream_uri(self.as_ref().to_glib_none().0)) + from_glib_none(ges_sys::ges_uri_source_asset_get_stream_uri( + self.as_ref().to_glib_none().0, + )) } } } diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index 226bfcc0c..153af697b 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -69,7 +69,6 @@ macro_rules! skip_assert_initialized { #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-gl/src/auto/enums.rs b/gstreamer-gl/src/auto/enums.rs index d615a093c..494678536 100644 --- a/gstreamer-gl/src/auto/enums.rs +++ b/gstreamer-gl/src/auto/enums.rs @@ -2,20 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::Quark; -use glib::StaticType; -use glib::Type; use glib::error::ErrorDomain; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::Quark; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_gl_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLContextError { Failed, WrongConfig, @@ -38,8 +37,10 @@ impl ToGlib for GLContextError { GLContextError::WrongApi => gst_gl_sys::GST_GL_CONTEXT_ERROR_WRONG_API, GLContextError::OldLibs => gst_gl_sys::GST_GL_CONTEXT_ERROR_OLD_LIBS, GLContextError::CreateContext => gst_gl_sys::GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, - GLContextError::ResourceUnavailable => gst_gl_sys::GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, - GLContextError::__Unknown(value) => value + GLContextError::ResourceUnavailable => { + gst_gl_sys::GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE + } + GLContextError::__Unknown(value) => value, } } } @@ -108,8 +109,7 @@ impl SetValue for GLContextError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLFormat { Luminance, Alpha, @@ -153,7 +153,7 @@ impl ToGlib for GLFormat { GLFormat::Rgba16 => gst_gl_sys::GST_GL_RGBA16, GLFormat::DepthComponent16 => gst_gl_sys::GST_GL_DEPTH_COMPONENT16, GLFormat::Depth24Stencil8 => gst_gl_sys::GST_GL_DEPTH24_STENCIL8, - GLFormat::__Unknown(value) => value + GLFormat::__Unknown(value) => value, } } } @@ -208,8 +208,7 @@ impl SetValue for GLFormat { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLQueryType { None, TimeElapsed, @@ -227,7 +226,7 @@ impl ToGlib for GLQueryType { GLQueryType::None => gst_gl_sys::GST_GL_QUERY_NONE, GLQueryType::TimeElapsed => gst_gl_sys::GST_GL_QUERY_TIME_ELAPSED, GLQueryType::Timestamp => gst_gl_sys::GST_GL_QUERY_TIMESTAMP, - GLQueryType::__Unknown(value) => value + GLQueryType::__Unknown(value) => value, } } } @@ -269,8 +268,7 @@ impl SetValue for GLQueryType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLSLError { Compile, Link, @@ -288,7 +286,7 @@ impl ToGlib for GLSLError { GLSLError::Compile => gst_gl_sys::GST_GLSL_ERROR_COMPILE, GLSLError::Link => gst_gl_sys::GST_GLSL_ERROR_LINK, GLSLError::Program => gst_gl_sys::GST_GLSL_ERROR_PROGRAM, - GLSLError::__Unknown(value) => value + GLSLError::__Unknown(value) => value, } } } @@ -351,8 +349,7 @@ impl SetValue for GLSLError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLSLVersion { None, _100, @@ -398,7 +395,7 @@ impl ToGlib for GLSLVersion { GLSLVersion::_430 => gst_gl_sys::GST_GLSL_VERSION_430, GLSLVersion::_440 => gst_gl_sys::GST_GLSL_VERSION_440, GLSLVersion::_450 => gst_gl_sys::GST_GLSL_VERSION_450, - GLSLVersion::__Unknown(value) => value + GLSLVersion::__Unknown(value) => value, } } } @@ -454,8 +451,7 @@ impl SetValue for GLSLVersion { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLStereoDownmix { GreenMagentaDubois, RedCyanDubois, @@ -470,10 +466,16 @@ impl ToGlib for GLStereoDownmix { fn to_glib(&self) -> gst_gl_sys::GstGLStereoDownmix { match *self { - GLStereoDownmix::GreenMagentaDubois => gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS, - GLStereoDownmix::RedCyanDubois => gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS, - GLStereoDownmix::AmberBlueDubois => gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS, - GLStereoDownmix::__Unknown(value) => value + GLStereoDownmix::GreenMagentaDubois => { + gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS + } + GLStereoDownmix::RedCyanDubois => { + gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS + } + GLStereoDownmix::AmberBlueDubois => { + gst_gl_sys::GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS + } + GLStereoDownmix::__Unknown(value) => value, } } } @@ -515,8 +517,7 @@ impl SetValue for GLStereoDownmix { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLTextureTarget { None, _2d, @@ -536,7 +537,7 @@ impl ToGlib for GLTextureTarget { GLTextureTarget::_2d => gst_gl_sys::GST_GL_TEXTURE_TARGET_2D, GLTextureTarget::Rectangle => gst_gl_sys::GST_GL_TEXTURE_TARGET_RECTANGLE, GLTextureTarget::ExternalOes => gst_gl_sys::GST_GL_TEXTURE_TARGET_EXTERNAL_OES, - GLTextureTarget::__Unknown(value) => value + GLTextureTarget::__Unknown(value) => value, } } } @@ -579,8 +580,7 @@ impl SetValue for GLTextureTarget { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLUploadReturn { Done, Error, @@ -602,7 +602,7 @@ impl ToGlib for GLUploadReturn { GLUploadReturn::Unsupported => gst_gl_sys::GST_GL_UPLOAD_UNSUPPORTED, GLUploadReturn::Reconfigure => gst_gl_sys::GST_GL_UPLOAD_RECONFIGURE, GLUploadReturn::UnsharedGlContext => gst_gl_sys::GST_GL_UPLOAD_UNSHARED_GL_CONTEXT, - GLUploadReturn::__Unknown(value) => value + GLUploadReturn::__Unknown(value) => value, } } } @@ -646,8 +646,7 @@ impl SetValue for GLUploadReturn { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum GLWindowError { Failed, OldLibs, @@ -664,8 +663,10 @@ impl ToGlib for GLWindowError { match *self { GLWindowError::Failed => gst_gl_sys::GST_GL_WINDOW_ERROR_FAILED, GLWindowError::OldLibs => gst_gl_sys::GST_GL_WINDOW_ERROR_OLD_LIBS, - GLWindowError::ResourceUnavailable => gst_gl_sys::GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, - GLWindowError::__Unknown(value) => value + GLWindowError::ResourceUnavailable => { + gst_gl_sys::GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE + } + GLWindowError::__Unknown(value) => value, } } } @@ -727,4 +728,3 @@ impl SetValue for GLWindowError { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-gl/src/auto/flags.rs b/gstreamer-gl/src/auto/flags.rs index 05f8bd8e4..683bc1350 100644 --- a/gstreamer-gl/src/auto/flags.rs +++ b/gstreamer-gl/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_gl_sys; @@ -223,4 +223,3 @@ impl SetValue for GLSLProfile { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-gl/src/auto/gl_base_filter.rs b/gstreamer-gl/src/auto/gl_base_filter.rs index dce87097e..ac198e3b5 100644 --- a/gstreamer-gl/src/auto/gl_base_filter.rs +++ b/gstreamer-gl/src/auto/gl_base_filter.rs @@ -2,20 +2,20 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; use gst_gl_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use GLContext; glib_wrapper! { pub struct GLBaseFilter(Object) @extends gst::Object; @@ -36,36 +36,56 @@ pub trait GLBaseFilterExt: 'static { fn get_property_context(&self) -> Option; - fn connect_property_context_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_context_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> GLBaseFilterExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] fn find_gl_context(&self) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_base_filter_find_gl_context(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_base_filter_find_gl_context( + self.as_ref().to_glib_none().0, + )) } } fn get_property_context(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"context\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"context\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } - fn connect_property_context_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_context_trampoline(this: *mut gst_gl_sys::GstGLBaseFilter, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_context_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_context_trampoline( + this: *mut gst_gl_sys::GstGLBaseFilter, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&GLBaseFilter::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::context\0".as_ptr() as *const _, - Some(transmute(notify_context_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::context\0".as_ptr() as *const _, + Some(transmute(notify_context_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/gl_color_convert.rs b/gstreamer-gl/src/auto/gl_color_convert.rs index 2f72977e3..beffb8ad6 100644 --- a/gstreamer-gl/src/auto/gl_color_convert.rs +++ b/gstreamer-gl/src/auto/gl_color_convert.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; use glib; use glib::object::IsA; use glib::translate::*; use gst; use gst_gl_sys; +use GLContext; glib_wrapper! { pub struct GLColorConvert(Object) @extends gst::Object; @@ -21,20 +21,43 @@ impl GLColorConvert { pub fn new>(context: &P) -> GLColorConvert { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_color_convert_new(context.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_color_convert_new( + context.as_ref().to_glib_none().0, + )) } } - pub fn set_caps(&self, in_caps: &gst::Caps, out_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { + pub fn set_caps( + &self, + in_caps: &gst::Caps, + out_caps: &gst::Caps, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_color_convert_set_caps(self.to_glib_none().0, in_caps.to_glib_none().0, out_caps.to_glib_none().0), "Failed to set caps") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_color_convert_set_caps( + self.to_glib_none().0, + in_caps.to_glib_none().0, + out_caps.to_glib_none().0 + ), + "Failed to set caps" + ) } } - pub fn transform_caps>(context: &P, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option { + pub fn transform_caps>( + context: &P, + direction: gst::PadDirection, + caps: &gst::Caps, + filter: &gst::Caps, + ) -> Option { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_color_convert_transform_caps(context.as_ref().to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_color_convert_transform_caps( + context.as_ref().to_glib_none().0, + direction.to_glib(), + caps.to_glib_none().0, + filter.to_glib_none().0, + )) } } } diff --git a/gstreamer-gl/src/auto/gl_context.rs b/gstreamer-gl/src/auto/gl_context.rs index 013c4ae40..5254ba556 100644 --- a/gstreamer-gl/src/auto/gl_context.rs +++ b/gstreamer-gl/src/auto/gl_context.rs @@ -2,13 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use GLAPI; -use GLDisplay; -use GLPlatform; -use GLSLProfile; -use GLSLVersion; -use GLWindow; use glib; use glib::object::IsA; use glib::translate::*; @@ -16,6 +9,13 @@ use gst; use gst_gl_sys; use std::mem; use std::ptr; +use Error; +use GLDisplay; +use GLPlatform; +use GLSLProfile; +use GLSLVersion; +use GLWindow; +use GLAPI; glib_wrapper! { pub struct GLContext(Object) @extends gst::Object; @@ -29,15 +29,15 @@ impl GLContext { pub fn new>(display: &P) -> GLContext { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_gl_context_new(display.as_ref().to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_gl_context_new( + display.as_ref().to_glib_none().0, + )) } } pub fn get_current() -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_gl_sys::gst_gl_context_get_current()) - } + unsafe { from_glib_none(gst_gl_sys::gst_gl_context_get_current()) } } pub fn get_current_gl_api(platform: GLPlatform) -> (GLAPI, u32, u32) { @@ -45,7 +45,11 @@ impl GLContext { unsafe { let mut major = mem::uninitialized(); let mut minor = mem::uninitialized(); - let ret = from_glib(gst_gl_sys::gst_gl_context_get_current_gl_api(platform.to_glib(), &mut major, &mut minor)); + let ret = from_glib(gst_gl_sys::gst_gl_context_get_current_gl_api( + platform.to_glib(), + &mut major, + &mut minor, + )); (ret, major, minor) } } @@ -109,31 +113,51 @@ pub trait GLContextExt: 'static { impl> GLContextExt for O { fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_context_activate(self.as_ref().to_glib_none().0, activate.to_glib()), "Failed to activate OpenGL context") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_context_activate( + self.as_ref().to_glib_none().0, + activate.to_glib() + ), + "Failed to activate OpenGL context" + ) } } fn can_share>(&self, other_context: &P) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_can_share(self.as_ref().to_glib_none().0, other_context.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_context_can_share( + self.as_ref().to_glib_none().0, + other_context.as_ref().to_glib_none().0, + )) } } fn check_feature(&self, feature: &str) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_check_feature(self.as_ref().to_glib_none().0, feature.to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_context_check_feature( + self.as_ref().to_glib_none().0, + feature.to_glib_none().0, + )) } } fn check_framebuffer_status(&self, fbo_target: u32) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_check_framebuffer_status(self.as_ref().to_glib_none().0, fbo_target)) + from_glib(gst_gl_sys::gst_gl_context_check_framebuffer_status( + self.as_ref().to_glib_none().0, + fbo_target, + )) } } fn check_gl_version(&self, api: GLAPI, maj: i32, min: i32) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_check_gl_version(self.as_ref().to_glib_none().0, api.to_glib(), maj, min)) + from_glib(gst_gl_sys::gst_gl_context_check_gl_version( + self.as_ref().to_glib_none().0, + api.to_glib(), + maj, + min, + )) } } @@ -152,8 +176,16 @@ impl> GLContextExt for O { fn create>(&self, other_context: Option<&P>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = gst_gl_sys::gst_gl_context_create(self.as_ref().to_glib_none().0, other_context.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = gst_gl_sys::gst_gl_context_create( + self.as_ref().to_glib_none().0, + other_context.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -166,26 +198,37 @@ impl> GLContextExt for O { fn fill_info(&self) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = gst_gl_sys::gst_gl_context_fill_info(self.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = + gst_gl_sys::gst_gl_context_fill_info(self.as_ref().to_glib_none().0, &mut error); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } fn get_display(&self) -> GLDisplay { unsafe { - from_glib_full(gst_gl_sys::gst_gl_context_get_display(self.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_context_get_display( + self.as_ref().to_glib_none().0, + )) } } fn get_gl_api(&self) -> GLAPI { unsafe { - from_glib(gst_gl_sys::gst_gl_context_get_gl_api(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_context_get_gl_api( + self.as_ref().to_glib_none().0, + )) } } fn get_gl_platform(&self) -> GLPlatform { unsafe { - from_glib(gst_gl_sys::gst_gl_context_get_gl_platform(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_context_get_gl_platform( + self.as_ref().to_glib_none().0, + )) } } @@ -193,7 +236,11 @@ impl> GLContextExt for O { unsafe { let mut major = mem::uninitialized(); let mut minor = mem::uninitialized(); - gst_gl_sys::gst_gl_context_get_gl_platform_version(self.as_ref().to_glib_none().0, &mut major, &mut minor); + gst_gl_sys::gst_gl_context_get_gl_platform_version( + self.as_ref().to_glib_none().0, + &mut major, + &mut minor, + ); (major, minor) } } @@ -202,52 +249,81 @@ impl> GLContextExt for O { unsafe { let mut maj = mem::uninitialized(); let mut min = mem::uninitialized(); - gst_gl_sys::gst_gl_context_get_gl_version(self.as_ref().to_glib_none().0, &mut maj, &mut min); + gst_gl_sys::gst_gl_context_get_gl_version( + self.as_ref().to_glib_none().0, + &mut maj, + &mut min, + ); (maj, min) } } fn get_window(&self) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_context_get_window(self.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_context_get_window( + self.as_ref().to_glib_none().0, + )) } } fn is_shared(&self) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_is_shared(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_context_is_shared( + self.as_ref().to_glib_none().0, + )) } } fn set_shared_with>(&self, share: &P) { unsafe { - gst_gl_sys::gst_gl_context_set_shared_with(self.as_ref().to_glib_none().0, share.as_ref().to_glib_none().0); + gst_gl_sys::gst_gl_context_set_shared_with( + self.as_ref().to_glib_none().0, + share.as_ref().to_glib_none().0, + ); } } fn set_window>(&self, window: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_context_set_window(self.as_ref().to_glib_none().0, window.as_ref().to_glib_full()), "Failed to set window") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_context_set_window( + self.as_ref().to_glib_none().0, + window.as_ref().to_glib_full() + ), + "Failed to set window" + ) } } fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_supports_glsl_profile_version(self.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib(gst_gl_sys::gst_gl_context_supports_glsl_profile_version( + self.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn supports_precision(&self, version: GLSLVersion, profile: GLSLProfile) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_supports_precision(self.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib(gst_gl_sys::gst_gl_context_supports_precision( + self.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn supports_precision_highp(&self, version: GLSLVersion, profile: GLSLProfile) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_context_supports_precision_highp(self.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib(gst_gl_sys::gst_gl_context_supports_precision_highp( + self.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + )) } } diff --git a/gstreamer-gl/src/auto/gl_display.rs b/gstreamer-gl/src/auto/gl_display.rs index 4064a7896..ae29118d0 100644 --- a/gstreamer-gl/src/auto/gl_display.rs +++ b/gstreamer-gl/src/auto/gl_display.rs @@ -2,16 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use GLAPI; -use GLContext; -use GLDisplayType; -use GLWindow; use glib; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst; @@ -19,6 +14,11 @@ use gst_gl_sys; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Error; +use GLContext; +use GLDisplayType; +use GLWindow; +use GLAPI; glib_wrapper! { pub struct GLDisplay(Object) @extends gst::Object; @@ -31,9 +31,7 @@ glib_wrapper! { impl GLDisplay { pub fn new() -> GLDisplay { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_gl_sys::gst_gl_display_new()) - } + unsafe { from_glib_full(gst_gl_sys::gst_gl_display_new()) } } } @@ -65,13 +63,22 @@ pub trait GLDisplayExt: 'static { fn remove_window>(&self, window: &P) -> Result<(), glib::error::BoolError>; - fn connect_create_context GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_create_context GLContext + Send + Sync + 'static>( + &self, + f: F, + ) -> SignalHandlerId; } impl> GLDisplayExt for O { fn add_context>(&self, context: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_display_add_context(self.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0), "Failed to add OpenGL context") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_display_add_context( + self.as_ref().to_glib_none().0, + context.as_ref().to_glib_none().0 + ), + "Failed to add OpenGL context" + ) } } @@ -79,58 +86,103 @@ impl> GLDisplayExt for O { unsafe { let mut p_context = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = gst_gl_sys::gst_gl_display_create_context(self.as_ref().to_glib_none().0, other_context.as_ref().to_glib_none().0, &mut p_context, &mut error); - if error.is_null() { Ok(from_glib_full(p_context)) } else { Err(from_glib_full(error)) } + let _ = gst_gl_sys::gst_gl_display_create_context( + self.as_ref().to_glib_none().0, + other_context.as_ref().to_glib_none().0, + &mut p_context, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(p_context)) + } else { + Err(from_glib_full(error)) + } } } fn create_window(&self) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_display_create_window(self.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_display_create_window( + self.as_ref().to_glib_none().0, + )) } } fn filter_gl_api(&self, gl_api: GLAPI) { unsafe { - gst_gl_sys::gst_gl_display_filter_gl_api(self.as_ref().to_glib_none().0, gl_api.to_glib()); + gst_gl_sys::gst_gl_display_filter_gl_api( + self.as_ref().to_glib_none().0, + gl_api.to_glib(), + ); } } fn get_gl_api(&self) -> GLAPI { unsafe { - from_glib(gst_gl_sys::gst_gl_display_get_gl_api(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_display_get_gl_api( + self.as_ref().to_glib_none().0, + )) } } fn get_gl_api_unlocked(&self) -> GLAPI { unsafe { - from_glib(gst_gl_sys::gst_gl_display_get_gl_api_unlocked(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_display_get_gl_api_unlocked( + self.as_ref().to_glib_none().0, + )) } } fn get_handle_type(&self) -> GLDisplayType { unsafe { - from_glib(gst_gl_sys::gst_gl_display_get_handle_type(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_display_get_handle_type( + self.as_ref().to_glib_none().0, + )) } } fn remove_window>(&self, window: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_display_remove_window(self.as_ref().to_glib_none().0, window.as_ref().to_glib_none().0), "Failed to remove window") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_display_remove_window( + self.as_ref().to_glib_none().0, + window.as_ref().to_glib_none().0 + ), + "Failed to remove window" + ) } } - fn connect_create_context GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn create_context_trampoline GLContext + Send + Sync + 'static>(this: *mut gst_gl_sys::GstGLDisplay, context: *mut gst_gl_sys::GstGLContext, f: glib_sys::gpointer) -> *mut gst_gl_sys::GstGLContext - where P: IsA + fn connect_create_context GLContext + Send + Sync + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn create_context_trampoline< + P, + F: Fn(&P, &GLContext) -> GLContext + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLDisplay, + context: *mut gst_gl_sys::GstGLContext, + f: glib_sys::gpointer, + ) -> *mut gst_gl_sys::GstGLContext + where + P: IsA, { let f: &F = &*(f as *const F); - f(&GLDisplay::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(context)).to_glib_full() + f( + &GLDisplay::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(context), + ) + .to_glib_full() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"create-context\0".as_ptr() as *const _, - Some(transmute(create_context_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"create-context\0".as_ptr() as *const _, + Some(transmute(create_context_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/gl_display_egl.rs b/gstreamer-gl/src/auto/gl_display_egl.rs index 051c8bc2e..dc56d9b87 100644 --- a/gstreamer-gl/src/auto/gl_display_egl.rs +++ b/gstreamer-gl/src/auto/gl_display_egl.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLDisplay; use glib::translate::*; use gst; use gst_gl_sys; +use GLDisplay; glib_wrapper! { pub struct GLDisplayEGL(Object) @extends GLDisplay, gst::Object; @@ -18,9 +18,7 @@ glib_wrapper! { impl GLDisplayEGL { pub fn new() -> GLDisplayEGL { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_gl_sys::gst_gl_display_egl_new()) - } + unsafe { from_glib_full(gst_gl_sys::gst_gl_display_egl_new()) } } //pub fn new_with_egl_display(display: /*Unimplemented*/Option) -> GLDisplayEGL { diff --git a/gstreamer-gl/src/auto/gl_display_wayland.rs b/gstreamer-gl/src/auto/gl_display_wayland.rs index e85d5d3c1..71cc71ec3 100644 --- a/gstreamer-gl/src/auto/gl_display_wayland.rs +++ b/gstreamer-gl/src/auto/gl_display_wayland.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLDisplay; use glib::translate::*; use gst; use gst_gl_sys; +use GLDisplay; glib_wrapper! { pub struct GLDisplayWayland(Object) @extends GLDisplay, gst::Object; @@ -19,7 +19,9 @@ impl GLDisplayWayland { pub fn new(name: Option<&str>) -> GLDisplayWayland { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_display_wayland_new(name.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_display_wayland_new( + name.to_glib_none().0, + )) } } diff --git a/gstreamer-gl/src/auto/gl_display_x11.rs b/gstreamer-gl/src/auto/gl_display_x11.rs index 1379951c0..57deca49f 100644 --- a/gstreamer-gl/src/auto/gl_display_x11.rs +++ b/gstreamer-gl/src/auto/gl_display_x11.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLDisplay; use glib::translate::*; use gst; use gst_gl_sys; +use GLDisplay; glib_wrapper! { pub struct GLDisplayX11(Object) @extends GLDisplay, gst::Object; @@ -18,9 +18,7 @@ glib_wrapper! { impl GLDisplayX11 { pub fn new(name: Option<&str>) -> GLDisplayX11 { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_gl_sys::gst_gl_display_x11_new(name.to_glib_none().0)) - } + unsafe { from_glib_full(gst_gl_sys::gst_gl_display_x11_new(name.to_glib_none().0)) } } //pub fn new_with_display(display: /*Unimplemented*/Fundamental: Pointer) -> GLDisplayX11 { diff --git a/gstreamer-gl/src/auto/gl_framebuffer.rs b/gstreamer-gl/src/auto/gl_framebuffer.rs index b1ceceb88..d53a6d411 100644 --- a/gstreamer-gl/src/auto/gl_framebuffer.rs +++ b/gstreamer-gl/src/auto/gl_framebuffer.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; use glib::object::IsA; use glib::translate::*; use gst; use gst_gl_sys; use std::mem; +use GLContext; glib_wrapper! { pub struct GLFramebuffer(Object) @extends gst::Object; @@ -21,14 +21,24 @@ impl GLFramebuffer { pub fn new>(context: &P) -> GLFramebuffer { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_framebuffer_new(context.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_framebuffer_new( + context.as_ref().to_glib_none().0, + )) } } - pub fn new_with_default_depth>(context: &P, width: u32, height: u32) -> GLFramebuffer { + pub fn new_with_default_depth>( + context: &P, + width: u32, + height: u32, + ) -> GLFramebuffer { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_gl_framebuffer_new_with_default_depth(context.as_ref().to_glib_none().0, width, height)) + from_glib_none(gst_gl_sys::gst_gl_framebuffer_new_with_default_depth( + context.as_ref().to_glib_none().0, + width, + height, + )) } } } @@ -69,14 +79,16 @@ impl> GLFramebufferExt for O { unsafe { let mut width = mem::uninitialized(); let mut height = mem::uninitialized(); - gst_gl_sys::gst_gl_framebuffer_get_effective_dimensions(self.as_ref().to_glib_none().0, &mut width, &mut height); + gst_gl_sys::gst_gl_framebuffer_get_effective_dimensions( + self.as_ref().to_glib_none().0, + &mut width, + &mut height, + ); (width, height) } } fn get_id(&self) -> u32 { - unsafe { - gst_gl_sys::gst_gl_framebuffer_get_id(self.as_ref().to_glib_none().0) - } + unsafe { gst_gl_sys::gst_gl_framebuffer_get_id(self.as_ref().to_glib_none().0) } } } diff --git a/gstreamer-gl/src/auto/gl_overlay_compositor.rs b/gstreamer-gl/src/auto/gl_overlay_compositor.rs index 059300030..2bbb62ead 100644 --- a/gstreamer-gl/src/auto/gl_overlay_compositor.rs +++ b/gstreamer-gl/src/auto/gl_overlay_compositor.rs @@ -2,20 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; -#[cfg(any(feature = "v1_16", feature = "dox"))] -use glib::StaticType; -#[cfg(any(feature = "v1_16", feature = "dox"))] -use glib::Value; use glib::object::IsA; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::object::ObjectType as ObjectType_; #[cfg(any(feature = "v1_16", feature = "dox"))] -use glib::signal::SignalHandlerId; -#[cfg(any(feature = "v1_16", feature = "dox"))] use glib::signal::connect_raw; +#[cfg(any(feature = "v1_16", feature = "dox"))] +use glib::signal::SignalHandlerId; use glib::translate::*; #[cfg(any(feature = "v1_16", feature = "dox"))] +use glib::StaticType; +#[cfg(any(feature = "v1_16", feature = "dox"))] +use glib::Value; +#[cfg(any(feature = "v1_16", feature = "dox"))] use glib_sys; #[cfg(any(feature = "v1_16", feature = "dox"))] use gobject_sys; @@ -25,6 +24,7 @@ use gst_gl_sys; use std::boxed::Box as Box_; #[cfg(any(feature = "v1_16", feature = "dox"))] use std::mem::transmute; +use GLContext; glib_wrapper! { pub struct GLOverlayCompositor(Object) @extends gst::Object; @@ -38,7 +38,9 @@ impl GLOverlayCompositor { pub fn new>(context: &P) -> GLOverlayCompositor { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_gl_overlay_compositor_new(context.as_ref().to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_gl_overlay_compositor_new( + context.as_ref().to_glib_none().0, + )) } } @@ -58,7 +60,11 @@ impl GLOverlayCompositor { pub fn get_property_yinvert(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"yinvert\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"yinvert\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -66,27 +72,46 @@ impl GLOverlayCompositor { #[cfg(any(feature = "v1_16", feature = "dox"))] pub fn set_property_yinvert(&self, yinvert: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"yinvert\0".as_ptr() as *const _, Value::from(&yinvert).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"yinvert\0".as_ptr() as *const _, + Value::from(&yinvert).to_glib_none().0, + ); } } pub fn add_caps(caps: &gst::Caps) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_overlay_compositor_add_caps(caps.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_overlay_compositor_add_caps( + caps.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn connect_property_yinvert_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_yinvert_trampoline(this: *mut gst_gl_sys::GstGLOverlayCompositor, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_yinvert_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_yinvert_trampoline< + F: Fn(&GLOverlayCompositor) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLOverlayCompositor, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::yinvert\0".as_ptr() as *const _, - Some(transmute(notify_yinvert_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::yinvert\0".as_ptr() as *const _, + Some(transmute(notify_yinvert_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/gl_shader.rs b/gstreamer-gl/src/auto/gl_shader.rs index 810114bce..3f6acd293 100644 --- a/gstreamer-gl/src/auto/gl_shader.rs +++ b/gstreamer-gl/src/auto/gl_shader.rs @@ -2,23 +2,16 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use GLContext; -#[cfg(any(feature = "v1_16", feature = "dox"))] -use GLSLProfile; -use GLSLStage; -#[cfg(any(feature = "v1_16", feature = "dox"))] -use GLSLVersion; use glib; +use glib::object::IsA; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::IsA; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -26,6 +19,13 @@ use gst_gl_sys; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use Error; +use GLContext; +#[cfg(any(feature = "v1_16", feature = "dox"))] +use GLSLProfile; +use GLSLStage; +#[cfg(any(feature = "v1_16", feature = "dox"))] +use GLSLVersion; glib_wrapper! { pub struct GLShader(Object) @extends gst::Object; @@ -39,7 +39,9 @@ impl GLShader { pub fn new>(context: &P) -> GLShader { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_shader_new(context.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_shader_new( + context.as_ref().to_glib_none().0, + )) } } @@ -47,8 +49,15 @@ impl GLShader { skip_assert_initialized!(); unsafe { let mut error = ptr::null_mut(); - let ret = gst_gl_sys::gst_gl_shader_new_default(context.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_gl_sys::gst_gl_shader_new_default( + context.as_ref().to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -62,33 +71,58 @@ impl GLShader { pub fn attach(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0), "Failed to attach stage to shader") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0), + "Failed to attach stage to shader" + ) } } pub fn attach_unlocked(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0), "Failed to attach stage to shader") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_shader_attach_unlocked( + self.to_glib_none().0, + stage.to_glib_none().0 + ), + "Failed to attach stage to shader" + ) } } pub fn bind_attribute_location(&self, index: u32, name: &str) { unsafe { - gst_gl_sys::gst_gl_shader_bind_attribute_location(self.to_glib_none().0, index, name.to_glib_none().0); + gst_gl_sys::gst_gl_shader_bind_attribute_location( + self.to_glib_none().0, + index, + name.to_glib_none().0, + ); } } pub fn bind_frag_data_location(&self, index: u32, name: &str) { unsafe { - gst_gl_sys::gst_gl_shader_bind_frag_data_location(self.to_glib_none().0, index, name.to_glib_none().0); + gst_gl_sys::gst_gl_shader_bind_frag_data_location( + self.to_glib_none().0, + index, + name.to_glib_none().0, + ); } } pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = gst_gl_sys::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = gst_gl_sys::gst_gl_shader_compile_attach_stage( + self.to_glib_none().0, + stage.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -100,33 +134,39 @@ impl GLShader { pub fn detach_unlocked(&self, stage: &GLSLStage) { unsafe { - gst_gl_sys::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0); + gst_gl_sys::gst_gl_shader_detach_unlocked( + self.to_glib_none().0, + stage.to_glib_none().0, + ); } } pub fn get_attribute_location(&self, name: &str) -> i32 { unsafe { - gst_gl_sys::gst_gl_shader_get_attribute_location(self.to_glib_none().0, name.to_glib_none().0) + gst_gl_sys::gst_gl_shader_get_attribute_location( + self.to_glib_none().0, + name.to_glib_none().0, + ) } } pub fn get_program_handle(&self) -> i32 { - unsafe { - gst_gl_sys::gst_gl_shader_get_program_handle(self.to_glib_none().0) - } + unsafe { gst_gl_sys::gst_gl_shader_get_program_handle(self.to_glib_none().0) } } pub fn is_linked(&self) -> bool { - unsafe { - from_glib(gst_gl_sys::gst_gl_shader_is_linked(self.to_glib_none().0)) - } + unsafe { from_glib(gst_gl_sys::gst_gl_shader_is_linked(self.to_glib_none().0)) } } pub fn link(&self) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = gst_gl_sys::gst_gl_shader_link(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -144,105 +184,189 @@ impl GLShader { pub fn set_uniform_1f(&self, name: &str, value: f32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_1f(self.to_glib_none().0, name.to_glib_none().0, value); + gst_gl_sys::gst_gl_shader_set_uniform_1f( + self.to_glib_none().0, + name.to_glib_none().0, + value, + ); } } pub fn set_uniform_1fv(&self, name: &str, value: &[f32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_1fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_1fv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_1i(&self, name: &str, value: i32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_1i(self.to_glib_none().0, name.to_glib_none().0, value); + gst_gl_sys::gst_gl_shader_set_uniform_1i( + self.to_glib_none().0, + name.to_glib_none().0, + value, + ); } } pub fn set_uniform_1iv(&self, name: &str, value: &[i32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_1iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_1iv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_2f(&self, name: &str, v0: f32, v1: f32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_2f(self.to_glib_none().0, name.to_glib_none().0, v0, v1); + gst_gl_sys::gst_gl_shader_set_uniform_2f( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + ); } } pub fn set_uniform_2fv(&self, name: &str, value: &[f32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_2fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_2fv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_2i(&self, name: &str, v0: i32, v1: i32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_2i(self.to_glib_none().0, name.to_glib_none().0, v0, v1); + gst_gl_sys::gst_gl_shader_set_uniform_2i( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + ); } } pub fn set_uniform_2iv(&self, name: &str, value: &[i32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_2iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_2iv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_3f(&self, name: &str, v0: f32, v1: f32, v2: f32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_3f(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2); + gst_gl_sys::gst_gl_shader_set_uniform_3f( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + v2, + ); } } pub fn set_uniform_3fv(&self, name: &str, value: &[f32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_3fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_3fv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_3i(&self, name: &str, v0: i32, v1: i32, v2: i32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_3i(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2); + gst_gl_sys::gst_gl_shader_set_uniform_3i( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + v2, + ); } } pub fn set_uniform_3iv(&self, name: &str, value: &[i32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_3iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_3iv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_4f(&self, name: &str, v0: f32, v1: f32, v2: f32, v3: f32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_4f(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2, v3); + gst_gl_sys::gst_gl_shader_set_uniform_4f( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + v2, + v3, + ); } } pub fn set_uniform_4fv(&self, name: &str, value: &[f32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_4fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_4fv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } pub fn set_uniform_4i(&self, name: &str, v0: i32, v1: i32, v2: i32, v3: i32) { unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_4i(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2, v3); + gst_gl_sys::gst_gl_shader_set_uniform_4i( + self.to_glib_none().0, + name.to_glib_none().0, + v0, + v1, + v2, + v3, + ); } } pub fn set_uniform_4iv(&self, name: &str, value: &[i32]) { let count = value.len() as u32; unsafe { - gst_gl_sys::gst_gl_shader_set_uniform_4iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0); + gst_gl_sys::gst_gl_shader_set_uniform_4iv( + self.to_glib_none().0, + name.to_glib_none().0, + count, + value.to_glib_none().0, + ); } } @@ -255,44 +379,85 @@ impl GLShader { pub fn get_property_linked(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"linked\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn string_fragment_external_oes_get_default>(context: &P, version: GLSLVersion, profile: GLSLProfile) -> Option { + pub fn string_fragment_external_oes_get_default>( + context: &P, + version: GLSLVersion, + profile: GLSLProfile, + ) -> Option { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_shader_string_fragment_external_oes_get_default(context.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib_full( + gst_gl_sys::gst_gl_shader_string_fragment_external_oes_get_default( + context.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + ), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn string_fragment_get_default>(context: &P, version: GLSLVersion, profile: GLSLProfile) -> Option { + pub fn string_fragment_get_default>( + context: &P, + version: GLSLVersion, + profile: GLSLProfile, + ) -> Option { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_shader_string_fragment_get_default(context.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib_full(gst_gl_sys::gst_gl_shader_string_fragment_get_default( + context.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn string_get_highest_precision>(context: &P, version: GLSLVersion, profile: GLSLProfile) -> Option { + pub fn string_get_highest_precision>( + context: &P, + version: GLSLVersion, + profile: GLSLProfile, + ) -> Option { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_gl_shader_string_get_highest_precision(context.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib_none(gst_gl_sys::gst_gl_shader_string_get_highest_precision( + context.as_ref().to_glib_none().0, + version.to_glib(), + profile.to_glib(), + )) } } - pub fn connect_property_linked_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_linked_trampoline(this: *mut gst_gl_sys::GstGLShader, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_linked_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_linked_trampoline( + this: *mut gst_gl_sys::GstGLShader, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::linked\0".as_ptr() as *const _, - Some(transmute(notify_linked_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::linked\0".as_ptr() as *const _, + Some(transmute(notify_linked_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/gl_upload.rs b/gstreamer-gl/src/auto/gl_upload.rs index 035f6028c..42c4268d3 100644 --- a/gstreamer-gl/src/auto/gl_upload.rs +++ b/gstreamer-gl/src/auto/gl_upload.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; use glib; use glib::object::IsA; use glib::translate::*; use gst; use gst_gl_sys; use std::ptr; +use GLContext; glib_wrapper! { pub struct GLUpload(Object) @extends gst::Object; @@ -22,7 +22,9 @@ impl GLUpload { pub fn new>(context: &P) -> GLUpload { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_upload_new(context.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_upload_new( + context.as_ref().to_glib_none().0, + )) } } @@ -35,29 +37,53 @@ impl GLUpload { } } - pub fn set_caps(&self, in_caps: &gst::Caps, out_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { + pub fn set_caps( + &self, + in_caps: &gst::Caps, + out_caps: &gst::Caps, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_upload_set_caps(self.to_glib_none().0, in_caps.to_glib_none().0, out_caps.to_glib_none().0), "Failed to set caps") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_upload_set_caps( + self.to_glib_none().0, + in_caps.to_glib_none().0, + out_caps.to_glib_none().0 + ), + "Failed to set caps" + ) } } pub fn set_context>(&self, context: &P) { unsafe { - gst_gl_sys::gst_gl_upload_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0); + gst_gl_sys::gst_gl_upload_set_context( + self.to_glib_none().0, + context.as_ref().to_glib_none().0, + ); } } - pub fn transform_caps>(&self, context: &P, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option { + pub fn transform_caps>( + &self, + context: &P, + direction: gst::PadDirection, + caps: &gst::Caps, + filter: &gst::Caps, + ) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_upload_transform_caps(self.to_glib_none().0, context.as_ref().to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_upload_transform_caps( + self.to_glib_none().0, + context.as_ref().to_glib_none().0, + direction.to_glib(), + caps.to_glib_none().0, + filter.to_glib_none().0, + )) } } pub fn get_input_template_caps() -> gst::Caps { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_gl_sys::gst_gl_upload_get_input_template_caps()) - } + unsafe { from_glib_full(gst_gl_sys::gst_gl_upload_get_input_template_caps()) } } } diff --git a/gstreamer-gl/src/auto/gl_view_convert.rs b/gstreamer-gl/src/auto/gl_view_convert.rs index 990817fbf..bb0deceab 100644 --- a/gstreamer-gl/src/auto/gl_view_convert.rs +++ b/gstreamer-gl/src/auto/gl_view_convert.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; -use GLStereoDownmix; use glib; -use glib::StaticType; -use glib::Value; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; @@ -19,6 +17,8 @@ use gst_gl_sys; use gst_video; use std::boxed::Box as Box_; use std::mem::transmute; +use GLContext; +use GLStereoDownmix; glib_wrapper! { pub struct GLViewConvert(Object) @extends gst::Object; @@ -31,14 +31,15 @@ glib_wrapper! { impl GLViewConvert { pub fn new() -> GLViewConvert { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_gl_sys::gst_gl_view_convert_new()) - } + unsafe { from_glib_full(gst_gl_sys::gst_gl_view_convert_new()) } } pub fn perform(&self, inbuf: &gst::Buffer) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_view_convert_perform(self.to_glib_none().0, inbuf.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_view_convert_perform( + self.to_glib_none().0, + inbuf.to_glib_none().0, + )) } } @@ -48,151 +49,312 @@ impl GLViewConvert { } } - pub fn set_caps(&self, in_caps: &gst::Caps, out_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { + pub fn set_caps( + &self, + in_caps: &gst::Caps, + out_caps: &gst::Caps, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_view_convert_set_caps(self.to_glib_none().0, in_caps.to_glib_none().0, out_caps.to_glib_none().0), "Failed to set caps") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_view_convert_set_caps( + self.to_glib_none().0, + in_caps.to_glib_none().0, + out_caps.to_glib_none().0 + ), + "Failed to set caps" + ) } } pub fn set_context>(&self, context: &P) { unsafe { - gst_gl_sys::gst_gl_view_convert_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0); + gst_gl_sys::gst_gl_view_convert_set_context( + self.to_glib_none().0, + context.as_ref().to_glib_none().0, + ); } } - pub fn transform_caps(&self, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option { + pub fn transform_caps( + &self, + direction: gst::PadDirection, + caps: &gst::Caps, + filter: &gst::Caps, + ) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_view_convert_transform_caps(self.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_view_convert_transform_caps( + self.to_glib_none().0, + direction.to_glib(), + caps.to_glib_none().0, + filter.to_glib_none().0, + )) } } pub fn get_property_downmix_mode(&self) -> GLStereoDownmix { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"downmix-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"downmix-mode\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_downmix_mode(&self, downmix_mode: GLStereoDownmix) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"downmix-mode\0".as_ptr() as *const _, Value::from(&downmix_mode).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"downmix-mode\0".as_ptr() as *const _, + Value::from(&downmix_mode).to_glib_none().0, + ); } } pub fn get_property_input_flags_override(&self) -> gst_video::VideoMultiviewFlags { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"input-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"input-flags-override\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) { + pub fn set_property_input_flags_override( + &self, + input_flags_override: gst_video::VideoMultiviewFlags, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"input-flags-override\0".as_ptr() as *const _, Value::from(&input_flags_override).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"input-flags-override\0".as_ptr() as *const _, + Value::from(&input_flags_override).to_glib_none().0, + ); } } pub fn get_property_input_mode_override(&self) -> gst_video::VideoMultiviewMode { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"input-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"input-mode-override\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) { + pub fn set_property_input_mode_override( + &self, + input_mode_override: gst_video::VideoMultiviewMode, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"input-mode-override\0".as_ptr() as *const _, Value::from(&input_mode_override).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"input-mode-override\0".as_ptr() as *const _, + Value::from(&input_mode_override).to_glib_none().0, + ); } } pub fn get_property_output_flags_override(&self) -> gst_video::VideoMultiviewFlags { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"output-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"output-flags-override\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) { + pub fn set_property_output_flags_override( + &self, + output_flags_override: gst_video::VideoMultiviewFlags, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"output-flags-override\0".as_ptr() as *const _, Value::from(&output_flags_override).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"output-flags-override\0".as_ptr() as *const _, + Value::from(&output_flags_override).to_glib_none().0, + ); } } pub fn get_property_output_mode_override(&self) -> gst_video::VideoMultiviewMode { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"output-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"output-mode-override\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) { + pub fn set_property_output_mode_override( + &self, + output_mode_override: gst_video::VideoMultiviewMode, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"output-mode-override\0".as_ptr() as *const _, Value::from(&output_mode_override).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"output-mode-override\0".as_ptr() as *const _, + Value::from(&output_mode_override).to_glib_none().0, + ); } } - pub fn connect_property_downmix_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_downmix_mode_trampoline(this: *mut gst_gl_sys::GstGLViewConvert, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_downmix_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_downmix_mode_trampoline< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLViewConvert, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::downmix-mode\0".as_ptr() as *const _, - Some(transmute(notify_downmix_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::downmix-mode\0".as_ptr() as *const _, + Some(transmute(notify_downmix_mode_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_input_flags_override_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_input_flags_override_trampoline(this: *mut gst_gl_sys::GstGLViewConvert, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_input_flags_override_notify< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_input_flags_override_trampoline< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLViewConvert, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::input-flags-override\0".as_ptr() as *const _, - Some(transmute(notify_input_flags_override_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::input-flags-override\0".as_ptr() as *const _, + Some(transmute( + notify_input_flags_override_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_input_mode_override_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_input_mode_override_trampoline(this: *mut gst_gl_sys::GstGLViewConvert, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_input_mode_override_notify< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_input_mode_override_trampoline< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLViewConvert, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::input-mode-override\0".as_ptr() as *const _, - Some(transmute(notify_input_mode_override_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::input-mode-override\0".as_ptr() as *const _, + Some(transmute( + notify_input_mode_override_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_output_flags_override_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_output_flags_override_trampoline(this: *mut gst_gl_sys::GstGLViewConvert, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_output_flags_override_notify< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_output_flags_override_trampoline< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLViewConvert, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::output-flags-override\0".as_ptr() as *const _, - Some(transmute(notify_output_flags_override_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::output-flags-override\0".as_ptr() as *const _, + Some(transmute( + notify_output_flags_override_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_output_mode_override_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_output_mode_override_trampoline(this: *mut gst_gl_sys::GstGLViewConvert, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_output_mode_override_notify< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_output_mode_override_trampoline< + F: Fn(&GLViewConvert) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLViewConvert, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::output-mode-override\0".as_ptr() as *const _, - Some(transmute(notify_output_mode_override_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::output-mode-override\0".as_ptr() as *const _, + Some(transmute( + notify_output_mode_override_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/gl_window.rs b/gstreamer-gl/src/auto/gl_window.rs index 3deddab30..d16d1d4bc 100644 --- a/gstreamer-gl/src/auto/gl_window.rs +++ b/gstreamer-gl/src/auto/gl_window.rs @@ -2,15 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GLContext; -use GLDisplay; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst; use gst_gl_sys; @@ -18,6 +16,8 @@ use libc; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; +use GLContext; +use GLDisplay; glib_wrapper! { pub struct GLWindow(Object) @extends gst::Object; @@ -31,7 +31,9 @@ impl GLWindow { pub fn new>(display: &P) -> GLWindow { skip_assert_initialized!(); unsafe { - from_glib_full(gst_gl_sys::gst_gl_window_new(display.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_window_new( + display.as_ref().to_glib_none().0, + )) } } } @@ -67,20 +69,34 @@ pub trait GLWindowExt: 'static { fn set_preferred_size(&self, width: i32, height: i32); - fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError>; + fn set_render_rectangle( + &self, + x: i32, + y: i32, + width: i32, + height: i32, + ) -> Result<(), glib::error::BoolError>; fn show(&self); - fn connect_key_event(&self, f: F) -> SignalHandlerId; + fn connect_key_event( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_mouse_event(&self, f: F) -> SignalHandlerId; + fn connect_mouse_event( + &self, + f: F, + ) -> SignalHandlerId; } impl> GLWindowExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] fn controls_viewport(&self) -> bool { unsafe { - from_glib(gst_gl_sys::gst_gl_window_controls_viewport(self.as_ref().to_glib_none().0)) + from_glib(gst_gl_sys::gst_gl_window_controls_viewport( + self.as_ref().to_glib_none().0, + )) } } @@ -92,7 +108,9 @@ impl> GLWindowExt for O { fn get_context(&self) -> Option { unsafe { - from_glib_full(gst_gl_sys::gst_gl_window_get_context(self.as_ref().to_glib_none().0)) + from_glib_full(gst_gl_sys::gst_gl_window_get_context( + self.as_ref().to_glib_none().0, + )) } } @@ -100,14 +118,21 @@ impl> GLWindowExt for O { unsafe { let mut width = mem::uninitialized(); let mut height = mem::uninitialized(); - gst_gl_sys::gst_gl_window_get_surface_dimensions(self.as_ref().to_glib_none().0, &mut width, &mut height); + gst_gl_sys::gst_gl_window_get_surface_dimensions( + self.as_ref().to_glib_none().0, + &mut width, + &mut height, + ); (width, height) } } fn handle_events(&self, handle_events: bool) { unsafe { - gst_gl_sys::gst_gl_window_handle_events(self.as_ref().to_glib_none().0, handle_events.to_glib()); + gst_gl_sys::gst_gl_window_handle_events( + self.as_ref().to_glib_none().0, + handle_events.to_glib(), + ); } } @@ -137,25 +162,54 @@ impl> GLWindowExt for O { fn send_key_event(&self, event_type: &str, key_str: &str) { unsafe { - gst_gl_sys::gst_gl_window_send_key_event(self.as_ref().to_glib_none().0, event_type.to_glib_none().0, key_str.to_glib_none().0); + gst_gl_sys::gst_gl_window_send_key_event( + self.as_ref().to_glib_none().0, + event_type.to_glib_none().0, + key_str.to_glib_none().0, + ); } } fn send_mouse_event(&self, event_type: &str, button: i32, posx: f64, posy: f64) { unsafe { - gst_gl_sys::gst_gl_window_send_mouse_event(self.as_ref().to_glib_none().0, event_type.to_glib_none().0, button, posx, posy); + gst_gl_sys::gst_gl_window_send_mouse_event( + self.as_ref().to_glib_none().0, + event_type.to_glib_none().0, + button, + posx, + posy, + ); } } fn set_preferred_size(&self, width: i32, height: i32) { unsafe { - gst_gl_sys::gst_gl_window_set_preferred_size(self.as_ref().to_glib_none().0, width, height); + gst_gl_sys::gst_gl_window_set_preferred_size( + self.as_ref().to_glib_none().0, + width, + height, + ); } } - fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError> { + fn set_render_rectangle( + &self, + x: i32, + y: i32, + width: i32, + height: i32, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_gl_window_set_render_rectangle(self.as_ref().to_glib_none().0, x, y, width, height), "Failed to set the specified region") + glib_result_from_gboolean!( + gst_gl_sys::gst_gl_window_set_render_rectangle( + self.as_ref().to_glib_none().0, + x, + y, + width, + height + ), + "Failed to set the specified region" + ) } } @@ -165,31 +219,73 @@ impl> GLWindowExt for O { } } - fn connect_key_event(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn key_event_trampoline(this: *mut gst_gl_sys::GstGLWindow, id: *mut libc::c_char, key: *mut libc::c_char, f: glib_sys::gpointer) - where P: IsA + fn connect_key_event( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn key_event_trampoline< + P, + F: Fn(&P, &str, &str) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLWindow, + id: *mut libc::c_char, + key: *mut libc::c_char, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&GLWindow::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(id), &GString::from_glib_borrow(key)) + f( + &GLWindow::from_glib_borrow(this).unsafe_cast(), + &GString::from_glib_borrow(id), + &GString::from_glib_borrow(key), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"key-event\0".as_ptr() as *const _, - Some(transmute(key_event_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"key-event\0".as_ptr() as *const _, + Some(transmute(key_event_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_mouse_event(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn mouse_event_trampoline(this: *mut gst_gl_sys::GstGLWindow, id: *mut libc::c_char, button: libc::c_int, x: libc::c_double, y: libc::c_double, f: glib_sys::gpointer) - where P: IsA + fn connect_mouse_event( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn mouse_event_trampoline< + P, + F: Fn(&P, &str, i32, f64, f64) + Send + Sync + 'static, + >( + this: *mut gst_gl_sys::GstGLWindow, + id: *mut libc::c_char, + button: libc::c_int, + x: libc::c_double, + y: libc::c_double, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&GLWindow::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(id), button, x, y) + f( + &GLWindow::from_glib_borrow(this).unsafe_cast(), + &GString::from_glib_borrow(id), + button, + x, + y, + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"mouse-event\0".as_ptr() as *const _, - Some(transmute(mouse_event_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"mouse-event\0".as_ptr() as *const _, + Some(transmute(mouse_event_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-gl/src/auto/glsl_stage.rs b/gstreamer-gl/src/auto/glsl_stage.rs index f3b3aefac..ee3f4b4d2 100644 --- a/gstreamer-gl/src/auto/glsl_stage.rs +++ b/gstreamer-gl/src/auto/glsl_stage.rs @@ -2,17 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::IsA; +use glib::translate::*; +use glib::GString; +use gst; +use gst_gl_sys; +use std::ptr; use Error; use GLContext; use GLSLProfile; use GLSLVersion; -use glib; -use glib::GString; -use glib::object::IsA; -use glib::translate::*; -use gst; -use gst_gl_sys; -use std::ptr; glib_wrapper! { pub struct GLSLStage(Object) @extends gst::Object; @@ -26,36 +26,68 @@ impl GLSLStage { pub fn new>(context: &P, type_: u32) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_glsl_stage_new(context.as_ref().to_glib_none().0, type_)) + from_glib_none(gst_gl_sys::gst_glsl_stage_new( + context.as_ref().to_glib_none().0, + type_, + )) } } pub fn new_default_fragment>(context: &P) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_glsl_stage_new_default_fragment(context.as_ref().to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_glsl_stage_new_default_fragment( + context.as_ref().to_glib_none().0, + )) } } pub fn new_default_vertex>(context: &P) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_glsl_stage_new_default_vertex(context.as_ref().to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_glsl_stage_new_default_vertex( + context.as_ref().to_glib_none().0, + )) } } - pub fn new_with_string>(context: &P, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &str) -> GLSLStage { + pub fn new_with_string>( + context: &P, + type_: u32, + version: GLSLVersion, + profile: GLSLProfile, + str: &str, + ) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(gst_gl_sys::gst_glsl_stage_new_with_string(context.as_ref().to_glib_none().0, type_, version.to_glib(), profile.to_glib(), str.to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_glsl_stage_new_with_string( + context.as_ref().to_glib_none().0, + type_, + version.to_glib(), + profile.to_glib(), + str.to_glib_none().0, + )) } } - pub fn new_with_strings>(context: &P, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &[&str]) -> GLSLStage { + pub fn new_with_strings>( + context: &P, + type_: u32, + version: GLSLVersion, + profile: GLSLProfile, + str: &[&str], + ) -> GLSLStage { skip_assert_initialized!(); let n_strings = str.len() as i32; unsafe { - from_glib_none(gst_gl_sys::gst_glsl_stage_new_with_strings(context.as_ref().to_glib_none().0, type_, version.to_glib(), profile.to_glib(), n_strings, str.to_glib_none().0)) + from_glib_none(gst_gl_sys::gst_glsl_stage_new_with_strings( + context.as_ref().to_glib_none().0, + type_, + version.to_glib(), + profile.to_glib(), + n_strings, + str.to_glib_none().0, + )) } } @@ -63,38 +95,56 @@ impl GLSLStage { unsafe { let mut error = ptr::null_mut(); let _ = gst_gl_sys::gst_glsl_stage_compile(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } pub fn get_handle(&self) -> u32 { - unsafe { - gst_gl_sys::gst_glsl_stage_get_handle(self.to_glib_none().0) - } + unsafe { gst_gl_sys::gst_glsl_stage_get_handle(self.to_glib_none().0) } } pub fn get_profile(&self) -> GLSLProfile { unsafe { - from_glib(gst_gl_sys::gst_glsl_stage_get_profile(self.to_glib_none().0)) + from_glib(gst_gl_sys::gst_glsl_stage_get_profile( + self.to_glib_none().0, + )) } } pub fn get_shader_type(&self) -> u32 { - unsafe { - gst_gl_sys::gst_glsl_stage_get_shader_type(self.to_glib_none().0) - } + unsafe { gst_gl_sys::gst_glsl_stage_get_shader_type(self.to_glib_none().0) } } pub fn get_version(&self) -> GLSLVersion { unsafe { - from_glib(gst_gl_sys::gst_glsl_stage_get_version(self.to_glib_none().0)) + from_glib(gst_gl_sys::gst_glsl_stage_get_version( + self.to_glib_none().0, + )) } } - pub fn set_strings(&self, version: GLSLVersion, profile: GLSLProfile, str: &[&str]) -> Result<(), glib::error::BoolError> { + pub fn set_strings( + &self, + version: GLSLVersion, + profile: GLSLProfile, + str: &[&str], + ) -> Result<(), glib::error::BoolError> { let n_strings = str.len() as i32; unsafe { - glib_result_from_gboolean!(gst_gl_sys::gst_glsl_stage_set_strings(self.to_glib_none().0, version.to_glib(), profile.to_glib(), n_strings, str.to_glib_none().0), "Failed to attach stage to set strings") + glib_result_from_gboolean!( + gst_gl_sys::gst_glsl_stage_set_strings( + self.to_glib_none().0, + version.to_glib(), + profile.to_glib(), + n_strings, + str.to_glib_none().0 + ), + "Failed to attach stage to set strings" + ) } } } diff --git a/gstreamer-gl/src/auto/mod.rs b/gstreamer-gl/src/auto/mod.rs index 0251a6d07..80861807a 100644 --- a/gstreamer-gl/src/auto/mod.rs +++ b/gstreamer-gl/src/auto/mod.rs @@ -5,20 +5,20 @@ #[cfg(any(feature = "v1_16", feature = "dox"))] mod gl_base_filter; #[cfg(any(feature = "v1_16", feature = "dox"))] -pub use self::gl_base_filter::{GLBaseFilter, GLBaseFilterClass, NONE_GL_BASE_FILTER}; -#[cfg(any(feature = "v1_16", feature = "dox"))] pub use self::gl_base_filter::GLBaseFilterExt; +#[cfg(any(feature = "v1_16", feature = "dox"))] +pub use self::gl_base_filter::{GLBaseFilter, GLBaseFilterClass, NONE_GL_BASE_FILTER}; mod gl_color_convert; pub use self::gl_color_convert::{GLColorConvert, GLColorConvertClass}; mod gl_context; -pub use self::gl_context::{GLContext, GLContextClass, NONE_GL_CONTEXT}; pub use self::gl_context::GLContextExt; +pub use self::gl_context::{GLContext, GLContextClass, NONE_GL_CONTEXT}; mod gl_display; -pub use self::gl_display::{GLDisplay, GLDisplayClass, NONE_GL_DISPLAY}; pub use self::gl_display::GLDisplayExt; +pub use self::gl_display::{GLDisplay, GLDisplayClass, NONE_GL_DISPLAY}; #[cfg(any(feature = "egl", feature = "dox"))] mod gl_display_egl; @@ -36,8 +36,8 @@ mod gl_display_x11; pub use self::gl_display_x11::{GLDisplayX11, GLDisplayX11Class}; mod gl_framebuffer; -pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER}; pub use self::gl_framebuffer::GLFramebufferExt; +pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER}; mod gl_overlay_compositor; pub use self::gl_overlay_compositor::{GLOverlayCompositor, GLOverlayCompositorClass}; @@ -55,8 +55,8 @@ mod gl_view_convert; pub use self::gl_view_convert::{GLViewConvert, GLViewConvertClass}; mod gl_window; -pub use self::gl_window::{GLWindow, GLWindowClass, NONE_GL_WINDOW}; pub use self::gl_window::GLWindowExt; +pub use self::gl_window::{GLWindow, GLWindowClass, NONE_GL_WINDOW}; mod enums; pub use self::enums::GLContextError; @@ -70,10 +70,10 @@ pub use self::enums::GLUploadReturn; pub use self::enums::GLWindowError; mod flags; -pub use self::flags::GLAPI; pub use self::flags::GLDisplayType; pub use self::flags::GLPlatform; pub use self::flags::GLSLProfile; +pub use self::flags::GLAPI; #[doc(hidden)] pub mod traits { diff --git a/gstreamer-gl/src/lib.rs b/gstreamer-gl/src/lib.rs index 5ef8ef8f1..5a0c80a7d 100644 --- a/gstreamer-gl/src/lib.rs +++ b/gstreamer-gl/src/lib.rs @@ -40,7 +40,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-net/src/auto/mod.rs b/gstreamer-net/src/auto/mod.rs index 55d27d11e..e43742da4 100644 --- a/gstreamer-net/src/auto/mod.rs +++ b/gstreamer-net/src/auto/mod.rs @@ -15,5 +15,4 @@ mod ptp_clock; pub use self::ptp_clock::{PtpClock, PtpClockClass}; #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-net/src/auto/net_client_clock.rs b/gstreamer-net/src/auto/net_client_clock.rs index f133226f3..aef73f47b 100644 --- a/gstreamer-net/src/auto/net_client_clock.rs +++ b/gstreamer-net/src/auto/net_client_clock.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -28,21 +28,33 @@ impl NetClientClock { pub fn get_property_address(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"address\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_address(&self, address: Option<&str>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"address\0".as_ptr() as *const _, Value::from(address).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"address\0".as_ptr() as *const _, + Value::from(address).to_glib_none().0, + ); } } pub fn get_property_base_time(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"base-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"base-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -50,21 +62,33 @@ impl NetClientClock { pub fn get_property_bus(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"bus\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"bus\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_bus(&self, bus: Option<&gst::Bus>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"bus\0".as_ptr() as *const _, Value::from(bus).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"bus\0".as_ptr() as *const _, + Value::from(bus).to_glib_none().0, + ); } } pub fn get_property_internal_clock(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"internal-clock\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -72,140 +96,271 @@ impl NetClientClock { pub fn get_property_minimum_update_interval(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"minimum-update-interval\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"minimum-update-interval\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_minimum_update_interval(&self, minimum_update_interval: u64) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"minimum-update-interval\0".as_ptr() as *const _, Value::from(&minimum_update_interval).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"minimum-update-interval\0".as_ptr() as *const _, + Value::from(&minimum_update_interval).to_glib_none().0, + ); } } pub fn get_property_port(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"port\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_port(&self, port: i32) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"port\0".as_ptr() as *const _, Value::from(&port).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"port\0".as_ptr() as *const _, + Value::from(&port).to_glib_none().0, + ); } } pub fn get_property_qos_dscp(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"qos-dscp\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_qos_dscp(&self, qos_dscp: i32) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"qos-dscp\0".as_ptr() as *const _, + Value::from(&qos_dscp).to_glib_none().0, + ); } } pub fn get_property_round_trip_limit(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"round-trip-limit\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"round-trip-limit\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_round_trip_limit(&self, round_trip_limit: u64) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"round-trip-limit\0".as_ptr() as *const _, Value::from(&round_trip_limit).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"round-trip-limit\0".as_ptr() as *const _, + Value::from(&round_trip_limit).to_glib_none().0, + ); } } - pub fn connect_property_address_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_address_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_address_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_address_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _, - Some(transmute(notify_address_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::address\0".as_ptr() as *const _, + Some(transmute(notify_address_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_bus_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_bus_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_bus_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_bus_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::bus\0".as_ptr() as *const _, - Some(transmute(notify_bus_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::bus\0".as_ptr() as *const _, + Some(transmute(notify_bus_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_internal_clock_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_internal_clock_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_internal_clock_notify< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_internal_clock_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _, - Some(transmute(notify_internal_clock_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::internal-clock\0".as_ptr() as *const _, + Some(transmute(notify_internal_clock_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_minimum_update_interval_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_minimum_update_interval_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_minimum_update_interval_notify< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_minimum_update_interval_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::minimum-update-interval\0".as_ptr() as *const _, - Some(transmute(notify_minimum_update_interval_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::minimum-update-interval\0".as_ptr() as *const _, + Some(transmute( + notify_minimum_update_interval_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_port_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_port_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_port_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_port_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::port\0".as_ptr() as *const _, - Some(transmute(notify_port_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::port\0".as_ptr() as *const _, + Some(transmute(notify_port_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_qos_dscp_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_qos_dscp_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_qos_dscp_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _, - Some(transmute(notify_qos_dscp_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::qos-dscp\0".as_ptr() as *const _, + Some(transmute(notify_qos_dscp_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_round_trip_limit_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_round_trip_limit_trampoline(this: *mut gst_net_sys::GstNetClientClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_round_trip_limit_notify< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_round_trip_limit_trampoline< + F: Fn(&NetClientClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetClientClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::round-trip-limit\0".as_ptr() as *const _, - Some(transmute(notify_round_trip_limit_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::round-trip-limit\0".as_ptr() as *const _, + Some(transmute(notify_round_trip_limit_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-net/src/auto/net_time_provider.rs b/gstreamer-net/src/auto/net_time_provider.rs index 7a2480311..a240dc0c6 100644 --- a/gstreamer-net/src/auto/net_time_provider.rs +++ b/gstreamer-net/src/auto/net_time_provider.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -28,21 +28,33 @@ impl NetTimeProvider { pub fn get_property_active(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"active\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_active(&self, active: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"active\0".as_ptr() as *const _, Value::from(&active).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"active\0".as_ptr() as *const _, + Value::from(&active).to_glib_none().0, + ); } } pub fn get_property_address(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"address\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -50,7 +62,11 @@ impl NetTimeProvider { pub fn get_property_clock(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"clock\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -58,7 +74,11 @@ impl NetTimeProvider { pub fn get_property_port(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"port\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -66,38 +86,72 @@ impl NetTimeProvider { pub fn get_property_qos_dscp(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"qos-dscp\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_qos_dscp(&self, qos_dscp: i32) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"qos-dscp\0".as_ptr() as *const _, + Value::from(&qos_dscp).to_glib_none().0, + ); } } - pub fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_active_trampoline(this: *mut gst_net_sys::GstNetTimeProvider, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_active_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_active_trampoline< + F: Fn(&NetTimeProvider) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetTimeProvider, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _, - Some(transmute(notify_active_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::active\0".as_ptr() as *const _, + Some(transmute(notify_active_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_qos_dscp_trampoline(this: *mut gst_net_sys::GstNetTimeProvider, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_qos_dscp_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_qos_dscp_trampoline< + F: Fn(&NetTimeProvider) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstNetTimeProvider, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _, - Some(transmute(notify_qos_dscp_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::qos-dscp\0".as_ptr() as *const _, + Some(transmute(notify_qos_dscp_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-net/src/auto/ntp_clock.rs b/gstreamer-net/src/auto/ntp_clock.rs index cf3dcadea..93e4f975a 100644 --- a/gstreamer-net/src/auto/ntp_clock.rs +++ b/gstreamer-net/src/auto/ntp_clock.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use NetClientClock; use glib::translate::*; use gst; use gst_net_sys; +use NetClientClock; glib_wrapper! { pub struct NtpClock(Object) @extends NetClientClock, gst::Clock, gst::Object; diff --git a/gstreamer-net/src/auto/ptp_clock.rs b/gstreamer-net/src/auto/ptp_clock.rs index 5f697ff93..2409ca0bf 100644 --- a/gstreamer-net/src/auto/ptp_clock.rs +++ b/gstreamer-net/src/auto/ptp_clock.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -27,7 +27,11 @@ impl PtpClock { pub fn get_property_domain(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"domain\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"domain\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -35,7 +39,11 @@ impl PtpClock { pub fn get_property_grandmaster_clock_id(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"grandmaster-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"grandmaster-clock-id\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -43,7 +51,11 @@ impl PtpClock { pub fn get_property_internal_clock(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"internal-clock\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -51,44 +63,91 @@ impl PtpClock { pub fn get_property_master_clock_id(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"master-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"master-clock-id\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn connect_property_grandmaster_clock_id_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_grandmaster_clock_id_trampoline(this: *mut gst_net_sys::GstPtpClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_grandmaster_clock_id_notify< + F: Fn(&PtpClock) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_grandmaster_clock_id_trampoline< + F: Fn(&PtpClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstPtpClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::grandmaster-clock-id\0".as_ptr() as *const _, - Some(transmute(notify_grandmaster_clock_id_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::grandmaster-clock-id\0".as_ptr() as *const _, + Some(transmute( + notify_grandmaster_clock_id_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_internal_clock_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_internal_clock_trampoline(this: *mut gst_net_sys::GstPtpClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_internal_clock_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_internal_clock_trampoline< + F: Fn(&PtpClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstPtpClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _, - Some(transmute(notify_internal_clock_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::internal-clock\0".as_ptr() as *const _, + Some(transmute(notify_internal_clock_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_master_clock_id_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_master_clock_id_trampoline(this: *mut gst_net_sys::GstPtpClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_master_clock_id_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_master_clock_id_trampoline< + F: Fn(&PtpClock) + Send + Sync + 'static, + >( + this: *mut gst_net_sys::GstPtpClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::master-clock-id\0".as_ptr() as *const _, - Some(transmute(notify_master_clock_id_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::master-clock-id\0".as_ptr() as *const _, + Some(transmute(notify_master_clock_id_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-net/src/lib.rs b/gstreamer-net/src/lib.rs index 07e28f049..34d488297 100644 --- a/gstreamer-net/src/lib.rs +++ b/gstreamer-net/src/lib.rs @@ -29,7 +29,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; mod net_client_clock; diff --git a/gstreamer-pbutils/src/auto/discoverer.rs b/gstreamer-pbutils/src/auto/discoverer.rs index ce6f53cb6..9d082dbde 100644 --- a/gstreamer-pbutils/src/auto/discoverer.rs +++ b/gstreamer-pbutils/src/auto/discoverer.rs @@ -2,17 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererInfo; -use Error; use glib; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::StaticType; #[cfg(any(feature = "v1_16", feature = "dox"))] use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; #[cfg(any(feature = "v1_16", feature = "dox"))] use gobject_sys; @@ -22,6 +20,8 @@ use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; +use DiscovererInfo; +use Error; glib_wrapper! { pub struct Discoverer(Object); @@ -37,21 +37,39 @@ impl Discoverer { unsafe { let mut error = ptr::null_mut(); let ret = gst_pbutils_sys::gst_discoverer_new(timeout.to_glib(), &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } pub fn discover_uri(&self, uri: &str) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = gst_pbutils_sys::gst_discoverer_discover_uri(self.to_glib_none().0, uri.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_pbutils_sys::gst_discoverer_discover_uri( + self.to_glib_none().0, + uri.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } pub fn discover_uri_async(&self, uri: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_pbutils_sys::gst_discoverer_discover_uri_async(self.to_glib_none().0, uri.to_glib_none().0), "Failed to add URI to list of discovers") + glib_result_from_gboolean!( + gst_pbutils_sys::gst_discoverer_discover_uri_async( + self.to_glib_none().0, + uri.to_glib_none().0 + ), + "Failed to add URI to list of discovers" + ) } } @@ -71,7 +89,11 @@ impl Discoverer { pub fn get_property_use_cache(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"use-cache\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"use-cache\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -79,68 +101,138 @@ impl Discoverer { #[cfg(any(feature = "v1_16", feature = "dox"))] pub fn set_property_use_cache(&self, use_cache: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"use-cache\0".as_ptr() as *const _, Value::from(&use_cache).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"use-cache\0".as_ptr() as *const _, + Value::from(&use_cache).to_glib_none().0, + ); } } - pub fn connect_discovered) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - 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) { + pub fn connect_discovered< + F: Fn(&Discoverer, &DiscovererInfo, Option<&Error>) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn discovered_trampoline< + F: Fn(&Discoverer, &DiscovererInfo, Option<&Error>) + 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), Option::::from_glib_borrow(error).as_ref()) + f( + &from_glib_borrow(this), + &from_glib_borrow(info), + Option::::from_glib_borrow(error).as_ref(), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"discovered\0".as_ptr() as *const _, - Some(transmute(discovered_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"discovered\0".as_ptr() as *const _, + Some(transmute(discovered_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_finished(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn finished_trampoline(this: *mut gst_pbutils_sys::GstDiscoverer, f: glib_sys::gpointer) { + pub fn connect_finished( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn finished_trampoline( + this: *mut gst_pbutils_sys::GstDiscoverer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, - Some(transmute(finished_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"finished\0".as_ptr() as *const _, + Some(transmute(finished_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_source_setup(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn source_setup_trampoline(this: *mut gst_pbutils_sys::GstDiscoverer, source: *mut gst_sys::GstElement, f: glib_sys::gpointer) { + pub fn connect_source_setup( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn source_setup_trampoline< + F: Fn(&Discoverer, &gst::Element) + Send + Sync + 'static, + >( + this: *mut gst_pbutils_sys::GstDiscoverer, + source: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(source)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"source-setup\0".as_ptr() as *const _, - Some(transmute(source_setup_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"source-setup\0".as_ptr() as *const _, + Some(transmute(source_setup_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_starting(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn starting_trampoline(this: *mut gst_pbutils_sys::GstDiscoverer, f: glib_sys::gpointer) { + pub fn connect_starting( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn starting_trampoline( + this: *mut gst_pbutils_sys::GstDiscoverer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"starting\0".as_ptr() as *const _, - Some(transmute(starting_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"starting\0".as_ptr() as *const _, + Some(transmute(starting_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn connect_property_use_cache_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_use_cache_trampoline(this: *mut gst_pbutils_sys::GstDiscoverer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_use_cache_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_use_cache_trampoline< + F: Fn(&Discoverer) + Send + Sync + 'static, + >( + this: *mut gst_pbutils_sys::GstDiscoverer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::use-cache\0".as_ptr() as *const _, - Some(transmute(notify_use_cache_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::use-cache\0".as_ptr() as *const _, + Some(transmute(notify_use_cache_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_audio_info.rs b/gstreamer-pbutils/src/auto/discoverer_audio_info.rs index afc37298f..54a6ee127 100644 --- a/gstreamer-pbutils/src/auto/discoverer_audio_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_audio_info.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererStreamInfo; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_pbutils_sys; +use DiscovererStreamInfo; glib_wrapper! { pub struct DiscovererAudioInfo(Object) @extends DiscovererStreamInfo; @@ -17,9 +17,7 @@ glib_wrapper! { impl DiscovererAudioInfo { pub fn get_bitrate(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_audio_info_get_bitrate(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_audio_info_get_bitrate(self.to_glib_none().0) } } #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -30,33 +28,27 @@ impl DiscovererAudioInfo { } pub fn get_channels(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_audio_info_get_channels(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_audio_info_get_channels(self.to_glib_none().0) } } pub fn get_depth(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_audio_info_get_depth(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_audio_info_get_depth(self.to_glib_none().0) } } pub fn get_language(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_audio_info_get_language(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_audio_info_get_language( + self.to_glib_none().0, + )) } } pub fn get_max_bitrate(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_audio_info_get_max_bitrate(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_audio_info_get_max_bitrate(self.to_glib_none().0) } } pub fn get_sample_rate(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_audio_info_get_sample_rate(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_audio_info_get_sample_rate(self.to_glib_none().0) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_container_info.rs b/gstreamer-pbutils/src/auto/discoverer_container_info.rs index ca930b677..4288f7d3a 100644 --- a/gstreamer-pbutils/src/auto/discoverer_container_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_container_info.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererStreamInfo; use glib::translate::*; use gst_pbutils_sys; +use DiscovererStreamInfo; glib_wrapper! { pub struct DiscovererContainerInfo(Object) @extends DiscovererStreamInfo; @@ -17,7 +17,9 @@ glib_wrapper! { impl DiscovererContainerInfo { pub fn get_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_container_info_get_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_container_info_get_streams(self.to_glib_none().0), + ) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_info.rs b/gstreamer-pbutils/src/auto/discoverer_info.rs index 664f8f3ab..cbfcfd989 100644 --- a/gstreamer-pbutils/src/auto/discoverer_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_info.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::translate::*; +use glib::GString; +use gst; +use gst_pbutils_sys; use DiscovererResult; use DiscovererSerializeFlags; use DiscovererStreamInfo; -use glib; -use glib::GString; -use glib::translate::*; -use gst; -use gst_pbutils_sys; glib_wrapper! { pub struct DiscovererInfo(Object); @@ -22,117 +22,159 @@ glib_wrapper! { impl DiscovererInfo { pub fn copy(&self) -> DiscovererInfo { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_info_copy(self.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_info_copy( + self.to_glib_none().0, + )) } } pub fn get_audio_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_audio_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_info_get_audio_streams(self.to_glib_none().0), + ) } } pub fn get_container_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_container_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_info_get_container_streams(self.to_glib_none().0), + ) } } pub fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_info_get_duration(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_info_get_duration( + self.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_live(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_info_get_live(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_info_get_live( + self.to_glib_none().0, + )) } } pub fn get_misc(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_misc(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_misc( + self.to_glib_none().0, + )) } } pub fn get_missing_elements_installer_details(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_missing_elements_installer_details(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_pbutils_sys::gst_discoverer_info_get_missing_elements_installer_details( + self.to_glib_none().0, + ), + ) } } pub fn get_result(&self) -> DiscovererResult { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_info_get_result(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_info_get_result( + self.to_glib_none().0, + )) } } pub fn get_seekable(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_info_get_seekable(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_info_get_seekable( + self.to_glib_none().0, + )) } } pub fn get_stream_info(&self) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_stream_info(self.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_stream_info( + self.to_glib_none().0, + )) } } pub fn get_stream_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_stream_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_info_get_stream_list(self.to_glib_none().0), + ) } } pub fn get_streams(&self, streamtype: glib::types::Type) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_streams(self.to_glib_none().0, streamtype.to_glib())) + FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_streams( + self.to_glib_none().0, + streamtype.to_glib(), + )) } } pub fn get_subtitle_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_subtitle_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_info_get_subtitle_streams(self.to_glib_none().0), + ) } } pub fn get_tags(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_tags(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_tags( + self.to_glib_none().0, + )) } } pub fn get_toc(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_toc(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_toc( + self.to_glib_none().0, + )) } } pub fn get_uri(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_uri(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_info_get_uri( + self.to_glib_none().0, + )) } } pub fn get_video_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_discoverer_info_get_video_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_discoverer_info_get_video_streams(self.to_glib_none().0), + ) } } pub fn to_variant(&self, flags: DiscovererSerializeFlags) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_info_to_variant(self.to_glib_none().0, flags.to_glib())) + from_glib_full(gst_pbutils_sys::gst_discoverer_info_to_variant( + self.to_glib_none().0, + flags.to_glib(), + )) } } pub fn from_variant(variant: &glib::Variant) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_info_from_variant(variant.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_info_from_variant( + variant.to_glib_none().0, + )) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_stream_info.rs b/gstreamer-pbutils/src/auto/discoverer_stream_info.rs index 10038f14e..bb7bbd0aa 100644 --- a/gstreamer-pbutils/src/auto/discoverer_stream_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_stream_info.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst; use gst_pbutils_sys; @@ -42,49 +42,67 @@ pub trait DiscovererStreamInfoExt: 'static { impl> DiscovererStreamInfoExt for O { fn get_caps(&self) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_misc(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_misc(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_misc( + self.as_ref().to_glib_none().0, + )) } } fn get_next(&self) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_next(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_next( + self.as_ref().to_glib_none().0, + )) } } fn get_previous(&self) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_previous(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_discoverer_stream_info_get_previous( + self.as_ref().to_glib_none().0, + )) } } fn get_stream_id(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_stream_id(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_stream_id( + self.as_ref().to_glib_none().0, + )) } } fn get_stream_type_nick(&self) -> GString { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_stream_type_nick(self.as_ref().to_glib_none().0)) + from_glib_none( + gst_pbutils_sys::gst_discoverer_stream_info_get_stream_type_nick( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_tags(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_tags(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_tags( + self.as_ref().to_glib_none().0, + )) } } fn get_toc(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_toc(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_stream_info_get_toc( + self.as_ref().to_glib_none().0, + )) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs b/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs index 95aae8a02..7cef35fab 100644 --- a/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererStreamInfo; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_pbutils_sys; +use DiscovererStreamInfo; glib_wrapper! { pub struct DiscovererSubtitleInfo(Object) @extends DiscovererStreamInfo; @@ -18,7 +18,9 @@ glib_wrapper! { impl DiscovererSubtitleInfo { pub fn get_language(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_discoverer_subtitle_info_get_language(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_discoverer_subtitle_info_get_language( + self.to_glib_none().0, + )) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_video_info.rs b/gstreamer-pbutils/src/auto/discoverer_video_info.rs index 7e763ddda..045ccd424 100644 --- a/gstreamer-pbutils/src/auto/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_video_info.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererStreamInfo; use glib::translate::*; use gst_pbutils_sys; +use DiscovererStreamInfo; glib_wrapper! { pub struct DiscovererVideoInfo(Object) @extends DiscovererStreamInfo; @@ -16,44 +16,38 @@ glib_wrapper! { impl DiscovererVideoInfo { pub fn get_bitrate(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_video_info_get_bitrate(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_video_info_get_bitrate(self.to_glib_none().0) } } pub fn get_depth(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_video_info_get_depth(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_video_info_get_depth(self.to_glib_none().0) } } pub fn get_height(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_video_info_get_height(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_video_info_get_height(self.to_glib_none().0) } } pub fn get_max_bitrate(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_video_info_get_max_bitrate(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_video_info_get_max_bitrate(self.to_glib_none().0) } } pub fn get_width(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_discoverer_video_info_get_width(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_discoverer_video_info_get_width(self.to_glib_none().0) } } pub fn is_image(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_video_info_is_image(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_video_info_is_image( + self.to_glib_none().0, + )) } } pub fn is_interlaced(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_discoverer_video_info_is_interlaced(self.to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_discoverer_video_info_is_interlaced( + self.to_glib_none().0, + )) } } } diff --git a/gstreamer-pbutils/src/auto/encoding_audio_profile.rs b/gstreamer-pbutils/src/auto/encoding_audio_profile.rs index 4df7a1917..6a5dc933b 100644 --- a/gstreamer-pbutils/src/auto/encoding_audio_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_audio_profile.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use EncodingProfile; use glib::translate::*; use gst_pbutils_sys; +use EncodingProfile; glib_wrapper! { pub struct EncodingAudioProfile(Object) @extends EncodingProfile; diff --git a/gstreamer-pbutils/src/auto/encoding_container_profile.rs b/gstreamer-pbutils/src/auto/encoding_container_profile.rs index e202edcd6..e547143ce 100644 --- a/gstreamer-pbutils/src/auto/encoding_container_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_container_profile.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use EncodingProfile; use glib::object::IsA; use glib::translate::*; use gst_pbutils_sys; +use EncodingProfile; glib_wrapper! { pub struct EncodingContainerProfile(Object) @extends EncodingProfile; @@ -18,13 +18,20 @@ glib_wrapper! { impl EncodingContainerProfile { pub fn contains_profile>(&self, profile: &P) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_encoding_container_profile_contains_profile(self.to_glib_none().0, profile.as_ref().to_glib_none().0)) + from_glib( + gst_pbutils_sys::gst_encoding_container_profile_contains_profile( + self.to_glib_none().0, + profile.as_ref().to_glib_none().0, + ), + ) } } pub fn get_profiles(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_pbutils_sys::gst_encoding_container_profile_get_profiles(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_pbutils_sys::gst_encoding_container_profile_get_profiles(self.to_glib_none().0), + ) } } } diff --git a/gstreamer-pbutils/src/auto/encoding_profile.rs b/gstreamer-pbutils/src/auto/encoding_profile.rs index 1e765c8b6..26abc86a3 100644 --- a/gstreamer-pbutils/src/auto/encoding_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_profile.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use DiscovererInfo; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst; use gst_pbutils_sys; +use DiscovererInfo; glib_wrapper! { pub struct EncodingProfile(Object); @@ -18,17 +18,27 @@ glib_wrapper! { } impl EncodingProfile { - pub fn find(targetname: &str, profilename: Option<&str>, category: Option<&str>) -> Option { + pub fn find( + targetname: &str, + profilename: Option<&str>, + category: Option<&str>, + ) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_find(targetname.to_glib_none().0, profilename.to_glib_none().0, category.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_find( + targetname.to_glib_none().0, + profilename.to_glib_none().0, + category.to_glib_none().0, + )) } } pub fn from_discoverer(info: &DiscovererInfo) -> Option { skip_assert_initialized!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_from_discoverer(info.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_from_discoverer( + info.to_glib_none().0, + )) } } } @@ -73,43 +83,59 @@ impl> EncodingProfileExt for O { #[cfg(any(feature = "v1_12", feature = "dox"))] fn copy(&self) -> EncodingProfile { unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_copy(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_copy( + self.as_ref().to_glib_none().0, + )) } } fn get_allow_dynamic_output(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_encoding_profile_get_allow_dynamic_output(self.as_ref().to_glib_none().0)) + from_glib( + gst_pbutils_sys::gst_encoding_profile_get_allow_dynamic_output( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_description(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_description(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_description( + self.as_ref().to_glib_none().0, + )) } } fn get_file_extension(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_file_extension(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_file_extension( + self.as_ref().to_glib_none().0, + )) } } fn get_format(&self) -> gst::Caps { unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_format(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_format( + self.as_ref().to_glib_none().0, + )) } } fn get_input_caps(&self) -> gst::Caps { unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_input_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_input_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_name(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_name(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_name( + self.as_ref().to_glib_none().0, + )) } } @@ -121,37 +147,50 @@ impl> EncodingProfileExt for O { fn get_preset(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_preset(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_preset( + self.as_ref().to_glib_none().0, + )) } } fn get_preset_name(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_preset_name(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_preset_name( + self.as_ref().to_glib_none().0, + )) } } fn get_restriction(&self) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_restriction(self.as_ref().to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_restriction( + self.as_ref().to_glib_none().0, + )) } } fn get_type_nick(&self) -> Option { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_type_nick(self.as_ref().to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_type_nick( + self.as_ref().to_glib_none().0, + )) } } fn is_enabled(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_encoding_profile_is_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_encoding_profile_is_enabled( + self.as_ref().to_glib_none().0, + )) } } fn is_equal>(&self, b: &P) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_encoding_profile_is_equal(self.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0)) + from_glib(gst_pbutils_sys::gst_encoding_profile_is_equal( + self.as_ref().to_glib_none().0, + b.as_ref().to_glib_none().0, + )) } } } diff --git a/gstreamer-pbutils/src/auto/encoding_target.rs b/gstreamer-pbutils/src/auto/encoding_target.rs index e38931744..418454649 100644 --- a/gstreamer-pbutils/src/auto/encoding_target.rs +++ b/gstreamer-pbutils/src/auto/encoding_target.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use EncodingProfile; -use Error; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_pbutils_sys; use std; use std::ptr; +use EncodingProfile; +use Error; glib_wrapper! { pub struct EncodingTarget(Object); @@ -19,40 +19,61 @@ glib_wrapper! { } impl EncodingTarget { - pub fn new(name: &str, category: &str, description: &str, profiles: &[EncodingProfile]) -> EncodingTarget { + pub fn new( + name: &str, + category: &str, + description: &str, + profiles: &[EncodingProfile], + ) -> EncodingTarget { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_target_new(name.to_glib_none().0, category.to_glib_none().0, description.to_glib_none().0, profiles.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_target_new( + name.to_glib_none().0, + category.to_glib_none().0, + description.to_glib_none().0, + profiles.to_glib_none().0, + )) } } pub fn get_category(&self) -> GString { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_target_get_category(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_target_get_category( + self.to_glib_none().0, + )) } } pub fn get_description(&self) -> GString { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_target_get_description(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_target_get_description( + self.to_glib_none().0, + )) } } pub fn get_name(&self) -> GString { unsafe { - from_glib_none(gst_pbutils_sys::gst_encoding_target_get_name(self.to_glib_none().0)) + from_glib_none(gst_pbutils_sys::gst_encoding_target_get_name( + self.to_glib_none().0, + )) } } pub fn get_profile(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_target_get_profile(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_encoding_target_get_profile( + self.to_glib_none().0, + name.to_glib_none().0, + )) } } pub fn get_profiles(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_pbutils_sys::gst_encoding_target_get_profiles(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_pbutils_sys::gst_encoding_target_get_profiles( + self.to_glib_none().0, + )) } } @@ -60,15 +81,27 @@ impl EncodingTarget { unsafe { let mut error = ptr::null_mut(); let _ = gst_pbutils_sys::gst_encoding_target_save(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } pub fn save_to_file>(&self, filepath: P) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = gst_pbutils_sys::gst_encoding_target_save_to_file(self.to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = gst_pbutils_sys::gst_encoding_target_save_to_file( + self.to_glib_none().0, + filepath.as_ref().to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -76,8 +109,16 @@ impl EncodingTarget { assert_initialized_main_thread!(); unsafe { let mut error = ptr::null_mut(); - let ret = gst_pbutils_sys::gst_encoding_target_load(name.to_glib_none().0, category.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_pbutils_sys::gst_encoding_target_load( + name.to_glib_none().0, + category.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -85,8 +126,15 @@ impl EncodingTarget { assert_initialized_main_thread!(); unsafe { let mut error = ptr::null_mut(); - let ret = gst_pbutils_sys::gst_encoding_target_load_from_file(filepath.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_pbutils_sys::gst_encoding_target_load_from_file( + filepath.as_ref().to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/gstreamer-pbutils/src/auto/encoding_video_profile.rs b/gstreamer-pbutils/src/auto/encoding_video_profile.rs index d66c6710f..4cc0076af 100644 --- a/gstreamer-pbutils/src/auto/encoding_video_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_video_profile.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use EncodingProfile; use glib::translate::*; use gst_pbutils_sys; +use EncodingProfile; glib_wrapper! { pub struct EncodingVideoProfile(Object) @extends EncodingProfile; @@ -16,14 +16,16 @@ glib_wrapper! { impl EncodingVideoProfile { pub fn get_pass(&self) -> u32 { - unsafe { - gst_pbutils_sys::gst_encoding_video_profile_get_pass(self.to_glib_none().0) - } + unsafe { gst_pbutils_sys::gst_encoding_video_profile_get_pass(self.to_glib_none().0) } } pub fn get_variableframerate(&self) -> bool { unsafe { - from_glib(gst_pbutils_sys::gst_encoding_video_profile_get_variableframerate(self.to_glib_none().0)) + from_glib( + gst_pbutils_sys::gst_encoding_video_profile_get_variableframerate( + self.to_glib_none().0, + ), + ) } } } diff --git a/gstreamer-pbutils/src/auto/enums.rs b/gstreamer-pbutils/src/auto/enums.rs index 7cd476933..ad1330f2e 100644 --- a/gstreamer-pbutils/src/auto/enums.rs +++ b/gstreamer-pbutils/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_pbutils_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum DiscovererResult { Ok, UriInvalid, @@ -37,7 +36,7 @@ impl ToGlib for DiscovererResult { DiscovererResult::Timeout => gst_pbutils_sys::GST_DISCOVERER_TIMEOUT, DiscovererResult::Busy => gst_pbutils_sys::GST_DISCOVERER_BUSY, DiscovererResult::MissingPlugins => gst_pbutils_sys::GST_DISCOVERER_MISSING_PLUGINS, - DiscovererResult::__Unknown(value) => value + DiscovererResult::__Unknown(value) => value, } } } @@ -81,4 +80,3 @@ impl SetValue for DiscovererResult { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-pbutils/src/auto/flags.rs b/gstreamer-pbutils/src/auto/flags.rs index c29dabf92..a64a9a69c 100644 --- a/gstreamer-pbutils/src/auto/flags.rs +++ b/gstreamer-pbutils/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_pbutils_sys; @@ -62,4 +62,3 @@ impl SetValue for DiscovererSerializeFlags { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-pbutils/src/auto/functions.rs b/gstreamer-pbutils/src/auto/functions.rs index 655d67be1..78ebaa851 100644 --- a/gstreamer-pbutils/src/auto/functions.rs +++ b/gstreamer-pbutils/src/auto/functions.rs @@ -2,45 +2,54 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use EncodingTarget; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_pbutils_sys; use std::mem; - +use EncodingTarget; pub fn encoding_list_all_targets(categoryname: Option<&str>) -> Vec { assert_initialized_main_thread!(); unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_encoding_list_all_targets(categoryname.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_encoding_list_all_targets( + categoryname.to_glib_none().0, + )) } } pub fn encoding_list_available_categories() -> Vec { assert_initialized_main_thread!(); unsafe { - FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_encoding_list_available_categories()) + FromGlibPtrContainer::from_glib_full( + gst_pbutils_sys::gst_encoding_list_available_categories(), + ) } } pub fn pb_utils_get_element_description(factory_name: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_pb_utils_get_element_description(factory_name.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_element_description( + factory_name.to_glib_none().0, + )) } } pub fn pb_utils_get_sink_description(protocol: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_pb_utils_get_sink_description(protocol.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_sink_description( + protocol.to_glib_none().0, + )) } } pub fn pb_utils_get_source_description(protocol: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_pbutils_sys::gst_pb_utils_get_source_description(protocol.to_glib_none().0)) + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_source_description( + protocol.to_glib_none().0, + )) } } @@ -58,7 +67,5 @@ pub fn plugins_base_version() -> (u32, u32, u32, u32) { pub fn plugins_base_version_string() -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_pbutils_sys::gst_plugins_base_version_string()) - } + unsafe { from_glib_full(gst_pbutils_sys::gst_plugins_base_version_string()) } } diff --git a/gstreamer-pbutils/src/auto/mod.rs b/gstreamer-pbutils/src/auto/mod.rs index b1af084b2..40d5fd554 100644 --- a/gstreamer-pbutils/src/auto/mod.rs +++ b/gstreamer-pbutils/src/auto/mod.rs @@ -15,8 +15,10 @@ mod discoverer_info; pub use self::discoverer_info::{DiscovererInfo, DiscovererInfoClass}; mod discoverer_stream_info; -pub use self::discoverer_stream_info::{DiscovererStreamInfo, DiscovererStreamInfoClass, NONE_DISCOVERER_STREAM_INFO}; pub use self::discoverer_stream_info::DiscovererStreamInfoExt; +pub use self::discoverer_stream_info::{ + DiscovererStreamInfo, DiscovererStreamInfoClass, NONE_DISCOVERER_STREAM_INFO, +}; mod discoverer_subtitle_info; pub use self::discoverer_subtitle_info::{DiscovererSubtitleInfo, DiscovererSubtitleInfoClass}; @@ -28,11 +30,13 @@ mod encoding_audio_profile; pub use self::encoding_audio_profile::{EncodingAudioProfile, EncodingAudioProfileClass}; mod encoding_container_profile; -pub use self::encoding_container_profile::{EncodingContainerProfile, EncodingContainerProfileClass}; +pub use self::encoding_container_profile::{ + EncodingContainerProfile, EncodingContainerProfileClass, +}; mod encoding_profile; -pub use self::encoding_profile::{EncodingProfile, EncodingProfileClass, NONE_ENCODING_PROFILE}; pub use self::encoding_profile::EncodingProfileExt; +pub use self::encoding_profile::{EncodingProfile, EncodingProfileClass, NONE_ENCODING_PROFILE}; mod encoding_target; pub use self::encoding_target::{EncodingTarget, EncodingTargetClass}; diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index 1beea741d..f7153bb53 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -43,7 +43,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] -#[rustfmt::skip] mod auto; pub use auto::functions::*; pub use auto::*; diff --git a/gstreamer-player/src/auto/enums.rs b/gstreamer-player/src/auto/enums.rs index 862be8b04..e2e92cc3d 100644 --- a/gstreamer-player/src/auto/enums.rs +++ b/gstreamer-player/src/auto/enums.rs @@ -2,20 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::Quark; -use glib::StaticType; -use glib::Type; use glib::error::ErrorDomain; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::Quark; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_player_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PlayerColorBalanceType { Hue, Brightness, @@ -32,10 +31,14 @@ impl ToGlib for PlayerColorBalanceType { fn to_glib(&self) -> gst_player_sys::GstPlayerColorBalanceType { match *self { PlayerColorBalanceType::Hue => gst_player_sys::GST_PLAYER_COLOR_BALANCE_HUE, - PlayerColorBalanceType::Brightness => gst_player_sys::GST_PLAYER_COLOR_BALANCE_BRIGHTNESS, - PlayerColorBalanceType::Saturation => gst_player_sys::GST_PLAYER_COLOR_BALANCE_SATURATION, + PlayerColorBalanceType::Brightness => { + gst_player_sys::GST_PLAYER_COLOR_BALANCE_BRIGHTNESS + } + PlayerColorBalanceType::Saturation => { + gst_player_sys::GST_PLAYER_COLOR_BALANCE_SATURATION + } PlayerColorBalanceType::Contrast => gst_player_sys::GST_PLAYER_COLOR_BALANCE_CONTRAST, - PlayerColorBalanceType::__Unknown(value) => value + PlayerColorBalanceType::__Unknown(value) => value, } } } @@ -78,8 +81,7 @@ impl SetValue for PlayerColorBalanceType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PlayerError { Failed, #[doc(hidden)] @@ -93,7 +95,7 @@ impl ToGlib for PlayerError { fn to_glib(&self) -> gst_player_sys::GstPlayerError { match *self { PlayerError::Failed => gst_player_sys::GST_PLAYER_ERROR_FAILED, - PlayerError::__Unknown(value) => value + PlayerError::__Unknown(value) => value, } } } @@ -152,8 +154,7 @@ impl SetValue for PlayerError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PlayerSnapshotFormat { RawNative, RawXrgb, @@ -175,7 +176,7 @@ impl ToGlib for PlayerSnapshotFormat { PlayerSnapshotFormat::RawBgrx => gst_player_sys::GST_PLAYER_THUMBNAIL_RAW_BGRx, PlayerSnapshotFormat::Jpg => gst_player_sys::GST_PLAYER_THUMBNAIL_JPG, PlayerSnapshotFormat::Png => gst_player_sys::GST_PLAYER_THUMBNAIL_PNG, - PlayerSnapshotFormat::__Unknown(value) => value + PlayerSnapshotFormat::__Unknown(value) => value, } } } @@ -195,8 +196,7 @@ impl FromGlib for PlayerSnapshotFormat } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PlayerState { Stopped, Buffering, @@ -216,7 +216,7 @@ impl ToGlib for PlayerState { PlayerState::Buffering => gst_player_sys::GST_PLAYER_STATE_BUFFERING, PlayerState::Paused => gst_player_sys::GST_PLAYER_STATE_PAUSED, PlayerState::Playing => gst_player_sys::GST_PLAYER_STATE_PLAYING, - PlayerState::__Unknown(value) => value + PlayerState::__Unknown(value) => value, } } } @@ -258,4 +258,3 @@ impl SetValue for PlayerState { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-player/src/auto/mod.rs b/gstreamer-player/src/auto/mod.rs index 6ae19e41e..e1a1e3c32 100644 --- a/gstreamer-player/src/auto/mod.rs +++ b/gstreamer-player/src/auto/mod.rs @@ -9,18 +9,22 @@ mod player_audio_info; pub use self::player_audio_info::{PlayerAudioInfo, PlayerAudioInfoClass}; mod player_gmain_context_signal_dispatcher; -pub use self::player_gmain_context_signal_dispatcher::{PlayerGMainContextSignalDispatcher, PlayerGMainContextSignalDispatcherClass}; +pub use self::player_gmain_context_signal_dispatcher::{ + PlayerGMainContextSignalDispatcher, PlayerGMainContextSignalDispatcherClass, +}; mod player_media_info; pub use self::player_media_info::{PlayerMediaInfo, PlayerMediaInfoClass}; mod player_signal_dispatcher; -pub use self::player_signal_dispatcher::{PlayerSignalDispatcher, NONE_PLAYER_SIGNAL_DISPATCHER}; pub use self::player_signal_dispatcher::PlayerSignalDispatcherExt; +pub use self::player_signal_dispatcher::{PlayerSignalDispatcher, NONE_PLAYER_SIGNAL_DISPATCHER}; mod player_stream_info; -pub use self::player_stream_info::{PlayerStreamInfo, PlayerStreamInfoClass, NONE_PLAYER_STREAM_INFO}; pub use self::player_stream_info::PlayerStreamInfoExt; +pub use self::player_stream_info::{ + PlayerStreamInfo, PlayerStreamInfoClass, NONE_PLAYER_STREAM_INFO, +}; mod player_subtitle_info; pub use self::player_subtitle_info::{PlayerSubtitleInfo, PlayerSubtitleInfoClass}; @@ -29,11 +33,13 @@ mod player_video_info; pub use self::player_video_info::{PlayerVideoInfo, PlayerVideoInfoClass}; mod player_video_overlay_video_renderer; -pub use self::player_video_overlay_video_renderer::{PlayerVideoOverlayVideoRenderer, PlayerVideoOverlayVideoRendererClass}; +pub use self::player_video_overlay_video_renderer::{ + PlayerVideoOverlayVideoRenderer, PlayerVideoOverlayVideoRendererClass, +}; mod player_video_renderer; -pub use self::player_video_renderer::{PlayerVideoRenderer, NONE_PLAYER_VIDEO_RENDERER}; pub use self::player_video_renderer::PlayerVideoRendererExt; +pub use self::player_video_renderer::{PlayerVideoRenderer, NONE_PLAYER_VIDEO_RENDERER}; mod player_visualization; pub use self::player_visualization::PlayerVisualization; diff --git a/gstreamer-player/src/auto/player.rs b/gstreamer-player/src/auto/player.rs index c69e7d4f4..caf824790 100644 --- a/gstreamer-player/src/auto/player.rs +++ b/gstreamer-player/src/auto/player.rs @@ -2,6 +2,22 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::GString; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_player_sys; +use gst_video; +use libc; +use std::boxed::Box as Box_; +use std::mem::transmute; use Error; use PlayerAudioInfo; use PlayerColorBalanceType; @@ -11,22 +27,6 @@ use PlayerState; use PlayerSubtitleInfo; use PlayerVideoInfo; use PlayerVisualization; -use glib; -use glib::GString; -use glib::StaticType; -use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gobject_sys; -use gst; -use gst_player_sys; -use gst_video; -use libc; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Player(Object) @extends gst::Object; @@ -38,9 +38,7 @@ glib_wrapper! { impl Player { pub fn get_audio_video_offset(&self) -> i64 { - unsafe { - gst_player_sys::gst_player_get_audio_video_offset(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_get_audio_video_offset(self.to_glib_none().0) } } pub fn get_color_balance(&self, type_: PlayerColorBalanceType) -> f64 { @@ -51,110 +49,132 @@ impl Player { pub fn get_current_audio_track(&self) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_current_audio_track(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_current_audio_track( + self.to_glib_none().0, + )) } } pub fn get_current_subtitle_track(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_get_current_subtitle_track(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_get_current_subtitle_track( + self.to_glib_none().0, + )) } } pub fn get_current_video_track(&self) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_current_video_track(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_current_video_track( + self.to_glib_none().0, + )) } } pub fn get_current_visualization(&self) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_current_visualization(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_current_visualization( + self.to_glib_none().0, + )) } } pub fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(gst_player_sys::gst_player_get_duration(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_get_duration( + self.to_glib_none().0, + )) } } pub fn get_media_info(&self) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_media_info(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_media_info( + self.to_glib_none().0, + )) } } pub fn get_multiview_flags(&self) -> gst_video::VideoMultiviewFlags { unsafe { - from_glib(gst_player_sys::gst_player_get_multiview_flags(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_get_multiview_flags( + self.to_glib_none().0, + )) } } pub fn get_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking { unsafe { - from_glib(gst_player_sys::gst_player_get_multiview_mode(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_get_multiview_mode( + self.to_glib_none().0, + )) } } pub fn get_mute(&self) -> bool { - unsafe { - from_glib(gst_player_sys::gst_player_get_mute(self.to_glib_none().0)) - } + unsafe { from_glib(gst_player_sys::gst_player_get_mute(self.to_glib_none().0)) } } pub fn get_pipeline(&self) -> gst::Element { unsafe { - from_glib_full(gst_player_sys::gst_player_get_pipeline(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_pipeline( + self.to_glib_none().0, + )) } } pub fn get_position(&self) -> gst::ClockTime { unsafe { - from_glib(gst_player_sys::gst_player_get_position(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_get_position( + self.to_glib_none().0, + )) } } pub fn get_rate(&self) -> f64 { - unsafe { - gst_player_sys::gst_player_get_rate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_get_rate(self.to_glib_none().0) } } pub fn get_subtitle_uri(&self) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_subtitle_uri(self.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_subtitle_uri( + self.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] pub fn get_subtitle_video_offset(&self) -> i64 { - unsafe { - gst_player_sys::gst_player_get_subtitle_video_offset(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_get_subtitle_video_offset(self.to_glib_none().0) } } pub fn get_uri(&self) -> Option { - unsafe { - from_glib_full(gst_player_sys::gst_player_get_uri(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_player_sys::gst_player_get_uri(self.to_glib_none().0)) } } - pub fn get_video_snapshot(&self, format: PlayerSnapshotFormat, config: Option<&gst::Structure>) -> Option { + pub fn get_video_snapshot( + &self, + format: PlayerSnapshotFormat, + config: Option<&gst::Structure>, + ) -> Option { unsafe { - from_glib_full(gst_player_sys::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.to_glib_none().0)) + from_glib_full(gst_player_sys::gst_player_get_video_snapshot( + self.to_glib_none().0, + format.to_glib(), + config.to_glib_none().0, + )) } } pub fn get_volume(&self) -> f64 { - unsafe { - gst_player_sys::gst_player_get_volume(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_get_volume(self.to_glib_none().0) } } pub fn has_color_balance(&self) -> bool { unsafe { - from_glib(gst_player_sys::gst_player_has_color_balance(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_has_color_balance( + self.to_glib_none().0, + )) } } @@ -178,13 +198,19 @@ impl Player { pub fn set_audio_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_player_sys::gst_player_set_audio_track(self.to_glib_none().0, stream_index), "Failed to set audio track") + glib_result_from_gboolean!( + gst_player_sys::gst_player_set_audio_track(self.to_glib_none().0, stream_index), + "Failed to set audio track" + ) } } pub fn set_audio_track_enabled(&self, enabled: bool) { unsafe { - gst_player_sys::gst_player_set_audio_track_enabled(self.to_glib_none().0, enabled.to_glib()); + gst_player_sys::gst_player_set_audio_track_enabled( + self.to_glib_none().0, + enabled.to_glib(), + ); } } @@ -196,7 +222,11 @@ impl Player { pub fn set_color_balance(&self, type_: PlayerColorBalanceType, value: f64) { unsafe { - gst_player_sys::gst_player_set_color_balance(self.to_glib_none().0, type_.to_glib(), value); + gst_player_sys::gst_player_set_color_balance( + self.to_glib_none().0, + type_.to_glib(), + value, + ); } } @@ -226,19 +256,28 @@ impl Player { pub fn set_subtitle_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_player_sys::gst_player_set_subtitle_track(self.to_glib_none().0, stream_index), "Failed to set subtitle track") + glib_result_from_gboolean!( + gst_player_sys::gst_player_set_subtitle_track(self.to_glib_none().0, stream_index), + "Failed to set subtitle track" + ) } } pub fn set_subtitle_track_enabled(&self, enabled: bool) { unsafe { - gst_player_sys::gst_player_set_subtitle_track_enabled(self.to_glib_none().0, enabled.to_glib()); + gst_player_sys::gst_player_set_subtitle_track_enabled( + self.to_glib_none().0, + enabled.to_glib(), + ); } } pub fn set_subtitle_uri(&self, uri: &str) { unsafe { - gst_player_sys::gst_player_set_subtitle_uri(self.to_glib_none().0, uri.to_glib_none().0); + gst_player_sys::gst_player_set_subtitle_uri( + self.to_glib_none().0, + uri.to_glib_none().0, + ); } } @@ -257,25 +296,40 @@ impl Player { pub fn set_video_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_player_sys::gst_player_set_video_track(self.to_glib_none().0, stream_index), "Failed to set video track") + glib_result_from_gboolean!( + gst_player_sys::gst_player_set_video_track(self.to_glib_none().0, stream_index), + "Failed to set video track" + ) } } pub fn set_video_track_enabled(&self, enabled: bool) { unsafe { - gst_player_sys::gst_player_set_video_track_enabled(self.to_glib_none().0, enabled.to_glib()); + gst_player_sys::gst_player_set_video_track_enabled( + self.to_glib_none().0, + enabled.to_glib(), + ); } } pub fn set_visualization(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_player_sys::gst_player_set_visualization(self.to_glib_none().0, name.to_glib_none().0), "Failed to set visualization") + glib_result_from_gboolean!( + gst_player_sys::gst_player_set_visualization( + self.to_glib_none().0, + name.to_glib_none().0 + ), + "Failed to set visualization" + ) } } pub fn set_visualization_enabled(&self, enabled: bool) { unsafe { - gst_player_sys::gst_player_set_visualization_enabled(self.to_glib_none().0, enabled.to_glib()); + gst_player_sys::gst_player_set_visualization_enabled( + self.to_glib_none().0, + enabled.to_glib(), + ); } } @@ -294,63 +348,102 @@ impl Player { pub fn get_property_suburi(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"suburi\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"suburi\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_suburi(&self, suburi: Option<&str>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"suburi\0".as_ptr() as *const _, Value::from(suburi).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"suburi\0".as_ptr() as *const _, + Value::from(suburi).to_glib_none().0, + ); } } pub fn get_property_video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-multiview-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-multiview-flags\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) { + pub fn set_property_video_multiview_flags( + &self, + video_multiview_flags: gst_video::VideoMultiviewFlags, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-multiview-flags\0".as_ptr() as *const _, Value::from(&video_multiview_flags).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-multiview-flags\0".as_ptr() as *const _, + Value::from(&video_multiview_flags).to_glib_none().0, + ); } } pub fn get_property_video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-multiview-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = Value::from_type( + ::static_type(), + ); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-multiview-mode\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn set_property_video_multiview_mode(&self, video_multiview_mode: gst_video::VideoMultiviewFramePacking) { + pub fn set_property_video_multiview_mode( + &self, + video_multiview_mode: gst_video::VideoMultiviewFramePacking, + ) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-multiview-mode\0".as_ptr() as *const _, Value::from(&video_multiview_mode).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-multiview-mode\0".as_ptr() as *const _, + Value::from(&video_multiview_mode).to_glib_none().0, + ); } } pub fn get_audio_streams(info: &PlayerMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_audio_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_audio_streams( + info.to_glib_none().0, + )) } } pub fn get_subtitle_streams(info: &PlayerMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_subtitle_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_subtitle_streams( + info.to_glib_none().0, + )) } } pub fn get_video_streams(info: &PlayerMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_video_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_get_video_streams( + info.to_glib_none().0, + )) } } @@ -362,315 +455,622 @@ impl Player { } pub fn connect_buffering(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn buffering_trampoline(this: *mut gst_player_sys::GstPlayer, object: libc::c_int, f: glib_sys::gpointer) { + unsafe extern "C" fn buffering_trampoline( + this: *mut gst_player_sys::GstPlayer, + object: libc::c_int, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), object) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"buffering\0".as_ptr() as *const _, - Some(transmute(buffering_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"buffering\0".as_ptr() as *const _, + Some(transmute(buffering_trampoline:: as usize)), + Box_::into_raw(f), + ) } } pub fn connect_end_of_stream(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn end_of_stream_trampoline(this: *mut gst_player_sys::GstPlayer, f: glib_sys::gpointer) { + unsafe extern "C" fn end_of_stream_trampoline( + this: *mut gst_player_sys::GstPlayer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"end-of-stream\0".as_ptr() as *const _, - Some(transmute(end_of_stream_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"end-of-stream\0".as_ptr() as *const _, + Some(transmute(end_of_stream_trampoline:: as usize)), + Box_::into_raw(f), + ) } } pub fn connect_error(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn error_trampoline(this: *mut gst_player_sys::GstPlayer, object: *mut glib_sys::GError, f: glib_sys::gpointer) { + unsafe extern "C" fn error_trampoline( + this: *mut gst_player_sys::GstPlayer, + object: *mut glib_sys::GError, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"error\0".as_ptr() as *const _, - Some(transmute(error_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"error\0".as_ptr() as *const _, + Some(transmute(error_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_media_info_updated(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn media_info_updated_trampoline(this: *mut gst_player_sys::GstPlayer, object: *mut gst_player_sys::GstPlayerMediaInfo, f: glib_sys::gpointer) { + pub fn connect_media_info_updated( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn media_info_updated_trampoline< + F: Fn(&Player, &PlayerMediaInfo) + Send + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + object: *mut gst_player_sys::GstPlayerMediaInfo, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"media-info-updated\0".as_ptr() as *const _, - Some(transmute(media_info_updated_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"media-info-updated\0".as_ptr() as *const _, + Some(transmute(media_info_updated_trampoline:: as usize)), + Box_::into_raw(f), + ) } } pub fn connect_mute_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn mute_changed_trampoline(this: *mut gst_player_sys::GstPlayer, f: glib_sys::gpointer) { + unsafe extern "C" fn mute_changed_trampoline( + this: *mut gst_player_sys::GstPlayer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"mute-changed\0".as_ptr() as *const _, - Some(transmute(mute_changed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"mute-changed\0".as_ptr() as *const _, + Some(transmute(mute_changed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_state_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn state_changed_trampoline(this: *mut gst_player_sys::GstPlayer, object: gst_player_sys::GstPlayerState, f: glib_sys::gpointer) { + pub fn connect_state_changed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn state_changed_trampoline< + F: Fn(&Player, PlayerState) + Send + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + object: gst_player_sys::GstPlayerState, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), from_glib(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"state-changed\0".as_ptr() as *const _, - Some(transmute(state_changed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"state-changed\0".as_ptr() as *const _, + Some(transmute(state_changed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_uri_loaded(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn uri_loaded_trampoline(this: *mut gst_player_sys::GstPlayer, object: *mut libc::c_char, f: glib_sys::gpointer) { + pub fn connect_uri_loaded( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn uri_loaded_trampoline( + this: *mut gst_player_sys::GstPlayer, + object: *mut libc::c_char, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &GString::from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"uri-loaded\0".as_ptr() as *const _, - Some(transmute(uri_loaded_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"uri-loaded\0".as_ptr() as *const _, + Some(transmute(uri_loaded_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_video_dimensions_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn video_dimensions_changed_trampoline(this: *mut gst_player_sys::GstPlayer, object: libc::c_int, p0: libc::c_int, f: glib_sys::gpointer) { + pub fn connect_video_dimensions_changed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn video_dimensions_changed_trampoline< + F: Fn(&Player, i32, i32) + Send + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + object: libc::c_int, + p0: libc::c_int, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), object, p0) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"video-dimensions-changed\0".as_ptr() as *const _, - Some(transmute(video_dimensions_changed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"video-dimensions-changed\0".as_ptr() as *const _, + Some(transmute(video_dimensions_changed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } pub fn connect_volume_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn volume_changed_trampoline(this: *mut gst_player_sys::GstPlayer, f: glib_sys::gpointer) { + unsafe extern "C" fn volume_changed_trampoline( + this: *mut gst_player_sys::GstPlayer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"volume-changed\0".as_ptr() as *const _, - Some(transmute(volume_changed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"volume-changed\0".as_ptr() as *const _, + Some(transmute(volume_changed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_warning(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn warning_trampoline(this: *mut gst_player_sys::GstPlayer, object: *mut glib_sys::GError, f: glib_sys::gpointer) { + pub fn connect_warning( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn warning_trampoline( + this: *mut gst_player_sys::GstPlayer, + object: *mut glib_sys::GError, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"warning\0".as_ptr() as *const _, - Some(transmute(warning_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"warning\0".as_ptr() as *const _, + Some(transmute(warning_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_audio_video_offset_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_audio_video_offset_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_audio_video_offset_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_audio_video_offset_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::audio-video-offset\0".as_ptr() as *const _, - Some(transmute(notify_audio_video_offset_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::audio-video-offset\0".as_ptr() as *const _, + Some(transmute( + notify_audio_video_offset_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_current_audio_track_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_current_audio_track_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_current_audio_track_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_current_audio_track_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::current-audio-track\0".as_ptr() as *const _, - Some(transmute(notify_current_audio_track_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::current-audio-track\0".as_ptr() as *const _, + Some(transmute( + notify_current_audio_track_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_current_subtitle_track_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_current_subtitle_track_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_current_subtitle_track_notify< + F: Fn(&Player) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_current_subtitle_track_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::current-subtitle-track\0".as_ptr() as *const _, - Some(transmute(notify_current_subtitle_track_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::current-subtitle-track\0".as_ptr() as *const _, + Some(transmute( + notify_current_subtitle_track_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_current_video_track_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_current_video_track_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_current_video_track_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_current_video_track_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::current-video-track\0".as_ptr() as *const _, - Some(transmute(notify_current_video_track_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::current-video-track\0".as_ptr() as *const _, + Some(transmute( + notify_current_video_track_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_duration_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_duration_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_duration_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, - Some(transmute(notify_duration_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::duration\0".as_ptr() as *const _, + Some(transmute(notify_duration_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_media_info_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_media_info_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_media_info_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_media_info_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::media-info\0".as_ptr() as *const _, - Some(transmute(notify_media_info_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::media-info\0".as_ptr() as *const _, + Some(transmute(notify_media_info_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mute_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_mute_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_mute_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, - Some(transmute(notify_mute_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mute\0".as_ptr() as *const _, + Some(transmute(notify_mute_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_pipeline_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_pipeline_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_pipeline_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_pipeline_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::pipeline\0".as_ptr() as *const _, - Some(transmute(notify_pipeline_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::pipeline\0".as_ptr() as *const _, + Some(transmute(notify_pipeline_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_position_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_position_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_position_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_position_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::position\0".as_ptr() as *const _, - Some(transmute(notify_position_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::position\0".as_ptr() as *const _, + Some(transmute(notify_position_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_rate_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_rate_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_rate_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_rate_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::rate\0".as_ptr() as *const _, - Some(transmute(notify_rate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::rate\0".as_ptr() as *const _, + Some(transmute(notify_rate_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - pub fn connect_property_subtitle_video_offset_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_subtitle_video_offset_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_subtitle_video_offset_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_subtitle_video_offset_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::subtitle-video-offset\0".as_ptr() as *const _, - Some(transmute(notify_subtitle_video_offset_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::subtitle-video-offset\0".as_ptr() as *const _, + Some(transmute( + notify_subtitle_video_offset_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_suburi_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_suburi_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_suburi_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_suburi_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::suburi\0".as_ptr() as *const _, - Some(transmute(notify_suburi_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::suburi\0".as_ptr() as *const _, + Some(transmute(notify_suburi_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_uri_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_uri_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_uri_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::uri\0".as_ptr() as *const _, + Some(transmute(notify_uri_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_video_multiview_flags_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_video_multiview_flags_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_video_multiview_flags_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_video_multiview_flags_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-flags\0".as_ptr() as *const _, - Some(transmute(notify_video_multiview_flags_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::video-multiview-flags\0".as_ptr() as *const _, + Some(transmute( + notify_video_multiview_flags_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_video_multiview_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_video_multiview_mode_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_video_multiview_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_video_multiview_mode_trampoline< + F: Fn(&Player) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-mode\0".as_ptr() as *const _, - Some(transmute(notify_video_multiview_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::video-multiview-mode\0".as_ptr() as *const _, + Some(transmute( + notify_video_multiview_mode_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_volume_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_volume_trampoline(this: *mut gst_player_sys::GstPlayer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_volume_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_volume_trampoline( + this: *mut gst_player_sys::GstPlayer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _, - Some(transmute(notify_volume_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::volume\0".as_ptr() as *const _, + Some(transmute(notify_volume_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-player/src/auto/player_audio_info.rs b/gstreamer-player/src/auto/player_audio_info.rs index 10bbf6e80..e468c6d52 100644 --- a/gstreamer-player/src/auto/player_audio_info.rs +++ b/gstreamer-player/src/auto/player_audio_info.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use PlayerStreamInfo; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_player_sys; +use PlayerStreamInfo; glib_wrapper! { pub struct PlayerAudioInfo(Object) @extends PlayerStreamInfo; @@ -17,33 +17,27 @@ glib_wrapper! { impl PlayerAudioInfo { pub fn get_bitrate(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_audio_info_get_bitrate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_audio_info_get_bitrate(self.to_glib_none().0) } } pub fn get_channels(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_audio_info_get_channels(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_audio_info_get_channels(self.to_glib_none().0) } } pub fn get_language(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_audio_info_get_language(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_audio_info_get_language( + self.to_glib_none().0, + )) } } pub fn get_max_bitrate(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_audio_info_get_max_bitrate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_audio_info_get_max_bitrate(self.to_glib_none().0) } } pub fn get_sample_rate(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_audio_info_get_sample_rate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_audio_info_get_sample_rate(self.to_glib_none().0) } } } diff --git a/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs b/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs index 028439c25..b1f10ca63 100644 --- a/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs +++ b/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use PlayerSignalDispatcher; use glib; -use glib::StaticType; -use glib::Value; use glib::object::ObjectType as ObjectType_; use glib::translate::*; +use glib::StaticType; +use glib::Value; use gobject_sys; use gst_player_sys; +use PlayerSignalDispatcher; glib_wrapper! { pub struct PlayerGMainContextSignalDispatcher(Object) @implements PlayerSignalDispatcher; @@ -23,7 +23,11 @@ impl PlayerGMainContextSignalDispatcher { pub fn get_property_application_context(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"application-context\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"application-context\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } diff --git a/gstreamer-player/src/auto/player_media_info.rs b/gstreamer-player/src/auto/player_media_info.rs index 4a384015c..b92e92a57 100644 --- a/gstreamer-player/src/auto/player_media_info.rs +++ b/gstreamer-player/src/auto/player_media_info.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::translate::*; +use glib::GString; +use gst; +use gst_player_sys; use PlayerAudioInfo; use PlayerStreamInfo; use PlayerSubtitleInfo; use PlayerVideoInfo; -use glib::GString; -use glib::translate::*; -use gst; -use gst_player_sys; glib_wrapper! { pub struct PlayerMediaInfo(Object); @@ -22,25 +22,33 @@ glib_wrapper! { impl PlayerMediaInfo { pub fn get_audio_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_media_info_get_audio_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_player_sys::gst_player_media_info_get_audio_streams(self.to_glib_none().0), + ) } } pub fn get_container_format(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_media_info_get_container_format(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_media_info_get_container_format( + self.to_glib_none().0, + )) } } pub fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(gst_player_sys::gst_player_media_info_get_duration(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_media_info_get_duration( + self.to_glib_none().0, + )) } } pub fn get_image_sample(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_media_info_get_image_sample(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_media_info_get_image_sample( + self.to_glib_none().0, + )) } } @@ -58,7 +66,9 @@ impl PlayerMediaInfo { pub fn get_number_of_subtitle_streams(&self) -> u32 { unsafe { - gst_player_sys::gst_player_media_info_get_number_of_subtitle_streams(self.to_glib_none().0) + gst_player_sys::gst_player_media_info_get_number_of_subtitle_streams( + self.to_glib_none().0, + ) } } @@ -70,49 +80,65 @@ impl PlayerMediaInfo { pub fn get_stream_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_media_info_get_stream_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_player_sys::gst_player_media_info_get_stream_list(self.to_glib_none().0), + ) } } pub fn get_subtitle_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_media_info_get_subtitle_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_player_sys::gst_player_media_info_get_subtitle_streams(self.to_glib_none().0), + ) } } pub fn get_tags(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_media_info_get_tags(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_media_info_get_tags( + self.to_glib_none().0, + )) } } pub fn get_title(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_media_info_get_title(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_media_info_get_title( + self.to_glib_none().0, + )) } } pub fn get_uri(&self) -> GString { unsafe { - from_glib_none(gst_player_sys::gst_player_media_info_get_uri(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_media_info_get_uri( + self.to_glib_none().0, + )) } } pub fn get_video_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_player_sys::gst_player_media_info_get_video_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_player_sys::gst_player_media_info_get_video_streams(self.to_glib_none().0), + ) } } pub fn is_live(&self) -> bool { unsafe { - from_glib(gst_player_sys::gst_player_media_info_is_live(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_media_info_is_live( + self.to_glib_none().0, + )) } } pub fn is_seekable(&self) -> bool { unsafe { - from_glib(gst_player_sys::gst_player_media_info_is_seekable(self.to_glib_none().0)) + from_glib(gst_player_sys::gst_player_media_info_is_seekable( + self.to_glib_none().0, + )) } } } diff --git a/gstreamer-player/src/auto/player_stream_info.rs b/gstreamer-player/src/auto/player_stream_info.rs index 3cbd0dd8b..c4b5f3e13 100644 --- a/gstreamer-player/src/auto/player_stream_info.rs +++ b/gstreamer-player/src/auto/player_stream_info.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst; use gst_player_sys; @@ -36,31 +36,41 @@ pub trait PlayerStreamInfoExt: 'static { impl> PlayerStreamInfoExt for O { fn get_caps(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_stream_info_get_caps(const_override(self.as_ref().to_glib_none().0))) + from_glib_none(gst_player_sys::gst_player_stream_info_get_caps( + const_override(self.as_ref().to_glib_none().0), + )) } } fn get_codec(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_stream_info_get_codec(const_override(self.as_ref().to_glib_none().0))) + from_glib_none(gst_player_sys::gst_player_stream_info_get_codec( + const_override(self.as_ref().to_glib_none().0), + )) } } fn get_index(&self) -> i32 { unsafe { - gst_player_sys::gst_player_stream_info_get_index(const_override(self.as_ref().to_glib_none().0)) + gst_player_sys::gst_player_stream_info_get_index(const_override( + self.as_ref().to_glib_none().0, + )) } } fn get_stream_type(&self) -> GString { unsafe { - from_glib_none(gst_player_sys::gst_player_stream_info_get_stream_type(const_override(self.as_ref().to_glib_none().0))) + from_glib_none(gst_player_sys::gst_player_stream_info_get_stream_type( + const_override(self.as_ref().to_glib_none().0), + )) } } fn get_tags(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_stream_info_get_tags(const_override(self.as_ref().to_glib_none().0))) + from_glib_none(gst_player_sys::gst_player_stream_info_get_tags( + const_override(self.as_ref().to_glib_none().0), + )) } } } diff --git a/gstreamer-player/src/auto/player_subtitle_info.rs b/gstreamer-player/src/auto/player_subtitle_info.rs index e61e5c14f..62dd3dd4f 100644 --- a/gstreamer-player/src/auto/player_subtitle_info.rs +++ b/gstreamer-player/src/auto/player_subtitle_info.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use PlayerStreamInfo; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_player_sys; +use PlayerStreamInfo; glib_wrapper! { pub struct PlayerSubtitleInfo(Object) @extends PlayerStreamInfo; @@ -18,7 +18,9 @@ glib_wrapper! { impl PlayerSubtitleInfo { pub fn get_language(&self) -> Option { unsafe { - from_glib_none(gst_player_sys::gst_player_subtitle_info_get_language(self.to_glib_none().0)) + from_glib_none(gst_player_sys::gst_player_subtitle_info_get_language( + self.to_glib_none().0, + )) } } } diff --git a/gstreamer-player/src/auto/player_video_info.rs b/gstreamer-player/src/auto/player_video_info.rs index 5e93690c9..dcdea1f9f 100644 --- a/gstreamer-player/src/auto/player_video_info.rs +++ b/gstreamer-player/src/auto/player_video_info.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use PlayerStreamInfo; use glib::translate::*; use gst_player_sys; +use PlayerStreamInfo; glib_wrapper! { pub struct PlayerVideoInfo(Object) @extends PlayerStreamInfo; @@ -16,27 +16,19 @@ glib_wrapper! { impl PlayerVideoInfo { pub fn get_bitrate(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_video_info_get_bitrate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_video_info_get_bitrate(self.to_glib_none().0) } } pub fn get_height(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_video_info_get_height(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_video_info_get_height(self.to_glib_none().0) } } pub fn get_max_bitrate(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_video_info_get_max_bitrate(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_video_info_get_max_bitrate(self.to_glib_none().0) } } pub fn get_width(&self) -> i32 { - unsafe { - gst_player_sys::gst_player_video_info_get_width(self.to_glib_none().0) - } + unsafe { gst_player_sys::gst_player_video_info_get_width(self.to_glib_none().0) } } } diff --git a/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs b/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs index afe1dc4e6..62f9608d1 100644 --- a/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs @@ -2,13 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use PlayerVideoRenderer; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -16,6 +15,7 @@ use gst_player_sys; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; +use PlayerVideoRenderer; glib_wrapper! { pub struct PlayerVideoOverlayVideoRenderer(Object) @implements PlayerVideoRenderer; @@ -38,7 +38,13 @@ impl PlayerVideoOverlayVideoRenderer { let mut y = mem::uninitialized(); let mut width = mem::uninitialized(); let mut height = mem::uninitialized(); - gst_player_sys::gst_player_video_overlay_video_renderer_get_render_rectangle(self.to_glib_none().0, &mut x, &mut y, &mut width, &mut height); + gst_player_sys::gst_player_video_overlay_video_renderer_get_render_rectangle( + self.to_glib_none().0, + &mut x, + &mut y, + &mut width, + &mut height, + ); (x, y, width, height) } } @@ -49,7 +55,13 @@ impl PlayerVideoOverlayVideoRenderer { pub fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) { unsafe { - gst_player_sys::gst_player_video_overlay_video_renderer_set_render_rectangle(self.to_glib_none().0, x, y, width, height); + gst_player_sys::gst_player_video_overlay_video_renderer_set_render_rectangle( + self.to_glib_none().0, + x, + y, + width, + height, + ); } } @@ -60,14 +72,22 @@ impl PlayerVideoOverlayVideoRenderer { pub fn get_property_video_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-sink\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_video_sink(&self, video_sink: Option<&gst::Element>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"video-sink\0".as_ptr() as *const _, + Value::from(video_sink).to_glib_none().0, + ); } } @@ -79,27 +99,57 @@ impl PlayerVideoOverlayVideoRenderer { // unsafe { TODO: call gst_player_sys:gst_player_video_overlay_video_renderer_new_with_sink() } //} - pub fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_video_sink_trampoline(this: *mut gst_player_sys::GstPlayerVideoOverlayVideoRenderer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_video_sink_notify< + F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_video_sink_trampoline< + F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayerVideoOverlayVideoRenderer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _, - Some(transmute(notify_video_sink_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::video-sink\0".as_ptr() as *const _, + Some(transmute(notify_video_sink_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_window_handle_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_window_handle_trampoline(this: *mut gst_player_sys::GstPlayerVideoOverlayVideoRenderer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_window_handle_notify< + F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_window_handle_trampoline< + F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static, + >( + this: *mut gst_player_sys::GstPlayerVideoOverlayVideoRenderer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::window-handle\0".as_ptr() as *const _, - Some(transmute(notify_window_handle_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::window-handle\0".as_ptr() as *const _, + Some(transmute(notify_window_handle_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-player/src/lib.rs b/gstreamer-player/src/lib.rs index 2a1f57185..7f479e094 100644 --- a/gstreamer-player/src/lib.rs +++ b/gstreamer-player/src/lib.rs @@ -33,7 +33,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] #[allow(clippy::cast_ptr_alignment)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-rtsp-server/src/auto/enums.rs b/gstreamer-rtsp-server/src/auto/enums.rs index a69aaa57d..152c7d1eb 100644 --- a/gstreamer-rtsp-server/src/auto/enums.rs +++ b/gstreamer-rtsp-server/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_rtsp_server_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPAddressPoolResult { Ok, Einval, @@ -32,10 +31,12 @@ impl ToGlib for RTSPAddressPoolResult { match *self { RTSPAddressPoolResult::Ok => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_OK, RTSPAddressPoolResult::Einval => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_EINVAL, - RTSPAddressPoolResult::Ereserved => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ERESERVED, + RTSPAddressPoolResult::Ereserved => { + gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ERESERVED + } RTSPAddressPoolResult::Erange => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ERANGE, RTSPAddressPoolResult::Elast => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ELAST, - RTSPAddressPoolResult::__Unknown(value) => value + RTSPAddressPoolResult::__Unknown(value) => value, } } } @@ -55,8 +56,7 @@ impl FromGlib for RTSPAddressPool } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPFilterResult { Remove, Keep, @@ -74,7 +74,7 @@ impl ToGlib for RTSPFilterResult { RTSPFilterResult::Remove => gst_rtsp_server_sys::GST_RTSP_FILTER_REMOVE, RTSPFilterResult::Keep => gst_rtsp_server_sys::GST_RTSP_FILTER_KEEP, RTSPFilterResult::Ref => gst_rtsp_server_sys::GST_RTSP_FILTER_REF, - RTSPFilterResult::__Unknown(value) => value + RTSPFilterResult::__Unknown(value) => value, } } } @@ -92,8 +92,7 @@ impl FromGlib for RTSPFilterResult { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPMediaStatus { Unprepared, Unpreparing, @@ -117,7 +116,7 @@ impl ToGlib for RTSPMediaStatus { RTSPMediaStatus::Prepared => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_PREPARED, RTSPMediaStatus::Suspended => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_SUSPENDED, RTSPMediaStatus::Error => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_ERROR, - RTSPMediaStatus::__Unknown(value) => value + RTSPMediaStatus::__Unknown(value) => value, } } } @@ -138,8 +137,7 @@ impl FromGlib for RTSPMediaStatus { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPPublishClockMode { None, Clock, @@ -156,8 +154,10 @@ impl ToGlib for RTSPPublishClockMode { match *self { RTSPPublishClockMode::None => gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_NONE, RTSPPublishClockMode::Clock => gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK, - RTSPPublishClockMode::ClockAndOffset => gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET, - RTSPPublishClockMode::__Unknown(value) => value + RTSPPublishClockMode::ClockAndOffset => { + gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET + } + RTSPPublishClockMode::__Unknown(value) => value, } } } @@ -199,8 +199,7 @@ impl SetValue for RTSPPublishClockMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPSuspendMode { None, Pause, @@ -218,7 +217,7 @@ impl ToGlib for RTSPSuspendMode { RTSPSuspendMode::None => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_NONE, RTSPSuspendMode::Pause => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_PAUSE, RTSPSuspendMode::Reset => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_RESET, - RTSPSuspendMode::__Unknown(value) => value + RTSPSuspendMode::__Unknown(value) => value, } } } @@ -260,8 +259,7 @@ impl SetValue for RTSPSuspendMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPThreadType { Client, Media, @@ -277,7 +275,7 @@ impl ToGlib for RTSPThreadType { match *self { RTSPThreadType::Client => gst_rtsp_server_sys::GST_RTSP_THREAD_TYPE_CLIENT, RTSPThreadType::Media => gst_rtsp_server_sys::GST_RTSP_THREAD_TYPE_MEDIA, - RTSPThreadType::__Unknown(value) => value + RTSPThreadType::__Unknown(value) => value, } } } @@ -293,4 +291,3 @@ impl FromGlib for RTSPThreadType { } } } - diff --git a/gstreamer-rtsp-server/src/auto/flags.rs b/gstreamer-rtsp-server/src/auto/flags.rs index d790ccc3c..dac77718d 100644 --- a/gstreamer-rtsp-server/src/auto/flags.rs +++ b/gstreamer-rtsp-server/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_rtsp_server_sys; @@ -87,4 +87,3 @@ impl SetValue for RTSPTransportMode { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-rtsp-server/src/auto/mod.rs b/gstreamer-rtsp-server/src/auto/mod.rs index 07d135f02..30b112f57 100644 --- a/gstreamer-rtsp-server/src/auto/mod.rs +++ b/gstreamer-rtsp-server/src/auto/mod.rs @@ -3,60 +3,68 @@ // DO NOT EDIT mod rtsp_address_pool; -pub use self::rtsp_address_pool::{RTSPAddressPool, RTSPAddressPoolClass, NONE_RTSP_ADDRESS_POOL}; pub use self::rtsp_address_pool::RTSPAddressPoolExt; +pub use self::rtsp_address_pool::{RTSPAddressPool, RTSPAddressPoolClass, NONE_RTSP_ADDRESS_POOL}; mod rtsp_auth; -pub use self::rtsp_auth::{RTSPAuth, RTSPAuthClass, NONE_RTSP_AUTH}; pub use self::rtsp_auth::RTSPAuthExt; +pub use self::rtsp_auth::{RTSPAuth, RTSPAuthClass, NONE_RTSP_AUTH}; mod rtsp_client; -pub use self::rtsp_client::{RTSPClient, RTSPClientClass, NONE_RTSP_CLIENT}; pub use self::rtsp_client::RTSPClientExt; +pub use self::rtsp_client::{RTSPClient, RTSPClientClass, NONE_RTSP_CLIENT}; mod rtsp_media; -pub use self::rtsp_media::{RTSPMedia, RTSPMediaClass, NONE_RTSP_MEDIA}; pub use self::rtsp_media::RTSPMediaExt; +pub use self::rtsp_media::{RTSPMedia, RTSPMediaClass, NONE_RTSP_MEDIA}; mod rtsp_media_factory; -pub use self::rtsp_media_factory::{RTSPMediaFactory, RTSPMediaFactoryClass, NONE_RTSP_MEDIA_FACTORY}; pub use self::rtsp_media_factory::RTSPMediaFactoryExt; +pub use self::rtsp_media_factory::{ + RTSPMediaFactory, RTSPMediaFactoryClass, NONE_RTSP_MEDIA_FACTORY, +}; mod rtsp_media_factory_uri; -pub use self::rtsp_media_factory_uri::{RTSPMediaFactoryURI, RTSPMediaFactoryURIClass, NONE_RTSP_MEDIA_FACTORY_URI}; pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURIExt; +pub use self::rtsp_media_factory_uri::{ + RTSPMediaFactoryURI, RTSPMediaFactoryURIClass, NONE_RTSP_MEDIA_FACTORY_URI, +}; mod rtsp_mount_points; -pub use self::rtsp_mount_points::{RTSPMountPoints, RTSPMountPointsClass, NONE_RTSP_MOUNT_POINTS}; pub use self::rtsp_mount_points::RTSPMountPointsExt; +pub use self::rtsp_mount_points::{RTSPMountPoints, RTSPMountPointsClass, NONE_RTSP_MOUNT_POINTS}; mod rtsp_server; -pub use self::rtsp_server::{RTSPServer, RTSPServerClass, NONE_RTSP_SERVER}; pub use self::rtsp_server::RTSPServerExt; +pub use self::rtsp_server::{RTSPServer, RTSPServerClass, NONE_RTSP_SERVER}; mod rtsp_session; -pub use self::rtsp_session::{RTSPSession, RTSPSessionClass, NONE_RTSP_SESSION}; pub use self::rtsp_session::RTSPSessionExt; +pub use self::rtsp_session::{RTSPSession, RTSPSessionClass, NONE_RTSP_SESSION}; mod rtsp_session_media; -pub use self::rtsp_session_media::{RTSPSessionMedia, RTSPSessionMediaClass, NONE_RTSP_SESSION_MEDIA}; pub use self::rtsp_session_media::RTSPSessionMediaExt; +pub use self::rtsp_session_media::{ + RTSPSessionMedia, RTSPSessionMediaClass, NONE_RTSP_SESSION_MEDIA, +}; mod rtsp_session_pool; -pub use self::rtsp_session_pool::{RTSPSessionPool, RTSPSessionPoolClass, NONE_RTSP_SESSION_POOL}; pub use self::rtsp_session_pool::RTSPSessionPoolExt; +pub use self::rtsp_session_pool::{RTSPSessionPool, RTSPSessionPoolClass, NONE_RTSP_SESSION_POOL}; mod rtsp_stream; -pub use self::rtsp_stream::{RTSPStream, RTSPStreamClass, NONE_RTSP_STREAM}; pub use self::rtsp_stream::RTSPStreamExt; +pub use self::rtsp_stream::{RTSPStream, RTSPStreamClass, NONE_RTSP_STREAM}; mod rtsp_stream_transport; -pub use self::rtsp_stream_transport::{RTSPStreamTransport, RTSPStreamTransportClass, NONE_RTSP_STREAM_TRANSPORT}; pub use self::rtsp_stream_transport::RTSPStreamTransportExt; +pub use self::rtsp_stream_transport::{ + RTSPStreamTransport, RTSPStreamTransportClass, NONE_RTSP_STREAM_TRANSPORT, +}; mod rtsp_thread_pool; -pub use self::rtsp_thread_pool::{RTSPThreadPool, RTSPThreadPoolClass, NONE_RTSP_THREAD_POOL}; pub use self::rtsp_thread_pool::RTSPThreadPoolExt; +pub use self::rtsp_thread_pool::{RTSPThreadPool, RTSPThreadPoolClass, NONE_RTSP_THREAD_POOL}; mod rtsp_address; pub use self::rtsp_address::RTSPAddress; diff --git a/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs index d1813993f..e44a857e0 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPAddress; -use RTSPAddressFlags; use glib; use glib::object::IsA; use glib::translate::*; use gst_rtsp_server_sys; +use RTSPAddress; +use RTSPAddressFlags; glib_wrapper! { pub struct RTSPAddressPool(Object); @@ -20,9 +20,7 @@ glib_wrapper! { impl RTSPAddressPool { pub fn new() -> RTSPAddressPool { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_address_pool_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_address_pool_new()) } } } @@ -40,7 +38,14 @@ pub const NONE_RTSP_ADDRESS_POOL: Option<&RTSPAddressPool> = None; pub trait RTSPAddressPoolExt: 'static { fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option; - fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError>; + fn add_range( + &self, + min_address: &str, + max_address: &str, + min_port: u16, + max_port: u16, + ttl: u8, + ) -> Result<(), glib::error::BoolError>; fn clear(&self); @@ -52,13 +57,34 @@ pub trait RTSPAddressPoolExt: 'static { impl> RTSPAddressPoolExt for O { fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_address_pool_acquire_address(self.as_ref().to_glib_none().0, flags.to_glib(), n_ports)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_address_pool_acquire_address( + self.as_ref().to_glib_none().0, + flags.to_glib(), + n_ports, + )) } } - fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError> { + fn add_range( + &self, + min_address: &str, + max_address: &str, + min_port: u16, + max_port: u16, + ttl: u8, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_address_pool_add_range(self.as_ref().to_glib_none().0, min_address.to_glib_none().0, max_address.to_glib_none().0, min_port, max_port, ttl), "Failed to add address range") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_address_pool_add_range( + self.as_ref().to_glib_none().0, + min_address.to_glib_none().0, + max_address.to_glib_none().0, + min_port, + max_port, + ttl + ), + "Failed to add address range" + ) } } @@ -76,7 +102,11 @@ impl> RTSPAddressPoolExt for O { fn has_unicast_addresses(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_address_pool_has_unicast_addresses(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_address_pool_has_unicast_addresses( + self.as_ref().to_glib_none().0, + ), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_auth.rs b/gstreamer-rtsp-server/src/auto/rtsp_auth.rs index 7c215d6da..ed8be25d0 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_auth.rs @@ -2,16 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPToken; use gio; use gio_sys; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; #[cfg(any(feature = "v1_12", feature = "dox"))] use gst_rtsp; @@ -19,6 +18,7 @@ use gst_rtsp_server_sys; use std; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPToken; glib_wrapper! { pub struct RTSPAuth(Object); @@ -31,22 +31,26 @@ glib_wrapper! { impl RTSPAuth { pub fn new() -> RTSPAuth { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_new()) } } pub fn check(check: &str) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_auth_check(check.to_glib_none().0), "Check failed") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_auth_check(check.to_glib_none().0), + "Check failed" + ) } } pub fn make_basic(user: &str, pass: &str) -> GString { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_make_basic(user.to_glib_none().0, pass.to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_make_basic( + user.to_glib_none().0, + pass.to_glib_none().0, + )) } } } @@ -102,124 +106,211 @@ pub trait RTSPAuthExt: 'static { fn set_tls_database>(&self, database: Option<&P>); - fn connect_accept_certificate bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_accept_certificate< + F: Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + + Send + + Sync + + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPAuthExt for O { fn add_basic(&self, basic: &str, token: &RTSPToken) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_add_basic(self.as_ref().to_glib_none().0, basic.to_glib_none().0, token.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_add_basic( + self.as_ref().to_glib_none().0, + basic.to_glib_none().0, + token.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn add_digest(&self, user: &str, pass: &str, token: &RTSPToken) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_add_digest(self.as_ref().to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_add_digest( + self.as_ref().to_glib_none().0, + user.to_glib_none().0, + pass.to_glib_none().0, + token.to_glib_none().0, + ); } } fn get_default_token(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_default_token(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_default_token( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_realm(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_realm(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_realm( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn get_supported_methods(&self) -> gst_rtsp::RTSPAuthMethod { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_auth_get_supported_methods(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_auth_get_supported_methods( + self.as_ref().to_glib_none().0, + )) } } fn get_tls_authentication_mode(&self) -> gio::TlsAuthenticationMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_auth_get_tls_authentication_mode(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_auth_get_tls_authentication_mode( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_tls_certificate(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_tls_certificate(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_tls_certificate( + self.as_ref().to_glib_none().0, + )) } } fn get_tls_database(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_tls_database(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_auth_get_tls_database( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn parse_htdigest>(&self, path: P, token: &RTSPToken) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_auth_parse_htdigest(self.as_ref().to_glib_none().0, path.as_ref().to_glib_none().0, token.to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_auth_parse_htdigest( + self.as_ref().to_glib_none().0, + path.as_ref().to_glib_none().0, + token.to_glib_none().0, + )) } } fn remove_basic(&self, basic: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_remove_basic(self.as_ref().to_glib_none().0, basic.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_remove_basic( + self.as_ref().to_glib_none().0, + basic.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn remove_digest(&self, user: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_remove_digest(self.as_ref().to_glib_none().0, user.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_remove_digest( + self.as_ref().to_glib_none().0, + user.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_realm(&self, realm: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_realm(self.as_ref().to_glib_none().0, realm.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_set_realm( + self.as_ref().to_glib_none().0, + realm.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_supported_methods(self.as_ref().to_glib_none().0, methods.to_glib()); + gst_rtsp_server_sys::gst_rtsp_auth_set_supported_methods( + self.as_ref().to_glib_none().0, + methods.to_glib(), + ); } } fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_tls_authentication_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_auth_set_tls_authentication_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_tls_certificate>(&self, cert: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_tls_certificate(self.as_ref().to_glib_none().0, cert.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_set_tls_certificate( + self.as_ref().to_glib_none().0, + cert.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn set_tls_database>(&self, database: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_tls_database(self.as_ref().to_glib_none().0, database.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_auth_set_tls_database( + self.as_ref().to_glib_none().0, + database.map(|p| p.as_ref()).to_glib_none().0, + ); } } - fn connect_accept_certificate bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn accept_certificate_trampoline bool + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPAuth, connection: *mut gio_sys::GTlsConnection, peer_cert: *mut gio_sys::GTlsCertificate, errors: gio_sys::GTlsCertificateFlags, f: glib_sys::gpointer) -> glib_sys::gboolean - where P: IsA + fn connect_accept_certificate< + F: Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + + Send + + Sync + + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn accept_certificate_trampoline< + P, + F: Fn(&P, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + + Send + + Sync + + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPAuth, + connection: *mut gio_sys::GTlsConnection, + peer_cert: *mut gio_sys::GTlsCertificate, + errors: gio_sys::GTlsCertificateFlags, + f: glib_sys::gpointer, + ) -> glib_sys::gboolean + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPAuth::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(connection), &from_glib_borrow(peer_cert), from_glib(errors)).to_glib() + f( + &RTSPAuth::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(connection), + &from_glib_borrow(peer_cert), + from_glib(errors), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _, - Some(transmute(accept_certificate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"accept-certificate\0".as_ptr() as *const _, + Some(transmute(accept_certificate_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_client.rs b/gstreamer-rtsp-server/src/auto/rtsp_client.rs index 359520a26..4f9e95bb5 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_client.rs @@ -2,20 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPAuth; -use RTSPContext; -use RTSPFilterResult; -use RTSPMountPoints; -use RTSPSession; -use RTSPSessionPool; -use RTSPThreadPool; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; #[cfg(any(feature = "v1_12", feature = "dox"))] @@ -25,6 +18,13 @@ use gst_rtsp_server_sys; use gst_rtsp_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPAuth; +use RTSPContext; +use RTSPFilterResult; +use RTSPMountPoints; +use RTSPSession; +use RTSPSessionPool; +use RTSPThreadPool; glib_wrapper! { pub struct RTSPClient(Object); @@ -37,9 +37,7 @@ glib_wrapper! { impl RTSPClient { pub fn new() -> RTSPClient { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_new()) } } } @@ -71,7 +69,10 @@ pub trait RTSPClientExt: 'static { //fn send_message>(&self, session: Option<&P>, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; - fn session_filter(&self, func: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>) -> Vec; + fn session_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>, + ) -> Vec; fn set_auth>(&self, auth: Option<&P>); @@ -92,71 +93,166 @@ pub trait RTSPClientExt: 'static { fn set_property_drop_backlog(&self, drop_backlog: bool); - fn connect_announce_request(&self, f: F) -> SignalHandlerId; + fn connect_announce_request( + &self, + f: F, + ) -> SignalHandlerId; //fn connect_check_requirements(&self, f: F) -> SignalHandlerId; fn connect_closed(&self, f: F) -> SignalHandlerId; - fn connect_describe_request(&self, f: F) -> SignalHandlerId; + fn connect_describe_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId; + fn connect_get_parameter_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_handle_response(&self, f: F) -> SignalHandlerId; + fn connect_handle_response( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_new_session(&self, f: F) -> SignalHandlerId; + fn connect_new_session( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_options_request(&self, f: F) -> SignalHandlerId; + fn connect_options_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_pause_request(&self, f: F) -> SignalHandlerId; + fn connect_pause_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_play_request(&self, f: F) -> SignalHandlerId; + fn connect_play_request( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_announce_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_announce_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_describe_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_describe_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_get_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_get_parameter_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_options_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_options_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_pause_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_pause_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_play_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_play_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_record_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_record_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_set_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_set_parameter_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_setup_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_setup_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_teardown_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; + fn connect_pre_teardown_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_record_request(&self, f: F) -> SignalHandlerId; + fn connect_record_request( + &self, + f: F, + ) -> SignalHandlerId; //fn connect_send_message(&self, f: F) -> SignalHandlerId; - fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId; + fn connect_set_parameter_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_setup_request(&self, f: F) -> SignalHandlerId; + fn connect_setup_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_teardown_request(&self, f: F) -> SignalHandlerId; + fn connect_teardown_request( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_drop_backlog_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_drop_backlog_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_mount_points_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_session_pool_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPClientExt for O { @@ -168,7 +264,9 @@ impl> RTSPClientExt for O { fn get_auth(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_auth(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_auth( + self.as_ref().to_glib_none().0, + )) } } @@ -178,19 +276,25 @@ impl> RTSPClientExt for O { fn get_mount_points(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_mount_points(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_mount_points( + self.as_ref().to_glib_none().0, + )) } } fn get_session_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_session_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_session_pool( + self.as_ref().to_glib_none().0, + )) } } fn get_thread_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_thread_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_get_thread_pool( + self.as_ref().to_glib_none().0, + )) } } @@ -202,12 +306,23 @@ impl> RTSPClientExt for O { // unsafe { TODO: call gst_rtsp_server_sys:gst_rtsp_client_send_message() } //} - fn session_filter(&self, func: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>) -> Vec { - let func_data: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)> = func; - unsafe extern "C" fn func_func(client: *mut gst_rtsp_server_sys::GstRTSPClient, sess: *mut gst_rtsp_server_sys::GstRTSPSession, user_data: glib_sys::gpointer) -> gst_rtsp_server_sys::GstRTSPFilterResult { + fn session_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>, + ) -> Vec { + let func_data: Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)> = + func; + unsafe extern "C" fn func_func( + client: *mut gst_rtsp_server_sys::GstRTSPClient, + sess: *mut gst_rtsp_server_sys::GstRTSPSession, + user_data: glib_sys::gpointer, + ) -> gst_rtsp_server_sys::GstRTSPFilterResult { let client = from_glib_borrow(client); let sess = from_glib_borrow(sess); - let callback: *mut Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>; + let callback: *mut Option< + &mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult), + > = user_data as *const _ as usize + as *mut Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)>; let res = if let Some(ref mut callback) = *callback { callback(&client, &sess) } else { @@ -215,16 +330,31 @@ impl> RTSPClientExt for O { }; res.to_glib() } - let func = if func_data.is_some() { Some(func_func as _) } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult)> = &func_data; + let func = if func_data.is_some() { + Some(func_func as _) + } else { + None + }; + let super_callback0: &Option< + &mut dyn (FnMut(&RTSPClient, &RTSPSession) -> RTSPFilterResult), + > = &func_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_client_session_filter(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full( + gst_rtsp_server_sys::gst_rtsp_client_session_filter( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + ), + ) } } fn set_auth>(&self, auth: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_client_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_client_set_auth( + self.as_ref().to_glib_none().0, + auth.map(|p| p.as_ref()).to_glib_none().0, + ); } } @@ -234,7 +364,10 @@ impl> RTSPClientExt for O { fn set_mount_points>(&self, mounts: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_client_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_client_set_mount_points( + self.as_ref().to_glib_none().0, + mounts.map(|p| p.as_ref()).to_glib_none().0, + ); } } @@ -249,41 +382,72 @@ impl> RTSPClientExt for O { fn set_session_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_client_set_session_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_client_set_session_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn set_thread_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_client_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_client_set_thread_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn get_property_drop_backlog(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"drop-backlog\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"drop-backlog\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_drop_backlog(&self, drop_backlog: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"drop-backlog\0".as_ptr() as *const _, Value::from(&drop_backlog).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"drop-backlog\0".as_ptr() as *const _, + Value::from(&drop_backlog).to_glib_none().0, + ); } } - fn connect_announce_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn announce_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_announce_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn announce_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"announce-request\0".as_ptr() as *const _, - Some(transmute(announce_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"announce-request\0".as_ptr() as *const _, + Some(transmute(announce_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } @@ -292,278 +456,645 @@ impl> RTSPClientExt for O { //} fn connect_closed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn closed_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn closed_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _, - Some(transmute(closed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"closed\0".as_ptr() as *const _, + Some(transmute(closed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_describe_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn describe_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_describe_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn describe_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"describe-request\0".as_ptr() as *const _, - Some(transmute(describe_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"describe-request\0".as_ptr() as *const _, + Some(transmute(describe_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn get_parameter_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_get_parameter_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn get_parameter_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"get-parameter-request\0".as_ptr() as *const _, - Some(transmute(get_parameter_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"get-parameter-request\0".as_ptr() as *const _, + Some(transmute( + get_parameter_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_handle_response(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn handle_response_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_handle_response( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn handle_response_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"handle-response\0".as_ptr() as *const _, - Some(transmute(handle_response_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"handle-response\0".as_ptr() as *const _, + Some(transmute(handle_response_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_new_session(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_session_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, object: *mut gst_rtsp_server_sys::GstRTSPSession, f: glib_sys::gpointer) - where P: IsA + fn connect_new_session( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_session_trampoline< + P, + F: Fn(&P, &RTSPSession) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + object: *mut gst_rtsp_server_sys::GstRTSPSession, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-session\0".as_ptr() as *const _, - Some(transmute(new_session_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-session\0".as_ptr() as *const _, + Some(transmute(new_session_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_options_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn options_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_options_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn options_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"options-request\0".as_ptr() as *const _, - Some(transmute(options_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"options-request\0".as_ptr() as *const _, + Some(transmute(options_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_pause_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pause_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_pause_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pause_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pause-request\0".as_ptr() as *const _, - Some(transmute(pause_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pause-request\0".as_ptr() as *const _, + Some(transmute(pause_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_play_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn play_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_play_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn play_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"play-request\0".as_ptr() as *const _, - Some(transmute(play_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"play-request\0".as_ptr() as *const _, + Some(transmute(play_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_announce_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_announce_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_announce_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_announce_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-announce-request\0".as_ptr() as *const _, - Some(transmute(pre_announce_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-announce-request\0".as_ptr() as *const _, + Some(transmute( + pre_announce_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_describe_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_describe_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_describe_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_describe_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-describe-request\0".as_ptr() as *const _, - Some(transmute(pre_describe_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-describe-request\0".as_ptr() as *const _, + Some(transmute( + pre_describe_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_get_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_get_parameter_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_get_parameter_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_get_parameter_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-get-parameter-request\0".as_ptr() as *const _, - Some(transmute(pre_get_parameter_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-get-parameter-request\0".as_ptr() as *const _, + Some(transmute( + pre_get_parameter_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_options_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_options_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_options_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_options_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-options-request\0".as_ptr() as *const _, - Some(transmute(pre_options_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-options-request\0".as_ptr() as *const _, + Some(transmute( + pre_options_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_pause_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_pause_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_pause_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_pause_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-pause-request\0".as_ptr() as *const _, - Some(transmute(pre_pause_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-pause-request\0".as_ptr() as *const _, + Some(transmute(pre_pause_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_play_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_play_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_play_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_play_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-play-request\0".as_ptr() as *const _, - Some(transmute(pre_play_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-play-request\0".as_ptr() as *const _, + Some(transmute(pre_play_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_record_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_record_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_record_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_record_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-record-request\0".as_ptr() as *const _, - Some(transmute(pre_record_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-record-request\0".as_ptr() as *const _, + Some(transmute(pre_record_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_set_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_set_parameter_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_set_parameter_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_set_parameter_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-set-parameter-request\0".as_ptr() as *const _, - Some(transmute(pre_set_parameter_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-set-parameter-request\0".as_ptr() as *const _, + Some(transmute( + pre_set_parameter_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_setup_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_setup_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_setup_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_setup_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-setup-request\0".as_ptr() as *const _, - Some(transmute(pre_setup_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-setup-request\0".as_ptr() as *const _, + Some(transmute(pre_setup_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_12", feature = "dox"))] - fn connect_pre_teardown_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pre_teardown_request_trampoline gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) -> gst_rtsp_sys::GstRTSPStatusCode - where P: IsA + fn connect_pre_teardown_request< + F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pre_teardown_request_trampoline< + P, + F: Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) -> gst_rtsp_sys::GstRTSPStatusCode + where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) + .to_glib() } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pre-teardown-request\0".as_ptr() as *const _, - Some(transmute(pre_teardown_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pre-teardown-request\0".as_ptr() as *const _, + Some(transmute( + pre_teardown_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_record_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn record_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_record_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn record_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"record-request\0".as_ptr() as *const _, - Some(transmute(record_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"record-request\0".as_ptr() as *const _, + Some(transmute(record_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } @@ -571,87 +1102,179 @@ impl> RTSPClientExt for O { // Ignored message: GstRtsp.RTSPMessage //} - fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn set_parameter_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_set_parameter_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn set_parameter_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"set-parameter-request\0".as_ptr() as *const _, - Some(transmute(set_parameter_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"set-parameter-request\0".as_ptr() as *const _, + Some(transmute( + set_parameter_request_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_setup_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn setup_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_setup_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn setup_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"setup-request\0".as_ptr() as *const _, - Some(transmute(setup_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"setup-request\0".as_ptr() as *const _, + Some(transmute(setup_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_teardown_request(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn teardown_request_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, f: glib_sys::gpointer) - where P: IsA + fn connect_teardown_request( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn teardown_request_trampoline< + P, + F: Fn(&P, &RTSPContext) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) + f( + &RTSPClient::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(ctx), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"teardown-request\0".as_ptr() as *const _, - Some(transmute(teardown_request_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"teardown-request\0".as_ptr() as *const _, + Some(transmute(teardown_request_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_drop_backlog_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_drop_backlog_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_drop_backlog_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_drop_backlog_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::drop-backlog\0".as_ptr() as *const _, - Some(transmute(notify_drop_backlog_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::drop-backlog\0".as_ptr() as *const _, + Some(transmute( + notify_drop_backlog_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mount_points_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_mount_points_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_mount_points_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _, - Some(transmute(notify_mount_points_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mount-points\0".as_ptr() as *const _, + Some(transmute( + notify_mount_points_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_session_pool_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPClient, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_session_pool_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_session_pool_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPClient, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _, - Some(transmute(notify_session_pool_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::session-pool\0".as_ptr() as *const _, + Some(transmute( + notify_session_pool_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_media.rs index bfacc38cf..a0493631a 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media.rs @@ -2,21 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPAddressPool; -use RTSPMediaStatus; -use RTSPPublishClockMode; -use RTSPStream; -use RTSPSuspendMode; -use RTSPTransportMode; use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -25,6 +19,12 @@ use gst_rtsp_server_sys; use libc; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPAddressPool; +use RTSPMediaStatus; +use RTSPPublishClockMode; +use RTSPStream; +use RTSPSuspendMode; +use RTSPTransportMode; glib_wrapper! { pub struct RTSPMedia(Object); @@ -38,7 +38,9 @@ impl RTSPMedia { pub fn new>(element: &P) -> RTSPMedia { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_new(element.as_ref().to_glib_full())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_new( + element.as_ref().to_glib_full(), + )) } } } @@ -54,7 +56,11 @@ pub trait RTSPMediaExt: 'static { //#[cfg(any(feature = "v1_14", feature = "dox"))] //fn complete_pipeline(&self, transports: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 10, id: 31 }) -> bool; - fn create_stream, Q: IsA>(&self, payloader: &P, pad: &Q) -> Option; + fn create_stream, Q: IsA>( + &self, + payloader: &P, + pad: &Q, + ) -> Option; fn find_stream(&self, control: &str) -> Option; @@ -202,45 +208,97 @@ pub trait RTSPMediaExt: 'static { fn set_property_time_provider(&self, time_provider: bool); - fn connect_new_state(&self, f: F) -> SignalHandlerId; + fn connect_new_state(&self, f: F) + -> SignalHandlerId; - fn connect_new_stream(&self, f: F) -> SignalHandlerId; + fn connect_new_stream( + &self, + f: F, + ) -> SignalHandlerId; fn connect_prepared(&self, f: F) -> SignalHandlerId; - fn connect_removed_stream(&self, f: F) -> SignalHandlerId; + fn connect_removed_stream( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_target_state(&self, f: F) -> SignalHandlerId; + fn connect_target_state( + &self, + f: F, + ) -> SignalHandlerId; fn connect_unprepared(&self, f: F) -> SignalHandlerId; - fn connect_property_bind_mcast_address_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_bind_mcast_address_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_buffer_size_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_clock_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_eos_shutdown_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_max_mcast_ttl_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_mcast_ttl_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_reusable_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_reusable_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_shared_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_stop_on_disconnect_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_suspend_mode_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_time_provider_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_time_provider_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_transport_mode_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPMediaExt for O { @@ -255,27 +313,42 @@ impl> RTSPMediaExt for O { // unsafe { TODO: call gst_rtsp_server_sys:gst_rtsp_media_complete_pipeline() } //} - fn create_stream, Q: IsA>(&self, payloader: &P, pad: &Q) -> Option { + fn create_stream, Q: IsA>( + &self, + payloader: &P, + pad: &Q, + ) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_create_stream(self.as_ref().to_glib_none().0, payloader.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_create_stream( + self.as_ref().to_glib_none().0, + payloader.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0, + )) } } fn find_stream(&self, control: &str) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_find_stream(self.as_ref().to_glib_none().0, control.to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_find_stream( + self.as_ref().to_glib_none().0, + control.to_glib_none().0, + )) } } fn get_address_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_address_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_address_pool( + self.as_ref().to_glib_none().0, + )) } } fn get_base_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_base_time(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_base_time( + self.as_ref().to_glib_none().0, + )) } } @@ -287,27 +360,31 @@ impl> RTSPMediaExt for O { fn get_clock(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_clock(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_clock( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_do_retransmission(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_do_retransmission(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_do_retransmission( + self.as_ref().to_glib_none().0, + )) } } fn get_element(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_element(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_element( + self.as_ref().to_glib_none().0, + )) } } fn get_latency(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_media_get_latency(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_media_get_latency(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v1_16", feature = "dox"))] @@ -319,7 +396,9 @@ impl> RTSPMediaExt for O { fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_multicast_iface(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_multicast_iface( + self.as_ref().to_glib_none().0, + )) } } @@ -329,49 +408,68 @@ impl> RTSPMediaExt for O { fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_profiles(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_profiles( + self.as_ref().to_glib_none().0, + )) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_protocols(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_protocols( + self.as_ref().to_glib_none().0, + )) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_publish_clock_mode(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_publish_clock_mode( + self.as_ref().to_glib_none().0, + )) } } fn get_range_string(&self, play: bool, unit: gst_rtsp::RTSPRangeUnit) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_range_string(self.as_ref().to_glib_none().0, play.to_glib(), unit.to_glib())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_get_range_string( + self.as_ref().to_glib_none().0, + play.to_glib(), + unit.to_glib(), + )) } } fn get_retransmission_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_retransmission_time(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_retransmission_time( + self.as_ref().to_glib_none().0, + )) } } fn get_status(&self) -> RTSPMediaStatus { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_status(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_status( + self.as_ref().to_glib_none().0, + )) } } fn get_stream(&self, idx: u32) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_get_stream(self.as_ref().to_glib_none().0, idx)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_get_stream( + self.as_ref().to_glib_none().0, + idx, + )) } } fn get_suspend_mode(&self) -> RTSPSuspendMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_suspend_mode(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_suspend_mode( + self.as_ref().to_glib_none().0, + )) } } @@ -381,7 +479,9 @@ impl> RTSPMediaExt for O { fn get_transport_mode(&self) -> RTSPTransportMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_transport_mode(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_get_transport_mode( + self.as_ref().to_glib_none().0, + )) } } @@ -392,44 +492,54 @@ impl> RTSPMediaExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] fn is_bind_mcast_address(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_bind_mcast_address(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_bind_mcast_address( + self.as_ref().to_glib_none().0, + )) } } fn is_eos_shutdown(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_eos_shutdown(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_eos_shutdown( + self.as_ref().to_glib_none().0, + )) } } fn is_reusable(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_reusable(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_reusable( + self.as_ref().to_glib_none().0, + )) } } fn is_shared(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_shared(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_shared( + self.as_ref().to_glib_none().0, + )) } } fn is_stop_on_disconnect(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_stop_on_disconnect(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_stop_on_disconnect( + self.as_ref().to_glib_none().0, + )) } } fn is_time_provider(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_time_provider(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_is_time_provider( + self.as_ref().to_glib_none().0, + )) } } fn n_streams(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_media_n_streams(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_media_n_streams(self.as_ref().to_glib_none().0) } } //fn prepare(&self, thread: /*Ignored*/Option<&mut RTSPThread>) -> bool { @@ -452,58 +562,85 @@ impl> RTSPMediaExt for O { fn set_address_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_set_address_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_bind_mcast_address(&self, bind_mcast_addr: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_bind_mcast_address(self.as_ref().to_glib_none().0, bind_mcast_addr.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_bind_mcast_address( + self.as_ref().to_glib_none().0, + bind_mcast_addr.to_glib(), + ); } } fn set_buffer_size(&self, size: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_buffer_size(self.as_ref().to_glib_none().0, size); + gst_rtsp_server_sys::gst_rtsp_media_set_buffer_size( + self.as_ref().to_glib_none().0, + size, + ); } } fn set_clock>(&self, clock: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_set_clock( + self.as_ref().to_glib_none().0, + clock.map(|p| p.as_ref()).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_do_retransmission(&self, do_retransmission: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_do_retransmission(self.as_ref().to_glib_none().0, do_retransmission.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_do_retransmission( + self.as_ref().to_glib_none().0, + do_retransmission.to_glib(), + ); } } fn set_eos_shutdown(&self, eos_shutdown: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_eos_shutdown(self.as_ref().to_glib_none().0, eos_shutdown.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_eos_shutdown( + self.as_ref().to_glib_none().0, + eos_shutdown.to_glib(), + ); } } fn set_latency(&self, latency: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_latency(self.as_ref().to_glib_none().0, latency); + gst_rtsp_server_sys::gst_rtsp_media_set_latency( + self.as_ref().to_glib_none().0, + latency, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_max_mcast_ttl(&self, ttl: u32) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_set_max_mcast_ttl(self.as_ref().to_glib_none().0, ttl)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_set_max_mcast_ttl( + self.as_ref().to_glib_none().0, + ttl, + )) } } fn set_multicast_iface(&self, multicast_iface: Option<&str>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_set_multicast_iface( + self.as_ref().to_glib_none().0, + multicast_iface.to_glib_none().0, + ); } } @@ -513,43 +650,64 @@ impl> RTSPMediaExt for O { fn set_pipeline_state(&self, state: gst::State) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_pipeline_state(self.as_ref().to_glib_none().0, state.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_pipeline_state( + self.as_ref().to_glib_none().0, + state.to_glib(), + ); } } fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_profiles( + self.as_ref().to_glib_none().0, + profiles.to_glib(), + ); } } fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_protocols( + self.as_ref().to_glib_none().0, + protocols.to_glib(), + ); } } fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_publish_clock_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_retransmission_time(&self, time: gst::ClockTime) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_retransmission_time( + self.as_ref().to_glib_none().0, + time.to_glib(), + ); } } fn set_reusable(&self, reusable: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_reusable(self.as_ref().to_glib_none().0, reusable.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_reusable( + self.as_ref().to_glib_none().0, + reusable.to_glib(), + ); } } fn set_shared(&self, shared: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_shared(self.as_ref().to_glib_none().0, shared.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_shared( + self.as_ref().to_glib_none().0, + shared.to_glib(), + ); } } @@ -559,19 +717,28 @@ impl> RTSPMediaExt for O { fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_stop_on_disconnect(self.as_ref().to_glib_none().0, stop_on_disconnect.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_stop_on_disconnect( + self.as_ref().to_glib_none().0, + stop_on_disconnect.to_glib(), + ); } } fn set_suspend_mode(&self, mode: RTSPSuspendMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_suspend_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_suspend_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_transport_mode(&self, mode: RTSPTransportMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_set_transport_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } @@ -581,52 +748,79 @@ impl> RTSPMediaExt for O { fn suspend(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_media_suspend(self.as_ref().to_glib_none().0), "Failed to suspend media") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_media_suspend(self.as_ref().to_glib_none().0), + "Failed to suspend media" + ) } } fn take_pipeline>(&self, pipeline: &P) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_take_pipeline(self.as_ref().to_glib_none().0, pipeline.as_ref().to_glib_full()); + gst_rtsp_server_sys::gst_rtsp_media_take_pipeline( + self.as_ref().to_glib_none().0, + pipeline.as_ref().to_glib_full(), + ); } } fn unprepare(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_media_unprepare(self.as_ref().to_glib_none().0), "Failed to unprepare media") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_media_unprepare(self.as_ref().to_glib_none().0), + "Failed to unprepare media" + ) } } fn unsuspend(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_media_unsuspend(self.as_ref().to_glib_none().0), "Failed to unsuspend media") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_media_unsuspend(self.as_ref().to_glib_none().0), + "Failed to unsuspend media" + ) } } fn use_time_provider(&self, time_provider: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_use_time_provider(self.as_ref().to_glib_none().0, time_provider.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_use_time_provider( + self.as_ref().to_glib_none().0, + time_provider.to_glib(), + ); } } fn get_property_bind_mcast_address(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"bind-mcast-address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"bind-mcast-address\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_bind_mcast_address(&self, bind_mcast_address: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"bind-mcast-address\0".as_ptr() as *const _, Value::from(&bind_mcast_address).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"bind-mcast-address\0".as_ptr() as *const _, + Value::from(&bind_mcast_address).to_glib_none().0, + ); } } fn get_property_eos_shutdown(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"eos-shutdown\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"eos-shutdown\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -634,21 +828,33 @@ impl> RTSPMediaExt for O { fn get_property_max_mcast_ttl(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-mcast-ttl\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-mcast-ttl\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_max_mcast_ttl(&self, max_mcast_ttl: u32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-mcast-ttl\0".as_ptr() as *const _, Value::from(&max_mcast_ttl).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-mcast-ttl\0".as_ptr() as *const _, + Value::from(&max_mcast_ttl).to_glib_none().0, + ); } } fn get_property_reusable(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"reusable\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"reusable\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -656,7 +862,11 @@ impl> RTSPMediaExt for O { fn get_property_shared(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"shared\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"shared\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -664,294 +874,549 @@ impl> RTSPMediaExt for O { fn get_property_stop_on_disconnect(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"stop-on-disconnect\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"stop-on-disconnect\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_time_provider(&self, time_provider: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"time-provider\0".as_ptr() as *const _, Value::from(&time_provider).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"time-provider\0".as_ptr() as *const _, + Value::from(&time_provider).to_glib_none().0, + ); } } - fn connect_new_state(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_state_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, object: libc::c_int, f: glib_sys::gpointer) - where P: IsA + fn connect_new_state( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_state_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + object: libc::c_int, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-state\0".as_ptr() as *const _, - Some(transmute(new_state_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-state\0".as_ptr() as *const _, + Some(transmute(new_state_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_new_stream(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_stream_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, object: *mut gst_rtsp_server_sys::GstRTSPStream, f: glib_sys::gpointer) - where P: IsA + fn connect_new_stream( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_stream_trampoline< + P, + F: Fn(&P, &RTSPStream) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + object: *mut gst_rtsp_server_sys::GstRTSPStream, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPMedia::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-stream\0".as_ptr() as *const _, - Some(transmute(new_stream_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-stream\0".as_ptr() as *const _, + Some(transmute(new_stream_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_prepared(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn prepared_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn prepared_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"prepared\0".as_ptr() as *const _, - Some(transmute(prepared_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"prepared\0".as_ptr() as *const _, + Some(transmute(prepared_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_removed_stream(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn removed_stream_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, object: *mut gst_rtsp_server_sys::GstRTSPStream, f: glib_sys::gpointer) - where P: IsA + fn connect_removed_stream( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn removed_stream_trampoline< + P, + F: Fn(&P, &RTSPStream) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + object: *mut gst_rtsp_server_sys::GstRTSPStream, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPMedia::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"removed-stream\0".as_ptr() as *const _, - Some(transmute(removed_stream_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"removed-stream\0".as_ptr() as *const _, + Some(transmute(removed_stream_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_target_state(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn target_state_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, object: libc::c_int, f: glib_sys::gpointer) - where P: IsA + fn connect_target_state( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn target_state_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + object: libc::c_int, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"target-state\0".as_ptr() as *const _, - Some(transmute(target_state_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"target-state\0".as_ptr() as *const _, + Some(transmute(target_state_trampoline:: as usize)), + Box_::into_raw(f), + ) } } fn connect_unprepared(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn unprepared_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn unprepared_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"unprepared\0".as_ptr() as *const _, - Some(transmute(unprepared_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"unprepared\0".as_ptr() as *const _, + Some(transmute(unprepared_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_bind_mcast_address_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_bind_mcast_address_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_bind_mcast_address_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_bind_mcast_address_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::bind-mcast-address\0".as_ptr() as *const _, - Some(transmute(notify_bind_mcast_address_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::bind-mcast-address\0".as_ptr() as *const _, + Some(transmute( + notify_bind_mcast_address_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_buffer_size_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_buffer_size_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_buffer_size_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, - Some(transmute(notify_buffer_size_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::buffer-size\0".as_ptr() as *const _, + Some(transmute(notify_buffer_size_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_clock_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_clock_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_clock_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _, - Some(transmute(notify_clock_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::clock\0".as_ptr() as *const _, + Some(transmute(notify_clock_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_eos_shutdown_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_eos_shutdown_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_eos_shutdown_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, - Some(transmute(notify_eos_shutdown_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::eos-shutdown\0".as_ptr() as *const _, + Some(transmute( + notify_eos_shutdown_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_latency_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_latency_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, - Some(transmute(notify_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::latency\0".as_ptr() as *const _, + Some(transmute(notify_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_mcast_ttl_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_mcast_ttl_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_mcast_ttl_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_mcast_ttl_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-mcast-ttl\0".as_ptr() as *const _, - Some(transmute(notify_max_mcast_ttl_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-mcast-ttl\0".as_ptr() as *const _, + Some(transmute( + notify_max_mcast_ttl_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_profiles_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_profiles_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, - Some(transmute(notify_profiles_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::profiles\0".as_ptr() as *const _, + Some(transmute(notify_profiles_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_protocols_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_protocols_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, - Some(transmute(notify_protocols_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::protocols\0".as_ptr() as *const _, + Some(transmute(notify_protocols_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_reusable_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_reusable_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_reusable_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_reusable_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::reusable\0".as_ptr() as *const _, - Some(transmute(notify_reusable_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::reusable\0".as_ptr() as *const _, + Some(transmute(notify_reusable_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_shared_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_shared_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_shared_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _, - Some(transmute(notify_shared_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::shared\0".as_ptr() as *const _, + Some(transmute(notify_shared_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_stop_on_disconnect_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_stop_on_disconnect_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_stop_on_disconnect_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, - Some(transmute(notify_stop_on_disconnect_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::stop-on-disconnect\0".as_ptr() as *const _, + Some(transmute( + notify_stop_on_disconnect_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_suspend_mode_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_suspend_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_suspend_mode_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, - Some(transmute(notify_suspend_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::suspend-mode\0".as_ptr() as *const _, + Some(transmute( + notify_suspend_mode_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_time_provider_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_time_provider_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_time_provider_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_time_provider_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::time-provider\0".as_ptr() as *const _, - Some(transmute(notify_time_provider_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::time-provider\0".as_ptr() as *const _, + Some(transmute( + notify_time_provider_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_transport_mode_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMedia, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_transport_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_transport_mode_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMedia, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, - Some(transmute(notify_transport_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::transport-mode\0".as_ptr() as *const _, + Some(transmute( + notify_transport_mode_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs index 5ecc6d27c..189e6fa3a 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs @@ -2,20 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPAddressPool; -use RTSPMedia; -use RTSPPublishClockMode; -use RTSPSuspendMode; -use RTSPTransportMode; use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst; @@ -23,6 +18,11 @@ use gst_rtsp; use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPAddressPool; +use RTSPMedia; +use RTSPPublishClockMode; +use RTSPSuspendMode; +use RTSPTransportMode; glib_wrapper! { pub struct RTSPMediaFactory(Object); @@ -35,9 +35,7 @@ glib_wrapper! { impl RTSPMediaFactory { pub fn new() -> RTSPMediaFactory { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_new()) } } } @@ -159,35 +157,80 @@ pub trait RTSPMediaFactoryExt: 'static { fn get_property_stop_on_disconnect(&self) -> bool; - fn connect_media_configure(&self, f: F) -> SignalHandlerId; + fn connect_media_configure( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_media_constructed(&self, f: F) -> SignalHandlerId; + fn connect_media_constructed( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_bind_mcast_address_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_bind_mcast_address_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_buffer_size_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_clock_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_eos_shutdown_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_launch_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_launch_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_max_mcast_ttl_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_mcast_ttl_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_shared_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_stop_on_disconnect_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_suspend_mode_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_transport_mode_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPMediaFactoryExt for O { @@ -197,38 +240,56 @@ impl> RTSPMediaFactoryExt for O { fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_construct(self.as_ref().to_glib_none().0, url.to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_construct( + self.as_ref().to_glib_none().0, + url.to_glib_none().0, + )) } } fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_factory_create_element(self.as_ref().to_glib_none().0, url.to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_media_factory_create_element( + self.as_ref().to_glib_none().0, + url.to_glib_none().0, + )) } } fn get_address_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_address_pool(self.as_ref().to_glib_none().0)) + from_glib_full( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_address_pool( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_buffer_size(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_get_buffer_size(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_media_factory_get_buffer_size( + self.as_ref().to_glib_none().0, + ) } } fn get_clock(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_clock(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_clock( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_do_retransmission(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_do_retransmission(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_do_retransmission( + self.as_ref().to_glib_none().0, + ), + ) } } @@ -240,26 +301,36 @@ impl> RTSPMediaFactoryExt for O { fn get_launch(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_launch(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_launch( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_max_mcast_ttl(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_get_max_mcast_ttl(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_media_factory_get_max_mcast_ttl( + self.as_ref().to_glib_none().0, + ) } } fn get_media_gtype(&self) -> glib::types::Type { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_media_gtype(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_media_gtype( + self.as_ref().to_glib_none().0, + )) } } fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_get_multicast_iface(self.as_ref().to_glib_none().0)) + from_glib_full( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_multicast_iface( + self.as_ref().to_glib_none().0, + ), + ) } } @@ -269,131 +340,198 @@ impl> RTSPMediaFactoryExt for O { fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_profiles(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_profiles( + self.as_ref().to_glib_none().0, + )) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_protocols(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_protocols( + self.as_ref().to_glib_none().0, + )) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_publish_clock_mode(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_publish_clock_mode( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_retransmission_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_retransmission_time(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_retransmission_time( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_suspend_mode(&self) -> RTSPSuspendMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_suspend_mode(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_suspend_mode( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_transport_mode(&self) -> RTSPTransportMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_get_transport_mode(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_get_transport_mode( + self.as_ref().to_glib_none().0, + ), + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn is_bind_mcast_address(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_bind_mcast_address(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_is_bind_mcast_address( + self.as_ref().to_glib_none().0, + ), + ) } } fn is_eos_shutdown(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_eos_shutdown(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_eos_shutdown( + self.as_ref().to_glib_none().0, + )) } } fn is_shared(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_shared(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_shared( + self.as_ref().to_glib_none().0, + )) } } fn is_stop_on_disonnect(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_is_stop_on_disonnect(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_is_stop_on_disonnect( + self.as_ref().to_glib_none().0, + ), + ) } } fn set_address_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_address_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_bind_mcast_address(&self, bind_mcast_addr: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_bind_mcast_address(self.as_ref().to_glib_none().0, bind_mcast_addr.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_bind_mcast_address( + self.as_ref().to_glib_none().0, + bind_mcast_addr.to_glib(), + ); } } fn set_buffer_size(&self, size: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_buffer_size(self.as_ref().to_glib_none().0, size); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_buffer_size( + self.as_ref().to_glib_none().0, + size, + ); } } fn set_clock>(&self, clock: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_clock( + self.as_ref().to_glib_none().0, + clock.map(|p| p.as_ref()).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_do_retransmission(&self, do_retransmission: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_do_retransmission(self.as_ref().to_glib_none().0, do_retransmission.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_do_retransmission( + self.as_ref().to_glib_none().0, + do_retransmission.to_glib(), + ); } } fn set_eos_shutdown(&self, eos_shutdown: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_eos_shutdown(self.as_ref().to_glib_none().0, eos_shutdown.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_eos_shutdown( + self.as_ref().to_glib_none().0, + eos_shutdown.to_glib(), + ); } } fn set_latency(&self, latency: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_latency(self.as_ref().to_glib_none().0, latency); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_latency( + self.as_ref().to_glib_none().0, + latency, + ); } } fn set_launch(&self, launch: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_launch(self.as_ref().to_glib_none().0, launch.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_launch( + self.as_ref().to_glib_none().0, + launch.to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_max_mcast_ttl(&self, ttl: u32) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_media_factory_set_max_mcast_ttl(self.as_ref().to_glib_none().0, ttl)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_media_factory_set_max_mcast_ttl( + self.as_ref().to_glib_none().0, + ttl, + ), + ) } } fn set_media_gtype(&self, media_gtype: glib::types::Type) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_media_gtype(self.as_ref().to_glib_none().0, media_gtype.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_media_gtype( + self.as_ref().to_glib_none().0, + media_gtype.to_glib(), + ); } } fn set_multicast_iface(&self, multicast_iface: Option<&str>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_multicast_iface( + self.as_ref().to_glib_none().0, + multicast_iface.to_glib_none().0, + ); } } @@ -403,70 +541,106 @@ impl> RTSPMediaFactoryExt for O { fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_profiles( + self.as_ref().to_glib_none().0, + profiles.to_glib(), + ); } } fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_protocols( + self.as_ref().to_glib_none().0, + protocols.to_glib(), + ); } } fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_publish_clock_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_retransmission_time(&self, time: gst::ClockTime) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_retransmission_time( + self.as_ref().to_glib_none().0, + time.to_glib(), + ); } } fn set_shared(&self, shared: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_shared(self.as_ref().to_glib_none().0, shared.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_shared( + self.as_ref().to_glib_none().0, + shared.to_glib(), + ); } } fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_stop_on_disconnect(self.as_ref().to_glib_none().0, stop_on_disconnect.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_stop_on_disconnect( + self.as_ref().to_glib_none().0, + stop_on_disconnect.to_glib(), + ); } } fn set_suspend_mode(&self, mode: RTSPSuspendMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_suspend_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_suspend_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_transport_mode(&self, mode: RTSPTransportMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_media_factory_set_transport_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn get_property_bind_mcast_address(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"bind-mcast-address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"bind-mcast-address\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_bind_mcast_address(&self, bind_mcast_address: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"bind-mcast-address\0".as_ptr() as *const _, Value::from(&bind_mcast_address).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"bind-mcast-address\0".as_ptr() as *const _, + Value::from(&bind_mcast_address).to_glib_none().0, + ); } } fn get_property_eos_shutdown(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"eos-shutdown\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"eos-shutdown\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -474,21 +648,33 @@ impl> RTSPMediaFactoryExt for O { fn get_property_max_mcast_ttl(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-mcast-ttl\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-mcast-ttl\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_max_mcast_ttl(&self, max_mcast_ttl: u32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"max-mcast-ttl\0".as_ptr() as *const _, Value::from(&max_mcast_ttl).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"max-mcast-ttl\0".as_ptr() as *const _, + Value::from(&max_mcast_ttl).to_glib_none().0, + ); } } fn get_property_shared(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"shared\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"shared\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -496,218 +682,420 @@ impl> RTSPMediaFactoryExt for O { fn get_property_stop_on_disconnect(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"stop-on-disconnect\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"stop-on-disconnect\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - fn connect_media_configure(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn media_configure_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, object: *mut gst_rtsp_server_sys::GstRTSPMedia, f: glib_sys::gpointer) - where P: IsA + fn connect_media_configure( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn media_configure_trampoline< + P, + F: Fn(&P, &RTSPMedia) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + object: *mut gst_rtsp_server_sys::GstRTSPMedia, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"media-configure\0".as_ptr() as *const _, - Some(transmute(media_configure_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"media-configure\0".as_ptr() as *const _, + Some(transmute(media_configure_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_media_constructed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn media_constructed_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, object: *mut gst_rtsp_server_sys::GstRTSPMedia, f: glib_sys::gpointer) - where P: IsA + fn connect_media_constructed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn media_constructed_trampoline< + P, + F: Fn(&P, &RTSPMedia) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + object: *mut gst_rtsp_server_sys::GstRTSPMedia, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"media-constructed\0".as_ptr() as *const _, - Some(transmute(media_constructed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"media-constructed\0".as_ptr() as *const _, + Some(transmute(media_constructed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_bind_mcast_address_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_bind_mcast_address_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_bind_mcast_address_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_bind_mcast_address_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::bind-mcast-address\0".as_ptr() as *const _, - Some(transmute(notify_bind_mcast_address_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::bind-mcast-address\0".as_ptr() as *const _, + Some(transmute( + notify_bind_mcast_address_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_buffer_size_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_buffer_size_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_buffer_size_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, - Some(transmute(notify_buffer_size_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::buffer-size\0".as_ptr() as *const _, + Some(transmute(notify_buffer_size_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_clock_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_clock_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_clock_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _, - Some(transmute(notify_clock_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::clock\0".as_ptr() as *const _, + Some(transmute(notify_clock_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_eos_shutdown_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_eos_shutdown_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_eos_shutdown_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, - Some(transmute(notify_eos_shutdown_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::eos-shutdown\0".as_ptr() as *const _, + Some(transmute( + notify_eos_shutdown_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_latency_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_latency_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, - Some(transmute(notify_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::latency\0".as_ptr() as *const _, + Some(transmute(notify_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_launch_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_launch_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_launch_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_launch_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::launch\0".as_ptr() as *const _, - Some(transmute(notify_launch_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::launch\0".as_ptr() as *const _, + Some(transmute(notify_launch_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_mcast_ttl_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_mcast_ttl_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_mcast_ttl_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_mcast_ttl_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-mcast-ttl\0".as_ptr() as *const _, - Some(transmute(notify_max_mcast_ttl_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-mcast-ttl\0".as_ptr() as *const _, + Some(transmute( + notify_max_mcast_ttl_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_profiles_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_profiles_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, - Some(transmute(notify_profiles_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::profiles\0".as_ptr() as *const _, + Some(transmute(notify_profiles_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_protocols_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_protocols_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, - Some(transmute(notify_protocols_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::protocols\0".as_ptr() as *const _, + Some(transmute(notify_protocols_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_shared_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_shared_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_shared_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _, - Some(transmute(notify_shared_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::shared\0".as_ptr() as *const _, + Some(transmute(notify_shared_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_stop_on_disconnect_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_stop_on_disconnect_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_stop_on_disconnect_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, - Some(transmute(notify_stop_on_disconnect_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::stop-on-disconnect\0".as_ptr() as *const _, + Some(transmute( + notify_stop_on_disconnect_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_suspend_mode_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_suspend_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_suspend_mode_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, - Some(transmute(notify_suspend_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::suspend-mode\0".as_ptr() as *const _, + Some(transmute( + notify_suspend_mode_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_transport_mode_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_transport_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_transport_mode_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, - Some(transmute(notify_transport_mode_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::transport-mode\0".as_ptr() as *const _, + Some(transmute( + notify_transport_mode_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs b/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs index 769e3731a..a5b50a3af 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs @@ -2,20 +2,20 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPMediaFactory; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPMediaFactory; glib_wrapper! { pub struct RTSPMediaFactoryURI(Object) @extends RTSPMediaFactory; @@ -28,9 +28,7 @@ glib_wrapper! { impl RTSPMediaFactoryURI { pub fn new() -> RTSPMediaFactoryURI { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_uri_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_uri_new()) } } } @@ -54,63 +52,104 @@ pub trait RTSPMediaFactoryURIExt: 'static { fn set_property_use_gstpay(&self, use_gstpay: bool); - fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_uri_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_use_gstpay_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_use_gstpay_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPMediaFactoryURIExt for O { fn get_uri(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_uri_get_uri(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_media_factory_uri_get_uri( + self.as_ref().to_glib_none().0, + )) } } fn set_uri(&self, uri: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_uri_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_media_factory_uri_set_uri( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + ); } } fn get_property_use_gstpay(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"use-gstpay\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"use-gstpay\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_use_gstpay(&self, use_gstpay: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"use-gstpay\0".as_ptr() as *const _, Value::from(&use_gstpay).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"use-gstpay\0".as_ptr() as *const _, + Value::from(&use_gstpay).to_glib_none().0, + ); } } - fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_uri_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactoryURI, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_uri_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_uri_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactoryURI, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::uri\0".as_ptr() as *const _, + Some(transmute(notify_uri_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_use_gstpay_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_use_gstpay_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPMediaFactoryURI, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_use_gstpay_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_use_gstpay_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPMediaFactoryURI, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::use-gstpay\0".as_ptr() as *const _, - Some(transmute(notify_use_gstpay_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::use-gstpay\0".as_ptr() as *const _, + Some(transmute(notify_use_gstpay_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs b/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs index 5d7ef5562..bed80329c 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPMediaFactory; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_rtsp; use gst_rtsp_server_sys; use std::mem; +use RTSPMediaFactory; glib_wrapper! { pub struct RTSPMountPoints(Object); @@ -21,9 +21,7 @@ glib_wrapper! { impl RTSPMountPoints { pub fn new() -> RTSPMountPoints { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_new()) } } } @@ -51,27 +49,41 @@ pub trait RTSPMountPointsExt: 'static { impl> RTSPMountPointsExt for O { fn add_factory>(&self, path: &str, factory: &P) { unsafe { - gst_rtsp_server_sys::gst_rtsp_mount_points_add_factory(self.as_ref().to_glib_none().0, path.to_glib_none().0, factory.as_ref().to_glib_full()); + gst_rtsp_server_sys::gst_rtsp_mount_points_add_factory( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + factory.as_ref().to_glib_full(), + ); } } fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_make_path(self.as_ref().to_glib_none().0, url.to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_make_path( + self.as_ref().to_glib_none().0, + url.to_glib_none().0, + )) } } fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) { unsafe { let mut matched = mem::uninitialized(); - let ret = from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_match(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched)); + let ret = from_glib_full(gst_rtsp_server_sys::gst_rtsp_mount_points_match( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + &mut matched, + )); (ret, matched) } } fn remove_factory(&self, path: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_mount_points_remove_factory(self.as_ref().to_glib_none().0, path.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_mount_points_remove_factory( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + ); } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_server.rs b/gstreamer-rtsp-server/src/auto/rtsp_server.rs index 8c6073ea6..ed7a3c353 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_server.rs @@ -2,6 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use gio; +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::GString; +use glib_sys; +use gst_rtsp_server_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use std::ptr; use Error; use RTSPAuth; use RTSPClient; @@ -9,19 +22,6 @@ use RTSPFilterResult; use RTSPMountPoints; use RTSPSessionPool; use RTSPThreadPool; -use gio; -use glib; -use glib::GString; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gst_rtsp_server_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; -use std::ptr; glib_wrapper! { pub struct RTSPServer(Object); @@ -34,15 +34,24 @@ glib_wrapper! { impl RTSPServer { pub fn new() -> RTSPServer { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_new()) } } - pub fn io_func, Q: IsA>(socket: &P, condition: glib::IOCondition, server: &Q) -> Result<(), glib::error::BoolError> { + pub fn io_func, Q: IsA>( + socket: &P, + condition: glib::IOCondition, + server: &Q, + ) -> Result<(), glib::error::BoolError> { skip_assert_initialized!(); unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_server_io_func(socket.as_ref().to_glib_none().0, condition.to_glib(), server.as_ref().to_glib_none().0), "Failed to connect the source") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_server_io_func( + socket.as_ref().to_glib_none().0, + condition.to_glib(), + server.as_ref().to_glib_none().0 + ), + "Failed to connect the source" + ) } } } @@ -59,11 +68,20 @@ unsafe impl Sync for RTSPServer {} pub const NONE_RTSP_SERVER: Option<&RTSPServer> = None; pub trait RTSPServerExt: 'static { - fn client_filter(&self, func: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>) -> Vec; + fn client_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>, + ) -> Vec; - fn create_socket>(&self, cancellable: Option<&P>) -> Result; + fn create_socket>( + &self, + cancellable: Option<&P>, + ) -> Result; - fn create_source>(&self, cancellable: Option<&P>) -> Result; + fn create_source>( + &self, + cancellable: Option<&P>, + ) -> Result; fn get_address(&self) -> Option; @@ -95,30 +113,68 @@ pub trait RTSPServerExt: 'static { fn set_thread_pool>(&self, pool: Option<&P>); - fn transfer_connection>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Option<&str>) -> Result<(), glib::error::BoolError>; + fn transfer_connection>( + &self, + socket: &P, + ip: &str, + port: i32, + initial_buffer: Option<&str>, + ) -> Result<(), glib::error::BoolError>; - fn connect_client_connected(&self, f: F) -> SignalHandlerId; + fn connect_client_connected( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_address_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_address_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_backlog_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_bound_port_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_mount_points_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_service_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_service_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_session_pool_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPServerExt for O { - fn client_filter(&self, func: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>) -> Vec { - let func_data: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)> = func; - unsafe extern "C" fn func_func(server: *mut gst_rtsp_server_sys::GstRTSPServer, client: *mut gst_rtsp_server_sys::GstRTSPClient, user_data: glib_sys::gpointer) -> gst_rtsp_server_sys::GstRTSPFilterResult { + fn client_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>, + ) -> Vec { + let func_data: Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)> = + func; + unsafe extern "C" fn func_func( + server: *mut gst_rtsp_server_sys::GstRTSPServer, + client: *mut gst_rtsp_server_sys::GstRTSPClient, + user_data: glib_sys::gpointer, + ) -> gst_rtsp_server_sys::GstRTSPFilterResult { let server = from_glib_borrow(server); let client = from_glib_borrow(client); - let callback: *mut Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>; + let callback: *mut Option< + &mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult), + > = user_data as *const _ as usize + as *mut Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)>; let res = if let Some(ref mut callback) = *callback { callback(&server, &client) } else { @@ -126,45 +182,81 @@ impl> RTSPServerExt for O { }; res.to_glib() } - let func = if func_data.is_some() { Some(func_func as _) } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult)> = &func_data; + let func = if func_data.is_some() { + Some(func_func as _) + } else { + None + }; + let super_callback0: &Option< + &mut dyn (FnMut(&RTSPServer, &RTSPClient) -> RTSPFilterResult), + > = &func_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_client_filter(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full( + gst_rtsp_server_sys::gst_rtsp_server_client_filter( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + ), + ) } } - fn create_socket>(&self, cancellable: Option<&P>) -> Result { + fn create_socket>( + &self, + cancellable: Option<&P>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = gst_rtsp_server_sys::gst_rtsp_server_create_socket(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_rtsp_server_sys::gst_rtsp_server_create_socket( + self.as_ref().to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } - fn create_source>(&self, cancellable: Option<&P>) -> Result { + fn create_source>( + &self, + cancellable: Option<&P>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = gst_rtsp_server_sys::gst_rtsp_server_create_source(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_rtsp_server_sys::gst_rtsp_server_create_source( + self.as_ref().to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } fn get_address(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_address(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_address( + self.as_ref().to_glib_none().0, + )) } } fn get_auth(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_auth(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_auth( + self.as_ref().to_glib_none().0, + )) } } fn get_backlog(&self) -> i32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0) } } fn get_bound_port(&self) -> i32 { @@ -175,171 +267,302 @@ impl> RTSPServerExt for O { fn get_mount_points(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_mount_points(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_mount_points( + self.as_ref().to_glib_none().0, + )) } } fn get_service(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_service(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_service( + self.as_ref().to_glib_none().0, + )) } } fn get_session_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_session_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_session_pool( + self.as_ref().to_glib_none().0, + )) } } fn get_thread_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_thread_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_server_get_thread_pool( + self.as_ref().to_glib_none().0, + )) } } fn set_address(&self, address: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_address(self.as_ref().to_glib_none().0, address.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_address( + self.as_ref().to_glib_none().0, + address.to_glib_none().0, + ); } } fn set_auth>(&self, auth: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_auth( + self.as_ref().to_glib_none().0, + auth.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn set_backlog(&self, backlog: i32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_backlog(self.as_ref().to_glib_none().0, backlog); + gst_rtsp_server_sys::gst_rtsp_server_set_backlog( + self.as_ref().to_glib_none().0, + backlog, + ); } } fn set_mount_points>(&self, mounts: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_mount_points( + self.as_ref().to_glib_none().0, + mounts.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn set_service(&self, service: &str) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_service(self.as_ref().to_glib_none().0, service.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_service( + self.as_ref().to_glib_none().0, + service.to_glib_none().0, + ); } } fn set_session_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_session_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_session_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } fn set_thread_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_server_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_server_set_thread_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } - fn transfer_connection>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Option<&str>) -> Result<(), glib::error::BoolError> { + fn transfer_connection>( + &self, + socket: &P, + ip: &str, + port: i32, + initial_buffer: Option<&str>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_server_transfer_connection(self.as_ref().to_glib_none().0, socket.as_ref().to_glib_full(), ip.to_glib_none().0, port, initial_buffer.to_glib_none().0), "Failed to transfer to the connection") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_server_transfer_connection( + self.as_ref().to_glib_none().0, + socket.as_ref().to_glib_full(), + ip.to_glib_none().0, + port, + initial_buffer.to_glib_none().0 + ), + "Failed to transfer to the connection" + ) } } - fn connect_client_connected(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn client_connected_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, object: *mut gst_rtsp_server_sys::GstRTSPClient, f: glib_sys::gpointer) - where P: IsA + fn connect_client_connected( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn client_connected_trampoline< + P, + F: Fn(&P, &RTSPClient) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + object: *mut gst_rtsp_server_sys::GstRTSPClient, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPServer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPServer::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"client-connected\0".as_ptr() as *const _, - Some(transmute(client_connected_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"client-connected\0".as_ptr() as *const _, + Some(transmute(client_connected_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_address_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_address_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_address_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_address_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _, - Some(transmute(notify_address_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::address\0".as_ptr() as *const _, + Some(transmute(notify_address_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_backlog_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_backlog_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_backlog_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::backlog\0".as_ptr() as *const _, - Some(transmute(notify_backlog_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::backlog\0".as_ptr() as *const _, + Some(transmute(notify_backlog_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_bound_port_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_bound_port_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_bound_port_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::bound-port\0".as_ptr() as *const _, - Some(transmute(notify_bound_port_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::bound-port\0".as_ptr() as *const _, + Some(transmute(notify_bound_port_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_mount_points_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_mount_points_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_mount_points_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _, - Some(transmute(notify_mount_points_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::mount-points\0".as_ptr() as *const _, + Some(transmute( + notify_mount_points_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_service_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_service_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_service_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_service_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::service\0".as_ptr() as *const _, - Some(transmute(notify_service_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::service\0".as_ptr() as *const _, + Some(transmute(notify_service_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_session_pool_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPServer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_session_pool_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_session_pool_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPServer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _, - Some(transmute(notify_session_pool_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::session-pool\0".as_ptr() as *const _, + Some(transmute( + notify_session_pool_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session.rs b/gstreamer-rtsp-server/src/auto/rtsp_session.rs index 0403b2825..3cd19209d 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPFilterResult; -use RTSPMedia; -use RTSPSessionMedia; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; +use RTSPFilterResult; +use RTSPMedia; +use RTSPSessionMedia; glib_wrapper! { pub struct RTSPSession(Object); @@ -32,7 +32,9 @@ impl RTSPSession { pub fn new(sessionid: &str) -> RTSPSession { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_new(sessionid.to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_new( + sessionid.to_glib_none().0, + )) } } } @@ -45,7 +47,10 @@ pub const NONE_RTSP_SESSION: Option<&RTSPSession> = None; pub trait RTSPSessionExt: 'static { fn allow_expire(&self); - fn filter(&self, func: Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)>) -> Vec; + fn filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)>, + ) -> Vec; fn get_header(&self) -> Option; @@ -77,9 +82,15 @@ pub trait RTSPSessionExt: 'static { fn set_property_timeout_always_visible(&self, timeout_always_visible: bool); - fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_timeout_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_timeout_always_visible_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_timeout_always_visible_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPSessionExt for O { @@ -89,12 +100,26 @@ impl> RTSPSessionExt for O { } } - fn filter(&self, func: Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)>) -> Vec { - let func_data: Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)> = func; - unsafe extern "C" fn func_func(sess: *mut gst_rtsp_server_sys::GstRTSPSession, media: *mut gst_rtsp_server_sys::GstRTSPSessionMedia, user_data: glib_sys::gpointer) -> gst_rtsp_server_sys::GstRTSPFilterResult { + fn filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)>, + ) -> Vec { + let func_data: Option< + &mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult), + > = func; + unsafe extern "C" fn func_func( + sess: *mut gst_rtsp_server_sys::GstRTSPSession, + media: *mut gst_rtsp_server_sys::GstRTSPSessionMedia, + user_data: glib_sys::gpointer, + ) -> gst_rtsp_server_sys::GstRTSPFilterResult { let sess = from_glib_borrow(sess); let media = from_glib_borrow(media); - let callback: *mut Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)>; + let callback: *mut Option< + &mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult), + > = user_data as *const _ as usize + as *mut Option< + &mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult), + >; let res = if let Some(ref mut callback) = *callback { callback(&sess, &media) } else { @@ -102,37 +127,53 @@ impl> RTSPSessionExt for O { }; res.to_glib() } - let func = if func_data.is_some() { Some(func_func as _) } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult)> = &func_data; + let func = if func_data.is_some() { + Some(func_func as _) + } else { + None + }; + let super_callback0: &Option< + &mut dyn (FnMut(&RTSPSession, &RTSPSessionMedia) -> RTSPFilterResult), + > = &func_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_filter(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_filter( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + )) } } fn get_header(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_get_header(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_get_header( + self.as_ref().to_glib_none().0, + )) } } fn get_media(&self, path: &str) -> (Option, i32) { unsafe { let mut matched = mem::uninitialized(); - let ret = from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_get_media(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched)); + let ret = from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_get_media( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + &mut matched, + )); (ret, matched) } } fn get_sessionid(&self) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_get_sessionid(self.as_ref().to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_get_sessionid( + self.as_ref().to_glib_none().0, + )) } } fn get_timeout(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_session_get_timeout(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_session_get_timeout(self.as_ref().to_glib_none().0) } } //fn is_expired(&self, now: /*Ignored*/&mut glib::TimeVal) -> bool { @@ -141,13 +182,20 @@ impl> RTSPSessionExt for O { fn is_expired_usec(&self, now: i64) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_session_is_expired_usec(self.as_ref().to_glib_none().0, now)) + from_glib(gst_rtsp_server_sys::gst_rtsp_session_is_expired_usec( + self.as_ref().to_glib_none().0, + now, + )) } } fn manage_media>(&self, path: &str, media: &P) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_manage_media(self.as_ref().to_glib_none().0, path.to_glib_none().0, media.as_ref().to_glib_full())) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_manage_media( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + media.as_ref().to_glib_full(), + )) } } @@ -157,7 +205,10 @@ impl> RTSPSessionExt for O { fn next_timeout_usec(&self, now: i64) -> i32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_session_next_timeout_usec(self.as_ref().to_glib_none().0, now) + gst_rtsp_server_sys::gst_rtsp_session_next_timeout_usec( + self.as_ref().to_glib_none().0, + now, + ) } } @@ -169,13 +220,19 @@ impl> RTSPSessionExt for O { fn release_media>(&self, media: &P) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_session_release_media(self.as_ref().to_glib_none().0, media.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_session_release_media( + self.as_ref().to_glib_none().0, + media.as_ref().to_glib_none().0, + )) } } fn set_timeout(&self, timeout: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_session_set_timeout(self.as_ref().to_glib_none().0, timeout); + gst_rtsp_server_sys::gst_rtsp_session_set_timeout( + self.as_ref().to_glib_none().0, + timeout, + ); } } @@ -188,42 +245,77 @@ impl> RTSPSessionExt for O { fn get_property_timeout_always_visible(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"timeout-always-visible\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"timeout-always-visible\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_timeout_always_visible(&self, timeout_always_visible: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"timeout-always-visible\0".as_ptr() as *const _, Value::from(&timeout_always_visible).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"timeout-always-visible\0".as_ptr() as *const _, + Value::from(&timeout_always_visible).to_glib_none().0, + ); } } - fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_timeout_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPSession, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_timeout_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_timeout_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPSession, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPSession::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, - Some(transmute(notify_timeout_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeout\0".as_ptr() as *const _, + Some(transmute(notify_timeout_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_timeout_always_visible_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_timeout_always_visible_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPSession, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_timeout_always_visible_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_timeout_always_visible_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPSession, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPSession::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::timeout-always-visible\0".as_ptr() as *const _, - Some(transmute(notify_timeout_always_visible_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeout-always-visible\0".as_ptr() as *const _, + Some(transmute( + notify_timeout_always_visible_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs index ea5bfa9b4..49df0db08 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs @@ -2,15 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPMedia; -use RTSPStreamTransport; use glib; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst; use gst_rtsp_server_sys; use std::mem; +use RTSPMedia; +use RTSPStreamTransport; glib_wrapper! { pub struct RTSPSessionMedia(Object); @@ -24,7 +24,10 @@ impl RTSPSessionMedia { pub fn new>(path: &str, media: &P) -> RTSPSessionMedia { skip_assert_initialized!(); unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_media_new(path.to_glib_none().0, media.as_ref().to_glib_full())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_media_new( + path.to_glib_none().0, + media.as_ref().to_glib_full(), + )) } } } @@ -66,19 +69,25 @@ impl> RTSPSessionMediaExt for O { fn get_base_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_session_media_get_base_time(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_session_media_get_base_time( + self.as_ref().to_glib_none().0, + )) } } fn get_media(&self) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_media_get_media(self.as_ref().to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_media_get_media( + self.as_ref().to_glib_none().0, + )) } } fn get_rtpinfo(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_media_get_rtpinfo(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_media_get_rtpinfo( + self.as_ref().to_glib_none().0, + )) } } @@ -88,7 +97,10 @@ impl> RTSPSessionMediaExt for O { fn get_transport(&self, idx: u32) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_media_get_transport(self.as_ref().to_glib_none().0, idx)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_session_media_get_transport( + self.as_ref().to_glib_none().0, + idx, + )) } } @@ -100,8 +112,16 @@ impl> RTSPSessionMediaExt for O { fn matches(&self, path: &str) -> Option { unsafe { let mut matched = mem::uninitialized(); - let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_session_media_matches(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched)); - if ret { Some(matched) } else { None } + let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_session_media_matches( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + &mut matched, + )); + if ret { + Some(matched) + } else { + None + } } } @@ -111,7 +131,13 @@ impl> RTSPSessionMediaExt for O { fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_session_media_set_state(self.as_ref().to_glib_none().0, state.to_glib()), "Failed to set state of session media") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_session_media_set_state( + self.as_ref().to_glib_none().0, + state.to_glib() + ), + "Failed to set state of session media" + ) } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs index d7e7dec9d..de590816a 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs @@ -2,18 +2,18 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPFilterResult; -use RTSPSession; use glib; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use RTSPFilterResult; +use RTSPSession; glib_wrapper! { pub struct RTSPSessionPool(Object); @@ -26,9 +26,7 @@ glib_wrapper! { impl RTSPSessionPool { pub fn new() -> RTSPSessionPool { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_new()) } } } @@ -48,7 +46,10 @@ pub trait RTSPSessionPoolExt: 'static { fn create(&self) -> Option; - fn filter(&self, func: Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)>) -> Vec; + fn filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)>, + ) -> Vec; fn find(&self, sessionid: &str) -> Option; @@ -60,9 +61,15 @@ pub trait RTSPSessionPoolExt: 'static { fn set_max_sessions(&self, max: u32); - fn connect_session_removed(&self, f: F) -> SignalHandlerId; + fn connect_session_removed( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_max_sessions_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_sessions_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPSessionPoolExt for O { @@ -74,16 +81,32 @@ impl> RTSPSessionPoolExt for O { fn create(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_create(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_create( + self.as_ref().to_glib_none().0, + )) } } - fn filter(&self, func: Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)>) -> Vec { - let func_data: Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)> = func; - unsafe extern "C" fn func_func(pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool, session: *mut gst_rtsp_server_sys::GstRTSPSession, user_data: glib_sys::gpointer) -> gst_rtsp_server_sys::GstRTSPFilterResult { + fn filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)>, + ) -> Vec { + let func_data: Option< + &mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult), + > = func; + unsafe extern "C" fn func_func( + pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool, + session: *mut gst_rtsp_server_sys::GstRTSPSession, + user_data: glib_sys::gpointer, + ) -> gst_rtsp_server_sys::GstRTSPFilterResult { let pool = from_glib_borrow(pool); let session = from_glib_borrow(session); - let callback: *mut Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)>; + let callback: *mut Option< + &mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult), + > = user_data as *const _ as usize + as *mut Option< + &mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult), + >; let res = if let Some(ref mut callback) = *callback { callback(&pool, &session) } else { @@ -91,68 +114,124 @@ impl> RTSPSessionPoolExt for O { }; res.to_glib() } - let func = if func_data.is_some() { Some(func_func as _) } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult)> = &func_data; + let func = if func_data.is_some() { + Some(func_func as _) + } else { + None + }; + let super_callback0: &Option< + &mut dyn (FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult), + > = &func_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_filter(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_filter( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + )) } } fn find(&self, sessionid: &str) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_find(self.as_ref().to_glib_none().0, sessionid.to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_session_pool_find( + self.as_ref().to_glib_none().0, + sessionid.to_glib_none().0, + )) } } fn get_max_sessions(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_session_pool_get_max_sessions(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_session_pool_get_max_sessions( + self.as_ref().to_glib_none().0, + ) } } fn get_n_sessions(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_session_pool_get_n_sessions(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_session_pool_get_n_sessions( + self.as_ref().to_glib_none().0, + ) } } fn remove>(&self, sess: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_session_pool_remove(self.as_ref().to_glib_none().0, sess.as_ref().to_glib_none().0), "Failed to remove session from pool") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_session_pool_remove( + self.as_ref().to_glib_none().0, + sess.as_ref().to_glib_none().0 + ), + "Failed to remove session from pool" + ) } } fn set_max_sessions(&self, max: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_session_pool_set_max_sessions(self.as_ref().to_glib_none().0, max); + gst_rtsp_server_sys::gst_rtsp_session_pool_set_max_sessions( + self.as_ref().to_glib_none().0, + max, + ); } } - fn connect_session_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn session_removed_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPSessionPool, object: *mut gst_rtsp_server_sys::GstRTSPSession, f: glib_sys::gpointer) - where P: IsA + fn connect_session_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn session_removed_trampoline< + P, + F: Fn(&P, &RTSPSession) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPSessionPool, + object: *mut gst_rtsp_server_sys::GstRTSPSession, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPSessionPool::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"session-removed\0".as_ptr() as *const _, - Some(transmute(session_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"session-removed\0".as_ptr() as *const _, + Some(transmute(session_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_max_sessions_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_sessions_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPSessionPool, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_sessions_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_sessions_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPSessionPool, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-sessions\0".as_ptr() as *const _, - Some(transmute(notify_max_sessions_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-sessions\0".as_ptr() as *const _, + Some(transmute( + notify_max_sessions_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs index b3201bb55..42a4d0337 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs @@ -2,19 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPAddress; -use RTSPAddressPool; -use RTSPFilterResult; -use RTSPPublishClockMode; -use RTSPStreamTransport; use gio; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst; use gst_rtsp; @@ -23,6 +18,11 @@ use gst_sys; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; +use RTSPAddress; +use RTSPAddressPool; +use RTSPFilterResult; +use RTSPPublishClockMode; +use RTSPStreamTransport; glib_wrapper! { pub struct RTSPStream(Object); @@ -33,10 +33,18 @@ glib_wrapper! { } impl RTSPStream { - pub fn new, Q: IsA>(idx: u32, payloader: &P, pad: &Q) -> RTSPStream { + pub fn new, Q: IsA>( + idx: u32, + payloader: &P, + pad: &Q, + ) -> RTSPStream { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_new(idx, payloader.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_new( + idx, + payloader.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0, + )) } } } @@ -48,9 +56,18 @@ pub const NONE_RTSP_STREAM: Option<&RTSPStream> = None; pub trait RTSPStreamExt: 'static { #[cfg(any(feature = "v1_16", feature = "dox"))] - fn add_multicast_client_address(&self, destination: &str, rtp_port: u32, rtcp_port: u32, family: gio::SocketFamily) -> bool; + fn add_multicast_client_address( + &self, + destination: &str, + rtp_port: u32, + rtcp_port: u32, + family: gio::SocketFamily, + ) -> bool; - fn add_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError>; + fn add_transport>( + &self, + trans: &P, + ) -> Result<(), glib::error::BoolError>; //fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_settings: bool) -> bool; @@ -151,11 +168,23 @@ pub trait RTSPStreamExt: 'static { //fn is_transport_supported(&self, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> bool; - fn join_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError>; + fn join_bin, Q: IsA>( + &self, + bin: &P, + rtpbin: &Q, + state: gst::State, + ) -> Result<(), glib::error::BoolError>; - fn leave_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError>; + fn leave_bin, Q: IsA>( + &self, + bin: &P, + rtpbin: &Q, + ) -> Result<(), glib::error::BoolError>; - fn remove_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError>; + fn remove_transport>( + &self, + trans: &P, + ) -> Result<(), glib::error::BoolError>; #[cfg(any(feature = "v1_16", feature = "dox"))] fn request_aux_receiver(&self, sessid: u32) -> Option; @@ -163,12 +192,22 @@ pub trait RTSPStreamExt: 'static { fn request_aux_sender(&self, sessid: u32) -> Option; #[cfg(any(feature = "v1_16", feature = "dox"))] - fn request_ulpfec_decoder>(&self, rtpbin: &P, sessid: u32) -> Option; + fn request_ulpfec_decoder>( + &self, + rtpbin: &P, + sessid: u32, + ) -> Option; #[cfg(any(feature = "v1_16", feature = "dox"))] fn request_ulpfec_encoder(&self, sessid: u32) -> Option; - fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option; + fn reserve_address( + &self, + address: &str, + port: u32, + n_ports: u32, + ttl: u32, + ) -> Option; #[cfg(any(feature = "v1_14", feature = "dox"))] fn seekable(&self) -> bool; @@ -215,39 +254,87 @@ pub trait RTSPStreamExt: 'static { #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_ulpfec_pt(&self, pt: u32); - fn transport_filter(&self, func: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>) -> Vec; + fn transport_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>, + ) -> Vec; fn unblock_linked(&self) -> Result<(), glib::error::BoolError>; - fn update_crypto(&self, ssrc: u32, crypto: Option<&gst::Caps>) -> Result<(), glib::error::BoolError>; + fn update_crypto( + &self, + ssrc: u32, + crypto: Option<&gst::Caps>, + ) -> Result<(), glib::error::BoolError>; #[cfg(any(feature = "v1_16", feature = "dox"))] fn verify_mcast_ttl(&self, ttl: u32) -> bool; - fn connect_new_rtcp_encoder(&self, f: F) -> SignalHandlerId; + fn connect_new_rtcp_encoder( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_new_rtp_encoder(&self, f: F) -> SignalHandlerId; + fn connect_new_rtp_encoder( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_new_rtp_rtcp_decoder(&self, f: F) -> SignalHandlerId; + fn connect_new_rtp_rtcp_decoder( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_control_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_control_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPStreamExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] - fn add_multicast_client_address(&self, destination: &str, rtp_port: u32, rtcp_port: u32, family: gio::SocketFamily) -> bool { + fn add_multicast_client_address( + &self, + destination: &str, + rtp_port: u32, + rtcp_port: u32, + family: gio::SocketFamily, + ) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_add_multicast_client_address(self.as_ref().to_glib_none().0, destination.to_glib_none().0, rtp_port, rtcp_port, family.to_glib())) + from_glib( + gst_rtsp_server_sys::gst_rtsp_stream_add_multicast_client_address( + self.as_ref().to_glib_none().0, + destination.to_glib_none().0, + rtp_port, + rtcp_port, + family.to_glib(), + ), + ) } } - fn add_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError> { + fn add_transport>( + &self, + trans: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_add_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to add transport") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_add_transport( + self.as_ref().to_glib_none().0, + trans.as_ref().to_glib_none().0 + ), + "Failed to add transport" + ) } } @@ -262,7 +349,9 @@ impl> RTSPStreamExt for O { fn get_address_pool(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_address_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_address_pool( + self.as_ref().to_glib_none().0, + )) } } @@ -274,13 +363,17 @@ impl> RTSPStreamExt for O { fn get_caps(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_control(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_control(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_control( + self.as_ref().to_glib_none().0, + )) } } @@ -291,20 +384,18 @@ impl> RTSPStreamExt for O { } fn get_dscp_qos(&self) -> i32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0) } } fn get_index(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0) } } fn get_joined_bin(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_joined_bin(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_joined_bin( + self.as_ref().to_glib_none().0, + )) } } @@ -316,88 +407,121 @@ impl> RTSPStreamExt for O { } fn get_mtu(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_mtu(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_stream_get_mtu(self.as_ref().to_glib_none().0) } } fn get_multicast_address(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_address(self.as_ref().to_glib_none().0, family.to_glib())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_address( + self.as_ref().to_glib_none().0, + family.to_glib(), + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_multicast_client_addresses(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_client_addresses(self.as_ref().to_glib_none().0)) + from_glib_full( + gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_client_addresses( + self.as_ref().to_glib_none().0, + ), + ) } } fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_iface(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_multicast_iface( + self.as_ref().to_glib_none().0, + )) } } fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_profiles(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_profiles( + self.as_ref().to_glib_none().0, + )) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_protocols(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_protocols( + self.as_ref().to_glib_none().0, + )) } } fn get_pt(&self) -> u32 { - unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0) - } + unsafe { gst_rtsp_server_sys::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_publish_clock_mode(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_publish_clock_mode( + self.as_ref().to_glib_none().0, + )) } } fn get_retransmission_pt(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_stream_get_retransmission_pt( + self.as_ref().to_glib_none().0, + ) } } fn get_retransmission_time(&self) -> gst::ClockTime { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_retransmission_time(self.as_ref().to_glib_none().0)) + from_glib( + gst_rtsp_server_sys::gst_rtsp_stream_get_retransmission_time( + self.as_ref().to_glib_none().0, + ), + ) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtcp_multicast_socket(self.as_ref().to_glib_none().0, family.to_glib())) + from_glib_full( + gst_rtsp_server_sys::gst_rtsp_stream_get_rtcp_multicast_socket( + self.as_ref().to_glib_none().0, + family.to_glib(), + ), + ) } } fn get_rtcp_socket(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtcp_socket(self.as_ref().to_glib_none().0, family.to_glib())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtcp_socket( + self.as_ref().to_glib_none().0, + family.to_glib(), + )) } } fn get_rtp_multicast_socket(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtp_multicast_socket(self.as_ref().to_glib_none().0, family.to_glib())) + from_glib_full( + gst_rtsp_server_sys::gst_rtsp_stream_get_rtp_multicast_socket( + self.as_ref().to_glib_none().0, + family.to_glib(), + ), + ) } } fn get_rtp_socket(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtp_socket(self.as_ref().to_glib_none().0, family.to_glib())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtp_socket( + self.as_ref().to_glib_none().0, + family.to_glib(), + )) } } @@ -407,14 +531,26 @@ impl> RTSPStreamExt for O { let mut seq = mem::uninitialized(); let mut clock_rate = mem::uninitialized(); let mut running_time = mem::uninitialized(); - let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_rtpinfo(self.as_ref().to_glib_none().0, &mut rtptime, &mut seq, &mut clock_rate, &mut running_time)); - if ret { Some((rtptime, seq, clock_rate, from_glib(running_time))) } else { None } + let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_rtpinfo( + self.as_ref().to_glib_none().0, + &mut rtptime, + &mut seq, + &mut clock_rate, + &mut running_time, + )); + if ret { + Some((rtptime, seq, clock_rate, from_glib(running_time))) + } else { + None + } } } fn get_rtpsession(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtpsession(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_rtpsession( + self.as_ref().to_glib_none().0, + )) } } @@ -424,40 +560,53 @@ impl> RTSPStreamExt for O { fn get_sinkpad(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_sinkpad(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_sinkpad( + self.as_ref().to_glib_none().0, + )) } } fn get_srcpad(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_srcpad(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_srcpad( + self.as_ref().to_glib_none().0, + )) } } fn get_srtp_encoder(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_srtp_encoder(self.as_ref().to_glib_none().0)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_get_srtp_encoder( + self.as_ref().to_glib_none().0, + )) } } fn get_ssrc(&self) -> u32 { unsafe { let mut ssrc = mem::uninitialized(); - gst_rtsp_server_sys::gst_rtsp_stream_get_ssrc(self.as_ref().to_glib_none().0, &mut ssrc); + gst_rtsp_server_sys::gst_rtsp_stream_get_ssrc( + self.as_ref().to_glib_none().0, + &mut ssrc, + ); ssrc } } fn get_ulpfec_enabled(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_ulpfec_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_get_ulpfec_enabled( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn get_ulpfec_percentage(&self) -> u32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_get_ulpfec_percentage(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_stream_get_ulpfec_percentage( + self.as_ref().to_glib_none().0, + ) } } @@ -471,53 +620,71 @@ impl> RTSPStreamExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] fn handle_keymgmt(&self, keymgmt: &str) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_handle_keymgmt(self.as_ref().to_glib_none().0, keymgmt.to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_handle_keymgmt( + self.as_ref().to_glib_none().0, + keymgmt.to_glib_none().0, + )) } } fn has_control(&self, control: Option<&str>) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_has_control(self.as_ref().to_glib_none().0, control.to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_has_control( + self.as_ref().to_glib_none().0, + control.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn is_bind_mcast_address(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_bind_mcast_address(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_bind_mcast_address( + self.as_ref().to_glib_none().0, + )) } } fn is_blocking(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_blocking(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_blocking( + self.as_ref().to_glib_none().0, + )) } } fn is_client_side(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_client_side(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_client_side( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn is_complete(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_complete(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_complete( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn is_receiver(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_receiver(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_receiver( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn is_sender(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_sender(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_is_sender( + self.as_ref().to_glib_none().0, + )) } } @@ -525,111 +692,202 @@ impl> RTSPStreamExt for O { // unsafe { TODO: call gst_rtsp_server_sys:gst_rtsp_stream_is_transport_supported() } //} - fn join_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError> { + fn join_bin, Q: IsA>( + &self, + bin: &P, + rtpbin: &Q, + state: gst::State, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_join_bin(self.as_ref().to_glib_none().0, bin.as_ref().to_glib_none().0, rtpbin.as_ref().to_glib_none().0, state.to_glib()), "Failed to join bin") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_join_bin( + self.as_ref().to_glib_none().0, + bin.as_ref().to_glib_none().0, + rtpbin.as_ref().to_glib_none().0, + state.to_glib() + ), + "Failed to join bin" + ) } } - fn leave_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError> { + fn leave_bin, Q: IsA>( + &self, + bin: &P, + rtpbin: &Q, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_leave_bin(self.as_ref().to_glib_none().0, bin.as_ref().to_glib_none().0, rtpbin.as_ref().to_glib_none().0), "Failed to leave bin") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_leave_bin( + self.as_ref().to_glib_none().0, + bin.as_ref().to_glib_none().0, + rtpbin.as_ref().to_glib_none().0 + ), + "Failed to leave bin" + ) } } - fn remove_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError> { + fn remove_transport>( + &self, + trans: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_remove_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to remove transport") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_remove_transport( + self.as_ref().to_glib_none().0, + trans.as_ref().to_glib_none().0 + ), + "Failed to remove transport" + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn request_aux_receiver(&self, sessid: u32) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_aux_receiver(self.as_ref().to_glib_none().0, sessid)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_aux_receiver( + self.as_ref().to_glib_none().0, + sessid, + )) } } fn request_aux_sender(&self, sessid: u32) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_aux_sender(self.as_ref().to_glib_none().0, sessid)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_aux_sender( + self.as_ref().to_glib_none().0, + sessid, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] - fn request_ulpfec_decoder>(&self, rtpbin: &P, sessid: u32) -> Option { + fn request_ulpfec_decoder>( + &self, + rtpbin: &P, + sessid: u32, + ) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_ulpfec_decoder(self.as_ref().to_glib_none().0, rtpbin.as_ref().to_glib_none().0, sessid)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_ulpfec_decoder( + self.as_ref().to_glib_none().0, + rtpbin.as_ref().to_glib_none().0, + sessid, + )) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn request_ulpfec_encoder(&self, sessid: u32) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_ulpfec_encoder(self.as_ref().to_glib_none().0, sessid)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_request_ulpfec_encoder( + self.as_ref().to_glib_none().0, + sessid, + )) } } - fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option { + fn reserve_address( + &self, + address: &str, + port: u32, + n_ports: u32, + ttl: u32, + ) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_reserve_address(self.as_ref().to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl)) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_reserve_address( + self.as_ref().to_glib_none().0, + address.to_glib_none().0, + port, + n_ports, + ttl, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn seekable(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_seekable(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_seekable( + self.as_ref().to_glib_none().0, + )) } } fn set_address_pool>(&self, pool: Option<&P>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_set_address_pool( + self.as_ref().to_glib_none().0, + pool.map(|p| p.as_ref()).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_bind_mcast_address(&self, bind_mcast_addr: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_bind_mcast_address(self.as_ref().to_glib_none().0, bind_mcast_addr.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_bind_mcast_address( + self.as_ref().to_glib_none().0, + bind_mcast_addr.to_glib(), + ); } } fn set_blocked(&self, blocked: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_set_blocked(self.as_ref().to_glib_none().0, blocked.to_glib()), "Failed to block/unblock the dataflow") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_set_blocked( + self.as_ref().to_glib_none().0, + blocked.to_glib() + ), + "Failed to block/unblock the dataflow" + ) } } fn set_buffer_size(&self, size: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_buffer_size(self.as_ref().to_glib_none().0, size); + gst_rtsp_server_sys::gst_rtsp_stream_set_buffer_size( + self.as_ref().to_glib_none().0, + size, + ); } } fn set_client_side(&self, client_side: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_client_side(self.as_ref().to_glib_none().0, client_side.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_client_side( + self.as_ref().to_glib_none().0, + client_side.to_glib(), + ); } } fn set_control(&self, control: Option<&str>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_control(self.as_ref().to_glib_none().0, control.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_set_control( + self.as_ref().to_glib_none().0, + control.to_glib_none().0, + ); } } fn set_dscp_qos(&self, dscp_qos: i32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_dscp_qos(self.as_ref().to_glib_none().0, dscp_qos); + gst_rtsp_server_sys::gst_rtsp_stream_set_dscp_qos( + self.as_ref().to_glib_none().0, + dscp_qos, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_max_mcast_ttl(&self, ttl: u32) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_set_max_mcast_ttl(self.as_ref().to_glib_none().0, ttl)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_set_max_mcast_ttl( + self.as_ref().to_glib_none().0, + ttl, + )) } } @@ -641,56 +899,84 @@ impl> RTSPStreamExt for O { fn set_multicast_iface(&self, multicast_iface: Option<&str>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_set_multicast_iface( + self.as_ref().to_glib_none().0, + multicast_iface.to_glib_none().0, + ); } } fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_profiles( + self.as_ref().to_glib_none().0, + profiles.to_glib(), + ); } } fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_protocols( + self.as_ref().to_glib_none().0, + protocols.to_glib(), + ); } } fn set_pt_map(&self, pt: u32, caps: &gst::Caps) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_pt_map(self.as_ref().to_glib_none().0, pt, caps.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_set_pt_map( + self.as_ref().to_glib_none().0, + pt, + caps.to_glib_none().0, + ); } } fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_publish_clock_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } fn set_retransmission_pt(&self, rtx_pt: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_retransmission_pt(self.as_ref().to_glib_none().0, rtx_pt); + gst_rtsp_server_sys::gst_rtsp_stream_set_retransmission_pt( + self.as_ref().to_glib_none().0, + rtx_pt, + ); } } fn set_retransmission_time(&self, time: gst::ClockTime) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_set_retransmission_time( + self.as_ref().to_glib_none().0, + time.to_glib(), + ); } } fn set_seqnum_offset(&self, seqnum: u16) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_seqnum_offset(self.as_ref().to_glib_none().0, seqnum); + gst_rtsp_server_sys::gst_rtsp_stream_set_seqnum_offset( + self.as_ref().to_glib_none().0, + seqnum, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn set_ulpfec_percentage(&self, percentage: u32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_set_ulpfec_percentage(self.as_ref().to_glib_none().0, percentage); + gst_rtsp_server_sys::gst_rtsp_stream_set_ulpfec_percentage( + self.as_ref().to_glib_none().0, + percentage, + ); } } @@ -701,12 +987,26 @@ impl> RTSPStreamExt for O { } } - fn transport_filter(&self, func: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>) -> Vec { - let func_data: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)> = func; - unsafe extern "C" fn func_func(stream: *mut gst_rtsp_server_sys::GstRTSPStream, trans: *mut gst_rtsp_server_sys::GstRTSPStreamTransport, user_data: glib_sys::gpointer) -> gst_rtsp_server_sys::GstRTSPFilterResult { + fn transport_filter( + &self, + func: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>, + ) -> Vec { + let func_data: Option< + &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult), + > = func; + unsafe extern "C" fn func_func( + stream: *mut gst_rtsp_server_sys::GstRTSPStream, + trans: *mut gst_rtsp_server_sys::GstRTSPStreamTransport, + user_data: glib_sys::gpointer, + ) -> gst_rtsp_server_sys::GstRTSPFilterResult { let stream = from_glib_borrow(stream); let trans = from_glib_borrow(trans); - let callback: *mut Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>; + let callback: *mut Option< + &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult), + > = user_data as *const _ as usize + as *mut Option< + &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult), + >; let res = if let Some(ref mut callback) = *callback { callback(&stream, &trans) } else { @@ -714,113 +1014,228 @@ impl> RTSPStreamExt for O { }; res.to_glib() } - let func = if func_data.is_some() { Some(func_func as _) } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)> = &func_data; + let func = if func_data.is_some() { + Some(func_func as _) + } else { + None + }; + let super_callback0: &Option< + &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult), + > = &func_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_transport_filter(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full( + gst_rtsp_server_sys::gst_rtsp_stream_transport_filter( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + ), + ) } } fn unblock_linked(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0), "Failed to unblock the dataflow") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0), + "Failed to unblock the dataflow" + ) } } - fn update_crypto(&self, ssrc: u32, crypto: Option<&gst::Caps>) -> Result<(), glib::error::BoolError> { + fn update_crypto( + &self, + ssrc: u32, + crypto: Option<&gst::Caps>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_update_crypto(self.as_ref().to_glib_none().0, ssrc, crypto.to_glib_none().0), "Failed to update crypto") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_update_crypto( + self.as_ref().to_glib_none().0, + ssrc, + crypto.to_glib_none().0 + ), + "Failed to update crypto" + ) } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn verify_mcast_ttl(&self, ttl: u32) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_verify_mcast_ttl(self.as_ref().to_glib_none().0, ttl)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_verify_mcast_ttl( + self.as_ref().to_glib_none().0, + ttl, + )) } } - fn connect_new_rtcp_encoder(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_rtcp_encoder_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, object: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_new_rtcp_encoder( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_rtcp_encoder_trampoline< + P, + F: Fn(&P, &gst::Element) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + object: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPStream::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-rtcp-encoder\0".as_ptr() as *const _, - Some(transmute(new_rtcp_encoder_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-rtcp-encoder\0".as_ptr() as *const _, + Some(transmute(new_rtcp_encoder_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_new_rtp_encoder(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_rtp_encoder_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, object: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_new_rtp_encoder( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_rtp_encoder_trampoline< + P, + F: Fn(&P, &gst::Element) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + object: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPStream::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-rtp-encoder\0".as_ptr() as *const _, - Some(transmute(new_rtp_encoder_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-rtp-encoder\0".as_ptr() as *const _, + Some(transmute(new_rtp_encoder_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_new_rtp_rtcp_decoder(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn new_rtp_rtcp_decoder_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, object: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_new_rtp_rtcp_decoder( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn new_rtp_rtcp_decoder_trampoline< + P, + F: Fn(&P, &gst::Element) + Send + Sync + 'static, + >( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + object: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) + f( + &RTSPStream::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"new-rtp-rtcp-decoder\0".as_ptr() as *const _, - Some(transmute(new_rtp_rtcp_decoder_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"new-rtp-rtcp-decoder\0".as_ptr() as *const _, + Some(transmute( + new_rtp_rtcp_decoder_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_control_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_control_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_control_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::control\0".as_ptr() as *const _, - Some(transmute(notify_control_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::control\0".as_ptr() as *const _, + Some(transmute(notify_control_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_profiles_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_profiles_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_profiles_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, - Some(transmute(notify_profiles_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::profiles\0".as_ptr() as *const _, + Some(transmute(notify_profiles_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_protocols_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_protocols_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_protocols_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, - Some(transmute(notify_protocols_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::protocols\0".as_ptr() as *const _, + Some(transmute(notify_protocols_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs index 89d2c8ad9..eb79799d3 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs @@ -2,15 +2,15 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPStream; use glib; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst; use gst_rtsp; use gst_rtsp_server_sys; use std::boxed::Box as Box_; +use RTSPStream; glib_wrapper! { pub struct RTSPStreamTransport(Object); @@ -75,13 +75,18 @@ pub trait RTSPStreamTransportExt: 'static { impl> RTSPStreamTransportExt for O { fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option { unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_rtpinfo(self.as_ref().to_glib_none().0, start_time.to_glib())) + from_glib_full(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_rtpinfo( + self.as_ref().to_glib_none().0, + start_time.to_glib(), + )) } } fn get_stream(&self) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_stream(self.as_ref().to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_stream( + self.as_ref().to_glib_none().0, + )) } } @@ -91,32 +96,46 @@ impl> RTSPStreamTransportExt for O { fn get_url(&self) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_url(self.as_ref().to_glib_none().0)) + from_glib_none(gst_rtsp_server_sys::gst_rtsp_stream_transport_get_url( + self.as_ref().to_glib_none().0, + )) } } fn is_timed_out(&self) -> bool { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_transport_is_timed_out(self.as_ref().to_glib_none().0)) + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_transport_is_timed_out( + self.as_ref().to_glib_none().0, + )) } } fn keep_alive(&self) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_keep_alive(self.as_ref().to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_transport_keep_alive( + self.as_ref().to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn message_sent(&self) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_message_sent(self.as_ref().to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_transport_message_sent( + self.as_ref().to_glib_none().0, + ); } } fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_transport_send_rtcp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_transport_send_rtcp( + self.as_ref().to_glib_none().0, + buffer.to_glib_none().0 + ), + "Failed to send rtcp" + ) } } @@ -127,7 +146,13 @@ impl> RTSPStreamTransportExt for O { fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_transport_send_rtp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_transport_send_rtp( + self.as_ref().to_glib_none().0, + buffer.to_glib_none().0 + ), + "Failed to send rtp" + ) } } @@ -138,7 +163,13 @@ impl> RTSPStreamTransportExt for O { fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_rtsp_server_sys::gst_rtsp_stream_transport_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to set active") + glib_result_from_gboolean!( + gst_rtsp_server_sys::gst_rtsp_stream_transport_set_active( + self.as_ref().to_glib_none().0, + active.to_glib() + ), + "Failed to set active" + ) } } @@ -159,7 +190,12 @@ impl> RTSPStreamTransportExt for O { let destroy_call3 = Some(notify_func::

as _); let super_callback0: Box_

= keep_alive_data; unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_set_keepalive(self.as_ref().to_glib_none().0, keep_alive, Box::into_raw(super_callback0) as *mut _, destroy_call3); + gst_rtsp_server_sys::gst_rtsp_stream_transport_set_keepalive( + self.as_ref().to_glib_none().0, + keep_alive, + Box::into_raw(super_callback0) as *mut _, + destroy_call3, + ); } } @@ -181,13 +217,21 @@ impl> RTSPStreamTransportExt for O { let destroy_call3 = Some(notify_func::

as _); let super_callback0: Box_

= message_sent_data; unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_set_message_sent(self.as_ref().to_glib_none().0, message_sent, Box::into_raw(super_callback0) as *mut _, destroy_call3); + gst_rtsp_server_sys::gst_rtsp_stream_transport_set_message_sent( + self.as_ref().to_glib_none().0, + message_sent, + Box::into_raw(super_callback0) as *mut _, + destroy_call3, + ); } } fn set_timed_out(&self, timedout: bool) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_set_timed_out(self.as_ref().to_glib_none().0, timedout.to_glib()); + gst_rtsp_server_sys::gst_rtsp_stream_transport_set_timed_out( + self.as_ref().to_glib_none().0, + timedout.to_glib(), + ); } } @@ -197,7 +241,10 @@ impl> RTSPStreamTransportExt for O { fn set_url(&self, url: Option<&gst_rtsp::RTSPUrl>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_stream_transport_set_url(self.as_ref().to_glib_none().0, url.to_glib_none().0); + gst_rtsp_server_sys::gst_rtsp_stream_transport_set_url( + self.as_ref().to_glib_none().0, + url.to_glib_none().0, + ); } } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs b/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs index bf80eb2f8..f281287b3 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs @@ -4,8 +4,8 @@ use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst_rtsp_server_sys; @@ -23,9 +23,7 @@ glib_wrapper! { impl RTSPThreadPool { pub fn new() -> RTSPThreadPool { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_rtsp_server_sys::gst_rtsp_thread_pool_new()) - } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_thread_pool_new()) } } pub fn cleanup() { @@ -54,13 +52,18 @@ pub trait RTSPThreadPoolExt: 'static { fn set_max_threads(&self, max_threads: i32); - fn connect_property_max_threads_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_max_threads_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> RTSPThreadPoolExt for O { fn get_max_threads(&self) -> i32 { unsafe { - gst_rtsp_server_sys::gst_rtsp_thread_pool_get_max_threads(self.as_ref().to_glib_none().0) + gst_rtsp_server_sys::gst_rtsp_thread_pool_get_max_threads( + self.as_ref().to_glib_none().0, + ) } } @@ -70,21 +73,35 @@ impl> RTSPThreadPoolExt for O { fn set_max_threads(&self, max_threads: i32) { unsafe { - gst_rtsp_server_sys::gst_rtsp_thread_pool_set_max_threads(self.as_ref().to_glib_none().0, max_threads); + gst_rtsp_server_sys::gst_rtsp_thread_pool_set_max_threads( + self.as_ref().to_glib_none().0, + max_threads, + ); } } - fn connect_property_max_threads_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_max_threads_trampoline(this: *mut gst_rtsp_server_sys::GstRTSPThreadPool, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_max_threads_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_threads_trampoline( + this: *mut gst_rtsp_server_sys::GstRTSPThreadPool, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&RTSPThreadPool::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::max-threads\0".as_ptr() as *const _, - Some(transmute(notify_max_threads_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-threads\0".as_ptr() as *const _, + Some(transmute(notify_max_threads_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 6d52d8ab4..a8ac55687 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -46,7 +46,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-rtsp/src/auto/enums.rs b/gstreamer-rtsp/src/auto/enums.rs index f8e1e614b..92dadb7fe 100644 --- a/gstreamer-rtsp/src/auto/enums.rs +++ b/gstreamer-rtsp/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_rtsp_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPAuthMethod { None, Basic, @@ -31,7 +30,7 @@ impl ToGlib for RTSPAuthMethod { RTSPAuthMethod::None => gst_rtsp_sys::GST_RTSP_AUTH_NONE, RTSPAuthMethod::Basic => gst_rtsp_sys::GST_RTSP_AUTH_BASIC, RTSPAuthMethod::Digest => gst_rtsp_sys::GST_RTSP_AUTH_DIGEST, - RTSPAuthMethod::__Unknown(value) => value + RTSPAuthMethod::__Unknown(value) => value, } } } @@ -73,8 +72,7 @@ impl SetValue for RTSPAuthMethod { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPFamily { None, Inet, @@ -92,7 +90,7 @@ impl ToGlib for RTSPFamily { RTSPFamily::None => gst_rtsp_sys::GST_RTSP_FAM_NONE, RTSPFamily::Inet => gst_rtsp_sys::GST_RTSP_FAM_INET, RTSPFamily::Inet6 => gst_rtsp_sys::GST_RTSP_FAM_INET6, - RTSPFamily::__Unknown(value) => value + RTSPFamily::__Unknown(value) => value, } } } @@ -134,8 +132,7 @@ impl SetValue for RTSPFamily { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPHeaderField { Invalid, Accept, @@ -296,20 +293,28 @@ impl ToGlib for RTSPHeaderField { RTSPHeaderField::AcceptCharset => gst_rtsp_sys::GST_RTSP_HDR_ACCEPT_CHARSET, RTSPHeaderField::Supported => gst_rtsp_sys::GST_RTSP_HDR_SUPPORTED, RTSPHeaderField::Vary => gst_rtsp_sys::GST_RTSP_HDR_VARY, - RTSPHeaderField::XAccelerateStreaming => gst_rtsp_sys::GST_RTSP_HDR_X_ACCELERATE_STREAMING, + RTSPHeaderField::XAccelerateStreaming => { + gst_rtsp_sys::GST_RTSP_HDR_X_ACCELERATE_STREAMING + } RTSPHeaderField::XAcceptAuthent => gst_rtsp_sys::GST_RTSP_HDR_X_ACCEPT_AUTHENT, - RTSPHeaderField::XAcceptProxyAuthent => gst_rtsp_sys::GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT, + RTSPHeaderField::XAcceptProxyAuthent => { + gst_rtsp_sys::GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT + } RTSPHeaderField::XBroadcastId => gst_rtsp_sys::GST_RTSP_HDR_X_BROADCAST_ID, RTSPHeaderField::XBurstStreaming => gst_rtsp_sys::GST_RTSP_HDR_X_BURST_STREAMING, RTSPHeaderField::XNotice => gst_rtsp_sys::GST_RTSP_HDR_X_NOTICE, RTSPHeaderField::XPlayerLagTime => gst_rtsp_sys::GST_RTSP_HDR_X_PLAYER_LAG_TIME, RTSPHeaderField::XPlaylist => gst_rtsp_sys::GST_RTSP_HDR_X_PLAYLIST, - RTSPHeaderField::XPlaylistChangeNotice => gst_rtsp_sys::GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE, + RTSPHeaderField::XPlaylistChangeNotice => { + gst_rtsp_sys::GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE + } RTSPHeaderField::XPlaylistGenId => gst_rtsp_sys::GST_RTSP_HDR_X_PLAYLIST_GEN_ID, RTSPHeaderField::XPlaylistSeekId => gst_rtsp_sys::GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, RTSPHeaderField::XProxyClientAgent => gst_rtsp_sys::GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, RTSPHeaderField::XProxyClientVerb => gst_rtsp_sys::GST_RTSP_HDR_X_PROXY_CLIENT_VERB, - RTSPHeaderField::XRecedingPlaylistchange => gst_rtsp_sys::GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, + RTSPHeaderField::XRecedingPlaylistchange => { + gst_rtsp_sys::GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE + } RTSPHeaderField::XRtpInfo => gst_rtsp_sys::GST_RTSP_HDR_X_RTP_INFO, RTSPHeaderField::XStartupprofile => gst_rtsp_sys::GST_RTSP_HDR_X_STARTUPPROFILE, RTSPHeaderField::Timestamp => gst_rtsp_sys::GST_RTSP_HDR_TIMESTAMP, @@ -327,7 +332,7 @@ impl ToGlib for RTSPHeaderField { RTSPHeaderField::Frames => gst_rtsp_sys::GST_RTSP_HDR_FRAMES, RTSPHeaderField::RateControl => gst_rtsp_sys::GST_RTSP_HDR_RATE_CONTROL, RTSPHeaderField::Last => gst_rtsp_sys::GST_RTSP_HDR_LAST, - RTSPHeaderField::__Unknown(value) => value + RTSPHeaderField::__Unknown(value) => value, } } } @@ -456,8 +461,7 @@ impl SetValue for RTSPHeaderField { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPMsgType { Invalid, Request, @@ -481,7 +485,7 @@ impl ToGlib for RTSPMsgType { RTSPMsgType::HttpRequest => gst_rtsp_sys::GST_RTSP_MESSAGE_HTTP_REQUEST, RTSPMsgType::HttpResponse => gst_rtsp_sys::GST_RTSP_MESSAGE_HTTP_RESPONSE, RTSPMsgType::Data => gst_rtsp_sys::GST_RTSP_MESSAGE_DATA, - RTSPMsgType::__Unknown(value) => value + RTSPMsgType::__Unknown(value) => value, } } } @@ -526,8 +530,7 @@ impl SetValue for RTSPMsgType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPRangeUnit { Smpte, Smpte30Drop, @@ -549,7 +552,7 @@ impl ToGlib for RTSPRangeUnit { RTSPRangeUnit::Smpte25 => gst_rtsp_sys::GST_RTSP_RANGE_SMPTE_25, RTSPRangeUnit::Npt => gst_rtsp_sys::GST_RTSP_RANGE_NPT, RTSPRangeUnit::Clock => gst_rtsp_sys::GST_RTSP_RANGE_CLOCK, - RTSPRangeUnit::__Unknown(value) => value + RTSPRangeUnit::__Unknown(value) => value, } } } @@ -593,8 +596,7 @@ impl SetValue for RTSPRangeUnit { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPResult { Ok, Error, @@ -642,7 +644,7 @@ impl ToGlib for RTSPResult { RTSPResult::Etget => gst_rtsp_sys::GST_RTSP_ETGET, RTSPResult::Etpost => gst_rtsp_sys::GST_RTSP_ETPOST, RTSPResult::Elast => gst_rtsp_sys::GST_RTSP_ELAST, - RTSPResult::__Unknown(value) => value + RTSPResult::__Unknown(value) => value, } } } @@ -699,8 +701,7 @@ impl SetValue for RTSPResult { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPState { Invalid, Init, @@ -724,7 +725,7 @@ impl ToGlib for RTSPState { RTSPState::Seeking => gst_rtsp_sys::GST_RTSP_STATE_SEEKING, RTSPState::Playing => gst_rtsp_sys::GST_RTSP_STATE_PLAYING, RTSPState::Recording => gst_rtsp_sys::GST_RTSP_STATE_RECORDING, - RTSPState::__Unknown(value) => value + RTSPState::__Unknown(value) => value, } } } @@ -769,8 +770,7 @@ impl SetValue for RTSPState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPStatusCode { Invalid, Continue, @@ -851,30 +851,52 @@ impl ToGlib for RTSPStatusCode { RTSPStatusCode::Gone => gst_rtsp_sys::GST_RTSP_STS_GONE, RTSPStatusCode::LengthRequired => gst_rtsp_sys::GST_RTSP_STS_LENGTH_REQUIRED, RTSPStatusCode::PreconditionFailed => gst_rtsp_sys::GST_RTSP_STS_PRECONDITION_FAILED, - RTSPStatusCode::RequestEntityTooLarge => gst_rtsp_sys::GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE, + RTSPStatusCode::RequestEntityTooLarge => { + gst_rtsp_sys::GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE + } RTSPStatusCode::RequestUriTooLarge => gst_rtsp_sys::GST_RTSP_STS_REQUEST_URI_TOO_LARGE, - RTSPStatusCode::UnsupportedMediaType => gst_rtsp_sys::GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE, - RTSPStatusCode::ParameterNotUnderstood => gst_rtsp_sys::GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD, + RTSPStatusCode::UnsupportedMediaType => { + gst_rtsp_sys::GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE + } + RTSPStatusCode::ParameterNotUnderstood => { + gst_rtsp_sys::GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD + } RTSPStatusCode::ConferenceNotFound => gst_rtsp_sys::GST_RTSP_STS_CONFERENCE_NOT_FOUND, RTSPStatusCode::NotEnoughBandwidth => gst_rtsp_sys::GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH, RTSPStatusCode::SessionNotFound => gst_rtsp_sys::GST_RTSP_STS_SESSION_NOT_FOUND, - RTSPStatusCode::MethodNotValidInThisState => gst_rtsp_sys::GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE, - RTSPStatusCode::HeaderFieldNotValidForResource => gst_rtsp_sys::GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE, + RTSPStatusCode::MethodNotValidInThisState => { + gst_rtsp_sys::GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE + } + RTSPStatusCode::HeaderFieldNotValidForResource => { + gst_rtsp_sys::GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE + } RTSPStatusCode::InvalidRange => gst_rtsp_sys::GST_RTSP_STS_INVALID_RANGE, RTSPStatusCode::ParameterIsReadonly => gst_rtsp_sys::GST_RTSP_STS_PARAMETER_IS_READONLY, - RTSPStatusCode::AggregateOperationNotAllowed => gst_rtsp_sys::GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED, - RTSPStatusCode::OnlyAggregateOperationAllowed => gst_rtsp_sys::GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, - RTSPStatusCode::UnsupportedTransport => gst_rtsp_sys::GST_RTSP_STS_UNSUPPORTED_TRANSPORT, - RTSPStatusCode::DestinationUnreachable => gst_rtsp_sys::GST_RTSP_STS_DESTINATION_UNREACHABLE, - RTSPStatusCode::KeyManagementFailure => gst_rtsp_sys::GST_RTSP_STS_KEY_MANAGEMENT_FAILURE, + RTSPStatusCode::AggregateOperationNotAllowed => { + gst_rtsp_sys::GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED + } + RTSPStatusCode::OnlyAggregateOperationAllowed => { + gst_rtsp_sys::GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED + } + RTSPStatusCode::UnsupportedTransport => { + gst_rtsp_sys::GST_RTSP_STS_UNSUPPORTED_TRANSPORT + } + RTSPStatusCode::DestinationUnreachable => { + gst_rtsp_sys::GST_RTSP_STS_DESTINATION_UNREACHABLE + } + RTSPStatusCode::KeyManagementFailure => { + gst_rtsp_sys::GST_RTSP_STS_KEY_MANAGEMENT_FAILURE + } RTSPStatusCode::InternalServerError => gst_rtsp_sys::GST_RTSP_STS_INTERNAL_SERVER_ERROR, RTSPStatusCode::NotImplemented => gst_rtsp_sys::GST_RTSP_STS_NOT_IMPLEMENTED, RTSPStatusCode::BadGateway => gst_rtsp_sys::GST_RTSP_STS_BAD_GATEWAY, RTSPStatusCode::ServiceUnavailable => gst_rtsp_sys::GST_RTSP_STS_SERVICE_UNAVAILABLE, RTSPStatusCode::GatewayTimeout => gst_rtsp_sys::GST_RTSP_STS_GATEWAY_TIMEOUT, - RTSPStatusCode::RtspVersionNotSupported => gst_rtsp_sys::GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED, + RTSPStatusCode::RtspVersionNotSupported => { + gst_rtsp_sys::GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED + } RTSPStatusCode::OptionNotSupported => gst_rtsp_sys::GST_RTSP_STS_OPTION_NOT_SUPPORTED, - RTSPStatusCode::__Unknown(value) => value + RTSPStatusCode::__Unknown(value) => value, } } } @@ -959,8 +981,7 @@ impl SetValue for RTSPStatusCode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum RTSPTimeType { Seconds, Now, @@ -982,7 +1003,7 @@ impl ToGlib for RTSPTimeType { RTSPTimeType::End => gst_rtsp_sys::GST_RTSP_TIME_END, RTSPTimeType::Frames => gst_rtsp_sys::GST_RTSP_TIME_FRAMES, RTSPTimeType::Utc => gst_rtsp_sys::GST_RTSP_TIME_UTC, - RTSPTimeType::__Unknown(value) => value + RTSPTimeType::__Unknown(value) => value, } } } @@ -1025,4 +1046,3 @@ impl SetValue for RTSPTimeType { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-rtsp/src/auto/flags.rs b/gstreamer-rtsp/src/auto/flags.rs index 0db79843e..4c0c0c43f 100644 --- a/gstreamer-rtsp/src/auto/flags.rs +++ b/gstreamer-rtsp/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_rtsp_sys; @@ -271,4 +271,3 @@ impl SetValue for RTSPTransMode { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-rtsp/src/auto/mod.rs b/gstreamer-rtsp/src/auto/mod.rs index 81b030b55..ee7f33149 100644 --- a/gstreamer-rtsp/src/auto/mod.rs +++ b/gstreamer-rtsp/src/auto/mod.rs @@ -27,5 +27,4 @@ pub use self::flags::RTSPProfile; pub use self::flags::RTSPTransMode; #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-rtsp/src/auto/rtsp_url.rs b/gstreamer-rtsp/src/auto/rtsp_url.rs index df2a4a884..0edbd0033 100644 --- a/gstreamer-rtsp/src/auto/rtsp_url.rs +++ b/gstreamer-rtsp/src/auto/rtsp_url.rs @@ -2,11 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use RTSPResult; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_rtsp_sys; use std::ptr; +use RTSPResult; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -22,19 +22,26 @@ glib_wrapper! { impl RTSPUrl { pub fn decode_path_components(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_rtsp_sys::gst_rtsp_url_decode_path_components(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_rtsp_sys::gst_rtsp_url_decode_path_components( + self.to_glib_none().0, + )) } } pub fn get_request_uri(&self) -> Option { unsafe { - from_glib_full(gst_rtsp_sys::gst_rtsp_url_get_request_uri(self.to_glib_none().0)) + from_glib_full(gst_rtsp_sys::gst_rtsp_url_get_request_uri( + self.to_glib_none().0, + )) } } pub fn set_port(&mut self, port: u16) -> RTSPResult { unsafe { - from_glib(gst_rtsp_sys::gst_rtsp_url_set_port(self.to_glib_none_mut().0, port)) + from_glib(gst_rtsp_sys::gst_rtsp_url_set_port( + self.to_glib_none_mut().0, + port, + )) } } @@ -42,7 +49,10 @@ impl RTSPUrl { assert_initialized_main_thread!(); unsafe { let mut url = ptr::null_mut(); - let ret = from_glib(gst_rtsp_sys::gst_rtsp_url_parse(urlstr.to_glib_none().0, &mut url)); + let ret = from_glib(gst_rtsp_sys::gst_rtsp_url_parse( + urlstr.to_glib_none().0, + &mut url, + )); (ret, from_glib_full(url)) } } diff --git a/gstreamer-rtsp/src/lib.rs b/gstreamer-rtsp/src/lib.rs index 45f174a0a..3a86fa1eb 100644 --- a/gstreamer-rtsp/src/lib.rs +++ b/gstreamer-rtsp/src/lib.rs @@ -37,7 +37,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-sdp/src/auto/mod.rs b/gstreamer-sdp/src/auto/mod.rs index c3ee77e76..e27d46c0f 100644 --- a/gstreamer-sdp/src/auto/mod.rs +++ b/gstreamer-sdp/src/auto/mod.rs @@ -3,5 +3,4 @@ // DO NOT EDIT #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-sdp/src/lib.rs b/gstreamer-sdp/src/lib.rs index ee0b57100..1b68a13ee 100644 --- a/gstreamer-sdp/src/lib.rs +++ b/gstreamer-sdp/src/lib.rs @@ -32,7 +32,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(non_snake_case)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-video/src/auto/enums.rs b/gstreamer-video/src/auto/enums.rs index 6f004d1a3..2e0edc2fa 100644 --- a/gstreamer-video/src/auto/enums.rs +++ b/gstreamer-video/src/auto/enums.rs @@ -2,19 +2,18 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_video_sys; #[cfg(any(feature = "v1_16", feature = "dox"))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoCaptionType { Unknown, Cea608Raw, @@ -37,7 +36,7 @@ impl ToGlib for VideoCaptionType { VideoCaptionType::Cea608S3341a => gst_video_sys::GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A, VideoCaptionType::Cea708Raw => gst_video_sys::GST_VIDEO_CAPTION_TYPE_CEA708_RAW, VideoCaptionType::Cea708Cdp => gst_video_sys::GST_VIDEO_CAPTION_TYPE_CEA708_CDP, - VideoCaptionType::__Unknown(value) => value + VideoCaptionType::__Unknown(value) => value, } } } @@ -86,8 +85,7 @@ impl SetValue for VideoCaptionType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoColorMatrix { Unknown, Rgb, @@ -113,7 +111,7 @@ impl ToGlib for VideoColorMatrix { VideoColorMatrix::Bt601 => gst_video_sys::GST_VIDEO_COLOR_MATRIX_BT601, VideoColorMatrix::Smpte240m => gst_video_sys::GST_VIDEO_COLOR_MATRIX_SMPTE240M, VideoColorMatrix::Bt2020 => gst_video_sys::GST_VIDEO_COLOR_MATRIX_BT2020, - VideoColorMatrix::__Unknown(value) => value + VideoColorMatrix::__Unknown(value) => value, } } } @@ -159,8 +157,7 @@ impl SetValue for VideoColorMatrix { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoColorPrimaries { Unknown, Bt709, @@ -198,7 +195,7 @@ impl ToGlib for VideoColorPrimaries { VideoColorPrimaries::Smpterp431 => gst_video_sys::GST_VIDEO_COLOR_PRIMARIES_SMPTERP431, VideoColorPrimaries::Smpteeg432 => gst_video_sys::GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432, VideoColorPrimaries::Ebu3213 => gst_video_sys::GST_VIDEO_COLOR_PRIMARIES_EBU3213, - VideoColorPrimaries::__Unknown(value) => value + VideoColorPrimaries::__Unknown(value) => value, } } } @@ -251,8 +248,7 @@ impl SetValue for VideoColorPrimaries { } #[cfg(any(feature = "v1_12", feature = "dox"))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoFieldOrder { Unknown, TopFieldFirst, @@ -270,8 +266,10 @@ impl ToGlib for VideoFieldOrder { match *self { VideoFieldOrder::Unknown => gst_video_sys::GST_VIDEO_FIELD_ORDER_UNKNOWN, VideoFieldOrder::TopFieldFirst => gst_video_sys::GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST, - VideoFieldOrder::BottomFieldFirst => gst_video_sys::GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST, - VideoFieldOrder::__Unknown(value) => value + VideoFieldOrder::BottomFieldFirst => { + gst_video_sys::GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST + } + VideoFieldOrder::__Unknown(value) => value, } } } @@ -318,8 +316,7 @@ impl SetValue for VideoFieldOrder { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoFormat { Unknown, Encoded, @@ -503,7 +500,7 @@ impl ToGlib for VideoFormat { VideoFormat::Y410 => gst_video_sys::GST_VIDEO_FORMAT_Y410, VideoFormat::Vuya => gst_video_sys::GST_VIDEO_FORMAT_VUYA, VideoFormat::Bgr10a2Le => gst_video_sys::GST_VIDEO_FORMAT_BGR10A2_LE, - VideoFormat::__Unknown(value) => value + VideoFormat::__Unknown(value) => value, } } } @@ -628,8 +625,7 @@ impl SetValue for VideoFormat { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoInterlaceMode { Progressive, Interleaved, @@ -651,7 +647,7 @@ impl ToGlib for VideoInterlaceMode { VideoInterlaceMode::Mixed => gst_video_sys::GST_VIDEO_INTERLACE_MODE_MIXED, VideoInterlaceMode::Fields => gst_video_sys::GST_VIDEO_INTERLACE_MODE_FIELDS, VideoInterlaceMode::Alternate => gst_video_sys::GST_VIDEO_INTERLACE_MODE_ALTERNATE, - VideoInterlaceMode::__Unknown(value) => value + VideoInterlaceMode::__Unknown(value) => value, } } } @@ -695,8 +691,7 @@ impl SetValue for VideoInterlaceMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoMultiviewFramePacking { None, Mono, @@ -718,17 +713,37 @@ impl ToGlib for VideoMultiviewFramePacking { fn to_glib(&self) -> gst_video_sys::GstVideoMultiviewFramePacking { match *self { - VideoMultiviewFramePacking::None => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE, - VideoMultiviewFramePacking::Mono => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO, - VideoMultiviewFramePacking::Left => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT, - VideoMultiviewFramePacking::Right => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT, - VideoMultiviewFramePacking::SideBySide => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE, - VideoMultiviewFramePacking::SideBySideQuincunx => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX, - VideoMultiviewFramePacking::ColumnInterleaved => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED, - VideoMultiviewFramePacking::RowInterleaved => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED, - VideoMultiviewFramePacking::TopBottom => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM, - VideoMultiviewFramePacking::Checkerboard => gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD, - VideoMultiviewFramePacking::__Unknown(value) => value + VideoMultiviewFramePacking::None => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE + } + VideoMultiviewFramePacking::Mono => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO + } + VideoMultiviewFramePacking::Left => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT + } + VideoMultiviewFramePacking::Right => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT + } + VideoMultiviewFramePacking::SideBySide => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE + } + VideoMultiviewFramePacking::SideBySideQuincunx => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX + } + VideoMultiviewFramePacking::ColumnInterleaved => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED + } + VideoMultiviewFramePacking::RowInterleaved => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED + } + VideoMultiviewFramePacking::TopBottom => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM + } + VideoMultiviewFramePacking::Checkerboard => { + gst_video_sys::GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD + } + VideoMultiviewFramePacking::__Unknown(value) => value, } } } @@ -777,8 +792,7 @@ impl SetValue for VideoMultiviewFramePacking { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoMultiviewMode { None, Mono, @@ -808,15 +822,27 @@ impl ToGlib for VideoMultiviewMode { VideoMultiviewMode::Left => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_LEFT, VideoMultiviewMode::Right => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_RIGHT, VideoMultiviewMode::SideBySide => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE, - VideoMultiviewMode::SideBySideQuincunx => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX, - VideoMultiviewMode::ColumnInterleaved => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED, - VideoMultiviewMode::RowInterleaved => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED, + VideoMultiviewMode::SideBySideQuincunx => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX + } + VideoMultiviewMode::ColumnInterleaved => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED + } + VideoMultiviewMode::RowInterleaved => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED + } VideoMultiviewMode::TopBottom => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM, - VideoMultiviewMode::Checkerboard => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD, - VideoMultiviewMode::FrameByFrame => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME, - VideoMultiviewMode::MultiviewFrameByFrame => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME, + VideoMultiviewMode::Checkerboard => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD + } + VideoMultiviewMode::FrameByFrame => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME + } + VideoMultiviewMode::MultiviewFrameByFrame => { + gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME + } VideoMultiviewMode::Separated => gst_video_sys::GST_VIDEO_MULTIVIEW_MODE_SEPARATED, - VideoMultiviewMode::__Unknown(value) => value + VideoMultiviewMode::__Unknown(value) => value, } } } @@ -868,8 +894,7 @@ impl SetValue for VideoMultiviewMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoTileMode { Unknown, Zflipz2x2, @@ -885,7 +910,7 @@ impl ToGlib for VideoTileMode { match *self { VideoTileMode::Unknown => gst_video_sys::GST_VIDEO_TILE_MODE_UNKNOWN, VideoTileMode::Zflipz2x2 => gst_video_sys::GST_VIDEO_TILE_MODE_ZFLIPZ_2X2, - VideoTileMode::__Unknown(value) => value + VideoTileMode::__Unknown(value) => value, } } } @@ -926,8 +951,7 @@ impl SetValue for VideoTileMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum VideoTransferFunction { Unknown, Gamma10, @@ -965,7 +989,7 @@ impl ToGlib for VideoTransferFunction { VideoTransferFunction::Log316 => gst_video_sys::GST_VIDEO_TRANSFER_LOG316, VideoTransferFunction::Bt202012 => gst_video_sys::GST_VIDEO_TRANSFER_BT2020_12, VideoTransferFunction::Adobergb => gst_video_sys::GST_VIDEO_TRANSFER_ADOBERGB, - VideoTransferFunction::__Unknown(value) => value + VideoTransferFunction::__Unknown(value) => value, } } } @@ -1016,4 +1040,3 @@ impl SetValue for VideoTransferFunction { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-video/src/auto/flags.rs b/gstreamer-video/src/auto/flags.rs index 20da65661..8e81d2e7e 100644 --- a/gstreamer-video/src/auto/flags.rs +++ b/gstreamer-video/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_video_sys; @@ -431,4 +431,3 @@ impl FromGlib for VideoTimeCodeFlags { VideoTimeCodeFlags::from_bits_truncate(value) } } - diff --git a/gstreamer-video/src/auto/mod.rs b/gstreamer-video/src/auto/mod.rs index 4defd9e46..0f00de9dc 100644 --- a/gstreamer-video/src/auto/mod.rs +++ b/gstreamer-video/src/auto/mod.rs @@ -6,19 +6,19 @@ mod video_buffer_pool; pub use self::video_buffer_pool::{VideoBufferPool, VideoBufferPoolClass, NONE_VIDEO_BUFFER_POOL}; mod video_decoder; -pub use self::video_decoder::{VideoDecoder, VideoDecoderClass, NONE_VIDEO_DECODER}; pub use self::video_decoder::VideoDecoderExt; +pub use self::video_decoder::{VideoDecoder, VideoDecoderClass, NONE_VIDEO_DECODER}; mod video_encoder; -pub use self::video_encoder::{VideoEncoder, VideoEncoderClass, NONE_VIDEO_ENCODER}; pub use self::video_encoder::VideoEncoderExt; +pub use self::video_encoder::{VideoEncoder, VideoEncoderClass, NONE_VIDEO_ENCODER}; mod video_filter; pub use self::video_filter::{VideoFilter, VideoFilterClass, NONE_VIDEO_FILTER}; mod video_overlay; -pub use self::video_overlay::{VideoOverlay, NONE_VIDEO_OVERLAY}; pub use self::video_overlay::VideoOverlayExt; +pub use self::video_overlay::{VideoOverlay, NONE_VIDEO_OVERLAY}; mod enums; #[cfg(any(feature = "v1_16", feature = "dox"))] diff --git a/gstreamer-video/src/auto/video_buffer_pool.rs b/gstreamer-video/src/auto/video_buffer_pool.rs index 866c79ff3..f19d5ed72 100644 --- a/gstreamer-video/src/auto/video_buffer_pool.rs +++ b/gstreamer-video/src/auto/video_buffer_pool.rs @@ -19,7 +19,8 @@ impl VideoBufferPool { pub fn new() -> VideoBufferPool { assert_initialized_main_thread!(); unsafe { - gst::BufferPool::from_glib_full(gst_video_sys::gst_video_buffer_pool_new()).unsafe_cast() + gst::BufferPool::from_glib_full(gst_video_sys::gst_video_buffer_pool_new()) + .unsafe_cast() } } } diff --git a/gstreamer-video/src/auto/video_decoder.rs b/gstreamer-video/src/auto/video_decoder.rs index 2148ad101..e5e1bdd64 100644 --- a/gstreamer-video/src/auto/video_decoder.rs +++ b/gstreamer-video/src/auto/video_decoder.rs @@ -2,11 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use VideoCodecFrame; use glib::object::IsA; use glib::translate::*; use gst; use gst_video_sys; +use VideoCodecFrame; glib_wrapper! { pub struct VideoDecoder(Object) @extends gst::Element, gst::Object; @@ -46,7 +46,11 @@ pub trait VideoDecoderExt: 'static { fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode); - fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> Option; + fn proxy_getcaps( + &self, + caps: Option<&gst::Caps>, + filter: Option<&gst::Caps>, + ) -> Option; fn set_estimate_rate(&self, enabled: bool); @@ -68,7 +72,9 @@ impl> VideoDecoderExt for O { fn allocate_output_buffer(&self) -> Option { unsafe { - from_glib_full(gst_video_sys::gst_video_decoder_allocate_output_buffer(self.as_ref().to_glib_none().0)) + from_glib_full(gst_video_sys::gst_video_decoder_allocate_output_buffer( + self.as_ref().to_glib_none().0, + )) } } @@ -78,7 +84,9 @@ impl> VideoDecoderExt for O { fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(gst_video_sys::gst_video_decoder_get_buffer_pool(self.as_ref().to_glib_none().0)) + from_glib_full(gst_video_sys::gst_video_decoder_get_buffer_pool( + self.as_ref().to_glib_none().0, + )) } } @@ -90,25 +98,30 @@ impl> VideoDecoderExt for O { fn get_max_decode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff { unsafe { - gst_video_sys::gst_video_decoder_get_max_decode_time(self.as_ref().to_glib_none().0, frame.to_glib_none().0) + gst_video_sys::gst_video_decoder_get_max_decode_time( + self.as_ref().to_glib_none().0, + frame.to_glib_none().0, + ) } } fn get_max_errors(&self) -> i32 { - unsafe { - gst_video_sys::gst_video_decoder_get_max_errors(self.as_ref().to_glib_none().0) - } + unsafe { gst_video_sys::gst_video_decoder_get_max_errors(self.as_ref().to_glib_none().0) } } fn get_needs_format(&self) -> bool { unsafe { - from_glib(gst_video_sys::gst_video_decoder_get_needs_format(self.as_ref().to_glib_none().0)) + from_glib(gst_video_sys::gst_video_decoder_get_needs_format( + self.as_ref().to_glib_none().0, + )) } } fn get_packetized(&self) -> bool { unsafe { - from_glib(gst_video_sys::gst_video_decoder_get_packetized(self.as_ref().to_glib_none().0)) + from_glib(gst_video_sys::gst_video_decoder_get_packetized( + self.as_ref().to_glib_none().0, + )) } } @@ -126,19 +139,34 @@ impl> VideoDecoderExt for O { fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) { unsafe { - gst_video_sys::gst_video_decoder_merge_tags(self.as_ref().to_glib_none().0, tags.to_glib_none().0, mode.to_glib()); + gst_video_sys::gst_video_decoder_merge_tags( + self.as_ref().to_glib_none().0, + tags.to_glib_none().0, + mode.to_glib(), + ); } } - fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> Option { + fn proxy_getcaps( + &self, + caps: Option<&gst::Caps>, + filter: Option<&gst::Caps>, + ) -> Option { unsafe { - from_glib_full(gst_video_sys::gst_video_decoder_proxy_getcaps(self.as_ref().to_glib_none().0, caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_video_sys::gst_video_decoder_proxy_getcaps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + filter.to_glib_none().0, + )) } } fn set_estimate_rate(&self, enabled: bool) { unsafe { - gst_video_sys::gst_video_decoder_set_estimate_rate(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_video_sys::gst_video_decoder_set_estimate_rate( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } @@ -150,19 +178,28 @@ impl> VideoDecoderExt for O { fn set_needs_format(&self, enabled: bool) { unsafe { - gst_video_sys::gst_video_decoder_set_needs_format(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_video_sys::gst_video_decoder_set_needs_format( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } fn set_packetized(&self, packetized: bool) { unsafe { - gst_video_sys::gst_video_decoder_set_packetized(self.as_ref().to_glib_none().0, packetized.to_glib()); + gst_video_sys::gst_video_decoder_set_packetized( + self.as_ref().to_glib_none().0, + packetized.to_glib(), + ); } } fn set_use_default_pad_acceptcaps(&self, use_: bool) { unsafe { - gst_video_sys::gst_video_decoder_set_use_default_pad_acceptcaps(self.as_ref().to_glib_none().0, use_.to_glib()); + gst_video_sys::gst_video_decoder_set_use_default_pad_acceptcaps( + self.as_ref().to_glib_none().0, + use_.to_glib(), + ); } } } diff --git a/gstreamer-video/src/auto/video_encoder.rs b/gstreamer-video/src/auto/video_encoder.rs index 0923a32b1..885bdc35b 100644 --- a/gstreamer-video/src/auto/video_encoder.rs +++ b/gstreamer-video/src/auto/video_encoder.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -#[cfg(any(feature = "v1_14", feature = "dox"))] -use VideoCodecFrame; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst; use gst_video_sys; use std::boxed::Box as Box_; use std::mem::transmute; +#[cfg(any(feature = "v1_14", feature = "dox"))] +use VideoCodecFrame; glib_wrapper! { pub struct VideoEncoder(Object) @extends gst::Element, gst::Object; @@ -44,7 +44,11 @@ pub trait VideoEncoderExt: 'static { fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode); - fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> Option; + fn proxy_getcaps( + &self, + caps: Option<&gst::Caps>, + filter: Option<&gst::Caps>, + ) -> Option; fn set_headers(&self, headers: &[&gst::Buffer]); @@ -57,13 +61,19 @@ pub trait VideoEncoderExt: 'static { fn set_property_qos(&self, qos: bool); - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> VideoEncoderExt for O { fn allocate_output_buffer(&self, size: usize) -> Option { unsafe { - from_glib_full(gst_video_sys::gst_video_encoder_allocate_output_buffer(self.as_ref().to_glib_none().0, size)) + from_glib_full(gst_video_sys::gst_video_encoder_allocate_output_buffer( + self.as_ref().to_glib_none().0, + size, + )) } } @@ -74,73 +84,118 @@ impl> VideoEncoderExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff { unsafe { - gst_video_sys::gst_video_encoder_get_max_encode_time(self.as_ref().to_glib_none().0, frame.to_glib_none().0) + gst_video_sys::gst_video_encoder_get_max_encode_time( + self.as_ref().to_glib_none().0, + frame.to_glib_none().0, + ) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn is_qos_enabled(&self) -> bool { unsafe { - from_glib(gst_video_sys::gst_video_encoder_is_qos_enabled(self.as_ref().to_glib_none().0)) + from_glib(gst_video_sys::gst_video_encoder_is_qos_enabled( + self.as_ref().to_glib_none().0, + )) } } fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) { unsafe { - gst_video_sys::gst_video_encoder_merge_tags(self.as_ref().to_glib_none().0, tags.to_glib_none().0, mode.to_glib()); + gst_video_sys::gst_video_encoder_merge_tags( + self.as_ref().to_glib_none().0, + tags.to_glib_none().0, + mode.to_glib(), + ); } } - fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> Option { + fn proxy_getcaps( + &self, + caps: Option<&gst::Caps>, + filter: Option<&gst::Caps>, + ) -> Option { unsafe { - from_glib_full(gst_video_sys::gst_video_encoder_proxy_getcaps(self.as_ref().to_glib_none().0, caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_video_sys::gst_video_encoder_proxy_getcaps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + filter.to_glib_none().0, + )) } } fn set_headers(&self, headers: &[&gst::Buffer]) { unsafe { - gst_video_sys::gst_video_encoder_set_headers(self.as_ref().to_glib_none().0, headers.to_glib_full()); + gst_video_sys::gst_video_encoder_set_headers( + self.as_ref().to_glib_none().0, + headers.to_glib_full(), + ); } } fn set_min_pts(&self, min_pts: gst::ClockTime) { unsafe { - gst_video_sys::gst_video_encoder_set_min_pts(self.as_ref().to_glib_none().0, min_pts.to_glib()); + gst_video_sys::gst_video_encoder_set_min_pts( + self.as_ref().to_glib_none().0, + min_pts.to_glib(), + ); } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn set_qos_enabled(&self, enabled: bool) { unsafe { - gst_video_sys::gst_video_encoder_set_qos_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); + gst_video_sys::gst_video_encoder_set_qos_enabled( + self.as_ref().to_glib_none().0, + enabled.to_glib(), + ); } } fn get_property_qos(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_qos(&self, qos: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"qos\0".as_ptr() as *const _, Value::from(&qos).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"qos\0".as_ptr() as *const _, + Value::from(&qos).to_glib_none().0, + ); } } - fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_qos_trampoline(this: *mut gst_video_sys::GstVideoEncoder, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_qos_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_qos_trampoline( + this: *mut gst_video_sys::GstVideoEncoder, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&VideoEncoder::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _, - Some(transmute(notify_qos_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::qos\0".as_ptr() as *const _, + Some(transmute(notify_qos_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-video/src/auto/video_overlay.rs b/gstreamer-video/src/auto/video_overlay.rs index 0aebb9f52..504f74de1 100644 --- a/gstreamer-video/src/auto/video_overlay.rs +++ b/gstreamer-video/src/auto/video_overlay.rs @@ -41,7 +41,13 @@ pub trait VideoOverlayExt: 'static { fn prepare_window_handle(&self); - fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError>; + fn set_render_rectangle( + &self, + x: i32, + y: i32, + width: i32, + height: i32, + ) -> Result<(), glib::error::BoolError>; //fn set_window_handle(&self, handle: /*Unimplemented*/Fundamental: UIntPtr); } @@ -59,7 +65,10 @@ impl> VideoOverlayExt for O { fn handle_events(&self, handle_events: bool) { unsafe { - gst_video_sys::gst_video_overlay_handle_events(self.as_ref().to_glib_none().0, handle_events.to_glib()); + gst_video_sys::gst_video_overlay_handle_events( + self.as_ref().to_glib_none().0, + handle_events.to_glib(), + ); } } @@ -69,9 +78,24 @@ impl> VideoOverlayExt for O { } } - fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError> { + fn set_render_rectangle( + &self, + x: i32, + y: i32, + width: i32, + height: i32, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_video_sys::gst_video_overlay_set_render_rectangle(self.as_ref().to_glib_none().0, x, y, width, height), "Failed to set render rectangle") + glib_result_from_gboolean!( + gst_video_sys::gst_video_overlay_set_render_rectangle( + self.as_ref().to_glib_none().0, + x, + y, + width, + height + ), + "Failed to set render rectangle" + ) } } diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index ebae57a92..bc5385430 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -40,7 +40,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer-webrtc/src/auto/enums.rs b/gstreamer-webrtc/src/auto/enums.rs index 0176a8788..de8216568 100644 --- a/gstreamer-webrtc/src/auto/enums.rs +++ b/gstreamer-webrtc/src/auto/enums.rs @@ -2,18 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_web_rtc_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCDTLSSetup { None, Actpass, @@ -33,7 +32,7 @@ impl ToGlib for WebRTCDTLSSetup { WebRTCDTLSSetup::Actpass => gst_web_rtc_sys::GST_WEBRTC_DTLS_SETUP_ACTPASS, WebRTCDTLSSetup::Active => gst_web_rtc_sys::GST_WEBRTC_DTLS_SETUP_ACTIVE, WebRTCDTLSSetup::Passive => gst_web_rtc_sys::GST_WEBRTC_DTLS_SETUP_PASSIVE, - WebRTCDTLSSetup::__Unknown(value) => value + WebRTCDTLSSetup::__Unknown(value) => value, } } } @@ -76,8 +75,7 @@ impl SetValue for WebRTCDTLSSetup { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCDTLSTransportState { New, Closed, @@ -95,11 +93,19 @@ impl ToGlib for WebRTCDTLSTransportState { fn to_glib(&self) -> gst_web_rtc_sys::GstWebRTCDTLSTransportState { match *self { WebRTCDTLSTransportState::New => gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW, - WebRTCDTLSTransportState::Closed => gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED, - WebRTCDTLSTransportState::Failed => gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED, - WebRTCDTLSTransportState::Connecting => gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING, - WebRTCDTLSTransportState::Connected => gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED, - WebRTCDTLSTransportState::__Unknown(value) => value + WebRTCDTLSTransportState::Closed => { + gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED + } + WebRTCDTLSTransportState::Failed => { + gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED + } + WebRTCDTLSTransportState::Connecting => { + gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING + } + WebRTCDTLSTransportState::Connected => { + gst_web_rtc_sys::GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED + } + WebRTCDTLSTransportState::__Unknown(value) => value, } } } @@ -143,8 +149,7 @@ impl SetValue for WebRTCDTLSTransportState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCICEComponent { Rtp, Rtcp, @@ -160,7 +165,7 @@ impl ToGlib for WebRTCICEComponent { match *self { WebRTCICEComponent::Rtp => gst_web_rtc_sys::GST_WEBRTC_ICE_COMPONENT_RTP, WebRTCICEComponent::Rtcp => gst_web_rtc_sys::GST_WEBRTC_ICE_COMPONENT_RTCP, - WebRTCICEComponent::__Unknown(value) => value + WebRTCICEComponent::__Unknown(value) => value, } } } @@ -201,8 +206,7 @@ impl SetValue for WebRTCICEComponent { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCICEConnectionState { New, Checking, @@ -222,13 +226,25 @@ impl ToGlib for WebRTCICEConnectionState { fn to_glib(&self) -> gst_web_rtc_sys::GstWebRTCICEConnectionState { match *self { WebRTCICEConnectionState::New => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_NEW, - WebRTCICEConnectionState::Checking => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING, - WebRTCICEConnectionState::Connected => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED, - WebRTCICEConnectionState::Completed => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED, - WebRTCICEConnectionState::Failed => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_FAILED, - WebRTCICEConnectionState::Disconnected => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED, - WebRTCICEConnectionState::Closed => gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED, - WebRTCICEConnectionState::__Unknown(value) => value + WebRTCICEConnectionState::Checking => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING + } + WebRTCICEConnectionState::Connected => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED + } + WebRTCICEConnectionState::Completed => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED + } + WebRTCICEConnectionState::Failed => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_FAILED + } + WebRTCICEConnectionState::Disconnected => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED + } + WebRTCICEConnectionState::Closed => { + gst_web_rtc_sys::GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED + } + WebRTCICEConnectionState::__Unknown(value) => value, } } } @@ -274,8 +290,7 @@ impl SetValue for WebRTCICEConnectionState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCICEGatheringState { New, Gathering, @@ -291,9 +306,13 @@ impl ToGlib for WebRTCICEGatheringState { fn to_glib(&self) -> gst_web_rtc_sys::GstWebRTCICEGatheringState { match *self { WebRTCICEGatheringState::New => gst_web_rtc_sys::GST_WEBRTC_ICE_GATHERING_STATE_NEW, - WebRTCICEGatheringState::Gathering => gst_web_rtc_sys::GST_WEBRTC_ICE_GATHERING_STATE_GATHERING, - WebRTCICEGatheringState::Complete => gst_web_rtc_sys::GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE, - WebRTCICEGatheringState::__Unknown(value) => value + WebRTCICEGatheringState::Gathering => { + gst_web_rtc_sys::GST_WEBRTC_ICE_GATHERING_STATE_GATHERING + } + WebRTCICEGatheringState::Complete => { + gst_web_rtc_sys::GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE + } + WebRTCICEGatheringState::__Unknown(value) => value, } } } @@ -335,8 +354,7 @@ impl SetValue for WebRTCICEGatheringState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCICERole { Controlled, Controlling, @@ -352,7 +370,7 @@ impl ToGlib for WebRTCICERole { match *self { WebRTCICERole::Controlled => gst_web_rtc_sys::GST_WEBRTC_ICE_ROLE_CONTROLLED, WebRTCICERole::Controlling => gst_web_rtc_sys::GST_WEBRTC_ICE_ROLE_CONTROLLING, - WebRTCICERole::__Unknown(value) => value + WebRTCICERole::__Unknown(value) => value, } } } @@ -393,8 +411,7 @@ impl SetValue for WebRTCICERole { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCPeerConnectionState { New, Connecting, @@ -413,12 +430,22 @@ impl ToGlib for WebRTCPeerConnectionState { fn to_glib(&self) -> gst_web_rtc_sys::GstWebRTCPeerConnectionState { match *self { WebRTCPeerConnectionState::New => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_NEW, - WebRTCPeerConnectionState::Connecting => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING, - WebRTCPeerConnectionState::Connected => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED, - WebRTCPeerConnectionState::Disconnected => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED, - WebRTCPeerConnectionState::Failed => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_FAILED, - WebRTCPeerConnectionState::Closed => gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED, - WebRTCPeerConnectionState::__Unknown(value) => value + WebRTCPeerConnectionState::Connecting => { + gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING + } + WebRTCPeerConnectionState::Connected => { + gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED + } + WebRTCPeerConnectionState::Disconnected => { + gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED + } + WebRTCPeerConnectionState::Failed => { + gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_FAILED + } + WebRTCPeerConnectionState::Closed => { + gst_web_rtc_sys::GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED + } + WebRTCPeerConnectionState::__Unknown(value) => value, } } } @@ -463,8 +490,7 @@ impl SetValue for WebRTCPeerConnectionState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCRTPTransceiverDirection { None, Inactive, @@ -481,12 +507,22 @@ impl ToGlib for WebRTCRTPTransceiverDirection { fn to_glib(&self) -> gst_web_rtc_sys::GstWebRTCRTPTransceiverDirection { match *self { - WebRTCRTPTransceiverDirection::None => gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE, - WebRTCRTPTransceiverDirection::Inactive => gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE, - WebRTCRTPTransceiverDirection::Sendonly => gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY, - WebRTCRTPTransceiverDirection::Recvonly => gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY, - WebRTCRTPTransceiverDirection::Sendrecv => gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV, - WebRTCRTPTransceiverDirection::__Unknown(value) => value + WebRTCRTPTransceiverDirection::None => { + gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE + } + WebRTCRTPTransceiverDirection::Inactive => { + gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE + } + WebRTCRTPTransceiverDirection::Sendonly => { + gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY + } + WebRTCRTPTransceiverDirection::Recvonly => { + gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY + } + WebRTCRTPTransceiverDirection::Sendrecv => { + gst_web_rtc_sys::GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV + } + WebRTCRTPTransceiverDirection::__Unknown(value) => value, } } } @@ -530,8 +566,7 @@ impl SetValue for WebRTCRTPTransceiverDirection { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCSDPType { Offer, Pranswer, @@ -551,7 +586,7 @@ impl ToGlib for WebRTCSDPType { WebRTCSDPType::Pranswer => gst_web_rtc_sys::GST_WEBRTC_SDP_TYPE_PRANSWER, WebRTCSDPType::Answer => gst_web_rtc_sys::GST_WEBRTC_SDP_TYPE_ANSWER, WebRTCSDPType::Rollback => gst_web_rtc_sys::GST_WEBRTC_SDP_TYPE_ROLLBACK, - WebRTCSDPType::__Unknown(value) => value + WebRTCSDPType::__Unknown(value) => value, } } } @@ -594,8 +629,7 @@ impl SetValue for WebRTCSDPType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCSignalingState { Stable, Closed, @@ -615,11 +649,19 @@ impl ToGlib for WebRTCSignalingState { match *self { WebRTCSignalingState::Stable => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_STABLE, WebRTCSignalingState::Closed => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_CLOSED, - WebRTCSignalingState::HaveLocalOffer => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER, - WebRTCSignalingState::HaveRemoteOffer => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER, - WebRTCSignalingState::HaveLocalPranswer => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER, - WebRTCSignalingState::HaveRemotePranswer => gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER, - WebRTCSignalingState::__Unknown(value) => value + WebRTCSignalingState::HaveLocalOffer => { + gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER + } + WebRTCSignalingState::HaveRemoteOffer => { + gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER + } + WebRTCSignalingState::HaveLocalPranswer => { + gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER + } + WebRTCSignalingState::HaveRemotePranswer => { + gst_web_rtc_sys::GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER + } + WebRTCSignalingState::__Unknown(value) => value, } } } @@ -664,8 +706,7 @@ impl SetValue for WebRTCSignalingState { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum WebRTCStatsType { Codec, InboundRtp, @@ -694,8 +735,12 @@ impl ToGlib for WebRTCStatsType { WebRTCStatsType::Codec => gst_web_rtc_sys::GST_WEBRTC_STATS_CODEC, WebRTCStatsType::InboundRtp => gst_web_rtc_sys::GST_WEBRTC_STATS_INBOUND_RTP, WebRTCStatsType::OutboundRtp => gst_web_rtc_sys::GST_WEBRTC_STATS_OUTBOUND_RTP, - WebRTCStatsType::RemoteInboundRtp => gst_web_rtc_sys::GST_WEBRTC_STATS_REMOTE_INBOUND_RTP, - WebRTCStatsType::RemoteOutboundRtp => gst_web_rtc_sys::GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP, + WebRTCStatsType::RemoteInboundRtp => { + gst_web_rtc_sys::GST_WEBRTC_STATS_REMOTE_INBOUND_RTP + } + WebRTCStatsType::RemoteOutboundRtp => { + gst_web_rtc_sys::GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP + } WebRTCStatsType::Csrc => gst_web_rtc_sys::GST_WEBRTC_STATS_CSRC, WebRTCStatsType::PeerConnection => gst_web_rtc_sys::GST_WEBRTC_STATS_PEER_CONNECTION, WebRTCStatsType::DataChannel => gst_web_rtc_sys::GST_WEBRTC_STATS_DATA_CHANNEL, @@ -705,7 +750,7 @@ impl ToGlib for WebRTCStatsType { WebRTCStatsType::LocalCandidate => gst_web_rtc_sys::GST_WEBRTC_STATS_LOCAL_CANDIDATE, WebRTCStatsType::RemoteCandidate => gst_web_rtc_sys::GST_WEBRTC_STATS_REMOTE_CANDIDATE, WebRTCStatsType::Certificate => gst_web_rtc_sys::GST_WEBRTC_STATS_CERTIFICATE, - WebRTCStatsType::__Unknown(value) => value + WebRTCStatsType::__Unknown(value) => value, } } } @@ -757,4 +802,3 @@ impl SetValue for WebRTCStatsType { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer-webrtc/src/auto/mod.rs b/gstreamer-webrtc/src/auto/mod.rs index beb0e21cc..29c14d274 100644 --- a/gstreamer-webrtc/src/auto/mod.rs +++ b/gstreamer-webrtc/src/auto/mod.rs @@ -34,5 +34,4 @@ pub use self::enums::WebRTCSignalingState; pub use self::enums::WebRTCStatsType; #[doc(hidden)] -pub mod traits { -} +pub mod traits {} diff --git a/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs b/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs index 4381437b2..9d9c015be 100644 --- a/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs +++ b/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs @@ -2,20 +2,20 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use WebRTCDTLSTransportState; -use WebRTCICETransport; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_web_rtc_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use WebRTCDTLSTransportState; +use WebRTCICETransport; glib_wrapper! { pub struct WebRTCDTLSTransport(Object); @@ -29,48 +29,74 @@ impl WebRTCDTLSTransport { pub fn new(session_id: u32, rtcp: bool) -> WebRTCDTLSTransport { assert_initialized_main_thread!(); unsafe { - from_glib_none(gst_web_rtc_sys::gst_webrtc_dtls_transport_new(session_id, rtcp.to_glib())) + from_glib_none(gst_web_rtc_sys::gst_webrtc_dtls_transport_new( + session_id, + rtcp.to_glib(), + )) } } pub fn set_transport(&self, ice: &WebRTCICETransport) { unsafe { - gst_web_rtc_sys::gst_webrtc_dtls_transport_set_transport(self.to_glib_none().0, ice.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_dtls_transport_set_transport( + self.to_glib_none().0, + ice.to_glib_none().0, + ); } } pub fn get_property_certificate(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"certificate\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_certificate(&self, certificate: Option<&str>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"certificate\0".as_ptr() as *const _, Value::from(certificate).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"certificate\0".as_ptr() as *const _, + Value::from(certificate).to_glib_none().0, + ); } } pub fn get_property_client(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"client\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"client\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_client(&self, client: bool) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"client\0".as_ptr() as *const _, Value::from(&client).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"client\0".as_ptr() as *const _, + Value::from(&client).to_glib_none().0, + ); } } pub fn get_property_remote_certificate(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"remote-certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"remote-certificate\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -78,7 +104,11 @@ impl WebRTCDTLSTransport { pub fn get_property_rtcp(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"rtcp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"rtcp\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -86,15 +116,24 @@ impl WebRTCDTLSTransport { pub fn get_property_session_id(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"session-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"session-id\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn get_property_state(&self) -> WebRTCDTLSTransportState { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"state\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -102,68 +141,145 @@ impl WebRTCDTLSTransport { pub fn get_property_transport(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"transport\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"transport\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } - pub fn connect_property_certificate_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_certificate_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_certificate_notify< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_certificate_trampoline< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::certificate\0".as_ptr() as *const _, - Some(transmute(notify_certificate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::certificate\0".as_ptr() as *const _, + Some(transmute(notify_certificate_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_client_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_client_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_client_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_client_trampoline< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::client\0".as_ptr() as *const _, - Some(transmute(notify_client_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::client\0".as_ptr() as *const _, + Some(transmute(notify_client_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_remote_certificate_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_remote_certificate_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_remote_certificate_notify< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_remote_certificate_trampoline< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::remote-certificate\0".as_ptr() as *const _, - Some(transmute(notify_remote_certificate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::remote-certificate\0".as_ptr() as *const _, + Some(transmute( + notify_remote_certificate_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_state_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_state_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_state_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_state_trampoline< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::state\0".as_ptr() as *const _, - Some(transmute(notify_state_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::state\0".as_ptr() as *const _, + Some(transmute(notify_state_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_transport_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_transport_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_transport_notify< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_transport_trampoline< + F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCDTLSTransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::transport\0".as_ptr() as *const _, - Some(transmute(notify_transport_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::transport\0".as_ptr() as *const _, + Some(transmute(notify_transport_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-webrtc/src/auto/web_rtcice_transport.rs b/gstreamer-webrtc/src/auto/web_rtcice_transport.rs index 37c741851..7a20d1c07 100644 --- a/gstreamer-webrtc/src/auto/web_rtcice_transport.rs +++ b/gstreamer-webrtc/src/auto/web_rtcice_transport.rs @@ -2,22 +2,22 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use WebRTCICEComponent; -use WebRTCICEConnectionState; -use WebRTCICEGatheringState; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_web_rtc_sys; use libc; use std::boxed::Box as Box_; use std::mem::transmute; +use WebRTCICEComponent; +use WebRTCICEConnectionState; +use WebRTCICEGatheringState; glib_wrapper! { pub struct WebRTCICETransport(Object); @@ -30,19 +30,30 @@ glib_wrapper! { impl WebRTCICETransport { pub fn connection_state_change(&self, new_state: WebRTCICEConnectionState) { unsafe { - gst_web_rtc_sys::gst_webrtc_ice_transport_connection_state_change(self.to_glib_none().0, new_state.to_glib()); + gst_web_rtc_sys::gst_webrtc_ice_transport_connection_state_change( + self.to_glib_none().0, + new_state.to_glib(), + ); } } pub fn gathering_state_change(&self, new_state: WebRTCICEGatheringState) { unsafe { - gst_web_rtc_sys::gst_webrtc_ice_transport_gathering_state_change(self.to_glib_none().0, new_state.to_glib()); + gst_web_rtc_sys::gst_webrtc_ice_transport_gathering_state_change( + self.to_glib_none().0, + new_state.to_glib(), + ); } } pub fn new_candidate(&self, stream_id: u32, component: WebRTCICEComponent, attr: &str) { unsafe { - gst_web_rtc_sys::gst_webrtc_ice_transport_new_candidate(self.to_glib_none().0, stream_id, component.to_glib(), attr.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_ice_transport_new_candidate( + self.to_glib_none().0, + stream_id, + component.to_glib(), + attr.to_glib_none().0, + ); } } @@ -55,72 +66,143 @@ impl WebRTCICETransport { pub fn get_property_component(&self) -> WebRTCICEComponent { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"component\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"component\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn get_property_gathering_state(&self) -> WebRTCICEGatheringState { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"gathering-state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"gathering-state\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn get_property_state(&self) -> WebRTCICEConnectionState { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + let mut value = + Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"state\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn connect_on_new_candidate(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn on_new_candidate_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCICETransport, object: *mut libc::c_char, f: glib_sys::gpointer) { + pub fn connect_on_new_candidate( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn on_new_candidate_trampoline< + F: Fn(&WebRTCICETransport, &str) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCICETransport, + object: *mut libc::c_char, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &GString::from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"on-new-candidate\0".as_ptr() as *const _, - Some(transmute(on_new_candidate_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"on-new-candidate\0".as_ptr() as *const _, + Some(transmute(on_new_candidate_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_on_selected_candidate_pair_change(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn on_selected_candidate_pair_change_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCICETransport, f: glib_sys::gpointer) { + pub fn connect_on_selected_candidate_pair_change< + F: Fn(&WebRTCICETransport) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn on_selected_candidate_pair_change_trampoline< + F: Fn(&WebRTCICETransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCICETransport, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"on-selected-candidate-pair-change\0".as_ptr() as *const _, - Some(transmute(on_selected_candidate_pair_change_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"on-selected-candidate-pair-change\0".as_ptr() as *const _, + Some(transmute( + on_selected_candidate_pair_change_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - pub fn connect_property_gathering_state_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_gathering_state_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCICETransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_gathering_state_notify< + F: Fn(&WebRTCICETransport) + Send + Sync + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_gathering_state_trampoline< + F: Fn(&WebRTCICETransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCICETransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::gathering-state\0".as_ptr() as *const _, - Some(transmute(notify_gathering_state_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::gathering-state\0".as_ptr() as *const _, + Some(transmute(notify_gathering_state_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_state_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_state_trampoline(this: *mut gst_web_rtc_sys::GstWebRTCICETransport, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_state_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_state_trampoline< + F: Fn(&WebRTCICETransport) + Send + Sync + 'static, + >( + this: *mut gst_web_rtc_sys::GstWebRTCICETransport, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::state\0".as_ptr() as *const _, - Some(transmute(notify_state_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::state\0".as_ptr() as *const _, + Some(transmute(notify_state_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs index 281c09653..49dfcf5e6 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use WebRTCDTLSTransport; use glib::translate::*; use gst_web_rtc_sys; +use WebRTCDTLSTransport; glib_wrapper! { pub struct WebRTCRTPReceiver(Object); @@ -17,20 +17,24 @@ glib_wrapper! { impl WebRTCRTPReceiver { pub fn new() -> WebRTCRTPReceiver { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_web_rtc_sys::gst_webrtc_rtp_receiver_new()) - } + unsafe { from_glib_none(gst_web_rtc_sys::gst_webrtc_rtp_receiver_new()) } } pub fn set_rtcp_transport(&self, transport: &WebRTCDTLSTransport) { unsafe { - gst_web_rtc_sys::gst_webrtc_rtp_receiver_set_rtcp_transport(self.to_glib_none().0, transport.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_rtp_receiver_set_rtcp_transport( + self.to_glib_none().0, + transport.to_glib_none().0, + ); } } pub fn set_transport(&self, transport: &WebRTCDTLSTransport) { unsafe { - gst_web_rtc_sys::gst_webrtc_rtp_receiver_set_transport(self.to_glib_none().0, transport.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_rtp_receiver_set_transport( + self.to_glib_none().0, + transport.to_glib_none().0, + ); } } } diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs index c20dfd135..5eff55dbe 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs @@ -2,9 +2,9 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use WebRTCDTLSTransport; use glib::translate::*; use gst_web_rtc_sys; +use WebRTCDTLSTransport; glib_wrapper! { pub struct WebRTCRTPSender(Object); @@ -17,20 +17,24 @@ glib_wrapper! { impl WebRTCRTPSender { pub fn new() -> WebRTCRTPSender { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_web_rtc_sys::gst_webrtc_rtp_sender_new()) - } + unsafe { from_glib_none(gst_web_rtc_sys::gst_webrtc_rtp_sender_new()) } } pub fn set_rtcp_transport(&self, transport: &WebRTCDTLSTransport) { unsafe { - gst_web_rtc_sys::gst_webrtc_rtp_sender_set_rtcp_transport(self.to_glib_none().0, transport.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_rtp_sender_set_rtcp_transport( + self.to_glib_none().0, + transport.to_glib_none().0, + ); } } pub fn set_transport(&self, transport: &WebRTCDTLSTransport) { unsafe { - gst_web_rtc_sys::gst_webrtc_rtp_sender_set_transport(self.to_glib_none().0, transport.to_glib_none().0); + gst_web_rtc_sys::gst_webrtc_rtp_sender_set_transport( + self.to_glib_none().0, + transport.to_glib_none().0, + ); } } } diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs index a7772c767..ca6453435 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use WebRTCRTPReceiver; -use WebRTCRTPSender; -use glib::StaticType; -use glib::Value; use glib::object::ObjectType as ObjectType_; use glib::translate::*; +use glib::StaticType; +use glib::Value; use gobject_sys; use gst_web_rtc_sys; +use WebRTCRTPReceiver; +use WebRTCRTPSender; glib_wrapper! { pub struct WebRTCRTPTransceiver(Object); @@ -23,7 +23,11 @@ impl WebRTCRTPTransceiver { pub fn get_property_mlineindex(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"mlineindex\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"mlineindex\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -31,7 +35,11 @@ impl WebRTCRTPTransceiver { pub fn get_property_receiver(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"receiver\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"receiver\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -39,7 +47,11 @@ impl WebRTCRTPTransceiver { pub fn get_property_sender(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"sender\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"sender\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } diff --git a/gstreamer-webrtc/src/lib.rs b/gstreamer-webrtc/src/lib.rs index ff0e80172..49497824d 100644 --- a/gstreamer-webrtc/src/lib.rs +++ b/gstreamer-webrtc/src/lib.rs @@ -34,7 +34,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::unreadable_literal)] #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] -#[rustfmt::skip] mod auto; pub use auto::*; diff --git a/gstreamer/src/auto/allocator.rs b/gstreamer/src/auto/allocator.rs index 3a204748b..71b7b499f 100644 --- a/gstreamer/src/auto/allocator.rs +++ b/gstreamer/src/auto/allocator.rs @@ -2,10 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; use glib::object::IsA; use glib::translate::*; use gst_sys; +use Object; glib_wrapper! { pub struct Allocator(Object) @extends Object; @@ -18,15 +18,16 @@ glib_wrapper! { impl Allocator { pub fn find(name: Option<&str>) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_allocator_find(name.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_allocator_find(name.to_glib_none().0)) } } pub fn register>(name: &str, allocator: &P) { skip_assert_initialized!(); unsafe { - gst_sys::gst_allocator_register(name.to_glib_none().0, allocator.as_ref().to_glib_full()); + gst_sys::gst_allocator_register( + name.to_glib_none().0, + allocator.as_ref().to_glib_full(), + ); } } } diff --git a/gstreamer/src/auto/bin.rs b/gstreamer/src/auto/bin.rs index d804147a0..45f3e08a6 100644 --- a/gstreamer/src/auto/bin.rs +++ b/gstreamer/src/auto/bin.rs @@ -2,6 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; use ChildProxy; use Element; #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -9,19 +22,6 @@ use ElementFlags; use Object; use Pad; use PadDirection; -use glib; -use glib::StaticType; -use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gobject_sys; -use gst_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Bin(Object) @extends Element, Object, @implements ChildProxy; @@ -93,24 +93,48 @@ pub trait GstBinExt: 'static { fn set_property_message_forward(&self, message_forward: bool); #[cfg(any(feature = "v1_10", feature = "dox"))] - fn connect_deep_element_added(&self, f: F) -> SignalHandlerId; + fn connect_deep_element_added( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(any(feature = "v1_10", feature = "dox"))] - fn connect_deep_element_removed(&self, f: F) -> SignalHandlerId; + fn connect_deep_element_removed( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_element_added(&self, f: F) -> SignalHandlerId; + fn connect_element_added( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_element_removed(&self, f: F) -> SignalHandlerId; + fn connect_element_removed( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_async_handling_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_async_handling_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_message_forward_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_message_forward_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> GstBinExt for O { fn add>(&self, element: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bin_add(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!( + gst_sys::gst_bin_add( + self.as_ref().to_glib_none().0, + element.as_ref().to_glib_none().0 + ), + "Failed to add element" + ) } } @@ -120,32 +144,46 @@ impl> GstBinExt for O { fn find_unlinked_pad(&self, direction: PadDirection) -> Option { unsafe { - from_glib_full(gst_sys::gst_bin_find_unlinked_pad(self.as_ref().to_glib_none().0, direction.to_glib())) + from_glib_full(gst_sys::gst_bin_find_unlinked_pad( + self.as_ref().to_glib_none().0, + direction.to_glib(), + )) } } fn get_by_interface(&self, iface: glib::types::Type) -> Option { unsafe { - from_glib_full(gst_sys::gst_bin_get_by_interface(self.as_ref().to_glib_none().0, iface.to_glib())) + from_glib_full(gst_sys::gst_bin_get_by_interface( + self.as_ref().to_glib_none().0, + iface.to_glib(), + )) } } fn get_by_name(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_bin_get_by_name(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_bin_get_by_name( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn get_by_name_recurse_up(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_bin_get_by_name_recurse_up(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_bin_get_by_name_recurse_up( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_10", feature = "dox"))] fn get_suppressed_flags(&self) -> ElementFlags { unsafe { - from_glib(gst_sys::gst_bin_get_suppressed_flags(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_bin_get_suppressed_flags( + self.as_ref().to_glib_none().0, + )) } } @@ -175,13 +213,22 @@ impl> GstBinExt for O { fn recalculate_latency(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bin_recalculate_latency(self.as_ref().to_glib_none().0), "Failed to recalculate latency") + glib_result_from_gboolean!( + gst_sys::gst_bin_recalculate_latency(self.as_ref().to_glib_none().0), + "Failed to recalculate latency" + ) } } fn remove>(&self, element: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bin_remove(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!( + gst_sys::gst_bin_remove( + self.as_ref().to_glib_none().0, + element.as_ref().to_glib_none().0 + ), + "Failed to remove element" + ) } } @@ -198,121 +245,246 @@ impl> GstBinExt for O { fn sync_children_states(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bin_sync_children_states(self.as_ref().to_glib_none().0), "Failed to sync children states") + glib_result_from_gboolean!( + gst_sys::gst_bin_sync_children_states(self.as_ref().to_glib_none().0), + "Failed to sync children states" + ) } } fn get_property_async_handling(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"async-handling\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"async-handling\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_async_handling(&self, async_handling: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"async-handling\0".as_ptr() as *const _, Value::from(&async_handling).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"async-handling\0".as_ptr() as *const _, + Value::from(&async_handling).to_glib_none().0, + ); } } fn get_property_message_forward(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"message-forward\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"message-forward\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_message_forward(&self, message_forward: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"message-forward\0".as_ptr() as *const _, Value::from(&message_forward).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"message-forward\0".as_ptr() as *const _, + Value::from(&message_forward).to_glib_none().0, + ); } } #[cfg(any(feature = "v1_10", feature = "dox"))] - fn connect_deep_element_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn deep_element_added_trampoline(this: *mut gst_sys::GstBin, sub_bin: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_deep_element_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn deep_element_added_trampoline< + P, + F: Fn(&P, &Bin, &Element) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + sub_bin: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(sub_bin), &from_glib_borrow(element)) + f( + &Bin::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(sub_bin), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"deep-element-added\0".as_ptr() as *const _, - Some(transmute(deep_element_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"deep-element-added\0".as_ptr() as *const _, + Some(transmute(deep_element_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } #[cfg(any(feature = "v1_10", feature = "dox"))] - fn connect_deep_element_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn deep_element_removed_trampoline(this: *mut gst_sys::GstBin, sub_bin: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_deep_element_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn deep_element_removed_trampoline< + P, + F: Fn(&P, &Bin, &Element) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + sub_bin: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(sub_bin), &from_glib_borrow(element)) + f( + &Bin::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(sub_bin), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"deep-element-removed\0".as_ptr() as *const _, - Some(transmute(deep_element_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"deep-element-removed\0".as_ptr() as *const _, + Some(transmute( + deep_element_removed_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_element_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn element_added_trampoline(this: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_element_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn element_added_trampoline< + P, + F: Fn(&P, &Element) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) + f( + &Bin::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"element-added\0".as_ptr() as *const _, - Some(transmute(element_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"element-added\0".as_ptr() as *const _, + Some(transmute(element_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_element_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn element_removed_trampoline(this: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + fn connect_element_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn element_removed_trampoline< + P, + F: Fn(&P, &Element) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) + f( + &Bin::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(element), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"element-removed\0".as_ptr() as *const _, - Some(transmute(element_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"element-removed\0".as_ptr() as *const _, + Some(transmute(element_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_async_handling_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_async_handling_trampoline(this: *mut gst_sys::GstBin, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_async_handling_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_async_handling_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Bin::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::async-handling\0".as_ptr() as *const _, - Some(transmute(notify_async_handling_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::async-handling\0".as_ptr() as *const _, + Some(transmute( + notify_async_handling_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_message_forward_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_message_forward_trampoline(this: *mut gst_sys::GstBin, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_message_forward_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_message_forward_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBin, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Bin::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::message-forward\0".as_ptr() as *const _, - Some(transmute(notify_message_forward_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::message-forward\0".as_ptr() as *const _, + Some(transmute( + notify_message_forward_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/buffer_pool.rs b/gstreamer/src/auto/buffer_pool.rs index 0d8be4601..55d22c5d8 100644 --- a/gstreamer/src/auto/buffer_pool.rs +++ b/gstreamer/src/auto/buffer_pool.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; use glib; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_sys; +use Object; glib_wrapper! { pub struct BufferPool(Object) @extends Object; @@ -37,31 +37,47 @@ pub trait BufferPoolExt: 'static { impl> BufferPoolExt for O { fn get_options(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_sys::gst_buffer_pool_get_options(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_sys::gst_buffer_pool_get_options( + self.as_ref().to_glib_none().0, + )) } } fn has_option(&self, option: &str) -> bool { unsafe { - from_glib(gst_sys::gst_buffer_pool_has_option(self.as_ref().to_glib_none().0, option.to_glib_none().0)) + from_glib(gst_sys::gst_buffer_pool_has_option( + self.as_ref().to_glib_none().0, + option.to_glib_none().0, + )) } } fn is_active(&self) -> bool { unsafe { - from_glib(gst_sys::gst_buffer_pool_is_active(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_buffer_pool_is_active( + self.as_ref().to_glib_none().0, + )) } } fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_buffer_pool_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to activate buffer pool") + glib_result_from_gboolean!( + gst_sys::gst_buffer_pool_set_active( + self.as_ref().to_glib_none().0, + active.to_glib() + ), + "Failed to activate buffer pool" + ) } } fn set_flushing(&self, flushing: bool) { unsafe { - gst_sys::gst_buffer_pool_set_flushing(self.as_ref().to_glib_none().0, flushing.to_glib()); + gst_sys::gst_buffer_pool_set_flushing( + self.as_ref().to_glib_none().0, + flushing.to_glib(), + ); } } } diff --git a/gstreamer/src/auto/bus.rs b/gstreamer/src/auto/bus.rs index 44439b988..79802f170 100644 --- a/gstreamer/src/auto/bus.rs +++ b/gstreamer/src/auto/bus.rs @@ -2,18 +2,18 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ClockTime; -use Message; -use Object; use glib; use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use ClockTime; +use Message; +use Object; glib_wrapper! { pub struct Bus(Object) @extends Object; @@ -26,9 +26,7 @@ glib_wrapper! { impl Bus { pub fn new() -> Bus { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_bus_new()) - } + unsafe { from_glib_full(gst_sys::gst_bus_new()) } } pub fn add_signal_watch(&self) { @@ -59,26 +57,23 @@ impl Bus { //} pub fn have_pending(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_bus_have_pending(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_bus_have_pending(self.to_glib_none().0)) } } pub fn peek(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_bus_peek(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_bus_peek(self.to_glib_none().0)) } } pub fn pop(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_bus_pop(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_bus_pop(self.to_glib_none().0)) } } pub fn post(&self, message: &Message) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bus_post(self.to_glib_none().0, message.to_glib_full()), "Failed to post message") + glib_result_from_gboolean!( + gst_sys::gst_bus_post(self.to_glib_none().0, message.to_glib_full()), + "Failed to post message" + ) } } @@ -90,7 +85,10 @@ impl Bus { pub fn remove_watch(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_bus_remove_watch(self.to_glib_none().0), "Bus has no event source") + glib_result_from_gboolean!( + gst_sys::gst_bus_remove_watch(self.to_glib_none().0), + "Bus has no event source" + ) } } @@ -106,31 +104,55 @@ impl Bus { pub fn timed_pop(&self, timeout: ClockTime) -> Option { unsafe { - from_glib_full(gst_sys::gst_bus_timed_pop(self.to_glib_none().0, timeout.to_glib())) + from_glib_full(gst_sys::gst_bus_timed_pop( + self.to_glib_none().0, + timeout.to_glib(), + )) } } pub fn connect_message(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn message_trampoline(this: *mut gst_sys::GstBus, message: *mut gst_sys::GstMessage, f: glib_sys::gpointer) { + unsafe extern "C" fn message_trampoline( + this: *mut gst_sys::GstBus, + message: *mut gst_sys::GstMessage, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(message)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"message\0".as_ptr() as *const _, - Some(transmute(message_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"message\0".as_ptr() as *const _, + Some(transmute(message_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_sync_message(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn sync_message_trampoline(this: *mut gst_sys::GstBus, message: *mut gst_sys::GstMessage, f: glib_sys::gpointer) { + pub fn connect_sync_message( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn sync_message_trampoline< + F: Fn(&Bus, &Message) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstBus, + message: *mut gst_sys::GstMessage, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(message)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"sync-message\0".as_ptr() as *const _, - Some(transmute(sync_message_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"sync-message\0".as_ptr() as *const _, + Some(transmute(sync_message_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/child_proxy.rs b/gstreamer/src/auto/child_proxy.rs index 0e7399f5d..1d26ef626 100644 --- a/gstreamer/src/auto/child_proxy.rs +++ b/gstreamer/src/auto/child_proxy.rs @@ -3,12 +3,12 @@ // DO NOT EDIT use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gobject_sys; use gst_sys; @@ -54,21 +54,35 @@ pub trait ChildProxyExt: 'static { //fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); - fn connect_child_added(&self, f: F) -> SignalHandlerId; + fn connect_child_added( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_child_removed(&self, f: F) -> SignalHandlerId; + fn connect_child_removed( + &self, + f: F, + ) -> SignalHandlerId; } impl> ChildProxyExt for O { fn child_added>(&self, child: &P, name: &str) { unsafe { - gst_sys::gst_child_proxy_child_added(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0); + gst_sys::gst_child_proxy_child_added( + self.as_ref().to_glib_none().0, + child.as_ref().to_glib_none().0, + name.to_glib_none().0, + ); } } fn child_removed>(&self, child: &P, name: &str) { unsafe { - gst_sys::gst_child_proxy_child_removed(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0); + gst_sys::gst_child_proxy_child_removed( + self.as_ref().to_glib_none().0, + child.as_ref().to_glib_none().0, + name.to_glib_none().0, + ); } } @@ -78,20 +92,24 @@ impl> ChildProxyExt for O { fn get_child_by_index(&self, index: u32) -> Option { unsafe { - from_glib_full(gst_sys::gst_child_proxy_get_child_by_index(self.as_ref().to_glib_none().0, index)) + from_glib_full(gst_sys::gst_child_proxy_get_child_by_index( + self.as_ref().to_glib_none().0, + index, + )) } } fn get_child_by_name(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_child_proxy_get_child_by_name(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_child_proxy_get_child_by_name( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn get_children_count(&self) -> u32 { - unsafe { - gst_sys::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) - } + unsafe { gst_sys::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) } } //fn get_property(&self, name: &str, value: /*Ignored*/glib::Value) { @@ -118,31 +136,69 @@ impl> ChildProxyExt for O { // unsafe { TODO: call gst_sys:gst_child_proxy_set_valist() } //} - fn connect_child_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn child_added_trampoline(this: *mut gst_sys::GstChildProxy, object: *mut gobject_sys::GObject, name: *mut libc::c_char, f: glib_sys::gpointer) - where P: IsA + fn connect_child_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn child_added_trampoline< + P, + F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstChildProxy, + object: *mut gobject_sys::GObject, + name: *mut libc::c_char, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&ChildProxy::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &GString::from_glib_borrow(name)) + f( + &ChildProxy::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + &GString::from_glib_borrow(name), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"child-added\0".as_ptr() as *const _, - Some(transmute(child_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"child-added\0".as_ptr() as *const _, + Some(transmute(child_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_child_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn child_removed_trampoline(this: *mut gst_sys::GstChildProxy, object: *mut gobject_sys::GObject, name: *mut libc::c_char, f: glib_sys::gpointer) - where P: IsA + fn connect_child_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn child_removed_trampoline< + P, + F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstChildProxy, + object: *mut gobject_sys::GObject, + name: *mut libc::c_char, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&ChildProxy::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &GString::from_glib_borrow(name)) + f( + &ChildProxy::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(object), + &GString::from_glib_borrow(name), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"child-removed\0".as_ptr() as *const _, - Some(transmute(child_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"child-removed\0".as_ptr() as *const _, + Some(transmute(child_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/clock.rs b/gstreamer/src/auto/clock.rs index e7945103d..22e00ab32 100644 --- a/gstreamer/src/auto/clock.rs +++ b/gstreamer/src/auto/clock.rs @@ -2,22 +2,22 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ClockTime; -use Object; use glib; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; +use ClockTime; +use Object; glib_wrapper! { pub struct Clock(Object) @extends Object; @@ -75,7 +75,11 @@ pub const NONE_CLOCK: Option<&Clock> = None; pub trait ClockExt: 'static { fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option; - fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>; + fn add_observation_unapplied( + &self, + slave: ClockTime, + master: ClockTime, + ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>; fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime; @@ -99,7 +103,13 @@ pub trait ClockExt: 'static { //fn periodic_id_reinit(&self, id: /*Unimplemented*/ClockID, start_time: ClockTime, interval: ClockTime) -> bool; - fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime); + fn set_calibration( + &self, + internal: ClockTime, + external: ClockTime, + rate_num: ClockTime, + rate_denom: ClockTime, + ); fn set_master>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError>; @@ -125,37 +135,81 @@ pub trait ClockExt: 'static { fn connect_synced(&self, f: F) -> SignalHandlerId; - fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_timeout_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_window_size_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_window_size_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_window_threshold_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_window_threshold_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> ClockExt for O { fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option { unsafe { let mut r_squared = mem::uninitialized(); - let ret = from_glib(gst_sys::gst_clock_add_observation(self.as_ref().to_glib_none().0, slave.to_glib(), master.to_glib(), &mut r_squared)); - if ret { Some(r_squared) } else { None } + let ret = from_glib(gst_sys::gst_clock_add_observation( + self.as_ref().to_glib_none().0, + slave.to_glib(), + master.to_glib(), + &mut r_squared, + )); + if ret { + Some(r_squared) + } else { + None + } } } - fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> { + fn add_observation_unapplied( + &self, + slave: ClockTime, + master: ClockTime, + ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> { unsafe { let mut r_squared = mem::uninitialized(); let mut internal = mem::uninitialized(); let mut external = mem::uninitialized(); let mut rate_num = mem::uninitialized(); let mut rate_denom = mem::uninitialized(); - let ret = from_glib(gst_sys::gst_clock_add_observation_unapplied(self.as_ref().to_glib_none().0, slave.to_glib(), master.to_glib(), &mut r_squared, &mut internal, &mut external, &mut rate_num, &mut rate_denom)); - if ret { Some((r_squared, from_glib(internal), from_glib(external), from_glib(rate_num), from_glib(rate_denom))) } else { None } + let ret = from_glib(gst_sys::gst_clock_add_observation_unapplied( + self.as_ref().to_glib_none().0, + slave.to_glib(), + master.to_glib(), + &mut r_squared, + &mut internal, + &mut external, + &mut rate_num, + &mut rate_denom, + )); + if ret { + Some(( + r_squared, + from_glib(internal), + from_glib(external), + from_glib(rate_num), + from_glib(rate_denom), + )) + } else { + None + } } } fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_adjust_unlocked(self.as_ref().to_glib_none().0, internal.to_glib())) + from_glib(gst_sys::gst_clock_adjust_unlocked( + self.as_ref().to_glib_none().0, + internal.to_glib(), + )) } } @@ -165,45 +219,60 @@ impl> ClockExt for O { let mut external = mem::uninitialized(); let mut rate_num = mem::uninitialized(); let mut rate_denom = mem::uninitialized(); - gst_sys::gst_clock_get_calibration(self.as_ref().to_glib_none().0, &mut internal, &mut external, &mut rate_num, &mut rate_denom); - (from_glib(internal), from_glib(external), from_glib(rate_num), from_glib(rate_denom)) + gst_sys::gst_clock_get_calibration( + self.as_ref().to_glib_none().0, + &mut internal, + &mut external, + &mut rate_num, + &mut rate_denom, + ); + ( + from_glib(internal), + from_glib(external), + from_glib(rate_num), + from_glib(rate_denom), + ) } } fn get_internal_time(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_get_internal_time(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_clock_get_internal_time( + self.as_ref().to_glib_none().0, + )) } } fn get_master(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_clock_get_master(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_clock_get_master( + self.as_ref().to_glib_none().0, + )) } } fn get_resolution(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_get_resolution(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_clock_get_resolution( + self.as_ref().to_glib_none().0, + )) } } fn get_time(&self) -> ClockTime { - unsafe { - from_glib(gst_sys::gst_clock_get_time(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_clock_get_time(self.as_ref().to_glib_none().0)) } } fn get_timeout(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_clock_get_timeout( + self.as_ref().to_glib_none().0, + )) } } fn is_synced(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_clock_is_synced(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_clock_is_synced(self.as_ref().to_glib_none().0)) } } //fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option { @@ -218,21 +287,42 @@ impl> ClockExt for O { // unsafe { TODO: call gst_sys:gst_clock_periodic_id_reinit() } //} - fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime) { + fn set_calibration( + &self, + internal: ClockTime, + external: ClockTime, + rate_num: ClockTime, + rate_denom: ClockTime, + ) { unsafe { - gst_sys::gst_clock_set_calibration(self.as_ref().to_glib_none().0, internal.to_glib(), external.to_glib(), rate_num.to_glib(), rate_denom.to_glib()); + gst_sys::gst_clock_set_calibration( + self.as_ref().to_glib_none().0, + internal.to_glib(), + external.to_glib(), + rate_num.to_glib(), + rate_denom.to_glib(), + ); } } fn set_master>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_clock_set_master(self.as_ref().to_glib_none().0, master.map(|p| p.as_ref()).to_glib_none().0), "Failed to set master clock") + glib_result_from_gboolean!( + gst_sys::gst_clock_set_master( + self.as_ref().to_glib_none().0, + master.map(|p| p.as_ref()).to_glib_none().0 + ), + "Failed to set master clock" + ) } } fn set_resolution(&self, resolution: ClockTime) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_set_resolution(self.as_ref().to_glib_none().0, resolution.to_glib())) + from_glib(gst_sys::gst_clock_set_resolution( + self.as_ref().to_glib_none().0, + resolution.to_glib(), + )) } } @@ -254,97 +344,168 @@ impl> ClockExt for O { fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime { unsafe { - from_glib(gst_sys::gst_clock_unadjust_unlocked(self.as_ref().to_glib_none().0, external.to_glib())) + from_glib(gst_sys::gst_clock_unadjust_unlocked( + self.as_ref().to_glib_none().0, + external.to_glib(), + )) } } fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_clock_wait_for_sync(self.as_ref().to_glib_none().0, timeout.to_glib()), "Timed out waiting for sync") + glib_result_from_gboolean!( + gst_sys::gst_clock_wait_for_sync(self.as_ref().to_glib_none().0, timeout.to_glib()), + "Timed out waiting for sync" + ) } } fn get_property_window_size(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"window-size\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"window-size\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_window_size(&self, window_size: i32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"window-size\0".as_ptr() as *const _, Value::from(&window_size).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"window-size\0".as_ptr() as *const _, + Value::from(&window_size).to_glib_none().0, + ); } } fn get_property_window_threshold(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"window-threshold\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"window-threshold\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_window_threshold(&self, window_threshold: i32) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"window-threshold\0".as_ptr() as *const _, Value::from(&window_threshold).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"window-threshold\0".as_ptr() as *const _, + Value::from(&window_threshold).to_glib_none().0, + ); } } fn connect_synced(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn synced_trampoline(this: *mut gst_sys::GstClock, synced: glib_sys::gboolean, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn synced_trampoline( + this: *mut gst_sys::GstClock, + synced: glib_sys::gboolean, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Clock::from_glib_borrow(this).unsafe_cast(), from_glib(synced)) + f( + &Clock::from_glib_borrow(this).unsafe_cast(), + from_glib(synced), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"synced\0".as_ptr() as *const _, - Some(transmute(synced_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"synced\0".as_ptr() as *const _, + Some(transmute(synced_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_timeout_trampoline(this: *mut gst_sys::GstClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_timeout_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_timeout_trampoline( + this: *mut gst_sys::GstClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Clock::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, - Some(transmute(notify_timeout_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeout\0".as_ptr() as *const _, + Some(transmute(notify_timeout_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_window_size_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_window_size_trampoline(this: *mut gst_sys::GstClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_window_size_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_window_size_trampoline( + this: *mut gst_sys::GstClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Clock::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::window-size\0".as_ptr() as *const _, - Some(transmute(notify_window_size_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::window-size\0".as_ptr() as *const _, + Some(transmute(notify_window_size_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_window_threshold_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_window_threshold_trampoline(this: *mut gst_sys::GstClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_window_threshold_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_window_threshold_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Clock::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::window-threshold\0".as_ptr() as *const _, - Some(transmute(notify_window_threshold_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::window-threshold\0".as_ptr() as *const _, + Some(transmute( + notify_window_threshold_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/date_time.rs b/gstreamer/src/auto/date_time.rs index f3c18c246..f7aa5a6d2 100644 --- a/gstreamer/src/auto/date_time.rs +++ b/gstreamer/src/auto/date_time.rs @@ -3,8 +3,8 @@ // DO NOT EDIT use glib; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_sys; glib_wrapper! { @@ -19,170 +19,153 @@ glib_wrapper! { } impl DateTime { - pub fn new(tzoffset: f32, year: i32, month: i32, day: i32, hour: i32, minute: i32, seconds: f64) -> DateTime { + pub fn new( + tzoffset: f32, + year: i32, + month: i32, + day: i32, + hour: i32, + minute: i32, + seconds: f64, + ) -> DateTime { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_date_time_new(tzoffset, year, month, day, hour, minute, seconds)) + from_glib_full(gst_sys::gst_date_time_new( + tzoffset, year, month, day, hour, minute, seconds, + )) } } pub fn new_from_g_date_time(dt: &glib::DateTime) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_date_time_new_from_g_date_time(dt.to_glib_full())) + from_glib_full(gst_sys::gst_date_time_new_from_g_date_time( + dt.to_glib_full(), + )) } } pub fn new_from_iso8601_string(string: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_date_time_new_from_iso8601_string(string.to_glib_none().0)) + from_glib_full(gst_sys::gst_date_time_new_from_iso8601_string( + string.to_glib_none().0, + )) } } pub fn new_from_unix_epoch_local_time(secs: i64) -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_from_unix_epoch_local_time(secs)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_from_unix_epoch_local_time(secs)) } } pub fn new_from_unix_epoch_utc(secs: i64) -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_from_unix_epoch_utc(secs)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_from_unix_epoch_utc(secs)) } } - pub fn new_local_time(year: i32, month: i32, day: i32, hour: i32, minute: i32, seconds: f64) -> DateTime { + pub fn new_local_time( + year: i32, + month: i32, + day: i32, + hour: i32, + minute: i32, + seconds: f64, + ) -> DateTime { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_date_time_new_local_time(year, month, day, hour, minute, seconds)) + from_glib_full(gst_sys::gst_date_time_new_local_time( + year, month, day, hour, minute, seconds, + )) } } pub fn new_now_local_time() -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_now_local_time()) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_now_local_time()) } } pub fn new_now_utc() -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_now_utc()) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_now_utc()) } } pub fn new_y(year: i32) -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_y(year)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_y(year)) } } pub fn new_ym(year: i32, month: i32) -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_ym(year, month)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_ym(year, month)) } } pub fn new_ymd(year: i32, month: i32, day: i32) -> DateTime { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_date_time_new_ymd(year, month, day)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_new_ymd(year, month, day)) } } pub fn get_day(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_day(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_day(self.to_glib_none().0) } } pub fn get_hour(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_hour(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_hour(self.to_glib_none().0) } } pub fn get_microsecond(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_microsecond(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_microsecond(self.to_glib_none().0) } } pub fn get_minute(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_minute(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_minute(self.to_glib_none().0) } } pub fn get_month(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_month(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_month(self.to_glib_none().0) } } pub fn get_second(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_second(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_second(self.to_glib_none().0) } } pub fn get_time_zone_offset(&self) -> f32 { - unsafe { - gst_sys::gst_date_time_get_time_zone_offset(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_time_zone_offset(self.to_glib_none().0) } } pub fn get_year(&self) -> i32 { - unsafe { - gst_sys::gst_date_time_get_year(self.to_glib_none().0) - } + unsafe { gst_sys::gst_date_time_get_year(self.to_glib_none().0) } } pub fn has_day(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_date_time_has_day(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_date_time_has_day(self.to_glib_none().0)) } } pub fn has_month(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_date_time_has_month(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_date_time_has_month(self.to_glib_none().0)) } } pub fn has_second(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_date_time_has_second(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_date_time_has_second(self.to_glib_none().0)) } } pub fn has_time(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_date_time_has_time(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_date_time_has_time(self.to_glib_none().0)) } } pub fn has_year(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_date_time_has_year(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_date_time_has_year(self.to_glib_none().0)) } } pub fn to_g_date_time(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_date_time_to_g_date_time(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_date_time_to_g_date_time(self.to_glib_none().0)) } } pub fn to_iso8601_string(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_date_time_to_iso8601_string(self.to_glib_none().0)) + from_glib_full(gst_sys::gst_date_time_to_iso8601_string( + self.to_glib_none().0, + )) } } } diff --git a/gstreamer/src/auto/device.rs b/gstreamer/src/auto/device.rs index 0d54740c4..d435702ba 100644 --- a/gstreamer/src/auto/device.rs +++ b/gstreamer/src/auto/device.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Caps; -use Element; -use Object; -use Structure; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Caps; +use Element; +use Object; +use Structure; glib_wrapper! { pub struct Device(Object) @extends Object; @@ -46,7 +46,10 @@ pub trait DeviceExt: 'static { fn has_classesv(&self, classes: &[&str]) -> bool; - fn reconfigure_element>(&self, element: &P) -> Result<(), glib::error::BoolError>; + fn reconfigure_element>( + &self, + element: &P, + ) -> Result<(), glib::error::BoolError>; fn connect_removed(&self, f: F) -> SignalHandlerId; } @@ -54,63 +57,92 @@ pub trait DeviceExt: 'static { impl> DeviceExt for O { fn create_element(&self, name: Option<&str>) -> Option { unsafe { - from_glib_full(gst_sys::gst_device_create_element(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_device_create_element( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn get_caps(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_device_get_caps(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_device_get_caps(self.as_ref().to_glib_none().0)) } } fn get_device_class(&self) -> GString { unsafe { - from_glib_full(gst_sys::gst_device_get_device_class(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_device_get_device_class( + self.as_ref().to_glib_none().0, + )) } } fn get_display_name(&self) -> GString { unsafe { - from_glib_full(gst_sys::gst_device_get_display_name(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_device_get_display_name( + self.as_ref().to_glib_none().0, + )) } } fn get_properties(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_device_get_properties(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_device_get_properties( + self.as_ref().to_glib_none().0, + )) } } fn has_classes(&self, classes: &str) -> bool { unsafe { - from_glib(gst_sys::gst_device_has_classes(self.as_ref().to_glib_none().0, classes.to_glib_none().0)) + from_glib(gst_sys::gst_device_has_classes( + self.as_ref().to_glib_none().0, + classes.to_glib_none().0, + )) } } fn has_classesv(&self, classes: &[&str]) -> bool { unsafe { - from_glib(gst_sys::gst_device_has_classesv(self.as_ref().to_glib_none().0, classes.to_glib_none().0)) + from_glib(gst_sys::gst_device_has_classesv( + self.as_ref().to_glib_none().0, + classes.to_glib_none().0, + )) } } - fn reconfigure_element>(&self, element: &P) -> Result<(), glib::error::BoolError> { + fn reconfigure_element>( + &self, + element: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_device_reconfigure_element(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0), "Failed to reconfigure the element to use this device") + glib_result_from_gboolean!( + gst_sys::gst_device_reconfigure_element( + self.as_ref().to_glib_none().0, + element.as_ref().to_glib_none().0 + ), + "Failed to reconfigure the element to use this device" + ) } } fn connect_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn removed_trampoline(this: *mut gst_sys::GstDevice, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn removed_trampoline( + this: *mut gst_sys::GstDevice, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Device::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"removed\0".as_ptr() as *const _, - Some(transmute(removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"removed\0".as_ptr() as *const _, + Some(transmute(removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/device_monitor.rs b/gstreamer/src/auto/device_monitor.rs index 3a57f5044..531e3f481 100644 --- a/gstreamer/src/auto/device_monitor.rs +++ b/gstreamer/src/auto/device_monitor.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Bus; -use Device; -use Object; use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Bus; +use Device; +use Object; glib_wrapper! { pub struct DeviceMonitor(Object) @extends Object; @@ -52,43 +52,60 @@ pub trait DeviceMonitorExt: 'static { fn set_property_show_all(&self, show_all: bool); - fn connect_property_show_all_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_show_all_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> DeviceMonitorExt for O { fn get_bus(&self) -> Bus { unsafe { - from_glib_full(gst_sys::gst_device_monitor_get_bus(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_device_monitor_get_bus( + self.as_ref().to_glib_none().0, + )) } } fn get_devices(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_monitor_get_devices(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_monitor_get_devices( + self.as_ref().to_glib_none().0, + )) } } fn get_providers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_monitor_get_providers(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_monitor_get_providers( + self.as_ref().to_glib_none().0, + )) } } fn get_show_all_devices(&self) -> bool { unsafe { - from_glib(gst_sys::gst_device_monitor_get_show_all_devices(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_device_monitor_get_show_all_devices( + self.as_ref().to_glib_none().0, + )) } } fn set_show_all_devices(&self, show_all: bool) { unsafe { - gst_sys::gst_device_monitor_set_show_all_devices(self.as_ref().to_glib_none().0, show_all.to_glib()); + gst_sys::gst_device_monitor_set_show_all_devices( + self.as_ref().to_glib_none().0, + show_all.to_glib(), + ); } } fn start(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_device_monitor_start(self.as_ref().to_glib_none().0), "Failed to start") + glib_result_from_gboolean!( + gst_sys::gst_device_monitor_start(self.as_ref().to_glib_none().0), + "Failed to start" + ) } } @@ -101,28 +118,47 @@ impl> DeviceMonitorExt for O { fn get_property_show_all(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"show-all\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"show-all\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_show_all(&self, show_all: bool) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"show-all\0".as_ptr() as *const _, Value::from(&show_all).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"show-all\0".as_ptr() as *const _, + Value::from(&show_all).to_glib_none().0, + ); } } - fn connect_property_show_all_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_show_all_trampoline(this: *mut gst_sys::GstDeviceMonitor, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_show_all_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_show_all_trampoline( + this: *mut gst_sys::GstDeviceMonitor, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&DeviceMonitor::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::show-all\0".as_ptr() as *const _, - Some(transmute(notify_show_all_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::show-all\0".as_ptr() as *const _, + Some(transmute(notify_show_all_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/device_provider.rs b/gstreamer/src/auto/device_provider.rs index d25247530..74c5a356a 100644 --- a/gstreamer/src/auto/device_provider.rs +++ b/gstreamer/src/auto/device_provider.rs @@ -2,22 +2,22 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Bus; -use Device; -use DeviceProviderFactory; -use Object; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst_sys; use libc; use std::boxed::Box as Box_; use std::mem::transmute; +use Bus; +use Device; +use DeviceProviderFactory; +use Object; glib_wrapper! { pub struct DeviceProvider(Object) @extends Object; @@ -58,70 +58,102 @@ pub trait DeviceProviderExt: 'static { fn unhide_provider(&self, name: &str); - fn connect_provider_hidden(&self, f: F) -> SignalHandlerId; + fn connect_provider_hidden( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_provider_unhidden(&self, f: F) -> SignalHandlerId; + fn connect_provider_unhidden( + &self, + f: F, + ) -> SignalHandlerId; } impl> DeviceProviderExt for O { fn can_monitor(&self) -> bool { unsafe { - from_glib(gst_sys::gst_device_provider_can_monitor(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_device_provider_can_monitor( + self.as_ref().to_glib_none().0, + )) } } fn device_add>(&self, device: &P) { unsafe { - gst_sys::gst_device_provider_device_add(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0); + gst_sys::gst_device_provider_device_add( + self.as_ref().to_glib_none().0, + device.as_ref().to_glib_none().0, + ); } } #[cfg(any(feature = "v1_16", feature = "dox"))] fn device_changed, Q: IsA>(&self, device: &P, changed_device: &Q) { unsafe { - gst_sys::gst_device_provider_device_changed(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0, changed_device.as_ref().to_glib_none().0); + gst_sys::gst_device_provider_device_changed( + self.as_ref().to_glib_none().0, + device.as_ref().to_glib_none().0, + changed_device.as_ref().to_glib_none().0, + ); } } fn device_remove>(&self, device: &P) { unsafe { - gst_sys::gst_device_provider_device_remove(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0); + gst_sys::gst_device_provider_device_remove( + self.as_ref().to_glib_none().0, + device.as_ref().to_glib_none().0, + ); } } fn get_bus(&self) -> Bus { unsafe { - from_glib_full(gst_sys::gst_device_provider_get_bus(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_device_provider_get_bus( + self.as_ref().to_glib_none().0, + )) } } fn get_devices(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_devices(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_devices( + self.as_ref().to_glib_none().0, + )) } } fn get_factory(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_device_provider_get_factory(self.as_ref().to_glib_none().0)) + from_glib_none(gst_sys::gst_device_provider_get_factory( + self.as_ref().to_glib_none().0, + )) } } fn get_hidden_providers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_hidden_providers(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_hidden_providers( + self.as_ref().to_glib_none().0, + )) } } fn hide_provider(&self, name: &str) { unsafe { - gst_sys::gst_device_provider_hide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0); + gst_sys::gst_device_provider_hide_provider( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + ); } } fn start(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_device_provider_start(self.as_ref().to_glib_none().0), "Failed to start") + glib_result_from_gboolean!( + gst_sys::gst_device_provider_start(self.as_ref().to_glib_none().0), + "Failed to start" + ) } } @@ -133,35 +165,72 @@ impl> DeviceProviderExt for O { fn unhide_provider(&self, name: &str) { unsafe { - gst_sys::gst_device_provider_unhide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0); + gst_sys::gst_device_provider_unhide_provider( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + ); } } - fn connect_provider_hidden(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn provider_hidden_trampoline(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer) - where P: IsA + fn connect_provider_hidden( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn provider_hidden_trampoline< + P, + F: Fn(&P, &str) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstDeviceProvider, + object: *mut libc::c_char, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) + f( + &DeviceProvider::from_glib_borrow(this).unsafe_cast(), + &GString::from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"provider-hidden\0".as_ptr() as *const _, - Some(transmute(provider_hidden_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"provider-hidden\0".as_ptr() as *const _, + Some(transmute(provider_hidden_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_provider_unhidden(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn provider_unhidden_trampoline(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer) - where P: IsA + fn connect_provider_unhidden( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn provider_unhidden_trampoline< + P, + F: Fn(&P, &str) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstDeviceProvider, + object: *mut libc::c_char, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) + f( + &DeviceProvider::from_glib_borrow(this).unsafe_cast(), + &GString::from_glib_borrow(object), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"provider-unhidden\0".as_ptr() as *const _, - Some(transmute(provider_unhidden_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"provider-unhidden\0".as_ptr() as *const _, + Some(transmute(provider_unhidden_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/device_provider_factory.rs b/gstreamer/src/auto/device_provider_factory.rs index 56eceefd2..a78dd9317 100644 --- a/gstreamer/src/auto/device_provider_factory.rs +++ b/gstreamer/src/auto/device_provider_factory.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::translate::*; +use glib::GString; +use gst_sys; use DeviceProvider; use Object; use PluginFeature; use Rank; -use glib; -use glib::GString; -use glib::translate::*; -use gst_sys; glib_wrapper! { pub struct DeviceProviderFactory(Object) @extends PluginFeature, Object; @@ -22,58 +22,81 @@ glib_wrapper! { impl DeviceProviderFactory { pub fn get(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_device_provider_factory_get(self.to_glib_none().0)) + from_glib_full(gst_sys::gst_device_provider_factory_get( + self.to_glib_none().0, + )) } } pub fn get_device_provider_type(&self) -> glib::types::Type { unsafe { - from_glib(gst_sys::gst_device_provider_factory_get_device_provider_type(self.to_glib_none().0)) + from_glib( + gst_sys::gst_device_provider_factory_get_device_provider_type( + self.to_glib_none().0, + ), + ) } } pub fn get_metadata(&self, key: &str) -> Option { unsafe { - from_glib_none(gst_sys::gst_device_provider_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0)) + from_glib_none(gst_sys::gst_device_provider_factory_get_metadata( + self.to_glib_none().0, + key.to_glib_none().0, + )) } } pub fn get_metadata_keys(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_factory_get_metadata_keys(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full( + gst_sys::gst_device_provider_factory_get_metadata_keys(self.to_glib_none().0), + ) } } pub fn has_classes(&self, classes: Option<&str>) -> bool { unsafe { - from_glib(gst_sys::gst_device_provider_factory_has_classes(self.to_glib_none().0, classes.to_glib_none().0)) + from_glib(gst_sys::gst_device_provider_factory_has_classes( + self.to_glib_none().0, + classes.to_glib_none().0, + )) } } pub fn has_classesv(&self, classes: &[&str]) -> bool { unsafe { - from_glib(gst_sys::gst_device_provider_factory_has_classesv(self.to_glib_none().0, classes.to_glib_none().0)) + from_glib(gst_sys::gst_device_provider_factory_has_classesv( + self.to_glib_none().0, + classes.to_glib_none().0, + )) } } pub fn find(name: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_device_provider_factory_find(name.to_glib_none().0)) + from_glib_full(gst_sys::gst_device_provider_factory_find( + name.to_glib_none().0, + )) } } pub fn get_by_name(factoryname: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(gst_sys::gst_device_provider_factory_get_by_name(factoryname.to_glib_none().0)) + from_glib_full(gst_sys::gst_device_provider_factory_get_by_name( + factoryname.to_glib_none().0, + )) } } pub fn list_get_device_providers(minrank: Rank) -> Vec { assert_initialized_main_thread!(); unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_factory_list_get_device_providers(minrank.to_glib())) + FromGlibPtrContainer::from_glib_full( + gst_sys::gst_device_provider_factory_list_get_device_providers(minrank.to_glib()), + ) } } } diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index e44db0c06..198f91522 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -2,6 +2,17 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib_sys; +use gst_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use std::ptr; use Bus; use Caps; use Clock; @@ -15,17 +26,6 @@ use Pad; use PadLinkCheck; use PadTemplate; use URIType; -use glib; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gst_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; -use std::ptr; glib_wrapper! { pub struct Element(Object) @extends Object; @@ -36,12 +36,25 @@ glib_wrapper! { } impl Element { - pub fn make_from_uri(type_: URIType, uri: &str, elementname: Option<&str>) -> Result { + pub fn make_from_uri( + type_: URIType, + uri: &str, + elementname: Option<&str>, + ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = ptr::null_mut(); - let ret = gst_sys::gst_element_make_from_uri(type_.to_glib(), uri.to_glib_none().0, elementname.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_sys::gst_element_make_from_uri( + type_.to_glib(), + uri.to_glib_none().0, + elementname.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } } @@ -99,15 +112,36 @@ pub trait ElementExt: 'static { fn link>(&self, dest: &P) -> Result<(), glib::error::BoolError>; - fn link_filtered>(&self, dest: &P, filter: Option<&Caps>) -> Result<(), glib::error::BoolError>; + fn link_filtered>( + &self, + dest: &P, + filter: Option<&Caps>, + ) -> Result<(), glib::error::BoolError>; //fn link_many>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool; - fn link_pads>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>) -> Result<(), glib::error::BoolError>; + fn link_pads>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + ) -> Result<(), glib::error::BoolError>; - fn link_pads_filtered>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>, filter: Option<&Caps>) -> Result<(), glib::error::BoolError>; + fn link_pads_filtered>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + filter: Option<&Caps>, + ) -> Result<(), glib::error::BoolError>; - fn link_pads_full>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>, flags: PadLinkCheck) -> Result<(), glib::error::BoolError>; + fn link_pads_full>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + flags: PadLinkCheck, + ) -> Result<(), glib::error::BoolError>; fn lost_state(&self); @@ -126,7 +160,12 @@ pub trait ElementExt: 'static { fn remove_pad>(&self, pad: &P) -> Result<(), glib::error::BoolError>; - fn request_pad(&self, templ: &PadTemplate, name: Option<&str>, caps: Option<&Caps>) -> Option; + fn request_pad( + &self, + templ: &PadTemplate, + name: Option<&str>, + caps: Option<&Caps>, + ) -> Option; fn set_base_time(&self, time: ClockTime); @@ -150,9 +189,15 @@ pub trait ElementExt: 'static { fn connect_no_more_pads(&self, f: F) -> SignalHandlerId; - fn connect_pad_added(&self, f: F) -> SignalHandlerId; + fn connect_pad_added( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_pad_removed(&self, f: F) -> SignalHandlerId; + fn connect_pad_removed( + &self, + f: F, + ) -> SignalHandlerId; } impl> ElementExt for O { @@ -164,7 +209,13 @@ impl> ElementExt for O { fn add_pad>(&self, pad: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_add_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0), "Failed to add pad") + glib_result_from_gboolean!( + gst_sys::gst_element_add_pad( + self.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0 + ), + "Failed to add pad" + ) } } @@ -177,7 +228,11 @@ impl> ElementExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn foreach_pad bool>(&self, func: P) -> bool { let func_data: P = func; - unsafe extern "C" fn func_func bool>(element: *mut gst_sys::GstElement, pad: *mut gst_sys::GstPad, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn func_func bool>( + element: *mut gst_sys::GstElement, + pad: *mut gst_sys::GstPad, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let element = from_glib_borrow(element); let pad = from_glib_borrow(pad); let callback: *mut P = user_data as *const _ as usize as *mut P; @@ -187,14 +242,22 @@ impl> ElementExt for O { let func = Some(func_func::

as _); let super_callback0: &P = &func_data; unsafe { - from_glib(gst_sys::gst_element_foreach_pad(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + from_glib(gst_sys::gst_element_foreach_pad( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn foreach_sink_pad bool>(&self, func: P) -> bool { let func_data: P = func; - unsafe extern "C" fn func_func bool>(element: *mut gst_sys::GstElement, pad: *mut gst_sys::GstPad, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn func_func bool>( + element: *mut gst_sys::GstElement, + pad: *mut gst_sys::GstPad, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let element = from_glib_borrow(element); let pad = from_glib_borrow(pad); let callback: *mut P = user_data as *const _ as usize as *mut P; @@ -204,14 +267,22 @@ impl> ElementExt for O { let func = Some(func_func::

as _); let super_callback0: &P = &func_data; unsafe { - from_glib(gst_sys::gst_element_foreach_sink_pad(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + from_glib(gst_sys::gst_element_foreach_sink_pad( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn foreach_src_pad bool>(&self, func: P) -> bool { let func_data: P = func; - unsafe extern "C" fn func_func bool>(element: *mut gst_sys::GstElement, pad: *mut gst_sys::GstPad, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn func_func bool>( + element: *mut gst_sys::GstElement, + pad: *mut gst_sys::GstPad, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let element = from_glib_borrow(element); let pad = from_glib_borrow(pad); let callback: *mut P = user_data as *const _ as usize as *mut P; @@ -221,79 +292,109 @@ impl> ElementExt for O { let func = Some(func_func::

as _); let super_callback0: &P = &func_data; unsafe { - from_glib(gst_sys::gst_element_foreach_src_pad(self.as_ref().to_glib_none().0, func, super_callback0 as *const _ as usize as *mut _)) + from_glib(gst_sys::gst_element_foreach_src_pad( + self.as_ref().to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + )) } } fn get_base_time(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_element_get_base_time(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_element_get_base_time( + self.as_ref().to_glib_none().0, + )) } } fn get_bus(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_element_get_bus(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_element_get_bus(self.as_ref().to_glib_none().0)) } } fn get_clock(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_get_clock(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_element_get_clock( + self.as_ref().to_glib_none().0, + )) } } fn get_compatible_pad>(&self, pad: &P, caps: Option<&Caps>) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_get_compatible_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0, caps.to_glib_none().0)) + from_glib_full(gst_sys::gst_element_get_compatible_pad( + self.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0, + caps.to_glib_none().0, + )) } } fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option { unsafe { - from_glib_none(gst_sys::gst_element_get_compatible_pad_template(self.as_ref().to_glib_none().0, compattempl.to_glib_none().0)) + from_glib_none(gst_sys::gst_element_get_compatible_pad_template( + self.as_ref().to_glib_none().0, + compattempl.to_glib_none().0, + )) } } fn get_context(&self, context_type: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_get_context(self.as_ref().to_glib_none().0, context_type.to_glib_none().0)) + from_glib_full(gst_sys::gst_element_get_context( + self.as_ref().to_glib_none().0, + context_type.to_glib_none().0, + )) } } fn get_contexts(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_get_contexts(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_get_contexts( + self.as_ref().to_glib_none().0, + )) } } fn get_factory(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_element_get_factory(self.as_ref().to_glib_none().0)) + from_glib_none(gst_sys::gst_element_get_factory( + self.as_ref().to_glib_none().0, + )) } } fn get_request_pad(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_get_request_pad(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_element_get_request_pad( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn get_start_time(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_element_get_start_time(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_element_get_start_time( + self.as_ref().to_glib_none().0, + )) } } fn get_static_pad(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_get_static_pad(self.as_ref().to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_element_get_static_pad( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) } } fn is_locked_state(&self) -> bool { unsafe { - from_glib(gst_sys::gst_element_is_locked_state(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_element_is_locked_state( + self.as_ref().to_glib_none().0, + )) } } @@ -311,13 +412,30 @@ impl> ElementExt for O { fn link>(&self, dest: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_link(self.as_ref().to_glib_none().0, dest.as_ref().to_glib_none().0), "Failed to link elements") + glib_result_from_gboolean!( + gst_sys::gst_element_link( + self.as_ref().to_glib_none().0, + dest.as_ref().to_glib_none().0 + ), + "Failed to link elements" + ) } } - fn link_filtered>(&self, dest: &P, filter: Option<&Caps>) -> Result<(), glib::error::BoolError> { + fn link_filtered>( + &self, + dest: &P, + filter: Option<&Caps>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_link_filtered(self.as_ref().to_glib_none().0, dest.as_ref().to_glib_none().0, filter.to_glib_none().0), "Failed to link elements") + glib_result_from_gboolean!( + gst_sys::gst_element_link_filtered( + self.as_ref().to_glib_none().0, + dest.as_ref().to_glib_none().0, + filter.to_glib_none().0 + ), + "Failed to link elements" + ) } } @@ -325,21 +443,64 @@ impl> ElementExt for O { // unsafe { TODO: call gst_sys:gst_element_link_many() } //} - fn link_pads>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>) -> Result<(), glib::error::BoolError> { + fn link_pads>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_link_pads(self.as_ref().to_glib_none().0, srcpadname.to_glib_none().0, dest.as_ref().to_glib_none().0, destpadname.to_glib_none().0), "Failed to link pads") + glib_result_from_gboolean!( + gst_sys::gst_element_link_pads( + self.as_ref().to_glib_none().0, + srcpadname.to_glib_none().0, + dest.as_ref().to_glib_none().0, + destpadname.to_glib_none().0 + ), + "Failed to link pads" + ) } } - fn link_pads_filtered>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>, filter: Option<&Caps>) -> Result<(), glib::error::BoolError> { + fn link_pads_filtered>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + filter: Option<&Caps>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_link_pads_filtered(self.as_ref().to_glib_none().0, srcpadname.to_glib_none().0, dest.as_ref().to_glib_none().0, destpadname.to_glib_none().0, filter.to_glib_none().0), "Failed to link pads") + glib_result_from_gboolean!( + gst_sys::gst_element_link_pads_filtered( + self.as_ref().to_glib_none().0, + srcpadname.to_glib_none().0, + dest.as_ref().to_glib_none().0, + destpadname.to_glib_none().0, + filter.to_glib_none().0 + ), + "Failed to link pads" + ) } } - fn link_pads_full>(&self, srcpadname: Option<&str>, dest: &P, destpadname: Option<&str>, flags: PadLinkCheck) -> Result<(), glib::error::BoolError> { + fn link_pads_full>( + &self, + srcpadname: Option<&str>, + dest: &P, + destpadname: Option<&str>, + flags: PadLinkCheck, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_link_pads_full(self.as_ref().to_glib_none().0, srcpadname.to_glib_none().0, dest.as_ref().to_glib_none().0, destpadname.to_glib_none().0, flags.to_glib()), "Failed to link pads") + glib_result_from_gboolean!( + gst_sys::gst_element_link_pads_full( + self.as_ref().to_glib_none().0, + srcpadname.to_glib_none().0, + dest.as_ref().to_glib_none().0, + destpadname.to_glib_none().0, + flags.to_glib() + ), + "Failed to link pads" + ) } } @@ -366,31 +527,58 @@ impl> ElementExt for O { fn post_message(&self, message: &Message) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_post_message(self.as_ref().to_glib_none().0, message.to_glib_full()), "Failed to post message") + glib_result_from_gboolean!( + gst_sys::gst_element_post_message( + self.as_ref().to_glib_none().0, + message.to_glib_full() + ), + "Failed to post message" + ) } } fn provide_clock(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_provide_clock(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_element_provide_clock( + self.as_ref().to_glib_none().0, + )) } } fn release_request_pad>(&self, pad: &P) { unsafe { - gst_sys::gst_element_release_request_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0); + gst_sys::gst_element_release_request_pad( + self.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0, + ); } } fn remove_pad>(&self, pad: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_remove_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0), "Failed to remove pad") + glib_result_from_gboolean!( + gst_sys::gst_element_remove_pad( + self.as_ref().to_glib_none().0, + pad.as_ref().to_glib_none().0 + ), + "Failed to remove pad" + ) } } - fn request_pad(&self, templ: &PadTemplate, name: Option<&str>, caps: Option<&Caps>) -> Option { + fn request_pad( + &self, + templ: &PadTemplate, + name: Option<&str>, + caps: Option<&Caps>, + ) -> Option { unsafe { - from_glib_full(gst_sys::gst_element_request_pad(self.as_ref().to_glib_none().0, templ.to_glib_none().0, name.to_glib_none().0, caps.to_glib_none().0)) + from_glib_full(gst_sys::gst_element_request_pad( + self.as_ref().to_glib_none().0, + templ.to_glib_none().0, + name.to_glib_none().0, + caps.to_glib_none().0, + )) } } @@ -408,19 +596,31 @@ impl> ElementExt for O { fn set_clock>(&self, clock: Option<&P>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0), "Failed to set clock") + glib_result_from_gboolean!( + gst_sys::gst_element_set_clock( + self.as_ref().to_glib_none().0, + clock.map(|p| p.as_ref()).to_glib_none().0 + ), + "Failed to set clock" + ) } } fn set_context(&self, context: &Context) { unsafe { - gst_sys::gst_element_set_context(self.as_ref().to_glib_none().0, context.to_glib_none().0); + gst_sys::gst_element_set_context( + self.as_ref().to_glib_none().0, + context.to_glib_none().0, + ); } } fn set_locked_state(&self, locked_state: bool) -> bool { unsafe { - from_glib(gst_sys::gst_element_set_locked_state(self.as_ref().to_glib_none().0, locked_state.to_glib())) + from_glib(gst_sys::gst_element_set_locked_state( + self.as_ref().to_glib_none().0, + locked_state.to_glib(), + )) } } @@ -432,13 +632,19 @@ impl> ElementExt for O { fn sync_state_with_parent(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_element_sync_state_with_parent(self.as_ref().to_glib_none().0), "Failed to sync state with parent") + glib_result_from_gboolean!( + gst_sys::gst_element_sync_state_with_parent(self.as_ref().to_glib_none().0), + "Failed to sync state with parent" + ) } } fn unlink>(&self, dest: &P) { unsafe { - gst_sys::gst_element_unlink(self.as_ref().to_glib_none().0, dest.as_ref().to_glib_none().0); + gst_sys::gst_element_unlink( + self.as_ref().to_glib_none().0, + dest.as_ref().to_glib_none().0, + ); } } @@ -448,49 +654,89 @@ impl> ElementExt for O { fn unlink_pads>(&self, srcpadname: &str, dest: &P, destpadname: &str) { unsafe { - gst_sys::gst_element_unlink_pads(self.as_ref().to_glib_none().0, srcpadname.to_glib_none().0, dest.as_ref().to_glib_none().0, destpadname.to_glib_none().0); + gst_sys::gst_element_unlink_pads( + self.as_ref().to_glib_none().0, + srcpadname.to_glib_none().0, + dest.as_ref().to_glib_none().0, + destpadname.to_glib_none().0, + ); } } fn connect_no_more_pads(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn no_more_pads_trampoline(this: *mut gst_sys::GstElement, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn no_more_pads_trampoline( + this: *mut gst_sys::GstElement, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Element::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"no-more-pads\0".as_ptr() as *const _, - Some(transmute(no_more_pads_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"no-more-pads\0".as_ptr() as *const _, + Some(transmute(no_more_pads_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_pad_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pad_added_trampoline(this: *mut gst_sys::GstElement, new_pad: *mut gst_sys::GstPad, f: glib_sys::gpointer) - where P: IsA + fn connect_pad_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pad_added_trampoline( + this: *mut gst_sys::GstElement, + new_pad: *mut gst_sys::GstPad, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Element::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(new_pad)) + f( + &Element::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(new_pad), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pad-added\0".as_ptr() as *const _, - Some(transmute(pad_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pad-added\0".as_ptr() as *const _, + Some(transmute(pad_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_pad_removed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pad_removed_trampoline(this: *mut gst_sys::GstElement, old_pad: *mut gst_sys::GstPad, f: glib_sys::gpointer) - where P: IsA + fn connect_pad_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pad_removed_trampoline( + this: *mut gst_sys::GstElement, + old_pad: *mut gst_sys::GstPad, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Element::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(old_pad)) + f( + &Element::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(old_pad), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pad-removed\0".as_ptr() as *const _, - Some(transmute(pad_removed_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pad-removed\0".as_ptr() as *const _, + Some(transmute(pad_removed_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/element_factory.rs b/gstreamer/src/auto/element_factory.rs index 3493b9eb4..f45cae210 100644 --- a/gstreamer/src/auto/element_factory.rs +++ b/gstreamer/src/auto/element_factory.rs @@ -2,6 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::translate::*; +use glib::GString; +use gst_sys; use Caps; use Element; use ElementFactoryListType; @@ -11,10 +15,6 @@ use PluginFeature; use Rank; use StaticPadTemplate; use URIType; -use glib; -use glib::GString; -use glib::translate::*; -use gst_sys; glib_wrapper! { pub struct ElementFactory(Object) @extends PluginFeature, Object; @@ -27,113 +27,159 @@ glib_wrapper! { impl ElementFactory { pub fn can_sink_all_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_can_sink_all_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_can_sink_all_caps( + self.to_glib_none().0, + caps.to_glib_none().0, + )) } } pub fn can_sink_any_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_can_sink_any_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_can_sink_any_caps( + self.to_glib_none().0, + caps.to_glib_none().0, + )) } } pub fn can_src_all_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_can_src_all_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_can_src_all_caps( + self.to_glib_none().0, + caps.to_glib_none().0, + )) } } pub fn can_src_any_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_can_src_any_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_can_src_any_caps( + self.to_glib_none().0, + caps.to_glib_none().0, + )) } } pub fn create(&self, name: Option<&str>) -> Option { unsafe { - from_glib_none(gst_sys::gst_element_factory_create(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_none(gst_sys::gst_element_factory_create( + self.to_glib_none().0, + name.to_glib_none().0, + )) } } pub fn get_element_type(&self) -> glib::types::Type { unsafe { - from_glib(gst_sys::gst_element_factory_get_element_type(self.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_get_element_type( + self.to_glib_none().0, + )) } } pub fn get_metadata(&self, key: &str) -> Option { unsafe { - from_glib_none(gst_sys::gst_element_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0)) + from_glib_none(gst_sys::gst_element_factory_get_metadata( + self.to_glib_none().0, + key.to_glib_none().0, + )) } } pub fn get_metadata_keys(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_get_metadata_keys(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_get_metadata_keys( + self.to_glib_none().0, + )) } } pub fn get_num_pad_templates(&self) -> u32 { - unsafe { - gst_sys::gst_element_factory_get_num_pad_templates(self.to_glib_none().0) - } + unsafe { gst_sys::gst_element_factory_get_num_pad_templates(self.to_glib_none().0) } } pub fn get_static_pad_templates(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_sys::gst_element_factory_get_static_pad_templates(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none( + gst_sys::gst_element_factory_get_static_pad_templates(self.to_glib_none().0), + ) } } pub fn get_uri_protocols(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_sys::gst_element_factory_get_uri_protocols(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_sys::gst_element_factory_get_uri_protocols( + self.to_glib_none().0, + )) } } pub fn get_uri_type(&self) -> URIType { unsafe { - from_glib(gst_sys::gst_element_factory_get_uri_type(self.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_get_uri_type( + self.to_glib_none().0, + )) } } pub fn has_interface(&self, interfacename: &str) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_has_interface(self.to_glib_none().0, interfacename.to_glib_none().0)) + from_glib(gst_sys::gst_element_factory_has_interface( + self.to_glib_none().0, + interfacename.to_glib_none().0, + )) } } pub fn list_is_type(&self, type_: ElementFactoryListType) -> bool { unsafe { - from_glib(gst_sys::gst_element_factory_list_is_type(self.to_glib_none().0, type_)) + from_glib(gst_sys::gst_element_factory_list_is_type( + self.to_glib_none().0, + type_, + )) } } pub fn find(name: &str) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_element_factory_find(name.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_element_factory_find(name.to_glib_none().0)) } } - pub fn list_filter(list: &[ElementFactory], caps: &Caps, direction: PadDirection, subsetonly: bool) -> Vec { + pub fn list_filter( + list: &[ElementFactory], + caps: &Caps, + direction: PadDirection, + subsetonly: bool, + ) -> Vec { assert_initialized_main_thread!(); unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_list_filter(list.to_glib_none().0, caps.to_glib_none().0, direction.to_glib(), subsetonly.to_glib())) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_list_filter( + list.to_glib_none().0, + caps.to_glib_none().0, + direction.to_glib(), + subsetonly.to_glib(), + )) } } pub fn list_get_elements(type_: ElementFactoryListType, minrank: Rank) -> Vec { assert_initialized_main_thread!(); unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_list_get_elements(type_, minrank.to_glib())) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_element_factory_list_get_elements( + type_, + minrank.to_glib(), + )) } } pub fn make(factoryname: &str, name: Option<&str>) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_none(gst_sys::gst_element_factory_make(factoryname.to_glib_none().0, name.to_glib_none().0)) + from_glib_none(gst_sys::gst_element_factory_make( + factoryname.to_glib_none().0, + name.to_glib_none().0, + )) } } } diff --git a/gstreamer/src/auto/enums.rs b/gstreamer/src/auto/enums.rs index aeebeda7b..1c99a9529 100644 --- a/gstreamer/src/auto/enums.rs +++ b/gstreamer/src/auto/enums.rs @@ -2,20 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::Quark; -use glib::StaticType; -use glib::Type; use glib::error::ErrorDomain; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::Quark; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_sys; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum BufferingMode { Stream, Download, @@ -35,7 +34,7 @@ impl ToGlib for BufferingMode { BufferingMode::Download => gst_sys::GST_BUFFERING_DOWNLOAD, BufferingMode::Timeshift => gst_sys::GST_BUFFERING_TIMESHIFT, BufferingMode::Live => gst_sys::GST_BUFFERING_LIVE, - BufferingMode::__Unknown(value) => value + BufferingMode::__Unknown(value) => value, } } } @@ -78,8 +77,7 @@ impl SetValue for BufferingMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum BusSyncReply { Drop, Pass, @@ -97,7 +95,7 @@ impl ToGlib for BusSyncReply { BusSyncReply::Drop => gst_sys::GST_BUS_DROP, BusSyncReply::Pass => gst_sys::GST_BUS_PASS, BusSyncReply::Async => gst_sys::GST_BUS_ASYNC, - BusSyncReply::__Unknown(value) => value + BusSyncReply::__Unknown(value) => value, } } } @@ -139,8 +137,7 @@ impl SetValue for BusSyncReply { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum CapsIntersectMode { ZigZag, First, @@ -156,7 +153,7 @@ impl ToGlib for CapsIntersectMode { match *self { CapsIntersectMode::ZigZag => gst_sys::GST_CAPS_INTERSECT_ZIG_ZAG, CapsIntersectMode::First => gst_sys::GST_CAPS_INTERSECT_FIRST, - CapsIntersectMode::__Unknown(value) => value + CapsIntersectMode::__Unknown(value) => value, } } } @@ -198,8 +195,7 @@ impl SetValue for CapsIntersectMode { } #[must_use] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ClockReturn { Ok, Early, @@ -227,7 +223,7 @@ impl ToGlib for ClockReturn { ClockReturn::Error => gst_sys::GST_CLOCK_ERROR, ClockReturn::Unsupported => gst_sys::GST_CLOCK_UNSUPPORTED, ClockReturn::Done => gst_sys::GST_CLOCK_DONE, - ClockReturn::__Unknown(value) => value + ClockReturn::__Unknown(value) => value, } } } @@ -274,8 +270,7 @@ impl SetValue for ClockReturn { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ClockType { Realtime, Monotonic, @@ -293,7 +288,7 @@ impl ToGlib for ClockType { ClockType::Realtime => gst_sys::GST_CLOCK_TYPE_REALTIME, ClockType::Monotonic => gst_sys::GST_CLOCK_TYPE_MONOTONIC, ClockType::Other => gst_sys::GST_CLOCK_TYPE_OTHER, - ClockType::__Unknown(value) => value + ClockType::__Unknown(value) => value, } } } @@ -335,8 +330,7 @@ impl SetValue for ClockType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum CoreError { Failed, TooLazy, @@ -378,7 +372,7 @@ impl ToGlib for CoreError { CoreError::Clock => gst_sys::GST_CORE_ERROR_CLOCK, CoreError::Disabled => gst_sys::GST_CORE_ERROR_DISABLED, CoreError::NumErrors => gst_sys::GST_CORE_ERROR_NUM_ERRORS, - CoreError::__Unknown(value) => value + CoreError::__Unknown(value) => value, } } } @@ -465,8 +459,7 @@ impl SetValue for CoreError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum DebugLevel { None, Error, @@ -498,7 +491,7 @@ impl ToGlib for DebugLevel { DebugLevel::Trace => gst_sys::GST_LEVEL_TRACE, DebugLevel::Memdump => gst_sys::GST_LEVEL_MEMDUMP, DebugLevel::Count => gst_sys::GST_LEVEL_COUNT, - DebugLevel::__Unknown(value) => value + DebugLevel::__Unknown(value) => value, } } } @@ -547,8 +540,7 @@ impl SetValue for DebugLevel { } } - #[derive(Debug, PartialEq, Eq, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] pub enum EventType { Unknown, FlushStart, @@ -620,7 +612,7 @@ impl ToGlib for EventType { EventType::CustomDownstreamSticky => gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY, EventType::CustomBoth => gst_sys::GST_EVENT_CUSTOM_BOTH, EventType::CustomBothOob => gst_sys::GST_EVENT_CUSTOM_BOTH_OOB, - EventType::__Unknown(value) => value + EventType::__Unknown(value) => value, } } } @@ -690,8 +682,7 @@ impl SetValue for EventType { } #[must_use] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum FlowReturn { CustomSuccess2, CustomSuccess1, @@ -729,7 +720,7 @@ impl ToGlib for FlowReturn { FlowReturn::CustomError => gst_sys::GST_FLOW_CUSTOM_ERROR, FlowReturn::CustomError1 => gst_sys::GST_FLOW_CUSTOM_ERROR_1, FlowReturn::CustomError2 => gst_sys::GST_FLOW_CUSTOM_ERROR_2, - FlowReturn::__Unknown(value) => value + FlowReturn::__Unknown(value) => value, } } } @@ -781,9 +772,8 @@ impl SetValue for FlowReturn { } } - #[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Clone, Copy)] +#[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub enum Format { Undefined, Default, @@ -807,7 +797,7 @@ impl ToGlib for Format { Format::Time => gst_sys::GST_FORMAT_TIME, Format::Buffers => gst_sys::GST_FORMAT_BUFFERS, Format::Percent => gst_sys::GST_FORMAT_PERCENT, - Format::__Unknown(value) => value + Format::__Unknown(value) => value, } } } @@ -852,8 +842,7 @@ impl SetValue for Format { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum LibraryError { Failed, TooLazy, @@ -879,7 +868,7 @@ impl ToGlib for LibraryError { LibraryError::Settings => gst_sys::GST_LIBRARY_ERROR_SETTINGS, LibraryError::Encode => gst_sys::GST_LIBRARY_ERROR_ENCODE, LibraryError::NumErrors => gst_sys::GST_LIBRARY_ERROR_NUM_ERRORS, - LibraryError::__Unknown(value) => value + LibraryError::__Unknown(value) => value, } } } @@ -950,8 +939,7 @@ impl SetValue for LibraryError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PadDirection { Unknown, Src, @@ -969,7 +957,7 @@ impl ToGlib for PadDirection { PadDirection::Unknown => gst_sys::GST_PAD_UNKNOWN, PadDirection::Src => gst_sys::GST_PAD_SRC, PadDirection::Sink => gst_sys::GST_PAD_SINK, - PadDirection::__Unknown(value) => value + PadDirection::__Unknown(value) => value, } } } @@ -1012,8 +1000,7 @@ impl SetValue for PadDirection { } #[must_use] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PadLinkReturn { Ok, WrongHierarchy, @@ -1039,7 +1026,7 @@ impl ToGlib for PadLinkReturn { PadLinkReturn::Noformat => gst_sys::GST_PAD_LINK_NOFORMAT, PadLinkReturn::Nosched => gst_sys::GST_PAD_LINK_NOSCHED, PadLinkReturn::Refused => gst_sys::GST_PAD_LINK_REFUSED, - PadLinkReturn::__Unknown(value) => value + PadLinkReturn::__Unknown(value) => value, } } } @@ -1085,8 +1072,7 @@ impl SetValue for PadLinkReturn { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PadMode { None, Push, @@ -1104,7 +1090,7 @@ impl ToGlib for PadMode { PadMode::None => gst_sys::GST_PAD_MODE_NONE, PadMode::Push => gst_sys::GST_PAD_MODE_PUSH, PadMode::Pull => gst_sys::GST_PAD_MODE_PULL, - PadMode::__Unknown(value) => value + PadMode::__Unknown(value) => value, } } } @@ -1146,8 +1132,7 @@ impl SetValue for PadMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PadPresence { Always, Sometimes, @@ -1165,7 +1150,7 @@ impl ToGlib for PadPresence { PadPresence::Always => gst_sys::GST_PAD_ALWAYS, PadPresence::Sometimes => gst_sys::GST_PAD_SOMETIMES, PadPresence::Request => gst_sys::GST_PAD_REQUEST, - PadPresence::__Unknown(value) => value + PadPresence::__Unknown(value) => value, } } } @@ -1207,8 +1192,7 @@ impl SetValue for PadPresence { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PadProbeReturn { Drop, Ok, @@ -1230,7 +1214,7 @@ impl ToGlib for PadProbeReturn { PadProbeReturn::Remove => gst_sys::GST_PAD_PROBE_REMOVE, PadProbeReturn::Pass => gst_sys::GST_PAD_PROBE_PASS, PadProbeReturn::Handled => gst_sys::GST_PAD_PROBE_HANDLED, - PadProbeReturn::__Unknown(value) => value + PadProbeReturn::__Unknown(value) => value, } } } @@ -1274,8 +1258,7 @@ impl SetValue for PadProbeReturn { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ParseError { Syntax, NoSuchElement, @@ -1303,7 +1286,7 @@ impl ToGlib for ParseError { ParseError::EmptyBin => gst_sys::GST_PARSE_ERROR_EMPTY_BIN, ParseError::Empty => gst_sys::GST_PARSE_ERROR_EMPTY, ParseError::DelayedLink => gst_sys::GST_PARSE_ERROR_DELAYED_LINK, - ParseError::__Unknown(value) => value + ParseError::__Unknown(value) => value, } } } @@ -1376,8 +1359,7 @@ impl SetValue for ParseError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PluginError { Module, Dependencies, @@ -1395,7 +1377,7 @@ impl ToGlib for PluginError { PluginError::Module => gst_sys::GST_PLUGIN_ERROR_MODULE, PluginError::Dependencies => gst_sys::GST_PLUGIN_ERROR_DEPENDENCIES, PluginError::NameMismatch => gst_sys::GST_PLUGIN_ERROR_NAME_MISMATCH, - PluginError::__Unknown(value) => value + PluginError::__Unknown(value) => value, } } } @@ -1458,8 +1440,7 @@ impl SetValue for PluginError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ProgressType { Start, Continue, @@ -1481,7 +1462,7 @@ impl ToGlib for ProgressType { ProgressType::Complete => gst_sys::GST_PROGRESS_TYPE_COMPLETE, ProgressType::Canceled => gst_sys::GST_PROGRESS_TYPE_CANCELED, ProgressType::Error => gst_sys::GST_PROGRESS_TYPE_ERROR, - ProgressType::__Unknown(value) => value + ProgressType::__Unknown(value) => value, } } } @@ -1526,8 +1507,7 @@ impl SetValue for ProgressType { } #[cfg(any(feature = "v1_14", feature = "dox"))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum PromiseResult { Pending, Interrupted, @@ -1548,7 +1528,7 @@ impl ToGlib for PromiseResult { PromiseResult::Interrupted => gst_sys::GST_PROMISE_RESULT_INTERRUPTED, PromiseResult::Replied => gst_sys::GST_PROMISE_RESULT_REPLIED, PromiseResult::Expired => gst_sys::GST_PROMISE_RESULT_EXPIRED, - PromiseResult::__Unknown(value) => value + PromiseResult::__Unknown(value) => value, } } } @@ -1596,8 +1576,7 @@ impl SetValue for PromiseResult { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum QOSType { Overflow, Underflow, @@ -1615,7 +1594,7 @@ impl ToGlib for QOSType { QOSType::Overflow => gst_sys::GST_QOS_TYPE_OVERFLOW, QOSType::Underflow => gst_sys::GST_QOS_TYPE_UNDERFLOW, QOSType::Throttle => gst_sys::GST_QOS_TYPE_THROTTLE, - QOSType::__Unknown(value) => value + QOSType::__Unknown(value) => value, } } } @@ -1657,8 +1636,7 @@ impl SetValue for QOSType { } } - #[derive(Debug)] -#[derive(Clone, Copy)] +#[derive(Debug, Clone, Copy)] pub enum Rank { None, Marginal, @@ -1678,7 +1656,7 @@ impl ToGlib for Rank { Rank::Marginal => gst_sys::GST_RANK_MARGINAL, Rank::Secondary => gst_sys::GST_RANK_SECONDARY, Rank::Primary => gst_sys::GST_RANK_PRIMARY, - Rank::__Unknown(value) => value + Rank::__Unknown(value) => value, } } } @@ -1721,8 +1699,7 @@ impl SetValue for Rank { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ResourceError { Failed, TooLazy, @@ -1766,7 +1743,7 @@ impl ToGlib for ResourceError { ResourceError::NoSpaceLeft => gst_sys::GST_RESOURCE_ERROR_NO_SPACE_LEFT, ResourceError::NotAuthorized => gst_sys::GST_RESOURCE_ERROR_NOT_AUTHORIZED, ResourceError::NumErrors => gst_sys::GST_RESOURCE_ERROR_NUM_ERRORS, - ResourceError::__Unknown(value) => value + ResourceError::__Unknown(value) => value, } } } @@ -1855,8 +1832,7 @@ impl SetValue for ResourceError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum SeekType { None, Set, @@ -1874,7 +1850,7 @@ impl ToGlib for SeekType { SeekType::None => gst_sys::GST_SEEK_TYPE_NONE, SeekType::Set => gst_sys::GST_SEEK_TYPE_SET, SeekType::End => gst_sys::GST_SEEK_TYPE_END, - SeekType::__Unknown(value) => value + SeekType::__Unknown(value) => value, } } } @@ -1916,8 +1892,7 @@ impl SetValue for SeekType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum State { VoidPending, Null, @@ -1939,7 +1914,7 @@ impl ToGlib for State { State::Ready => gst_sys::GST_STATE_READY, State::Paused => gst_sys::GST_STATE_PAUSED, State::Playing => gst_sys::GST_STATE_PLAYING, - State::__Unknown(value) => value + State::__Unknown(value) => value, } } } @@ -1983,8 +1958,7 @@ impl SetValue for State { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StateChange { NullToReady, ReadyToPaused, @@ -2016,7 +1990,7 @@ impl ToGlib for StateChange { StateChange::ReadyToReady => gst_sys::GST_STATE_CHANGE_READY_TO_READY, StateChange::PausedToPaused => gst_sys::GST_STATE_CHANGE_PAUSED_TO_PAUSED, StateChange::PlayingToPlaying => gst_sys::GST_STATE_CHANGE_PLAYING_TO_PLAYING, - StateChange::__Unknown(value) => value + StateChange::__Unknown(value) => value, } } } @@ -2066,8 +2040,7 @@ impl SetValue for StateChange { } #[must_use] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StateChangeReturn { Failure, Success, @@ -2087,7 +2060,7 @@ impl ToGlib for StateChangeReturn { StateChangeReturn::Success => gst_sys::GST_STATE_CHANGE_SUCCESS, StateChangeReturn::Async => gst_sys::GST_STATE_CHANGE_ASYNC, StateChangeReturn::NoPreroll => gst_sys::GST_STATE_CHANGE_NO_PREROLL, - StateChangeReturn::__Unknown(value) => value + StateChangeReturn::__Unknown(value) => value, } } } @@ -2130,8 +2103,7 @@ impl SetValue for StateChangeReturn { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StreamError { Failed, TooLazy, @@ -2171,7 +2143,7 @@ impl ToGlib for StreamError { StreamError::Decrypt => gst_sys::GST_STREAM_ERROR_DECRYPT, StreamError::DecryptNokey => gst_sys::GST_STREAM_ERROR_DECRYPT_NOKEY, StreamError::NumErrors => gst_sys::GST_STREAM_ERROR_NUM_ERRORS, - StreamError::__Unknown(value) => value + StreamError::__Unknown(value) => value, } } } @@ -2256,8 +2228,7 @@ impl SetValue for StreamError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StreamStatusType { Create, Enter, @@ -2283,7 +2254,7 @@ impl ToGlib for StreamStatusType { StreamStatusType::Start => gst_sys::GST_STREAM_STATUS_TYPE_START, StreamStatusType::Pause => gst_sys::GST_STREAM_STATUS_TYPE_PAUSE, StreamStatusType::Stop => gst_sys::GST_STREAM_STATUS_TYPE_STOP, - StreamStatusType::__Unknown(value) => value + StreamStatusType::__Unknown(value) => value, } } } @@ -2329,8 +2300,7 @@ impl SetValue for StreamStatusType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum StructureChangeType { Link, Unlink, @@ -2346,7 +2316,7 @@ impl ToGlib for StructureChangeType { match *self { StructureChangeType::Link => gst_sys::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK, StructureChangeType::Unlink => gst_sys::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK, - StructureChangeType::__Unknown(value) => value + StructureChangeType::__Unknown(value) => value, } } } @@ -2387,8 +2357,7 @@ impl SetValue for StructureChangeType { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum TagFlag { Undefined, Meta, @@ -2410,7 +2379,7 @@ impl ToGlib for TagFlag { TagFlag::Encoded => gst_sys::GST_TAG_FLAG_ENCODED, TagFlag::Decoded => gst_sys::GST_TAG_FLAG_DECODED, TagFlag::Count => gst_sys::GST_TAG_FLAG_COUNT, - TagFlag::__Unknown(value) => value + TagFlag::__Unknown(value) => value, } } } @@ -2454,8 +2423,7 @@ impl SetValue for TagFlag { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum TagMergeMode { Undefined, ReplaceAll, @@ -2483,7 +2451,7 @@ impl ToGlib for TagMergeMode { TagMergeMode::Keep => gst_sys::GST_TAG_MERGE_KEEP, TagMergeMode::KeepAll => gst_sys::GST_TAG_MERGE_KEEP_ALL, TagMergeMode::Count => gst_sys::GST_TAG_MERGE_COUNT, - TagMergeMode::__Unknown(value) => value + TagMergeMode::__Unknown(value) => value, } } } @@ -2530,9 +2498,8 @@ impl SetValue for TagMergeMode { } } - #[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Clone, Copy)] +#[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub enum TagScope { Stream, Global, @@ -2548,7 +2515,7 @@ impl ToGlib for TagScope { match *self { TagScope::Stream => gst_sys::GST_TAG_SCOPE_STREAM, TagScope::Global => gst_sys::GST_TAG_SCOPE_GLOBAL, - TagScope::__Unknown(value) => value + TagScope::__Unknown(value) => value, } } } @@ -2589,8 +2556,7 @@ impl SetValue for TagScope { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum TaskState { Started, Stopped, @@ -2608,7 +2574,7 @@ impl ToGlib for TaskState { TaskState::Started => gst_sys::GST_TASK_STARTED, TaskState::Stopped => gst_sys::GST_TASK_STOPPED, TaskState::Paused => gst_sys::GST_TASK_PAUSED, - TaskState::__Unknown(value) => value + TaskState::__Unknown(value) => value, } } } @@ -2650,9 +2616,8 @@ impl SetValue for TaskState { } } - #[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Clone, Copy)] +#[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub enum TocEntryType { Angle, Version, @@ -2678,7 +2643,7 @@ impl ToGlib for TocEntryType { TocEntryType::Title => gst_sys::GST_TOC_ENTRY_TYPE_TITLE, TocEntryType::Track => gst_sys::GST_TOC_ENTRY_TYPE_TRACK, TocEntryType::Chapter => gst_sys::GST_TOC_ENTRY_TYPE_CHAPTER, - TocEntryType::__Unknown(value) => value + TocEntryType::__Unknown(value) => value, } } } @@ -2724,9 +2689,8 @@ impl SetValue for TocEntryType { } } - #[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Clone, Copy)] +#[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub enum TocLoopType { None, Forward, @@ -2746,7 +2710,7 @@ impl ToGlib for TocLoopType { TocLoopType::Forward => gst_sys::GST_TOC_LOOP_FORWARD, TocLoopType::Reverse => gst_sys::GST_TOC_LOOP_REVERSE, TocLoopType::PingPong => gst_sys::GST_TOC_LOOP_PING_PONG, - TocLoopType::__Unknown(value) => value + TocLoopType::__Unknown(value) => value, } } } @@ -2789,9 +2753,8 @@ impl SetValue for TocLoopType { } } - #[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Clone, Copy)] +#[cfg_attr(feature = "ser_de", derive(Serialize, Deserialize))] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub enum TocScope { Global, Current, @@ -2807,7 +2770,7 @@ impl ToGlib for TocScope { match *self { TocScope::Global => gst_sys::GST_TOC_SCOPE_GLOBAL, TocScope::Current => gst_sys::GST_TOC_SCOPE_CURRENT, - TocScope::__Unknown(value) => value + TocScope::__Unknown(value) => value, } } } @@ -2848,8 +2811,7 @@ impl SetValue for TocScope { } } - #[derive(Debug)] -#[derive(Clone, Copy)] +#[derive(Debug, Clone, Copy)] pub enum TypeFindProbability { None, Minimum, @@ -2873,7 +2835,7 @@ impl ToGlib for TypeFindProbability { TypeFindProbability::Likely => gst_sys::GST_TYPE_FIND_LIKELY, TypeFindProbability::NearlyCertain => gst_sys::GST_TYPE_FIND_NEARLY_CERTAIN, TypeFindProbability::Maximum => gst_sys::GST_TYPE_FIND_MAXIMUM, - TypeFindProbability::__Unknown(value) => value + TypeFindProbability::__Unknown(value) => value, } } } @@ -2918,8 +2880,7 @@ impl SetValue for TypeFindProbability { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum URIError { UnsupportedProtocol, BadUri, @@ -2939,7 +2900,7 @@ impl ToGlib for URIError { URIError::BadUri => gst_sys::GST_URI_ERROR_BAD_URI, URIError::BadState => gst_sys::GST_URI_ERROR_BAD_STATE, URIError::BadReference => gst_sys::GST_URI_ERROR_BAD_REFERENCE, - URIError::__Unknown(value) => value + URIError::__Unknown(value) => value, } } } @@ -3004,8 +2965,7 @@ impl SetValue for URIError { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum URIType { Unknown, Sink, @@ -3023,7 +2983,7 @@ impl ToGlib for URIType { URIType::Unknown => gst_sys::GST_URI_UNKNOWN, URIType::Sink => gst_sys::GST_URI_SINK, URIType::Src => gst_sys::GST_URI_SRC, - URIType::__Unknown(value) => value + URIType::__Unknown(value) => value, } } } @@ -3064,4 +3024,3 @@ impl SetValue for URIType { gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer/src/auto/flags.rs b/gstreamer/src/auto/flags.rs index a7d705e2c..97dd5d7a3 100644 --- a/gstreamer/src/auto/flags.rs +++ b/gstreamer/src/auto/flags.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib::StaticType; -use glib::Type; use glib::translate::*; use glib::value::FromValue; use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; +use glib::StaticType; +use glib::Type; use gobject_sys; use gst_sys; @@ -1197,4 +1197,3 @@ impl SetValue for StreamType { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - diff --git a/gstreamer/src/auto/functions.rs b/gstreamer/src/auto/functions.rs index 17f0feb5d..5b181305e 100644 --- a/gstreamer/src/auto/functions.rs +++ b/gstreamer/src/auto/functions.rs @@ -2,6 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::IsA; +use glib::translate::*; +use glib::GString; +use gst_sys; +use std; +use std::mem; +use std::ptr; use Bin; use ClockTime; use DebugGraphDetails; @@ -10,15 +18,6 @@ use Element; use Error; #[cfg(any(feature = "v1_12", feature = "dox"))] use StackTraceFlags; -use glib; -use glib::GString; -use glib::object::IsA; -use glib::translate::*; -use gst_sys; -use std; -use std::mem; -use std::ptr; - #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn debug_add_ring_buffer_logger(max_size_per_thread: u32, thread_timeout: u32) { @@ -31,51 +30,62 @@ pub fn debug_add_ring_buffer_logger(max_size_per_thread: u32, thread_timeout: u3 pub fn debug_bin_to_dot_data>(bin: &P, details: DebugGraphDetails) -> GString { skip_assert_initialized!(); unsafe { - from_glib_full(gst_sys::gst_debug_bin_to_dot_data(bin.as_ref().to_glib_none().0, details.to_glib())) + from_glib_full(gst_sys::gst_debug_bin_to_dot_data( + bin.as_ref().to_glib_none().0, + details.to_glib(), + )) } } -pub fn debug_bin_to_dot_file, Q: AsRef>(bin: &P, details: DebugGraphDetails, file_name: Q) { +pub fn debug_bin_to_dot_file, Q: AsRef>( + bin: &P, + details: DebugGraphDetails, + file_name: Q, +) { skip_assert_initialized!(); unsafe { - gst_sys::gst_debug_bin_to_dot_file(bin.as_ref().to_glib_none().0, details.to_glib(), file_name.as_ref().to_glib_none().0); + gst_sys::gst_debug_bin_to_dot_file( + bin.as_ref().to_glib_none().0, + details.to_glib(), + file_name.as_ref().to_glib_none().0, + ); } } -pub fn debug_bin_to_dot_file_with_ts, Q: AsRef>(bin: &P, details: DebugGraphDetails, file_name: Q) { +pub fn debug_bin_to_dot_file_with_ts, Q: AsRef>( + bin: &P, + details: DebugGraphDetails, + file_name: Q, +) { skip_assert_initialized!(); unsafe { - gst_sys::gst_debug_bin_to_dot_file_with_ts(bin.as_ref().to_glib_none().0, details.to_glib(), file_name.as_ref().to_glib_none().0); + gst_sys::gst_debug_bin_to_dot_file_with_ts( + bin.as_ref().to_glib_none().0, + details.to_glib(), + file_name.as_ref().to_glib_none().0, + ); } } pub fn debug_get_default_threshold() -> DebugLevel { assert_initialized_main_thread!(); - unsafe { - from_glib(gst_sys::gst_debug_get_default_threshold()) - } + unsafe { from_glib(gst_sys::gst_debug_get_default_threshold()) } } #[cfg(any(feature = "v1_12", feature = "dox"))] pub fn debug_get_stack_trace(flags: StackTraceFlags) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_debug_get_stack_trace(flags.to_glib())) - } + unsafe { from_glib_full(gst_sys::gst_debug_get_stack_trace(flags.to_glib())) } } pub fn debug_is_active() -> bool { assert_initialized_main_thread!(); - unsafe { - from_glib(gst_sys::gst_debug_is_active()) - } + unsafe { from_glib(gst_sys::gst_debug_is_active()) } } pub fn debug_is_colored() -> bool { assert_initialized_main_thread!(); - unsafe { - from_glib(gst_sys::gst_debug_is_colored()) - } + unsafe { from_glib(gst_sys::gst_debug_is_colored()) } } pub fn debug_print_stack_trace() { @@ -146,17 +156,26 @@ pub fn debug_unset_threshold_for_name(name: &str) { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_main_executable_path() -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_sys::gst_get_main_executable_path()) - } + unsafe { from_glib_none(gst_sys::gst_get_main_executable_path()) } } -pub fn parse_bin_from_description(bin_description: &str, ghost_unlinked_pads: bool) -> Result { +pub fn parse_bin_from_description( + bin_description: &str, + ghost_unlinked_pads: bool, +) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = ptr::null_mut(); - let ret = gst_sys::gst_parse_bin_from_description(bin_description.to_glib_none().0, ghost_unlinked_pads.to_glib(), &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + let ret = gst_sys::gst_parse_bin_from_description( + bin_description.to_glib_none().0, + ghost_unlinked_pads.to_glib(), + &mut error, + ); + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -165,7 +184,11 @@ pub fn parse_launch(pipeline_description: &str) -> Result { unsafe { let mut error = ptr::null_mut(); let ret = gst_sys::gst_parse_launch(pipeline_description.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -174,22 +197,27 @@ pub fn parse_launchv(argv: &[&str]) -> Result { unsafe { let mut error = ptr::null_mut(); let ret = gst_sys::gst_parse_launchv(argv.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } pub fn update_registry() -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { - glib_result_from_gboolean!(gst_sys::gst_update_registry(), "Failed to update the registry") + glib_result_from_gboolean!( + gst_sys::gst_update_registry(), + "Failed to update the registry" + ) } } pub fn util_get_timestamp() -> ClockTime { assert_initialized_main_thread!(); - unsafe { - from_glib(gst_sys::gst_util_get_timestamp()) - } + unsafe { from_glib(gst_sys::gst_util_get_timestamp()) } } pub fn version() -> (u32, u32, u32, u32) { @@ -206,7 +234,5 @@ pub fn version() -> (u32, u32, u32, u32) { pub fn version_string() -> GString { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_version_string()) - } + unsafe { from_glib_full(gst_sys::gst_version_string()) } } diff --git a/gstreamer/src/auto/ghost_pad.rs b/gstreamer/src/auto/ghost_pad.rs index 4b1f45d91..c1f020f96 100644 --- a/gstreamer/src/auto/ghost_pad.rs +++ b/gstreamer/src/auto/ghost_pad.rs @@ -2,16 +2,16 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; -use Pad; -use PadDirection; -use PadTemplate; -use ProxyPad; use glib; use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use gst_sys; +use Object; +use Pad; +use PadDirection; +use PadTemplate; +use ProxyPad; glib_wrapper! { pub struct GhostPad(Object) @extends ProxyPad, Pad, Object; @@ -25,14 +25,25 @@ impl GhostPad { pub fn new_no_target(name: Option<&str>, dir: PadDirection) -> Option { assert_initialized_main_thread!(); unsafe { - Option::::from_glib_none(gst_sys::gst_ghost_pad_new_no_target(name.to_glib_none().0, dir.to_glib())).map(|o| o.unsafe_cast()) + Option::::from_glib_none(gst_sys::gst_ghost_pad_new_no_target( + name.to_glib_none().0, + dir.to_glib(), + )) + .map(|o| o.unsafe_cast()) } } - pub fn new_no_target_from_template(name: Option<&str>, templ: &PadTemplate) -> Option { + pub fn new_no_target_from_template( + name: Option<&str>, + templ: &PadTemplate, + ) -> Option { skip_assert_initialized!(); unsafe { - Option::::from_glib_none(gst_sys::gst_ghost_pad_new_no_target_from_template(name.to_glib_none().0, templ.to_glib_none().0)).map(|o| o.unsafe_cast()) + Option::::from_glib_none(gst_sys::gst_ghost_pad_new_no_target_from_template( + name.to_glib_none().0, + templ.to_glib_none().0, + )) + .map(|o| o.unsafe_cast()) } } } @@ -51,13 +62,21 @@ pub trait GhostPadExt: 'static { impl> GhostPadExt for O { fn get_target(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_ghost_pad_get_target(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_ghost_pad_get_target( + self.as_ref().to_glib_none().0, + )) } } fn set_target>(&self, newtarget: Option<&P>) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_ghost_pad_set_target(self.as_ref().to_glib_none().0, newtarget.map(|p| p.as_ref()).to_glib_none().0), "Failed to set target") + glib_result_from_gboolean!( + gst_sys::gst_ghost_pad_set_target( + self.as_ref().to_glib_none().0, + newtarget.map(|p| p.as_ref()).to_glib_none().0 + ), + "Failed to set target" + ) } } } diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 28a9a9de3..9fc90bbe2 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -3,83 +3,83 @@ // DO NOT EDIT mod allocator; -pub use self::allocator::{Allocator, AllocatorClass, NONE_ALLOCATOR}; pub use self::allocator::AllocatorExt; +pub use self::allocator::{Allocator, AllocatorClass, NONE_ALLOCATOR}; mod bin; -pub use self::bin::{Bin, BinClass, NONE_BIN}; pub use self::bin::GstBinExt; +pub use self::bin::{Bin, BinClass, NONE_BIN}; mod buffer_pool; -pub use self::buffer_pool::{BufferPool, BufferPoolClass, NONE_BUFFER_POOL}; pub use self::buffer_pool::BufferPoolExt; +pub use self::buffer_pool::{BufferPool, BufferPoolClass, NONE_BUFFER_POOL}; mod bus; pub use self::bus::{Bus, BusClass}; mod child_proxy; -pub use self::child_proxy::{ChildProxy, NONE_CHILD_PROXY}; pub use self::child_proxy::ChildProxyExt; +pub use self::child_proxy::{ChildProxy, NONE_CHILD_PROXY}; mod clock; -pub use self::clock::{Clock, ClockClass, NONE_CLOCK}; pub use self::clock::ClockExt; +pub use self::clock::{Clock, ClockClass, NONE_CLOCK}; mod device; -pub use self::device::{Device, DeviceClass, NONE_DEVICE}; pub use self::device::DeviceExt; +pub use self::device::{Device, DeviceClass, NONE_DEVICE}; mod device_monitor; -pub use self::device_monitor::{DeviceMonitor, DeviceMonitorClass, NONE_DEVICE_MONITOR}; pub use self::device_monitor::DeviceMonitorExt; +pub use self::device_monitor::{DeviceMonitor, DeviceMonitorClass, NONE_DEVICE_MONITOR}; mod device_provider; -pub use self::device_provider::{DeviceProvider, DeviceProviderClass, NONE_DEVICE_PROVIDER}; pub use self::device_provider::DeviceProviderExt; +pub use self::device_provider::{DeviceProvider, DeviceProviderClass, NONE_DEVICE_PROVIDER}; mod device_provider_factory; pub use self::device_provider_factory::{DeviceProviderFactory, DeviceProviderFactoryClass}; mod element; -pub use self::element::{Element, ElementClass, NONE_ELEMENT}; pub use self::element::ElementExt; +pub use self::element::{Element, ElementClass, NONE_ELEMENT}; mod element_factory; pub use self::element_factory::{ElementFactory, ElementFactoryClass}; mod ghost_pad; -pub use self::ghost_pad::{GhostPad, GhostPadClass, NONE_GHOST_PAD}; pub use self::ghost_pad::GhostPadExt; +pub use self::ghost_pad::{GhostPad, GhostPadClass, NONE_GHOST_PAD}; mod object; -pub use self::object::{Object, ObjectClass, NONE_OBJECT}; pub use self::object::GstObjectExt; +pub use self::object::{Object, ObjectClass, NONE_OBJECT}; mod pad; -pub use self::pad::{Pad, PadClass, NONE_PAD}; pub use self::pad::PadExt; +pub use self::pad::{Pad, PadClass, NONE_PAD}; mod pad_template; pub use self::pad_template::{PadTemplate, PadTemplateClass}; mod pipeline; -pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; pub use self::pipeline::PipelineExt; +pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; mod plugin; pub use self::plugin::{Plugin, PluginClass}; mod plugin_feature; -pub use self::plugin_feature::{PluginFeature, PluginFeatureClass, NONE_PLUGIN_FEATURE}; pub use self::plugin_feature::PluginFeatureExt; +pub use self::plugin_feature::{PluginFeature, PluginFeatureClass, NONE_PLUGIN_FEATURE}; mod preset; -pub use self::preset::{Preset, NONE_PRESET}; pub use self::preset::PresetExt; +pub use self::preset::{Preset, NONE_PRESET}; mod proxy_pad; -pub use self::proxy_pad::{ProxyPad, ProxyPadClass, NONE_PROXY_PAD}; pub use self::proxy_pad::ProxyPadExt; +pub use self::proxy_pad::{ProxyPad, ProxyPadClass, NONE_PROXY_PAD}; mod registry; pub use self::registry::{Registry, RegistryClass}; @@ -95,23 +95,23 @@ mod stream_collection; pub use self::stream_collection::{StreamCollection, StreamCollectionClass}; mod system_clock; -pub use self::system_clock::{SystemClock, SystemClockClass, NONE_SYSTEM_CLOCK}; pub use self::system_clock::SystemClockExt; +pub use self::system_clock::{SystemClock, SystemClockClass, NONE_SYSTEM_CLOCK}; mod tag_setter; -pub use self::tag_setter::{TagSetter, NONE_TAG_SETTER}; pub use self::tag_setter::TagSetterExt; +pub use self::tag_setter::{TagSetter, NONE_TAG_SETTER}; mod toc_setter; -pub use self::toc_setter::{TocSetter, NONE_TOC_SETTER}; pub use self::toc_setter::TocSetterExt; +pub use self::toc_setter::{TocSetter, NONE_TOC_SETTER}; mod type_find_factory; pub use self::type_find_factory::{TypeFindFactory, TypeFindFactoryClass}; mod uri_handler; -pub use self::uri_handler::{URIHandler, NONE_URI_HANDLER}; pub use self::uri_handler::URIHandlerExt; +pub use self::uri_handler::{URIHandler, NONE_URI_HANDLER}; mod date_time; pub use self::date_time::DateTime; @@ -194,7 +194,6 @@ pub mod functions; #[doc(hidden)] pub mod traits { pub use super::AllocatorExt; - pub use super::GstBinExt; pub use super::BufferPoolExt; pub use super::ChildProxyExt; pub use super::ClockExt; @@ -203,6 +202,7 @@ pub mod traits { pub use super::DeviceProviderExt; pub use super::ElementExt; pub use super::GhostPadExt; + pub use super::GstBinExt; pub use super::GstObjectExt; pub use super::PadExt; pub use super::PipelineExt; diff --git a/gstreamer/src/auto/object.rs b/gstreamer/src/auto/object.rs index e521fec6b..6c8e2303d 100644 --- a/gstreamer/src/auto/object.rs +++ b/gstreamer/src/auto/object.rs @@ -2,19 +2,19 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ClockTime; -use Error; use glib; -use glib::GString; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use ClockTime; +use Error; glib_wrapper! { pub struct Object(Object); @@ -28,7 +28,10 @@ impl Object { pub fn check_uniqueness(list: &[Object], name: &str) -> bool { assert_initialized_main_thread!(); unsafe { - from_glib(gst_sys::gst_object_check_uniqueness(list.to_glib_none().0, name.to_glib_none().0)) + from_glib(gst_sys::gst_object_check_uniqueness( + list.to_glib_none().0, + name.to_glib_none().0, + )) } } @@ -99,9 +102,15 @@ pub trait GstObjectExt: 'static { //fn connect_deep_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_name_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_name_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_parent_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> GstObjectExt for O { @@ -111,7 +120,11 @@ impl> GstObjectExt for O { fn default_error(&self, error: &Error, debug: Option<&str>) { unsafe { - gst_sys::gst_object_default_error(self.as_ref().to_glib_none().0, error.to_glib_none().0, debug.to_glib_none().0); + gst_sys::gst_object_default_error( + self.as_ref().to_glib_none().0, + error.to_glib_none().0, + debug.to_glib_none().0, + ); } } @@ -121,7 +134,9 @@ impl> GstObjectExt for O { fn get_control_rate(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_object_get_control_rate(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_get_control_rate( + self.as_ref().to_glib_none().0, + )) } } @@ -130,20 +145,22 @@ impl> GstObjectExt for O { //} fn get_name(&self) -> GString { - unsafe { - from_glib_full(gst_sys::gst_object_get_name(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_object_get_name(self.as_ref().to_glib_none().0)) } } fn get_parent(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_object_get_parent(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_object_get_parent( + self.as_ref().to_glib_none().0, + )) } } fn get_path_string(&self) -> GString { unsafe { - from_glib_full(gst_sys::gst_object_get_path_string(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_object_get_path_string( + self.as_ref().to_glib_none().0, + )) } } @@ -157,25 +174,36 @@ impl> GstObjectExt for O { fn has_active_control_bindings(&self) -> bool { unsafe { - from_glib(gst_sys::gst_object_has_active_control_bindings(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_has_active_control_bindings( + self.as_ref().to_glib_none().0, + )) } } fn has_ancestor>(&self, ancestor: &P) -> bool { unsafe { - from_glib(gst_sys::gst_object_has_ancestor(self.as_ref().to_glib_none().0, ancestor.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_has_ancestor( + self.as_ref().to_glib_none().0, + ancestor.as_ref().to_glib_none().0, + )) } } fn has_as_ancestor>(&self, ancestor: &P) -> bool { unsafe { - from_glib(gst_sys::gst_object_has_as_ancestor(self.as_ref().to_glib_none().0, ancestor.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_has_as_ancestor( + self.as_ref().to_glib_none().0, + ancestor.as_ref().to_glib_none().0, + )) } } fn has_as_parent>(&self, parent: &P) -> bool { unsafe { - from_glib(gst_sys::gst_object_has_as_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_has_as_parent( + self.as_ref().to_glib_none().0, + parent.as_ref().to_glib_none().0, + )) } } @@ -185,43 +213,70 @@ impl> GstObjectExt for O { fn set_control_binding_disabled(&self, property_name: &str, disabled: bool) { unsafe { - gst_sys::gst_object_set_control_binding_disabled(self.as_ref().to_glib_none().0, property_name.to_glib_none().0, disabled.to_glib()); + gst_sys::gst_object_set_control_binding_disabled( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + disabled.to_glib(), + ); } } fn set_control_bindings_disabled(&self, disabled: bool) { unsafe { - gst_sys::gst_object_set_control_bindings_disabled(self.as_ref().to_glib_none().0, disabled.to_glib()); + gst_sys::gst_object_set_control_bindings_disabled( + self.as_ref().to_glib_none().0, + disabled.to_glib(), + ); } } fn set_control_rate(&self, control_rate: ClockTime) { unsafe { - gst_sys::gst_object_set_control_rate(self.as_ref().to_glib_none().0, control_rate.to_glib()); + gst_sys::gst_object_set_control_rate( + self.as_ref().to_glib_none().0, + control_rate.to_glib(), + ); } } fn set_name(&self, name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_object_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to set object name") + glib_result_from_gboolean!( + gst_sys::gst_object_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0), + "Failed to set object name" + ) } } fn set_parent>(&self, parent: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_object_set_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0), "Failed to set parent object") + glib_result_from_gboolean!( + gst_sys::gst_object_set_parent( + self.as_ref().to_glib_none().0, + parent.as_ref().to_glib_none().0 + ), + "Failed to set parent object" + ) } } fn suggest_next_sync(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_object_suggest_next_sync(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_object_suggest_next_sync( + self.as_ref().to_glib_none().0, + )) } } fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_object_sync_values(self.as_ref().to_glib_none().0, timestamp.to_glib()), "Failed to sync values") + glib_result_from_gboolean!( + gst_sys::gst_object_sync_values( + self.as_ref().to_glib_none().0, + timestamp.to_glib() + ), + "Failed to sync values" + ) } } @@ -235,31 +290,53 @@ impl> GstObjectExt for O { // Ignored prop: GObject.ParamSpec //} - fn connect_property_name_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_name_trampoline(this: *mut gst_sys::GstObject, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_name_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_name_trampoline( + this: *mut gst_sys::GstObject, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Object::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, - Some(transmute(notify_name_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::name\0".as_ptr() as *const _, + Some(transmute(notify_name_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_parent_trampoline(this: *mut gst_sys::GstObject, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_parent_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_parent_trampoline( + this: *mut gst_sys::GstObject, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Object::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::parent\0".as_ptr() as *const _, - Some(transmute(notify_parent_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::parent\0".as_ptr() as *const _, + Some(transmute(notify_parent_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/pad.rs b/gstreamer/src/auto/pad.rs index dc9e0bd36..9fe092075 100644 --- a/gstreamer/src/auto/pad.rs +++ b/gstreamer/src/auto/pad.rs @@ -2,6 +2,20 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::GString; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; use Caps; use Element; use Event; @@ -16,20 +30,6 @@ use PadTemplate; use Stream; #[cfg(any(feature = "v1_12", feature = "dox"))] use TaskState; -use glib; -use glib::GString; -use glib::StaticType; -use glib::Value; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gobject_sys; -use gst_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Pad(Object) @extends Object; @@ -43,14 +43,20 @@ impl Pad { pub fn new(name: Option<&str>, direction: PadDirection) -> Pad { assert_initialized_main_thread!(); unsafe { - from_glib_none(gst_sys::gst_pad_new(name.to_glib_none().0, direction.to_glib())) + from_glib_none(gst_sys::gst_pad_new( + name.to_glib_none().0, + direction.to_glib(), + )) } } pub fn new_from_template(templ: &PadTemplate, name: Option<&str>) -> Pad { skip_assert_initialized!(); unsafe { - from_glib_none(gst_sys::gst_pad_new_from_template(templ.to_glib_none().0, name.to_glib_none().0)) + from_glib_none(gst_sys::gst_pad_new_from_template( + templ.to_glib_none().0, + name.to_glib_none().0, + )) } } } @@ -67,7 +73,11 @@ pub trait PadExt: 'static { fn check_reconfigure(&self) -> bool; - fn create_stream_id>(&self, parent: &P, stream_id: Option<&str>) -> Option; + fn create_stream_id>( + &self, + parent: &P, + stream_id: Option<&str>, + ) -> Option; //fn create_stream_id_printf>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option; @@ -121,7 +131,11 @@ pub trait PadExt: 'static { fn link_maybe_ghosting>(&self, sink: &P) -> Result<(), glib::error::BoolError>; #[cfg(any(feature = "v1_10", feature = "dox"))] - fn link_maybe_ghosting_full>(&self, sink: &P, flags: PadLinkCheck) -> Result<(), glib::error::BoolError>; + fn link_maybe_ghosting_full>( + &self, + sink: &P, + flags: PadLinkCheck, + ) -> Result<(), glib::error::BoolError>; fn mark_reconfigure(&self); @@ -157,37 +171,67 @@ pub trait PadExt: 'static { fn connect_linked(&self, f: F) -> SignalHandlerId; - fn connect_unlinked(&self, f: F) -> SignalHandlerId; + fn connect_unlinked(&self, f: F) + -> SignalHandlerId; - fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_caps_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_offset_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_offset_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_template_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_template_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> PadExt for O { fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_activate_mode(self.as_ref().to_glib_none().0, mode.to_glib(), active.to_glib()), "Failed to activate mode pad") + glib_result_from_gboolean!( + gst_sys::gst_pad_activate_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + active.to_glib() + ), + "Failed to activate mode pad" + ) } } fn can_link>(&self, sinkpad: &P) -> bool { unsafe { - from_glib(gst_sys::gst_pad_can_link(self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_can_link( + self.as_ref().to_glib_none().0, + sinkpad.as_ref().to_glib_none().0, + )) } } fn check_reconfigure(&self) -> bool { unsafe { - from_glib(gst_sys::gst_pad_check_reconfigure(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_check_reconfigure( + self.as_ref().to_glib_none().0, + )) } } - fn create_stream_id>(&self, parent: &P, stream_id: Option<&str>) -> Option { + fn create_stream_id>( + &self, + parent: &P, + stream_id: Option<&str>, + ) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_create_stream_id(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0, stream_id.to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_create_stream_id( + self.as_ref().to_glib_none().0, + parent.as_ref().to_glib_none().0, + stream_id.to_glib_none().0, + )) } } @@ -201,7 +245,10 @@ impl> PadExt for O { fn forward bool>(&self, forward: P) -> bool { let forward_data: P = forward; - unsafe extern "C" fn forward_func bool>(pad: *mut gst_sys::GstPad, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn forward_func bool>( + pad: *mut gst_sys::GstPad, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let pad = from_glib_borrow(pad); let callback: *mut P = user_data as *const _ as usize as *mut P; let res = (*callback)(&pad); @@ -210,25 +257,35 @@ impl> PadExt for O { let forward = Some(forward_func::

as _); let super_callback0: &P = &forward_data; unsafe { - from_glib(gst_sys::gst_pad_forward(self.as_ref().to_glib_none().0, forward, super_callback0 as *const _ as usize as *mut _)) + from_glib(gst_sys::gst_pad_forward( + self.as_ref().to_glib_none().0, + forward, + super_callback0 as *const _ as usize as *mut _, + )) } } fn get_allowed_caps(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_allowed_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_allowed_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_current_caps(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_current_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_current_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_direction(&self) -> PadDirection { unsafe { - from_glib(gst_sys::gst_pad_get_direction(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_get_direction( + self.as_ref().to_glib_none().0, + )) } } @@ -237,89 +294,91 @@ impl> PadExt for O { //} fn get_offset(&self) -> i64 { - unsafe { - gst_sys::gst_pad_get_offset(self.as_ref().to_glib_none().0) - } + unsafe { gst_sys::gst_pad_get_offset(self.as_ref().to_glib_none().0) } } fn get_pad_template(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_pad_template(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_pad_template( + self.as_ref().to_glib_none().0, + )) } } fn get_pad_template_caps(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_pad_template_caps(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_pad_template_caps( + self.as_ref().to_glib_none().0, + )) } } fn get_parent_element(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_parent_element(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_parent_element( + self.as_ref().to_glib_none().0, + )) } } fn get_peer(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_pad_get_peer(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_pad_get_peer(self.as_ref().to_glib_none().0)) } } fn get_sticky_event(&self, event_type: EventType, idx: u32) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_sticky_event(self.as_ref().to_glib_none().0, event_type.to_glib(), idx)) + from_glib_full(gst_sys::gst_pad_get_sticky_event( + self.as_ref().to_glib_none().0, + event_type.to_glib(), + idx, + )) } } #[cfg(any(feature = "v1_10", feature = "dox"))] fn get_stream(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_pad_get_stream(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_pad_get_stream(self.as_ref().to_glib_none().0)) } } fn get_stream_id(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_get_stream_id(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_get_stream_id( + self.as_ref().to_glib_none().0, + )) } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn get_task_state(&self) -> TaskState { unsafe { - from_glib(gst_sys::gst_pad_get_task_state(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_get_task_state( + self.as_ref().to_glib_none().0, + )) } } fn has_current_caps(&self) -> bool { unsafe { - from_glib(gst_sys::gst_pad_has_current_caps(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_has_current_caps( + self.as_ref().to_glib_none().0, + )) } } fn is_active(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_pad_is_active(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_pad_is_active(self.as_ref().to_glib_none().0)) } } fn is_blocked(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_pad_is_blocked(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_pad_is_blocked(self.as_ref().to_glib_none().0)) } } fn is_blocking(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_pad_is_blocking(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_pad_is_blocking(self.as_ref().to_glib_none().0)) } } fn is_linked(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_pad_is_linked(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_pad_is_linked(self.as_ref().to_glib_none().0)) } } //fn iterate_internal_links(&self) -> /*Ignored*/Option { @@ -333,14 +392,31 @@ impl> PadExt for O { #[cfg(any(feature = "v1_10", feature = "dox"))] fn link_maybe_ghosting>(&self, sink: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_link_maybe_ghosting(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0), "Failed to link pads, possibly ghosting") + glib_result_from_gboolean!( + gst_sys::gst_pad_link_maybe_ghosting( + self.as_ref().to_glib_none().0, + sink.as_ref().to_glib_none().0 + ), + "Failed to link pads, possibly ghosting" + ) } } #[cfg(any(feature = "v1_10", feature = "dox"))] - fn link_maybe_ghosting_full>(&self, sink: &P, flags: PadLinkCheck) -> Result<(), glib::error::BoolError> { + fn link_maybe_ghosting_full>( + &self, + sink: &P, + flags: PadLinkCheck, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_link_maybe_ghosting_full(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0, flags.to_glib()), "Failed to link pads, possibly ghosting") + glib_result_from_gboolean!( + gst_sys::gst_pad_link_maybe_ghosting_full( + self.as_ref().to_glib_none().0, + sink.as_ref().to_glib_none().0, + flags.to_glib() + ), + "Failed to link pads, possibly ghosting" + ) } } @@ -352,43 +428,63 @@ impl> PadExt for O { fn needs_reconfigure(&self) -> bool { unsafe { - from_glib(gst_sys::gst_pad_needs_reconfigure(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pad_needs_reconfigure( + self.as_ref().to_glib_none().0, + )) } } fn pause_task(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_pause_task(self.as_ref().to_glib_none().0), "Failed to pause pad task") + glib_result_from_gboolean!( + gst_sys::gst_pad_pause_task(self.as_ref().to_glib_none().0), + "Failed to pause pad task" + ) } } fn peer_query_accept_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_pad_peer_query_accept_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_pad_peer_query_accept_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + )) } } fn peer_query_caps(&self, filter: Option<&Caps>) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_peer_query_caps(self.as_ref().to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_peer_query_caps( + self.as_ref().to_glib_none().0, + filter.to_glib_none().0, + )) } } fn query_accept_caps(&self, caps: &Caps) -> bool { unsafe { - from_glib(gst_sys::gst_pad_query_accept_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) + from_glib(gst_sys::gst_pad_query_accept_caps( + self.as_ref().to_glib_none().0, + caps.to_glib_none().0, + )) } } fn query_caps(&self, filter: Option<&Caps>) -> Option { unsafe { - from_glib_full(gst_sys::gst_pad_query_caps(self.as_ref().to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(gst_sys::gst_pad_query_caps( + self.as_ref().to_glib_none().0, + filter.to_glib_none().0, + )) } } fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to activate pad") + glib_result_from_gboolean!( + gst_sys::gst_pad_set_active(self.as_ref().to_glib_none().0, active.to_glib()), + "Failed to activate pad" + ) } } @@ -404,13 +500,22 @@ impl> PadExt for O { fn stop_task(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_stop_task(self.as_ref().to_glib_none().0), "Failed to stop pad task") + glib_result_from_gboolean!( + gst_sys::gst_pad_stop_task(self.as_ref().to_glib_none().0), + "Failed to stop pad task" + ) } } fn unlink>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_pad_unlink(self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0), "Failed to unlink pad") + glib_result_from_gboolean!( + gst_sys::gst_pad_unlink( + self.as_ref().to_glib_none().0, + sinkpad.as_ref().to_glib_none().0 + ), + "Failed to unlink pad" + ) } } @@ -423,7 +528,11 @@ impl> PadExt for O { fn get_property_caps(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"caps\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"caps\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -431,84 +540,150 @@ impl> PadExt for O { fn get_property_template(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"template\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"template\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } fn set_property_template(&self, template: Option<&PadTemplate>) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"template\0".as_ptr() as *const _, Value::from(template).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"template\0".as_ptr() as *const _, + Value::from(template).to_glib_none().0, + ); } } fn connect_linked(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn linked_trampoline(this: *mut gst_sys::GstPad, peer: *mut gst_sys::GstPad, f: glib_sys::gpointer) - where P: IsA + unsafe extern "C" fn linked_trampoline( + this: *mut gst_sys::GstPad, + peer: *mut gst_sys::GstPad, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Pad::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(peer)) + f( + &Pad::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(peer), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"linked\0".as_ptr() as *const _, - Some(transmute(linked_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"linked\0".as_ptr() as *const _, + Some(transmute(linked_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_unlinked(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn unlinked_trampoline(this: *mut gst_sys::GstPad, peer: *mut gst_sys::GstPad, f: glib_sys::gpointer) - where P: IsA + fn connect_unlinked( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn unlinked_trampoline( + this: *mut gst_sys::GstPad, + peer: *mut gst_sys::GstPad, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); - f(&Pad::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(peer)) + f( + &Pad::from_glib_borrow(this).unsafe_cast(), + &from_glib_borrow(peer), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"unlinked\0".as_ptr() as *const _, - Some(transmute(unlinked_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"unlinked\0".as_ptr() as *const _, + Some(transmute(unlinked_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_caps_trampoline(this: *mut gst_sys::GstPad, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_caps_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_caps_trampoline( + this: *mut gst_sys::GstPad, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pad::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, - Some(transmute(notify_caps_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::caps\0".as_ptr() as *const _, + Some(transmute(notify_caps_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_offset_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_offset_trampoline(this: *mut gst_sys::GstPad, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_offset_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_offset_trampoline( + this: *mut gst_sys::GstPad, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pad::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::offset\0".as_ptr() as *const _, - Some(transmute(notify_offset_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::offset\0".as_ptr() as *const _, + Some(transmute(notify_offset_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_template_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_template_trampoline(this: *mut gst_sys::GstPad, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_template_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_template_trampoline( + this: *mut gst_sys::GstPad, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pad::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::template\0".as_ptr() as *const _, - Some(transmute(notify_template_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::template\0".as_ptr() as *const _, + Some(transmute(notify_template_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/pad_template.rs b/gstreamer/src/auto/pad_template.rs index 6585c4681..c81e68ea2 100644 --- a/gstreamer/src/auto/pad_template.rs +++ b/gstreamer/src/auto/pad_template.rs @@ -2,26 +2,26 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Caps; -use Object; -use Pad; -use PadDirection; -use PadPresence; #[cfg(any(feature = "v1_14", feature = "dox"))] use glib; +use glib::object::IsA; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::IsA; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Caps; +use Object; +use Pad; +use PadDirection; +use PadPresence; glib_wrapper! { pub struct PadTemplate(Object) @extends Object; @@ -32,37 +32,64 @@ glib_wrapper! { } impl PadTemplate { - pub fn new(name_template: &str, direction: PadDirection, presence: PadPresence, caps: &Caps) -> Option { + pub fn new( + name_template: &str, + direction: PadDirection, + presence: PadPresence, + caps: &Caps, + ) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_none(gst_sys::gst_pad_template_new(name_template.to_glib_none().0, direction.to_glib(), presence.to_glib(), caps.to_glib_none().0)) + from_glib_none(gst_sys::gst_pad_template_new( + name_template.to_glib_none().0, + direction.to_glib(), + presence.to_glib(), + caps.to_glib_none().0, + )) } } #[cfg(any(feature = "v1_14", feature = "dox"))] - pub fn new_with_gtype(name_template: &str, direction: PadDirection, presence: PadPresence, caps: &Caps, pad_type: glib::types::Type) -> Option { + pub fn new_with_gtype( + name_template: &str, + direction: PadDirection, + presence: PadPresence, + caps: &Caps, + pad_type: glib::types::Type, + ) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_none(gst_sys::gst_pad_template_new_with_gtype(name_template.to_glib_none().0, direction.to_glib(), presence.to_glib(), caps.to_glib_none().0, pad_type.to_glib())) + from_glib_none(gst_sys::gst_pad_template_new_with_gtype( + name_template.to_glib_none().0, + direction.to_glib(), + presence.to_glib(), + caps.to_glib_none().0, + pad_type.to_glib(), + )) } } pub fn get_caps(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_pad_template_get_caps(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_pad_template_get_caps(self.to_glib_none().0)) } } pub fn pad_created>(&self, pad: &P) { unsafe { - gst_sys::gst_pad_template_pad_created(self.to_glib_none().0, pad.as_ref().to_glib_none().0); + gst_sys::gst_pad_template_pad_created( + self.to_glib_none().0, + pad.as_ref().to_glib_none().0, + ); } } pub fn get_property_direction(&self) -> PadDirection { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"direction\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"direction\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -71,7 +98,11 @@ impl PadTemplate { pub fn get_property_gtype(&self) -> glib::types::Type { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"gtype\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"gtype\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } @@ -79,7 +110,11 @@ impl PadTemplate { pub fn get_property_name_template(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"name-template\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"name-template\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -87,20 +122,37 @@ impl PadTemplate { pub fn get_property_presence(&self) -> PadPresence { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"presence\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"presence\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } - pub fn connect_pad_created(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn pad_created_trampoline(this: *mut gst_sys::GstPadTemplate, pad: *mut gst_sys::GstPad, f: glib_sys::gpointer) { + pub fn connect_pad_created( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn pad_created_trampoline< + F: Fn(&PadTemplate, &Pad) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstPadTemplate, + pad: *mut gst_sys::GstPad, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(pad)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"pad-created\0".as_ptr() as *const _, - Some(transmute(pad_created_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"pad-created\0".as_ptr() as *const _, + Some(transmute(pad_created_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/pipeline.rs b/gstreamer/src/auto/pipeline.rs index 71af1adb4..1e066332f 100644 --- a/gstreamer/src/auto/pipeline.rs +++ b/gstreamer/src/auto/pipeline.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib_sys; +use gst_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; use Bin; use ChildProxy; use Clock; use ClockTime; use Element; use Object; -use glib::object::Cast; -use glib::object::IsA; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; -use glib_sys; -use gst_sys; -use std::boxed::Box as Box_; -use std::mem::transmute; glib_wrapper! { pub struct Pipeline(Object) @extends Bin, Element, Object, @implements ChildProxy; @@ -59,11 +59,20 @@ pub trait PipelineExt: 'static { fn use_clock>(&self, clock: Option<&P>); - fn connect_property_auto_flush_bus_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_auto_flush_bus_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_delay_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_delay_notify( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> PipelineExt for O { @@ -75,31 +84,42 @@ impl> PipelineExt for O { fn get_auto_flush_bus(&self) -> bool { unsafe { - from_glib(gst_sys::gst_pipeline_get_auto_flush_bus(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pipeline_get_auto_flush_bus( + self.as_ref().to_glib_none().0, + )) } } fn get_delay(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pipeline_get_delay( + self.as_ref().to_glib_none().0, + )) } } fn get_latency(&self) -> ClockTime { unsafe { - from_glib(gst_sys::gst_pipeline_get_latency(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_pipeline_get_latency( + self.as_ref().to_glib_none().0, + )) } } fn get_pipeline_clock(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_pipeline_get_pipeline_clock(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_pipeline_get_pipeline_clock( + self.as_ref().to_glib_none().0, + )) } } fn set_auto_flush_bus(&self, auto_flush: bool) { unsafe { - gst_sys::gst_pipeline_set_auto_flush_bus(self.as_ref().to_glib_none().0, auto_flush.to_glib()); + gst_sys::gst_pipeline_set_auto_flush_bus( + self.as_ref().to_glib_none().0, + auto_flush.to_glib(), + ); } } @@ -117,49 +137,90 @@ impl> PipelineExt for O { fn use_clock>(&self, clock: Option<&P>) { unsafe { - gst_sys::gst_pipeline_use_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0); + gst_sys::gst_pipeline_use_clock( + self.as_ref().to_glib_none().0, + clock.map(|p| p.as_ref()).to_glib_none().0, + ); } } - fn connect_property_auto_flush_bus_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_auto_flush_bus_trampoline(this: *mut gst_sys::GstPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_auto_flush_bus_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_auto_flush_bus_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::auto-flush-bus\0".as_ptr() as *const _, - Some(transmute(notify_auto_flush_bus_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::auto-flush-bus\0".as_ptr() as *const _, + Some(transmute( + notify_auto_flush_bus_trampoline:: as usize, + )), + Box_::into_raw(f), + ) } } - fn connect_property_delay_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_delay_trampoline(this: *mut gst_sys::GstPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_delay_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_delay_trampoline( + this: *mut gst_sys::GstPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::delay\0".as_ptr() as *const _, - Some(transmute(notify_delay_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::delay\0".as_ptr() as *const _, + Some(transmute(notify_delay_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_latency_trampoline(this: *mut gst_sys::GstPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_latency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_latency_trampoline( + this: *mut gst_sys::GstPipeline, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, - Some(transmute(notify_latency_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::latency\0".as_ptr() as *const _, + Some(transmute(notify_latency_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/plugin.rs b/gstreamer/src/auto/plugin.rs index 716e6bd10..d013b4bf5 100644 --- a/gstreamer/src/auto/plugin.rs +++ b/gstreamer/src/auto/plugin.rs @@ -2,14 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use Object; -use PluginDependencyFlags; -use glib::GString; use glib::translate::*; +use glib::GString; use gst_sys; use std; use std::ptr; +use Error; +use Object; +use PluginDependencyFlags; glib_wrapper! { pub struct Plugin(Object) @extends Object; @@ -20,83 +20,89 @@ glib_wrapper! { } impl Plugin { - pub fn add_dependency(&self, env_vars: &[&str], paths: &[&str], names: &[&str], flags: PluginDependencyFlags) { + pub fn add_dependency( + &self, + env_vars: &[&str], + paths: &[&str], + names: &[&str], + flags: PluginDependencyFlags, + ) { unsafe { - gst_sys::gst_plugin_add_dependency(self.to_glib_none().0, env_vars.to_glib_none().0, paths.to_glib_none().0, names.to_glib_none().0, flags.to_glib()); + gst_sys::gst_plugin_add_dependency( + self.to_glib_none().0, + env_vars.to_glib_none().0, + paths.to_glib_none().0, + names.to_glib_none().0, + flags.to_glib(), + ); } } - pub fn add_dependency_simple(&self, env_vars: Option<&str>, paths: Option<&str>, names: Option<&str>, flags: PluginDependencyFlags) { + pub fn add_dependency_simple( + &self, + env_vars: Option<&str>, + paths: Option<&str>, + names: Option<&str>, + flags: PluginDependencyFlags, + ) { unsafe { - gst_sys::gst_plugin_add_dependency_simple(self.to_glib_none().0, env_vars.to_glib_none().0, paths.to_glib_none().0, names.to_glib_none().0, flags.to_glib()); + gst_sys::gst_plugin_add_dependency_simple( + self.to_glib_none().0, + env_vars.to_glib_none().0, + paths.to_glib_none().0, + names.to_glib_none().0, + flags.to_glib(), + ); } } pub fn get_description(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_description(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_description(self.to_glib_none().0)) } } pub fn get_filename(&self) -> Option { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_filename(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_filename(self.to_glib_none().0)) } } pub fn get_license(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_license(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_license(self.to_glib_none().0)) } } pub fn get_origin(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_origin(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_origin(self.to_glib_none().0)) } } pub fn get_package(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_package(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_package(self.to_glib_none().0)) } } pub fn get_release_date_string(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_plugin_get_release_date_string(self.to_glib_none().0)) + from_glib_none(gst_sys::gst_plugin_get_release_date_string( + self.to_glib_none().0, + )) } } pub fn get_source(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_source(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_source(self.to_glib_none().0)) } } pub fn get_version(&self) -> GString { - unsafe { - from_glib_none(gst_sys::gst_plugin_get_version(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_plugin_get_version(self.to_glib_none().0)) } } pub fn is_loaded(&self) -> bool { - unsafe { - from_glib(gst_sys::gst_plugin_is_loaded(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_plugin_is_loaded(self.to_glib_none().0)) } } pub fn load(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_plugin_load(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_plugin_load(self.to_glib_none().0)) } } pub fn load_by_name(name: &str) -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_plugin_load_by_name(name.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_plugin_load_by_name(name.to_glib_none().0)) } } pub fn load_file>(filename: P) -> Result { @@ -104,7 +110,11 @@ impl Plugin { unsafe { let mut error = ptr::null_mut(); let ret = gst_sys::gst_plugin_load_file(filename.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/gstreamer/src/auto/plugin_feature.rs b/gstreamer/src/auto/plugin_feature.rs index e51635e8c..f75544ee8 100644 --- a/gstreamer/src/auto/plugin_feature.rs +++ b/gstreamer/src/auto/plugin_feature.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; -use Plugin; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_sys; +use Object; +use Plugin; glib_wrapper! { pub struct PluginFeature(Object) @extends Object; @@ -35,25 +35,36 @@ pub trait PluginFeatureExt: 'static { impl> PluginFeatureExt for O { fn check_version(&self, min_major: u32, min_minor: u32, min_micro: u32) -> bool { unsafe { - from_glib(gst_sys::gst_plugin_feature_check_version(self.as_ref().to_glib_none().0, min_major, min_minor, min_micro)) + from_glib(gst_sys::gst_plugin_feature_check_version( + self.as_ref().to_glib_none().0, + min_major, + min_minor, + min_micro, + )) } } fn get_plugin(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_plugin_feature_get_plugin(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_plugin_feature_get_plugin( + self.as_ref().to_glib_none().0, + )) } } fn get_plugin_name(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_plugin_feature_get_plugin_name(self.as_ref().to_glib_none().0)) + from_glib_none(gst_sys::gst_plugin_feature_get_plugin_name( + self.as_ref().to_glib_none().0, + )) } } fn load(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_plugin_feature_load(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_plugin_feature_load( + self.as_ref().to_glib_none().0, + )) } } } diff --git a/gstreamer/src/auto/preset.rs b/gstreamer/src/auto/preset.rs index 6af6dbdcf..192560b25 100644 --- a/gstreamer/src/auto/preset.rs +++ b/gstreamer/src/auto/preset.rs @@ -3,9 +3,9 @@ // DO NOT EDIT use glib; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_sys; use std; use std::ptr; @@ -21,15 +21,18 @@ glib_wrapper! { impl Preset { pub fn get_app_dir() -> Option { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_sys::gst_preset_get_app_dir()) - } + unsafe { from_glib_none(gst_sys::gst_preset_get_app_dir()) } } - pub fn set_app_dir>(app_dir: P) -> Result<(), glib::error::BoolError> { + pub fn set_app_dir>( + app_dir: P, + ) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_set_app_dir(app_dir.as_ref().to_glib_none().0), "Failed to set app preset directory") + glib_result_from_gboolean!( + gst_sys::gst_preset_set_app_dir(app_dir.as_ref().to_glib_none().0), + "Failed to set app preset directory" + ) } } } @@ -56,63 +59,121 @@ pub trait PresetExt: 'static { fn save_preset(&self, name: &str) -> Result<(), glib::error::BoolError>; - fn set_meta(&self, name: &str, tag: &str, value: Option<&str>) -> Result<(), glib::error::BoolError>; + fn set_meta( + &self, + name: &str, + tag: &str, + value: Option<&str>, + ) -> Result<(), glib::error::BoolError>; } impl> PresetExt for O { fn delete_preset(&self, name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_delete_preset(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to delete preset") + glib_result_from_gboolean!( + gst_sys::gst_preset_delete_preset( + self.as_ref().to_glib_none().0, + name.to_glib_none().0 + ), + "Failed to delete preset" + ) } } fn get_meta(&self, name: &str, tag: &str) -> Option { unsafe { let mut value = ptr::null_mut(); - let ret = from_glib(gst_sys::gst_preset_get_meta(self.as_ref().to_glib_none().0, name.to_glib_none().0, tag.to_glib_none().0, &mut value)); - if ret { Some(from_glib_full(value)) } else { None } + let ret = from_glib(gst_sys::gst_preset_get_meta( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + tag.to_glib_none().0, + &mut value, + )); + if ret { + Some(from_glib_full(value)) + } else { + None + } } } fn get_preset_names(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_preset_get_preset_names(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_preset_get_preset_names( + self.as_ref().to_glib_none().0, + )) } } fn get_property_names(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_preset_get_property_names(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_preset_get_property_names( + self.as_ref().to_glib_none().0, + )) } } fn is_editable(&self) -> bool { unsafe { - from_glib(gst_sys::gst_preset_is_editable(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_preset_is_editable( + self.as_ref().to_glib_none().0, + )) } } fn load_preset(&self, name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_load_preset(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to load preset") + glib_result_from_gboolean!( + gst_sys::gst_preset_load_preset( + self.as_ref().to_glib_none().0, + name.to_glib_none().0 + ), + "Failed to load preset" + ) } } fn rename_preset(&self, old_name: &str, new_name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_rename_preset(self.as_ref().to_glib_none().0, old_name.to_glib_none().0, new_name.to_glib_none().0), "Failed to rename preset") + glib_result_from_gboolean!( + gst_sys::gst_preset_rename_preset( + self.as_ref().to_glib_none().0, + old_name.to_glib_none().0, + new_name.to_glib_none().0 + ), + "Failed to rename preset" + ) } } fn save_preset(&self, name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_save_preset(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to save preset") + glib_result_from_gboolean!( + gst_sys::gst_preset_save_preset( + self.as_ref().to_glib_none().0, + name.to_glib_none().0 + ), + "Failed to save preset" + ) } } - fn set_meta(&self, name: &str, tag: &str, value: Option<&str>) -> Result<(), glib::error::BoolError> { + fn set_meta( + &self, + name: &str, + tag: &str, + value: Option<&str>, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_preset_set_meta(self.as_ref().to_glib_none().0, name.to_glib_none().0, tag.to_glib_none().0, value.to_glib_none().0), "Failed to set preset meta") + glib_result_from_gboolean!( + gst_sys::gst_preset_set_meta( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + tag.to_glib_none().0, + value.to_glib_none().0 + ), + "Failed to set preset meta" + ) } } } diff --git a/gstreamer/src/auto/proxy_pad.rs b/gstreamer/src/auto/proxy_pad.rs index a3dbc5990..ae507779e 100644 --- a/gstreamer/src/auto/proxy_pad.rs +++ b/gstreamer/src/auto/proxy_pad.rs @@ -2,11 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; -use Pad; use glib::object::IsA; use glib::translate::*; use gst_sys; +use Object; +use Pad; glib_wrapper! { pub struct ProxyPad(Object) @extends Pad, Object; @@ -34,7 +34,9 @@ pub trait ProxyPadExt: 'static { impl> ProxyPadExt for O { fn get_internal(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_proxy_pad_get_internal(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_proxy_pad_get_internal( + self.as_ref().to_glib_none().0, + )) } } } diff --git a/gstreamer/src/auto/registry.rs b/gstreamer/src/auto/registry.rs index bb03cbe27..9c5d805a8 100644 --- a/gstreamer/src/auto/registry.rs +++ b/gstreamer/src/auto/registry.rs @@ -2,20 +2,20 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; -use Plugin; -use PluginFeature; use glib; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use gst_sys; use std; use std::boxed::Box as Box_; use std::mem::transmute; +use Object; +use Plugin; +use PluginFeature; glib_wrapper! { pub struct Registry(Object) @extends Object; @@ -26,27 +26,58 @@ glib_wrapper! { } impl Registry { - pub fn add_feature>(&self, feature: &P) -> Result<(), glib::error::BoolError> { + pub fn add_feature>( + &self, + feature: &P, + ) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_registry_add_feature(self.to_glib_none().0, feature.as_ref().to_glib_none().0), "Failed to add feature") + glib_result_from_gboolean!( + gst_sys::gst_registry_add_feature( + self.to_glib_none().0, + feature.as_ref().to_glib_none().0 + ), + "Failed to add feature" + ) } } pub fn add_plugin(&self, plugin: &Plugin) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(gst_sys::gst_registry_add_plugin(self.to_glib_none().0, plugin.to_glib_none().0), "Failed to add plugin") + glib_result_from_gboolean!( + gst_sys::gst_registry_add_plugin(self.to_glib_none().0, plugin.to_glib_none().0), + "Failed to add plugin" + ) } } - pub fn check_feature_version(&self, feature_name: &str, min_major: u32, min_minor: u32, min_micro: u32) -> bool { + pub fn check_feature_version( + &self, + feature_name: &str, + min_major: u32, + min_minor: u32, + min_micro: u32, + ) -> bool { unsafe { - from_glib(gst_sys::gst_registry_check_feature_version(self.to_glib_none().0, feature_name.to_glib_none().0, min_major, min_minor, min_micro)) + from_glib(gst_sys::gst_registry_check_feature_version( + self.to_glib_none().0, + feature_name.to_glib_none().0, + min_major, + min_minor, + min_micro, + )) } } - pub fn feature_filter bool>(&self, filter: P, first: bool) -> Vec { + pub fn feature_filter bool>( + &self, + filter: P, + first: bool, + ) -> Vec { let filter_data: P = filter; - unsafe extern "C" fn filter_func bool>(feature: *mut gst_sys::GstPluginFeature, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn filter_func bool>( + feature: *mut gst_sys::GstPluginFeature, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let feature = from_glib_borrow(feature); let callback: *mut P = user_data as *const _ as usize as *mut P; let res = (*callback)(&feature); @@ -55,61 +86,88 @@ impl Registry { let filter = Some(filter_func::

as _); let super_callback0: &P = &filter_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_feature_filter(self.to_glib_none().0, filter, first.to_glib(), super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_feature_filter( + self.to_glib_none().0, + filter, + first.to_glib(), + super_callback0 as *const _ as usize as *mut _, + )) } } pub fn find_feature(&self, name: &str, type_: glib::types::Type) -> Option { unsafe { - from_glib_full(gst_sys::gst_registry_find_feature(self.to_glib_none().0, name.to_glib_none().0, type_.to_glib())) + from_glib_full(gst_sys::gst_registry_find_feature( + self.to_glib_none().0, + name.to_glib_none().0, + type_.to_glib(), + )) } } pub fn find_plugin(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_registry_find_plugin(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_registry_find_plugin( + self.to_glib_none().0, + name.to_glib_none().0, + )) } } pub fn get_feature_list(&self, type_: glib::types::Type) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_feature_list(self.to_glib_none().0, type_.to_glib())) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_feature_list( + self.to_glib_none().0, + type_.to_glib(), + )) } } pub fn get_feature_list_by_plugin(&self, name: &str) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_feature_list_by_plugin(self.to_glib_none().0, name.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_feature_list_by_plugin( + self.to_glib_none().0, + name.to_glib_none().0, + )) } } pub fn get_feature_list_cookie(&self) -> u32 { - unsafe { - gst_sys::gst_registry_get_feature_list_cookie(self.to_glib_none().0) - } + unsafe { gst_sys::gst_registry_get_feature_list_cookie(self.to_glib_none().0) } } pub fn get_plugin_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_plugin_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_get_plugin_list( + self.to_glib_none().0, + )) } } pub fn lookup(&self, filename: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_registry_lookup(self.to_glib_none().0, filename.to_glib_none().0)) + from_glib_full(gst_sys::gst_registry_lookup( + self.to_glib_none().0, + filename.to_glib_none().0, + )) } } pub fn lookup_feature(&self, name: &str) -> Option { unsafe { - from_glib_full(gst_sys::gst_registry_lookup_feature(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(gst_sys::gst_registry_lookup_feature( + self.to_glib_none().0, + name.to_glib_none().0, + )) } } pub fn plugin_filter bool>(&self, filter: P, first: bool) -> Vec { let filter_data: P = filter; - unsafe extern "C" fn filter_func bool>(plugin: *mut gst_sys::GstPlugin, user_data: glib_sys::gpointer) -> glib_sys::gboolean { + unsafe extern "C" fn filter_func bool>( + plugin: *mut gst_sys::GstPlugin, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let plugin = from_glib_borrow(plugin); let callback: *mut P = user_data as *const _ as usize as *mut P; let res = (*callback)(&plugin); @@ -118,13 +176,21 @@ impl Registry { let filter = Some(filter_func::

as _); let super_callback0: &P = &filter_data; unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_plugin_filter(self.to_glib_none().0, filter, first.to_glib(), super_callback0 as *const _ as usize as *mut _)) + FromGlibPtrContainer::from_glib_full(gst_sys::gst_registry_plugin_filter( + self.to_glib_none().0, + filter, + first.to_glib(), + super_callback0 as *const _ as usize as *mut _, + )) } } pub fn remove_feature>(&self, feature: &P) { unsafe { - gst_sys::gst_registry_remove_feature(self.to_glib_none().0, feature.as_ref().to_glib_none().0); + gst_sys::gst_registry_remove_feature( + self.to_glib_none().0, + feature.as_ref().to_glib_none().0, + ); } } @@ -136,38 +202,65 @@ impl Registry { pub fn scan_path>(&self, path: P) -> bool { unsafe { - from_glib(gst_sys::gst_registry_scan_path(self.to_glib_none().0, path.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_registry_scan_path( + self.to_glib_none().0, + path.as_ref().to_glib_none().0, + )) } } pub fn get() -> Registry { assert_initialized_main_thread!(); - unsafe { - from_glib_none(gst_sys::gst_registry_get()) - } + unsafe { from_glib_none(gst_sys::gst_registry_get()) } } - pub fn connect_feature_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn feature_added_trampoline(this: *mut gst_sys::GstRegistry, feature: *mut gst_sys::GstPluginFeature, f: glib_sys::gpointer) { + pub fn connect_feature_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn feature_added_trampoline< + F: Fn(&Registry, &PluginFeature) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstRegistry, + feature: *mut gst_sys::GstPluginFeature, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(feature)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"feature-added\0".as_ptr() as *const _, - Some(transmute(feature_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"feature-added\0".as_ptr() as *const _, + Some(transmute(feature_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_plugin_added(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn plugin_added_trampoline(this: *mut gst_sys::GstRegistry, plugin: *mut gst_sys::GstPlugin, f: glib_sys::gpointer) { + pub fn connect_plugin_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn plugin_added_trampoline< + F: Fn(&Registry, &Plugin) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstRegistry, + plugin: *mut gst_sys::GstPlugin, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(plugin)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"plugin-added\0".as_ptr() as *const _, - Some(transmute(plugin_added_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"plugin-added\0".as_ptr() as *const _, + Some(transmute(plugin_added_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/stream.rs b/gstreamer/src/auto/stream.rs index f4dce8de0..5b4efc656 100644 --- a/gstreamer/src/auto/stream.rs +++ b/gstreamer/src/auto/stream.rs @@ -2,23 +2,23 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Caps; -use Object; -use StreamFlags; -use StreamType; -use TagList; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Caps; +use Object; +use StreamFlags; +use StreamType; +use TagList; glib_wrapper! { pub struct Stream(Object) @extends Object; @@ -31,37 +31,27 @@ glib_wrapper! { impl Stream { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_caps(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_stream_get_caps(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_stream_get_caps(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_stream_flags(&self) -> StreamFlags { - unsafe { - from_glib(gst_sys::gst_stream_get_stream_flags(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_stream_get_stream_flags(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_stream_id(&self) -> Option { - unsafe { - from_glib_none(gst_sys::gst_stream_get_stream_id(self.to_glib_none().0)) - } + unsafe { from_glib_none(gst_sys::gst_stream_get_stream_id(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_stream_type(&self) -> StreamType { - unsafe { - from_glib(gst_sys::gst_stream_get_stream_type(self.to_glib_none().0)) - } + unsafe { from_glib(gst_sys::gst_stream_get_stream_type(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_tags(&self) -> Option { - unsafe { - from_glib_full(gst_sys::gst_stream_get_tags(self.to_glib_none().0)) - } + unsafe { from_glib_full(gst_sys::gst_stream_get_tags(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -95,35 +85,55 @@ impl Stream { pub fn get_property_caps(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"caps\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"caps\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_caps(&self, caps: Option<&Caps>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"caps\0".as_ptr() as *const _, Value::from(caps).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"caps\0".as_ptr() as *const _, + Value::from(caps).to_glib_none().0, + ); } } pub fn get_property_stream_flags(&self) -> StreamFlags { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"stream-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"stream-flags\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_stream_flags(&self, stream_flags: StreamFlags) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"stream-flags\0".as_ptr() as *const _, Value::from(&stream_flags).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"stream-flags\0".as_ptr() as *const _, + Value::from(&stream_flags).to_glib_none().0, + ); } } pub fn get_property_stream_id(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"stream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"stream-id\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } @@ -131,76 +141,140 @@ impl Stream { pub fn get_property_stream_type(&self) -> StreamType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"stream-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"stream-type\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } pub fn set_property_stream_type(&self, stream_type: StreamType) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"stream-type\0".as_ptr() as *const _, Value::from(&stream_type).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"stream-type\0".as_ptr() as *const _, + Value::from(&stream_type).to_glib_none().0, + ); } } pub fn get_property_tags(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"tags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"tags\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_tags(&self, tags: Option<&TagList>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"tags\0".as_ptr() as *const _, Value::from(tags).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"tags\0".as_ptr() as *const _, + Value::from(tags).to_glib_none().0, + ); } } - pub fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_caps_trampoline(this: *mut gst_sys::GstStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_caps_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_caps_trampoline( + this: *mut gst_sys::GstStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, - Some(transmute(notify_caps_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::caps\0".as_ptr() as *const _, + Some(transmute(notify_caps_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_stream_flags_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_stream_flags_trampoline(this: *mut gst_sys::GstStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_stream_flags_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_stream_flags_trampoline< + F: Fn(&Stream) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::stream-flags\0".as_ptr() as *const _, - Some(transmute(notify_stream_flags_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::stream-flags\0".as_ptr() as *const _, + Some(transmute(notify_stream_flags_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_stream_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_stream_type_trampoline(this: *mut gst_sys::GstStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_stream_type_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_stream_type_trampoline< + F: Fn(&Stream) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _, - Some(transmute(notify_stream_type_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::stream-type\0".as_ptr() as *const _, + Some(transmute(notify_stream_type_trampoline:: as usize)), + Box_::into_raw(f), + ) } } - pub fn connect_property_tags_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_tags_trampoline(this: *mut gst_sys::GstStream, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_tags_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tags_trampoline( + this: *mut gst_sys::GstStream, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::tags\0".as_ptr() as *const _, - Some(transmute(notify_tags_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::tags\0".as_ptr() as *const _, + Some(transmute(notify_tags_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/stream_collection.rs b/gstreamer/src/auto/stream_collection.rs index 1adef034c..6be3d93ca 100644 --- a/gstreamer/src/auto/stream_collection.rs +++ b/gstreamer/src/auto/stream_collection.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Object; -#[cfg(any(feature = "v1_10", feature = "dox"))] -use Stream; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::ObjectType as ObjectType_; -use glib::signal::SignalHandlerId; -use glib::signal::connect_raw; -use glib::translate::*; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Object; +#[cfg(any(feature = "v1_10", feature = "dox"))] +use Stream; glib_wrapper! { pub struct StreamCollection(Object) @extends Object; @@ -29,36 +29,47 @@ glib_wrapper! { impl StreamCollection { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_size(&self) -> u32 { - unsafe { - gst_sys::gst_stream_collection_get_size(self.to_glib_none().0) - } + unsafe { gst_sys::gst_stream_collection_get_size(self.to_glib_none().0) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_stream(&self, index: u32) -> Option { unsafe { - from_glib_none(gst_sys::gst_stream_collection_get_stream(self.to_glib_none().0, index)) + from_glib_none(gst_sys::gst_stream_collection_get_stream( + self.to_glib_none().0, + index, + )) } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_upstream_id(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_stream_collection_get_upstream_id(self.to_glib_none().0)) + from_glib_none(gst_sys::gst_stream_collection_get_upstream_id( + self.to_glib_none().0, + )) } } pub fn get_property_upstream_id(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"upstream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"upstream-id\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get() } } pub fn set_property_upstream_id(&self, upstream_id: Option<&str>) { unsafe { - gobject_sys::g_object_set_property(self.as_ptr() as *mut gobject_sys::GObject, b"upstream-id\0".as_ptr() as *const _, Value::from(upstream_id).to_glib_none().0); + gobject_sys::g_object_set_property( + self.as_ptr() as *mut gobject_sys::GObject, + b"upstream-id\0".as_ptr() as *const _, + Value::from(upstream_id).to_glib_none().0, + ); } } @@ -66,15 +77,28 @@ impl StreamCollection { // Ignored p0: GObject.ParamSpec //} - pub fn connect_property_upstream_id_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_upstream_id_trampoline(this: *mut gst_sys::GstStreamCollection, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) { + pub fn connect_property_upstream_id_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_upstream_id_trampoline< + F: Fn(&StreamCollection) + Send + Sync + 'static, + >( + this: *mut gst_sys::GstStreamCollection, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::upstream-id\0".as_ptr() as *const _, - Some(transmute(notify_upstream_id_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::upstream-id\0".as_ptr() as *const _, + Some(transmute(notify_upstream_id_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/system_clock.rs b/gstreamer/src/auto/system_clock.rs index 5f2323242..a25be4e92 100644 --- a/gstreamer/src/auto/system_clock.rs +++ b/gstreamer/src/auto/system_clock.rs @@ -2,21 +2,21 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Clock; -use ClockType; -use Object; -use glib::StaticType; -use glib::Value; use glib::object::Cast; use glib::object::IsA; -use glib::signal::SignalHandlerId; use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::StaticType; +use glib::Value; use glib_sys; use gobject_sys; use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; +use Clock; +use ClockType; +use Object; glib_wrapper! { pub struct SystemClock(Object) @extends Clock, Object; @@ -29,9 +29,7 @@ glib_wrapper! { impl SystemClock { pub fn obtain() -> Clock { assert_initialized_main_thread!(); - unsafe { - from_glib_full(gst_sys::gst_system_clock_obtain()) - } + unsafe { from_glib_full(gst_sys::gst_system_clock_obtain()) } } pub fn set_default>(new_clock: Option<&P>) { @@ -52,35 +50,57 @@ pub trait SystemClockExt: 'static { fn set_property_clock_type(&self, clock_type: ClockType); - fn connect_property_clock_type_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_clock_type_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> SystemClockExt for O { fn get_property_clock_type(&self) -> ClockType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"clock-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"clock-type\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); value.get().unwrap() } } fn set_property_clock_type(&self, clock_type: ClockType) { unsafe { - gobject_sys::g_object_set_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"clock-type\0".as_ptr() as *const _, Value::from(&clock_type).to_glib_none().0); + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"clock-type\0".as_ptr() as *const _, + Value::from(&clock_type).to_glib_none().0, + ); } } - fn connect_property_clock_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_clock_type_trampoline(this: *mut gst_sys::GstSystemClock, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) - where P: IsA + fn connect_property_clock_type_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_clock_type_trampoline( + this: *mut gst_sys::GstSystemClock, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, { let f: &F = &*(f as *const F); f(&SystemClock::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"notify::clock-type\0".as_ptr() as *const _, - Some(transmute(notify_clock_type_trampoline:: as usize)), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"notify::clock-type\0".as_ptr() as *const _, + Some(transmute(notify_clock_type_trampoline:: as usize)), + Box_::into_raw(f), + ) } } } diff --git a/gstreamer/src/auto/tag_setter.rs b/gstreamer/src/auto/tag_setter.rs index 1efd6979a..0948d17aa 100644 --- a/gstreamer/src/auto/tag_setter.rs +++ b/gstreamer/src/auto/tag_setter.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::object::IsA; +use glib::translate::*; +use gst_sys; use Element; use Object; use TagList; use TagMergeMode; -use glib::object::IsA; -use glib::translate::*; -use gst_sys; glib_wrapper! { pub struct TagSetter(Interface) @requires Element, Object; @@ -68,19 +68,27 @@ impl> TagSetterExt for O { fn get_tag_list(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_tag_setter_get_tag_list(self.as_ref().to_glib_none().0)) + from_glib_none(gst_sys::gst_tag_setter_get_tag_list( + self.as_ref().to_glib_none().0, + )) } } fn get_tag_merge_mode(&self) -> TagMergeMode { unsafe { - from_glib(gst_sys::gst_tag_setter_get_tag_merge_mode(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_tag_setter_get_tag_merge_mode( + self.as_ref().to_glib_none().0, + )) } } fn merge_tags(&self, list: &TagList, mode: TagMergeMode) { unsafe { - gst_sys::gst_tag_setter_merge_tags(self.as_ref().to_glib_none().0, list.to_glib_none().0, mode.to_glib()); + gst_sys::gst_tag_setter_merge_tags( + self.as_ref().to_glib_none().0, + list.to_glib_none().0, + mode.to_glib(), + ); } } @@ -92,7 +100,10 @@ impl> TagSetterExt for O { fn set_tag_merge_mode(&self, mode: TagMergeMode) { unsafe { - gst_sys::gst_tag_setter_set_tag_merge_mode(self.as_ref().to_glib_none().0, mode.to_glib()); + gst_sys::gst_tag_setter_set_tag_merge_mode( + self.as_ref().to_glib_none().0, + mode.to_glib(), + ); } } } diff --git a/gstreamer/src/auto/toc_setter.rs b/gstreamer/src/auto/toc_setter.rs index de81b5579..5fca13c4b 100644 --- a/gstreamer/src/auto/toc_setter.rs +++ b/gstreamer/src/auto/toc_setter.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Element; -use Object; -use Toc; use glib::object::IsA; use glib::translate::*; use gst_sys; +use Element; +use Object; +use Toc; glib_wrapper! { pub struct TocSetter(Interface) @requires Element, Object; @@ -33,7 +33,9 @@ pub trait TocSetterExt: 'static { impl> TocSetterExt for O { fn get_toc(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_toc_setter_get_toc(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_toc_setter_get_toc( + self.as_ref().to_glib_none().0, + )) } } diff --git a/gstreamer/src/auto/type_find_factory.rs b/gstreamer/src/auto/type_find_factory.rs index 4eeedc412..4e156b27e 100644 --- a/gstreamer/src/auto/type_find_factory.rs +++ b/gstreamer/src/auto/type_find_factory.rs @@ -2,12 +2,12 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT +use glib::translate::*; +use glib::GString; +use gst_sys; use Caps; use Object; use PluginFeature; -use glib::GString; -use glib::translate::*; -use gst_sys; glib_wrapper! { pub struct TypeFindFactory(Object) @extends PluginFeature, Object; @@ -24,27 +24,31 @@ impl TypeFindFactory { pub fn get_caps(&self) -> Option { unsafe { - from_glib_none(gst_sys::gst_type_find_factory_get_caps(self.to_glib_none().0)) + from_glib_none(gst_sys::gst_type_find_factory_get_caps( + self.to_glib_none().0, + )) } } pub fn get_extensions(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_sys::gst_type_find_factory_get_extensions(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_sys::gst_type_find_factory_get_extensions( + self.to_glib_none().0, + )) } } pub fn has_function(&self) -> bool { unsafe { - from_glib(gst_sys::gst_type_find_factory_has_function(self.to_glib_none().0)) + from_glib(gst_sys::gst_type_find_factory_has_function( + self.to_glib_none().0, + )) } } pub fn get_list() -> Vec { assert_initialized_main_thread!(); - unsafe { - FromGlibPtrContainer::from_glib_full(gst_sys::gst_type_find_factory_get_list()) - } + unsafe { FromGlibPtrContainer::from_glib_full(gst_sys::gst_type_find_factory_get_list()) } } } diff --git a/gstreamer/src/auto/uri_handler.rs b/gstreamer/src/auto/uri_handler.rs index 15604f8f3..85a43681c 100644 --- a/gstreamer/src/auto/uri_handler.rs +++ b/gstreamer/src/auto/uri_handler.rs @@ -2,13 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use Error; -use URIType; -use glib::GString; use glib::object::IsA; use glib::translate::*; +use glib::GString; use gst_sys; use std::ptr; +use Error; +use URIType; glib_wrapper! { pub struct URIHandler(Interface); @@ -36,27 +36,41 @@ pub trait URIHandlerExt: 'static { impl> URIHandlerExt for O { fn get_protocols(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(gst_sys::gst_uri_handler_get_protocols(self.as_ref().to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(gst_sys::gst_uri_handler_get_protocols( + self.as_ref().to_glib_none().0, + )) } } fn get_uri(&self) -> Option { unsafe { - from_glib_full(gst_sys::gst_uri_handler_get_uri(self.as_ref().to_glib_none().0)) + from_glib_full(gst_sys::gst_uri_handler_get_uri( + self.as_ref().to_glib_none().0, + )) } } fn get_uri_type(&self) -> URIType { unsafe { - from_glib(gst_sys::gst_uri_handler_get_uri_type(self.as_ref().to_glib_none().0)) + from_glib(gst_sys::gst_uri_handler_get_uri_type( + self.as_ref().to_glib_none().0, + )) } } fn set_uri(&self, uri: &str) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = gst_sys::gst_uri_handler_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let _ = gst_sys::gst_uri_handler_set_uri( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 44286c971..a26f8331e 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -66,7 +66,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[allow(clippy::too_many_arguments)] #[allow(clippy::match_same_arms)] #[allow(clippy::type_complexity)] -#[rustfmt::skip] mod auto; pub use auto::functions::*; pub use auto::*;