diff --git a/gstreamer-app/src/auto/app_sink.rs b/gstreamer-app/src/auto/app_sink.rs index efa9e8e8a..fd710cd65 100644 --- a/gstreamer-app/src/auto/app_sink.rs +++ b/gstreamer-app/src/auto/app_sink.rs @@ -5,6 +5,7 @@ use ffi; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -12,18 +13,11 @@ use glib_ffi; use gobject_ffi; use gst; use gst_base; -use gst_base_ffi; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct AppSink(Object): [ - gst_base::BaseSink => gst_base_ffi::GstBaseSink, - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - gst::URIHandler => gst_ffi::GstURIHandler, - ]; + pub struct AppSink(Object) @extends gst_base::BaseSink, gst::Element, gst::Object, @implements gst::URIHandler; match fn { get_type => || ffi::gst_app_sink_get_type(), @@ -99,9 +93,8 @@ impl AppSink { pub fn set_caps<'a, P: Into>>(&self, caps: P) { let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.0); + ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0); } } @@ -146,21 +139,21 @@ impl AppSink { pub fn get_property_buffer_list(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"buffer-list\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"buffer-list\0".as_ptr() as *const _, Value::from(&buffer_list).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"eos\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"eos\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -168,7 +161,7 @@ impl AppSink { pub fn connect_eos(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"eos\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _, transmute(eos_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -176,7 +169,7 @@ impl AppSink { pub fn connect_property_buffer_list_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::buffer-list\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::buffer-list\0".as_ptr() as *const _, transmute(notify_buffer_list_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -184,7 +177,7 @@ impl AppSink { pub fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::caps\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -192,7 +185,7 @@ impl AppSink { pub fn connect_property_drop_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::drop\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::drop\0".as_ptr() as *const _, transmute(notify_drop_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -200,7 +193,7 @@ impl AppSink { pub fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::emit-signals\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _, transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -208,7 +201,7 @@ impl AppSink { pub fn connect_property_eos_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::eos\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::eos\0".as_ptr() as *const _, transmute(notify_eos_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -216,7 +209,7 @@ impl AppSink { pub fn connect_property_max_buffers_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::max-buffers\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-buffers\0".as_ptr() as *const _, transmute(notify_max_buffers_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -224,7 +217,7 @@ impl AppSink { pub fn connect_property_wait_on_eos_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::wait-on-eos\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::wait-on-eos\0".as_ptr() as *const _, transmute(notify_wait_on_eos_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -233,6 +226,8 @@ impl AppSink { unsafe impl Send for AppSink {} unsafe impl Sync for AppSink {} +pub const NONE_APP_SINK: Option<&AppSink> = None; + unsafe extern "C" fn eos_trampoline(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) { let f: &&(Fn(&AppSink) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-app/src/auto/app_src.rs b/gstreamer-app/src/auto/app_src.rs index cb5656bc6..7c095e8c4 100644 --- a/gstreamer-app/src/auto/app_src.rs +++ b/gstreamer-app/src/auto/app_src.rs @@ -6,6 +6,7 @@ use AppStreamType; use ffi; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -13,19 +14,12 @@ use glib_ffi; use gobject_ffi; use gst; use gst_base; -use gst_base_ffi; -use gst_ffi; use libc; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct AppSrc(Object): [ - gst_base::BaseSrc => gst_base_ffi::GstBaseSrc, - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - gst::URIHandler => gst_ffi::GstURIHandler, - ]; + pub struct AppSrc(Object) @extends gst_base::BaseSrc, gst::Element, gst::Object, @implements gst::URIHandler; match fn { get_type => || ffi::gst_app_src_get_type(), @@ -82,9 +76,8 @@ impl AppSrc { pub fn set_caps<'a, P: Into>>(&self, caps: P) { let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.0); + ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0); } } @@ -122,105 +115,105 @@ impl AppSrc { pub fn get_property_block(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"block\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"block\0".as_ptr() as *const _, Value::from(&block).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"format\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"format\0".as_ptr() as *const _, Value::from(&format).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"is-live\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"is-live\0".as_ptr() as *const _, Value::from(&is_live).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"max-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"max-latency\0".as_ptr() as *const _, Value::from(&max_latency).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"min-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"min-latency\0".as_ptr() as *const _, Value::from(&min_latency).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"min-percent\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"min-percent\0".as_ptr() as *const _, Value::from(&min_percent).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"enough-data\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"enough-data\0".as_ptr() as *const _, transmute(enough_data_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -228,7 +221,7 @@ impl AppSrc { pub fn connect_need_data(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"need-data\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"need-data\0".as_ptr() as *const _, transmute(need_data_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -236,7 +229,7 @@ impl AppSrc { pub fn connect_seek_data bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"seek-data\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"seek-data\0".as_ptr() as *const _, transmute(seek_data_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -244,7 +237,7 @@ impl AppSrc { pub fn connect_property_block_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::block\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::block\0".as_ptr() as *const _, transmute(notify_block_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -252,7 +245,7 @@ impl AppSrc { pub fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::caps\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -260,7 +253,7 @@ impl AppSrc { pub fn connect_property_current_level_bytes_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::current-level-bytes\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::current-level-bytes\0".as_ptr() as *const _, transmute(notify_current_level_bytes_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -268,7 +261,7 @@ impl AppSrc { pub fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -276,7 +269,7 @@ impl AppSrc { pub fn connect_property_emit_signals_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::emit-signals\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _, transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -284,7 +277,7 @@ impl AppSrc { pub fn connect_property_format_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::format\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::format\0".as_ptr() as *const _, transmute(notify_format_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -292,7 +285,7 @@ impl AppSrc { pub fn connect_property_is_live_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::is-live\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::is-live\0".as_ptr() as *const _, transmute(notify_is_live_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -300,7 +293,7 @@ impl AppSrc { pub fn connect_property_max_bytes_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::max-bytes\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-bytes\0".as_ptr() as *const _, transmute(notify_max_bytes_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -308,7 +301,7 @@ impl AppSrc { pub fn connect_property_max_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::max-latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-latency\0".as_ptr() as *const _, transmute(notify_max_latency_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -316,7 +309,7 @@ impl AppSrc { pub fn connect_property_min_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::min-latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::min-latency\0".as_ptr() as *const _, transmute(notify_min_latency_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -324,7 +317,7 @@ impl AppSrc { pub fn connect_property_min_percent_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::min-percent\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::min-percent\0".as_ptr() as *const _, transmute(notify_min_percent_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -332,7 +325,7 @@ impl AppSrc { pub fn connect_property_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::size\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::size\0".as_ptr() as *const _, transmute(notify_size_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -340,7 +333,7 @@ impl AppSrc { pub fn connect_property_stream_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::stream-type\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _, transmute(notify_stream_type_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -349,6 +342,8 @@ impl AppSrc { unsafe impl Send for AppSrc {} unsafe impl Sync for AppSrc {} +pub const NONE_APP_SRC: Option<&AppSrc> = None; + unsafe extern "C" fn enough_data_trampoline(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) { let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-app/src/auto/mod.rs b/gstreamer-app/src/auto/mod.rs index a32f0c4a0..c3f9ada6e 100644 --- a/gstreamer-app/src/auto/mod.rs +++ b/gstreamer-app/src/auto/mod.rs @@ -3,10 +3,10 @@ // DO NOT EDIT mod app_sink; -pub use self::app_sink::AppSink; +pub use self::app_sink::{AppSink, AppSinkClass, NONE_APP_SINK}; mod app_src; -pub use self::app_src::AppSrc; +pub use self::app_src::{AppSrc, AppSrcClass, NONE_APP_SRC}; mod enums; pub use self::enums::AppStreamType; diff --git a/gstreamer-app/src/auto/versions.txt b/gstreamer-app/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-app/src/auto/versions.txt +++ b/gstreamer-app/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-audio/src/auto/mod.rs b/gstreamer-audio/src/auto/mod.rs index a4a957003..04257a030 100644 --- a/gstreamer-audio/src/auto/mod.rs +++ b/gstreamer-audio/src/auto/mod.rs @@ -3,7 +3,7 @@ // DO NOT EDIT mod stream_volume; -pub use self::stream_volume::StreamVolume; +pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME}; pub use self::stream_volume::StreamVolumeExt; #[cfg(any(feature = "v1_14", feature = "dox"))] diff --git a/gstreamer-audio/src/auto/stream_volume.rs b/gstreamer-audio/src/auto/stream_volume.rs index ae5e5ad7c..3d9de8f98 100644 --- a/gstreamer-audio/src/auto/stream_volume.rs +++ b/gstreamer-audio/src/auto/stream_volume.rs @@ -4,7 +4,7 @@ use StreamVolumeFormat; use ffi; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,7 +14,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct StreamVolume(Object); + pub struct StreamVolume(Interface); match fn { get_type => || ffi::gst_stream_volume_get_type(), @@ -33,6 +33,8 @@ impl StreamVolume { unsafe impl Send for StreamVolume {} unsafe impl Sync for StreamVolume {} +pub const NONE_STREAM_VOLUME: Option<&StreamVolume> = None; + pub trait StreamVolumeExt: 'static { fn get_mute(&self) -> bool; @@ -50,32 +52,32 @@ pub trait StreamVolumeExt: 'static { impl> StreamVolumeExt for O { fn get_mute(&self) -> bool { unsafe { - from_glib(ffi::gst_stream_volume_get_mute(self.to_glib_none().0)) + from_glib(ffi::gst_stream_volume_get_mute(self.as_ref().to_glib_none().0)) } } fn get_volume(&self, format: StreamVolumeFormat) -> f64 { unsafe { - ffi::gst_stream_volume_get_volume(self.to_glib_none().0, format.to_glib()) + ffi::gst_stream_volume_get_volume(self.as_ref().to_glib_none().0, format.to_glib()) } } fn set_mute(&self, mute: bool) { unsafe { - ffi::gst_stream_volume_set_mute(self.to_glib_none().0, mute.to_glib()); + ffi::gst_stream_volume_set_mute(self.as_ref().to_glib_none().0, mute.to_glib()); } } fn set_volume(&self, format: StreamVolumeFormat, val: f64) { unsafe { - ffi::gst_stream_volume_set_volume(self.to_glib_none().0, format.to_glib(), val); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mute\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, transmute(notify_mute_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -83,7 +85,7 @@ impl> StreamVolumeExt for O { fn connect_property_volume_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::volume\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _, transmute(notify_volume_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -92,11 +94,11 @@ impl> StreamVolumeExt for O { unsafe extern "C" fn notify_mute_trampoline

(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&StreamVolume::from_glib_borrow(this).downcast_unchecked()) + f(&StreamVolume::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_volume_trampoline

(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&StreamVolume::from_glib_borrow(this).downcast_unchecked()) + f(&StreamVolume::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-audio/src/auto/versions.txt b/gstreamer-audio/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-audio/src/auto/versions.txt +++ b/gstreamer-audio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-base/src/auto/adapter.rs b/gstreamer-base/src/auto/adapter.rs index ac5a50fba..61665c0c8 100644 --- a/gstreamer-base/src/auto/adapter.rs +++ b/gstreamer-base/src/auto/adapter.rs @@ -10,7 +10,7 @@ use gst; use std::mem; glib_wrapper! { - pub struct Adapter(Object); + pub struct Adapter(Object); match fn { get_type => || ffi::gst_adapter_get_type(), @@ -197,3 +197,5 @@ unsafe impl glib::SendUnique for Adapter { self.ref_count() == 1 } } + +pub const NONE_ADAPTER: Option<&Adapter> = None; diff --git a/gstreamer-base/src/auto/aggregator.rs b/gstreamer-base/src/auto/aggregator.rs index a5c999011..a96237851 100644 --- a/gstreamer-base/src/auto/aggregator.rs +++ b/gstreamer-base/src/auto/aggregator.rs @@ -2,11 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use AggregatorClass; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,15 +13,11 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Aggregator(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct Aggregator(Object) @extends gst::Element, gst::Object; match fn { get_type => || ffi::gst_aggregator_get_type(), @@ -32,6 +27,8 @@ glib_wrapper! { unsafe impl Send for Aggregator {} unsafe impl Sync for Aggregator {} +pub const NONE_AGGREGATOR: Option<&Aggregator> = None; + pub trait AggregatorExt: 'static { //#[cfg(any(feature = "v1_14", feature = "dox"))] //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); @@ -67,28 +64,28 @@ impl> AggregatorExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_aggregator_get_buffer_pool(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_aggregator_get_latency(self.to_glib_none().0)) + from_glib(ffi::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 { - ffi::gst_aggregator_set_latency(self.to_glib_none().0, min_latency.to_glib(), max_latency.to_glib()); + ffi::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 { - ffi::gst_aggregator_set_src_caps(self.to_glib_none().0, caps.to_glib_none().0); + ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); } } @@ -110,7 +107,7 @@ impl> AggregatorExt for O { fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, transmute(notify_latency_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -118,7 +115,7 @@ impl> AggregatorExt for O { fn connect_property_start_time_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::start-time\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::start-time\0".as_ptr() as *const _, transmute(notify_start_time_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -128,11 +125,11 @@ impl> AggregatorExt for O { unsafe extern "C" fn notify_latency_trampoline

(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Aggregator::from_glib_borrow(this).downcast_unchecked()) + f(&Aggregator::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_start_time_trampoline

(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Aggregator::from_glib_borrow(this).downcast_unchecked()) + f(&Aggregator::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-base/src/auto/aggregator_pad.rs b/gstreamer-base/src/auto/aggregator_pad.rs index 0221644af..eec8393f3 100644 --- a/gstreamer-base/src/auto/aggregator_pad.rs +++ b/gstreamer-base/src/auto/aggregator_pad.rs @@ -2,18 +2,13 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use AggregatorPadClass; use ffi; use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct AggregatorPad(Object): [ - gst::Pad => gst_ffi::GstPad, - gst::Object => gst_ffi::GstObject, - ]; + pub struct AggregatorPad(Object) @extends gst::Pad, gst::Object; match fn { get_type => || ffi::gst_aggregator_pad_get_type(), @@ -23,6 +18,8 @@ glib_wrapper! { unsafe impl Send for AggregatorPad {} unsafe impl Sync for AggregatorPad {} +pub const NONE_AGGREGATOR_PAD: Option<&AggregatorPad> = None; + pub trait AggregatorPadExt: 'static { #[cfg(any(feature = "v1_14", feature = "dox"))] fn drop_buffer(&self) -> bool; @@ -44,35 +41,35 @@ impl> AggregatorPadExt for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn drop_buffer(&self) -> bool { unsafe { - from_glib(ffi::gst_aggregator_pad_drop_buffer(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_aggregator_pad_has_buffer(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_aggregator_pad_is_eos(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_aggregator_pad_peek_buffer(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_aggregator_pad_pop_buffer(self.to_glib_none().0)) + from_glib_full(ffi::gst_aggregator_pad_pop_buffer(self.as_ref().to_glib_none().0)) } } } diff --git a/gstreamer-base/src/auto/base_sink.rs b/gstreamer-base/src/auto/base_sink.rs index cff56d0c4..641f0ea02 100644 --- a/gstreamer-base/src/auto/base_sink.rs +++ b/gstreamer-base/src/auto/base_sink.rs @@ -2,11 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use BaseSinkClass; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,16 +13,12 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct BaseSink(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct BaseSink(Object) @extends gst::Element, gst::Object; match fn { get_type => || ffi::gst_base_sink_get_type(), @@ -33,6 +28,8 @@ glib_wrapper! { unsafe impl Send for BaseSink {} unsafe impl Sync for BaseSink {} +pub const NONE_BASE_SINK: Option<&BaseSink> = None; + pub trait BaseSinkExt: 'static { //fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> gst::FlowReturn; @@ -132,80 +129,80 @@ impl> BaseSinkExt for O { fn get_blocksize(&self) -> u32 { unsafe { - ffi::gst_base_sink_get_blocksize(self.to_glib_none().0) + ffi::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(ffi::gst_base_sink_get_drop_out_of_segment(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_base_sink_get_last_sample(self.to_glib_none().0)) + from_glib_full(ffi::gst_base_sink_get_last_sample(self.as_ref().to_glib_none().0)) } } fn get_latency(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_base_sink_get_latency(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_get_latency(self.as_ref().to_glib_none().0)) } } fn get_max_bitrate(&self) -> u64 { unsafe { - ffi::gst_base_sink_get_max_bitrate(self.to_glib_none().0) + ffi::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0) } } fn get_max_lateness(&self) -> i64 { unsafe { - ffi::gst_base_sink_get_max_lateness(self.to_glib_none().0) + ffi::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0) } } fn get_render_delay(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_base_sink_get_render_delay(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_get_render_delay(self.as_ref().to_glib_none().0)) } } fn get_sync(&self) -> bool { unsafe { - from_glib(ffi::gst_base_sink_get_sync(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_get_sync(self.as_ref().to_glib_none().0)) } } fn get_throttle_time(&self) -> u64 { unsafe { - ffi::gst_base_sink_get_throttle_time(self.to_glib_none().0) + ffi::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0) } } fn get_ts_offset(&self) -> gst::ClockTimeDiff { unsafe { - ffi::gst_base_sink_get_ts_offset(self.to_glib_none().0) + ffi::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0) } } fn is_async_enabled(&self) -> bool { unsafe { - from_glib(ffi::gst_base_sink_is_async_enabled(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_is_async_enabled(self.as_ref().to_glib_none().0)) } } fn is_last_sample_enabled(&self) -> bool { unsafe { - from_glib(ffi::gst_base_sink_is_last_sample_enabled(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_is_last_sample_enabled(self.as_ref().to_glib_none().0)) } } fn is_qos_enabled(&self) -> bool { unsafe { - from_glib(ffi::gst_base_sink_is_qos_enabled(self.to_glib_none().0)) + from_glib(ffi::gst_base_sink_is_qos_enabled(self.as_ref().to_glib_none().0)) } } @@ -215,82 +212,82 @@ 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(ffi::gst_base_sink_query_latency(self.to_glib_none().0, &mut live, &mut upstream_live, &mut min_latency, &mut max_latency)); + let ret = from_glib(ffi::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 { - ffi::gst_base_sink_set_async_enabled(self.to_glib_none().0, enabled.to_glib()); + ffi::gst_base_sink_set_async_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_blocksize(&self, blocksize: u32) { unsafe { - ffi::gst_base_sink_set_blocksize(self.to_glib_none().0, blocksize); + ffi::gst_base_sink_set_blocksize(self.as_ref().to_glib_none().0, blocksize); } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) { unsafe { - ffi::gst_base_sink_set_drop_out_of_segment(self.to_glib_none().0, drop_out_of_segment.to_glib()); + ffi::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 { - ffi::gst_base_sink_set_last_sample_enabled(self.to_glib_none().0, enabled.to_glib()); + ffi::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 { - ffi::gst_base_sink_set_max_bitrate(self.to_glib_none().0, max_bitrate); + ffi::gst_base_sink_set_max_bitrate(self.as_ref().to_glib_none().0, max_bitrate); } } fn set_max_lateness(&self, max_lateness: i64) { unsafe { - ffi::gst_base_sink_set_max_lateness(self.to_glib_none().0, max_lateness); + ffi::gst_base_sink_set_max_lateness(self.as_ref().to_glib_none().0, max_lateness); } } fn set_qos_enabled(&self, enabled: bool) { unsafe { - ffi::gst_base_sink_set_qos_enabled(self.to_glib_none().0, enabled.to_glib()); + ffi::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 { - ffi::gst_base_sink_set_render_delay(self.to_glib_none().0, delay.to_glib()); + ffi::gst_base_sink_set_render_delay(self.as_ref().to_glib_none().0, delay.to_glib()); } } fn set_sync(&self, sync: bool) { unsafe { - ffi::gst_base_sink_set_sync(self.to_glib_none().0, sync.to_glib()); + ffi::gst_base_sink_set_sync(self.as_ref().to_glib_none().0, sync.to_glib()); } } fn set_throttle_time(&self, throttle: u64) { unsafe { - ffi::gst_base_sink_set_throttle_time(self.to_glib_none().0, throttle); + ffi::gst_base_sink_set_throttle_time(self.as_ref().to_glib_none().0, throttle); } } fn set_ts_offset(&self, offset: gst::ClockTimeDiff) { unsafe { - ffi::gst_base_sink_set_ts_offset(self.to_glib_none().0, offset); + ffi::gst_base_sink_set_ts_offset(self.as_ref().to_glib_none().0, offset); } } fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff) { unsafe { let mut jitter = mem::uninitialized(); - let ret = from_glib(ffi::gst_base_sink_wait_clock(self.to_glib_none().0, time.to_glib(), &mut jitter)); + let ret = from_glib(ffi::gst_base_sink_wait_clock(self.as_ref().to_glib_none().0, time.to_glib(), &mut jitter)); (ret, jitter) } } @@ -340,7 +337,7 @@ impl> BaseSinkExt for O { fn connect_property_async_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::async\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::async\0".as_ptr() as *const _, transmute(notify_async_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -348,7 +345,7 @@ impl> BaseSinkExt for O { fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::blocksize\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _, transmute(notify_blocksize_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -356,7 +353,7 @@ impl> BaseSinkExt for O { fn connect_property_enable_last_sample_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::enable-last-sample\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::enable-last-sample\0".as_ptr() as *const _, transmute(notify_enable_last_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -364,7 +361,7 @@ impl> BaseSinkExt for O { fn connect_property_last_sample_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::last-sample\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::last-sample\0".as_ptr() as *const _, transmute(notify_last_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -372,7 +369,7 @@ impl> BaseSinkExt for O { fn connect_property_max_bitrate_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _, transmute(notify_max_bitrate_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -380,7 +377,7 @@ impl> BaseSinkExt for O { fn connect_property_max_lateness_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-lateness\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-lateness\0".as_ptr() as *const _, transmute(notify_max_lateness_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -388,7 +385,7 @@ impl> BaseSinkExt for O { fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::qos\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _, transmute(notify_qos_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -396,7 +393,7 @@ impl> BaseSinkExt for O { fn connect_property_render_delay_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::render-delay\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::render-delay\0".as_ptr() as *const _, transmute(notify_render_delay_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -404,7 +401,7 @@ impl> BaseSinkExt for O { fn connect_property_sync_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::sync\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::sync\0".as_ptr() as *const _, transmute(notify_sync_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -412,7 +409,7 @@ impl> BaseSinkExt for O { fn connect_property_throttle_time_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::throttle-time\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::throttle-time\0".as_ptr() as *const _, transmute(notify_throttle_time_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -420,7 +417,7 @@ impl> BaseSinkExt for O { fn connect_property_ts_offset_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::ts-offset\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::ts-offset\0".as_ptr() as *const _, transmute(notify_ts_offset_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -429,65 +426,65 @@ impl> BaseSinkExt for O { unsafe extern "C" fn notify_async_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_blocksize_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_enable_last_sample_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_last_sample_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_max_bitrate_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_max_lateness_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_qos_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_render_delay_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_sync_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_throttle_time_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_ts_offset_trampoline

(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSink::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-base/src/auto/base_src.rs b/gstreamer-base/src/auto/base_src.rs index 6202e2451..ccd9de85d 100644 --- a/gstreamer-base/src/auto/base_src.rs +++ b/gstreamer-base/src/auto/base_src.rs @@ -2,11 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use BaseSrcClass; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,16 +13,12 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct BaseSrc(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct BaseSrc(Object) @extends gst::Element, gst::Object; match fn { get_type => || ffi::gst_base_src_get_type(), @@ -33,6 +28,8 @@ glib_wrapper! { unsafe impl Send for BaseSrc {} unsafe impl Sync for BaseSrc {} +pub const NONE_BASE_SRC: Option<&BaseSrc> = None; + pub trait BaseSrcExt: 'static { //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); @@ -90,37 +87,37 @@ impl> BaseSrcExt for O { fn get_blocksize(&self) -> u32 { unsafe { - ffi::gst_base_src_get_blocksize(self.to_glib_none().0) + ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) } } fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_base_src_get_buffer_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_base_src_get_buffer_pool(self.as_ref().to_glib_none().0)) } } fn get_do_timestamp(&self) -> bool { unsafe { - from_glib(ffi::gst_base_src_get_do_timestamp(self.to_glib_none().0)) + from_glib(ffi::gst_base_src_get_do_timestamp(self.as_ref().to_glib_none().0)) } } fn is_async(&self) -> bool { unsafe { - from_glib(ffi::gst_base_src_is_async(self.to_glib_none().0)) + from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0)) } } fn is_live(&self) -> bool { unsafe { - from_glib(ffi::gst_base_src_is_live(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_base_src_new_seamless_segment(self.to_glib_none().0, start, stop, time)) + from_glib(ffi::gst_base_src_new_seamless_segment(self.as_ref().to_glib_none().0, start, stop, time)) } } @@ -129,56 +126,56 @@ 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(ffi::gst_base_src_query_latency(self.to_glib_none().0, &mut live, &mut min_latency, &mut max_latency)); + let ret = from_glib(ffi::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 } } } fn set_async(&self, async: bool) { unsafe { - ffi::gst_base_src_set_async(self.to_glib_none().0, async.to_glib()); + ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async.to_glib()); } } fn set_automatic_eos(&self, automatic_eos: bool) { unsafe { - ffi::gst_base_src_set_automatic_eos(self.to_glib_none().0, automatic_eos.to_glib()); + ffi::gst_base_src_set_automatic_eos(self.as_ref().to_glib_none().0, automatic_eos.to_glib()); } } fn set_blocksize(&self, blocksize: u32) { unsafe { - ffi::gst_base_src_set_blocksize(self.to_glib_none().0, blocksize); + ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize); } } fn set_caps(&self, caps: &gst::Caps) -> bool { unsafe { - from_glib(ffi::gst_base_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) } } fn set_do_timestamp(&self, timestamp: bool) { unsafe { - ffi::gst_base_src_set_do_timestamp(self.to_glib_none().0, timestamp.to_glib()); + ffi::gst_base_src_set_do_timestamp(self.as_ref().to_glib_none().0, timestamp.to_glib()); } } fn set_dynamic_size(&self, dynamic: bool) { unsafe { - ffi::gst_base_src_set_dynamic_size(self.to_glib_none().0, dynamic.to_glib()); + ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.to_glib()); } } fn set_format(&self, format: gst::Format) { unsafe { - ffi::gst_base_src_set_format(self.to_glib_none().0, format.to_glib()); + ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.to_glib()); } } fn set_live(&self, live: bool) { unsafe { - ffi::gst_base_src_set_live(self.to_glib_none().0, live.to_glib()); + ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.to_glib()); } } @@ -213,7 +210,7 @@ impl> BaseSrcExt for O { fn connect_property_blocksize_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::blocksize\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _, transmute(notify_blocksize_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -221,7 +218,7 @@ impl> BaseSrcExt for O { fn connect_property_do_timestamp_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _, transmute(notify_do_timestamp_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -229,7 +226,7 @@ impl> BaseSrcExt for O { fn connect_property_num_buffers_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::num-buffers\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::num-buffers\0".as_ptr() as *const _, transmute(notify_num_buffers_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -237,7 +234,7 @@ impl> BaseSrcExt for O { fn connect_property_typefind_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::typefind\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::typefind\0".as_ptr() as *const _, transmute(notify_typefind_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -246,23 +243,23 @@ impl> BaseSrcExt for O { unsafe extern "C" fn notify_blocksize_trampoline

(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_do_timestamp_trampoline

(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_num_buffers_trampoline

(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_typefind_trampoline

(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) + f(&BaseSrc::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-base/src/auto/base_transform.rs b/gstreamer-base/src/auto/base_transform.rs index 43d3816c5..a451d9150 100644 --- a/gstreamer-base/src/auto/base_transform.rs +++ b/gstreamer-base/src/auto/base_transform.rs @@ -2,11 +2,10 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use BaseTransformClass; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,15 +13,11 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct BaseTransform(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct BaseTransform(Object) @extends gst::Element, gst::Object; match fn { get_type => || ffi::gst_base_transform_get_type(), @@ -32,6 +27,8 @@ glib_wrapper! { unsafe impl Send for BaseTransform {} unsafe impl Sync for BaseTransform {} +pub const NONE_BASE_TRANSFORM: Option<&BaseTransform> = None; + pub trait BaseTransformExt: 'static { //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); @@ -75,79 +72,79 @@ impl> BaseTransformExt for O { fn get_buffer_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_base_transform_get_buffer_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_base_transform_get_buffer_pool(self.as_ref().to_glib_none().0)) } } fn is_in_place(&self) -> bool { unsafe { - from_glib(ffi::gst_base_transform_is_in_place(self.to_glib_none().0)) + from_glib(ffi::gst_base_transform_is_in_place(self.as_ref().to_glib_none().0)) } } fn is_passthrough(&self) -> bool { unsafe { - from_glib(ffi::gst_base_transform_is_passthrough(self.to_glib_none().0)) + from_glib(ffi::gst_base_transform_is_passthrough(self.as_ref().to_glib_none().0)) } } fn is_qos_enabled(&self) -> bool { unsafe { - from_glib(ffi::gst_base_transform_is_qos_enabled(self.to_glib_none().0)) + from_glib(ffi::gst_base_transform_is_qos_enabled(self.as_ref().to_glib_none().0)) } } fn reconfigure_sink(&self) { unsafe { - ffi::gst_base_transform_reconfigure_sink(self.to_glib_none().0); + ffi::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0); } } fn reconfigure_src(&self) { unsafe { - ffi::gst_base_transform_reconfigure_src(self.to_glib_none().0); + ffi::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0); } } fn set_gap_aware(&self, gap_aware: bool) { unsafe { - ffi::gst_base_transform_set_gap_aware(self.to_glib_none().0, gap_aware.to_glib()); + ffi::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 { - ffi::gst_base_transform_set_in_place(self.to_glib_none().0, in_place.to_glib()); + ffi::gst_base_transform_set_in_place(self.as_ref().to_glib_none().0, in_place.to_glib()); } } fn set_passthrough(&self, passthrough: bool) { unsafe { - ffi::gst_base_transform_set_passthrough(self.to_glib_none().0, passthrough.to_glib()); + ffi::gst_base_transform_set_passthrough(self.as_ref().to_glib_none().0, passthrough.to_glib()); } } fn set_prefer_passthrough(&self, prefer_passthrough: bool) { unsafe { - ffi::gst_base_transform_set_prefer_passthrough(self.to_glib_none().0, prefer_passthrough.to_glib()); + ffi::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 { - ffi::gst_base_transform_set_qos_enabled(self.to_glib_none().0, enabled.to_glib()); + ffi::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 { - ffi::gst_base_transform_update_qos(self.to_glib_none().0, proportion, diff, timestamp.to_glib()); + ffi::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) -> bool { unsafe { - from_glib(ffi::gst_base_transform_update_src_caps(self.to_glib_none().0, updated_caps.to_glib_none().0)) + from_glib(ffi::gst_base_transform_update_src_caps(self.as_ref().to_glib_none().0, updated_caps.to_glib_none().0)) } } @@ -168,7 +165,7 @@ impl> BaseTransformExt for O { fn connect_property_qos_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::qos\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _, transmute(notify_qos_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -177,5 +174,5 @@ impl> BaseTransformExt for O { unsafe extern "C" fn notify_qos_trampoline

(this: *mut ffi::GstBaseTransform, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&BaseTransform::from_glib_borrow(this).downcast_unchecked()) + f(&BaseTransform::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-base/src/auto/functions.rs b/gstreamer-base/src/auto/functions.rs index 37a40db00..66a5f2ce1 100644 --- a/gstreamer-base/src/auto/functions.rs +++ b/gstreamer-base/src/auto/functions.rs @@ -12,17 +12,16 @@ use std::mem; pub fn type_find_helper>(src: &P, size: u64) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_type_find_helper(src.to_glib_none().0, size)) + from_glib_full(ffi::gst_type_find_helper(src.as_ref().to_glib_none().0, size)) } } pub fn type_find_helper_for_buffer<'a, P: IsA + 'a, Q: Into>>(obj: Q, buf: &gst::Buffer) -> (Option, gst::TypeFindProbability) { assert_initialized_main_thread!(); let obj = obj.into(); - let obj = obj.to_glib_none(); unsafe { let mut prob = mem::uninitialized(); - let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer(obj.0, buf.to_glib_none().0, &mut prob)); + let ret = from_glib_full(ffi::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)) } } @@ -30,9 +29,8 @@ pub fn type_find_helper_for_buffer<'a, P: IsA + 'a, Q: Into + 'a, Q: Into>>(obj: Q, extension: &str) -> Option { assert_initialized_main_thread!(); let obj = obj.into(); - let obj = obj.to_glib_none(); unsafe { - from_glib_full(ffi::gst_type_find_helper_for_extension(obj.0, extension.to_glib_none().0)) + from_glib_full(ffi::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 0bce4e707..57ae2b5ed 100644 --- a/gstreamer-base/src/auto/mod.rs +++ b/gstreamer-base/src/auto/mod.rs @@ -3,36 +3,36 @@ // DO NOT EDIT mod adapter; -pub use self::adapter::Adapter; +pub use self::adapter::{Adapter, AdapterClass, NONE_ADAPTER}; #[cfg(any(feature = "v1_14", feature = "dox"))] mod aggregator; #[cfg(any(feature = "v1_14", feature = "dox"))] -pub use self::aggregator::Aggregator; +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"))] mod aggregator_pad; #[cfg(any(feature = "v1_14", feature = "dox"))] -pub use self::aggregator_pad::AggregatorPad; +pub use self::aggregator_pad::{AggregatorPad, AggregatorPadClass, NONE_AGGREGATOR_PAD}; #[cfg(any(feature = "v1_14", feature = "dox"))] pub use self::aggregator_pad::AggregatorPadExt; mod base_sink; -pub use self::base_sink::BaseSink; +pub use self::base_sink::{BaseSink, BaseSinkClass, NONE_BASE_SINK}; pub use self::base_sink::BaseSinkExt; mod base_src; -pub use self::base_src::BaseSrc; +pub use self::base_src::{BaseSrc, BaseSrcClass, NONE_BASE_SRC}; pub use self::base_src::BaseSrcExt; mod base_transform; -pub use self::base_transform::BaseTransform; +pub use self::base_transform::{BaseTransform, BaseTransformClass, NONE_BASE_TRANSFORM}; pub use self::base_transform::BaseTransformExt; mod push_src; -pub use self::push_src::PushSrc; +pub use self::push_src::{PushSrc, PushSrcClass, NONE_PUSH_SRC}; pub mod functions; diff --git a/gstreamer-base/src/auto/push_src.rs b/gstreamer-base/src/auto/push_src.rs index 9032e4734..7729a8c90 100644 --- a/gstreamer-base/src/auto/push_src.rs +++ b/gstreamer-base/src/auto/push_src.rs @@ -6,14 +6,9 @@ use BaseSrc; use ffi; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct PushSrc(Object): [ - BaseSrc, - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct PushSrc(Object) @extends BaseSrc, gst::Element, gst::Object; match fn { get_type => || ffi::gst_push_src_get_type(), @@ -24,3 +19,5 @@ impl PushSrc {} unsafe impl Send for PushSrc {} unsafe impl Sync for PushSrc {} + +pub const NONE_PUSH_SRC: Option<&PushSrc> = None; diff --git a/gstreamer-base/src/auto/versions.txt b/gstreamer-base/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-base/src/auto/versions.txt +++ b/gstreamer-base/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-check/src/auto/mod.rs b/gstreamer-check/src/auto/mod.rs index 132169bcb..0dabd69f2 100644 --- a/gstreamer-check/src/auto/mod.rs +++ b/gstreamer-check/src/auto/mod.rs @@ -3,7 +3,7 @@ // DO NOT EDIT mod test_clock; -pub use self::test_clock::TestClock; +pub use self::test_clock::{TestClock, TestClockClass, NONE_TEST_CLOCK}; #[doc(hidden)] pub mod traits { diff --git a/gstreamer-check/src/auto/test_clock.rs b/gstreamer-check/src/auto/test_clock.rs index 1ee985b94..23b2963ac 100644 --- a/gstreamer-check/src/auto/test_clock.rs +++ b/gstreamer-check/src/auto/test_clock.rs @@ -5,22 +5,19 @@ use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct TestClock(Object): [ - gst::Clock => gst_ffi::GstClock, - gst::Object => gst_ffi::GstObject, - ]; + pub struct TestClock(Object) @extends gst::Clock, gst::Object; match fn { get_type => || ffi::gst_test_clock_get_type(), @@ -31,14 +28,14 @@ impl TestClock { pub fn new() -> TestClock { assert_initialized_main_thread!(); unsafe { - gst::Clock::from_glib_full(ffi::gst_test_clock_new()).downcast_unchecked() + gst::Clock::from_glib_full(ffi::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(ffi::gst_test_clock_new_with_start_time(start_time.to_glib())).downcast_unchecked() + gst::Clock::from_glib_full(ffi::gst_test_clock_new_with_start_time(start_time.to_glib())).unsafe_cast() } } @@ -105,21 +102,21 @@ impl TestClock { pub fn get_property_clock_type(&self) -> gst::ClockType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"clock-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"clock-type\0".as_ptr() as *const _, Value::from(&clock_type).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -131,7 +128,7 @@ impl TestClock { pub fn connect_property_clock_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::clock-type\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::clock-type\0".as_ptr() as *const _, transmute(notify_clock_type_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -146,6 +143,8 @@ impl Default for TestClock { unsafe impl Send for TestClock {} unsafe impl Sync for TestClock {} +pub const NONE_TEST_CLOCK: Option<&TestClock> = None; + unsafe extern "C" fn notify_clock_type_trampoline(this: *mut ffi::GstTestClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&TestClock) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-check/src/auto/versions.txt b/gstreamer-check/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-check/src/auto/versions.txt +++ b/gstreamer-check/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-editing-services/src/auto/asset.rs b/gstreamer-editing-services/src/auto/asset.rs index 311c2383d..7e0ca33fd 100644 --- a/gstreamer-editing-services/src/auto/asset.rs +++ b/gstreamer-editing-services/src/auto/asset.rs @@ -12,7 +12,7 @@ use gio_ffi; use glib; use glib::GString; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -24,7 +24,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Asset(Object); + pub struct Asset(Object); match fn { get_type => || ffi::ges_asset_get_type(), @@ -42,30 +42,28 @@ impl Asset { pub fn request<'a, P: Into>>(extractable_type: glib::types::Type, id: P) -> Result, Error> { assert_initialized_main_thread!(); let id = id.into(); - let id = id.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ges_asset_request(extractable_type.to_glib(), id.0, &mut error); + let ret = ffi::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<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: P, callback: Q) { + pub fn request_async<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: Q, callback: R) { assert_initialized_main_thread!(); let cancellable = cancellable.into(); - let cancellable = cancellable.to_glib_none(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn request_async_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) + let user_data: Box> = Box::new(Box::new(callback)); + unsafe extern "C" fn request_async_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::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 callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box> = Box::from_raw(user_data as *mut _); callback(result); } - let callback = request_async_trampoline::; + let callback = request_async_trampoline::; unsafe { - ffi::ges_asset_request_async(extractable_type.to_glib(), id.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + ffi::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 _); } } @@ -92,6 +90,8 @@ impl Asset { } } +pub const NONE_ASSET: Option<&Asset> = None; + pub trait AssetExt: 'static { fn extract(&self) -> Result, Error>; @@ -122,58 +122,57 @@ impl> AssetExt for O { fn extract(&self) -> Result, Error> { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ges_asset_extract(self.to_glib_none().0, &mut error); + let ret = ffi::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)) } } } fn get_error(&self) -> Option { unsafe { - from_glib_none(ffi::ges_asset_get_error(self.to_glib_none().0)) + from_glib_none(ffi::ges_asset_get_error(self.as_ref().to_glib_none().0)) } } fn get_extractable_type(&self) -> glib::types::Type { unsafe { - from_glib(ffi::ges_asset_get_extractable_type(self.to_glib_none().0)) + from_glib(ffi::ges_asset_get_extractable_type(self.as_ref().to_glib_none().0)) } } fn get_id(&self) -> Option { unsafe { - from_glib_none(ffi::ges_asset_get_id(self.to_glib_none().0)) + from_glib_none(ffi::ges_asset_get_id(self.as_ref().to_glib_none().0)) } } fn get_proxy(&self) -> Option { unsafe { - from_glib_none(ffi::ges_asset_get_proxy(self.to_glib_none().0)) + from_glib_none(ffi::ges_asset_get_proxy(self.as_ref().to_glib_none().0)) } } fn get_proxy_target(&self) -> Option { unsafe { - from_glib_none(ffi::ges_asset_get_proxy_target(self.to_glib_none().0)) + from_glib_none(ffi::ges_asset_get_proxy_target(self.as_ref().to_glib_none().0)) } } fn list_proxies(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.as_ref().to_glib_none().0)) } } fn set_proxy<'a, P: IsA + 'a, Q: Into>>(&self, proxy: Q) -> bool { let proxy = proxy.into(); - let proxy = proxy.to_glib_none(); unsafe { - from_glib(ffi::ges_asset_set_proxy(self.to_glib_none().0, proxy.0)) + from_glib(ffi::ges_asset_set_proxy(self.as_ref().to_glib_none().0, proxy.map(|p| p.as_ref()).to_glib_none().0)) } } fn unproxy>(&self, proxy: &P) -> bool { unsafe { - from_glib(ffi::ges_asset_unproxy(self.to_glib_none().0, proxy.to_glib_none().0)) + from_glib(ffi::ges_asset_unproxy(self.as_ref().to_glib_none().0, proxy.as_ref().to_glib_none().0)) } } @@ -186,7 +185,7 @@ impl> AssetExt for O { fn connect_property_proxy_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::proxy\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::proxy\0".as_ptr() as *const _, transmute(notify_proxy_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -194,7 +193,7 @@ impl> AssetExt for O { fn connect_property_proxy_target_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::proxy-target\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::proxy-target\0".as_ptr() as *const _, transmute(notify_proxy_target_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -203,11 +202,11 @@ impl> AssetExt for O { unsafe extern "C" fn notify_proxy_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Asset::from_glib_borrow(this).downcast_unchecked()) + f(&Asset::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_proxy_target_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Asset::from_glib_borrow(this).downcast_unchecked()) + f(&Asset::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/base_effect.rs b/gstreamer-editing-services/src/auto/base_effect.rs index cc62805ad..faeb2bffb 100644 --- a/gstreamer-editing-services/src/auto/base_effect.rs +++ b/gstreamer-editing-services/src/auto/base_effect.rs @@ -9,7 +9,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct BaseEffect(Object): TrackElement, TimelineElement, Extractable; + pub struct BaseEffect(Object) @extends TrackElement, TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_base_effect_get_type(), @@ -17,3 +17,5 @@ glib_wrapper! { } impl BaseEffect {} + +pub const NONE_BASE_EFFECT: Option<&BaseEffect> = None; diff --git a/gstreamer-editing-services/src/auto/clip.rs b/gstreamer-editing-services/src/auto/clip.rs index 3cef9fd55..6423e8507 100644 --- a/gstreamer-editing-services/src/auto/clip.rs +++ b/gstreamer-editing-services/src/auto/clip.rs @@ -13,7 +13,7 @@ use TrackElement; use TrackType; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -23,13 +23,15 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Clip(Object): Container, TimelineElement, Extractable; + pub struct Clip(Object) @extends Container, TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_clip_get_type(), } } +pub const NONE_CLIP: Option<&Clip> = None; + pub trait ClipExt: 'static { fn add_asset>(&self, asset: &P) -> Option; @@ -47,7 +49,7 @@ pub trait ClipExt: 'static { fn get_top_effects(&self) -> Vec; - fn move_to_layer(&self, layer: &Layer) -> bool; + fn move_to_layer>(&self, layer: &P) -> bool; fn set_supported_formats(&self, supportedformats: TrackType); @@ -65,90 +67,88 @@ pub trait ClipExt: 'static { impl> ClipExt for O { fn add_asset>(&self, asset: &P) -> Option { unsafe { - from_glib_none(ffi::ges_clip_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) + from_glib_none(ffi::ges_clip_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0)) } } fn find_track_element<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, type_: glib::types::Type) -> Option { let track = track.into(); - let track = track.to_glib_none(); unsafe { - from_glib_full(ffi::ges_clip_find_track_element(self.to_glib_none().0, track.0, type_.to_glib())) + from_glib_full(ffi::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<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec { let track = track.into(); - let track = track.to_glib_none(); unsafe { - FromGlibPtrContainer::from_glib_full(ffi::ges_clip_find_track_elements(self.to_glib_none().0, track.0, track_type.to_glib(), type_.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::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(ffi::ges_clip_get_layer(self.to_glib_none().0)) + from_glib_full(ffi::ges_clip_get_layer(self.as_ref().to_glib_none().0)) } } fn get_supported_formats(&self) -> TrackType { unsafe { - from_glib(ffi::ges_clip_get_supported_formats(self.to_glib_none().0)) + from_glib(ffi::ges_clip_get_supported_formats(self.as_ref().to_glib_none().0)) } } fn get_top_effect_index>(&self, effect: &P) -> i32 { unsafe { - ffi::ges_clip_get_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0) + ffi::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 { - ffi::ges_clip_get_top_effect_position(self.to_glib_none().0, effect.to_glib_none().0) + ffi::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(ffi::ges_clip_get_top_effects(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::ges_clip_get_top_effects(self.as_ref().to_glib_none().0)) } } - fn move_to_layer(&self, layer: &Layer) -> bool { + fn move_to_layer>(&self, layer: &P) -> bool { unsafe { - from_glib(ffi::ges_clip_move_to_layer(self.to_glib_none().0, layer.to_glib_none().0)) + from_glib(ffi::ges_clip_move_to_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0)) } } fn set_supported_formats(&self, supportedformats: TrackType) { unsafe { - ffi::ges_clip_set_supported_formats(self.to_glib_none().0, supportedformats.to_glib()); + ffi::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) -> bool { unsafe { - from_glib(ffi::ges_clip_set_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0, newindex)) + from_glib(ffi::ges_clip_set_top_effect_index(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newindex)) } } fn set_top_effect_priority>(&self, effect: &P, newpriority: u32) -> bool { unsafe { - from_glib(ffi::ges_clip_set_top_effect_priority(self.to_glib_none().0, effect.to_glib_none().0, newpriority)) + from_glib(ffi::ges_clip_set_top_effect_priority(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newpriority)) } } fn split(&self, position: u64) -> Option { unsafe { - from_glib_none(ffi::ges_clip_split(self.to_glib_none().0, position)) + from_glib_none(ffi::ges_clip_split(self.as_ref().to_glib_none().0, position)) } } fn connect_property_layer_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::layer\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::layer\0".as_ptr() as *const _, transmute(notify_layer_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -156,7 +156,7 @@ impl> ClipExt for O { fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, transmute(notify_supported_formats_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -165,11 +165,11 @@ impl> ClipExt for O { unsafe extern "C" fn notify_layer_trampoline

(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Clip::from_glib_borrow(this).downcast_unchecked()) + f(&Clip::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_supported_formats_trampoline

(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Clip::from_glib_borrow(this).downcast_unchecked()) + f(&Clip::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/container.rs b/gstreamer-editing-services/src/auto/container.rs index 93fe6b139..33a0310af 100644 --- a/gstreamer-editing-services/src/auto/container.rs +++ b/gstreamer-editing-services/src/auto/container.rs @@ -11,7 +11,7 @@ use ffi; use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -22,7 +22,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Container(Object): TimelineElement, Extractable; + pub struct Container(Object) @extends TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_container_get_type(), @@ -38,6 +38,8 @@ impl Container { } } +pub const NONE_CONTAINER: Option<&Container> = None; + pub trait GESContainerExt: 'static { fn add>(&self, child: &P) -> Result<(), glib::error::BoolError>; @@ -61,31 +63,31 @@ pub trait GESContainerExt: 'static { impl> GESContainerExt for O { fn add>(&self, child: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::ges_container_add(self.to_glib_none().0, child.to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!(ffi::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> { unsafe { - glib_result_from_gboolean!(ffi::ges_container_edit(self.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!(ffi::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(ffi::ges_container_get_children(self.to_glib_none().0, recursive.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::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!(ffi::ges_container_remove(self.to_glib_none().0, child.to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!(ffi::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(ffi::ges_container_ungroup(self.to_glib_full(), recursive.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::ges_container_ungroup(self.as_ref().to_glib_full(), recursive.to_glib())) } } @@ -100,7 +102,7 @@ impl> GESContainerExt for O { fn connect_child_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"child-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"child-added\0".as_ptr() as *const _, transmute(child_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -108,7 +110,7 @@ impl> GESContainerExt for O { fn connect_child_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"child-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"child-removed\0".as_ptr() as *const _, transmute(child_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -116,7 +118,7 @@ impl> GESContainerExt for O { fn connect_property_height_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::height\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::height\0".as_ptr() as *const _, transmute(notify_height_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -125,17 +127,17 @@ impl> GESContainerExt for O { unsafe extern "C" fn child_added_trampoline

(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); - f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) + f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) } unsafe extern "C" fn child_removed_trampoline

(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); - f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) + f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) } unsafe extern "C" fn notify_height_trampoline

(this: *mut ffi::GESContainer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Container::from_glib_borrow(this).downcast_unchecked()) + f(&Container::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/effect.rs b/gstreamer-editing-services/src/auto/effect.rs index d98531bf8..38d58c6df 100644 --- a/gstreamer-editing-services/src/auto/effect.rs +++ b/gstreamer-editing-services/src/auto/effect.rs @@ -15,7 +15,7 @@ use glib::translate::*; use gobject_ffi; glib_wrapper! { - pub struct Effect(Object): BaseEffect, TrackElement, TimelineElement, Extractable; + pub struct Effect(Object) @extends BaseEffect, TrackElement, TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_effect_get_type(), @@ -31,6 +31,8 @@ impl Effect { } } +pub const NONE_EFFECT: Option<&Effect> = None; + pub trait EffectExt: 'static { fn get_property_bin_description(&self) -> Option; } diff --git a/gstreamer-editing-services/src/auto/extractable.rs b/gstreamer-editing-services/src/auto/extractable.rs index 73e77de79..243145c61 100644 --- a/gstreamer-editing-services/src/auto/extractable.rs +++ b/gstreamer-editing-services/src/auto/extractable.rs @@ -9,13 +9,15 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct Extractable(Object); + pub struct Extractable(Interface); match fn { get_type => || ffi::ges_extractable_get_type(), } } +pub const NONE_EXTRACTABLE: Option<&Extractable> = None; + pub trait ExtractableExt: 'static { fn get_asset(&self) -> Option; @@ -27,19 +29,19 @@ pub trait ExtractableExt: 'static { impl> ExtractableExt for O { fn get_asset(&self) -> Option { unsafe { - from_glib_none(ffi::ges_extractable_get_asset(self.to_glib_none().0)) + from_glib_none(ffi::ges_extractable_get_asset(self.as_ref().to_glib_none().0)) } } fn get_id(&self) -> Option { unsafe { - from_glib_full(ffi::ges_extractable_get_id(self.to_glib_none().0)) + from_glib_full(ffi::ges_extractable_get_id(self.as_ref().to_glib_none().0)) } } fn set_asset>(&self, asset: &P) -> bool { unsafe { - from_glib(ffi::ges_extractable_set_asset(self.to_glib_none().0, asset.to_glib_none().0)) + from_glib(ffi::ges_extractable_set_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0)) } } } diff --git a/gstreamer-editing-services/src/auto/group.rs b/gstreamer-editing-services/src/auto/group.rs index 114439d4d..7267d56db 100644 --- a/gstreamer-editing-services/src/auto/group.rs +++ b/gstreamer-editing-services/src/auto/group.rs @@ -8,7 +8,7 @@ use TimelineElement; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -19,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Group(Object): Container, TimelineElement, Extractable; + pub struct Group(Object) @extends Container, TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_group_get_type(), @@ -41,6 +41,8 @@ impl Default for Group { } } +pub const NONE_GROUP: Option<&Group> = None; + pub trait GroupExt: 'static { fn get_property_duration(&self) -> u64; @@ -147,7 +149,7 @@ impl> GroupExt for O { fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -155,7 +157,7 @@ impl> GroupExt for O { fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::in-point\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _, transmute(notify_in_point_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -163,7 +165,7 @@ impl> GroupExt for O { fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _, transmute(notify_max_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -171,7 +173,7 @@ impl> GroupExt for O { fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -179,7 +181,7 @@ impl> GroupExt for O { fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::start\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _, transmute(notify_start_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -188,29 +190,29 @@ impl> GroupExt for O { unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Group::from_glib_borrow(this).downcast_unchecked()) + f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_in_point_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Group::from_glib_borrow(this).downcast_unchecked()) + f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_max_duration_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Group::from_glib_borrow(this).downcast_unchecked()) + f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Group::from_glib_borrow(this).downcast_unchecked()) + f(&Group::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_start_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Group::from_glib_borrow(this).downcast_unchecked()) + f(&Group::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/layer.rs b/gstreamer-editing-services/src/auto/layer.rs index 1bf52332c..f256bd095 100644 --- a/gstreamer-editing-services/src/auto/layer.rs +++ b/gstreamer-editing-services/src/auto/layer.rs @@ -8,7 +8,7 @@ use Extractable; use Timeline; use TrackType; use ffi; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -19,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Layer(Object): Extractable; + pub struct Layer(Object) @implements Extractable; match fn { get_type => || ffi::ges_layer_get_type(), @@ -41,6 +41,8 @@ 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; @@ -67,7 +69,7 @@ pub trait LayerExt: 'static { #[cfg_attr(feature = "v1_16", deprecated)] fn set_priority(&self, priority: u32); - fn set_timeline(&self, timeline: &Timeline); + fn set_timeline>(&self, timeline: &P); fn connect_clip_added(&self, f: F) -> SignalHandlerId; @@ -82,86 +84,86 @@ pub trait LayerExt: 'static { impl> LayerExt for O { fn add_asset>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option { unsafe { - from_glib_none(ffi::ges_layer_add_asset(self.to_glib_none().0, asset.to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib())) + from_glib_none(ffi::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) -> bool { unsafe { - from_glib(ffi::ges_layer_add_clip(self.to_glib_none().0, clip.to_glib_none().0)) + from_glib(ffi::ges_layer_add_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0)) } } fn get_auto_transition(&self) -> bool { unsafe { - from_glib(ffi::ges_layer_get_auto_transition(self.to_glib_none().0)) + from_glib(ffi::ges_layer_get_auto_transition(self.as_ref().to_glib_none().0)) } } fn get_clips(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::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(ffi::ges_layer_get_clips_in_interval(self.to_glib_none().0, start.to_glib(), end.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::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(ffi::ges_layer_get_duration(self.to_glib_none().0)) + from_glib(ffi::ges_layer_get_duration(self.as_ref().to_glib_none().0)) } } fn get_priority(&self) -> u32 { unsafe { - ffi::ges_layer_get_priority(self.to_glib_none().0) + ffi::ges_layer_get_priority(self.as_ref().to_glib_none().0) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_none(ffi::ges_layer_get_timeline(self.to_glib_none().0)) + from_glib_none(ffi::ges_layer_get_timeline(self.as_ref().to_glib_none().0)) } } fn is_empty(&self) -> bool { unsafe { - from_glib(ffi::ges_layer_is_empty(self.to_glib_none().0)) + from_glib(ffi::ges_layer_is_empty(self.as_ref().to_glib_none().0)) } } fn remove_clip>(&self, clip: &P) -> bool { unsafe { - from_glib(ffi::ges_layer_remove_clip(self.to_glib_none().0, clip.to_glib_none().0)) + from_glib(ffi::ges_layer_remove_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0)) } } fn set_auto_transition(&self, auto_transition: bool) { unsafe { - ffi::ges_layer_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); + ffi::ges_layer_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib()); } } fn set_priority(&self, priority: u32) { unsafe { - ffi::ges_layer_set_priority(self.to_glib_none().0, priority); + ffi::ges_layer_set_priority(self.as_ref().to_glib_none().0, priority); } } - fn set_timeline(&self, timeline: &Timeline) { + fn set_timeline>(&self, timeline: &P) { unsafe { - ffi::ges_layer_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"clip-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"clip-added\0".as_ptr() as *const _, transmute(clip_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -169,7 +171,7 @@ impl> LayerExt for O { fn connect_clip_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"clip-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"clip-removed\0".as_ptr() as *const _, transmute(clip_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -177,7 +179,7 @@ impl> LayerExt for O { fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, transmute(notify_auto_transition_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -185,7 +187,7 @@ impl> LayerExt for O { fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -194,23 +196,23 @@ impl> LayerExt for O { unsafe extern "C" fn clip_added_trampoline

(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); - f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) + f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip)) } unsafe extern "C" fn clip_removed_trampoline

(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); - f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) + f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip)) } unsafe extern "C" fn notify_auto_transition_trampoline

(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Layer::from_glib_borrow(this).downcast_unchecked()) + f(&Layer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Layer::from_glib_borrow(this).downcast_unchecked()) + f(&Layer::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/mod.rs b/gstreamer-editing-services/src/auto/mod.rs index c35a7626e..37128b2cd 100644 --- a/gstreamer-editing-services/src/auto/mod.rs +++ b/gstreamer-editing-services/src/auto/mod.rs @@ -3,70 +3,70 @@ // DO NOT EDIT mod asset; -pub use self::asset::Asset; +pub use self::asset::{Asset, AssetClass, NONE_ASSET}; pub use self::asset::AssetExt; mod base_effect; -pub use self::base_effect::BaseEffect; +pub use self::base_effect::{BaseEffect, BaseEffectClass, NONE_BASE_EFFECT}; mod clip; -pub use self::clip::Clip; +pub use self::clip::{Clip, ClipClass, NONE_CLIP}; pub use self::clip::ClipExt; mod container; -pub use self::container::Container; +pub use self::container::{Container, ContainerClass, NONE_CONTAINER}; pub use self::container::GESContainerExt; mod effect; -pub use self::effect::Effect; +pub use self::effect::{Effect, EffectClass, NONE_EFFECT}; pub use self::effect::EffectExt; mod extractable; -pub use self::extractable::Extractable; +pub use self::extractable::{Extractable, NONE_EXTRACTABLE}; pub use self::extractable::ExtractableExt; mod group; -pub use self::group::Group; +pub use self::group::{Group, GroupClass, NONE_GROUP}; pub use self::group::GroupExt; mod layer; -pub use self::layer::Layer; +pub use self::layer::{Layer, LayerClass, NONE_LAYER}; pub use self::layer::LayerExt; mod pipeline; -pub use self::pipeline::Pipeline; +pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; pub use self::pipeline::GESPipelineExt; mod project; -pub use self::project::Project; +pub use self::project::{Project, ProjectClass, NONE_PROJECT}; pub use self::project::ProjectExt; mod timeline; -pub use self::timeline::Timeline; +pub use self::timeline::{Timeline, TimelineClass, NONE_TIMELINE}; pub use self::timeline::TimelineExt; mod timeline_element; -pub use self::timeline_element::TimelineElement; +pub use self::timeline_element::{TimelineElement, TimelineElementClass, NONE_TIMELINE_ELEMENT}; pub use self::timeline_element::TimelineElementExt; mod track; -pub use self::track::Track; +pub use self::track::{Track, TrackClass, NONE_TRACK}; pub use self::track::GESTrackExt; mod track_element; -pub use self::track_element::TrackElement; +pub use self::track_element::{TrackElement, TrackElementClass, NONE_TRACK_ELEMENT}; pub use self::track_element::TrackElementExt; mod uri_clip; -pub use self::uri_clip::UriClip; +pub use self::uri_clip::{UriClip, UriClipClass, NONE_URI_CLIP}; pub use self::uri_clip::UriClipExt; mod uri_clip_asset; -pub use self::uri_clip_asset::UriClipAsset; +pub use self::uri_clip_asset::{UriClipAsset, UriClipAssetClass, NONE_URI_CLIP_ASSET}; pub use self::uri_clip_asset::UriClipAssetExt; mod uri_source_asset; -pub use self::uri_source_asset::UriSourceAsset; +pub use self::uri_source_asset::{UriSourceAsset, UriSourceAssetClass, NONE_URI_SOURCE_ASSET}; pub use self::uri_source_asset::UriSourceAssetExt; mod enums; diff --git a/gstreamer-editing-services/src/auto/pipeline.rs b/gstreamer-editing-services/src/auto/pipeline.rs index ae3422e2c..75feef662 100644 --- a/gstreamer-editing-services/src/auto/pipeline.rs +++ b/gstreamer-editing-services/src/auto/pipeline.rs @@ -9,7 +9,7 @@ use ffi; use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -17,18 +17,13 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use gst_pbutils; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Pipeline(Object): [ - gst::Pipeline => gst_ffi::GstPipeline, - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct Pipeline(Object) @extends gst::Pipeline, gst::Element, gst::Object; match fn { get_type => || ffi::ges_pipeline_get_type(), @@ -50,6 +45,8 @@ impl Default for Pipeline { } } +pub const NONE_PIPELINE: Option<&Pipeline> = None; + pub trait GESPipelineExt: 'static { fn get_mode(&self) -> PipelineFlags; @@ -71,7 +68,7 @@ pub trait GESPipelineExt: 'static { fn set_render_settings>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>; - fn set_timeline(&self, timeline: &Timeline) -> bool; + fn set_timeline>(&self, timeline: &P) -> bool; fn get_property_audio_filter(&self) -> Option; @@ -107,69 +104,69 @@ pub trait GESPipelineExt: 'static { impl> GESPipelineExt for O { fn get_mode(&self) -> PipelineFlags { unsafe { - from_glib(ffi::ges_pipeline_get_mode(self.to_glib_none().0)) + from_glib(ffi::ges_pipeline_get_mode(self.as_ref().to_glib_none().0)) } } fn get_thumbnail(&self, caps: &gst::Caps) -> Option { unsafe { - from_glib_full(ffi::ges_pipeline_get_thumbnail(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib_full(ffi::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(ffi::ges_pipeline_get_thumbnail_rgb24(self.to_glib_none().0, width, height)) + from_glib_full(ffi::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(ffi::ges_pipeline_preview_get_audio_sink(self.to_glib_none().0)) + from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(self.as_ref().to_glib_none().0)) } } fn preview_get_video_sink(&self) -> Option { unsafe { - from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.to_glib_none().0)) + from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.as_ref().to_glib_none().0)) } } fn preview_set_audio_sink>(&self, sink: &P) { unsafe { - ffi::ges_pipeline_preview_set_audio_sink(self.to_glib_none().0, sink.to_glib_none().0); + ffi::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 { - ffi::ges_pipeline_preview_set_video_sink(self.to_glib_none().0, sink.to_glib_none().0); + ffi::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> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ges_pipeline_save_thumbnail(self.to_glib_none().0, width, height, format.to_glib_none().0, location.to_glib_none().0, &mut error); + let _ = ffi::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!(ffi::ges_pipeline_set_mode(self.to_glib_none().0, mode.to_glib()), "Failed to set mode") + glib_result_from_gboolean!(ffi::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> { unsafe { - glib_result_from_gboolean!(ffi::ges_pipeline_set_render_settings(self.to_glib_none().0, output_uri.to_glib_none().0, profile.to_glib_none().0), "Failed to set render settings") + glib_result_from_gboolean!(ffi::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: &Timeline) -> bool { + fn set_timeline>(&self, timeline: &P) -> bool { unsafe { - from_glib(ffi::ges_pipeline_set_timeline(self.to_glib_none().0, timeline.to_glib_full())) + from_glib(ffi::ges_pipeline_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_full())) } } @@ -240,7 +237,7 @@ impl> GESPipelineExt for O { fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::audio-filter\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::audio-filter\0".as_ptr() as *const _, transmute(notify_audio_filter_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -248,7 +245,7 @@ impl> GESPipelineExt for O { fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::audio-sink\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::audio-sink\0".as_ptr() as *const _, transmute(notify_audio_sink_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -256,7 +253,7 @@ impl> GESPipelineExt for O { fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mode\0".as_ptr() as *const _, transmute(notify_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -264,7 +261,7 @@ impl> GESPipelineExt for O { fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeline\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _, transmute(notify_timeline_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -272,7 +269,7 @@ impl> GESPipelineExt for O { fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::video-filter\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::video-filter\0".as_ptr() as *const _, transmute(notify_video_filter_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -280,7 +277,7 @@ impl> GESPipelineExt for O { fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::video-sink\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _, transmute(notify_video_sink_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -289,35 +286,35 @@ impl> GESPipelineExt for O { unsafe extern "C" fn notify_audio_filter_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_audio_sink_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mode_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_timeline_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_video_filter_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_video_sink_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/project.rs b/gstreamer-editing-services/src/auto/project.rs index be69394c6..794c53fa6 100644 --- a/gstreamer-editing-services/src/auto/project.rs +++ b/gstreamer-editing-services/src/auto/project.rs @@ -8,7 +8,7 @@ use Timeline; use ffi; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -21,7 +21,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Project(Object): Asset; + pub struct Project(Object) @extends Asset; match fn { get_type => || ffi::ges_project_get_type(), @@ -32,13 +32,14 @@ impl Project { pub fn new<'a, P: Into>>(uri: P) -> Project { assert_initialized_main_thread!(); let uri = uri.into(); - let uri = uri.to_glib_none(); unsafe { - from_glib_full(ffi::ges_project_new(uri.0)) + from_glib_full(ffi::ges_project_new(uri.to_glib_none().0)) } } } +pub const NONE_PROJECT: Option<&Project> = None; + pub trait ProjectExt: 'static { fn add_asset>(&self, asset: &P) -> bool; @@ -58,11 +59,11 @@ pub trait ProjectExt: 'static { fn list_encoding_profiles(&self) -> Vec; - fn load(&self, timeline: &Timeline) -> Result<(), Error>; + fn load>(&self, timeline: &P) -> Result<(), Error>; fn remove_asset>(&self, asset: &P) -> bool; - fn save<'a, P: IsA + 'a, Q: Into>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error>; + fn save<'a, P: IsA, Q: IsA + 'a, R: Into>>(&self, timeline: &P, uri: &str, formatter_asset: R, overwrite: bool) -> Result<(), Error>; fn connect_asset_added(&self, f: F) -> SignalHandlerId; @@ -80,84 +81,81 @@ pub trait ProjectExt: 'static { impl> ProjectExt for O { fn add_asset>(&self, asset: &P) -> bool { unsafe { - from_glib(ffi::ges_project_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) + from_glib(ffi::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) -> bool { unsafe { - from_glib(ffi::ges_project_add_encoding_profile(self.to_glib_none().0, profile.to_glib_none().0)) + from_glib(ffi::ges_project_add_encoding_profile(self.as_ref().to_glib_none().0, profile.as_ref().to_glib_none().0)) } } fn create_asset<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> bool { let id = id.into(); - let id = id.to_glib_none(); unsafe { - from_glib(ffi::ges_project_create_asset(self.to_glib_none().0, id.0, extractable_type.to_glib())) + from_glib(ffi::ges_project_create_asset(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) } } fn create_asset_sync<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> Result, Error> { let id = id.into(); - let id = id.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ges_project_create_asset_sync(self.to_glib_none().0, id.0, extractable_type.to_glib(), &mut error); + let ret = ffi::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(ffi::ges_project_get_asset(self.to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) + from_glib_full(ffi::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(ffi::ges_project_get_loading_assets(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::ges_project_get_loading_assets(self.as_ref().to_glib_none().0)) } } fn get_uri(&self) -> Option { unsafe { - from_glib_full(ffi::ges_project_get_uri(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::ges_project_list_assets(self.to_glib_none().0, filter.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::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(ffi::ges_project_list_encoding_profiles(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ges_project_list_encoding_profiles(self.as_ref().to_glib_none().0)) } } - fn load(&self, timeline: &Timeline) -> Result<(), Error> { + fn load>(&self, timeline: &P) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ges_project_load(self.to_glib_none().0, timeline.to_glib_none().0, &mut error); + let _ = ffi::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) -> bool { unsafe { - from_glib(ffi::ges_project_remove_asset(self.to_glib_none().0, asset.to_glib_none().0)) + from_glib(ffi::ges_project_remove_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0)) } } - fn save<'a, P: IsA + 'a, Q: Into>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { + fn save<'a, P: IsA, Q: IsA + 'a, R: Into>>(&self, timeline: &P, uri: &str, formatter_asset: R, overwrite: bool) -> Result<(), Error> { let formatter_asset = formatter_asset.into(); - let formatter_asset = formatter_asset.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ges_project_save(self.to_glib_none().0, timeline.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); + let _ = ffi::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)) } } } @@ -165,7 +163,7 @@ impl> ProjectExt for O { fn connect_asset_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"asset-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"asset-added\0".as_ptr() as *const _, transmute(asset_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -173,7 +171,7 @@ impl> ProjectExt for O { fn connect_asset_loading(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"asset-loading\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"asset-loading\0".as_ptr() as *const _, transmute(asset_loading_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -181,7 +179,7 @@ impl> ProjectExt for O { fn connect_asset_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"asset-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"asset-removed\0".as_ptr() as *const _, transmute(asset_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -189,7 +187,7 @@ impl> ProjectExt for O { fn connect_error_loading_asset(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"error-loading-asset\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"error-loading-asset\0".as_ptr() as *const _, transmute(error_loading_asset_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -197,7 +195,7 @@ impl> ProjectExt for O { fn connect_loaded(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"loaded\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"loaded\0".as_ptr() as *const _, transmute(loaded_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -205,7 +203,7 @@ impl> ProjectExt for O { fn connect_missing_uri Option + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ Option + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"missing-uri\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"missing-uri\0".as_ptr() as *const _, transmute(missing_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -214,35 +212,35 @@ impl> ProjectExt for O { unsafe extern "C" fn asset_added_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) + f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) } unsafe extern "C" fn asset_loading_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) + f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) } unsafe extern "C" fn asset_removed_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) + f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset)) } unsafe extern "C" fn error_loading_asset_trampoline

(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, id: *mut libc::c_char, extractable_type: glib_ffi::GType, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Error, &str, glib::types::Type) + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &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 extern "C" fn loaded_trampoline

(this: *mut ffi::GESProject, timeline: *mut ffi::GESTimeline, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Timeline) + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(timeline)) + f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(timeline)) } unsafe extern "C" fn missing_uri_trampoline

(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, wrong_asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) -> *mut libc::c_char where P: IsA { let f: &&(Fn(&P, &Error, &Asset) -> Option + 'static) = transmute(f); - f(&Project::from_glib_borrow(this).downcast_unchecked(), &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() } diff --git a/gstreamer-editing-services/src/auto/timeline.rs b/gstreamer-editing-services/src/auto/timeline.rs index 559116564..a1dfda0e6 100644 --- a/gstreamer-editing-services/src/auto/timeline.rs +++ b/gstreamer-editing-services/src/auto/timeline.rs @@ -12,24 +12,19 @@ use Track; use TrackElement; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Timeline(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - Extractable, - ]; + pub struct Timeline(Object) @extends gst::Element, gst::Object, @implements Extractable; match fn { get_type => || ffi::ges_timeline_get_type(), @@ -67,8 +62,10 @@ impl Default for Timeline { } } +pub const NONE_TIMELINE: Option<&Timeline> = None; + pub trait TimelineExt: 'static { - fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; + fn add_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError>; fn add_track>(&self, track: &P) -> Result<(), glib::error::BoolError>; @@ -102,11 +99,11 @@ pub trait TimelineExt: 'static { fn load_from_uri(&self, uri: &str) -> Result<(), Error>; - fn move_layer(&self, layer: &Layer, 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 remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; + fn remove_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError>; fn remove_track>(&self, track: &P) -> bool; @@ -144,160 +141,159 @@ pub trait TimelineExt: 'static { } impl> TimelineExt for O { - fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> { + fn add_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::ges_timeline_add_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to add layer") + glib_result_from_gboolean!(ffi::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!(ffi::ges_timeline_add_track(self.to_glib_none().0, track.to_glib_full()), "Failed to add track") + glib_result_from_gboolean!(ffi::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(ffi::ges_timeline_append_layer(self.to_glib_none().0)) + from_glib_none(ffi::ges_timeline_append_layer(self.as_ref().to_glib_none().0)) } } fn commit(&self) -> bool { unsafe { - from_glib(ffi::ges_timeline_commit(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_commit(self.as_ref().to_glib_none().0)) } } fn commit_sync(&self) -> bool { unsafe { - from_glib(ffi::ges_timeline_commit_sync(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_commit_sync(self.as_ref().to_glib_none().0)) } } fn get_auto_transition(&self) -> bool { unsafe { - from_glib(ffi::ges_timeline_get_auto_transition(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_get_auto_transition(self.as_ref().to_glib_none().0)) } } fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_get_duration(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_get_duration(self.as_ref().to_glib_none().0)) } } fn get_element(&self, name: &str) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_get_element(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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(ffi::ges_timeline_get_groups(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(self.as_ref().to_glib_none().0)) } } fn get_layer(&self, priority: u32) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_get_layer(self.to_glib_none().0, priority)) + from_glib_full(ffi::ges_timeline_get_layer(self.as_ref().to_glib_none().0, priority)) } } fn get_layers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.as_ref().to_glib_none().0)) } } fn get_pad_for_track>(&self, track: &P) -> Option { unsafe { - from_glib_none(ffi::ges_timeline_get_pad_for_track(self.to_glib_none().0, track.to_glib_none().0)) + from_glib_none(ffi::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(ffi::ges_timeline_get_snapping_distance(self.to_glib_none().0)) + from_glib(ffi::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(ffi::ges_timeline_get_track_for_pad(self.to_glib_none().0, pad.to_glib_none().0)) + from_glib_none(ffi::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(ffi::ges_timeline_get_tracks(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(self.as_ref().to_glib_none().0)) } } fn is_empty(&self) -> bool { unsafe { - from_glib(ffi::ges_timeline_is_empty(self.to_glib_none().0)) + from_glib(ffi::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 _ = ffi::ges_timeline_load_from_uri(self.to_glib_none().0, uri.to_glib_none().0, &mut error); + let _ = ffi::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: &Layer, 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!(ffi::ges_timeline_move_layer(self.to_glib_none().0, layer.to_glib_none().0, new_layer_priority), "Failed to move layer") + glib_result_from_gboolean!(ffi::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 { unsafe { - from_glib_none(ffi::ges_timeline_paste_element(self.to_glib_none().0, element.to_glib_none().0, position.to_glib(), layer_priority)) + from_glib_none(ffi::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: &Layer) -> Result<(), glib::error::BoolError> { + fn remove_layer>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::ges_timeline_remove_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to remove layer") + glib_result_from_gboolean!(ffi::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) -> bool { unsafe { - from_glib(ffi::ges_timeline_remove_track(self.to_glib_none().0, track.to_glib_none().0)) + from_glib(ffi::ges_timeline_remove_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_none().0)) } } fn save_to_uri<'a, P: IsA + 'a, Q: Into>>(&self, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { let formatter_asset = formatter_asset.into(); - let formatter_asset = formatter_asset.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ges_timeline_save_to_uri(self.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); + let _ = ffi::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 { - ffi::ges_timeline_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); + ffi::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 { - ffi::ges_timeline_set_snapping_distance(self.to_glib_none().0, snapping_distance.to_glib()); + ffi::ges_timeline_set_snapping_distance(self.as_ref().to_glib_none().0, snapping_distance.to_glib()); } } fn connect_commited(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"commited\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _, transmute(commited_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -305,7 +301,7 @@ impl> TimelineExt for O { fn connect_group_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"group-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"group-added\0".as_ptr() as *const _, transmute(group_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -317,7 +313,7 @@ impl> TimelineExt for O { fn connect_layer_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"layer-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"layer-added\0".as_ptr() as *const _, transmute(layer_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -325,7 +321,7 @@ impl> TimelineExt for O { fn connect_layer_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"layer-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"layer-removed\0".as_ptr() as *const _, transmute(layer_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -337,7 +333,7 @@ impl> TimelineExt for O { fn connect_snapping_ended(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"snapping-ended\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"snapping-ended\0".as_ptr() as *const _, transmute(snapping_ended_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -345,7 +341,7 @@ impl> TimelineExt for O { fn connect_snapping_started(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"snapping-started\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"snapping-started\0".as_ptr() as *const _, transmute(snapping_started_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -353,7 +349,7 @@ impl> TimelineExt for O { fn connect_track_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"track-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"track-added\0".as_ptr() as *const _, transmute(track_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -361,7 +357,7 @@ impl> TimelineExt for O { fn connect_track_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"track-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"track-removed\0".as_ptr() as *const _, transmute(track_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -369,7 +365,7 @@ impl> TimelineExt for O { fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, transmute(notify_auto_transition_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -377,7 +373,7 @@ impl> TimelineExt for O { fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -385,7 +381,7 @@ impl> TimelineExt for O { fn connect_property_snapping_distance_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::snapping-distance\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::snapping-distance\0".as_ptr() as *const _, transmute(notify_snapping_distance_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -394,65 +390,65 @@ impl> TimelineExt for O { unsafe extern "C" fn commited_trampoline

(this: *mut ffi::GESTimeline, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked()) + f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn group_added_trampoline

(this: *mut ffi::GESTimeline, group: *mut ffi::GESGroup, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Group) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(group)) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(group)) } unsafe extern "C" fn layer_added_trampoline

(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer)) } unsafe extern "C" fn layer_removed_trampoline

(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer)) } unsafe extern "C" fn snapping_ended_trampoline

(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) } unsafe extern "C" fn snapping_started_trampoline

(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) } unsafe extern "C" fn track_added_trampoline

(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Track) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track)) } unsafe extern "C" fn track_removed_trampoline

(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Track) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) + f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track)) } unsafe extern "C" fn notify_auto_transition_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked()) + f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked()) + f(&Timeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_snapping_distance_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Timeline::from_glib_borrow(this).downcast_unchecked()) + f(&Timeline::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/timeline_element.rs b/gstreamer-editing-services/src/auto/timeline_element.rs index 7adff1526..96a72f77c 100644 --- a/gstreamer-editing-services/src/auto/timeline_element.rs +++ b/gstreamer-editing-services/src/auto/timeline_element.rs @@ -9,7 +9,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -21,13 +21,15 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct TimelineElement(Object): Extractable; + pub struct TimelineElement(Object) @implements Extractable; match fn { get_type => || ffi::ges_timeline_element_get_type(), } } +pub const NONE_TIMELINE_ELEMENT: Option<&TimelineElement> = None; + pub trait TimelineElementExt: 'static { //fn add_child_property, Q: IsA>(&self, pspec: &P, child: &Q) -> bool; @@ -99,7 +101,7 @@ pub trait TimelineElementExt: 'static { fn set_start(&self, start: gst::ClockTime); - fn set_timeline(&self, timeline: &Timeline) -> bool; + fn set_timeline>(&self, timeline: &P) -> bool; fn trim(&self, start: gst::ClockTime) -> bool; @@ -139,7 +141,7 @@ impl> TimelineElementExt for O { fn copy(&self, deep: bool) -> Option { unsafe { - from_glib_none(ffi::ges_timeline_element_copy(self.to_glib_none().0, deep.to_glib())) + from_glib_none(ffi::ges_timeline_element_copy(self.as_ref().to_glib_none().0, deep.to_glib())) } } @@ -161,61 +163,61 @@ impl> TimelineElementExt for O { fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_element_get_duration(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_get_duration(self.as_ref().to_glib_none().0)) } } fn get_inpoint(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_element_get_inpoint(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_get_inpoint(self.as_ref().to_glib_none().0)) } } fn get_max_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_element_get_max_duration(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_get_max_duration(self.as_ref().to_glib_none().0)) } } fn get_name(&self) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_element_get_name(self.to_glib_none().0)) + from_glib_full(ffi::ges_timeline_element_get_name(self.as_ref().to_glib_none().0)) } } fn get_parent(&self) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_element_get_parent(self.to_glib_none().0)) + from_glib_full(ffi::ges_timeline_element_get_parent(self.as_ref().to_glib_none().0)) } } fn get_priority(&self) -> u32 { unsafe { - ffi::ges_timeline_element_get_priority(self.to_glib_none().0) + ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) } } fn get_start(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_element_get_start(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_get_start(self.as_ref().to_glib_none().0)) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_element_get_timeline(self.to_glib_none().0)) + from_glib_full(ffi::ges_timeline_element_get_timeline(self.as_ref().to_glib_none().0)) } } fn get_toplevel_parent(&self) -> Option { unsafe { - from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(self.to_glib_none().0)) + from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(self.as_ref().to_glib_none().0)) } } fn get_track_types(&self) -> TrackType { unsafe { - from_glib(ffi::ges_timeline_element_get_track_types(self.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_get_track_types(self.as_ref().to_glib_none().0)) } } @@ -229,7 +231,7 @@ impl> TimelineElementExt for O { fn paste(&self, paste_position: gst::ClockTime) -> Option { unsafe { - from_glib_none(ffi::ges_timeline_element_paste(self.to_glib_none().0, paste_position.to_glib())) + from_glib_none(ffi::ges_timeline_element_paste(self.as_ref().to_glib_none().0, paste_position.to_glib())) } } @@ -239,25 +241,25 @@ impl> TimelineElementExt for O { fn ripple(&self, start: gst::ClockTime) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_ripple(self.to_glib_none().0, start.to_glib())) + from_glib(ffi::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.to_glib())) } } fn ripple_end(&self, end: gst::ClockTime) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_ripple_end(self.to_glib_none().0, end.to_glib())) + from_glib(ffi::ges_timeline_element_ripple_end(self.as_ref().to_glib_none().0, end.to_glib())) } } fn roll_end(&self, end: gst::ClockTime) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_roll_end(self.to_glib_none().0, end.to_glib())) + from_glib(ffi::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.to_glib())) } } fn roll_start(&self, start: gst::ClockTime) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_roll_start(self.to_glib_none().0, start.to_glib())) + from_glib(ffi::ges_timeline_element_roll_start(self.as_ref().to_glib_none().0, start.to_glib())) } } @@ -279,57 +281,56 @@ impl> TimelineElementExt for O { fn set_duration(&self, duration: gst::ClockTime) { unsafe { - ffi::ges_timeline_element_set_duration(self.to_glib_none().0, duration.to_glib()); + ffi::ges_timeline_element_set_duration(self.as_ref().to_glib_none().0, duration.to_glib()); } } fn set_inpoint(&self, inpoint: gst::ClockTime) { unsafe { - ffi::ges_timeline_element_set_inpoint(self.to_glib_none().0, inpoint.to_glib()); + ffi::ges_timeline_element_set_inpoint(self.as_ref().to_glib_none().0, inpoint.to_glib()); } } fn set_max_duration(&self, maxduration: gst::ClockTime) { unsafe { - ffi::ges_timeline_element_set_max_duration(self.to_glib_none().0, maxduration.to_glib()); + ffi::ges_timeline_element_set_max_duration(self.as_ref().to_glib_none().0, maxduration.to_glib()); } } fn set_name<'a, P: Into>>(&self, name: P) -> bool { let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib(ffi::ges_timeline_element_set_name(self.to_glib_none().0, name.0)) + from_glib(ffi::ges_timeline_element_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0)) } } fn set_parent>(&self, parent: &P) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_set_parent(self.to_glib_none().0, parent.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_set_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0)) } } fn set_priority(&self, priority: u32) { unsafe { - ffi::ges_timeline_element_set_priority(self.to_glib_none().0, priority); + ffi::ges_timeline_element_set_priority(self.as_ref().to_glib_none().0, priority); } } fn set_start(&self, start: gst::ClockTime) { unsafe { - ffi::ges_timeline_element_set_start(self.to_glib_none().0, start.to_glib()); + ffi::ges_timeline_element_set_start(self.as_ref().to_glib_none().0, start.to_glib()); } } - fn set_timeline(&self, timeline: &Timeline) -> bool { + fn set_timeline>(&self, timeline: &P) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0)) + from_glib(ffi::ges_timeline_element_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0)) } } fn trim(&self, start: gst::ClockTime) -> bool { unsafe { - from_glib(ffi::ges_timeline_element_trim(self.to_glib_none().0, start.to_glib())) + from_glib(ffi::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.to_glib())) } } @@ -368,7 +369,7 @@ impl> TimelineElementExt for O { fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -376,7 +377,7 @@ impl> TimelineElementExt for O { fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::in-point\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _, transmute(notify_in_point_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -384,7 +385,7 @@ impl> TimelineElementExt for O { fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _, transmute(notify_max_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -392,7 +393,7 @@ impl> TimelineElementExt for O { fn connect_property_name_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::name\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, transmute(notify_name_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -400,7 +401,7 @@ impl> TimelineElementExt for O { fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::parent\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::parent\0".as_ptr() as *const _, transmute(notify_parent_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -408,7 +409,7 @@ impl> TimelineElementExt for O { fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -416,7 +417,7 @@ impl> TimelineElementExt for O { fn connect_property_serialize_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::serialize\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::serialize\0".as_ptr() as *const _, transmute(notify_serialize_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -424,7 +425,7 @@ impl> TimelineElementExt for O { fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::start\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _, transmute(notify_start_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -432,7 +433,7 @@ impl> TimelineElementExt for O { fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeline\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _, transmute(notify_timeline_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -441,53 +442,53 @@ impl> TimelineElementExt for O { unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_in_point_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_max_duration_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_name_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_parent_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_serialize_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_start_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_timeline_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) + f(&TimelineElement::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/track.rs b/gstreamer-editing-services/src/auto/track.rs index 274e379b5..01894523b 100644 --- a/gstreamer-editing-services/src/auto/track.rs +++ b/gstreamer-editing-services/src/auto/track.rs @@ -9,7 +9,7 @@ use ffi; use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -17,15 +17,11 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Track(Object): [ - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct Track(Object) @extends gst::Element, gst::Object; match fn { get_type => || ffi::ges_track_get_type(), @@ -41,6 +37,8 @@ impl Track { } } +pub const NONE_TRACK: Option<&Track> = None; + pub trait GESTrackExt: 'static { fn add_element>(&self, object: &P) -> Result<(), glib::error::BoolError>; @@ -62,7 +60,7 @@ pub trait GESTrackExt: 'static { fn set_restriction_caps(&self, caps: &gst::Caps); - fn set_timeline(&self, timeline: &Timeline); + fn set_timeline>(&self, timeline: &P); fn update_restriction_caps(&self, caps: &gst::Caps); @@ -88,43 +86,43 @@ pub trait GESTrackExt: 'static { impl> GESTrackExt for O { fn add_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::ges_track_add_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!(ffi::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(ffi::ges_track_commit(self.to_glib_none().0)) + from_glib(ffi::ges_track_commit(self.as_ref().to_glib_none().0)) } } fn get_caps(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_get_caps(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_get_caps(self.as_ref().to_glib_none().0)) } } fn get_elements(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(self.as_ref().to_glib_none().0)) } } fn get_mixing(&self) -> bool { unsafe { - from_glib(ffi::ges_track_get_mixing(self.to_glib_none().0)) + from_glib(ffi::ges_track_get_mixing(self.as_ref().to_glib_none().0)) } } fn get_timeline(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_get_timeline(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_get_timeline(self.as_ref().to_glib_none().0)) } } fn remove_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::ges_track_remove_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!(ffi::ges_track_remove_element(self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0), "Failed to remove element") } } @@ -134,25 +132,25 @@ impl> GESTrackExt for O { fn set_mixing(&self, mixing: bool) { unsafe { - ffi::ges_track_set_mixing(self.to_glib_none().0, mixing.to_glib()); + ffi::ges_track_set_mixing(self.as_ref().to_glib_none().0, mixing.to_glib()); } } fn set_restriction_caps(&self, caps: &gst::Caps) { unsafe { - ffi::ges_track_set_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); + ffi::ges_track_set_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); } } - fn set_timeline(&self, timeline: &Timeline) { + fn set_timeline>(&self, timeline: &P) { unsafe { - ffi::ges_track_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); + ffi::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 { - ffi::ges_track_update_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); + ffi::ges_track_update_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); } } @@ -183,7 +181,7 @@ impl> GESTrackExt for O { fn connect_commited(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"commited\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _, transmute(commited_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -191,7 +189,7 @@ impl> GESTrackExt for O { fn connect_track_element_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"track-element-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"track-element-added\0".as_ptr() as *const _, transmute(track_element_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -199,7 +197,7 @@ impl> GESTrackExt for O { fn connect_track_element_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"track-element-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"track-element-removed\0".as_ptr() as *const _, transmute(track_element_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -207,7 +205,7 @@ impl> GESTrackExt for O { fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -215,7 +213,7 @@ impl> GESTrackExt for O { fn connect_property_mixing_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mixing\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mixing\0".as_ptr() as *const _, transmute(notify_mixing_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -223,7 +221,7 @@ impl> GESTrackExt for O { fn connect_property_restriction_caps_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::restriction-caps\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::restriction-caps\0".as_ptr() as *const _, transmute(notify_restriction_caps_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -232,35 +230,35 @@ impl> GESTrackExt for O { unsafe extern "C" fn commited_trampoline

(this: *mut ffi::GESTrack, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked()) + f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn track_element_added_trampoline

(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) + f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect)) } unsafe extern "C" fn track_element_removed_trampoline

(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) + f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect)) } unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked()) + f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mixing_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked()) + f(&Track::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_restriction_caps_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Track::from_glib_borrow(this).downcast_unchecked()) + f(&Track::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/track_element.rs b/gstreamer-editing-services/src/auto/track_element.rs index ac8051ddf..14ca637e7 100644 --- a/gstreamer-editing-services/src/auto/track_element.rs +++ b/gstreamer-editing-services/src/auto/track_element.rs @@ -13,7 +13,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -25,13 +25,15 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct TrackElement(Object): TimelineElement, Extractable; + pub struct TrackElement(Object) @extends TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_track_element_get_type(), } } +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]); @@ -59,7 +61,7 @@ pub trait TrackElementExt: 'static { fn set_active(&self, active: bool) -> bool; - //fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool; + //fn set_control_source>(&self, source: &P, property_name: &str, binding_type: &str) -> bool; fn set_track_type(&self, type_: TrackType); @@ -79,13 +81,13 @@ pub trait TrackElementExt: 'static { impl> TrackElementExt for O { fn add_children_props>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]) { unsafe { - ffi::ges_track_element_add_children_props(self.to_glib_none().0, element.to_glib_none().0, wanted_categories.to_glib_none().0, blacklist.to_glib_none().0, whitelist.to_glib_none().0); + ffi::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) -> bool { unsafe { - from_glib(ffi::ges_track_element_edit(self.to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position)) + from_glib(ffi::ges_track_element_edit(self.as_ref().to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position)) } } @@ -99,37 +101,37 @@ impl> TrackElementExt for O { fn get_element(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_element_get_element(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_element_get_element(self.as_ref().to_glib_none().0)) } } fn get_gnlobject(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_element_get_gnlobject(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_element_get_gnlobject(self.as_ref().to_glib_none().0)) } } fn get_nleobject(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_element_get_nleobject(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_element_get_nleobject(self.as_ref().to_glib_none().0)) } } fn get_track(&self) -> Option { unsafe { - from_glib_none(ffi::ges_track_element_get_track(self.to_glib_none().0)) + from_glib_none(ffi::ges_track_element_get_track(self.as_ref().to_glib_none().0)) } } fn get_track_type(&self) -> TrackType { unsafe { - from_glib(ffi::ges_track_element_get_track_type(self.to_glib_none().0)) + from_glib(ffi::ges_track_element_get_track_type(self.as_ref().to_glib_none().0)) } } fn is_active(&self) -> bool { unsafe { - from_glib(ffi::ges_track_element_is_active(self.to_glib_none().0)) + from_glib(ffi::ges_track_element_is_active(self.as_ref().to_glib_none().0)) } } @@ -139,23 +141,23 @@ impl> TrackElementExt for O { fn remove_control_binding(&self, property_name: &str) -> bool { unsafe { - from_glib(ffi::ges_track_element_remove_control_binding(self.to_glib_none().0, property_name.to_glib_none().0)) + from_glib(ffi::ges_track_element_remove_control_binding(self.as_ref().to_glib_none().0, property_name.to_glib_none().0)) } } fn set_active(&self, active: bool) -> bool { unsafe { - from_glib(ffi::ges_track_element_set_active(self.to_glib_none().0, active.to_glib())) + from_glib(ffi::ges_track_element_set_active(self.as_ref().to_glib_none().0, active.to_glib())) } } - //fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool { + //fn set_control_source>(&self, source: &P, property_name: &str, binding_type: &str) -> bool { // unsafe { TODO: call ffi::ges_track_element_set_control_source() } //} fn set_track_type(&self, type_: TrackType) { unsafe { - ffi::ges_track_element_set_track_type(self.to_glib_none().0, type_.to_glib()); + ffi::ges_track_element_set_track_type(self.as_ref().to_glib_none().0, type_.to_glib()); } } @@ -178,7 +180,7 @@ impl> TrackElementExt for O { fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::active\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _, transmute(notify_active_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -186,7 +188,7 @@ impl> TrackElementExt for O { fn connect_property_track_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::track\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::track\0".as_ptr() as *const _, transmute(notify_track_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -194,7 +196,7 @@ impl> TrackElementExt for O { fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::track-type\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::track-type\0".as_ptr() as *const _, transmute(notify_track_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -203,17 +205,17 @@ impl> TrackElementExt for O { unsafe extern "C" fn notify_active_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) + f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_track_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) + f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_track_type_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) + f(&TrackElement::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/uri_clip.rs b/gstreamer-editing-services/src/auto/uri_clip.rs index 88db8ff7a..2cec8fd84 100644 --- a/gstreamer-editing-services/src/auto/uri_clip.rs +++ b/gstreamer-editing-services/src/auto/uri_clip.rs @@ -10,7 +10,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -21,7 +21,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct UriClip(Object): Clip, Container, TimelineElement, Extractable; + pub struct UriClip(Object) @extends Clip, Container, TimelineElement, @implements Extractable; match fn { get_type => || ffi::ges_uri_clip_get_type(), @@ -37,6 +37,8 @@ impl UriClip { } } +pub const NONE_URI_CLIP: Option<&UriClip> = None; + pub trait UriClipExt: 'static { fn get_uri(&self) -> Option; @@ -62,31 +64,31 @@ pub trait UriClipExt: 'static { impl> UriClipExt for O { fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::ges_uri_clip_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::ges_uri_clip_get_uri(self.as_ref().to_glib_none().0)) } } fn is_image(&self) -> bool { unsafe { - from_glib(ffi::ges_uri_clip_is_image(self.to_glib_none().0)) + from_glib(ffi::ges_uri_clip_is_image(self.as_ref().to_glib_none().0)) } } fn is_muted(&self) -> bool { unsafe { - from_glib(ffi::ges_uri_clip_is_muted(self.to_glib_none().0)) + from_glib(ffi::ges_uri_clip_is_muted(self.as_ref().to_glib_none().0)) } } fn set_is_image(&self, is_image: bool) { unsafe { - ffi::ges_uri_clip_set_is_image(self.to_glib_none().0, is_image.to_glib()); + ffi::ges_uri_clip_set_is_image(self.as_ref().to_glib_none().0, is_image.to_glib()); } } fn set_mute(&self, mute: bool) { unsafe { - ffi::ges_uri_clip_set_mute(self.to_glib_none().0, mute.to_glib()); + ffi::ges_uri_clip_set_mute(self.as_ref().to_glib_none().0, mute.to_glib()); } } @@ -109,7 +111,7 @@ impl> UriClipExt for O { fn connect_property_is_image_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::is-image\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::is-image\0".as_ptr() as *const _, transmute(notify_is_image_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -117,7 +119,7 @@ impl> UriClipExt for O { fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mute\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, transmute(notify_mute_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -125,7 +127,7 @@ impl> UriClipExt for O { fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, transmute(notify_supported_formats_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -134,17 +136,17 @@ impl> UriClipExt for O { unsafe extern "C" fn notify_is_image_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&UriClip::from_glib_borrow(this).downcast_unchecked()) + f(&UriClip::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mute_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&UriClip::from_glib_borrow(this).downcast_unchecked()) + f(&UriClip::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_supported_formats_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&UriClip::from_glib_borrow(this).downcast_unchecked()) + f(&UriClip::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/uri_clip_asset.rs b/gstreamer-editing-services/src/auto/uri_clip_asset.rs index 67de4c929..247d1c18d 100644 --- a/gstreamer-editing-services/src/auto/uri_clip_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_clip_asset.rs @@ -7,7 +7,7 @@ use Error; use UriSourceAsset; use ffi; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -21,7 +21,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct UriClipAsset(Object): Asset; + pub struct UriClipAsset(Object) @extends Asset; match fn { get_type => || ffi::ges_uri_clip_asset_get_type(), @@ -29,7 +29,7 @@ glib_wrapper! { } impl UriClipAsset { - //pub fn new<'a, P: Into>, Q: /*Unimplemented*/gio::AsyncReadyCallback>(uri: &str, cancellable: P, callback: Q) { + //pub fn new<'a, P: IsA + 'a, Q: Into>, R: /*Unimplemented*/gio::AsyncReadyCallback>(uri: &str, cancellable: Q, callback: R) { // unsafe { TODO: call ffi::ges_uri_clip_asset_new() } //} @@ -43,6 +43,8 @@ impl UriClipAsset { } } +pub const NONE_URI_CLIP_ASSET: Option<&UriClipAsset> = None; + pub trait UriClipAssetExt: 'static { fn get_duration(&self) -> gst::ClockTime; @@ -60,25 +62,25 @@ pub trait UriClipAssetExt: 'static { impl> UriClipAssetExt for O { fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_uri_clip_asset_get_duration(self.to_glib_none().0)) + from_glib(ffi::ges_uri_clip_asset_get_duration(self.as_ref().to_glib_none().0)) } } fn get_info(&self) -> Option { unsafe { - from_glib_none(ffi::ges_uri_clip_asset_get_info(const_override(self.to_glib_none().0))) + from_glib_none(ffi::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(ffi::ges_uri_clip_asset_get_stream_assets(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ges_uri_clip_asset_get_stream_assets(self.as_ref().to_glib_none().0)) } } fn is_image(&self) -> bool { unsafe { - from_glib(ffi::ges_uri_clip_asset_is_image(self.to_glib_none().0)) + from_glib(ffi::ges_uri_clip_asset_is_image(self.as_ref().to_glib_none().0)) } } @@ -91,7 +93,7 @@ impl> UriClipAssetExt for O { fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -100,5 +102,5 @@ impl> UriClipAssetExt for O { unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESUriClipAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&UriClipAsset::from_glib_borrow(this).downcast_unchecked()) + f(&UriClipAsset::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-editing-services/src/auto/uri_source_asset.rs b/gstreamer-editing-services/src/auto/uri_source_asset.rs index 71e63d39c..dde9b5d1f 100644 --- a/gstreamer-editing-services/src/auto/uri_source_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_source_asset.rs @@ -11,13 +11,15 @@ use glib::translate::*; use gst_pbutils; glib_wrapper! { - pub struct UriSourceAsset(Object): Asset; + pub struct UriSourceAsset(Object) @extends Asset; match fn { get_type => || ffi::ges_uri_source_asset_get_type(), } } +pub const NONE_URI_SOURCE_ASSET: Option<&UriSourceAsset> = None; + pub trait UriSourceAssetExt: 'static { fn get_filesource_asset(&self) -> Option; @@ -29,19 +31,19 @@ pub trait UriSourceAssetExt: 'static { impl> UriSourceAssetExt for O { fn get_filesource_asset(&self) -> Option { unsafe { - from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.to_glib_none().0)) + from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.as_ref().to_glib_none().0)) } } fn get_stream_info(&self) -> Option { unsafe { - from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.to_glib_none().0)) + from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.as_ref().to_glib_none().0)) } } fn get_stream_uri(&self) -> Option { unsafe { - from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.to_glib_none().0)) + from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.as_ref().to_glib_none().0)) } } } diff --git a/gstreamer-editing-services/src/auto/versions.txt b/gstreamer-editing-services/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-editing-services/src/auto/versions.txt +++ b/gstreamer-editing-services/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-gl/src/auto/gl_base_filter.rs b/gstreamer-gl/src/auto/gl_base_filter.rs index d97439094..2d6aa8771 100644 --- a/gstreamer-gl/src/auto/gl_base_filter.rs +++ b/gstreamer-gl/src/auto/gl_base_filter.rs @@ -6,7 +6,7 @@ use GLContext; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -14,14 +14,11 @@ use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct GLBaseFilter(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLBaseFilter(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_base_filter_get_type(), @@ -31,6 +28,8 @@ glib_wrapper! { unsafe impl Send for GLBaseFilter {} unsafe impl Sync for GLBaseFilter {} +pub const NONE_GL_BASE_FILTER: Option<&GLBaseFilter> = None; + pub trait GLBaseFilterExt: 'static { fn get_property_context(&self) -> Option; @@ -49,7 +48,7 @@ impl> GLBaseFilterExt for O { fn connect_property_context_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::context\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::context\0".as_ptr() as *const _, transmute(notify_context_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -58,5 +57,5 @@ impl> GLBaseFilterExt for O { unsafe extern "C" fn notify_context_trampoline

(this: *mut ffi::GstGLBaseFilter, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&GLBaseFilter::from_glib_borrow(this).downcast_unchecked()) + f(&GLBaseFilter::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-gl/src/auto/gl_color_convert.rs b/gstreamer-gl/src/auto/gl_color_convert.rs index 6b2806bfc..88ce54def 100644 --- a/gstreamer-gl/src/auto/gl_color_convert.rs +++ b/gstreamer-gl/src/auto/gl_color_convert.rs @@ -4,14 +4,12 @@ use GLContext; use ffi; +use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct GLColorConvert(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLColorConvert(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_color_convert_get_type(), @@ -19,10 +17,10 @@ glib_wrapper! { } impl GLColorConvert { - pub fn new(context: &GLContext) -> GLColorConvert { + pub fn new>(context: &P) -> GLColorConvert { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_gl_color_convert_new(context.to_glib_none().0)) + from_glib_full(ffi::gst_gl_color_convert_new(context.as_ref().to_glib_none().0)) } } @@ -32,13 +30,15 @@ impl GLColorConvert { } } - pub fn transform_caps(context: &GLContext, 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(ffi::gst_gl_color_convert_transform_caps(context.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(ffi::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)) } } } unsafe impl Send for GLColorConvert {} unsafe impl Sync for GLColorConvert {} + +pub const NONE_GL_COLOR_CONVERT: Option<&GLColorConvert> = None; diff --git a/gstreamer-gl/src/auto/gl_context.rs b/gstreamer-gl/src/auto/gl_context.rs index 5193c3617..326e8226a 100644 --- a/gstreamer-gl/src/auto/gl_context.rs +++ b/gstreamer-gl/src/auto/gl_context.rs @@ -14,14 +14,11 @@ use glib; use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; use std::mem; use std::ptr; glib_wrapper! { - pub struct GLContext(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLContext(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_context_get_type(), @@ -32,7 +29,7 @@ impl GLContext { pub fn new>(display: &P) -> GLContext { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::gst_gl_context_new(display.to_glib_none().0)) + from_glib_none(ffi::gst_gl_context_new(display.as_ref().to_glib_none().0)) } } @@ -57,10 +54,12 @@ impl GLContext { unsafe impl Send for GLContext {} unsafe impl Sync for GLContext {} +pub const NONE_GL_CONTEXT: Option<&GLContext> = None; + pub trait GLContextExt: 'static { fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError>; - fn can_share(&self, other_context: &GLContext) -> bool; + fn can_share>(&self, other_context: &P) -> bool; fn check_feature(&self, feature: &str) -> bool; @@ -72,7 +71,7 @@ pub trait GLContextExt: 'static { fn clear_shader(&self); - fn create<'a, P: Into>>(&self, other_context: P) -> Result<(), Error>; + fn create<'a, P: IsA + 'a, Q: Into>>(&self, other_context: Q) -> Result<(), Error>; fn destroy(&self); @@ -92,9 +91,9 @@ pub trait GLContextExt: 'static { fn is_shared(&self) -> bool; - fn set_shared_with(&self, share: &GLContext); + fn set_shared_with>(&self, share: &P); - fn set_window(&self, window: &GLWindow) -> bool; + fn set_window>(&self, window: &P) -> bool; fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool; @@ -104,85 +103,84 @@ pub trait GLContextExt: 'static { impl> GLContextExt for O { fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_gl_context_activate(self.to_glib_none().0, activate.to_glib()), "Failed to activate OpenGL context") + glib_result_from_gboolean!(ffi::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: &GLContext) -> bool { + fn can_share>(&self, other_context: &P) -> bool { unsafe { - from_glib(ffi::gst_gl_context_can_share(self.to_glib_none().0, other_context.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_gl_context_check_feature(self.to_glib_none().0, feature.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_gl_context_check_framebuffer_status(self.to_glib_none().0, fbo_target)) + from_glib(ffi::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(ffi::gst_gl_context_check_gl_version(self.to_glib_none().0, api.to_glib(), maj, min)) + from_glib(ffi::gst_gl_context_check_gl_version(self.as_ref().to_glib_none().0, api.to_glib(), maj, min)) } } fn clear_framebuffer(&self) { unsafe { - ffi::gst_gl_context_clear_framebuffer(self.to_glib_none().0); + ffi::gst_gl_context_clear_framebuffer(self.as_ref().to_glib_none().0); } } fn clear_shader(&self) { unsafe { - ffi::gst_gl_context_clear_shader(self.to_glib_none().0); + ffi::gst_gl_context_clear_shader(self.as_ref().to_glib_none().0); } } - fn create<'a, P: Into>>(&self, other_context: P) -> Result<(), Error> { + fn create<'a, P: IsA + 'a, Q: Into>>(&self, other_context: Q) -> Result<(), Error> { let other_context = other_context.into(); - let other_context = other_context.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let _ = ffi::gst_gl_context_create(self.to_glib_none().0, other_context.0, &mut error); + let _ = ffi::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)) } } } fn destroy(&self) { unsafe { - ffi::gst_gl_context_destroy(self.to_glib_none().0); + ffi::gst_gl_context_destroy(self.as_ref().to_glib_none().0); } } fn fill_info(&self) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::gst_gl_context_fill_info(self.to_glib_none().0, &mut error); + let _ = ffi::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(ffi::gst_gl_context_get_display(self.to_glib_none().0)) + from_glib_full(ffi::gst_gl_context_get_display(self.as_ref().to_glib_none().0)) } } fn get_gl_api(&self) -> GLAPI { unsafe { - from_glib(ffi::gst_gl_context_get_gl_api(self.to_glib_none().0)) + from_glib(ffi::gst_gl_context_get_gl_api(self.as_ref().to_glib_none().0)) } } fn get_gl_platform(&self) -> GLPlatform { unsafe { - from_glib(ffi::gst_gl_context_get_gl_platform(self.to_glib_none().0)) + from_glib(ffi::gst_gl_context_get_gl_platform(self.as_ref().to_glib_none().0)) } } @@ -190,7 +188,7 @@ impl> GLContextExt for O { unsafe { let mut major = mem::uninitialized(); let mut minor = mem::uninitialized(); - ffi::gst_gl_context_get_gl_platform_version(self.to_glib_none().0, &mut major, &mut minor); + ffi::gst_gl_context_get_gl_platform_version(self.as_ref().to_glib_none().0, &mut major, &mut minor); (major, minor) } } @@ -199,44 +197,44 @@ impl> GLContextExt for O { unsafe { let mut maj = mem::uninitialized(); let mut min = mem::uninitialized(); - ffi::gst_gl_context_get_gl_version(self.to_glib_none().0, &mut maj, &mut min); + ffi::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(ffi::gst_gl_context_get_window(self.to_glib_none().0)) + from_glib_full(ffi::gst_gl_context_get_window(self.as_ref().to_glib_none().0)) } } fn is_shared(&self) -> bool { unsafe { - from_glib(ffi::gst_gl_context_is_shared(self.to_glib_none().0)) + from_glib(ffi::gst_gl_context_is_shared(self.as_ref().to_glib_none().0)) } } - fn set_shared_with(&self, share: &GLContext) { + fn set_shared_with>(&self, share: &P) { unsafe { - ffi::gst_gl_context_set_shared_with(self.to_glib_none().0, share.to_glib_none().0); + ffi::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: &GLWindow) -> bool { + fn set_window>(&self, window: &P) -> bool { unsafe { - from_glib(ffi::gst_gl_context_set_window(self.to_glib_none().0, window.to_glib_full())) + from_glib(ffi::gst_gl_context_set_window(self.as_ref().to_glib_none().0, window.as_ref().to_glib_full())) } } fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool { unsafe { - from_glib(ffi::gst_gl_context_supports_glsl_profile_version(self.to_glib_none().0, version.to_glib(), profile.to_glib())) + from_glib(ffi::gst_gl_context_supports_glsl_profile_version(self.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib())) } } fn swap_buffers(&self) { unsafe { - ffi::gst_gl_context_swap_buffers(self.to_glib_none().0); + ffi::gst_gl_context_swap_buffers(self.as_ref().to_glib_none().0); } } } diff --git a/gstreamer-gl/src/auto/gl_display.rs b/gstreamer-gl/src/auto/gl_display.rs index 7f1ac7b96..b98e236da 100644 --- a/gstreamer-gl/src/auto/gl_display.rs +++ b/gstreamer-gl/src/auto/gl_display.rs @@ -9,22 +9,19 @@ use GLDisplayType; use GLWindow; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct GLDisplay(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLDisplay(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_display_get_type(), @@ -49,10 +46,12 @@ impl Default for GLDisplay { unsafe impl Send for GLDisplay {} unsafe impl Sync for GLDisplay {} -pub trait GLDisplayExt: 'static { - fn add_context(&self, context: &GLContext) -> Result<(), glib::error::BoolError>; +pub const NONE_GL_DISPLAY: Option<&GLDisplay> = None; - fn create_context(&self, other_context: &GLContext) -> Result; +pub trait GLDisplayExt: 'static { + fn add_context>(&self, context: &P) -> Result<(), glib::error::BoolError>; + + fn create_context>(&self, other_context: &P) -> Result; fn create_window(&self) -> Option; @@ -64,67 +63,67 @@ pub trait GLDisplayExt: 'static { fn get_handle_type(&self) -> GLDisplayType; - fn remove_window(&self, window: &GLWindow) -> Result<(), glib::error::BoolError>; + fn remove_window>(&self, window: &P) -> Result<(), glib::error::BoolError>; fn connect_create_context GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; } impl> GLDisplayExt for O { - fn add_context(&self, context: &GLContext) -> Result<(), glib::error::BoolError> { + fn add_context>(&self, context: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_gl_display_add_context(self.to_glib_none().0, context.to_glib_none().0), "Failed to add OpenGL context") + glib_result_from_gboolean!(ffi::gst_gl_display_add_context(self.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0), "Failed to add OpenGL context") } } - fn create_context(&self, other_context: &GLContext) -> Result { + fn create_context>(&self, other_context: &P) -> Result { unsafe { let mut p_context = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::gst_gl_display_create_context(self.to_glib_none().0, other_context.to_glib_none().0, &mut p_context, &mut error); + let _ = ffi::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(ffi::gst_gl_display_create_window(self.to_glib_none().0)) + from_glib_full(ffi::gst_gl_display_create_window(self.as_ref().to_glib_none().0)) } } fn filter_gl_api(&self, gl_api: GLAPI) { unsafe { - ffi::gst_gl_display_filter_gl_api(self.to_glib_none().0, gl_api.to_glib()); + ffi::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(ffi::gst_gl_display_get_gl_api(self.to_glib_none().0)) + from_glib(ffi::gst_gl_display_get_gl_api(self.as_ref().to_glib_none().0)) } } fn get_gl_api_unlocked(&self) -> GLAPI { unsafe { - from_glib(ffi::gst_gl_display_get_gl_api_unlocked(self.to_glib_none().0)) + from_glib(ffi::gst_gl_display_get_gl_api_unlocked(self.as_ref().to_glib_none().0)) } } fn get_handle_type(&self) -> GLDisplayType { unsafe { - from_glib(ffi::gst_gl_display_get_handle_type(self.to_glib_none().0)) + from_glib(ffi::gst_gl_display_get_handle_type(self.as_ref().to_glib_none().0)) } } - fn remove_window(&self, window: &GLWindow) -> Result<(), glib::error::BoolError> { + fn remove_window>(&self, window: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_gl_display_remove_window(self.to_glib_none().0, window.to_glib_none().0), "Failed to remove window") + glib_result_from_gboolean!(ffi::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 { let f: Box_ GLContext + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"create-context\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"create-context\0".as_ptr() as *const _, transmute(create_context_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -133,5 +132,5 @@ impl> GLDisplayExt for O { unsafe extern "C" fn create_context_trampoline

(this: *mut ffi::GstGLDisplay, context: *mut ffi::GstGLContext, f: glib_ffi::gpointer) -> *mut ffi::GstGLContext where P: IsA { let f: &&(Fn(&P, &GLContext) -> GLContext + Send + Sync + 'static) = transmute(f); - f(&GLDisplay::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(context)).to_glib_full() + f(&GLDisplay::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(context)).to_glib_full() } diff --git a/gstreamer-gl/src/auto/gl_display_egl.rs b/gstreamer-gl/src/auto/gl_display_egl.rs index f2459a99c..cbc445022 100644 --- a/gstreamer-gl/src/auto/gl_display_egl.rs +++ b/gstreamer-gl/src/auto/gl_display_egl.rs @@ -6,13 +6,9 @@ use GLDisplay; use ffi; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct GLDisplayEGL(Object): [ - GLDisplay, - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLDisplayEGL(Object) @extends GLDisplay, gst::Object; match fn { get_type => || ffi::gst_gl_display_egl_get_type(), @@ -44,3 +40,5 @@ impl Default for GLDisplayEGL { unsafe impl Send for GLDisplayEGL {} unsafe impl Sync for GLDisplayEGL {} + +pub const NONE_GL_DISPLAY_EGL: Option<&GLDisplayEGL> = None; diff --git a/gstreamer-gl/src/auto/gl_framebuffer.rs b/gstreamer-gl/src/auto/gl_framebuffer.rs index 42495221f..bad058750 100644 --- a/gstreamer-gl/src/auto/gl_framebuffer.rs +++ b/gstreamer-gl/src/auto/gl_framebuffer.rs @@ -7,13 +7,10 @@ use ffi; use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; use std::mem; glib_wrapper! { - pub struct GLFramebuffer(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLFramebuffer(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_framebuffer_get_type(), @@ -21,17 +18,17 @@ glib_wrapper! { } impl GLFramebuffer { - pub fn new(context: &GLContext) -> GLFramebuffer { + pub fn new>(context: &P) -> GLFramebuffer { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_gl_framebuffer_new(context.to_glib_none().0)) + from_glib_full(ffi::gst_gl_framebuffer_new(context.as_ref().to_glib_none().0)) } } - pub fn new_with_default_depth(context: &GLContext, 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(ffi::gst_gl_framebuffer_new_with_default_depth(context.to_glib_none().0, width, height)) + from_glib_none(ffi::gst_gl_framebuffer_new_with_default_depth(context.as_ref().to_glib_none().0, width, height)) } } } @@ -39,6 +36,8 @@ impl GLFramebuffer { unsafe impl Send for GLFramebuffer {} unsafe impl Sync for GLFramebuffer {} +pub const NONE_GL_FRAMEBUFFER: Option<&GLFramebuffer> = None; + pub trait GLFramebufferExt: 'static { //fn attach(&self, attachment_point: u32, mem: /*Ignored*/&mut GLBaseMemory); @@ -58,7 +57,7 @@ impl> GLFramebufferExt for O { fn bind(&self) { unsafe { - ffi::gst_gl_framebuffer_bind(self.to_glib_none().0); + ffi::gst_gl_framebuffer_bind(self.as_ref().to_glib_none().0); } } @@ -70,14 +69,14 @@ impl> GLFramebufferExt for O { unsafe { let mut width = mem::uninitialized(); let mut height = mem::uninitialized(); - ffi::gst_gl_framebuffer_get_effective_dimensions(self.to_glib_none().0, &mut width, &mut height); + ffi::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 { - ffi::gst_gl_framebuffer_get_id(self.to_glib_none().0) + ffi::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 69d366a9b..3c285dcce 100644 --- a/gstreamer-gl/src/auto/gl_overlay_compositor.rs +++ b/gstreamer-gl/src/auto/gl_overlay_compositor.rs @@ -4,14 +4,12 @@ use GLContext; use ffi; +use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct GLOverlayCompositor(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLOverlayCompositor(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_overlay_compositor_get_type(), @@ -19,10 +17,10 @@ glib_wrapper! { } impl GLOverlayCompositor { - pub fn new(context: &GLContext) -> GLOverlayCompositor { + pub fn new>(context: &P) -> GLOverlayCompositor { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::gst_gl_overlay_compositor_new(context.to_glib_none().0)) + from_glib_none(ffi::gst_gl_overlay_compositor_new(context.as_ref().to_glib_none().0)) } } @@ -48,3 +46,5 @@ impl GLOverlayCompositor { unsafe impl Send for GLOverlayCompositor {} unsafe impl Sync for GLOverlayCompositor {} + +pub const NONE_GL_OVERLAY_COMPOSITOR: Option<&GLOverlayCompositor> = None; diff --git a/gstreamer-gl/src/auto/gl_shader.rs b/gstreamer-gl/src/auto/gl_shader.rs index 8369480fc..2c1678192 100644 --- a/gstreamer-gl/src/auto/gl_shader.rs +++ b/gstreamer-gl/src/auto/gl_shader.rs @@ -8,21 +8,20 @@ use GLSLStage; use ffi; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct GLShader(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLShader(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_shader_get_type(), @@ -30,39 +29,39 @@ glib_wrapper! { } impl GLShader { - pub fn new(context: &GLContext) -> GLShader { + pub fn new>(context: &P) -> GLShader { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_gl_shader_new(context.to_glib_none().0)) + from_glib_full(ffi::gst_gl_shader_new(context.as_ref().to_glib_none().0)) } } - pub fn new_default(context: &GLContext) -> Result { + pub fn new_default>(context: &P) -> Result { skip_assert_initialized!(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_gl_shader_new_default(context.to_glib_none().0, &mut error); + let ret = ffi::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)) } } } - //pub fn new_link_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { + //pub fn new_link_with_stages>(context: &P, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { // unsafe { TODO: call ffi::gst_gl_shader_new_link_with_stages() } //} - //pub fn new_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { + //pub fn new_with_stages>(context: &P, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { // unsafe { TODO: call ffi::gst_gl_shader_new_with_stages() } //} - pub fn attach(&self, stage: &GLSLStage) -> bool { + pub fn attach>(&self, stage: &P) -> bool { unsafe { - from_glib(ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0)) + from_glib(ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.as_ref().to_glib_none().0)) } } - pub fn attach_unlocked(&self, stage: &GLSLStage) -> bool { + pub fn attach_unlocked>(&self, stage: &P) -> bool { unsafe { - from_glib(ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0)) + from_glib(ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.as_ref().to_glib_none().0)) } } @@ -78,23 +77,23 @@ impl GLShader { } } - pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), Error> { + pub fn compile_attach_stage>(&self, stage: &P) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.to_glib_none().0, &mut error); + let _ = ffi::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.as_ref().to_glib_none().0, &mut error); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } - pub fn detach(&self, stage: &GLSLStage) { + pub fn detach>(&self, stage: &P) { unsafe { - ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.to_glib_none().0); + ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.as_ref().to_glib_none().0); } } - pub fn detach_unlocked(&self, stage: &GLSLStage) { + pub fn detach_unlocked>(&self, stage: &P) { unsafe { - ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0); + ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.as_ref().to_glib_none().0); } } @@ -249,7 +248,7 @@ impl GLShader { pub fn get_property_linked(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -257,7 +256,7 @@ impl GLShader { pub fn connect_property_linked_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::linked\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::linked\0".as_ptr() as *const _, transmute(notify_linked_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -266,6 +265,8 @@ impl GLShader { unsafe impl Send for GLShader {} unsafe impl Sync for GLShader {} +pub const NONE_GL_SHADER: Option<&GLShader> = None; + unsafe extern "C" fn notify_linked_trampoline(this: *mut ffi::GstGLShader, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&GLShader) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-gl/src/auto/gl_upload.rs b/gstreamer-gl/src/auto/gl_upload.rs index 8324c5bc4..ee0799520 100644 --- a/gstreamer-gl/src/auto/gl_upload.rs +++ b/gstreamer-gl/src/auto/gl_upload.rs @@ -4,15 +4,13 @@ use GLContext; use ffi; +use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; use std::ptr; glib_wrapper! { - pub struct GLUpload(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLUpload(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_upload_get_type(), @@ -20,10 +18,10 @@ glib_wrapper! { } impl GLUpload { - pub fn new(context: &GLContext) -> GLUpload { + pub fn new>(context: &P) -> GLUpload { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_gl_upload_new(context.to_glib_none().0)) + from_glib_full(ffi::gst_gl_upload_new(context.as_ref().to_glib_none().0)) } } @@ -42,15 +40,15 @@ impl GLUpload { } } - pub fn set_context(&self, context: &GLContext) { + pub fn set_context>(&self, context: &P) { unsafe { - ffi::gst_gl_upload_set_context(self.to_glib_none().0, context.to_glib_none().0); + ffi::gst_gl_upload_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0); } } - pub fn transform_caps(&self, context: &GLContext, 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(ffi::gst_gl_upload_transform_caps(self.to_glib_none().0, context.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) + from_glib_full(ffi::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)) } } @@ -64,3 +62,5 @@ impl GLUpload { unsafe impl Send for GLUpload {} unsafe impl Sync for GLUpload {} + +pub const NONE_GL_UPLOAD: Option<&GLUpload> = None; diff --git a/gstreamer-gl/src/auto/gl_view_convert.rs b/gstreamer-gl/src/auto/gl_view_convert.rs index fcc92fd2b..f7be19bb8 100644 --- a/gstreamer-gl/src/auto/gl_view_convert.rs +++ b/gstreamer-gl/src/auto/gl_view_convert.rs @@ -7,21 +7,20 @@ use GLStereoDownmix; use ffi; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use gst_video; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct GLViewConvert(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLViewConvert(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_view_convert_get_type(), @@ -54,9 +53,9 @@ impl GLViewConvert { } } - pub fn set_context(&self, context: &GLContext) { + pub fn set_context>(&self, context: &P) { unsafe { - ffi::gst_gl_view_convert_set_context(self.to_glib_none().0, context.to_glib_none().0); + ffi::gst_gl_view_convert_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0); } } @@ -69,77 +68,77 @@ impl GLViewConvert { pub fn get_property_downmix_mode(&self) -> GLStereoDownmix { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"downmix-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"downmix-mode\0".as_ptr() as *const _, Value::from(&downmix_mode).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"input-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"input-flags-override\0".as_ptr() as *const _, Value::from(&input_flags_override).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"input-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"input-mode-override\0".as_ptr() as *const _, Value::from(&input_mode_override).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"output-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"output-flags-override\0".as_ptr() as *const _, Value::from(&output_flags_override).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"output-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"output-mode-override\0".as_ptr() as *const _, Value::from(&output_mode_override).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::downmix-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::downmix-mode\0".as_ptr() as *const _, transmute(notify_downmix_mode_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -147,7 +146,7 @@ impl GLViewConvert { pub fn connect_property_input_flags_override_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::input-flags-override\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::input-flags-override\0".as_ptr() as *const _, transmute(notify_input_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -155,7 +154,7 @@ impl GLViewConvert { pub fn connect_property_input_mode_override_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::input-mode-override\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::input-mode-override\0".as_ptr() as *const _, transmute(notify_input_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -163,7 +162,7 @@ impl GLViewConvert { pub fn connect_property_output_flags_override_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::output-flags-override\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::output-flags-override\0".as_ptr() as *const _, transmute(notify_output_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -171,7 +170,7 @@ impl GLViewConvert { pub fn connect_property_output_mode_override_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::output-mode-override\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::output-mode-override\0".as_ptr() as *const _, transmute(notify_output_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -186,6 +185,8 @@ impl Default for GLViewConvert { unsafe impl Send for GLViewConvert {} unsafe impl Sync for GLViewConvert {} +pub const NONE_GL_VIEW_CONVERT: Option<&GLViewConvert> = None; + unsafe extern "C" fn notify_downmix_mode_trampoline(this: *mut ffi::GstGLViewConvert, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&GLViewConvert) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-gl/src/auto/gl_window.rs b/gstreamer-gl/src/auto/gl_window.rs index f0331101a..1eda38a4f 100644 --- a/gstreamer-gl/src/auto/gl_window.rs +++ b/gstreamer-gl/src/auto/gl_window.rs @@ -6,23 +6,20 @@ use GLContext; use GLDisplay; use ffi; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gst; -use gst_ffi; use libc; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct GLWindow(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLWindow(Object) @extends gst::Object; match fn { get_type => || ffi::gst_gl_window_get_type(), @@ -33,7 +30,7 @@ impl GLWindow { pub fn new>(display: &P) -> GLWindow { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_gl_window_new(display.to_glib_none().0)) + from_glib_full(ffi::gst_gl_window_new(display.as_ref().to_glib_none().0)) } } } @@ -41,6 +38,8 @@ impl GLWindow { unsafe impl Send for GLWindow {} unsafe impl Sync for GLWindow {} +pub const NONE_GL_WINDOW: Option<&GLWindow> = None; + pub trait GLWindowExt: 'static { fn draw(&self); @@ -76,13 +75,13 @@ pub trait GLWindowExt: 'static { impl> GLWindowExt for O { fn draw(&self) { unsafe { - ffi::gst_gl_window_draw(self.to_glib_none().0); + ffi::gst_gl_window_draw(self.as_ref().to_glib_none().0); } } fn get_context(&self) -> Option { unsafe { - from_glib_full(ffi::gst_gl_window_get_context(self.to_glib_none().0)) + from_glib_full(ffi::gst_gl_window_get_context(self.as_ref().to_glib_none().0)) } } @@ -90,75 +89,75 @@ impl> GLWindowExt for O { unsafe { let mut width = mem::uninitialized(); let mut height = mem::uninitialized(); - ffi::gst_gl_window_get_surface_dimensions(self.to_glib_none().0, &mut width, &mut height); + ffi::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 { - ffi::gst_gl_window_handle_events(self.to_glib_none().0, handle_events.to_glib()); + ffi::gst_gl_window_handle_events(self.as_ref().to_glib_none().0, handle_events.to_glib()); } } fn queue_resize(&self) { unsafe { - ffi::gst_gl_window_queue_resize(self.to_glib_none().0); + ffi::gst_gl_window_queue_resize(self.as_ref().to_glib_none().0); } } fn quit(&self) { unsafe { - ffi::gst_gl_window_quit(self.to_glib_none().0); + ffi::gst_gl_window_quit(self.as_ref().to_glib_none().0); } } fn resize(&self, width: u32, height: u32) { unsafe { - ffi::gst_gl_window_resize(self.to_glib_none().0, width, height); + ffi::gst_gl_window_resize(self.as_ref().to_glib_none().0, width, height); } } fn run(&self) { unsafe { - ffi::gst_gl_window_run(self.to_glib_none().0); + ffi::gst_gl_window_run(self.as_ref().to_glib_none().0); } } fn send_key_event(&self, event_type: &str, key_str: &str) { unsafe { - ffi::gst_gl_window_send_key_event(self.to_glib_none().0, event_type.to_glib_none().0, key_str.to_glib_none().0); + ffi::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 { - ffi::gst_gl_window_send_mouse_event(self.to_glib_none().0, event_type.to_glib_none().0, button, posx, posy); + ffi::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 { - ffi::gst_gl_window_set_preferred_size(self.to_glib_none().0, width, height); + ffi::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) -> bool { unsafe { - from_glib(ffi::gst_gl_window_set_render_rectangle(self.to_glib_none().0, x, y, width, height)) + from_glib(ffi::gst_gl_window_set_render_rectangle(self.as_ref().to_glib_none().0, x, y, width, height)) } } fn show(&self) { unsafe { - ffi::gst_gl_window_show(self.to_glib_none().0); + ffi::gst_gl_window_show(self.as_ref().to_glib_none().0); } } fn connect_key_event(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"key-event\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"key-event\0".as_ptr() as *const _, transmute(key_event_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -166,7 +165,7 @@ impl> GLWindowExt for O { fn connect_mouse_event(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"mouse-event\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"mouse-event\0".as_ptr() as *const _, transmute(mouse_event_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -175,11 +174,11 @@ impl> GLWindowExt for O { unsafe extern "C" fn key_event_trampoline

(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, key: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &str, &str) + Send + Sync + 'static) = transmute(f); - f(&GLWindow::from_glib_borrow(this).downcast_unchecked(), &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 extern "C" fn mouse_event_trampoline

(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, button: libc::c_int, x: libc::c_double, y: libc::c_double, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &str, i32, f64, f64) + Send + Sync + 'static) = transmute(f); - f(&GLWindow::from_glib_borrow(this).downcast_unchecked(), &GString::from_glib_borrow(id), button, x, y) + f(&GLWindow::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(id), button, x, y) } diff --git a/gstreamer-gl/src/auto/glsl_stage.rs b/gstreamer-gl/src/auto/glsl_stage.rs index 3e5618e22..5b89c1e8d 100644 --- a/gstreamer-gl/src/auto/glsl_stage.rs +++ b/gstreamer-gl/src/auto/glsl_stage.rs @@ -8,15 +8,13 @@ use GLSLProfile; use GLSLVersion; use ffi; use glib::GString; +use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; use std::ptr; glib_wrapper! { - pub struct GLSLStage(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct GLSLStage(Object) @extends gst::Object; match fn { get_type => || ffi::gst_glsl_stage_get_type(), @@ -24,39 +22,39 @@ glib_wrapper! { } impl GLSLStage { - pub fn new(context: &GLContext, type_: u32) -> GLSLStage { + pub fn new>(context: &P, type_: u32) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::gst_glsl_stage_new(context.to_glib_none().0, type_)) + from_glib_none(ffi::gst_glsl_stage_new(context.as_ref().to_glib_none().0, type_)) } } - pub fn new_default_fragment(context: &GLContext) -> GLSLStage { + pub fn new_default_fragment>(context: &P) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::gst_glsl_stage_new_default_fragment(context.to_glib_none().0)) + from_glib_none(ffi::gst_glsl_stage_new_default_fragment(context.as_ref().to_glib_none().0)) } } - pub fn new_default_vertex(context: &GLContext) -> GLSLStage { + pub fn new_default_vertex>(context: &P) -> GLSLStage { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::gst_glsl_stage_new_default_vertex(context.to_glib_none().0)) + from_glib_none(ffi::gst_glsl_stage_new_default_vertex(context.as_ref().to_glib_none().0)) } } - pub fn new_with_string(context: &GLContext, 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(ffi::gst_glsl_stage_new_with_string(context.to_glib_none().0, type_, version.to_glib(), profile.to_glib(), str.to_glib_none().0)) + from_glib_none(ffi::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: &GLContext, 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(ffi::gst_glsl_stage_new_with_strings(context.to_glib_none().0, type_, version.to_glib(), profile.to_glib(), n_strings, str.to_glib_none().0)) + from_glib_none(ffi::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)) } } @@ -102,3 +100,5 @@ impl GLSLStage { unsafe impl Send for GLSLStage {} unsafe impl Sync for GLSLStage {} + +pub const NONE_GLSL_STAGE: Option<&GLSLStage> = None; diff --git a/gstreamer-gl/src/auto/mod.rs b/gstreamer-gl/src/auto/mod.rs index 214b60853..a0cd2e5b8 100644 --- a/gstreamer-gl/src/auto/mod.rs +++ b/gstreamer-gl/src/auto/mod.rs @@ -3,46 +3,46 @@ // DO NOT EDIT mod gl_base_filter; -pub use self::gl_base_filter::GLBaseFilter; +pub use self::gl_base_filter::{GLBaseFilter, GLBaseFilterClass, NONE_GL_BASE_FILTER}; pub use self::gl_base_filter::GLBaseFilterExt; mod gl_color_convert; -pub use self::gl_color_convert::GLColorConvert; +pub use self::gl_color_convert::{GLColorConvert, GLColorConvertClass, NONE_GL_COLOR_CONVERT}; mod gl_context; -pub use self::gl_context::GLContext; +pub use self::gl_context::{GLContext, GLContextClass, NONE_GL_CONTEXT}; pub use self::gl_context::GLContextExt; mod gl_display; -pub use self::gl_display::GLDisplay; +pub use self::gl_display::{GLDisplay, GLDisplayClass, NONE_GL_DISPLAY}; pub use self::gl_display::GLDisplayExt; #[cfg(any(feature = "egl", feature = "dox"))] mod gl_display_egl; #[cfg(any(feature = "egl", feature = "dox"))] -pub use self::gl_display_egl::GLDisplayEGL; +pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass, NONE_GL_DISPLAY_EGL}; mod gl_framebuffer; -pub use self::gl_framebuffer::GLFramebuffer; +pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER}; pub use self::gl_framebuffer::GLFramebufferExt; mod gl_overlay_compositor; -pub use self::gl_overlay_compositor::GLOverlayCompositor; +pub use self::gl_overlay_compositor::{GLOverlayCompositor, GLOverlayCompositorClass, NONE_GL_OVERLAY_COMPOSITOR}; mod glsl_stage; -pub use self::glsl_stage::GLSLStage; +pub use self::glsl_stage::{GLSLStage, GLSLStageClass, NONE_GLSL_STAGE}; mod gl_shader; -pub use self::gl_shader::GLShader; +pub use self::gl_shader::{GLShader, GLShaderClass, NONE_GL_SHADER}; mod gl_upload; -pub use self::gl_upload::GLUpload; +pub use self::gl_upload::{GLUpload, GLUploadClass, NONE_GL_UPLOAD}; mod gl_view_convert; -pub use self::gl_view_convert::GLViewConvert; +pub use self::gl_view_convert::{GLViewConvert, GLViewConvertClass, NONE_GL_VIEW_CONVERT}; mod gl_window; -pub use self::gl_window::GLWindow; +pub use self::gl_window::{GLWindow, GLWindowClass, NONE_GL_WINDOW}; pub use self::gl_window::GLWindowExt; mod enums; diff --git a/gstreamer-gl/src/auto/versions.txt b/gstreamer-gl/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-gl/src/auto/versions.txt +++ b/gstreamer-gl/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-net/src/auto/mod.rs b/gstreamer-net/src/auto/mod.rs index 7011138d6..1e41ad207 100644 --- a/gstreamer-net/src/auto/mod.rs +++ b/gstreamer-net/src/auto/mod.rs @@ -3,16 +3,16 @@ // DO NOT EDIT mod net_client_clock; -pub use self::net_client_clock::NetClientClock; +pub use self::net_client_clock::{NetClientClock, NetClientClockClass, NONE_NET_CLIENT_CLOCK}; mod net_time_provider; -pub use self::net_time_provider::NetTimeProvider; +pub use self::net_time_provider::{NetTimeProvider, NetTimeProviderClass, NONE_NET_TIME_PROVIDER}; mod ntp_clock; -pub use self::ntp_clock::NtpClock; +pub use self::ntp_clock::{NtpClock, NtpClockClass, NONE_NTP_CLOCK}; mod ptp_clock; -pub use self::ptp_clock::PtpClock; +pub use self::ptp_clock::{PtpClock, PtpClockClass, NONE_PTP_CLOCK}; #[doc(hidden)] pub mod traits { diff --git a/gstreamer-net/src/auto/net_client_clock.rs b/gstreamer-net/src/auto/net_client_clock.rs index b6032c5ff..168ff78fd 100644 --- a/gstreamer-net/src/auto/net_client_clock.rs +++ b/gstreamer-net/src/auto/net_client_clock.rs @@ -3,24 +3,23 @@ // DO NOT EDIT use ffi; +use glib; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct NetClientClock(Object): [ - gst::Clock => gst_ffi::GstClock, - gst::Object => gst_ffi::GstObject, - ]; + pub struct NetClientClock(Object) @extends gst::Clock, gst::Object; match fn { get_type => || ffi::gst_net_client_clock_get_type(), @@ -31,7 +30,7 @@ impl NetClientClock { pub fn get_property_address(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -39,14 +38,14 @@ impl NetClientClock { pub fn set_property_address<'a, P: Into>>(&self, address: P) { let address = address.into(); unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, Value::from(address).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"base-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"base-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -54,21 +53,21 @@ impl NetClientClock { pub fn get_property_bus(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"bus\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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>) { + pub fn set_property_bus + glib::value::SetValueOptional>(&self, bus: Option<&P>) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"bus\0".as_ptr() as *const _, Value::from(bus).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -76,63 +75,63 @@ impl NetClientClock { pub fn get_property_minimum_update_interval(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"minimum-update-interval\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"minimum-update-interval\0".as_ptr() as *const _, Value::from(&minimum_update_interval).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, Value::from(&port).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"round-trip-limit\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"round-trip-limit\0".as_ptr() as *const _, Value::from(&round_trip_limit).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::address\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _, transmute(notify_address_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -140,7 +139,7 @@ impl NetClientClock { pub fn connect_property_bus_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::bus\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::bus\0".as_ptr() as *const _, transmute(notify_bus_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -148,7 +147,7 @@ impl NetClientClock { pub fn connect_property_internal_clock_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::internal-clock\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _, transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -156,7 +155,7 @@ impl NetClientClock { pub fn connect_property_minimum_update_interval_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::minimum-update-interval\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::minimum-update-interval\0".as_ptr() as *const _, transmute(notify_minimum_update_interval_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -164,7 +163,7 @@ impl NetClientClock { pub fn connect_property_port_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::port\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::port\0".as_ptr() as *const _, transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -172,7 +171,7 @@ impl NetClientClock { pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::qos-dscp\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _, transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -180,7 +179,7 @@ impl NetClientClock { pub fn connect_property_round_trip_limit_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::round-trip-limit\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::round-trip-limit\0".as_ptr() as *const _, transmute(notify_round_trip_limit_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -189,6 +188,8 @@ impl NetClientClock { unsafe impl Send for NetClientClock {} unsafe impl Sync for NetClientClock {} +pub const NONE_NET_CLIENT_CLOCK: Option<&NetClientClock> = None; + unsafe extern "C" fn notify_address_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-net/src/auto/net_time_provider.rs b/gstreamer-net/src/auto/net_time_provider.rs index c87c15f63..2d63e8a1f 100644 --- a/gstreamer-net/src/auto/net_time_provider.rs +++ b/gstreamer-net/src/auto/net_time_provider.rs @@ -6,20 +6,18 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct NetTimeProvider(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct NetTimeProvider(Object) @extends gst::Object; match fn { get_type => || ffi::gst_net_time_provider_get_type(), @@ -30,21 +28,21 @@ impl NetTimeProvider { pub fn get_property_active(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"active\0".as_ptr() as *const _, Value::from(&active).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -52,7 +50,7 @@ impl NetTimeProvider { pub fn get_property_clock(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -60,7 +58,7 @@ impl NetTimeProvider { pub fn get_property_port(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -68,21 +66,21 @@ impl NetTimeProvider { pub fn get_property_qos_dscp(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::active\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _, transmute(notify_active_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -90,7 +88,7 @@ impl NetTimeProvider { pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::qos-dscp\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _, transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -99,6 +97,8 @@ impl NetTimeProvider { unsafe impl Send for NetTimeProvider {} unsafe impl Sync for NetTimeProvider {} +pub const NONE_NET_TIME_PROVIDER: Option<&NetTimeProvider> = None; + unsafe extern "C" fn notify_active_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-net/src/auto/ntp_clock.rs b/gstreamer-net/src/auto/ntp_clock.rs index d0c068064..6c2456cad 100644 --- a/gstreamer-net/src/auto/ntp_clock.rs +++ b/gstreamer-net/src/auto/ntp_clock.rs @@ -6,14 +6,9 @@ use NetClientClock; use ffi; use glib::translate::*; use gst; -use gst_ffi; glib_wrapper! { - pub struct NtpClock(Object): [ - NetClientClock, - gst::Clock => gst_ffi::GstClock, - gst::Object => gst_ffi::GstObject, - ]; + pub struct NtpClock(Object) @extends NetClientClock, gst::Clock, gst::Object; match fn { get_type => || ffi::gst_ntp_clock_get_type(), @@ -24,3 +19,5 @@ impl NtpClock {} unsafe impl Send for NtpClock {} unsafe impl Sync for NtpClock {} + +pub const NONE_NTP_CLOCK: Option<&NtpClock> = None; diff --git a/gstreamer-net/src/auto/ptp_clock.rs b/gstreamer-net/src/auto/ptp_clock.rs index be5e9638e..61d518ed7 100644 --- a/gstreamer-net/src/auto/ptp_clock.rs +++ b/gstreamer-net/src/auto/ptp_clock.rs @@ -5,21 +5,18 @@ use ffi; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct PtpClock(Object): [ - gst::Clock => gst_ffi::GstClock, - gst::Object => gst_ffi::GstObject, - ]; + pub struct PtpClock(Object) @extends gst::Clock, gst::Object; match fn { get_type => || ffi::gst_ptp_clock_get_type(), @@ -30,7 +27,7 @@ impl PtpClock { pub fn get_property_domain(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"domain\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"domain\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -38,7 +35,7 @@ impl PtpClock { pub fn get_property_grandmaster_clock_id(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"grandmaster-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"grandmaster-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -46,7 +43,7 @@ impl PtpClock { pub fn get_property_internal_clock(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -54,7 +51,7 @@ impl PtpClock { pub fn get_property_master_clock_id(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"master-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"master-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -62,7 +59,7 @@ impl PtpClock { pub fn connect_property_grandmaster_clock_id_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::grandmaster-clock-id\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::grandmaster-clock-id\0".as_ptr() as *const _, transmute(notify_grandmaster_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -70,7 +67,7 @@ impl PtpClock { pub fn connect_property_internal_clock_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::internal-clock\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _, transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -78,7 +75,7 @@ impl PtpClock { pub fn connect_property_master_clock_id_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::master-clock-id\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::master-clock-id\0".as_ptr() as *const _, transmute(notify_master_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -87,6 +84,8 @@ impl PtpClock { unsafe impl Send for PtpClock {} unsafe impl Sync for PtpClock {} +pub const NONE_PTP_CLOCK: Option<&PtpClock> = None; + unsafe extern "C" fn notify_grandmaster_clock_id_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-net/src/auto/versions.txt b/gstreamer-net/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-net/src/auto/versions.txt +++ b/gstreamer-net/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-pbutils/src/auto/discoverer.rs b/gstreamer-pbutils/src/auto/discoverer.rs index 078cf635e..5c8359967 100644 --- a/gstreamer-pbutils/src/auto/discoverer.rs +++ b/gstreamer-pbutils/src/auto/discoverer.rs @@ -6,6 +6,7 @@ use DiscovererInfo; use Error; use ffi; use glib; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -17,7 +18,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Discoverer(Object); + pub struct Discoverer(Object); match fn { get_type => || ffi::gst_discoverer_get_type(), @@ -63,7 +64,7 @@ impl Discoverer { pub fn connect_discovered) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"discovered\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"discovered\0".as_ptr() as *const _, transmute(discovered_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -71,7 +72,7 @@ impl Discoverer { pub fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"finished\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, transmute(finished_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -79,7 +80,7 @@ impl Discoverer { pub fn connect_source_setup(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"source-setup\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"source-setup\0".as_ptr() as *const _, transmute(source_setup_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -87,7 +88,7 @@ impl Discoverer { pub fn connect_starting(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"starting\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"starting\0".as_ptr() as *const _, transmute(starting_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -96,6 +97,8 @@ impl Discoverer { unsafe impl Send for Discoverer {} unsafe impl Sync for Discoverer {} +pub const NONE_DISCOVERER: Option<&Discoverer> = None; + unsafe extern "C" fn discovered_trampoline(this: *mut ffi::GstDiscoverer, info: *mut ffi::GstDiscovererInfo, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) { let f: &&(Fn(&Discoverer, &DiscovererInfo, &Option) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this), &from_glib_borrow(info), &from_glib_borrow(error)) diff --git a/gstreamer-pbutils/src/auto/discoverer_audio_info.rs b/gstreamer-pbutils/src/auto/discoverer_audio_info.rs index cdd4904ec..df708d543 100644 --- a/gstreamer-pbutils/src/auto/discoverer_audio_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_audio_info.rs @@ -8,7 +8,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct DiscovererAudioInfo(Object): DiscovererStreamInfo; + pub struct DiscovererAudioInfo(Object) @extends DiscovererStreamInfo; match fn { get_type => || ffi::gst_discoverer_audio_info_get_type(), @@ -62,3 +62,5 @@ impl DiscovererAudioInfo { unsafe impl Send for DiscovererAudioInfo {} unsafe impl Sync for DiscovererAudioInfo {} + +pub const NONE_DISCOVERER_AUDIO_INFO: Option<&DiscovererAudioInfo> = None; diff --git a/gstreamer-pbutils/src/auto/discoverer_container_info.rs b/gstreamer-pbutils/src/auto/discoverer_container_info.rs index 2beb4b1ea..66f21aa29 100644 --- a/gstreamer-pbutils/src/auto/discoverer_container_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_container_info.rs @@ -7,7 +7,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct DiscovererContainerInfo(Object): DiscovererStreamInfo; + pub struct DiscovererContainerInfo(Object) @extends DiscovererStreamInfo; match fn { get_type => || ffi::gst_discoverer_container_info_get_type(), @@ -24,3 +24,5 @@ impl DiscovererContainerInfo { unsafe impl Send for DiscovererContainerInfo {} unsafe impl Sync for DiscovererContainerInfo {} + +pub const NONE_DISCOVERER_CONTAINER_INFO: Option<&DiscovererContainerInfo> = None; diff --git a/gstreamer-pbutils/src/auto/discoverer_info.rs b/gstreamer-pbutils/src/auto/discoverer_info.rs index e69668805..af937b82e 100644 --- a/gstreamer-pbutils/src/auto/discoverer_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_info.rs @@ -13,7 +13,7 @@ use glib::translate::*; use gst; glib_wrapper! { - pub struct DiscovererInfo(Object); + pub struct DiscovererInfo(Object); match fn { get_type => || ffi::gst_discoverer_info_get_type(), @@ -32,6 +32,8 @@ impl DiscovererInfo { unsafe impl Send for DiscovererInfo {} unsafe impl Sync for DiscovererInfo {} +pub const NONE_DISCOVERER_INFO: Option<&DiscovererInfo> = None; + pub trait DiscovererInfoExt: 'static { fn copy(&self) -> DiscovererInfo; @@ -74,110 +76,110 @@ pub trait DiscovererInfoExt: 'static { impl> DiscovererInfoExt for O { fn copy(&self) -> DiscovererInfo { unsafe { - from_glib_full(ffi::gst_discoverer_info_copy(self.to_glib_none().0)) + from_glib_full(ffi::gst_discoverer_info_copy(self.as_ref().to_glib_none().0)) } } fn get_audio_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams(self.as_ref().to_glib_none().0)) } } fn get_container_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams(self.as_ref().to_glib_none().0)) } } fn get_duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_discoverer_info_get_duration(const_override(self.to_glib_none().0))) + from_glib(ffi::gst_discoverer_info_get_duration(const_override(self.as_ref().to_glib_none().0))) } } #[cfg(any(feature = "v1_14", feature = "dox"))] fn get_live(&self) -> bool { unsafe { - from_glib(ffi::gst_discoverer_info_get_live(const_override(self.to_glib_none().0))) + from_glib(ffi::gst_discoverer_info_get_live(const_override(self.as_ref().to_glib_none().0))) } } fn get_misc(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_info_get_misc(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_discoverer_info_get_misc(const_override(self.as_ref().to_glib_none().0))) } } fn get_missing_elements_installer_details(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_discoverer_info_get_missing_elements_installer_details(const_override(self.to_glib_none().0))) + FromGlibPtrContainer::from_glib_none(ffi::gst_discoverer_info_get_missing_elements_installer_details(const_override(self.as_ref().to_glib_none().0))) } } fn get_result(&self) -> DiscovererResult { unsafe { - from_glib(ffi::gst_discoverer_info_get_result(const_override(self.to_glib_none().0))) + from_glib(ffi::gst_discoverer_info_get_result(const_override(self.as_ref().to_glib_none().0))) } } fn get_seekable(&self) -> bool { unsafe { - from_glib(ffi::gst_discoverer_info_get_seekable(const_override(self.to_glib_none().0))) + from_glib(ffi::gst_discoverer_info_get_seekable(const_override(self.as_ref().to_glib_none().0))) } } fn get_stream_info(&self) -> Option { unsafe { - from_glib_full(ffi::gst_discoverer_info_get_stream_info(self.to_glib_none().0)) + from_glib_full(ffi::gst_discoverer_info_get_stream_info(self.as_ref().to_glib_none().0)) } } fn get_stream_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list(self.as_ref().to_glib_none().0)) } } fn get_streams(&self, streamtype: glib::types::Type) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams(self.to_glib_none().0, streamtype.to_glib())) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams(self.as_ref().to_glib_none().0, streamtype.to_glib())) } } fn get_subtitle_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams(self.as_ref().to_glib_none().0)) } } fn get_tags(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_info_get_tags(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_discoverer_info_get_tags(const_override(self.as_ref().to_glib_none().0))) } } fn get_toc(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_info_get_toc(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_discoverer_info_get_toc(const_override(self.as_ref().to_glib_none().0))) } } fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_info_get_uri(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_discoverer_info_get_uri(const_override(self.as_ref().to_glib_none().0))) } } fn get_video_streams(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams(self.as_ref().to_glib_none().0)) } } fn to_variant(&self, flags: DiscovererSerializeFlags) -> Option { unsafe { - from_glib_full(ffi::gst_discoverer_info_to_variant(self.to_glib_none().0, flags.to_glib())) + from_glib_full(ffi::gst_discoverer_info_to_variant(self.as_ref().to_glib_none().0, flags.to_glib())) } } } diff --git a/gstreamer-pbutils/src/auto/discoverer_stream_info.rs b/gstreamer-pbutils/src/auto/discoverer_stream_info.rs index aa95b0686..5e1fef1cb 100644 --- a/gstreamer-pbutils/src/auto/discoverer_stream_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_stream_info.rs @@ -9,7 +9,7 @@ use glib::translate::*; use gst; glib_wrapper! { - pub struct DiscovererStreamInfo(Object); + pub struct DiscovererStreamInfo(Object); match fn { get_type => || ffi::gst_discoverer_stream_info_get_type(), @@ -19,6 +19,8 @@ glib_wrapper! { unsafe impl Send for DiscovererStreamInfo {} unsafe impl Sync for DiscovererStreamInfo {} +pub const NONE_DISCOVERER_STREAM_INFO: Option<&DiscovererStreamInfo> = None; + pub trait DiscovererStreamInfoExt: 'static { fn get_caps(&self) -> Option; @@ -40,49 +42,49 @@ pub trait DiscovererStreamInfoExt: 'static { impl> DiscovererStreamInfoExt for O { fn get_caps(&self) -> Option { unsafe { - from_glib_full(ffi::gst_discoverer_stream_info_get_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_discoverer_stream_info_get_caps(self.as_ref().to_glib_none().0)) } } fn get_misc(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_stream_info_get_misc(self.to_glib_none().0)) + from_glib_none(ffi::gst_discoverer_stream_info_get_misc(self.as_ref().to_glib_none().0)) } } fn get_next(&self) -> Option { unsafe { - from_glib_full(ffi::gst_discoverer_stream_info_get_next(self.to_glib_none().0)) + from_glib_full(ffi::gst_discoverer_stream_info_get_next(self.as_ref().to_glib_none().0)) } } fn get_previous(&self) -> Option { unsafe { - from_glib_full(ffi::gst_discoverer_stream_info_get_previous(self.to_glib_none().0)) + from_glib_full(ffi::gst_discoverer_stream_info_get_previous(self.as_ref().to_glib_none().0)) } } fn get_stream_id(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id(self.to_glib_none().0)) + from_glib_none(ffi::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(ffi::gst_discoverer_stream_info_get_stream_type_nick(self.to_glib_none().0)) + from_glib_none(ffi::gst_discoverer_stream_info_get_stream_type_nick(self.as_ref().to_glib_none().0)) } } fn get_tags(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_stream_info_get_tags(self.to_glib_none().0)) + from_glib_none(ffi::gst_discoverer_stream_info_get_tags(self.as_ref().to_glib_none().0)) } } fn get_toc(&self) -> Option { unsafe { - from_glib_none(ffi::gst_discoverer_stream_info_get_toc(self.to_glib_none().0)) + from_glib_none(ffi::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 bf7288710..8dd71c71a 100644 --- a/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_subtitle_info.rs @@ -8,7 +8,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct DiscovererSubtitleInfo(Object): DiscovererStreamInfo; + pub struct DiscovererSubtitleInfo(Object) @extends DiscovererStreamInfo; match fn { get_type => || ffi::gst_discoverer_subtitle_info_get_type(), @@ -25,3 +25,5 @@ impl DiscovererSubtitleInfo { unsafe impl Send for DiscovererSubtitleInfo {} unsafe impl Sync for DiscovererSubtitleInfo {} + +pub const NONE_DISCOVERER_SUBTITLE_INFO: Option<&DiscovererSubtitleInfo> = None; diff --git a/gstreamer-pbutils/src/auto/discoverer_video_info.rs b/gstreamer-pbutils/src/auto/discoverer_video_info.rs index 6f5a412bb..6490ed820 100644 --- a/gstreamer-pbutils/src/auto/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_video_info.rs @@ -7,7 +7,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct DiscovererVideoInfo(Object): DiscovererStreamInfo; + pub struct DiscovererVideoInfo(Object) @extends DiscovererStreamInfo; match fn { get_type => || ffi::gst_discoverer_video_info_get_type(), @@ -60,3 +60,5 @@ impl DiscovererVideoInfo { unsafe impl Send for DiscovererVideoInfo {} unsafe impl Sync for DiscovererVideoInfo {} + +pub const NONE_DISCOVERER_VIDEO_INFO: Option<&DiscovererVideoInfo> = None; diff --git a/gstreamer-pbutils/src/auto/encoding_audio_profile.rs b/gstreamer-pbutils/src/auto/encoding_audio_profile.rs index 6460549e9..248934c8c 100644 --- a/gstreamer-pbutils/src/auto/encoding_audio_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_audio_profile.rs @@ -7,7 +7,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct EncodingAudioProfile(Object): EncodingProfile; + pub struct EncodingAudioProfile(Object) @extends EncodingProfile; match fn { get_type => || ffi::gst_encoding_audio_profile_get_type(), @@ -18,3 +18,5 @@ impl EncodingAudioProfile {} unsafe impl Send for EncodingAudioProfile {} unsafe impl Sync for EncodingAudioProfile {} + +pub const NONE_ENCODING_AUDIO_PROFILE: Option<&EncodingAudioProfile> = None; diff --git a/gstreamer-pbutils/src/auto/encoding_container_profile.rs b/gstreamer-pbutils/src/auto/encoding_container_profile.rs index 07219b3c7..ca9abceff 100644 --- a/gstreamer-pbutils/src/auto/encoding_container_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_container_profile.rs @@ -8,7 +8,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct EncodingContainerProfile(Object): EncodingProfile; + pub struct EncodingContainerProfile(Object) @extends EncodingProfile; match fn { get_type => || ffi::gst_encoding_container_profile_get_type(), @@ -18,6 +18,8 @@ glib_wrapper! { unsafe impl Send for EncodingContainerProfile {} unsafe impl Sync for EncodingContainerProfile {} +pub const NONE_ENCODING_CONTAINER_PROFILE: Option<&EncodingContainerProfile> = None; + pub trait EncodingContainerProfileExt: 'static { fn contains_profile>(&self, profile: &P) -> bool; @@ -27,13 +29,13 @@ pub trait EncodingContainerProfileExt: 'static { impl> EncodingContainerProfileExt for O { fn contains_profile>(&self, profile: &P) -> bool { unsafe { - from_glib(ffi::gst_encoding_container_profile_contains_profile(self.to_glib_none().0, profile.to_glib_none().0)) + from_glib(ffi::gst_encoding_container_profile_contains_profile(self.as_ref().to_glib_none().0, profile.as_ref().to_glib_none().0)) } } fn get_profiles(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_container_profile_get_profiles(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_container_profile_get_profiles(self.as_ref().to_glib_none().0)) } } } diff --git a/gstreamer-pbutils/src/auto/encoding_profile.rs b/gstreamer-pbutils/src/auto/encoding_profile.rs index ac5315ffc..dd8ca7039 100644 --- a/gstreamer-pbutils/src/auto/encoding_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_profile.rs @@ -10,7 +10,7 @@ use glib::translate::*; use gst; glib_wrapper! { - pub struct EncodingProfile(Object); + pub struct EncodingProfile(Object); match fn { get_type => || ffi::gst_encoding_profile_get_type(), @@ -21,18 +21,16 @@ impl EncodingProfile { pub fn find<'a, 'b, P: Into>, Q: Into>>(targetname: &str, profilename: P, category: Q) -> Option { assert_initialized_main_thread!(); let profilename = profilename.into(); - let profilename = profilename.to_glib_none(); let category = category.into(); - let category = category.to_glib_none(); unsafe { - from_glib_full(ffi::gst_encoding_profile_find(targetname.to_glib_none().0, profilename.0, category.0)) + from_glib_full(ffi::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 { + pub fn from_discoverer>(info: &P) -> Option { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_encoding_profile_from_discoverer(info.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_profile_from_discoverer(info.as_ref().to_glib_none().0)) } } } @@ -40,6 +38,8 @@ impl EncodingProfile { unsafe impl Send for EncodingProfile {} unsafe impl Sync for EncodingProfile {} +pub const NONE_ENCODING_PROFILE: Option<&EncodingProfile> = None; + pub trait EncodingProfileExt: 'static { fn copy(&self) -> EncodingProfile; @@ -73,85 +73,85 @@ pub trait EncodingProfileExt: 'static { impl> EncodingProfileExt for O { fn copy(&self) -> EncodingProfile { unsafe { - from_glib_full(ffi::gst_encoding_profile_copy(self.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_profile_copy(self.as_ref().to_glib_none().0)) } } fn get_allow_dynamic_output(&self) -> bool { unsafe { - from_glib(ffi::gst_encoding_profile_get_allow_dynamic_output(self.to_glib_none().0)) + from_glib(ffi::gst_encoding_profile_get_allow_dynamic_output(self.as_ref().to_glib_none().0)) } } fn get_description(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_description(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_description(self.as_ref().to_glib_none().0)) } } fn get_file_extension(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_file_extension(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_file_extension(self.as_ref().to_glib_none().0)) } } fn get_format(&self) -> gst::Caps { unsafe { - from_glib_full(ffi::gst_encoding_profile_get_format(self.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_profile_get_format(self.as_ref().to_glib_none().0)) } } fn get_input_caps(&self) -> gst::Caps { unsafe { - from_glib_full(ffi::gst_encoding_profile_get_input_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_profile_get_input_caps(self.as_ref().to_glib_none().0)) } } fn get_name(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_name(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_name(self.as_ref().to_glib_none().0)) } } fn get_presence(&self) -> u32 { unsafe { - ffi::gst_encoding_profile_get_presence(self.to_glib_none().0) + ffi::gst_encoding_profile_get_presence(self.as_ref().to_glib_none().0) } } fn get_preset(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_preset(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_preset(self.as_ref().to_glib_none().0)) } } fn get_preset_name(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_preset_name(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_preset_name(self.as_ref().to_glib_none().0)) } } fn get_restriction(&self) -> Option { unsafe { - from_glib_full(ffi::gst_encoding_profile_get_restriction(self.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_profile_get_restriction(self.as_ref().to_glib_none().0)) } } fn get_type_nick(&self) -> Option { unsafe { - from_glib_none(ffi::gst_encoding_profile_get_type_nick(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_profile_get_type_nick(self.as_ref().to_glib_none().0)) } } fn is_enabled(&self) -> bool { unsafe { - from_glib(ffi::gst_encoding_profile_is_enabled(self.to_glib_none().0)) + from_glib(ffi::gst_encoding_profile_is_enabled(self.as_ref().to_glib_none().0)) } } fn is_equal>(&self, b: &P) -> bool { unsafe { - from_glib(ffi::gst_encoding_profile_is_equal(self.to_glib_none().0, b.to_glib_none().0)) + from_glib(ffi::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 b56ce43b4..003ac26bf 100644 --- a/gstreamer-pbutils/src/auto/encoding_target.rs +++ b/gstreamer-pbutils/src/auto/encoding_target.rs @@ -12,7 +12,7 @@ use std; use std::ptr; glib_wrapper! { - pub struct EncodingTarget(Object); + pub struct EncodingTarget(Object); match fn { get_type => || ffi::gst_encoding_target_get_type(), @@ -30,10 +30,9 @@ impl EncodingTarget { pub fn load<'a, P: Into>>(name: &str, category: P) -> Result { assert_initialized_main_thread!(); let category = category.into(); - let category = category.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_encoding_target_load(name.to_glib_none().0, category.0, &mut error); + let ret = ffi::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)) } } } @@ -51,6 +50,8 @@ impl EncodingTarget { unsafe impl Send for EncodingTarget {} unsafe impl Sync for EncodingTarget {} +pub const NONE_ENCODING_TARGET: Option<&EncodingTarget> = None; + pub trait EncodingTargetExt: 'static { fn get_category(&self) -> GString; @@ -70,38 +71,38 @@ pub trait EncodingTargetExt: 'static { impl> EncodingTargetExt for O { fn get_category(&self) -> GString { unsafe { - from_glib_none(ffi::gst_encoding_target_get_category(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_target_get_category(self.as_ref().to_glib_none().0)) } } fn get_description(&self) -> GString { unsafe { - from_glib_none(ffi::gst_encoding_target_get_description(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_target_get_description(self.as_ref().to_glib_none().0)) } } fn get_name(&self) -> GString { unsafe { - from_glib_none(ffi::gst_encoding_target_get_name(self.to_glib_none().0)) + from_glib_none(ffi::gst_encoding_target_get_name(self.as_ref().to_glib_none().0)) } } fn get_profile(&self, name: &str) -> Option { unsafe { - from_glib_full(ffi::gst_encoding_target_get_profile(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::gst_encoding_target_get_profile(self.as_ref().to_glib_none().0, name.to_glib_none().0)) } } fn get_profiles(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_target_get_profiles(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_target_get_profiles(self.as_ref().to_glib_none().0)) } } fn save(&self) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::gst_encoding_target_save(self.to_glib_none().0, &mut error); + let _ = ffi::gst_encoding_target_save(self.as_ref().to_glib_none().0, &mut error); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -109,7 +110,7 @@ impl> EncodingTargetExt for O { fn save_to_file>(&self, filepath: P) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::gst_encoding_target_save_to_file(self.to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error); + let _ = ffi::gst_encoding_target_save_to_file(self.as_ref().to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error); if error.is_null() { Ok(()) } 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 501a69462..265358410 100644 --- a/gstreamer-pbutils/src/auto/encoding_video_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_video_profile.rs @@ -7,7 +7,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct EncodingVideoProfile(Object): EncodingProfile; + pub struct EncodingVideoProfile(Object) @extends EncodingProfile; match fn { get_type => || ffi::gst_encoding_video_profile_get_type(), @@ -30,3 +30,5 @@ impl EncodingVideoProfile { unsafe impl Send for EncodingVideoProfile {} unsafe impl Sync for EncodingVideoProfile {} + +pub const NONE_ENCODING_VIDEO_PROFILE: Option<&EncodingVideoProfile> = None; diff --git a/gstreamer-pbutils/src/auto/functions.rs b/gstreamer-pbutils/src/auto/functions.rs index 6dfe578e6..e3cf6f8f7 100644 --- a/gstreamer-pbutils/src/auto/functions.rs +++ b/gstreamer-pbutils/src/auto/functions.rs @@ -12,9 +12,8 @@ use std::mem; pub fn encoding_list_all_targets<'a, P: Into>>(categoryname: P) -> Vec { assert_initialized_main_thread!(); let categoryname = categoryname.into(); - let categoryname = categoryname.to_glib_none(); unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets(categoryname.0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets(categoryname.to_glib_none().0)) } } diff --git a/gstreamer-pbutils/src/auto/mod.rs b/gstreamer-pbutils/src/auto/mod.rs index aa33410ef..7c7c3bf7a 100644 --- a/gstreamer-pbutils/src/auto/mod.rs +++ b/gstreamer-pbutils/src/auto/mod.rs @@ -3,45 +3,45 @@ // DO NOT EDIT mod discoverer; -pub use self::discoverer::Discoverer; +pub use self::discoverer::{Discoverer, DiscovererClass, NONE_DISCOVERER}; mod discoverer_audio_info; -pub use self::discoverer_audio_info::DiscovererAudioInfo; +pub use self::discoverer_audio_info::{DiscovererAudioInfo, DiscovererAudioInfoClass, NONE_DISCOVERER_AUDIO_INFO}; mod discoverer_container_info; -pub use self::discoverer_container_info::DiscovererContainerInfo; +pub use self::discoverer_container_info::{DiscovererContainerInfo, DiscovererContainerInfoClass, NONE_DISCOVERER_CONTAINER_INFO}; mod discoverer_info; -pub use self::discoverer_info::DiscovererInfo; +pub use self::discoverer_info::{DiscovererInfo, DiscovererInfoClass, NONE_DISCOVERER_INFO}; pub use self::discoverer_info::DiscovererInfoExt; mod discoverer_stream_info; -pub use self::discoverer_stream_info::DiscovererStreamInfo; +pub use self::discoverer_stream_info::{DiscovererStreamInfo, DiscovererStreamInfoClass, NONE_DISCOVERER_STREAM_INFO}; pub use self::discoverer_stream_info::DiscovererStreamInfoExt; mod discoverer_subtitle_info; -pub use self::discoverer_subtitle_info::DiscovererSubtitleInfo; +pub use self::discoverer_subtitle_info::{DiscovererSubtitleInfo, DiscovererSubtitleInfoClass, NONE_DISCOVERER_SUBTITLE_INFO}; mod discoverer_video_info; -pub use self::discoverer_video_info::DiscovererVideoInfo; +pub use self::discoverer_video_info::{DiscovererVideoInfo, DiscovererVideoInfoClass, NONE_DISCOVERER_VIDEO_INFO}; mod encoding_audio_profile; -pub use self::encoding_audio_profile::EncodingAudioProfile; +pub use self::encoding_audio_profile::{EncodingAudioProfile, EncodingAudioProfileClass, NONE_ENCODING_AUDIO_PROFILE}; mod encoding_container_profile; -pub use self::encoding_container_profile::EncodingContainerProfile; +pub use self::encoding_container_profile::{EncodingContainerProfile, EncodingContainerProfileClass, NONE_ENCODING_CONTAINER_PROFILE}; pub use self::encoding_container_profile::EncodingContainerProfileExt; mod encoding_profile; -pub use self::encoding_profile::EncodingProfile; +pub use self::encoding_profile::{EncodingProfile, EncodingProfileClass, NONE_ENCODING_PROFILE}; pub use self::encoding_profile::EncodingProfileExt; mod encoding_target; -pub use self::encoding_target::EncodingTarget; +pub use self::encoding_target::{EncodingTarget, EncodingTargetClass, NONE_ENCODING_TARGET}; pub use self::encoding_target::EncodingTargetExt; mod encoding_video_profile; -pub use self::encoding_video_profile::EncodingVideoProfile; +pub use self::encoding_video_profile::{EncodingVideoProfile, EncodingVideoProfileClass, NONE_ENCODING_VIDEO_PROFILE}; mod enums; pub use self::enums::DiscovererResult; diff --git a/gstreamer-pbutils/src/auto/versions.txt b/gstreamer-pbutils/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-pbutils/src/auto/versions.txt +++ b/gstreamer-pbutils/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-player/src/auto/mod.rs b/gstreamer-player/src/auto/mod.rs index 2bea435f3..02d0fdbc4 100644 --- a/gstreamer-player/src/auto/mod.rs +++ b/gstreamer-player/src/auto/mod.rs @@ -3,36 +3,36 @@ // DO NOT EDIT mod player; -pub use self::player::Player; +pub use self::player::{Player, PlayerClass, NONE_PLAYER}; mod player_audio_info; -pub use self::player_audio_info::PlayerAudioInfo; +pub use self::player_audio_info::{PlayerAudioInfo, PlayerAudioInfoClass, NONE_PLAYER_AUDIO_INFO}; mod player_gmain_context_signal_dispatcher; -pub use self::player_gmain_context_signal_dispatcher::PlayerGMainContextSignalDispatcher; +pub use self::player_gmain_context_signal_dispatcher::{PlayerGMainContextSignalDispatcher, PlayerGMainContextSignalDispatcherClass, NONE_PLAYER_GMAIN_CONTEXT_SIGNAL_DISPATCHER}; mod player_media_info; -pub use self::player_media_info::PlayerMediaInfo; +pub use self::player_media_info::{PlayerMediaInfo, PlayerMediaInfoClass, NONE_PLAYER_MEDIA_INFO}; mod player_signal_dispatcher; -pub use self::player_signal_dispatcher::PlayerSignalDispatcher; +pub use self::player_signal_dispatcher::{PlayerSignalDispatcher, NONE_PLAYER_SIGNAL_DISPATCHER}; pub use self::player_signal_dispatcher::PlayerSignalDispatcherExt; mod player_stream_info; -pub use self::player_stream_info::PlayerStreamInfo; +pub use self::player_stream_info::{PlayerStreamInfo, PlayerStreamInfoClass, NONE_PLAYER_STREAM_INFO}; pub use self::player_stream_info::PlayerStreamInfoExt; mod player_subtitle_info; -pub use self::player_subtitle_info::PlayerSubtitleInfo; +pub use self::player_subtitle_info::{PlayerSubtitleInfo, PlayerSubtitleInfoClass, NONE_PLAYER_SUBTITLE_INFO}; mod player_video_info; -pub use self::player_video_info::PlayerVideoInfo; +pub use self::player_video_info::{PlayerVideoInfo, PlayerVideoInfoClass, NONE_PLAYER_VIDEO_INFO}; mod player_video_overlay_video_renderer; -pub use self::player_video_overlay_video_renderer::PlayerVideoOverlayVideoRenderer; +pub use self::player_video_overlay_video_renderer::{PlayerVideoOverlayVideoRenderer, PlayerVideoOverlayVideoRendererClass, NONE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER}; mod player_video_renderer; -pub use self::player_video_renderer::PlayerVideoRenderer; +pub use self::player_video_renderer::{PlayerVideoRenderer, NONE_PLAYER_VIDEO_RENDERER}; pub use self::player_video_renderer::PlayerVideoRendererExt; mod player_visualization; diff --git a/gstreamer-player/src/auto/player.rs b/gstreamer-player/src/auto/player.rs index faa3a585e..e1d74e9a6 100644 --- a/gstreamer-player/src/auto/player.rs +++ b/gstreamer-player/src/auto/player.rs @@ -16,22 +16,21 @@ use glib; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gst; -use gst_ffi; use gst_video; use libc; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Player(Object): [ - gst::Object => gst_ffi::GstObject, - ]; + pub struct Player(Object) @extends gst::Object; match fn { get_type => || ffi::gst_player_get_type(), @@ -137,9 +136,8 @@ impl Player { pub fn get_video_snapshot<'a, P: Into>>(&self, format: PlayerSnapshotFormat, config: P) -> Option { let config = config.into(); - let config = config.to_glib_none(); unsafe { - from_glib_full(ffi::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.0)) + from_glib_full(ffi::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.to_glib_none().0)) } } @@ -259,9 +257,8 @@ impl Player { pub fn set_visualization<'a, P: Into>>(&self, name: P) -> Result<(), glib::error::BoolError> { let name = name.into(); - let name = name.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_player_set_visualization(self.to_glib_none().0, name.0), "Failed to set visualization") + glib_result_from_gboolean!(ffi::gst_player_set_visualization(self.to_glib_none().0, name.to_glib_none().0), "Failed to set visualization") } } @@ -286,7 +283,7 @@ impl Player { pub fn get_property_suburi(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"suburi\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"suburi\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -294,56 +291,56 @@ impl Player { pub fn set_property_suburi<'a, P: Into>>(&self, suburi: P) { let suburi = suburi.into(); unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"suburi\0".as_ptr() as *const _, Value::from(suburi).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"video-multiview-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-multiview-flags\0".as_ptr() as *const _, Value::from(&video_multiview_flags).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"video-multiview-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-multiview-mode\0".as_ptr() as *const _, Value::from(&video_multiview_mode).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { + pub fn get_audio_streams>(info: &P) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(info.as_ref().to_glib_none().0)) } } - pub fn get_subtitle_streams(info: &PlayerMediaInfo) -> Vec { + pub fn get_subtitle_streams>(info: &P) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(info.as_ref().to_glib_none().0)) } } - pub fn get_video_streams(info: &PlayerMediaInfo) -> Vec { + pub fn get_video_streams>(info: &P) -> Vec { skip_assert_initialized!(); unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(info.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(info.as_ref().to_glib_none().0)) } } @@ -357,7 +354,7 @@ impl Player { pub fn connect_buffering(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"buffering\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"buffering\0".as_ptr() as *const _, transmute(buffering_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -365,7 +362,7 @@ impl Player { pub fn connect_end_of_stream(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"end-of-stream\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"end-of-stream\0".as_ptr() as *const _, transmute(end_of_stream_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -373,7 +370,7 @@ impl Player { pub fn connect_error(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"error\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"error\0".as_ptr() as *const _, transmute(error_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -381,7 +378,7 @@ impl Player { pub fn connect_media_info_updated(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"media-info-updated\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"media-info-updated\0".as_ptr() as *const _, transmute(media_info_updated_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -389,7 +386,7 @@ impl Player { pub fn connect_mute_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"mute-changed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"mute-changed\0".as_ptr() as *const _, transmute(mute_changed_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -397,7 +394,7 @@ impl Player { pub fn connect_state_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"state-changed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"state-changed\0".as_ptr() as *const _, transmute(state_changed_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -405,7 +402,7 @@ impl Player { pub fn connect_uri_loaded(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"uri-loaded\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"uri-loaded\0".as_ptr() as *const _, transmute(uri_loaded_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -413,7 +410,7 @@ impl Player { pub fn connect_video_dimensions_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"video-dimensions-changed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"video-dimensions-changed\0".as_ptr() as *const _, transmute(video_dimensions_changed_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -421,7 +418,7 @@ impl Player { pub fn connect_volume_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"volume-changed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"volume-changed\0".as_ptr() as *const _, transmute(volume_changed_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -429,7 +426,7 @@ impl Player { pub fn connect_warning(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"warning\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"warning\0".as_ptr() as *const _, transmute(warning_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -437,7 +434,7 @@ impl Player { pub fn connect_property_audio_video_offset_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::audio-video-offset\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::audio-video-offset\0".as_ptr() as *const _, transmute(notify_audio_video_offset_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -445,7 +442,7 @@ impl Player { pub fn connect_property_current_audio_track_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::current-audio-track\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::current-audio-track\0".as_ptr() as *const _, transmute(notify_current_audio_track_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -453,7 +450,7 @@ impl Player { pub fn connect_property_current_subtitle_track_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::current-subtitle-track\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::current-subtitle-track\0".as_ptr() as *const _, transmute(notify_current_subtitle_track_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -461,7 +458,7 @@ impl Player { pub fn connect_property_current_video_track_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::current-video-track\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::current-video-track\0".as_ptr() as *const _, transmute(notify_current_video_track_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -469,7 +466,7 @@ impl Player { pub fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::duration\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _, transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -477,7 +474,7 @@ impl Player { pub fn connect_property_media_info_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::media-info\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::media-info\0".as_ptr() as *const _, transmute(notify_media_info_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -485,7 +482,7 @@ impl Player { pub fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::mute\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _, transmute(notify_mute_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -493,7 +490,7 @@ impl Player { pub fn connect_property_pipeline_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::pipeline\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::pipeline\0".as_ptr() as *const _, transmute(notify_pipeline_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -501,7 +498,7 @@ impl Player { pub fn connect_property_position_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::position\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::position\0".as_ptr() as *const _, transmute(notify_position_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -509,7 +506,7 @@ impl Player { pub fn connect_property_rate_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::rate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::rate\0".as_ptr() as *const _, transmute(notify_rate_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -517,7 +514,7 @@ impl Player { pub fn connect_property_suburi_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::suburi\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::suburi\0".as_ptr() as *const _, transmute(notify_suburi_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -525,7 +522,7 @@ impl Player { pub fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::uri\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, transmute(notify_uri_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -533,7 +530,7 @@ impl Player { pub fn connect_property_video_multiview_flags_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::video-multiview-flags\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-flags\0".as_ptr() as *const _, transmute(notify_video_multiview_flags_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -541,7 +538,7 @@ impl Player { pub fn connect_property_video_multiview_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::video-multiview-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-mode\0".as_ptr() as *const _, transmute(notify_video_multiview_mode_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -549,7 +546,7 @@ impl Player { pub fn connect_property_volume_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::volume\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _, transmute(notify_volume_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -558,6 +555,8 @@ impl Player { unsafe impl Send for Player {} unsafe impl Sync for Player {} +pub const NONE_PLAYER: Option<&Player> = None; + unsafe extern "C" fn buffering_trampoline(this: *mut ffi::GstPlayer, object: libc::c_int, f: glib_ffi::gpointer) { let f: &&(Fn(&Player, i32) + Send + 'static) = transmute(f); f(&from_glib_borrow(this), object) diff --git a/gstreamer-player/src/auto/player_audio_info.rs b/gstreamer-player/src/auto/player_audio_info.rs index 27c5e96bd..c661ac26b 100644 --- a/gstreamer-player/src/auto/player_audio_info.rs +++ b/gstreamer-player/src/auto/player_audio_info.rs @@ -8,7 +8,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct PlayerAudioInfo(Object): PlayerStreamInfo; + pub struct PlayerAudioInfo(Object) @extends PlayerStreamInfo; match fn { get_type => || ffi::gst_player_audio_info_get_type(), @@ -49,3 +49,5 @@ impl PlayerAudioInfo { unsafe impl Send for PlayerAudioInfo {} unsafe impl Sync for PlayerAudioInfo {} + +pub const NONE_PLAYER_AUDIO_INFO: Option<&PlayerAudioInfo> = None; 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 c70a2a94a..8aca3f89f 100644 --- a/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs +++ b/gstreamer-player/src/auto/player_gmain_context_signal_dispatcher.rs @@ -7,11 +7,12 @@ use ffi; use glib; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::translate::*; use gobject_ffi; glib_wrapper! { - pub struct PlayerGMainContextSignalDispatcher(Object): PlayerSignalDispatcher; + pub struct PlayerGMainContextSignalDispatcher(Object) @implements PlayerSignalDispatcher; match fn { get_type => || ffi::gst_player_g_main_context_signal_dispatcher_get_type(), @@ -22,7 +23,7 @@ impl PlayerGMainContextSignalDispatcher { pub fn get_property_application_context(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"application-context\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"application-context\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -30,3 +31,5 @@ impl PlayerGMainContextSignalDispatcher { unsafe impl Send for PlayerGMainContextSignalDispatcher {} unsafe impl Sync for PlayerGMainContextSignalDispatcher {} + +pub const NONE_PLAYER_GMAIN_CONTEXT_SIGNAL_DISPATCHER: Option<&PlayerGMainContextSignalDispatcher> = None; diff --git a/gstreamer-player/src/auto/player_media_info.rs b/gstreamer-player/src/auto/player_media_info.rs index 044d8f7e8..fba16652a 100644 --- a/gstreamer-player/src/auto/player_media_info.rs +++ b/gstreamer-player/src/auto/player_media_info.rs @@ -12,7 +12,7 @@ use glib::translate::*; use gst; glib_wrapper! { - pub struct PlayerMediaInfo(Object); + pub struct PlayerMediaInfo(Object); match fn { get_type => || ffi::gst_player_media_info_get_type(), @@ -119,3 +119,5 @@ impl PlayerMediaInfo { unsafe impl Send for PlayerMediaInfo {} unsafe impl Sync for PlayerMediaInfo {} + +pub const NONE_PLAYER_MEDIA_INFO: Option<&PlayerMediaInfo> = None; diff --git a/gstreamer-player/src/auto/player_signal_dispatcher.rs b/gstreamer-player/src/auto/player_signal_dispatcher.rs index 5bf94486e..c27c87a57 100644 --- a/gstreamer-player/src/auto/player_signal_dispatcher.rs +++ b/gstreamer-player/src/auto/player_signal_dispatcher.rs @@ -7,7 +7,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct PlayerSignalDispatcher(Object); + pub struct PlayerSignalDispatcher(Interface); match fn { get_type => || ffi::gst_player_signal_dispatcher_get_type(), @@ -17,6 +17,8 @@ glib_wrapper! { unsafe impl Send for PlayerSignalDispatcher {} unsafe impl Sync for PlayerSignalDispatcher {} +pub const NONE_PLAYER_SIGNAL_DISPATCHER: Option<&PlayerSignalDispatcher> = None; + pub trait PlayerSignalDispatcherExt: 'static {} impl> PlayerSignalDispatcherExt for O {} diff --git a/gstreamer-player/src/auto/player_stream_info.rs b/gstreamer-player/src/auto/player_stream_info.rs index be8c46e1d..e8724ea46 100644 --- a/gstreamer-player/src/auto/player_stream_info.rs +++ b/gstreamer-player/src/auto/player_stream_info.rs @@ -9,7 +9,7 @@ use glib::translate::*; use gst; glib_wrapper! { - pub struct PlayerStreamInfo(Object); + pub struct PlayerStreamInfo(Object); match fn { get_type => || ffi::gst_player_stream_info_get_type(), @@ -19,6 +19,8 @@ glib_wrapper! { unsafe impl Send for PlayerStreamInfo {} unsafe impl Sync for PlayerStreamInfo {} +pub const NONE_PLAYER_STREAM_INFO: Option<&PlayerStreamInfo> = None; + pub trait PlayerStreamInfoExt: 'static { fn get_caps(&self) -> Option; @@ -34,31 +36,31 @@ pub trait PlayerStreamInfoExt: 'static { impl> PlayerStreamInfoExt for O { fn get_caps(&self) -> Option { unsafe { - from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(self.as_ref().to_glib_none().0))) } } fn get_codec(&self) -> Option { unsafe { - from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(self.to_glib_none().0))) + from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(self.as_ref().to_glib_none().0))) } } fn get_index(&self) -> i32 { unsafe { - ffi::gst_player_stream_info_get_index(const_override(self.to_glib_none().0)) + ffi::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(ffi::gst_player_stream_info_get_stream_type(const_override(self.to_glib_none().0))) + from_glib_none(ffi::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(ffi::gst_player_stream_info_get_tags(const_override(self.to_glib_none().0))) + from_glib_none(ffi::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 51d5a5c17..dabd9a261 100644 --- a/gstreamer-player/src/auto/player_subtitle_info.rs +++ b/gstreamer-player/src/auto/player_subtitle_info.rs @@ -8,7 +8,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct PlayerSubtitleInfo(Object): PlayerStreamInfo; + pub struct PlayerSubtitleInfo(Object) @extends PlayerStreamInfo; match fn { get_type => || ffi::gst_player_subtitle_info_get_type(), @@ -25,3 +25,5 @@ impl PlayerSubtitleInfo { unsafe impl Send for PlayerSubtitleInfo {} unsafe impl Sync for PlayerSubtitleInfo {} + +pub const NONE_PLAYER_SUBTITLE_INFO: Option<&PlayerSubtitleInfo> = None; diff --git a/gstreamer-player/src/auto/player_video_info.rs b/gstreamer-player/src/auto/player_video_info.rs index d3337e2b8..9146def5d 100644 --- a/gstreamer-player/src/auto/player_video_info.rs +++ b/gstreamer-player/src/auto/player_video_info.rs @@ -7,7 +7,7 @@ use ffi; use glib::translate::*; glib_wrapper! { - pub struct PlayerVideoInfo(Object): PlayerStreamInfo; + pub struct PlayerVideoInfo(Object) @extends PlayerStreamInfo; match fn { get_type => || ffi::gst_player_video_info_get_type(), @@ -42,3 +42,5 @@ impl PlayerVideoInfo { unsafe impl Send for PlayerVideoInfo {} unsafe impl Sync for PlayerVideoInfo {} + +pub const NONE_PLAYER_VIDEO_INFO: Option<&PlayerVideoInfo> = None; 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 b3451ca4e..8e7d90603 100644 --- a/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs @@ -8,6 +8,7 @@ use glib; use glib::StaticType; use glib::Value; use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -19,7 +20,7 @@ use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct PlayerVideoOverlayVideoRenderer(Object): PlayerVideoRenderer; + pub struct PlayerVideoOverlayVideoRenderer(Object) @implements PlayerVideoRenderer; match fn { get_type => || ffi::gst_player_video_overlay_video_renderer_get_type(), @@ -61,14 +62,14 @@ impl PlayerVideoOverlayVideoRenderer { pub fn get_property_video_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } pub fn set_property_video_sink + glib::value::SetValueOptional>(&self, video_sink: Option<&P>) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0); } } @@ -83,7 +84,7 @@ impl PlayerVideoOverlayVideoRenderer { pub fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::video-sink\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _, transmute(notify_video_sink_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -91,7 +92,7 @@ impl PlayerVideoOverlayVideoRenderer { pub fn connect_property_window_handle_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::window-handle\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::window-handle\0".as_ptr() as *const _, transmute(notify_window_handle_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -100,6 +101,8 @@ impl PlayerVideoOverlayVideoRenderer { unsafe impl Send for PlayerVideoOverlayVideoRenderer {} unsafe impl Sync for PlayerVideoOverlayVideoRenderer {} +pub const NONE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER: Option<&PlayerVideoOverlayVideoRenderer> = None; + unsafe extern "C" fn notify_video_sink_trampoline(this: *mut ffi::GstPlayerVideoOverlayVideoRenderer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-player/src/auto/player_video_renderer.rs b/gstreamer-player/src/auto/player_video_renderer.rs index 1ec0f98fa..4b83d0639 100644 --- a/gstreamer-player/src/auto/player_video_renderer.rs +++ b/gstreamer-player/src/auto/player_video_renderer.rs @@ -7,7 +7,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct PlayerVideoRenderer(Object); + pub struct PlayerVideoRenderer(Interface); match fn { get_type => || ffi::gst_player_video_renderer_get_type(), @@ -17,6 +17,8 @@ glib_wrapper! { unsafe impl Send for PlayerVideoRenderer {} unsafe impl Sync for PlayerVideoRenderer {} +pub const NONE_PLAYER_VIDEO_RENDERER: Option<&PlayerVideoRenderer> = None; + pub trait PlayerVideoRendererExt: 'static {} impl> PlayerVideoRendererExt for O {} diff --git a/gstreamer-player/src/auto/versions.txt b/gstreamer-player/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-player/src/auto/versions.txt +++ b/gstreamer-player/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-rtsp-server/src/auto/mod.rs b/gstreamer-rtsp-server/src/auto/mod.rs index e3e7d2f9e..bcaccc139 100644 --- a/gstreamer-rtsp-server/src/auto/mod.rs +++ b/gstreamer-rtsp-server/src/auto/mod.rs @@ -3,59 +3,59 @@ // DO NOT EDIT mod rtsp_address_pool; -pub use self::rtsp_address_pool::RTSPAddressPool; +pub use self::rtsp_address_pool::{RTSPAddressPool, RTSPAddressPoolClass, NONE_RTSP_ADDRESS_POOL}; pub use self::rtsp_address_pool::RTSPAddressPoolExt; mod rtsp_auth; -pub use self::rtsp_auth::RTSPAuth; +pub use self::rtsp_auth::{RTSPAuth, RTSPAuthClass, NONE_RTSP_AUTH}; pub use self::rtsp_auth::RTSPAuthExt; mod rtsp_client; -pub use self::rtsp_client::RTSPClient; +pub use self::rtsp_client::{RTSPClient, RTSPClientClass, NONE_RTSP_CLIENT}; pub use self::rtsp_client::RTSPClientExt; mod rtsp_media; -pub use self::rtsp_media::RTSPMedia; +pub use self::rtsp_media::{RTSPMedia, RTSPMediaClass, NONE_RTSP_MEDIA}; pub use self::rtsp_media::RTSPMediaExt; mod rtsp_media_factory; -pub use self::rtsp_media_factory::RTSPMediaFactory; +pub use self::rtsp_media_factory::{RTSPMediaFactory, RTSPMediaFactoryClass, NONE_RTSP_MEDIA_FACTORY}; pub use self::rtsp_media_factory::RTSPMediaFactoryExt; mod rtsp_media_factory_uri; -pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURI; +pub use self::rtsp_media_factory_uri::{RTSPMediaFactoryURI, RTSPMediaFactoryURIClass, NONE_RTSP_MEDIA_FACTORY_URI}; pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURIExt; mod rtsp_mount_points; -pub use self::rtsp_mount_points::RTSPMountPoints; +pub use self::rtsp_mount_points::{RTSPMountPoints, RTSPMountPointsClass, NONE_RTSP_MOUNT_POINTS}; pub use self::rtsp_mount_points::RTSPMountPointsExt; mod rtsp_server; -pub use self::rtsp_server::RTSPServer; +pub use self::rtsp_server::{RTSPServer, RTSPServerClass, NONE_RTSP_SERVER}; pub use self::rtsp_server::RTSPServerExt; mod rtsp_session; -pub use self::rtsp_session::RTSPSession; +pub use self::rtsp_session::{RTSPSession, RTSPSessionClass, NONE_RTSP_SESSION}; pub use self::rtsp_session::RTSPSessionExt; mod rtsp_session_media; -pub use self::rtsp_session_media::RTSPSessionMedia; +pub use self::rtsp_session_media::{RTSPSessionMedia, RTSPSessionMediaClass, NONE_RTSP_SESSION_MEDIA}; pub use self::rtsp_session_media::RTSPSessionMediaExt; mod rtsp_session_pool; -pub use self::rtsp_session_pool::RTSPSessionPool; +pub use self::rtsp_session_pool::{RTSPSessionPool, RTSPSessionPoolClass, NONE_RTSP_SESSION_POOL}; pub use self::rtsp_session_pool::RTSPSessionPoolExt; mod rtsp_stream; -pub use self::rtsp_stream::RTSPStream; +pub use self::rtsp_stream::{RTSPStream, RTSPStreamClass, NONE_RTSP_STREAM}; pub use self::rtsp_stream::RTSPStreamExt; mod rtsp_stream_transport; -pub use self::rtsp_stream_transport::RTSPStreamTransport; +pub use self::rtsp_stream_transport::{RTSPStreamTransport, RTSPStreamTransportClass, NONE_RTSP_STREAM_TRANSPORT}; pub use self::rtsp_stream_transport::RTSPStreamTransportExt; mod rtsp_thread_pool; -pub use self::rtsp_thread_pool::RTSPThreadPool; +pub use self::rtsp_thread_pool::{RTSPThreadPool, RTSPThreadPoolClass, NONE_RTSP_THREAD_POOL}; pub use self::rtsp_thread_pool::RTSPThreadPoolExt; mod rtsp_address; diff --git a/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs index 4fa8a67be..41e1ffd1f 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_address_pool.rs @@ -10,7 +10,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct RTSPAddressPool(Object); + pub struct RTSPAddressPool(Object); match fn { get_type => || ffi::gst_rtsp_address_pool_get_type(), @@ -35,6 +35,8 @@ impl Default for RTSPAddressPool { unsafe impl Send for RTSPAddressPool {} unsafe impl Sync for RTSPAddressPool {} +pub const NONE_RTSP_ADDRESS_POOL: Option<&RTSPAddressPool> = None; + pub trait RTSPAddressPoolExt: 'static { fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option; @@ -50,31 +52,31 @@ pub trait RTSPAddressPoolExt: 'static { impl> RTSPAddressPoolExt for O { fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_address_pool_acquire_address(self.to_glib_none().0, flags.to_glib(), n_ports)) + from_glib_full(ffi::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> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_address_pool_add_range(self.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!(ffi::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") } } fn clear(&self) { unsafe { - ffi::gst_rtsp_address_pool_clear(self.to_glib_none().0); + ffi::gst_rtsp_address_pool_clear(self.as_ref().to_glib_none().0); } } fn dump(&self) { unsafe { - ffi::gst_rtsp_address_pool_dump(self.to_glib_none().0); + ffi::gst_rtsp_address_pool_dump(self.as_ref().to_glib_none().0); } } fn has_unicast_addresses(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_address_pool_has_unicast_addresses(self.to_glib_none().0)) + from_glib(ffi::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 073289ebb..4e9152c72 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_auth.rs @@ -7,7 +7,7 @@ use ffi; use gio; use gio_ffi; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -19,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPAuth(Object); + pub struct RTSPAuth(Object); match fn { get_type => || ffi::gst_rtsp_auth_get_type(), @@ -58,6 +58,8 @@ impl Default for RTSPAuth { unsafe impl Send for RTSPAuth {} unsafe impl Sync for RTSPAuth {} +pub const NONE_RTSP_AUTH: Option<&RTSPAuth> = None; + pub trait RTSPAuthExt: 'static { fn add_basic(&self, basic: &str, token: &RTSPToken); @@ -85,7 +87,7 @@ pub trait RTSPAuthExt: 'static { fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode); - fn set_tls_certificate<'a, P: Into>>(&self, cert: P); + fn set_tls_certificate<'a, P: IsA + 'a, Q: Into>>(&self, cert: Q); fn set_tls_database<'a, P: IsA + 'a, Q: Into>>(&self, database: Q); @@ -95,94 +97,92 @@ pub trait RTSPAuthExt: 'static { impl> RTSPAuthExt for O { fn add_basic(&self, basic: &str, token: &RTSPToken) { unsafe { - ffi::gst_rtsp_auth_add_basic(self.to_glib_none().0, basic.to_glib_none().0, token.to_glib_none().0); + ffi::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 { - ffi::gst_rtsp_auth_add_digest(self.to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none().0); + ffi::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(ffi::gst_rtsp_auth_get_default_token(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_auth_get_default_token(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(ffi::gst_rtsp_auth_get_supported_methods(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_auth_get_supported_methods(self.as_ref().to_glib_none().0)) } } fn get_tls_authentication_mode(&self) -> gio::TlsAuthenticationMode { unsafe { - from_glib(ffi::gst_rtsp_auth_get_tls_authentication_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_auth_get_tls_authentication_mode(self.as_ref().to_glib_none().0)) } } fn get_tls_certificate(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_auth_get_tls_certificate(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_auth_get_tls_certificate(self.as_ref().to_glib_none().0)) } } fn get_tls_database(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_auth_get_tls_database(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_auth_get_tls_database(self.as_ref().to_glib_none().0)) } } fn remove_basic(&self, basic: &str) { unsafe { - ffi::gst_rtsp_auth_remove_basic(self.to_glib_none().0, basic.to_glib_none().0); + ffi::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 { - ffi::gst_rtsp_auth_remove_digest(self.to_glib_none().0, user.to_glib_none().0); + ffi::gst_rtsp_auth_remove_digest(self.as_ref().to_glib_none().0, user.to_glib_none().0); } } #[cfg(any(feature = "v1_12", feature = "dox"))] fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod) { unsafe { - ffi::gst_rtsp_auth_set_supported_methods(self.to_glib_none().0, methods.to_glib()); + ffi::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 { - ffi::gst_rtsp_auth_set_tls_authentication_mode(self.to_glib_none().0, mode.to_glib()); + ffi::gst_rtsp_auth_set_tls_authentication_mode(self.as_ref().to_glib_none().0, mode.to_glib()); } } - fn set_tls_certificate<'a, P: Into>>(&self, cert: P) { + fn set_tls_certificate<'a, P: IsA + 'a, Q: Into>>(&self, cert: Q) { let cert = cert.into(); - let cert = cert.to_glib_none(); unsafe { - ffi::gst_rtsp_auth_set_tls_certificate(self.to_glib_none().0, cert.0); + ffi::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<'a, P: IsA + 'a, Q: Into>>(&self, database: Q) { let database = database.into(); - let database = database.to_glib_none(); unsafe { - ffi::gst_rtsp_auth_set_tls_database(self.to_glib_none().0, database.0); + ffi::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 { let f: Box_ bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"accept-certificate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _, transmute(accept_certificate_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -191,5 +191,5 @@ impl> RTSPAuthExt for O { unsafe extern "C" fn accept_certificate_trampoline

(this: *mut ffi::GstRTSPAuth, connection: *mut gio_ffi::GTlsConnection, peer_cert: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { let f: &&(Fn(&P, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static) = transmute(f); - f(&RTSPAuth::from_glib_borrow(this).downcast_unchecked(), &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() } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_client.rs b/gstreamer-rtsp-server/src/auto/rtsp_client.rs index 581d1ce36..0e0560331 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_client.rs @@ -11,7 +11,7 @@ use RTSPThreadPool; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -26,7 +26,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPClient(Object); + pub struct RTSPClient(Object); match fn { get_type => || ffi::gst_rtsp_client_get_type(), @@ -51,6 +51,8 @@ impl Default for RTSPClient { unsafe impl Send for RTSPClient {} unsafe impl Sync for RTSPClient {} +pub const NONE_RTSP_CLIENT: Option<&RTSPClient> = None; + pub trait RTSPClientExt: 'static { fn close(&self); @@ -66,21 +68,21 @@ pub trait RTSPClientExt: 'static { //fn handle_message(&self, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; - //fn send_message<'a, P: Into>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; + //fn send_message<'a, P: IsA + 'a, Q: Into>>(&self, session: Q, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; //fn session_filter<'a, P: Into>, Q: Into>>(&self, func: P, user_data: Q) -> Vec; - fn set_auth<'a, P: Into>>(&self, auth: P); + fn set_auth<'a, P: IsA + 'a, Q: Into>>(&self, auth: Q); //fn set_connection(&self, conn: /*Ignored*/&mut gst_rtsp::RTSPConnection) -> bool; - fn set_mount_points<'a, P: Into>>(&self, mounts: P); + fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q); //fn set_send_func<'a, P: Into>>(&self, func: /*Unknown conversion*//*Unimplemented*/RTSPClientSendFunc, notify: P); - fn set_session_pool<'a, P: Into>>(&self, pool: P); + fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); - fn set_thread_pool<'a, P: Into>>(&self, pool: P); + fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn get_property_drop_backlog(&self) -> bool; @@ -156,13 +158,13 @@ pub trait RTSPClientExt: 'static { impl> RTSPClientExt for O { fn close(&self) { unsafe { - ffi::gst_rtsp_client_close(self.to_glib_none().0); + ffi::gst_rtsp_client_close(self.as_ref().to_glib_none().0); } } fn get_auth(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_client_get_auth(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_client_get_auth(self.as_ref().to_glib_none().0)) } } @@ -172,19 +174,19 @@ impl> RTSPClientExt for O { fn get_mount_points(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_client_get_mount_points(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_client_get_mount_points(self.as_ref().to_glib_none().0)) } } fn get_session_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_client_get_session_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_client_get_session_pool(self.as_ref().to_glib_none().0)) } } fn get_thread_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_client_get_thread_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_client_get_thread_pool(self.as_ref().to_glib_none().0)) } } @@ -192,7 +194,7 @@ impl> RTSPClientExt for O { // unsafe { TODO: call ffi::gst_rtsp_client_handle_message() } //} - //fn send_message<'a, P: Into>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult { + //fn send_message<'a, P: IsA + 'a, Q: Into>>(&self, session: Q, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult { // unsafe { TODO: call ffi::gst_rtsp_client_send_message() } //} @@ -200,11 +202,10 @@ impl> RTSPClientExt for O { // unsafe { TODO: call ffi::gst_rtsp_client_session_filter() } //} - fn set_auth<'a, P: Into>>(&self, auth: P) { + fn set_auth<'a, P: IsA + 'a, Q: Into>>(&self, auth: Q) { let auth = auth.into(); - let auth = auth.to_glib_none(); unsafe { - ffi::gst_rtsp_client_set_auth(self.to_glib_none().0, auth.0); + ffi::gst_rtsp_client_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0); } } @@ -212,11 +213,10 @@ impl> RTSPClientExt for O { // unsafe { TODO: call ffi::gst_rtsp_client_set_connection() } //} - fn set_mount_points<'a, P: Into>>(&self, mounts: P) { + fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q) { let mounts = mounts.into(); - let mounts = mounts.to_glib_none(); unsafe { - ffi::gst_rtsp_client_set_mount_points(self.to_glib_none().0, mounts.0); + ffi::gst_rtsp_client_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0); } } @@ -224,19 +224,17 @@ impl> RTSPClientExt for O { // unsafe { TODO: call ffi::gst_rtsp_client_set_send_func() } //} - fn set_session_pool<'a, P: Into>>(&self, pool: P) { + fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_client_set_session_pool(self.to_glib_none().0, pool.0); + ffi::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<'a, P: Into>>(&self, pool: P) { + fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_client_set_thread_pool(self.to_glib_none().0, pool.0); + ffi::gst_rtsp_client_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } @@ -257,7 +255,7 @@ impl> RTSPClientExt for O { fn connect_announce_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"announce-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"announce-request\0".as_ptr() as *const _, transmute(announce_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -269,7 +267,7 @@ impl> RTSPClientExt for O { fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"closed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _, transmute(closed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -277,7 +275,7 @@ impl> RTSPClientExt for O { fn connect_describe_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"describe-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"describe-request\0".as_ptr() as *const _, transmute(describe_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -285,7 +283,7 @@ impl> RTSPClientExt for O { fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"get-parameter-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"get-parameter-request\0".as_ptr() as *const _, transmute(get_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -293,7 +291,7 @@ impl> RTSPClientExt for O { fn connect_handle_response(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"handle-response\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"handle-response\0".as_ptr() as *const _, transmute(handle_response_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -301,7 +299,7 @@ impl> RTSPClientExt for O { fn connect_new_session(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"new-session\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"new-session\0".as_ptr() as *const _, transmute(new_session_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -309,7 +307,7 @@ impl> RTSPClientExt for O { fn connect_options_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"options-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"options-request\0".as_ptr() as *const _, transmute(options_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -317,7 +315,7 @@ impl> RTSPClientExt for O { fn connect_pause_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pause-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pause-request\0".as_ptr() as *const _, transmute(pause_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -325,7 +323,7 @@ impl> RTSPClientExt for O { fn connect_play_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"play-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"play-request\0".as_ptr() as *const _, transmute(play_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -334,7 +332,7 @@ impl> RTSPClientExt for O { fn connect_pre_announce_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-announce-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-announce-request\0".as_ptr() as *const _, transmute(pre_announce_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -343,7 +341,7 @@ impl> RTSPClientExt for O { fn connect_pre_describe_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-describe-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-describe-request\0".as_ptr() as *const _, transmute(pre_describe_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -352,7 +350,7 @@ impl> RTSPClientExt for O { fn connect_pre_get_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-get-parameter-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-get-parameter-request\0".as_ptr() as *const _, transmute(pre_get_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -361,7 +359,7 @@ impl> RTSPClientExt for O { fn connect_pre_options_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-options-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-options-request\0".as_ptr() as *const _, transmute(pre_options_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -370,7 +368,7 @@ impl> RTSPClientExt for O { fn connect_pre_pause_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-pause-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-pause-request\0".as_ptr() as *const _, transmute(pre_pause_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -379,7 +377,7 @@ impl> RTSPClientExt for O { fn connect_pre_play_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-play-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-play-request\0".as_ptr() as *const _, transmute(pre_play_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -388,7 +386,7 @@ impl> RTSPClientExt for O { fn connect_pre_record_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-record-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-record-request\0".as_ptr() as *const _, transmute(pre_record_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -397,7 +395,7 @@ impl> RTSPClientExt for O { fn connect_pre_set_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-set-parameter-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-set-parameter-request\0".as_ptr() as *const _, transmute(pre_set_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -406,7 +404,7 @@ impl> RTSPClientExt for O { fn connect_pre_setup_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-setup-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-setup-request\0".as_ptr() as *const _, transmute(pre_setup_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -415,7 +413,7 @@ impl> RTSPClientExt for O { fn connect_pre_teardown_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pre-teardown-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pre-teardown-request\0".as_ptr() as *const _, transmute(pre_teardown_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -423,7 +421,7 @@ impl> RTSPClientExt for O { fn connect_record_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"record-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"record-request\0".as_ptr() as *const _, transmute(record_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -435,7 +433,7 @@ impl> RTSPClientExt for O { fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"set-parameter-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"set-parameter-request\0".as_ptr() as *const _, transmute(set_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -443,7 +441,7 @@ impl> RTSPClientExt for O { fn connect_setup_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"setup-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"setup-request\0".as_ptr() as *const _, transmute(setup_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -451,7 +449,7 @@ impl> RTSPClientExt for O { fn connect_teardown_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"teardown-request\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"teardown-request\0".as_ptr() as *const _, transmute(teardown_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -459,7 +457,7 @@ impl> RTSPClientExt for O { fn connect_property_drop_backlog_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::drop-backlog\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::drop-backlog\0".as_ptr() as *const _, transmute(notify_drop_backlog_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -467,7 +465,7 @@ impl> RTSPClientExt for O { fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mount-points\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _, transmute(notify_mount_points_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -475,7 +473,7 @@ impl> RTSPClientExt for O { fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::session-pool\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _, transmute(notify_session_pool_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -484,165 +482,165 @@ impl> RTSPClientExt for O { unsafe extern "C" fn announce_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn closed_trampoline

(this: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn describe_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn get_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn handle_response_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn new_session_trampoline

(this: *mut ffi::GstRTSPClient, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn options_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn pause_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn play_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_announce_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_describe_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_get_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_options_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_pause_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_play_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_record_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_set_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_setup_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } #[cfg(any(feature = "v1_12", feature = "dox"))] unsafe extern "C" fn pre_teardown_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode where P: IsA { let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib() } unsafe extern "C" fn record_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn set_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn setup_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn teardown_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)) } unsafe extern "C" fn notify_drop_backlog_trampoline

(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mount_points_trampoline

(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_session_pool_trampoline

(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPClient::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_media.rs index 48a321512..554fd1ccb 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media.rs @@ -13,7 +13,7 @@ use glib; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -27,7 +27,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPMedia(Object); + pub struct RTSPMedia(Object); match fn { get_type => || ffi::gst_rtsp_media_get_type(), @@ -38,7 +38,7 @@ impl RTSPMedia { pub fn new>(element: &P) -> RTSPMedia { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_rtsp_media_new(element.to_glib_full())) + from_glib_full(ffi::gst_rtsp_media_new(element.as_ref().to_glib_full())) } } } @@ -46,6 +46,8 @@ impl RTSPMedia { unsafe impl Send for RTSPMedia {} unsafe impl Sync for RTSPMedia {} +pub const NONE_RTSP_MEDIA: Option<&RTSPMedia> = None; + pub trait RTSPMediaExt: 'static { fn collect_streams(&self); @@ -113,7 +115,7 @@ pub trait RTSPMediaExt: 'static { //fn seekable(&self) -> /*Ignored*/gst::ClockTimeDiff; - fn set_address_pool<'a, P: Into>>(&self, pool: P); + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn set_buffer_size(&self, size: u32); @@ -153,7 +155,7 @@ pub trait RTSPMediaExt: 'static { fn suspend(&self) -> Result<(), glib::error::BoolError>; - fn take_pipeline(&self, pipeline: &gst::Pipeline); + fn take_pipeline>(&self, pipeline: &P); fn unprepare(&self) -> Result<(), glib::error::BoolError>; @@ -211,7 +213,7 @@ pub trait RTSPMediaExt: 'static { impl> RTSPMediaExt for O { fn collect_streams(&self) { unsafe { - ffi::gst_rtsp_media_collect_streams(self.to_glib_none().0); + ffi::gst_rtsp_media_collect_streams(self.as_ref().to_glib_none().0); } } @@ -221,55 +223,55 @@ impl> RTSPMediaExt for O { fn create_stream, Q: IsA>(&self, payloader: &P, pad: &Q) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_media_create_stream(self.to_glib_none().0, payloader.to_glib_none().0, pad.to_glib_none().0)) + from_glib_none(ffi::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(ffi::gst_rtsp_media_find_stream(self.to_glib_none().0, control.to_glib_none().0)) + from_glib_none(ffi::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(ffi::gst_rtsp_media_get_address_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_get_address_pool(self.as_ref().to_glib_none().0)) } } fn get_base_time(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_rtsp_media_get_base_time(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_base_time(self.as_ref().to_glib_none().0)) } } fn get_buffer_size(&self) -> u32 { unsafe { - ffi::gst_rtsp_media_get_buffer_size(self.to_glib_none().0) + ffi::gst_rtsp_media_get_buffer_size(self.as_ref().to_glib_none().0) } } fn get_clock(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_get_clock(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_get_clock(self.as_ref().to_glib_none().0)) } } fn get_element(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_get_element(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_get_element(self.as_ref().to_glib_none().0)) } } fn get_latency(&self) -> u32 { unsafe { - ffi::gst_rtsp_media_get_latency(self.to_glib_none().0) + ffi::gst_rtsp_media_get_latency(self.as_ref().to_glib_none().0) } } fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_get_multicast_iface(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_get_multicast_iface(self.as_ref().to_glib_none().0)) } } @@ -279,49 +281,49 @@ impl> RTSPMediaExt for O { fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(ffi::gst_rtsp_media_get_profiles(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_profiles(self.as_ref().to_glib_none().0)) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(ffi::gst_rtsp_media_get_protocols(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_protocols(self.as_ref().to_glib_none().0)) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(ffi::gst_rtsp_media_get_publish_clock_mode(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_rtsp_media_get_range_string(self.to_glib_none().0, play.to_glib(), unit.to_glib())) + from_glib_full(ffi::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(ffi::gst_rtsp_media_get_retransmission_time(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_retransmission_time(self.as_ref().to_glib_none().0)) } } fn get_status(&self) -> RTSPMediaStatus { unsafe { - from_glib(ffi::gst_rtsp_media_get_status(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_status(self.as_ref().to_glib_none().0)) } } fn get_stream(&self, idx: u32) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_media_get_stream(self.to_glib_none().0, idx)) + from_glib_none(ffi::gst_rtsp_media_get_stream(self.as_ref().to_glib_none().0, idx)) } } fn get_suspend_mode(&self) -> RTSPSuspendMode { unsafe { - from_glib(ffi::gst_rtsp_media_get_suspend_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_suspend_mode(self.as_ref().to_glib_none().0)) } } @@ -331,7 +333,7 @@ impl> RTSPMediaExt for O { fn get_transport_mode(&self) -> RTSPTransportMode { unsafe { - from_glib(ffi::gst_rtsp_media_get_transport_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_get_transport_mode(self.as_ref().to_glib_none().0)) } } @@ -341,37 +343,37 @@ impl> RTSPMediaExt for O { fn is_eos_shutdown(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_is_eos_shutdown(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_is_eos_shutdown(self.as_ref().to_glib_none().0)) } } fn is_reusable(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_is_reusable(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_is_reusable(self.as_ref().to_glib_none().0)) } } fn is_shared(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_is_shared(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_is_shared(self.as_ref().to_glib_none().0)) } } fn is_stop_on_disconnect(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_is_stop_on_disconnect(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_is_stop_on_disconnect(self.as_ref().to_glib_none().0)) } } fn is_time_provider(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_is_time_provider(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_is_time_provider(self.as_ref().to_glib_none().0)) } } fn n_streams(&self) -> u32 { unsafe { - ffi::gst_rtsp_media_n_streams(self.to_glib_none().0) + ffi::gst_rtsp_media_n_streams(self.as_ref().to_glib_none().0) } } @@ -391,45 +393,42 @@ impl> RTSPMediaExt for O { // unsafe { TODO: call ffi::gst_rtsp_media_seekable() } //} - fn set_address_pool<'a, P: Into>>(&self, pool: P) { + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_media_set_address_pool(self.to_glib_none().0, pool.0); + ffi::gst_rtsp_media_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } fn set_buffer_size(&self, size: u32) { unsafe { - ffi::gst_rtsp_media_set_buffer_size(self.to_glib_none().0, size); + ffi::gst_rtsp_media_set_buffer_size(self.as_ref().to_glib_none().0, size); } } fn set_clock<'a, P: IsA + 'a, Q: Into>>(&self, clock: Q) { let clock = clock.into(); - let clock = clock.to_glib_none(); unsafe { - ffi::gst_rtsp_media_set_clock(self.to_glib_none().0, clock.0); + ffi::gst_rtsp_media_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0); } } fn set_eos_shutdown(&self, eos_shutdown: bool) { unsafe { - ffi::gst_rtsp_media_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib()); + ffi::gst_rtsp_media_set_eos_shutdown(self.as_ref().to_glib_none().0, eos_shutdown.to_glib()); } } fn set_latency(&self, latency: u32) { unsafe { - ffi::gst_rtsp_media_set_latency(self.to_glib_none().0, latency); + ffi::gst_rtsp_media_set_latency(self.as_ref().to_glib_none().0, latency); } } fn set_multicast_iface<'a, P: Into>>(&self, multicast_iface: P) { let multicast_iface = multicast_iface.into(); - let multicast_iface = multicast_iface.to_glib_none(); unsafe { - ffi::gst_rtsp_media_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); + ffi::gst_rtsp_media_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0); } } @@ -439,43 +438,43 @@ impl> RTSPMediaExt for O { fn set_pipeline_state(&self, state: gst::State) { unsafe { - ffi::gst_rtsp_media_set_pipeline_state(self.to_glib_none().0, state.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_set_profiles(self.to_glib_none().0, profiles.to_glib()); + ffi::gst_rtsp_media_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib()); } } fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { unsafe { - ffi::gst_rtsp_media_set_protocols(self.to_glib_none().0, protocols.to_glib()); + ffi::gst_rtsp_media_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib()); } } fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { unsafe { - ffi::gst_rtsp_media_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_set_retransmission_time(self.to_glib_none().0, time.to_glib()); + ffi::gst_rtsp_media_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); } } fn set_reusable(&self, reusable: bool) { unsafe { - ffi::gst_rtsp_media_set_reusable(self.to_glib_none().0, reusable.to_glib()); + ffi::gst_rtsp_media_set_reusable(self.as_ref().to_glib_none().0, reusable.to_glib()); } } fn set_shared(&self, shared: bool) { unsafe { - ffi::gst_rtsp_media_set_shared(self.to_glib_none().0, shared.to_glib()); + ffi::gst_rtsp_media_set_shared(self.as_ref().to_glib_none().0, shared.to_glib()); } } @@ -485,19 +484,19 @@ impl> RTSPMediaExt for O { fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) { unsafe { - ffi::gst_rtsp_media_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_set_suspend_mode(self.to_glib_none().0, mode.to_glib()); + ffi::gst_rtsp_media_set_suspend_mode(self.as_ref().to_glib_none().0, mode.to_glib()); } } fn set_transport_mode(&self, mode: RTSPTransportMode) { unsafe { - ffi::gst_rtsp_media_set_transport_mode(self.to_glib_none().0, mode.to_glib()); + ffi::gst_rtsp_media_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib()); } } @@ -507,31 +506,31 @@ impl> RTSPMediaExt for O { fn suspend(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_media_suspend(self.to_glib_none().0), "Failed to suspend media") + glib_result_from_gboolean!(ffi::gst_rtsp_media_suspend(self.as_ref().to_glib_none().0), "Failed to suspend media") } } - fn take_pipeline(&self, pipeline: &gst::Pipeline) { + fn take_pipeline>(&self, pipeline: &P) { unsafe { - ffi::gst_rtsp_media_take_pipeline(self.to_glib_none().0, pipeline.to_glib_full()); + ffi::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!(ffi::gst_rtsp_media_unprepare(self.to_glib_none().0), "Failed to unprepare media") + glib_result_from_gboolean!(ffi::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!(ffi::gst_rtsp_media_unsuspend(self.to_glib_none().0), "Failed to unsuspend media") + glib_result_from_gboolean!(ffi::gst_rtsp_media_unsuspend(self.as_ref().to_glib_none().0), "Failed to unsuspend media") } } fn use_time_provider(&self, time_provider: bool) { unsafe { - ffi::gst_rtsp_media_use_time_provider(self.to_glib_none().0, time_provider.to_glib()); + ffi::gst_rtsp_media_use_time_provider(self.as_ref().to_glib_none().0, time_provider.to_glib()); } } @@ -576,7 +575,7 @@ impl> RTSPMediaExt for O { fn connect_new_state(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"new-state\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"new-state\0".as_ptr() as *const _, transmute(new_state_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -584,7 +583,7 @@ impl> RTSPMediaExt for O { fn connect_new_stream(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"new-stream\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"new-stream\0".as_ptr() as *const _, transmute(new_stream_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -592,7 +591,7 @@ impl> RTSPMediaExt for O { fn connect_prepared(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"prepared\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"prepared\0".as_ptr() as *const _, transmute(prepared_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -600,7 +599,7 @@ impl> RTSPMediaExt for O { fn connect_removed_stream(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"removed-stream\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"removed-stream\0".as_ptr() as *const _, transmute(removed_stream_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -608,7 +607,7 @@ impl> RTSPMediaExt for O { fn connect_target_state(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"target-state\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"target-state\0".as_ptr() as *const _, transmute(target_state_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -616,7 +615,7 @@ impl> RTSPMediaExt for O { fn connect_unprepared(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"unprepared\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"unprepared\0".as_ptr() as *const _, transmute(unprepared_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -624,7 +623,7 @@ impl> RTSPMediaExt for O { fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, transmute(notify_buffer_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -632,7 +631,7 @@ impl> RTSPMediaExt for O { fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::clock\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _, transmute(notify_clock_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -640,7 +639,7 @@ impl> RTSPMediaExt for O { fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, transmute(notify_eos_shutdown_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -648,7 +647,7 @@ impl> RTSPMediaExt for O { fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, transmute(notify_latency_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -656,7 +655,7 @@ impl> RTSPMediaExt for O { fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, transmute(notify_profiles_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -664,7 +663,7 @@ impl> RTSPMediaExt for O { fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, transmute(notify_protocols_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -672,7 +671,7 @@ impl> RTSPMediaExt for O { fn connect_property_reusable_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::reusable\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::reusable\0".as_ptr() as *const _, transmute(notify_reusable_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -680,7 +679,7 @@ impl> RTSPMediaExt for O { fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::shared\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _, transmute(notify_shared_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -688,7 +687,7 @@ impl> RTSPMediaExt for O { fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, transmute(notify_stop_on_disconnect_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -696,7 +695,7 @@ impl> RTSPMediaExt for O { fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, transmute(notify_suspend_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -704,7 +703,7 @@ impl> RTSPMediaExt for O { fn connect_property_time_provider_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::time-provider\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::time-provider\0".as_ptr() as *const _, transmute(notify_time_provider_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -712,7 +711,7 @@ impl> RTSPMediaExt for O { fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, transmute(notify_transport_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -721,107 +720,107 @@ impl> RTSPMediaExt for O { unsafe extern "C" fn new_state_trampoline

(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object) } unsafe extern "C" fn new_stream_trampoline

(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn prepared_trampoline

(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn removed_stream_trampoline

(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn target_state_trampoline

(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object) } unsafe extern "C" fn unprepared_trampoline

(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_buffer_size_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_clock_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_eos_shutdown_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_latency_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_profiles_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_protocols_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_reusable_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_shared_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_stop_on_disconnect_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_suspend_mode_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_time_provider_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_transport_mode_trampoline

(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMedia::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs index 09ff10138..ceffaddb2 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs @@ -12,7 +12,7 @@ use glib; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -25,7 +25,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPMediaFactory(Object); + pub struct RTSPMediaFactory(Object); match fn { get_type => || ffi::gst_rtsp_media_factory_get_type(), @@ -50,6 +50,8 @@ impl Default for RTSPMediaFactory { unsafe impl Send for RTSPMediaFactory {} unsafe impl Sync for RTSPMediaFactory {} +pub const NONE_RTSP_MEDIA_FACTORY: Option<&RTSPMediaFactory> = None; + pub trait RTSPMediaFactoryExt: 'static { //fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); @@ -91,7 +93,7 @@ pub trait RTSPMediaFactoryExt: 'static { fn is_stop_on_disonnect(&self) -> bool; - fn set_address_pool<'a, P: Into>>(&self, pool: P); + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn set_buffer_size(&self, size: u32); @@ -165,55 +167,55 @@ impl> RTSPMediaFactoryExt for O { fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_factory_construct(self.to_glib_none().0, url.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_rtsp_media_factory_create_element(self.to_glib_none().0, url.to_glib_none().0)) + from_glib_none(ffi::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(ffi::gst_rtsp_media_factory_get_address_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_factory_get_address_pool(self.as_ref().to_glib_none().0)) } } fn get_buffer_size(&self) -> u32 { unsafe { - ffi::gst_rtsp_media_factory_get_buffer_size(self.to_glib_none().0) + ffi::gst_rtsp_media_factory_get_buffer_size(self.as_ref().to_glib_none().0) } } fn get_clock(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.as_ref().to_glib_none().0)) } } fn get_latency(&self) -> u32 { unsafe { - ffi::gst_rtsp_media_factory_get_latency(self.to_glib_none().0) + ffi::gst_rtsp_media_factory_get_latency(self.as_ref().to_glib_none().0) } } fn get_launch(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.as_ref().to_glib_none().0)) } } fn get_media_gtype(&self) -> glib::types::Type { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.as_ref().to_glib_none().0)) } } fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.as_ref().to_glib_none().0)) } } @@ -223,109 +225,106 @@ impl> RTSPMediaFactoryExt for O { fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.as_ref().to_glib_none().0)) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.as_ref().to_glib_none().0)) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_publish_clock_mode(self.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_rtsp_media_factory_get_retransmission_time(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(self.as_ref().to_glib_none().0)) } } fn get_suspend_mode(&self) -> RTSPSuspendMode { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.as_ref().to_glib_none().0)) } } fn get_transport_mode(&self) -> RTSPTransportMode { unsafe { - from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.as_ref().to_glib_none().0)) } } fn is_eos_shutdown(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.as_ref().to_glib_none().0)) } } fn is_shared(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_factory_is_shared(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_is_shared(self.as_ref().to_glib_none().0)) } } fn is_stop_on_disonnect(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.as_ref().to_glib_none().0)) } } - fn set_address_pool<'a, P: Into>>(&self, pool: P) { + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_media_factory_set_address_pool(self.to_glib_none().0, pool.0); + ffi::gst_rtsp_media_factory_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } fn set_buffer_size(&self, size: u32) { unsafe { - ffi::gst_rtsp_media_factory_set_buffer_size(self.to_glib_none().0, size); + ffi::gst_rtsp_media_factory_set_buffer_size(self.as_ref().to_glib_none().0, size); } } fn set_clock<'a, P: IsA + 'a, Q: Into>>(&self, clock: Q) { let clock = clock.into(); - let clock = clock.to_glib_none(); unsafe { - ffi::gst_rtsp_media_factory_set_clock(self.to_glib_none().0, clock.0); + ffi::gst_rtsp_media_factory_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0); } } fn set_eos_shutdown(&self, eos_shutdown: bool) { unsafe { - ffi::gst_rtsp_media_factory_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_latency(self.to_glib_none().0, latency); + ffi::gst_rtsp_media_factory_set_latency(self.as_ref().to_glib_none().0, latency); } } fn set_launch(&self, launch: &str) { unsafe { - ffi::gst_rtsp_media_factory_set_launch(self.to_glib_none().0, launch.to_glib_none().0); + ffi::gst_rtsp_media_factory_set_launch(self.as_ref().to_glib_none().0, launch.to_glib_none().0); } } fn set_media_gtype(&self, media_gtype: glib::types::Type) { unsafe { - ffi::gst_rtsp_media_factory_set_media_gtype(self.to_glib_none().0, media_gtype.to_glib()); + ffi::gst_rtsp_media_factory_set_media_gtype(self.as_ref().to_glib_none().0, media_gtype.to_glib()); } } fn set_multicast_iface<'a, P: Into>>(&self, multicast_iface: P) { let multicast_iface = multicast_iface.into(); - let multicast_iface = multicast_iface.to_glib_none(); unsafe { - ffi::gst_rtsp_media_factory_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); + ffi::gst_rtsp_media_factory_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0); } } @@ -335,49 +334,49 @@ impl> RTSPMediaFactoryExt for O { fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { unsafe { - ffi::gst_rtsp_media_factory_set_profiles(self.to_glib_none().0, profiles.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_protocols(self.to_glib_none().0, protocols.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_retransmission_time(self.to_glib_none().0, time.to_glib()); + ffi::gst_rtsp_media_factory_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); } } fn set_shared(&self, shared: bool) { unsafe { - ffi::gst_rtsp_media_factory_set_shared(self.to_glib_none().0, shared.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_suspend_mode(self.to_glib_none().0, mode.to_glib()); + ffi::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 { - ffi::gst_rtsp_media_factory_set_transport_mode(self.to_glib_none().0, mode.to_glib()); + ffi::gst_rtsp_media_factory_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib()); } } @@ -408,7 +407,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_media_configure(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"media-configure\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"media-configure\0".as_ptr() as *const _, transmute(media_configure_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -416,7 +415,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_media_constructed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"media-constructed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"media-constructed\0".as_ptr() as *const _, transmute(media_constructed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -424,7 +423,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_buffer_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, transmute(notify_buffer_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -432,7 +431,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_clock_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::clock\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _, transmute(notify_clock_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -440,7 +439,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_eos_shutdown_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, transmute(notify_eos_shutdown_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -448,7 +447,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, transmute(notify_latency_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -456,7 +455,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_launch_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::launch\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::launch\0".as_ptr() as *const _, transmute(notify_launch_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -464,7 +463,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, transmute(notify_profiles_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -472,7 +471,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, transmute(notify_protocols_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -480,7 +479,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_shared_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::shared\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _, transmute(notify_shared_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -488,7 +487,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_stop_on_disconnect_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, transmute(notify_stop_on_disconnect_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -496,7 +495,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_suspend_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, transmute(notify_suspend_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -504,7 +503,7 @@ impl> RTSPMediaFactoryExt for O { fn connect_property_transport_mode_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, transmute(notify_transport_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -513,77 +512,77 @@ impl> RTSPMediaFactoryExt for O { unsafe extern "C" fn media_configure_trampoline

(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn media_constructed_trampoline

(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn notify_buffer_size_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_clock_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_eos_shutdown_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_latency_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_launch_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_profiles_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_protocols_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_shared_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_stop_on_disconnect_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_suspend_mode_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_transport_mode_trampoline

(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast()) } 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 2bf6ed334..f2df706e8 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media_factory_uri.rs @@ -7,7 +7,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -18,7 +18,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPMediaFactoryURI(Object): RTSPMediaFactory; + pub struct RTSPMediaFactoryURI(Object) @extends RTSPMediaFactory; match fn { get_type => || ffi::gst_rtsp_media_factory_uri_get_type(), @@ -43,6 +43,8 @@ impl Default for RTSPMediaFactoryURI { unsafe impl Send for RTSPMediaFactoryURI {} unsafe impl Sync for RTSPMediaFactoryURI {} +pub const NONE_RTSP_MEDIA_FACTORY_URI: Option<&RTSPMediaFactoryURI> = None; + pub trait RTSPMediaFactoryURIExt: 'static { fn get_uri(&self) -> Option; @@ -60,13 +62,13 @@ pub trait RTSPMediaFactoryURIExt: 'static { impl> RTSPMediaFactoryURIExt for O { fn get_uri(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(self.as_ref().to_glib_none().0)) } } fn set_uri(&self, uri: &str) { unsafe { - ffi::gst_rtsp_media_factory_uri_set_uri(self.to_glib_none().0, uri.to_glib_none().0); + ffi::gst_rtsp_media_factory_uri_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0); } } @@ -87,7 +89,7 @@ impl> RTSPMediaFactoryURIExt for O { fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::uri\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -95,7 +97,7 @@ impl> RTSPMediaFactoryURIExt for O { fn connect_property_use_gstpay_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::use-gstpay\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::use-gstpay\0".as_ptr() as *const _, transmute(notify_use_gstpay_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -104,11 +106,11 @@ impl> RTSPMediaFactoryURIExt for O { unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_use_gstpay_trampoline

(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs b/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs index 361405b8c..b31a2e634 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_mount_points.rs @@ -11,7 +11,7 @@ use gst_rtsp; use std::mem; glib_wrapper! { - pub struct RTSPMountPoints(Object); + pub struct RTSPMountPoints(Object); match fn { get_type => || ffi::gst_rtsp_mount_points_get_type(), @@ -36,6 +36,8 @@ impl Default for RTSPMountPoints { unsafe impl Send for RTSPMountPoints {} unsafe impl Sync for RTSPMountPoints {} +pub const NONE_RTSP_MOUNT_POINTS: Option<&RTSPMountPoints> = None; + pub trait RTSPMountPointsExt: 'static { fn add_factory>(&self, path: &str, factory: &P); @@ -49,27 +51,27 @@ pub trait RTSPMountPointsExt: 'static { impl> RTSPMountPointsExt for O { fn add_factory>(&self, path: &str, factory: &P) { unsafe { - ffi::gst_rtsp_mount_points_add_factory(self.to_glib_none().0, path.to_glib_none().0, factory.to_glib_full()); + ffi::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(ffi::gst_rtsp_mount_points_make_path(self.to_glib_none().0, url.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_rtsp_mount_points_match(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); + let ret = from_glib_full(ffi::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 { - ffi::gst_rtsp_mount_points_remove_factory(self.to_glib_none().0, path.to_glib_none().0); + ffi::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 f698ee2dc..d4af8cb77 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_server.rs @@ -12,7 +12,7 @@ use ffi; use gio; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -23,7 +23,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct RTSPServer(Object); + pub struct RTSPServer(Object); match fn { get_type => || ffi::gst_rtsp_server_get_type(), @@ -38,10 +38,10 @@ impl RTSPServer { } } - pub fn io_func>(socket: &gio::Socket, condition: glib::IOCondition, server: &P) -> bool { + pub fn io_func, Q: IsA>(socket: &P, condition: glib::IOCondition, server: &Q) -> bool { skip_assert_initialized!(); unsafe { - from_glib(ffi::gst_rtsp_server_io_func(socket.to_glib_none().0, condition.to_glib(), server.to_glib_none().0)) + from_glib(ffi::gst_rtsp_server_io_func(socket.as_ref().to_glib_none().0, condition.to_glib(), server.as_ref().to_glib_none().0)) } } } @@ -55,12 +55,14 @@ impl Default for RTSPServer { unsafe impl Send for RTSPServer {} unsafe impl Sync for RTSPServer {} +pub const NONE_RTSP_SERVER: Option<&RTSPServer> = None; + pub trait RTSPServerExt: 'static { //fn client_filter<'a, P: Into>, Q: Into>>(&self, func: P, user_data: Q) -> Vec; - fn create_socket<'a, P: Into>>(&self, cancellable: P) -> Result; + fn create_socket<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result; - fn create_source<'a, P: Into>>(&self, cancellable: P) -> Result; + fn create_source<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result; fn get_address(&self) -> Option; @@ -80,19 +82,19 @@ pub trait RTSPServerExt: 'static { fn set_address(&self, address: &str); - fn set_auth<'a, P: Into>>(&self, auth: P); + fn set_auth<'a, P: IsA + 'a, Q: Into>>(&self, auth: Q); fn set_backlog(&self, backlog: i32); - fn set_mount_points<'a, P: Into>>(&self, mounts: P); + fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q); fn set_service(&self, service: &str); - fn set_session_pool<'a, P: Into>>(&self, pool: P); + fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); - fn set_thread_pool<'a, P: Into>>(&self, pool: P); + fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); - fn transfer_connection<'a, P: Into>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool; + fn transfer_connection<'a, P: IsA, Q: Into>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> bool; fn connect_client_connected(&self, f: F) -> SignalHandlerId; @@ -114,136 +116,129 @@ impl> RTSPServerExt for O { // unsafe { TODO: call ffi::gst_rtsp_server_client_filter() } //} - fn create_socket<'a, P: Into>>(&self, cancellable: P) -> Result { + fn create_socket<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result { let cancellable = cancellable.into(); - let cancellable = cancellable.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_rtsp_server_create_socket(self.to_glib_none().0, cancellable.0, &mut error); + let ret = ffi::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<'a, P: Into>>(&self, cancellable: P) -> Result { + fn create_source<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result { let cancellable = cancellable.into(); - let cancellable = cancellable.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_rtsp_server_create_source(self.to_glib_none().0, cancellable.0, &mut error); + let ret = ffi::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(ffi::gst_rtsp_server_get_address(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_address(self.as_ref().to_glib_none().0)) } } fn get_auth(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_server_get_auth(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_auth(self.as_ref().to_glib_none().0)) } } fn get_backlog(&self) -> i32 { unsafe { - ffi::gst_rtsp_server_get_backlog(self.to_glib_none().0) + ffi::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0) } } fn get_bound_port(&self) -> i32 { unsafe { - ffi::gst_rtsp_server_get_bound_port(self.to_glib_none().0) + ffi::gst_rtsp_server_get_bound_port(self.as_ref().to_glib_none().0) } } fn get_mount_points(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.as_ref().to_glib_none().0)) } } fn get_service(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_server_get_service(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_service(self.as_ref().to_glib_none().0)) } } fn get_session_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.as_ref().to_glib_none().0)) } } fn get_thread_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.as_ref().to_glib_none().0)) } } fn set_address(&self, address: &str) { unsafe { - ffi::gst_rtsp_server_set_address(self.to_glib_none().0, address.to_glib_none().0); + ffi::gst_rtsp_server_set_address(self.as_ref().to_glib_none().0, address.to_glib_none().0); } } - fn set_auth<'a, P: Into>>(&self, auth: P) { + fn set_auth<'a, P: IsA + 'a, Q: Into>>(&self, auth: Q) { let auth = auth.into(); - let auth = auth.to_glib_none(); unsafe { - ffi::gst_rtsp_server_set_auth(self.to_glib_none().0, auth.0); + ffi::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 { - ffi::gst_rtsp_server_set_backlog(self.to_glib_none().0, backlog); + ffi::gst_rtsp_server_set_backlog(self.as_ref().to_glib_none().0, backlog); } } - fn set_mount_points<'a, P: Into>>(&self, mounts: P) { + fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q) { let mounts = mounts.into(); - let mounts = mounts.to_glib_none(); unsafe { - ffi::gst_rtsp_server_set_mount_points(self.to_glib_none().0, mounts.0); + ffi::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 { - ffi::gst_rtsp_server_set_service(self.to_glib_none().0, service.to_glib_none().0); + ffi::gst_rtsp_server_set_service(self.as_ref().to_glib_none().0, service.to_glib_none().0); } } - fn set_session_pool<'a, P: Into>>(&self, pool: P) { + fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_server_set_session_pool(self.to_glib_none().0, pool.0); + ffi::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<'a, P: Into>>(&self, pool: P) { + fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_server_set_thread_pool(self.to_glib_none().0, pool.0); + ffi::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<'a, P: Into>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool { + fn transfer_connection<'a, P: IsA, Q: Into>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> bool { let initial_buffer = initial_buffer.into(); - let initial_buffer = initial_buffer.to_glib_none(); unsafe { - from_glib(ffi::gst_rtsp_server_transfer_connection(self.to_glib_none().0, socket.to_glib_full(), ip.to_glib_none().0, port, initial_buffer.0)) + from_glib(ffi::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)) } } fn connect_client_connected(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"client-connected\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"client-connected\0".as_ptr() as *const _, transmute(client_connected_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -251,7 +246,7 @@ impl> RTSPServerExt for O { fn connect_property_address_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::address\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _, transmute(notify_address_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -259,7 +254,7 @@ impl> RTSPServerExt for O { fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::backlog\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::backlog\0".as_ptr() as *const _, transmute(notify_backlog_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -267,7 +262,7 @@ impl> RTSPServerExt for O { fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::bound-port\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::bound-port\0".as_ptr() as *const _, transmute(notify_bound_port_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -275,7 +270,7 @@ impl> RTSPServerExt for O { fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::mount-points\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _, transmute(notify_mount_points_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -283,7 +278,7 @@ impl> RTSPServerExt for O { fn connect_property_service_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::service\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::service\0".as_ptr() as *const _, transmute(notify_service_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -291,7 +286,7 @@ impl> RTSPServerExt for O { fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::session-pool\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _, transmute(notify_session_pool_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -300,41 +295,41 @@ impl> RTSPServerExt for O { unsafe extern "C" fn client_connected_trampoline

(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPClient) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn notify_address_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_backlog_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_bound_port_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mount_points_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_service_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_session_pool_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session.rs b/gstreamer-rtsp-server/src/auto/rtsp_session.rs index f820dafcc..42e3e54c2 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session.rs @@ -8,7 +8,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -20,7 +20,7 @@ use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct RTSPSession(Object); + pub struct RTSPSession(Object); match fn { get_type => || ffi::gst_rtsp_session_get_type(), @@ -39,6 +39,8 @@ impl RTSPSession { unsafe impl Send for RTSPSession {} unsafe impl Sync for RTSPSession {} +pub const NONE_RTSP_SESSION: Option<&RTSPSession> = None; + pub trait RTSPSessionExt: 'static { fn allow_expire(&self); @@ -64,7 +66,7 @@ pub trait RTSPSessionExt: 'static { fn prevent_expire(&self); - fn release_media(&self, media: &RTSPSessionMedia) -> bool; + fn release_media>(&self, media: &P) -> bool; fn set_timeout(&self, timeout: u32); @@ -82,7 +84,7 @@ pub trait RTSPSessionExt: 'static { impl> RTSPSessionExt for O { fn allow_expire(&self) { unsafe { - ffi::gst_rtsp_session_allow_expire(self.to_glib_none().0); + ffi::gst_rtsp_session_allow_expire(self.as_ref().to_glib_none().0); } } @@ -92,27 +94,27 @@ impl> RTSPSessionExt for O { fn get_header(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_session_get_header(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_rtsp_session_get_media(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); + let ret = from_glib_none(ffi::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(ffi::gst_rtsp_session_get_sessionid(self.to_glib_none().0)) + from_glib_none(ffi::gst_rtsp_session_get_sessionid(self.as_ref().to_glib_none().0)) } } fn get_timeout(&self) -> u32 { unsafe { - ffi::gst_rtsp_session_get_timeout(self.to_glib_none().0) + ffi::gst_rtsp_session_get_timeout(self.as_ref().to_glib_none().0) } } @@ -122,13 +124,13 @@ impl> RTSPSessionExt for O { fn is_expired_usec(&self, now: i64) -> bool { unsafe { - from_glib(ffi::gst_rtsp_session_is_expired_usec(self.to_glib_none().0, now)) + from_glib(ffi::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(ffi::gst_rtsp_session_manage_media(self.to_glib_none().0, path.to_glib_none().0, media.to_glib_full())) + from_glib_none(ffi::gst_rtsp_session_manage_media(self.as_ref().to_glib_none().0, path.to_glib_none().0, media.as_ref().to_glib_full())) } } @@ -138,31 +140,31 @@ impl> RTSPSessionExt for O { fn next_timeout_usec(&self, now: i64) -> i32 { unsafe { - ffi::gst_rtsp_session_next_timeout_usec(self.to_glib_none().0, now) + ffi::gst_rtsp_session_next_timeout_usec(self.as_ref().to_glib_none().0, now) } } fn prevent_expire(&self) { unsafe { - ffi::gst_rtsp_session_prevent_expire(self.to_glib_none().0); + ffi::gst_rtsp_session_prevent_expire(self.as_ref().to_glib_none().0); } } - fn release_media(&self, media: &RTSPSessionMedia) -> bool { + fn release_media>(&self, media: &P) -> bool { unsafe { - from_glib(ffi::gst_rtsp_session_release_media(self.to_glib_none().0, media.to_glib_none().0)) + from_glib(ffi::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 { - ffi::gst_rtsp_session_set_timeout(self.to_glib_none().0, timeout); + ffi::gst_rtsp_session_set_timeout(self.as_ref().to_glib_none().0, timeout); } } fn touch(&self) { unsafe { - ffi::gst_rtsp_session_touch(self.to_glib_none().0); + ffi::gst_rtsp_session_touch(self.as_ref().to_glib_none().0); } } @@ -183,7 +185,7 @@ impl> RTSPSessionExt for O { fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeout\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, transmute(notify_timeout_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -191,7 +193,7 @@ impl> RTSPSessionExt for O { fn connect_property_timeout_always_visible_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeout-always-visible\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::timeout-always-visible\0".as_ptr() as *const _, transmute(notify_timeout_always_visible_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -200,11 +202,11 @@ impl> RTSPSessionExt for O { unsafe extern "C" fn notify_timeout_trampoline

(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPSession::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPSession::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_timeout_always_visible_trampoline

(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPSession::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPSession::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs index b85d2b3ee..1e077eb07 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs @@ -13,7 +13,7 @@ use gst; use std::mem; glib_wrapper! { - pub struct RTSPSessionMedia(Object); + pub struct RTSPSessionMedia(Object); match fn { get_type => || ffi::gst_rtsp_session_media_get_type(), @@ -24,7 +24,7 @@ impl RTSPSessionMedia { pub fn new>(path: &str, media: &P) -> RTSPSessionMedia { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_rtsp_session_media_new(path.to_glib_none().0, media.to_glib_full())) + from_glib_full(ffi::gst_rtsp_session_media_new(path.to_glib_none().0, media.as_ref().to_glib_full())) } } } @@ -32,6 +32,8 @@ impl RTSPSessionMedia { unsafe impl Send for RTSPSessionMedia {} unsafe impl Sync for RTSPSessionMedia {} +pub const NONE_RTSP_SESSION_MEDIA: Option<&RTSPSessionMedia> = None; + pub trait RTSPSessionMediaExt: 'static { //fn alloc_channels(&self, range: /*Ignored*/gst_rtsp::RTSPRange) -> bool; @@ -53,7 +55,7 @@ pub trait RTSPSessionMediaExt: 'static { fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError>; - //fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option; + //fn set_transport>(&self, stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option; } impl> RTSPSessionMediaExt for O { @@ -63,19 +65,19 @@ impl> RTSPSessionMediaExt for O { fn get_base_time(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_rtsp_session_media_get_base_time(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_session_media_get_base_time(self.as_ref().to_glib_none().0)) } } fn get_media(&self) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_session_media_get_media(self.to_glib_none().0)) + from_glib_none(ffi::gst_rtsp_session_media_get_media(self.as_ref().to_glib_none().0)) } } fn get_rtpinfo(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_session_media_get_rtpinfo(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_session_media_get_rtpinfo(self.as_ref().to_glib_none().0)) } } @@ -85,7 +87,7 @@ impl> RTSPSessionMediaExt for O { fn get_transport(&self, idx: u32) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_session_media_get_transport(self.to_glib_none().0, idx)) + from_glib_none(ffi::gst_rtsp_session_media_get_transport(self.as_ref().to_glib_none().0, idx)) } } @@ -96,7 +98,7 @@ impl> RTSPSessionMediaExt for O { fn matches(&self, path: &str) -> Option { unsafe { let mut matched = mem::uninitialized(); - let ret = from_glib(ffi::gst_rtsp_session_media_matches(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); + let ret = from_glib(ffi::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 } } } @@ -107,11 +109,11 @@ impl> RTSPSessionMediaExt for O { fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_session_media_set_state(self.to_glib_none().0, state.to_glib()), "Failed to set state of session media") + glib_result_from_gboolean!(ffi::gst_rtsp_session_media_set_state(self.as_ref().to_glib_none().0, state.to_glib()), "Failed to set state of session media") } } - //fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option { + //fn set_transport>(&self, stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option { // unsafe { TODO: call ffi::gst_rtsp_session_media_set_transport() } //} } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs index c5db5f35d..0071ce826 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session_pool.rs @@ -5,7 +5,7 @@ use RTSPSession; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -15,7 +15,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPSessionPool(Object); + pub struct RTSPSessionPool(Object); match fn { get_type => || ffi::gst_rtsp_session_pool_get_type(), @@ -40,6 +40,8 @@ impl Default for RTSPSessionPool { unsafe impl Send for RTSPSessionPool {} unsafe impl Sync for RTSPSessionPool {} +pub const NONE_RTSP_SESSION_POOL: Option<&RTSPSessionPool> = None; + pub trait RTSPSessionPoolExt: 'static { fn cleanup(&self) -> u32; @@ -53,7 +55,7 @@ pub trait RTSPSessionPoolExt: 'static { fn get_n_sessions(&self) -> u32; - fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError>; + fn remove>(&self, sess: &P) -> Result<(), glib::error::BoolError>; fn set_max_sessions(&self, max: u32); @@ -65,13 +67,13 @@ pub trait RTSPSessionPoolExt: 'static { impl> RTSPSessionPoolExt for O { fn cleanup(&self) -> u32 { unsafe { - ffi::gst_rtsp_session_pool_cleanup(self.to_glib_none().0) + ffi::gst_rtsp_session_pool_cleanup(self.as_ref().to_glib_none().0) } } fn create(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_session_pool_create(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_session_pool_create(self.as_ref().to_glib_none().0)) } } @@ -81,38 +83,38 @@ impl> RTSPSessionPoolExt for O { fn find(&self, sessionid: &str) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_session_pool_find(self.to_glib_none().0, sessionid.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_session_pool_find(self.as_ref().to_glib_none().0, sessionid.to_glib_none().0)) } } fn get_max_sessions(&self) -> u32 { unsafe { - ffi::gst_rtsp_session_pool_get_max_sessions(self.to_glib_none().0) + ffi::gst_rtsp_session_pool_get_max_sessions(self.as_ref().to_glib_none().0) } } fn get_n_sessions(&self) -> u32 { unsafe { - ffi::gst_rtsp_session_pool_get_n_sessions(self.to_glib_none().0) + ffi::gst_rtsp_session_pool_get_n_sessions(self.as_ref().to_glib_none().0) } } - fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError> { + fn remove>(&self, sess: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_session_pool_remove(self.to_glib_none().0, sess.to_glib_none().0), "Failed to remove session from pool") + glib_result_from_gboolean!(ffi::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 { - ffi::gst_rtsp_session_pool_set_max_sessions(self.to_glib_none().0, max); + ffi::gst_rtsp_session_pool_set_max_sessions(self.as_ref().to_glib_none().0, max); } } fn connect_session_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"session-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"session-removed\0".as_ptr() as *const _, transmute(session_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -120,7 +122,7 @@ impl> RTSPSessionPoolExt for O { fn connect_property_max_sessions_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-sessions\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-sessions\0".as_ptr() as *const _, transmute(notify_max_sessions_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -129,11 +131,11 @@ impl> RTSPSessionPoolExt for O { unsafe extern "C" fn session_removed_trampoline

(this: *mut ffi::GstRTSPSessionPool, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f); - f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn notify_max_sessions_trampoline

(this: *mut ffi::GstRTSPSessionPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs index 98bdd64a8..44d6ce099 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs @@ -10,7 +10,7 @@ use ffi; use gio; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -24,7 +24,7 @@ use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct RTSPStream(Object); + pub struct RTSPStream(Object); match fn { get_type => || ffi::gst_rtsp_stream_get_type(), @@ -35,7 +35,7 @@ impl RTSPStream { pub fn new, Q: IsA>(idx: u32, payloader: &P, pad: &Q) -> RTSPStream { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_rtsp_stream_new(idx, payloader.to_glib_none().0, pad.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_new(idx, payloader.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0)) } } } @@ -43,8 +43,10 @@ impl RTSPStream { unsafe impl Send for RTSPStream {} unsafe impl Sync for RTSPStream {} +pub const NONE_RTSP_STREAM: Option<&RTSPStream> = None; + pub trait RTSPStreamExt: 'static { - fn add_transport(&self, trans: &RTSPStreamTransport) -> 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; @@ -124,7 +126,7 @@ pub trait RTSPStreamExt: 'static { fn leave_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError>; - fn remove_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError>; + fn remove_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError>; fn request_aux_sender(&self, sessid: u32) -> Option; @@ -132,7 +134,7 @@ pub trait RTSPStreamExt: 'static { fn seekable(&self) -> bool; - fn set_address_pool<'a, P: Into>>(&self, pool: P); + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn set_blocked(&self, blocked: bool) -> bool; @@ -180,9 +182,9 @@ pub trait RTSPStreamExt: 'static { } impl> RTSPStreamExt for O { - fn add_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> { + fn add_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_add_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to add transport") + glib_result_from_gboolean!(ffi::gst_rtsp_stream_add_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to add transport") } } @@ -196,127 +198,127 @@ impl> RTSPStreamExt for O { fn get_address_pool(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_address_pool(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_address_pool(self.as_ref().to_glib_none().0)) } } fn get_buffer_size(&self) -> u32 { unsafe { - ffi::gst_rtsp_stream_get_buffer_size(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_buffer_size(self.as_ref().to_glib_none().0) } } fn get_caps(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_caps(self.as_ref().to_glib_none().0)) } } fn get_control(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_control(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_control(self.as_ref().to_glib_none().0)) } } fn get_current_seqnum(&self) -> u16 { unsafe { - ffi::gst_rtsp_stream_get_current_seqnum(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_current_seqnum(self.as_ref().to_glib_none().0) } } fn get_dscp_qos(&self) -> i32 { unsafe { - ffi::gst_rtsp_stream_get_dscp_qos(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0) } } fn get_index(&self) -> u32 { unsafe { - ffi::gst_rtsp_stream_get_index(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0) } } fn get_joined_bin(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(self.as_ref().to_glib_none().0)) } } fn get_mtu(&self) -> u32 { unsafe { - ffi::gst_rtsp_stream_get_mtu(self.to_glib_none().0) + ffi::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(ffi::gst_rtsp_stream_get_multicast_address(self.to_glib_none().0, family.to_glib())) + from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(self.as_ref().to_glib_none().0, family.to_glib())) } } fn get_multicast_iface(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(self.as_ref().to_glib_none().0)) } } fn get_profiles(&self) -> gst_rtsp::RTSPProfile { unsafe { - from_glib(ffi::gst_rtsp_stream_get_profiles(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_get_profiles(self.as_ref().to_glib_none().0)) } } fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { unsafe { - from_glib(ffi::gst_rtsp_stream_get_protocols(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_get_protocols(self.as_ref().to_glib_none().0)) } } fn get_pt(&self) -> u32 { unsafe { - ffi::gst_rtsp_stream_get_pt(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0) } } fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { unsafe { - from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(self.as_ref().to_glib_none().0)) } } fn get_retransmission_pt(&self) -> u32 { unsafe { - ffi::gst_rtsp_stream_get_retransmission_pt(self.to_glib_none().0) + ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) } } fn get_retransmission_time(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_rtsp_stream_get_retransmission_time(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_get_retransmission_time(self.as_ref().to_glib_none().0)) } } fn get_rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_rtcp_multicast_socket(self.to_glib_none().0, family.to_glib())) + from_glib_full(ffi::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(ffi::gst_rtsp_stream_get_rtcp_socket(self.to_glib_none().0, family.to_glib())) + from_glib_full(ffi::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(ffi::gst_rtsp_stream_get_rtp_multicast_socket(self.to_glib_none().0, family.to_glib())) + from_glib_full(ffi::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(ffi::gst_rtsp_stream_get_rtp_socket(self.to_glib_none().0, family.to_glib())) + from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(self.as_ref().to_glib_none().0, family.to_glib())) } } @@ -326,14 +328,14 @@ 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(ffi::gst_rtsp_stream_get_rtpinfo(self.to_glib_none().0, &mut rtptime, &mut seq, &mut clock_rate, &mut running_time)); + let ret = from_glib(ffi::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(ffi::gst_rtsp_stream_get_rtpsession(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(self.as_ref().to_glib_none().0)) } } @@ -343,65 +345,64 @@ impl> RTSPStreamExt for O { fn get_sinkpad(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(self.as_ref().to_glib_none().0)) } } fn get_srcpad(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_srcpad(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_srcpad(self.as_ref().to_glib_none().0)) } } fn get_srtp_encoder(&self) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(self.to_glib_none().0)) + from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(self.as_ref().to_glib_none().0)) } } fn get_ssrc(&self) -> u32 { unsafe { let mut ssrc = mem::uninitialized(); - ffi::gst_rtsp_stream_get_ssrc(self.to_glib_none().0, &mut ssrc); + ffi::gst_rtsp_stream_get_ssrc(self.as_ref().to_glib_none().0, &mut ssrc); ssrc } } fn has_control<'a, P: Into>>(&self, control: P) -> bool { let control = control.into(); - let control = control.to_glib_none(); unsafe { - from_glib(ffi::gst_rtsp_stream_has_control(self.to_glib_none().0, control.0)) + from_glib(ffi::gst_rtsp_stream_has_control(self.as_ref().to_glib_none().0, control.to_glib_none().0)) } } fn is_blocking(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_is_blocking(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_is_blocking(self.as_ref().to_glib_none().0)) } } fn is_client_side(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_is_client_side(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_is_client_side(self.as_ref().to_glib_none().0)) } } fn is_complete(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_is_complete(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_is_complete(self.as_ref().to_glib_none().0)) } } fn is_receiver(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_is_receiver(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_is_receiver(self.as_ref().to_glib_none().0)) } } fn is_sender(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_is_sender(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_is_sender(self.as_ref().to_glib_none().0)) } } @@ -411,133 +412,130 @@ impl> RTSPStreamExt for O { fn join_bin, Q: IsA>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_join_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0, state.to_glib()), "Failed to join bin") + glib_result_from_gboolean!(ffi::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> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_leave_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0), "Failed to leave bin") + glib_result_from_gboolean!(ffi::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: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> { + fn remove_transport>(&self, trans: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_remove_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to remove transport") + glib_result_from_gboolean!(ffi::gst_rtsp_stream_remove_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to remove transport") } } fn request_aux_sender(&self, sessid: u32) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(self.to_glib_none().0, sessid)) + from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(self.as_ref().to_glib_none().0, sessid)) } } fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_reserve_address(self.to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl)) + from_glib_full(ffi::gst_rtsp_stream_reserve_address(self.as_ref().to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl)) } } fn seekable(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_seekable(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_seekable(self.as_ref().to_glib_none().0)) } } - fn set_address_pool<'a, P: Into>>(&self, pool: P) { + fn set_address_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); - let pool = pool.to_glib_none(); unsafe { - ffi::gst_rtsp_stream_set_address_pool(self.to_glib_none().0, pool.0); + ffi::gst_rtsp_stream_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } fn set_blocked(&self, blocked: bool) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_set_blocked(self.to_glib_none().0, blocked.to_glib())) + from_glib(ffi::gst_rtsp_stream_set_blocked(self.as_ref().to_glib_none().0, blocked.to_glib())) } } fn set_buffer_size(&self, size: u32) { unsafe { - ffi::gst_rtsp_stream_set_buffer_size(self.to_glib_none().0, size); + ffi::gst_rtsp_stream_set_buffer_size(self.as_ref().to_glib_none().0, size); } } fn set_client_side(&self, client_side: bool) { unsafe { - ffi::gst_rtsp_stream_set_client_side(self.to_glib_none().0, client_side.to_glib()); + ffi::gst_rtsp_stream_set_client_side(self.as_ref().to_glib_none().0, client_side.to_glib()); } } fn set_control<'a, P: Into>>(&self, control: P) { let control = control.into(); - let control = control.to_glib_none(); unsafe { - ffi::gst_rtsp_stream_set_control(self.to_glib_none().0, control.0); + ffi::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 { - ffi::gst_rtsp_stream_set_dscp_qos(self.to_glib_none().0, dscp_qos); + ffi::gst_rtsp_stream_set_dscp_qos(self.as_ref().to_glib_none().0, dscp_qos); } } fn set_mtu(&self, mtu: u32) { unsafe { - ffi::gst_rtsp_stream_set_mtu(self.to_glib_none().0, mtu); + ffi::gst_rtsp_stream_set_mtu(self.as_ref().to_glib_none().0, mtu); } } fn set_multicast_iface<'a, P: Into>>(&self, multicast_iface: P) { let multicast_iface = multicast_iface.into(); - let multicast_iface = multicast_iface.to_glib_none(); unsafe { - ffi::gst_rtsp_stream_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); + ffi::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 { - ffi::gst_rtsp_stream_set_profiles(self.to_glib_none().0, profiles.to_glib()); + ffi::gst_rtsp_stream_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib()); } } fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { unsafe { - ffi::gst_rtsp_stream_set_protocols(self.to_glib_none().0, protocols.to_glib()); + ffi::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 { - ffi::gst_rtsp_stream_set_pt_map(self.to_glib_none().0, pt, caps.to_glib_none().0); + ffi::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 { - ffi::gst_rtsp_stream_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); + ffi::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 { - ffi::gst_rtsp_stream_set_retransmission_pt(self.to_glib_none().0, rtx_pt); + ffi::gst_rtsp_stream_set_retransmission_pt(self.as_ref().to_glib_none().0, rtx_pt); } } fn set_retransmission_time(&self, time: gst::ClockTime) { unsafe { - ffi::gst_rtsp_stream_set_retransmission_time(self.to_glib_none().0, time.to_glib()); + ffi::gst_rtsp_stream_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib()); } } fn set_seqnum_offset(&self, seqnum: u16) { unsafe { - ffi::gst_rtsp_stream_set_seqnum_offset(self.to_glib_none().0, seqnum); + ffi::gst_rtsp_stream_set_seqnum_offset(self.as_ref().to_glib_none().0, seqnum); } } @@ -547,22 +545,21 @@ impl> RTSPStreamExt for O { fn unblock_linked(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_unblock_linked(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0)) } } fn update_crypto<'a, P: Into>>(&self, ssrc: u32, crypto: P) -> bool { let crypto = crypto.into(); - let crypto = crypto.to_glib_none(); unsafe { - from_glib(ffi::gst_rtsp_stream_update_crypto(self.to_glib_none().0, ssrc, crypto.0)) + from_glib(ffi::gst_rtsp_stream_update_crypto(self.as_ref().to_glib_none().0, ssrc, crypto.to_glib_none().0)) } } fn connect_new_rtcp_encoder(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"new-rtcp-encoder\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"new-rtcp-encoder\0".as_ptr() as *const _, transmute(new_rtcp_encoder_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -570,7 +567,7 @@ impl> RTSPStreamExt for O { fn connect_new_rtp_encoder(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"new-rtp-encoder\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"new-rtp-encoder\0".as_ptr() as *const _, transmute(new_rtp_encoder_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -578,7 +575,7 @@ impl> RTSPStreamExt for O { fn connect_property_control_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::control\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::control\0".as_ptr() as *const _, transmute(notify_control_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -586,7 +583,7 @@ impl> RTSPStreamExt for O { fn connect_property_profiles_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _, transmute(notify_profiles_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -594,7 +591,7 @@ impl> RTSPStreamExt for O { fn connect_property_protocols_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _, transmute(notify_protocols_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -603,29 +600,29 @@ impl> RTSPStreamExt for O { unsafe extern "C" fn new_rtcp_encoder_trampoline

(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f); - f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn new_rtp_encoder_trampoline

(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f); - f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) + f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object)) } unsafe extern "C" fn notify_control_trampoline

(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_profiles_trampoline

(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_protocols_trampoline

(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPStream::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs index bb8093829..ae71cd2bd 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs @@ -12,7 +12,7 @@ use gst; use gst_rtsp; glib_wrapper! { - pub struct RTSPStreamTransport(Object); + pub struct RTSPStreamTransport(Object); match fn { get_type => || ffi::gst_rtsp_stream_transport_get_type(), @@ -20,11 +20,13 @@ glib_wrapper! { } impl RTSPStreamTransport { - //pub fn new(stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> RTSPStreamTransport { + //pub fn new>(stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> RTSPStreamTransport { // unsafe { TODO: call ffi::gst_rtsp_stream_transport_new() } //} } +pub const NONE_RTSP_STREAM_TRANSPORT: Option<&RTSPStreamTransport> = None; + pub trait RTSPStreamTransportExt: 'static { fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option; @@ -58,13 +60,13 @@ pub trait RTSPStreamTransportExt: 'static { impl> RTSPStreamTransportExt for O { fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option { unsafe { - from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo(self.to_glib_none().0, start_time.to_glib())) + from_glib_full(ffi::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(ffi::gst_rtsp_stream_transport_get_stream(self.to_glib_none().0)) + from_glib_none(ffi::gst_rtsp_stream_transport_get_stream(self.as_ref().to_glib_none().0)) } } @@ -74,37 +76,37 @@ impl> RTSPStreamTransportExt for O { fn get_url(&self) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_stream_transport_get_url(self.to_glib_none().0)) + from_glib_none(ffi::gst_rtsp_stream_transport_get_url(self.as_ref().to_glib_none().0)) } } fn is_timed_out(&self) -> bool { unsafe { - from_glib(ffi::gst_rtsp_stream_transport_is_timed_out(self.to_glib_none().0)) + from_glib(ffi::gst_rtsp_stream_transport_is_timed_out(self.as_ref().to_glib_none().0)) } } fn keep_alive(&self) { unsafe { - ffi::gst_rtsp_stream_transport_keep_alive(self.to_glib_none().0); + ffi::gst_rtsp_stream_transport_keep_alive(self.as_ref().to_glib_none().0); } } fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtcp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp") + glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtcp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp") } } fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp") + glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp") } } fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_set_active(self.to_glib_none().0, active.to_glib()), "Failed to set active") + glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to set active") } } @@ -118,7 +120,7 @@ impl> RTSPStreamTransportExt for O { fn set_timed_out(&self, timedout: bool) { unsafe { - ffi::gst_rtsp_stream_transport_set_timed_out(self.to_glib_none().0, timedout.to_glib()); + ffi::gst_rtsp_stream_transport_set_timed_out(self.as_ref().to_glib_none().0, timedout.to_glib()); } } @@ -128,9 +130,8 @@ impl> RTSPStreamTransportExt for O { fn set_url<'a, P: Into>>(&self, url: P) { let url = url.into(); - let url = url.to_glib_none(); unsafe { - ffi::gst_rtsp_stream_transport_set_url(self.to_glib_none().0, url.0); + ffi::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 c4369977e..3be4853fc 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_thread_pool.rs @@ -3,7 +3,7 @@ // DO NOT EDIT use ffi; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -13,7 +13,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct RTSPThreadPool(Object); + pub struct RTSPThreadPool(Object); match fn { get_type => || ffi::gst_rtsp_thread_pool_get_type(), @@ -45,6 +45,8 @@ impl Default for RTSPThreadPool { unsafe impl Send for RTSPThreadPool {} unsafe impl Sync for RTSPThreadPool {} +pub const NONE_RTSP_THREAD_POOL: Option<&RTSPThreadPool> = None; + pub trait RTSPThreadPoolExt: 'static { fn get_max_threads(&self) -> i32; @@ -58,7 +60,7 @@ pub trait RTSPThreadPoolExt: 'static { impl> RTSPThreadPoolExt for O { fn get_max_threads(&self) -> i32 { unsafe { - ffi::gst_rtsp_thread_pool_get_max_threads(self.to_glib_none().0) + ffi::gst_rtsp_thread_pool_get_max_threads(self.as_ref().to_glib_none().0) } } @@ -68,14 +70,14 @@ impl> RTSPThreadPoolExt for O { fn set_max_threads(&self, max_threads: i32) { unsafe { - ffi::gst_rtsp_thread_pool_set_max_threads(self.to_glib_none().0, max_threads); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-threads\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::max-threads\0".as_ptr() as *const _, transmute(notify_max_threads_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -84,5 +86,5 @@ impl> RTSPThreadPoolExt for O { unsafe extern "C" fn notify_max_threads_trampoline

(this: *mut ffi::GstRTSPThreadPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&RTSPThreadPool::from_glib_borrow(this).downcast_unchecked()) + f(&RTSPThreadPool::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer-rtsp-server/src/auto/versions.txt b/gstreamer-rtsp-server/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-rtsp-server/src/auto/versions.txt +++ b/gstreamer-rtsp-server/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-rtsp/src/auto/versions.txt b/gstreamer-rtsp/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-rtsp/src/auto/versions.txt +++ b/gstreamer-rtsp/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-sdp/src/auto/versions.txt b/gstreamer-sdp/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-sdp/src/auto/versions.txt +++ b/gstreamer-sdp/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-video/src/auto/mod.rs b/gstreamer-video/src/auto/mod.rs index 8329cdeae..d2bab3029 100644 --- a/gstreamer-video/src/auto/mod.rs +++ b/gstreamer-video/src/auto/mod.rs @@ -3,10 +3,10 @@ // DO NOT EDIT mod video_filter; -pub use self::video_filter::VideoFilter; +pub use self::video_filter::{VideoFilter, VideoFilterClass, NONE_VIDEO_FILTER}; mod video_overlay; -pub use self::video_overlay::VideoOverlay; +pub use self::video_overlay::{VideoOverlay, NONE_VIDEO_OVERLAY}; pub use self::video_overlay::VideoOverlayExt; mod enums; diff --git a/gstreamer-video/src/auto/versions.txt b/gstreamer-video/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-video/src/auto/versions.txt +++ b/gstreamer-video/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-video/src/auto/video_filter.rs b/gstreamer-video/src/auto/video_filter.rs index 14efb79a9..686472c1f 100644 --- a/gstreamer-video/src/auto/video_filter.rs +++ b/gstreamer-video/src/auto/video_filter.rs @@ -6,15 +6,9 @@ use ffi; use glib::translate::*; use gst; use gst_base; -use gst_base_ffi; -use gst_ffi; glib_wrapper! { - pub struct VideoFilter(Object): [ - gst_base::BaseTransform => gst_base_ffi::GstBaseTransform, - gst::Element => gst_ffi::GstElement, - gst::Object => gst_ffi::GstObject, - ]; + pub struct VideoFilter(Object) @extends gst_base::BaseTransform, gst::Element, gst::Object; match fn { get_type => || ffi::gst_video_filter_get_type(), @@ -25,3 +19,5 @@ impl VideoFilter {} unsafe impl Send for VideoFilter {} unsafe impl Sync for VideoFilter {} + +pub const NONE_VIDEO_FILTER: Option<&VideoFilter> = None; diff --git a/gstreamer-video/src/auto/video_overlay.rs b/gstreamer-video/src/auto/video_overlay.rs index 6d13ee6bc..2ab6826bc 100644 --- a/gstreamer-video/src/auto/video_overlay.rs +++ b/gstreamer-video/src/auto/video_overlay.rs @@ -8,7 +8,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct VideoOverlay(Object); + pub struct VideoOverlay(Interface); match fn { get_type => || ffi::gst_video_overlay_get_type(), @@ -28,6 +28,8 @@ impl VideoOverlay { unsafe impl Send for VideoOverlay {} unsafe impl Sync for VideoOverlay {} +pub const NONE_VIDEO_OVERLAY: Option<&VideoOverlay> = None; + pub trait VideoOverlayExt: 'static { fn expose(&self); @@ -45,7 +47,7 @@ pub trait VideoOverlayExt: 'static { impl> VideoOverlayExt for O { fn expose(&self) { unsafe { - ffi::gst_video_overlay_expose(self.to_glib_none().0); + ffi::gst_video_overlay_expose(self.as_ref().to_glib_none().0); } } @@ -55,19 +57,19 @@ impl> VideoOverlayExt for O { fn handle_events(&self, handle_events: bool) { unsafe { - ffi::gst_video_overlay_handle_events(self.to_glib_none().0, handle_events.to_glib()); + ffi::gst_video_overlay_handle_events(self.as_ref().to_glib_none().0, handle_events.to_glib()); } } fn prepare_window_handle(&self) { unsafe { - ffi::gst_video_overlay_prepare_window_handle(self.to_glib_none().0); + ffi::gst_video_overlay_prepare_window_handle(self.as_ref().to_glib_none().0); } } fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_video_overlay_set_render_rectangle(self.to_glib_none().0, x, y, width, height), "Failed to set render rectangle") + glib_result_from_gboolean!(ffi::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-webrtc/src/auto/mod.rs b/gstreamer-webrtc/src/auto/mod.rs index 2240ff1c8..40990d04e 100644 --- a/gstreamer-webrtc/src/auto/mod.rs +++ b/gstreamer-webrtc/src/auto/mod.rs @@ -3,19 +3,19 @@ // DO NOT EDIT mod web_rtcdtls_transport; -pub use self::web_rtcdtls_transport::WebRTCDTLSTransport; +pub use self::web_rtcdtls_transport::{WebRTCDTLSTransport, WebRTCDTLSTransportClass, NONE_WEB_RTCDTLS_TRANSPORT}; mod web_rtcice_transport; -pub use self::web_rtcice_transport::WebRTCICETransport; +pub use self::web_rtcice_transport::{WebRTCICETransport, WebRTCICETransportClass, NONE_WEB_RTCICE_TRANSPORT}; mod web_rtcrtp_receiver; -pub use self::web_rtcrtp_receiver::WebRTCRTPReceiver; +pub use self::web_rtcrtp_receiver::{WebRTCRTPReceiver, WebRTCRTPReceiverClass, NONE_WEB_RTCRTP_RECEIVER}; mod web_rtcrtp_sender; -pub use self::web_rtcrtp_sender::WebRTCRTPSender; +pub use self::web_rtcrtp_sender::{WebRTCRTPSender, WebRTCRTPSenderClass, NONE_WEB_RTCRTP_SENDER}; mod web_rtcrtp_transceiver; -pub use self::web_rtcrtp_transceiver::WebRTCRTPTransceiver; +pub use self::web_rtcrtp_transceiver::{WebRTCRTPTransceiver, WebRTCRTPTransceiverClass, NONE_WEB_RTCRTP_TRANSCEIVER}; mod web_rtc_session_description; pub use self::web_rtc_session_description::WebRTCSessionDescription; diff --git a/gstreamer-webrtc/src/auto/versions.txt b/gstreamer-webrtc/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer-webrtc/src/auto/versions.txt +++ b/gstreamer-webrtc/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs b/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs index 82b14e2bf..3ccd6adf1 100644 --- a/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs +++ b/gstreamer-webrtc/src/auto/web_rtcdtls_transport.rs @@ -8,6 +8,8 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -17,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct WebRTCDTLSTransport(Object); + pub struct WebRTCDTLSTransport(Object); match fn { get_type => || ffi::gst_webrtc_dtls_transport_get_type(), @@ -32,16 +34,16 @@ impl WebRTCDTLSTransport { } } - pub fn set_transport(&self, ice: &WebRTCICETransport) { + pub fn set_transport>(&self, ice: &P) { unsafe { - ffi::gst_webrtc_dtls_transport_set_transport(self.to_glib_none().0, ice.to_glib_none().0); + ffi::gst_webrtc_dtls_transport_set_transport(self.to_glib_none().0, ice.as_ref().to_glib_none().0); } } pub fn get_property_certificate(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -49,28 +51,28 @@ impl WebRTCDTLSTransport { pub fn set_property_certificate<'a, P: Into>>(&self, certificate: P) { let certificate = certificate.into(); unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"certificate\0".as_ptr() as *const _, Value::from(certificate).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"client\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"client\0".as_ptr() as *const _, Value::from(&client).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"remote-certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"remote-certificate\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -78,7 +80,7 @@ impl WebRTCDTLSTransport { pub fn get_property_rtcp(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"rtcp\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"rtcp\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -86,7 +88,7 @@ impl WebRTCDTLSTransport { pub fn get_property_session_id(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"session-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"session-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -94,7 +96,7 @@ impl WebRTCDTLSTransport { pub fn get_property_state(&self) -> WebRTCDTLSTransportState { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -102,7 +104,7 @@ impl WebRTCDTLSTransport { pub fn get_property_transport(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"transport\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"transport\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -110,7 +112,7 @@ impl WebRTCDTLSTransport { pub fn connect_property_certificate_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::certificate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::certificate\0".as_ptr() as *const _, transmute(notify_certificate_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -118,7 +120,7 @@ impl WebRTCDTLSTransport { pub fn connect_property_client_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::client\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::client\0".as_ptr() as *const _, transmute(notify_client_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -126,7 +128,7 @@ impl WebRTCDTLSTransport { pub fn connect_property_remote_certificate_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::remote-certificate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::remote-certificate\0".as_ptr() as *const _, transmute(notify_remote_certificate_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -134,7 +136,7 @@ impl WebRTCDTLSTransport { pub fn connect_property_state_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::state\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::state\0".as_ptr() as *const _, transmute(notify_state_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -142,7 +144,7 @@ impl WebRTCDTLSTransport { pub fn connect_property_transport_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::transport\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::transport\0".as_ptr() as *const _, transmute(notify_transport_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -151,6 +153,8 @@ impl WebRTCDTLSTransport { unsafe impl Send for WebRTCDTLSTransport {} unsafe impl Sync for WebRTCDTLSTransport {} +pub const NONE_WEB_RTCDTLS_TRANSPORT: Option<&WebRTCDTLSTransport> = None; + unsafe extern "C" fn notify_certificate_trampoline(this: *mut ffi::GstWebRTCDTLSTransport, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&WebRTCDTLSTransport) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer-webrtc/src/auto/web_rtcice_transport.rs b/gstreamer-webrtc/src/auto/web_rtcice_transport.rs index 925bfd476..41f0470d3 100644 --- a/gstreamer-webrtc/src/auto/web_rtcice_transport.rs +++ b/gstreamer-webrtc/src/auto/web_rtcice_transport.rs @@ -9,6 +9,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -19,7 +20,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct WebRTCICETransport(Object); + pub struct WebRTCICETransport(Object); match fn { get_type => || ffi::gst_webrtc_ice_transport_get_type(), @@ -54,7 +55,7 @@ impl WebRTCICETransport { pub fn get_property_component(&self) -> WebRTCICEComponent { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"component\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"component\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -62,7 +63,7 @@ impl WebRTCICETransport { pub fn get_property_gathering_state(&self) -> WebRTCICEGatheringState { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"gathering-state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"gathering-state\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -70,7 +71,7 @@ impl WebRTCICETransport { pub fn get_property_state(&self) -> WebRTCICEConnectionState { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"state\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -78,7 +79,7 @@ impl WebRTCICETransport { pub fn connect_on_new_candidate(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"on-new-candidate\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"on-new-candidate\0".as_ptr() as *const _, transmute(on_new_candidate_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -86,7 +87,7 @@ impl WebRTCICETransport { pub fn connect_on_selected_candidate_pair_change(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"on-selected-candidate-pair-change\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"on-selected-candidate-pair-change\0".as_ptr() as *const _, transmute(on_selected_candidate_pair_change_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -94,7 +95,7 @@ impl WebRTCICETransport { pub fn connect_property_gathering_state_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::gathering-state\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::gathering-state\0".as_ptr() as *const _, transmute(notify_gathering_state_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -102,7 +103,7 @@ impl WebRTCICETransport { pub fn connect_property_state_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::state\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::state\0".as_ptr() as *const _, transmute(notify_state_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -111,6 +112,8 @@ impl WebRTCICETransport { unsafe impl Send for WebRTCICETransport {} unsafe impl Sync for WebRTCICETransport {} +pub const NONE_WEB_RTCICE_TRANSPORT: Option<&WebRTCICETransport> = None; + unsafe extern "C" fn on_new_candidate_trampoline(this: *mut ffi::GstWebRTCICETransport, object: *mut libc::c_char, f: glib_ffi::gpointer) { let f: &&(Fn(&WebRTCICETransport, &str) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this), &GString::from_glib_borrow(object)) diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs index 5587245e3..02b2304a9 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_receiver.rs @@ -4,10 +4,11 @@ use WebRTCDTLSTransport; use ffi; +use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct WebRTCRTPReceiver(Object); + pub struct WebRTCRTPReceiver(Object); match fn { get_type => || ffi::gst_webrtc_rtp_receiver_get_type(), @@ -22,15 +23,15 @@ impl WebRTCRTPReceiver { } } - pub fn set_rtcp_transport(&self, transport: &WebRTCDTLSTransport) { + pub fn set_rtcp_transport>(&self, transport: &P) { unsafe { - ffi::gst_webrtc_rtp_receiver_set_rtcp_transport(self.to_glib_none().0, transport.to_glib_none().0); + ffi::gst_webrtc_rtp_receiver_set_rtcp_transport(self.to_glib_none().0, transport.as_ref().to_glib_none().0); } } - pub fn set_transport(&self, transport: &WebRTCDTLSTransport) { + pub fn set_transport>(&self, transport: &P) { unsafe { - ffi::gst_webrtc_rtp_receiver_set_transport(self.to_glib_none().0, transport.to_glib_none().0); + ffi::gst_webrtc_rtp_receiver_set_transport(self.to_glib_none().0, transport.as_ref().to_glib_none().0); } } } @@ -43,3 +44,5 @@ impl Default for WebRTCRTPReceiver { unsafe impl Send for WebRTCRTPReceiver {} unsafe impl Sync for WebRTCRTPReceiver {} + +pub const NONE_WEB_RTCRTP_RECEIVER: Option<&WebRTCRTPReceiver> = None; diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs index ecc7408dc..a8e04136b 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_sender.rs @@ -4,10 +4,11 @@ use WebRTCDTLSTransport; use ffi; +use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct WebRTCRTPSender(Object); + pub struct WebRTCRTPSender(Object); match fn { get_type => || ffi::gst_webrtc_rtp_sender_get_type(), @@ -22,15 +23,15 @@ impl WebRTCRTPSender { } } - pub fn set_rtcp_transport(&self, transport: &WebRTCDTLSTransport) { + pub fn set_rtcp_transport>(&self, transport: &P) { unsafe { - ffi::gst_webrtc_rtp_sender_set_rtcp_transport(self.to_glib_none().0, transport.to_glib_none().0); + ffi::gst_webrtc_rtp_sender_set_rtcp_transport(self.to_glib_none().0, transport.as_ref().to_glib_none().0); } } - pub fn set_transport(&self, transport: &WebRTCDTLSTransport) { + pub fn set_transport>(&self, transport: &P) { unsafe { - ffi::gst_webrtc_rtp_sender_set_transport(self.to_glib_none().0, transport.to_glib_none().0); + ffi::gst_webrtc_rtp_sender_set_transport(self.to_glib_none().0, transport.as_ref().to_glib_none().0); } } } @@ -43,3 +44,5 @@ impl Default for WebRTCRTPSender { unsafe impl Send for WebRTCRTPSender {} unsafe impl Sync for WebRTCRTPSender {} + +pub const NONE_WEB_RTCRTP_SENDER: Option<&WebRTCRTPSender> = None; diff --git a/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs b/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs index d08278fa2..95d82afb3 100644 --- a/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs +++ b/gstreamer-webrtc/src/auto/web_rtcrtp_transceiver.rs @@ -7,11 +7,12 @@ use WebRTCRTPSender; use ffi; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::translate::*; use gobject_ffi; glib_wrapper! { - pub struct WebRTCRTPTransceiver(Object); + pub struct WebRTCRTPTransceiver(Object); match fn { get_type => || ffi::gst_webrtc_rtp_transceiver_get_type(), @@ -22,7 +23,7 @@ impl WebRTCRTPTransceiver { pub fn get_property_mlineindex(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"mlineindex\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"mlineindex\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -30,7 +31,7 @@ impl WebRTCRTPTransceiver { pub fn get_property_receiver(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"receiver\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"receiver\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -38,7 +39,7 @@ impl WebRTCRTPTransceiver { pub fn get_property_sender(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"sender\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"sender\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -46,3 +47,5 @@ impl WebRTCRTPTransceiver { unsafe impl Send for WebRTCRTPTransceiver {} unsafe impl Sync for WebRTCRTPTransceiver {} + +pub const NONE_WEB_RTCRTP_TRANSCEIVER: Option<&WebRTCRTPTransceiver> = None; diff --git a/gstreamer/src/auto/bin.rs b/gstreamer/src/auto/bin.rs index 1cf6e12e9..952137dfc 100644 --- a/gstreamer/src/auto/bin.rs +++ b/gstreamer/src/auto/bin.rs @@ -2,7 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use BinClass; use ChildProxy; use Element; #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -14,7 +13,7 @@ use ffi; use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -25,7 +24,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Bin(Object): Element, Object, ChildProxy; + pub struct Bin(Object) @extends Element, Object, @implements ChildProxy; match fn { get_type => || ffi::gst_bin_get_type(), @@ -36,9 +35,8 @@ impl Bin { pub fn new<'a, P: Into>>(name: P) -> Bin { assert_initialized_main_thread!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - Element::from_glib_none(ffi::gst_bin_new(name.0)).downcast_unchecked() + Element::from_glib_none(ffi::gst_bin_new(name.to_glib_none().0)).unsafe_cast() } } } @@ -46,6 +44,8 @@ impl Bin { unsafe impl Send for Bin {} unsafe impl Sync for Bin {} +pub const NONE_BIN: Option<&Bin> = None; + pub trait GstBinExt: 'static { fn add>(&self, element: &P) -> Result<(), glib::error::BoolError>; @@ -113,7 +113,7 @@ pub trait GstBinExt: 'static { impl> GstBinExt for O { fn add>(&self, element: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_bin_add(self.to_glib_none().0, element.to_glib_none().0), "Failed to add element") + glib_result_from_gboolean!(ffi::gst_bin_add(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0), "Failed to add element") } } @@ -123,32 +123,32 @@ impl> GstBinExt for O { fn find_unlinked_pad(&self, direction: PadDirection) -> Option { unsafe { - from_glib_full(ffi::gst_bin_find_unlinked_pad(self.to_glib_none().0, direction.to_glib())) + from_glib_full(ffi::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(ffi::gst_bin_get_by_interface(self.to_glib_none().0, iface.to_glib())) + from_glib_full(ffi::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(ffi::gst_bin_get_by_name(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_bin_get_by_name_recurse_up(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_bin_get_suppressed_flags(self.to_glib_none().0)) + from_glib(ffi::gst_bin_get_suppressed_flags(self.as_ref().to_glib_none().0)) } } @@ -178,13 +178,13 @@ impl> GstBinExt for O { fn recalculate_latency(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_bin_recalculate_latency(self.to_glib_none().0), "Failed to recalculate latency") + glib_result_from_gboolean!(ffi::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!(ffi::gst_bin_remove(self.to_glib_none().0, element.to_glib_none().0), "Failed to remove element") + glib_result_from_gboolean!(ffi::gst_bin_remove(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0), "Failed to remove element") } } @@ -195,13 +195,13 @@ impl> GstBinExt for O { #[cfg(any(feature = "v1_10", feature = "dox"))] fn set_suppressed_flags(&self, flags: ElementFlags) { unsafe { - ffi::gst_bin_set_suppressed_flags(self.to_glib_none().0, flags.to_glib()); + ffi::gst_bin_set_suppressed_flags(self.as_ref().to_glib_none().0, flags.to_glib()); } } fn sync_children_states(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_bin_sync_children_states(self.to_glib_none().0), "Failed to sync children states") + glib_result_from_gboolean!(ffi::gst_bin_sync_children_states(self.as_ref().to_glib_none().0), "Failed to sync children states") } } @@ -237,7 +237,7 @@ impl> GstBinExt for O { fn connect_deep_element_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"deep-element-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"deep-element-added\0".as_ptr() as *const _, transmute(deep_element_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -246,7 +246,7 @@ impl> GstBinExt for O { fn connect_deep_element_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"deep-element-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"deep-element-removed\0".as_ptr() as *const _, transmute(deep_element_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -254,7 +254,7 @@ impl> GstBinExt for O { fn connect_do_latency bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"do-latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"do-latency\0".as_ptr() as *const _, transmute(do_latency_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -262,7 +262,7 @@ impl> GstBinExt for O { fn connect_element_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"element-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"element-added\0".as_ptr() as *const _, transmute(element_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -270,7 +270,7 @@ impl> GstBinExt for O { fn connect_element_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"element-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"element-removed\0".as_ptr() as *const _, transmute(element_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -278,7 +278,7 @@ impl> GstBinExt for O { fn connect_property_async_handling_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::async-handling\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::async-handling\0".as_ptr() as *const _, transmute(notify_async_handling_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -286,7 +286,7 @@ impl> GstBinExt for O { fn connect_property_message_forward_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::message-forward\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::message-forward\0".as_ptr() as *const _, transmute(notify_message_forward_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -296,42 +296,42 @@ impl> GstBinExt for O { unsafe extern "C" fn deep_element_added_trampoline

(this: *mut ffi::GstBin, sub_bin: *mut ffi::GstBin, element: *mut ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Bin, &Element) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked(), &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)) } #[cfg(any(feature = "v1_10", feature = "dox"))] unsafe extern "C" fn deep_element_removed_trampoline

(this: *mut ffi::GstBin, sub_bin: *mut ffi::GstBin, element: *mut ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Bin, &Element) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked(), &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 extern "C" fn do_latency_trampoline

(this: *mut ffi::GstBin, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { let f: &&(Fn(&P) -> bool + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked()).to_glib() + f(&Bin::from_glib_borrow(this).unsafe_cast()).to_glib() } unsafe extern "C" fn element_added_trampoline

(this: *mut ffi::GstBin, element: *mut ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Element) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) + f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) } unsafe extern "C" fn element_removed_trampoline

(this: *mut ffi::GstBin, element: *mut ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Element) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) + f(&Bin::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element)) } unsafe extern "C" fn notify_async_handling_trampoline

(this: *mut ffi::GstBin, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked()) + f(&Bin::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_message_forward_trampoline

(this: *mut ffi::GstBin, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Bin::from_glib_borrow(this).downcast_unchecked()) + f(&Bin::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/buffer_pool.rs b/gstreamer/src/auto/buffer_pool.rs index 1d362f057..799aa60cc 100644 --- a/gstreamer/src/auto/buffer_pool.rs +++ b/gstreamer/src/auto/buffer_pool.rs @@ -10,7 +10,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct BufferPool(Object): Object; + pub struct BufferPool(Object) @extends Object; match fn { get_type => || ffi::gst_buffer_pool_get_type(), @@ -20,6 +20,8 @@ glib_wrapper! { unsafe impl Send for BufferPool {} unsafe impl Sync for BufferPool {} +pub const NONE_BUFFER_POOL: Option<&BufferPool> = None; + pub trait BufferPoolExt: 'static { fn get_options(&self) -> Vec; @@ -35,31 +37,31 @@ pub trait BufferPoolExt: 'static { impl> BufferPoolExt for O { fn get_options(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_buffer_pool_get_options(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_buffer_pool_get_options(self.as_ref().to_glib_none().0)) } } fn has_option(&self, option: &str) -> bool { unsafe { - from_glib(ffi::gst_buffer_pool_has_option(self.to_glib_none().0, option.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_buffer_pool_is_active(self.to_glib_none().0)) + from_glib(ffi::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!(ffi::gst_buffer_pool_set_active(self.to_glib_none().0, active.to_glib()), "Failed to activate buffer pool") + glib_result_from_gboolean!(ffi::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 { - ffi::gst_buffer_pool_set_flushing(self.to_glib_none().0, flushing.to_glib()); + ffi::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 05f6fc47d..dbf5608f1 100644 --- a/gstreamer/src/auto/bus.rs +++ b/gstreamer/src/auto/bus.rs @@ -7,6 +7,7 @@ use Message; use Object; use ffi; use glib; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -15,7 +16,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Bus(Object): Object; + pub struct Bus(Object) @extends Object; match fn { get_type => || ffi::gst_bus_get_type(), @@ -124,7 +125,7 @@ impl Bus { pub fn connect_message(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"message\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"message\0".as_ptr() as *const _, transmute(message_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -132,7 +133,7 @@ impl Bus { pub fn connect_sync_message(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"sync-message\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"sync-message\0".as_ptr() as *const _, transmute(sync_message_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -147,6 +148,8 @@ impl Default for Bus { unsafe impl Send for Bus {} unsafe impl Sync for Bus {} +pub const NONE_BUS: Option<&Bus> = None; + unsafe extern "C" fn message_trampoline(this: *mut ffi::GstBus, message: *mut ffi::GstMessage, f: glib_ffi::gpointer) { let f: &&(Fn(&Bus, &Message) + Send + 'static) = transmute(f); f(&from_glib_borrow(this), &from_glib_borrow(message)) diff --git a/gstreamer/src/auto/child_proxy.rs b/gstreamer/src/auto/child_proxy.rs index a9da654de..4eb36565b 100644 --- a/gstreamer/src/auto/child_proxy.rs +++ b/gstreamer/src/auto/child_proxy.rs @@ -5,7 +5,7 @@ use ffi; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -17,7 +17,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct ChildProxy(Object); + pub struct ChildProxy(Interface); match fn { get_type => || ffi::gst_child_proxy_get_type(), @@ -27,6 +27,8 @@ glib_wrapper! { unsafe impl Send for ChildProxy {} unsafe impl Sync for ChildProxy {} +pub const NONE_CHILD_PROXY: Option<&ChildProxy> = None; + pub trait ChildProxyExt: 'static { fn child_added>(&self, child: &P, name: &str); @@ -60,13 +62,13 @@ pub trait ChildProxyExt: 'static { impl> ChildProxyExt for O { fn child_added>(&self, child: &P, name: &str) { unsafe { - ffi::gst_child_proxy_child_added(self.to_glib_none().0, child.to_glib_none().0, name.to_glib_none().0); + ffi::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 { - ffi::gst_child_proxy_child_removed(self.to_glib_none().0, child.to_glib_none().0, name.to_glib_none().0); + ffi::gst_child_proxy_child_removed(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0); } } @@ -76,19 +78,19 @@ impl> ChildProxyExt for O { fn get_child_by_index(&self, index: u32) -> Option { unsafe { - from_glib_full(ffi::gst_child_proxy_get_child_by_index(self.to_glib_none().0, index)) + from_glib_full(ffi::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(ffi::gst_child_proxy_get_child_by_name(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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 { - ffi::gst_child_proxy_get_children_count(self.to_glib_none().0) + ffi::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) } } @@ -119,7 +121,7 @@ impl> ChildProxyExt for O { fn connect_child_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"child-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"child-added\0".as_ptr() as *const _, transmute(child_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -127,7 +129,7 @@ impl> ChildProxyExt for O { fn connect_child_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"child-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"child-removed\0".as_ptr() as *const _, transmute(child_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -136,11 +138,11 @@ impl> ChildProxyExt for O { unsafe extern "C" fn child_added_trampoline

(this: *mut ffi::GstChildProxy, object: *mut gobject_ffi::GObject, name: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &glib::Object, &str) + Send + Sync + 'static) = transmute(f); - f(&ChildProxy::from_glib_borrow(this).downcast_unchecked(), &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 extern "C" fn child_removed_trampoline

(this: *mut ffi::GstChildProxy, object: *mut gobject_ffi::GObject, name: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &glib::Object, &str) + Send + Sync + 'static) = transmute(f); - f(&ChildProxy::from_glib_borrow(this).downcast_unchecked(), &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)) } diff --git a/gstreamer/src/auto/clock.rs b/gstreamer/src/auto/clock.rs index 910767a6a..d84d83037 100644 --- a/gstreamer/src/auto/clock.rs +++ b/gstreamer/src/auto/clock.rs @@ -8,7 +8,7 @@ use ffi; use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -20,7 +20,7 @@ use std::mem; use std::mem::transmute; glib_wrapper! { - pub struct Clock(Object): Object; + pub struct Clock(Object) @extends Object; match fn { get_type => || ffi::gst_clock_get_type(), @@ -60,6 +60,8 @@ impl Clock { unsafe impl Send for Clock {} unsafe impl Sync for Clock {} +pub const NONE_CLOCK: Option<&Clock> = None; + pub trait ClockExt: 'static { fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option; @@ -124,7 +126,7 @@ impl> ClockExt for O { fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option { unsafe { let mut r_squared = mem::uninitialized(); - let ret = from_glib(ffi::gst_clock_add_observation(self.to_glib_none().0, slave.to_glib(), master.to_glib(), &mut r_squared)); + let ret = from_glib(ffi::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 } } } @@ -136,14 +138,14 @@ impl> ClockExt for O { let mut external = mem::uninitialized(); let mut rate_num = mem::uninitialized(); let mut rate_denom = mem::uninitialized(); - let ret = from_glib(ffi::gst_clock_add_observation_unapplied(self.to_glib_none().0, slave.to_glib(), master.to_glib(), &mut r_squared, &mut internal, &mut external, &mut rate_num, &mut rate_denom)); + let ret = from_glib(ffi::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(ffi::gst_clock_adjust_unlocked(self.to_glib_none().0, internal.to_glib())) + from_glib(ffi::gst_clock_adjust_unlocked(self.as_ref().to_glib_none().0, internal.to_glib())) } } @@ -153,44 +155,44 @@ impl> ClockExt for O { let mut external = mem::uninitialized(); let mut rate_num = mem::uninitialized(); let mut rate_denom = mem::uninitialized(); - ffi::gst_clock_get_calibration(self.to_glib_none().0, &mut internal, &mut external, &mut rate_num, &mut rate_denom); + ffi::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(ffi::gst_clock_get_internal_time(self.to_glib_none().0)) + from_glib(ffi::gst_clock_get_internal_time(self.as_ref().to_glib_none().0)) } } fn get_master(&self) -> Option { unsafe { - from_glib_full(ffi::gst_clock_get_master(self.to_glib_none().0)) + from_glib_full(ffi::gst_clock_get_master(self.as_ref().to_glib_none().0)) } } fn get_resolution(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_get_resolution(self.to_glib_none().0)) + from_glib(ffi::gst_clock_get_resolution(self.as_ref().to_glib_none().0)) } } fn get_time(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_get_time(self.to_glib_none().0)) + from_glib(ffi::gst_clock_get_time(self.as_ref().to_glib_none().0)) } } fn get_timeout(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_get_timeout(self.to_glib_none().0)) + from_glib(ffi::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) } } fn is_synced(&self) -> bool { unsafe { - from_glib(ffi::gst_clock_is_synced(self.to_glib_none().0)) + from_glib(ffi::gst_clock_is_synced(self.as_ref().to_glib_none().0)) } } @@ -208,33 +210,32 @@ impl> ClockExt for O { fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime) { unsafe { - ffi::gst_clock_set_calibration(self.to_glib_none().0, internal.to_glib(), external.to_glib(), rate_num.to_glib(), rate_denom.to_glib()); + ffi::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<'a, P: IsA + 'a, Q: Into>>(&self, master: Q) -> Result<(), glib::error::BoolError> { let master = master.into(); - let master = master.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_clock_set_master(self.to_glib_none().0, master.0), "Failed to set master clock") + glib_result_from_gboolean!(ffi::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(ffi::gst_clock_set_resolution(self.to_glib_none().0, resolution.to_glib())) + from_glib(ffi::gst_clock_set_resolution(self.as_ref().to_glib_none().0, resolution.to_glib())) } } fn set_synced(&self, synced: bool) { unsafe { - ffi::gst_clock_set_synced(self.to_glib_none().0, synced.to_glib()); + ffi::gst_clock_set_synced(self.as_ref().to_glib_none().0, synced.to_glib()); } } fn set_timeout(&self, timeout: ClockTime) { unsafe { - ffi::gst_clock_set_timeout(self.to_glib_none().0, timeout.to_glib()); + ffi::gst_clock_set_timeout(self.as_ref().to_glib_none().0, timeout.to_glib()); } } @@ -244,13 +245,13 @@ impl> ClockExt for O { fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_unadjust_unlocked(self.to_glib_none().0, external.to_glib())) + from_glib(ffi::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!(ffi::gst_clock_wait_for_sync(self.to_glib_none().0, timeout.to_glib()), "Timed out waiting for sync") + glib_result_from_gboolean!(ffi::gst_clock_wait_for_sync(self.as_ref().to_glib_none().0, timeout.to_glib()), "Timed out waiting for sync") } } @@ -285,7 +286,7 @@ impl> ClockExt for O { fn connect_synced(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"synced\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"synced\0".as_ptr() as *const _, transmute(synced_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -293,7 +294,7 @@ impl> ClockExt for O { fn connect_property_timeout_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeout\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, transmute(notify_timeout_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -301,7 +302,7 @@ impl> ClockExt for O { fn connect_property_window_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::window-size\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::window-size\0".as_ptr() as *const _, transmute(notify_window_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -309,7 +310,7 @@ impl> ClockExt for O { fn connect_property_window_threshold_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::window-threshold\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::window-threshold\0".as_ptr() as *const _, transmute(notify_window_threshold_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -318,23 +319,23 @@ impl> ClockExt for O { unsafe extern "C" fn synced_trampoline

(this: *mut ffi::GstClock, synced: glib_ffi::gboolean, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, bool) + Send + Sync + 'static) = transmute(f); - f(&Clock::from_glib_borrow(this).downcast_unchecked(), from_glib(synced)) + f(&Clock::from_glib_borrow(this).unsafe_cast(), from_glib(synced)) } unsafe extern "C" fn notify_timeout_trampoline

(this: *mut ffi::GstClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Clock::from_glib_borrow(this).downcast_unchecked()) + f(&Clock::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_window_size_trampoline

(this: *mut ffi::GstClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Clock::from_glib_borrow(this).downcast_unchecked()) + f(&Clock::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_window_threshold_trampoline

(this: *mut ffi::GstClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Clock::from_glib_borrow(this).downcast_unchecked()) + f(&Clock::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/device.rs b/gstreamer/src/auto/device.rs index bee79807d..4b972af20 100644 --- a/gstreamer/src/auto/device.rs +++ b/gstreamer/src/auto/device.rs @@ -8,7 +8,7 @@ use Object; use Structure; use ffi; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -18,7 +18,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Device(Object): Object; + pub struct Device(Object) @extends Object; match fn { get_type => || ffi::gst_device_get_type(), @@ -28,6 +28,8 @@ glib_wrapper! { unsafe impl Send for Device {} unsafe impl Sync for Device {} +pub const NONE_DEVICE: Option<&Device> = None; + pub trait DeviceExt: 'static { fn create_element<'a, P: Into>>(&self, name: P) -> Option; @@ -51,58 +53,57 @@ pub trait DeviceExt: 'static { impl> DeviceExt for O { fn create_element<'a, P: Into>>(&self, name: P) -> Option { let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib_full(ffi::gst_device_create_element(self.to_glib_none().0, name.0)) + from_glib_full(ffi::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(ffi::gst_device_get_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_get_caps(self.as_ref().to_glib_none().0)) } } fn get_device_class(&self) -> GString { unsafe { - from_glib_full(ffi::gst_device_get_device_class(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_get_device_class(self.as_ref().to_glib_none().0)) } } fn get_display_name(&self) -> GString { unsafe { - from_glib_full(ffi::gst_device_get_display_name(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_get_display_name(self.as_ref().to_glib_none().0)) } } fn get_properties(&self) -> Option { unsafe { - from_glib_full(ffi::gst_device_get_properties(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_get_properties(self.as_ref().to_glib_none().0)) } } fn has_classes(&self, classes: &str) -> bool { unsafe { - from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_device_has_classesv(self.to_glib_none().0, classes.to_glib_none().0)) + from_glib(ffi::gst_device_has_classesv(self.as_ref().to_glib_none().0, classes.to_glib_none().0)) } } fn reconfigure_element>(&self, element: &P) -> bool { unsafe { - from_glib(ffi::gst_device_reconfigure_element(self.to_glib_none().0, element.to_glib_none().0)) + from_glib(ffi::gst_device_reconfigure_element(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0)) } } fn connect_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"removed\0".as_ptr() as *const _, transmute(removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -111,5 +112,5 @@ impl> DeviceExt for O { unsafe extern "C" fn removed_trampoline

(this: *mut ffi::GstDevice, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Device::from_glib_borrow(this).downcast_unchecked()) + f(&Device::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/device_monitor.rs b/gstreamer/src/auto/device_monitor.rs index 50e7e598d..2bba094b7 100644 --- a/gstreamer/src/auto/device_monitor.rs +++ b/gstreamer/src/auto/device_monitor.rs @@ -11,7 +11,7 @@ use glib; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -22,7 +22,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct DeviceMonitor(Object): Object; + pub struct DeviceMonitor(Object) @extends Object; match fn { get_type => || ffi::gst_device_monitor_get_type(), @@ -32,6 +32,8 @@ glib_wrapper! { unsafe impl Send for DeviceMonitor {} unsafe impl Sync for DeviceMonitor {} +pub const NONE_DEVICE_MONITOR: Option<&DeviceMonitor> = None; + pub trait DeviceMonitorExt: 'static { fn add_filter<'a, 'b, P: Into>, Q: Into>>(&self, classes: P, caps: Q) -> u32; @@ -61,59 +63,57 @@ pub trait DeviceMonitorExt: 'static { impl> DeviceMonitorExt for O { fn add_filter<'a, 'b, P: Into>, Q: Into>>(&self, classes: P, caps: Q) -> u32 { let classes = classes.into(); - let classes = classes.to_glib_none(); let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - ffi::gst_device_monitor_add_filter(self.to_glib_none().0, classes.0, caps.0) + ffi::gst_device_monitor_add_filter(self.as_ref().to_glib_none().0, classes.to_glib_none().0, caps.to_glib_none().0) } } fn get_bus(&self) -> Bus { unsafe { - from_glib_full(ffi::gst_device_monitor_get_bus(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_monitor_get_bus(self.as_ref().to_glib_none().0)) } } fn get_devices(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_devices(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_devices(self.as_ref().to_glib_none().0)) } } fn get_providers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_providers(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_providers(self.as_ref().to_glib_none().0)) } } fn get_show_all_devices(&self) -> bool { unsafe { - from_glib(ffi::gst_device_monitor_get_show_all_devices(self.to_glib_none().0)) + from_glib(ffi::gst_device_monitor_get_show_all_devices(self.as_ref().to_glib_none().0)) } } fn remove_filter(&self, filter_id: u32) -> bool { unsafe { - from_glib(ffi::gst_device_monitor_remove_filter(self.to_glib_none().0, filter_id)) + from_glib(ffi::gst_device_monitor_remove_filter(self.as_ref().to_glib_none().0, filter_id)) } } fn set_show_all_devices(&self, show_all: bool) { unsafe { - ffi::gst_device_monitor_set_show_all_devices(self.to_glib_none().0, show_all.to_glib()); + ffi::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!(ffi::gst_device_monitor_start(self.to_glib_none().0), "Failed to start") + glib_result_from_gboolean!(ffi::gst_device_monitor_start(self.as_ref().to_glib_none().0), "Failed to start") } } fn stop(&self) { unsafe { - ffi::gst_device_monitor_stop(self.to_glib_none().0); + ffi::gst_device_monitor_stop(self.as_ref().to_glib_none().0); } } @@ -134,7 +134,7 @@ impl> DeviceMonitorExt for O { fn connect_property_show_all_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::show-all\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::show-all\0".as_ptr() as *const _, transmute(notify_show_all_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -143,5 +143,5 @@ impl> DeviceMonitorExt for O { unsafe extern "C" fn notify_show_all_trampoline

(this: *mut ffi::GstDeviceMonitor, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&DeviceMonitor::from_glib_borrow(this).downcast_unchecked()) + f(&DeviceMonitor::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/device_provider.rs b/gstreamer/src/auto/device_provider.rs index eb6290877..b098b62b6 100644 --- a/gstreamer/src/auto/device_provider.rs +++ b/gstreamer/src/auto/device_provider.rs @@ -10,7 +10,7 @@ use Plugin; use ffi; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -21,7 +21,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct DeviceProvider(Object): Object; + pub struct DeviceProvider(Object) @extends Object; match fn { get_type => || ffi::gst_device_provider_get_type(), @@ -29,12 +29,11 @@ glib_wrapper! { } impl DeviceProvider { - pub fn register<'a, P: Into>>(plugin: P, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> { + pub fn register<'a, P: IsA + 'a, Q: Into>>(plugin: Q, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); let plugin = plugin.into(); - let plugin = plugin.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_device_provider_register(plugin.0, name.to_glib_none().0, rank, type_.to_glib()), "Failed to register device provider factory") + glib_result_from_gboolean!(ffi::gst_device_provider_register(plugin.map(|p| p.as_ref()).to_glib_none().0, name.to_glib_none().0, rank, type_.to_glib()), "Failed to register device provider factory") } } } @@ -42,12 +41,14 @@ impl DeviceProvider { unsafe impl Send for DeviceProvider {} unsafe impl Sync for DeviceProvider {} +pub const NONE_DEVICE_PROVIDER: Option<&DeviceProvider> = None; + pub trait DeviceProviderExt: 'static { fn can_monitor(&self) -> bool; - fn device_add(&self, device: &Device); + fn device_add>(&self, device: &P); - fn device_remove(&self, device: &Device); + fn device_remove>(&self, device: &P); fn get_bus(&self) -> Bus; @@ -73,74 +74,74 @@ pub trait DeviceProviderExt: 'static { impl> DeviceProviderExt for O { fn can_monitor(&self) -> bool { unsafe { - from_glib(ffi::gst_device_provider_can_monitor(self.to_glib_none().0)) + from_glib(ffi::gst_device_provider_can_monitor(self.as_ref().to_glib_none().0)) } } - fn device_add(&self, device: &Device) { + fn device_add>(&self, device: &P) { unsafe { - ffi::gst_device_provider_device_add(self.to_glib_none().0, device.to_glib_none().0); + ffi::gst_device_provider_device_add(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0); } } - fn device_remove(&self, device: &Device) { + fn device_remove>(&self, device: &P) { unsafe { - ffi::gst_device_provider_device_remove(self.to_glib_none().0, device.to_glib_none().0); + ffi::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(ffi::gst_device_provider_get_bus(self.to_glib_none().0)) + from_glib_full(ffi::gst_device_provider_get_bus(self.as_ref().to_glib_none().0)) } } fn get_devices(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_devices(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_devices(self.as_ref().to_glib_none().0)) } } fn get_factory(&self) -> Option { unsafe { - from_glib_none(ffi::gst_device_provider_get_factory(self.to_glib_none().0)) + from_glib_none(ffi::gst_device_provider_get_factory(self.as_ref().to_glib_none().0)) } } fn get_hidden_providers(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_hidden_providers(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_hidden_providers(self.as_ref().to_glib_none().0)) } } fn hide_provider(&self, name: &str) { unsafe { - ffi::gst_device_provider_hide_provider(self.to_glib_none().0, name.to_glib_none().0); + ffi::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!(ffi::gst_device_provider_start(self.to_glib_none().0), "Failed to start") + glib_result_from_gboolean!(ffi::gst_device_provider_start(self.as_ref().to_glib_none().0), "Failed to start") } } fn stop(&self) { unsafe { - ffi::gst_device_provider_stop(self.to_glib_none().0); + ffi::gst_device_provider_stop(self.as_ref().to_glib_none().0); } } fn unhide_provider(&self, name: &str) { unsafe { - ffi::gst_device_provider_unhide_provider(self.to_glib_none().0, name.to_glib_none().0); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"provider-hidden\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"provider-hidden\0".as_ptr() as *const _, transmute(provider_hidden_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -148,7 +149,7 @@ impl> DeviceProviderExt for O { fn connect_provider_unhidden(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"provider-unhidden\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"provider-unhidden\0".as_ptr() as *const _, transmute(provider_unhidden_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -157,11 +158,11 @@ impl> DeviceProviderExt for O { unsafe extern "C" fn provider_hidden_trampoline

(this: *mut ffi::GstDeviceProvider, object: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &str) + Send + Sync + 'static) = transmute(f); - f(&DeviceProvider::from_glib_borrow(this).downcast_unchecked(), &GString::from_glib_borrow(object)) + f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) } unsafe extern "C" fn provider_unhidden_trampoline

(this: *mut ffi::GstDeviceProvider, object: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &str) + Send + Sync + 'static) = transmute(f); - f(&DeviceProvider::from_glib_borrow(this).downcast_unchecked(), &GString::from_glib_borrow(object)) + f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) } diff --git a/gstreamer/src/auto/device_provider_factory.rs b/gstreamer/src/auto/device_provider_factory.rs index 2c8cbd72b..10cad7026 100644 --- a/gstreamer/src/auto/device_provider_factory.rs +++ b/gstreamer/src/auto/device_provider_factory.rs @@ -12,7 +12,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct DeviceProviderFactory(Object): PluginFeature, Object; + pub struct DeviceProviderFactory(Object) @extends PluginFeature, Object; match fn { get_type => || ffi::gst_device_provider_factory_get_type(), @@ -46,9 +46,8 @@ impl DeviceProviderFactory { pub fn has_classes<'a, P: Into>>(&self, classes: P) -> bool { let classes = classes.into(); - let classes = classes.to_glib_none(); unsafe { - from_glib(ffi::gst_device_provider_factory_has_classes(self.to_glib_none().0, classes.0)) + from_glib(ffi::gst_device_provider_factory_has_classes(self.to_glib_none().0, classes.to_glib_none().0)) } } @@ -82,3 +81,5 @@ impl DeviceProviderFactory { unsafe impl Send for DeviceProviderFactory {} unsafe impl Sync for DeviceProviderFactory {} + +pub const NONE_DEVICE_PROVIDER_FACTORY: Option<&DeviceProviderFactory> = None; diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index 701a46f31..127e4063d 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -7,7 +7,6 @@ use Caps; use Clock; use ClockTime; use Context; -use ElementClass; use ElementFactory; use Error; use Message; @@ -19,7 +18,7 @@ use Plugin; use URIType; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -30,7 +29,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Element(Object): Object; + pub struct Element(Object) @extends Object; match fn { get_type => || ffi::gst_element_get_type(), @@ -41,20 +40,18 @@ impl Element { pub fn make_from_uri<'a, P: Into>>(type_: URIType, uri: &str, elementname: P) -> Result { assert_initialized_main_thread!(); let elementname = elementname.into(); - let elementname = elementname.to_glib_none(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_element_make_from_uri(type_.to_glib(), uri.to_glib_none().0, elementname.0, &mut error); + let ret = ffi::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)) } } } - pub fn register<'a, P: Into>>(plugin: P, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> { + pub fn register<'a, P: IsA + 'a, Q: Into>>(plugin: Q, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); let plugin = plugin.into(); - let plugin = plugin.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_register(plugin.0, name.to_glib_none().0, rank, type_.to_glib()), "Failed to register element factory") + glib_result_from_gboolean!(ffi::gst_element_register(plugin.map(|p| p.as_ref()).to_glib_none().0, name.to_glib_none().0, rank, type_.to_glib()), "Failed to register element factory") } } } @@ -62,6 +59,8 @@ impl Element { unsafe impl Send for Element {} unsafe impl Sync for Element {} +pub const NONE_ELEMENT: Option<&Element> = None; + pub trait ElementExt: 'static { fn abort_state(&self); @@ -89,7 +88,7 @@ pub trait ElementExt: 'static { fn get_compatible_pad<'a, P: IsA, Q: Into>>(&self, pad: &P, caps: Q) -> Option; - fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option; + fn get_compatible_pad_template>(&self, compattempl: &P) -> Option; fn get_context(&self, context_type: &str) -> Option; @@ -140,11 +139,11 @@ pub trait ElementExt: 'static { fn remove_pad>(&self, pad: &P) -> Result<(), glib::error::BoolError>; - fn request_pad<'a, 'b, P: Into>, Q: Into>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option; + fn request_pad<'a, 'b, P: IsA, Q: Into>, R: Into>>(&self, templ: &P, name: Q, caps: R) -> Option; fn set_base_time(&self, time: ClockTime); - fn set_bus<'a, P: Into>>(&self, bus: P); + fn set_bus<'a, P: IsA + 'a, Q: Into>>(&self, bus: Q); fn set_clock<'a, P: IsA + 'a, Q: Into>>(&self, clock: Q) -> Result<(), glib::error::BoolError>; @@ -172,13 +171,13 @@ pub trait ElementExt: 'static { impl> ElementExt for O { fn abort_state(&self) { unsafe { - ffi::gst_element_abort_state(self.to_glib_none().0); + ffi::gst_element_abort_state(self.as_ref().to_glib_none().0); } } fn add_pad>(&self, pad: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_element_add_pad(self.to_glib_none().0, pad.to_glib_none().0), "Failed to add pad") + glib_result_from_gboolean!(ffi::gst_element_add_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0), "Failed to add pad") } } @@ -189,7 +188,7 @@ impl> ElementExt for O { fn create_all_pads(&self) { unsafe { - ffi::gst_element_create_all_pads(self.to_glib_none().0); + ffi::gst_element_create_all_pads(self.as_ref().to_glib_none().0); } } @@ -210,75 +209,74 @@ impl> ElementExt for O { fn get_base_time(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_element_get_base_time(self.to_glib_none().0)) + from_glib(ffi::gst_element_get_base_time(self.as_ref().to_glib_none().0)) } } fn get_bus(&self) -> Option { unsafe { - from_glib_full(ffi::gst_element_get_bus(self.to_glib_none().0)) + from_glib_full(ffi::gst_element_get_bus(self.as_ref().to_glib_none().0)) } } fn get_clock(&self) -> Option { unsafe { - from_glib_full(ffi::gst_element_get_clock(self.to_glib_none().0)) + from_glib_full(ffi::gst_element_get_clock(self.as_ref().to_glib_none().0)) } } fn get_compatible_pad<'a, P: IsA, Q: Into>>(&self, pad: &P, caps: Q) -> Option { let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - from_glib_full(ffi::gst_element_get_compatible_pad(self.to_glib_none().0, pad.to_glib_none().0, caps.0)) + from_glib_full(ffi::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 { + fn get_compatible_pad_template>(&self, compattempl: &P) -> Option { unsafe { - from_glib_none(ffi::gst_element_get_compatible_pad_template(self.to_glib_none().0, compattempl.to_glib_none().0)) + from_glib_none(ffi::gst_element_get_compatible_pad_template(self.as_ref().to_glib_none().0, compattempl.as_ref().to_glib_none().0)) } } fn get_context(&self, context_type: &str) -> Option { unsafe { - from_glib_full(ffi::gst_element_get_context(self.to_glib_none().0, context_type.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_element_get_contexts(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_element_get_contexts(self.as_ref().to_glib_none().0)) } } fn get_factory(&self) -> Option { unsafe { - from_glib_none(ffi::gst_element_get_factory(self.to_glib_none().0)) + from_glib_none(ffi::gst_element_get_factory(self.as_ref().to_glib_none().0)) } } fn get_request_pad(&self, name: &str) -> Option { unsafe { - from_glib_full(ffi::gst_element_get_request_pad(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_element_get_start_time(self.to_glib_none().0)) + from_glib(ffi::gst_element_get_start_time(self.as_ref().to_glib_none().0)) } } fn get_static_pad(&self, name: &str) -> Option { unsafe { - from_glib_full(ffi::gst_element_get_static_pad(self.to_glib_none().0, name.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_element_is_locked_state(self.to_glib_none().0)) + from_glib(ffi::gst_element_is_locked_state(self.as_ref().to_glib_none().0)) } } @@ -296,15 +294,14 @@ impl> ElementExt for O { fn link>(&self, dest: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_element_link(self.to_glib_none().0, dest.to_glib_none().0), "Failed to link elements") + glib_result_from_gboolean!(ffi::gst_element_link(self.as_ref().to_glib_none().0, dest.as_ref().to_glib_none().0), "Failed to link elements") } } fn link_filtered<'a, P: IsA, Q: Into>>(&self, dest: &P, filter: Q) -> Result<(), glib::error::BoolError> { let filter = filter.into(); - let filter = filter.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_link_filtered(self.to_glib_none().0, dest.to_glib_none().0, filter.0), "Failed to link elements") + glib_result_from_gboolean!(ffi::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") } } @@ -314,39 +311,32 @@ impl> ElementExt for O { fn link_pads<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> Result<(), glib::error::BoolError> { let srcpadname = srcpadname.into(); - let srcpadname = srcpadname.to_glib_none(); let destpadname = destpadname.into(); - let destpadname = destpadname.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_link_pads(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0), "Failed to link pads") + glib_result_from_gboolean!(ffi::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<'a, 'b, 'c, P: Into>, Q: IsA, R: Into>, S: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError> { let srcpadname = srcpadname.into(); - let srcpadname = srcpadname.to_glib_none(); let destpadname = destpadname.into(); - let destpadname = destpadname.to_glib_none(); let filter = filter.into(); - let filter = filter.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_link_pads_filtered(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0, filter.0), "Failed to link pads") + glib_result_from_gboolean!(ffi::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<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: PadLinkCheck) -> Result<(), glib::error::BoolError> { let srcpadname = srcpadname.into(); - let srcpadname = srcpadname.to_glib_none(); let destpadname = destpadname.into(); - let destpadname = destpadname.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_link_pads_full(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0, flags.to_glib()), "Failed to link pads") + glib_result_from_gboolean!(ffi::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") } } fn lost_state(&self) { unsafe { - ffi::gst_element_lost_state(self.to_glib_none().0); + ffi::gst_element_lost_state(self.as_ref().to_glib_none().0); } } @@ -361,93 +351,89 @@ impl> ElementExt for O { fn no_more_pads(&self) { unsafe { - ffi::gst_element_no_more_pads(self.to_glib_none().0); + ffi::gst_element_no_more_pads(self.as_ref().to_glib_none().0); } } fn post_message(&self, message: &Message) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_element_post_message(self.to_glib_none().0, message.to_glib_full()), "Failed to post message") + glib_result_from_gboolean!(ffi::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(ffi::gst_element_provide_clock(self.to_glib_none().0)) + from_glib_full(ffi::gst_element_provide_clock(self.as_ref().to_glib_none().0)) } } fn release_request_pad>(&self, pad: &P) { unsafe { - ffi::gst_element_release_request_pad(self.to_glib_none().0, pad.to_glib_none().0); + ffi::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!(ffi::gst_element_remove_pad(self.to_glib_none().0, pad.to_glib_none().0), "Failed to remove pad") + glib_result_from_gboolean!(ffi::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<'a, 'b, P: Into>, Q: Into>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option { + fn request_pad<'a, 'b, P: IsA, Q: Into>, R: Into>>(&self, templ: &P, name: Q, caps: R) -> Option { let name = name.into(); - let name = name.to_glib_none(); let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - from_glib_full(ffi::gst_element_request_pad(self.to_glib_none().0, templ.to_glib_none().0, name.0, caps.0)) + from_glib_full(ffi::gst_element_request_pad(self.as_ref().to_glib_none().0, templ.as_ref().to_glib_none().0, name.to_glib_none().0, caps.to_glib_none().0)) } } fn set_base_time(&self, time: ClockTime) { unsafe { - ffi::gst_element_set_base_time(self.to_glib_none().0, time.to_glib()); + ffi::gst_element_set_base_time(self.as_ref().to_glib_none().0, time.to_glib()); } } - fn set_bus<'a, P: Into>>(&self, bus: P) { + fn set_bus<'a, P: IsA + 'a, Q: Into>>(&self, bus: Q) { let bus = bus.into(); - let bus = bus.to_glib_none(); unsafe { - ffi::gst_element_set_bus(self.to_glib_none().0, bus.0); + ffi::gst_element_set_bus(self.as_ref().to_glib_none().0, bus.map(|p| p.as_ref()).to_glib_none().0); } } fn set_clock<'a, P: IsA + 'a, Q: Into>>(&self, clock: Q) -> Result<(), glib::error::BoolError> { let clock = clock.into(); - let clock = clock.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_element_set_clock(self.to_glib_none().0, clock.0), "Failed to set clock") + glib_result_from_gboolean!(ffi::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 { - ffi::gst_element_set_context(self.to_glib_none().0, context.to_glib_none().0); + ffi::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(ffi::gst_element_set_locked_state(self.to_glib_none().0, locked_state.to_glib())) + from_glib(ffi::gst_element_set_locked_state(self.as_ref().to_glib_none().0, locked_state.to_glib())) } } fn set_start_time(&self, time: ClockTime) { unsafe { - ffi::gst_element_set_start_time(self.to_glib_none().0, time.to_glib()); + ffi::gst_element_set_start_time(self.as_ref().to_glib_none().0, time.to_glib()); } } fn sync_state_with_parent(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_element_sync_state_with_parent(self.to_glib_none().0), "Failed to sync state with parent") + glib_result_from_gboolean!(ffi::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 { - ffi::gst_element_unlink(self.to_glib_none().0, dest.to_glib_none().0); + ffi::gst_element_unlink(self.as_ref().to_glib_none().0, dest.as_ref().to_glib_none().0); } } @@ -457,14 +443,14 @@ impl> ElementExt for O { fn unlink_pads>(&self, srcpadname: &str, dest: &P, destpadname: &str) { unsafe { - ffi::gst_element_unlink_pads(self.to_glib_none().0, srcpadname.to_glib_none().0, dest.to_glib_none().0, destpadname.to_glib_none().0); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"no-more-pads\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"no-more-pads\0".as_ptr() as *const _, transmute(no_more_pads_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -472,7 +458,7 @@ impl> ElementExt for O { fn connect_pad_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pad-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pad-added\0".as_ptr() as *const _, transmute(pad_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -480,7 +466,7 @@ impl> ElementExt for O { fn connect_pad_removed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"pad-removed\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pad-removed\0".as_ptr() as *const _, transmute(pad_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -489,17 +475,17 @@ impl> ElementExt for O { unsafe extern "C" fn no_more_pads_trampoline

(this: *mut ffi::GstElement, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Element::from_glib_borrow(this).downcast_unchecked()) + f(&Element::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn pad_added_trampoline

(this: *mut ffi::GstElement, new_pad: *mut ffi::GstPad, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Pad) + Send + Sync + 'static) = transmute(f); - f(&Element::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(new_pad)) + f(&Element::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(new_pad)) } unsafe extern "C" fn pad_removed_trampoline

(this: *mut ffi::GstElement, old_pad: *mut ffi::GstPad, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Pad) + Send + Sync + 'static) = transmute(f); - f(&Element::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(old_pad)) + f(&Element::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(old_pad)) } diff --git a/gstreamer/src/auto/element_factory.rs b/gstreamer/src/auto/element_factory.rs index 14b51c459..a5d5ceefa 100644 --- a/gstreamer/src/auto/element_factory.rs +++ b/gstreamer/src/auto/element_factory.rs @@ -17,7 +17,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct ElementFactory(Object): PluginFeature, Object; + pub struct ElementFactory(Object) @extends PluginFeature, Object; match fn { get_type => || ffi::gst_element_factory_get_type(), @@ -51,9 +51,8 @@ impl ElementFactory { pub fn create<'a, P: Into>>(&self, name: P) -> Option { let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib_none(ffi::gst_element_factory_create(self.to_glib_none().0, name.0)) + from_glib_none(ffi::gst_element_factory_create(self.to_glib_none().0, name.to_glib_none().0)) } } @@ -135,12 +134,13 @@ impl ElementFactory { pub fn make<'a, P: Into>>(factoryname: &str, name: P) -> Option { assert_initialized_main_thread!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib_none(ffi::gst_element_factory_make(factoryname.to_glib_none().0, name.0)) + from_glib_none(ffi::gst_element_factory_make(factoryname.to_glib_none().0, name.to_glib_none().0)) } } } unsafe impl Send for ElementFactory {} unsafe impl Sync for ElementFactory {} + +pub const NONE_ELEMENT_FACTORY: Option<&ElementFactory> = None; diff --git a/gstreamer/src/auto/functions.rs b/gstreamer/src/auto/functions.rs index 02278b00f..61a02a5b2 100644 --- a/gstreamer/src/auto/functions.rs +++ b/gstreamer/src/auto/functions.rs @@ -30,21 +30,21 @@ 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(ffi::gst_debug_bin_to_dot_data(bin.to_glib_none().0, details.to_glib())) + from_glib_full(ffi::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) { skip_assert_initialized!(); unsafe { - ffi::gst_debug_bin_to_dot_file(bin.to_glib_none().0, details.to_glib(), file_name.as_ref().to_glib_none().0); + ffi::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) { skip_assert_initialized!(); unsafe { - ffi::gst_debug_bin_to_dot_file_with_ts(bin.to_glib_none().0, details.to_glib(), file_name.as_ref().to_glib_none().0); + ffi::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); } } diff --git a/gstreamer/src/auto/ghost_pad.rs b/gstreamer/src/auto/ghost_pad.rs index 3bc1e71f1..b9b871a87 100644 --- a/gstreamer/src/auto/ghost_pad.rs +++ b/gstreamer/src/auto/ghost_pad.rs @@ -2,7 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use GhostPadClass; use Object; use Pad; use PadDirection; @@ -10,12 +9,12 @@ use PadTemplate; use ProxyPad; use ffi; use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct GhostPad(Object): ProxyPad, Pad, Object; + pub struct GhostPad(Object) @extends ProxyPad, Pad, Object; match fn { get_type => || ffi::gst_ghost_pad_get_type(), @@ -26,18 +25,16 @@ impl GhostPad { pub fn new_no_target<'a, P: Into>>(name: P, dir: PadDirection) -> GhostPad { assert_initialized_main_thread!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target(name.0, dir.to_glib())).downcast_unchecked() + Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target(name.to_glib_none().0, dir.to_glib())).unsafe_cast() } } - pub fn new_no_target_from_template<'a, P: Into>>(name: P, templ: &PadTemplate) -> GhostPad { + pub fn new_no_target_from_template<'a, P: Into>, Q: IsA>(name: P, templ: &Q) -> GhostPad { skip_assert_initialized!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target_from_template(name.0, templ.to_glib_none().0)).downcast_unchecked() + Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target_from_template(name.to_glib_none().0, templ.as_ref().to_glib_none().0)).unsafe_cast() } } } @@ -45,6 +42,8 @@ impl GhostPad { unsafe impl Send for GhostPad {} unsafe impl Sync for GhostPad {} +pub const NONE_GHOST_PAD: Option<&GhostPad> = None; + pub trait GhostPadExt: 'static { fn get_target(&self) -> Option; @@ -54,15 +53,14 @@ pub trait GhostPadExt: 'static { impl> GhostPadExt for O { fn get_target(&self) -> Option { unsafe { - from_glib_full(ffi::gst_ghost_pad_get_target(self.to_glib_none().0)) + from_glib_full(ffi::gst_ghost_pad_get_target(self.as_ref().to_glib_none().0)) } } fn set_target<'a, P: IsA + 'a, Q: Into>>(&self, newtarget: Q) -> Result<(), glib::error::BoolError> { let newtarget = newtarget.into(); - let newtarget = newtarget.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_ghost_pad_set_target(self.to_glib_none().0, newtarget.0), "Failed to set target") + glib_result_from_gboolean!(ffi::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 bf5bc3d02..db8c7fabe 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -3,110 +3,110 @@ // DO NOT EDIT mod bin; -pub use self::bin::Bin; +pub use self::bin::{Bin, BinClass, NONE_BIN}; pub use self::bin::GstBinExt; mod buffer_pool; -pub use self::buffer_pool::BufferPool; +pub use self::buffer_pool::{BufferPool, BufferPoolClass, NONE_BUFFER_POOL}; pub use self::buffer_pool::BufferPoolExt; mod bus; -pub use self::bus::Bus; +pub use self::bus::{Bus, BusClass, NONE_BUS}; mod child_proxy; -pub use self::child_proxy::ChildProxy; +pub use self::child_proxy::{ChildProxy, NONE_CHILD_PROXY}; pub use self::child_proxy::ChildProxyExt; mod clock; -pub use self::clock::Clock; +pub use self::clock::{Clock, ClockClass, NONE_CLOCK}; pub use self::clock::ClockExt; mod device; -pub use self::device::Device; +pub use self::device::{Device, DeviceClass, NONE_DEVICE}; pub use self::device::DeviceExt; mod device_monitor; -pub use self::device_monitor::DeviceMonitor; +pub use self::device_monitor::{DeviceMonitor, DeviceMonitorClass, NONE_DEVICE_MONITOR}; pub use self::device_monitor::DeviceMonitorExt; mod device_provider; -pub use self::device_provider::DeviceProvider; +pub use self::device_provider::{DeviceProvider, DeviceProviderClass, NONE_DEVICE_PROVIDER}; pub use self::device_provider::DeviceProviderExt; mod device_provider_factory; -pub use self::device_provider_factory::DeviceProviderFactory; +pub use self::device_provider_factory::{DeviceProviderFactory, DeviceProviderFactoryClass, NONE_DEVICE_PROVIDER_FACTORY}; mod element; -pub use self::element::Element; +pub use self::element::{Element, ElementClass, NONE_ELEMENT}; pub use self::element::ElementExt; mod element_factory; -pub use self::element_factory::ElementFactory; +pub use self::element_factory::{ElementFactory, ElementFactoryClass, NONE_ELEMENT_FACTORY}; mod ghost_pad; -pub use self::ghost_pad::GhostPad; +pub use self::ghost_pad::{GhostPad, GhostPadClass, NONE_GHOST_PAD}; pub use self::ghost_pad::GhostPadExt; mod object; -pub use self::object::Object; +pub use self::object::{Object, ObjectClass, NONE_OBJECT}; pub use self::object::GstObjectExt; mod pad; -pub use self::pad::Pad; +pub use self::pad::{Pad, PadClass, NONE_PAD}; pub use self::pad::PadExt; mod pad_template; -pub use self::pad_template::PadTemplate; +pub use self::pad_template::{PadTemplate, PadTemplateClass, NONE_PAD_TEMPLATE}; mod pipeline; -pub use self::pipeline::Pipeline; +pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE}; pub use self::pipeline::PipelineExt; mod plugin; -pub use self::plugin::Plugin; +pub use self::plugin::{Plugin, PluginClass, NONE_PLUGIN}; mod plugin_feature; -pub use self::plugin_feature::PluginFeature; +pub use self::plugin_feature::{PluginFeature, PluginFeatureClass, NONE_PLUGIN_FEATURE}; pub use self::plugin_feature::PluginFeatureExt; mod preset; -pub use self::preset::Preset; +pub use self::preset::{Preset, NONE_PRESET}; pub use self::preset::PresetExt; mod proxy_pad; -pub use self::proxy_pad::ProxyPad; +pub use self::proxy_pad::{ProxyPad, ProxyPadClass, NONE_PROXY_PAD}; pub use self::proxy_pad::ProxyPadExt; mod registry; -pub use self::registry::Registry; +pub use self::registry::{Registry, RegistryClass, NONE_REGISTRY}; #[cfg(any(feature = "v1_10", feature = "dox"))] mod stream; #[cfg(any(feature = "v1_10", feature = "dox"))] -pub use self::stream::Stream; +pub use self::stream::{Stream, StreamClass, NONE_STREAM}; #[cfg(any(feature = "v1_10", feature = "dox"))] mod stream_collection; #[cfg(any(feature = "v1_10", feature = "dox"))] -pub use self::stream_collection::StreamCollection; +pub use self::stream_collection::{StreamCollection, StreamCollectionClass, NONE_STREAM_COLLECTION}; mod system_clock; -pub use self::system_clock::SystemClock; +pub use self::system_clock::{SystemClock, SystemClockClass, NONE_SYSTEM_CLOCK}; pub use self::system_clock::SystemClockExt; mod tag_setter; -pub use self::tag_setter::TagSetter; +pub use self::tag_setter::{TagSetter, NONE_TAG_SETTER}; pub use self::tag_setter::TagSetterExt; mod toc_setter; -pub use self::toc_setter::TocSetter; +pub use self::toc_setter::{TocSetter, NONE_TOC_SETTER}; pub use self::toc_setter::TocSetterExt; mod type_find_factory; -pub use self::type_find_factory::TypeFindFactory; +pub use self::type_find_factory::{TypeFindFactory, TypeFindFactoryClass, NONE_TYPE_FIND_FACTORY}; mod uri_handler; -pub use self::uri_handler::URIHandler; +pub use self::uri_handler::{URIHandler, NONE_URI_HANDLER}; pub use self::uri_handler::URIHandlerExt; mod date_time; diff --git a/gstreamer/src/auto/object.rs b/gstreamer/src/auto/object.rs index c608a5563..d7713fe02 100644 --- a/gstreamer/src/auto/object.rs +++ b/gstreamer/src/auto/object.rs @@ -7,7 +7,7 @@ use Error; use ffi; use glib; use glib::GString; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -17,7 +17,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Object(Object); + pub struct Object(Object); match fn { get_type => || ffi::gst_object_get_type(), @@ -48,8 +48,10 @@ impl Object { unsafe impl Send for Object {} unsafe impl Sync for Object {} +pub const NONE_OBJECT: Option<&Object> = None; + pub trait GstObjectExt: 'static { - //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; + //fn add_control_binding>(&self, binding: &P) -> bool; fn default_error<'a, P: Into>>(&self, error: &Error, debug: P); @@ -77,7 +79,7 @@ pub trait GstObjectExt: 'static { fn has_as_parent>(&self, parent: &P) -> bool; - //fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; + //fn remove_control_binding>(&self, binding: &P) -> bool; fn set_control_binding_disabled(&self, property_name: &str, disabled: bool); @@ -103,15 +105,14 @@ pub trait GstObjectExt: 'static { } impl> GstObjectExt for O { - //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { + //fn add_control_binding>(&self, binding: &P) -> bool { // unsafe { TODO: call ffi::gst_object_add_control_binding() } //} fn default_error<'a, P: Into>>(&self, error: &Error, debug: P) { let debug = debug.into(); - let debug = debug.to_glib_none(); unsafe { - ffi::gst_object_default_error(self.to_glib_none().0, error.to_glib_none().0, debug.0); + ffi::gst_object_default_error(self.as_ref().to_glib_none().0, error.to_glib_none().0, debug.to_glib_none().0); } } @@ -121,7 +122,7 @@ impl> GstObjectExt for O { fn get_control_rate(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_object_get_control_rate(self.to_glib_none().0)) + from_glib(ffi::gst_object_get_control_rate(self.as_ref().to_glib_none().0)) } } @@ -131,19 +132,19 @@ impl> GstObjectExt for O { fn get_name(&self) -> GString { unsafe { - from_glib_full(ffi::gst_object_get_name(self.to_glib_none().0)) + from_glib_full(ffi::gst_object_get_name(self.as_ref().to_glib_none().0)) } } fn get_parent(&self) -> Option { unsafe { - from_glib_full(ffi::gst_object_get_parent(self.to_glib_none().0)) + from_glib_full(ffi::gst_object_get_parent(self.as_ref().to_glib_none().0)) } } fn get_path_string(&self) -> GString { unsafe { - from_glib_full(ffi::gst_object_get_path_string(self.to_glib_none().0)) + from_glib_full(ffi::gst_object_get_path_string(self.as_ref().to_glib_none().0)) } } @@ -157,77 +158,77 @@ impl> GstObjectExt for O { fn has_active_control_bindings(&self) -> bool { unsafe { - from_glib(ffi::gst_object_has_active_control_bindings(self.to_glib_none().0)) + from_glib(ffi::gst_object_has_active_control_bindings(self.as_ref().to_glib_none().0)) } } fn has_ancestor>(&self, ancestor: &P) -> bool { unsafe { - from_glib(ffi::gst_object_has_ancestor(self.to_glib_none().0, ancestor.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_object_has_as_ancestor(self.to_glib_none().0, ancestor.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_object_has_as_parent(self.to_glib_none().0, parent.to_glib_none().0)) + from_glib(ffi::gst_object_has_as_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0)) } } - //fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { + //fn remove_control_binding>(&self, binding: &P) -> bool { // unsafe { TODO: call ffi::gst_object_remove_control_binding() } //} fn set_control_binding_disabled(&self, property_name: &str, disabled: bool) { unsafe { - ffi::gst_object_set_control_binding_disabled(self.to_glib_none().0, property_name.to_glib_none().0, disabled.to_glib()); + ffi::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 { - ffi::gst_object_set_control_bindings_disabled(self.to_glib_none().0, disabled.to_glib()); + ffi::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 { - ffi::gst_object_set_control_rate(self.to_glib_none().0, control_rate.to_glib()); + ffi::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!(ffi::gst_object_set_name(self.to_glib_none().0, name.to_glib_none().0), "Failed to set object name") + glib_result_from_gboolean!(ffi::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!(ffi::gst_object_set_parent(self.to_glib_none().0, parent.to_glib_none().0), "Failed to set parent object") + glib_result_from_gboolean!(ffi::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(ffi::gst_object_suggest_next_sync(self.to_glib_none().0)) + from_glib(ffi::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!(ffi::gst_object_sync_values(self.to_glib_none().0, timestamp.to_glib()), "Failed to sync values") + glib_result_from_gboolean!(ffi::gst_object_sync_values(self.as_ref().to_glib_none().0, timestamp.to_glib()), "Failed to sync values") } } fn unparent(&self) { unsafe { - ffi::gst_object_unparent(self.to_glib_none().0); + ffi::gst_object_unparent(self.as_ref().to_glib_none().0); } } @@ -238,7 +239,7 @@ impl> GstObjectExt for O { fn connect_property_name_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::name\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, transmute(notify_name_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -246,7 +247,7 @@ impl> GstObjectExt for O { fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::parent\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::parent\0".as_ptr() as *const _, transmute(notify_parent_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -255,11 +256,11 @@ impl> GstObjectExt for O { unsafe extern "C" fn notify_name_trampoline

(this: *mut ffi::GstObject, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Object::from_glib_borrow(this).downcast_unchecked()) + f(&Object::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_parent_trampoline

(this: *mut ffi::GstObject, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Object::from_glib_borrow(this).downcast_unchecked()) + f(&Object::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/pad.rs b/gstreamer/src/auto/pad.rs index 358de91f0..3dad68f68 100644 --- a/gstreamer/src/auto/pad.rs +++ b/gstreamer/src/auto/pad.rs @@ -7,7 +7,6 @@ use Element; use Event; use EventType; use Object; -use PadClass; use PadDirection; #[cfg(any(feature = "v1_10", feature = "dox"))] use PadLinkCheck; @@ -22,7 +21,7 @@ use glib; use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -33,7 +32,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Pad(Object): Object; + pub struct Pad(Object) @extends Object; match fn { get_type => || ffi::gst_pad_get_type(), @@ -44,18 +43,16 @@ impl Pad { pub fn new<'a, P: Into>>(name: P, direction: PadDirection) -> Pad { assert_initialized_main_thread!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib_none(ffi::gst_pad_new(name.0, direction.to_glib())) + from_glib_none(ffi::gst_pad_new(name.to_glib_none().0, direction.to_glib())) } } - pub fn new_from_template<'a, P: Into>>(templ: &PadTemplate, name: P) -> Pad { + pub fn new_from_template<'a, P: IsA, Q: Into>>(templ: &P, name: Q) -> Pad { skip_assert_initialized!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - from_glib_none(ffi::gst_pad_new_from_template(templ.to_glib_none().0, name.0)) + from_glib_none(ffi::gst_pad_new_from_template(templ.as_ref().to_glib_none().0, name.to_glib_none().0)) } } } @@ -63,6 +60,8 @@ impl Pad { unsafe impl Send for Pad {} unsafe impl Sync for Pad {} +pub const NONE_PAD: Option<&Pad> = None; + pub trait PadExt: 'static { fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError>; @@ -184,7 +183,7 @@ pub trait PadExt: 'static { fn get_property_template(&self) -> Option; - fn set_property_template(&self, template: Option<&PadTemplate>); + fn set_property_template + glib::value::SetValueOptional>(&self, template: Option<&P>); fn connect_linked(&self, f: F) -> SignalHandlerId; @@ -200,7 +199,7 @@ pub trait PadExt: 'static { impl> PadExt for O { fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_pad_activate_mode(self.to_glib_none().0, mode.to_glib(), active.to_glib()), "Failed to activate mode pad") + glib_result_from_gboolean!(ffi::gst_pad_activate_mode(self.as_ref().to_glib_none().0, mode.to_glib(), active.to_glib()), "Failed to activate mode pad") } } @@ -210,21 +209,20 @@ impl> PadExt for O { fn can_link>(&self, sinkpad: &P) -> bool { unsafe { - from_glib(ffi::gst_pad_can_link(self.to_glib_none().0, sinkpad.to_glib_none().0)) + from_glib(ffi::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(ffi::gst_pad_check_reconfigure(self.to_glib_none().0)) + from_glib(ffi::gst_pad_check_reconfigure(self.as_ref().to_glib_none().0)) } } fn create_stream_id<'a, P: IsA, Q: Into>>(&self, parent: &P, stream_id: Q) -> Option { let stream_id = stream_id.into(); - let stream_id = stream_id.to_glib_none(); unsafe { - from_glib_full(ffi::gst_pad_create_stream_id(self.to_glib_none().0, parent.to_glib_none().0, stream_id.0)) + from_glib_full(ffi::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)) } } @@ -242,19 +240,19 @@ impl> PadExt for O { fn get_allowed_caps(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_allowed_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_allowed_caps(self.as_ref().to_glib_none().0)) } } fn get_current_caps(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_current_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_current_caps(self.as_ref().to_glib_none().0)) } } fn get_direction(&self) -> PadDirection { unsafe { - from_glib(ffi::gst_pad_get_direction(self.to_glib_none().0)) + from_glib(ffi::gst_pad_get_direction(self.as_ref().to_glib_none().0)) } } @@ -264,87 +262,87 @@ impl> PadExt for O { fn get_offset(&self) -> i64 { unsafe { - ffi::gst_pad_get_offset(self.to_glib_none().0) + ffi::gst_pad_get_offset(self.as_ref().to_glib_none().0) } } fn get_pad_template(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_pad_template(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_pad_template(self.as_ref().to_glib_none().0)) } } fn get_pad_template_caps(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_pad_template_caps(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_pad_template_caps(self.as_ref().to_glib_none().0)) } } fn get_parent_element(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_parent_element(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_parent_element(self.as_ref().to_glib_none().0)) } } fn get_peer(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_peer(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_pad_get_sticky_event(self.to_glib_none().0, event_type.to_glib(), idx)) + from_glib_full(ffi::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(ffi::gst_pad_get_stream(self.to_glib_none().0)) + from_glib_full(ffi::gst_pad_get_stream(self.as_ref().to_glib_none().0)) } } fn get_stream_id(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pad_get_stream_id(self.to_glib_none().0)) + from_glib_full(ffi::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(ffi::gst_pad_get_task_state(self.to_glib_none().0)) + from_glib(ffi::gst_pad_get_task_state(self.as_ref().to_glib_none().0)) } } fn has_current_caps(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_has_current_caps(self.to_glib_none().0)) + from_glib(ffi::gst_pad_has_current_caps(self.as_ref().to_glib_none().0)) } } fn is_active(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_is_active(self.to_glib_none().0)) + from_glib(ffi::gst_pad_is_active(self.as_ref().to_glib_none().0)) } } fn is_blocked(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_is_blocked(self.to_glib_none().0)) + from_glib(ffi::gst_pad_is_blocked(self.as_ref().to_glib_none().0)) } } fn is_blocking(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_is_blocking(self.to_glib_none().0)) + from_glib(ffi::gst_pad_is_blocking(self.as_ref().to_glib_none().0)) } } fn is_linked(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_is_linked(self.to_glib_none().0)) + from_glib(ffi::gst_pad_is_linked(self.as_ref().to_glib_none().0)) } } @@ -359,60 +357,58 @@ 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!(ffi::gst_pad_link_maybe_ghosting(self.to_glib_none().0, sink.to_glib_none().0), "Failed to link pad, possibly ghosting") + glib_result_from_gboolean!(ffi::gst_pad_link_maybe_ghosting(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0), "Failed to link pad, possibly ghosting") } } #[cfg(any(feature = "v1_10", feature = "dox"))] fn link_maybe_ghosting_full>(&self, sink: &P, flags: PadLinkCheck) -> bool { unsafe { - from_glib(ffi::gst_pad_link_maybe_ghosting_full(self.to_glib_none().0, sink.to_glib_none().0, flags.to_glib())) + from_glib(ffi::gst_pad_link_maybe_ghosting_full(self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0, flags.to_glib())) } } fn mark_reconfigure(&self) { unsafe { - ffi::gst_pad_mark_reconfigure(self.to_glib_none().0); + ffi::gst_pad_mark_reconfigure(self.as_ref().to_glib_none().0); } } fn needs_reconfigure(&self) -> bool { unsafe { - from_glib(ffi::gst_pad_needs_reconfigure(self.to_glib_none().0)) + from_glib(ffi::gst_pad_needs_reconfigure(self.as_ref().to_glib_none().0)) } } fn pause_task(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_pad_pause_task(self.to_glib_none().0), "Failed to pause pad task") + glib_result_from_gboolean!(ffi::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(ffi::gst_pad_peer_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(ffi::gst_pad_peer_query_accept_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) } } fn peer_query_caps<'a, P: Into>>(&self, filter: P) -> Option { let filter = filter.into(); - let filter = filter.to_glib_none(); unsafe { - from_glib_full(ffi::gst_pad_peer_query_caps(self.to_glib_none().0, filter.0)) + from_glib_full(ffi::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(ffi::gst_pad_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0)) + from_glib(ffi::gst_pad_query_accept_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0)) } } fn query_caps<'a, P: Into>>(&self, filter: P) -> Option { let filter = filter.into(); - let filter = filter.to_glib_none(); unsafe { - from_glib_full(ffi::gst_pad_query_caps(self.to_glib_none().0, filter.0)) + from_glib_full(ffi::gst_pad_query_caps(self.as_ref().to_glib_none().0, filter.to_glib_none().0)) } } @@ -426,7 +422,7 @@ impl> PadExt for O { fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_pad_set_active(self.to_glib_none().0, active.to_glib()), "Failed to activate pad") + glib_result_from_gboolean!(ffi::gst_pad_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to activate pad") } } @@ -464,7 +460,7 @@ impl> PadExt for O { fn set_offset(&self, offset: i64) { unsafe { - ffi::gst_pad_set_offset(self.to_glib_none().0, offset); + ffi::gst_pad_set_offset(self.as_ref().to_glib_none().0, offset); } } @@ -486,19 +482,19 @@ impl> PadExt for O { fn stop_task(&self) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_pad_stop_task(self.to_glib_none().0), "Failed to stop pad task") + glib_result_from_gboolean!(ffi::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!(ffi::gst_pad_unlink(self.to_glib_none().0, sinkpad.to_glib_none().0), "Failed to unlink pad") + glib_result_from_gboolean!(ffi::gst_pad_unlink(self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0), "Failed to unlink pad") } } fn use_fixed_caps(&self) { unsafe { - ffi::gst_pad_use_fixed_caps(self.to_glib_none().0); + ffi::gst_pad_use_fixed_caps(self.as_ref().to_glib_none().0); } } @@ -518,7 +514,7 @@ impl> PadExt for O { } } - fn set_property_template(&self, template: Option<&PadTemplate>) { + fn set_property_template + glib::value::SetValueOptional>(&self, template: Option<&P>) { unsafe { gobject_ffi::g_object_set_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"template\0".as_ptr() as *const _, Value::from(template).to_glib_none().0); } @@ -527,7 +523,7 @@ impl> PadExt for O { fn connect_linked(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"linked\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"linked\0".as_ptr() as *const _, transmute(linked_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -535,7 +531,7 @@ impl> PadExt for O { fn connect_unlinked(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"unlinked\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"unlinked\0".as_ptr() as *const _, transmute(unlinked_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -543,7 +539,7 @@ impl> PadExt for O { fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::caps\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, transmute(notify_caps_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -551,7 +547,7 @@ impl> PadExt for O { fn connect_property_offset_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::offset\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::offset\0".as_ptr() as *const _, transmute(notify_offset_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -559,7 +555,7 @@ impl> PadExt for O { fn connect_property_template_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::template\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::template\0".as_ptr() as *const _, transmute(notify_template_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -568,29 +564,29 @@ impl> PadExt for O { unsafe extern "C" fn linked_trampoline

(this: *mut ffi::GstPad, peer: *mut ffi::GstPad, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Pad) + Send + Sync + 'static) = transmute(f); - f(&Pad::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(peer)) + f(&Pad::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(peer)) } unsafe extern "C" fn unlinked_trampoline

(this: *mut ffi::GstPad, peer: *mut ffi::GstPad, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P, &Pad) + Send + Sync + 'static) = transmute(f); - f(&Pad::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(peer)) + f(&Pad::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(peer)) } unsafe extern "C" fn notify_caps_trampoline

(this: *mut ffi::GstPad, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pad::from_glib_borrow(this).downcast_unchecked()) + f(&Pad::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_offset_trampoline

(this: *mut ffi::GstPad, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pad::from_glib_borrow(this).downcast_unchecked()) + f(&Pad::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_template_trampoline

(this: *mut ffi::GstPad, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pad::from_glib_borrow(this).downcast_unchecked()) + f(&Pad::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/pad_template.rs b/gstreamer/src/auto/pad_template.rs index 7b3025065..1b05a8fd9 100644 --- a/gstreamer/src/auto/pad_template.rs +++ b/gstreamer/src/auto/pad_template.rs @@ -14,6 +14,7 @@ use glib::GString; use glib::StaticType; use glib::Value; use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -23,7 +24,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct PadTemplate(Object): Object; + pub struct PadTemplate(Object) @extends Object; match fn { get_type => || ffi::gst_pad_template_get_type(), @@ -54,14 +55,14 @@ impl PadTemplate { pub fn pad_created>(&self, pad: &P) { unsafe { - ffi::gst_pad_template_pad_created(self.to_glib_none().0, pad.to_glib_none().0); + ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"direction\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"direction\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -70,7 +71,7 @@ impl PadTemplate { pub fn get_property_gtype(&self) -> glib::types::Type { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"gtype\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"gtype\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -78,7 +79,7 @@ impl PadTemplate { pub fn get_property_name_template(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"name-template\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"name-template\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -86,7 +87,7 @@ impl PadTemplate { pub fn get_property_presence(&self) -> PadPresence { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"presence\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"presence\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -94,7 +95,7 @@ impl PadTemplate { pub fn connect_pad_created(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"pad-created\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"pad-created\0".as_ptr() as *const _, transmute(pad_created_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -103,6 +104,8 @@ impl PadTemplate { unsafe impl Send for PadTemplate {} unsafe impl Sync for PadTemplate {} +pub const NONE_PAD_TEMPLATE: Option<&PadTemplate> = None; + unsafe extern "C" fn pad_created_trampoline(this: *mut ffi::GstPadTemplate, pad: *mut ffi::GstPad, f: glib_ffi::gpointer) { let f: &&(Fn(&PadTemplate, &Pad) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this), &from_glib_borrow(pad)) diff --git a/gstreamer/src/auto/pipeline.rs b/gstreamer/src/auto/pipeline.rs index 0b588a68f..1d89485b2 100644 --- a/gstreamer/src/auto/pipeline.rs +++ b/gstreamer/src/auto/pipeline.rs @@ -8,9 +8,8 @@ use Clock; use ClockTime; use Element; use Object; -use PipelineClass; use ffi; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -20,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Pipeline(Object): Bin, Element, Object, ChildProxy; + pub struct Pipeline(Object) @extends Bin, Element, Object, @implements ChildProxy; match fn { get_type => || ffi::gst_pipeline_get_type(), @@ -31,9 +30,8 @@ impl Pipeline { pub fn new<'a, P: Into>>(name: P) -> Pipeline { assert_initialized_main_thread!(); let name = name.into(); - let name = name.to_glib_none(); unsafe { - Element::from_glib_none(ffi::gst_pipeline_new(name.0)).downcast_unchecked() + Element::from_glib_none(ffi::gst_pipeline_new(name.to_glib_none().0)).unsafe_cast() } } } @@ -41,6 +39,8 @@ impl Pipeline { unsafe impl Send for Pipeline {} unsafe impl Sync for Pipeline {} +pub const NONE_PIPELINE: Option<&Pipeline> = None; + pub trait PipelineExt: 'static { fn auto_clock(&self); @@ -70,64 +70,63 @@ pub trait PipelineExt: 'static { impl> PipelineExt for O { fn auto_clock(&self) { unsafe { - ffi::gst_pipeline_auto_clock(self.to_glib_none().0); + ffi::gst_pipeline_auto_clock(self.as_ref().to_glib_none().0); } } fn get_auto_flush_bus(&self) -> bool { unsafe { - from_glib(ffi::gst_pipeline_get_auto_flush_bus(self.to_glib_none().0)) + from_glib(ffi::gst_pipeline_get_auto_flush_bus(self.as_ref().to_glib_none().0)) } } fn get_delay(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_pipeline_get_delay(self.to_glib_none().0)) + from_glib(ffi::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) } } fn get_latency(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_pipeline_get_latency(self.to_glib_none().0)) + from_glib(ffi::gst_pipeline_get_latency(self.as_ref().to_glib_none().0)) } } fn get_pipeline_clock(&self) -> Option { unsafe { - from_glib_full(ffi::gst_pipeline_get_pipeline_clock(self.to_glib_none().0)) + from_glib_full(ffi::gst_pipeline_get_pipeline_clock(self.as_ref().to_glib_none().0)) } } fn set_auto_flush_bus(&self, auto_flush: bool) { unsafe { - ffi::gst_pipeline_set_auto_flush_bus(self.to_glib_none().0, auto_flush.to_glib()); + ffi::gst_pipeline_set_auto_flush_bus(self.as_ref().to_glib_none().0, auto_flush.to_glib()); } } fn set_delay(&self, delay: ClockTime) { unsafe { - ffi::gst_pipeline_set_delay(self.to_glib_none().0, delay.to_glib()); + ffi::gst_pipeline_set_delay(self.as_ref().to_glib_none().0, delay.to_glib()); } } fn set_latency(&self, latency: ClockTime) { unsafe { - ffi::gst_pipeline_set_latency(self.to_glib_none().0, latency.to_glib()); + ffi::gst_pipeline_set_latency(self.as_ref().to_glib_none().0, latency.to_glib()); } } fn use_clock<'a, P: IsA + 'a, Q: Into>>(&self, clock: Q) { let clock = clock.into(); - let clock = clock.to_glib_none(); unsafe { - ffi::gst_pipeline_use_clock(self.to_glib_none().0, clock.0); + ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::auto-flush-bus\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::auto-flush-bus\0".as_ptr() as *const _, transmute(notify_auto_flush_bus_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -135,7 +134,7 @@ impl> PipelineExt for O { fn connect_property_delay_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::delay\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::delay\0".as_ptr() as *const _, transmute(notify_delay_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -143,7 +142,7 @@ impl> PipelineExt for O { fn connect_property_latency_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _, transmute(notify_latency_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -152,17 +151,17 @@ impl> PipelineExt for O { unsafe extern "C" fn notify_auto_flush_bus_trampoline

(this: *mut ffi::GstPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_delay_trampoline

(this: *mut ffi::GstPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_latency_trampoline

(this: *mut ffi::GstPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) + f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/plugin.rs b/gstreamer/src/auto/plugin.rs index f0e31c2f2..71c10cadc 100644 --- a/gstreamer/src/auto/plugin.rs +++ b/gstreamer/src/auto/plugin.rs @@ -12,7 +12,7 @@ use std; use std::ptr; glib_wrapper! { - pub struct Plugin(Object): Object; + pub struct Plugin(Object) @extends Object; match fn { get_type => || ffi::gst_plugin_get_type(), @@ -28,13 +28,10 @@ impl Plugin { pub fn add_dependency_simple<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, env_vars: P, paths: Q, names: R, flags: PluginDependencyFlags) { let env_vars = env_vars.into(); - let env_vars = env_vars.to_glib_none(); let paths = paths.into(); - let paths = paths.to_glib_none(); let names = names.into(); - let names = names.to_glib_none(); unsafe { - ffi::gst_plugin_add_dependency_simple(self.to_glib_none().0, env_vars.0, paths.0, names.0, flags.to_glib()); + ffi::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()); } } @@ -125,3 +122,5 @@ impl Plugin { unsafe impl Send for Plugin {} unsafe impl Sync for Plugin {} + +pub const NONE_PLUGIN: Option<&Plugin> = None; diff --git a/gstreamer/src/auto/plugin_feature.rs b/gstreamer/src/auto/plugin_feature.rs index ba2718e28..ae2c67bde 100644 --- a/gstreamer/src/auto/plugin_feature.rs +++ b/gstreamer/src/auto/plugin_feature.rs @@ -10,7 +10,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct PluginFeature(Object): Object; + pub struct PluginFeature(Object) @extends Object; match fn { get_type => || ffi::gst_plugin_feature_get_type(), @@ -20,6 +20,8 @@ glib_wrapper! { unsafe impl Send for PluginFeature {} unsafe impl Sync for PluginFeature {} +pub const NONE_PLUGIN_FEATURE: Option<&PluginFeature> = None; + pub trait PluginFeatureExt: 'static { fn check_version(&self, min_major: u32, min_minor: u32, min_micro: u32) -> bool; @@ -37,37 +39,37 @@ 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(ffi::gst_plugin_feature_check_version(self.to_glib_none().0, min_major, min_minor, min_micro)) + from_glib(ffi::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(ffi::gst_plugin_feature_get_plugin(self.to_glib_none().0)) + from_glib_full(ffi::gst_plugin_feature_get_plugin(self.as_ref().to_glib_none().0)) } } fn get_plugin_name(&self) -> Option { unsafe { - from_glib_none(ffi::gst_plugin_feature_get_plugin_name(self.to_glib_none().0)) + from_glib_none(ffi::gst_plugin_feature_get_plugin_name(self.as_ref().to_glib_none().0)) } } fn get_rank(&self) -> u32 { unsafe { - ffi::gst_plugin_feature_get_rank(self.to_glib_none().0) + ffi::gst_plugin_feature_get_rank(self.as_ref().to_glib_none().0) } } fn load(&self) -> Option { unsafe { - from_glib_full(ffi::gst_plugin_feature_load(self.to_glib_none().0)) + from_glib_full(ffi::gst_plugin_feature_load(self.as_ref().to_glib_none().0)) } } fn set_rank(&self, rank: u32) { unsafe { - ffi::gst_plugin_feature_set_rank(self.to_glib_none().0, rank); + ffi::gst_plugin_feature_set_rank(self.as_ref().to_glib_none().0, rank); } } } diff --git a/gstreamer/src/auto/preset.rs b/gstreamer/src/auto/preset.rs index 96a9ad95a..7685dfedf 100644 --- a/gstreamer/src/auto/preset.rs +++ b/gstreamer/src/auto/preset.rs @@ -11,7 +11,7 @@ use std; use std::ptr; glib_wrapper! { - pub struct Preset(Object); + pub struct Preset(Interface); match fn { get_type => || ffi::gst_preset_get_type(), @@ -37,6 +37,8 @@ impl Preset { unsafe impl Send for Preset {} unsafe impl Sync for Preset {} +pub const NONE_PRESET: Option<&Preset> = None; + pub trait PresetExt: 'static { fn delete_preset(&self, name: &str) -> Result<(), glib::error::BoolError>; @@ -60,59 +62,58 @@ pub trait PresetExt: 'static { impl> PresetExt for O { fn delete_preset(&self, name: &str) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_preset_delete_preset(self.to_glib_none().0, name.to_glib_none().0), "Failed to delete preset") + glib_result_from_gboolean!(ffi::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(ffi::gst_preset_get_meta(self.to_glib_none().0, name.to_glib_none().0, tag.to_glib_none().0, &mut value)); + let ret = from_glib(ffi::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(ffi::gst_preset_get_preset_names(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_preset_get_preset_names(self.as_ref().to_glib_none().0)) } } fn get_property_names(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_preset_get_property_names(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_full(ffi::gst_preset_get_property_names(self.as_ref().to_glib_none().0)) } } fn is_editable(&self) -> bool { unsafe { - from_glib(ffi::gst_preset_is_editable(self.to_glib_none().0)) + from_glib(ffi::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!(ffi::gst_preset_load_preset(self.to_glib_none().0, name.to_glib_none().0), "Failed to load preset") + glib_result_from_gboolean!(ffi::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!(ffi::gst_preset_rename_preset(self.to_glib_none().0, old_name.to_glib_none().0, new_name.to_glib_none().0), "Failed to rename preset") + glib_result_from_gboolean!(ffi::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!(ffi::gst_preset_save_preset(self.to_glib_none().0, name.to_glib_none().0), "Failed to save preset") + glib_result_from_gboolean!(ffi::gst_preset_save_preset(self.as_ref().to_glib_none().0, name.to_glib_none().0), "Failed to save preset") } } fn set_meta<'a, P: Into>>(&self, name: &str, tag: &str, value: P) -> Result<(), glib::error::BoolError> { let value = value.into(); - let value = value.to_glib_none(); unsafe { - glib_result_from_gboolean!(ffi::gst_preset_set_meta(self.to_glib_none().0, name.to_glib_none().0, tag.to_glib_none().0, value.0), "Failed to set preset meta") + glib_result_from_gboolean!(ffi::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 7733e995d..dddf81568 100644 --- a/gstreamer/src/auto/proxy_pad.rs +++ b/gstreamer/src/auto/proxy_pad.rs @@ -9,7 +9,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct ProxyPad(Object): Pad, Object; + pub struct ProxyPad(Object) @extends Pad, Object; match fn { get_type => || ffi::gst_proxy_pad_get_type(), @@ -25,6 +25,8 @@ impl ProxyPad { unsafe impl Send for ProxyPad {} unsafe impl Sync for ProxyPad {} +pub const NONE_PROXY_PAD: Option<&ProxyPad> = None; + pub trait ProxyPadExt: 'static { fn get_internal(&self) -> Option; } @@ -32,7 +34,7 @@ pub trait ProxyPadExt: 'static { impl> ProxyPadExt for O { fn get_internal(&self) -> Option { unsafe { - from_glib_full(ffi::gst_proxy_pad_get_internal(self.to_glib_none().0)) + from_glib_full(ffi::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 36b855b7c..5bdde1c91 100644 --- a/gstreamer/src/auto/registry.rs +++ b/gstreamer/src/auto/registry.rs @@ -8,6 +8,7 @@ use PluginFeature; use ffi; use glib; use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -17,7 +18,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Registry(Object): Object; + pub struct Registry(Object) @extends Object; match fn { get_type => || ffi::gst_registry_get_type(), @@ -27,13 +28,13 @@ glib_wrapper! { impl Registry { pub fn add_feature>(&self, feature: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_registry_add_feature(self.to_glib_none().0, feature.to_glib_none().0), "Failed to add feature") + glib_result_from_gboolean!(ffi::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> { + pub fn add_plugin>(&self, plugin: &P) -> Result<(), glib::error::BoolError> { unsafe { - glib_result_from_gboolean!(ffi::gst_registry_add_plugin(self.to_glib_none().0, plugin.to_glib_none().0), "Failed to add plugin") + glib_result_from_gboolean!(ffi::gst_registry_add_plugin(self.to_glib_none().0, plugin.as_ref().to_glib_none().0), "Failed to add plugin") } } @@ -101,13 +102,13 @@ impl Registry { pub fn remove_feature>(&self, feature: &P) { unsafe { - ffi::gst_registry_remove_feature(self.to_glib_none().0, feature.to_glib_none().0); + ffi::gst_registry_remove_feature(self.to_glib_none().0, feature.as_ref().to_glib_none().0); } } - pub fn remove_plugin(&self, plugin: &Plugin) { + pub fn remove_plugin>(&self, plugin: &P) { unsafe { - ffi::gst_registry_remove_plugin(self.to_glib_none().0, plugin.to_glib_none().0); + ffi::gst_registry_remove_plugin(self.to_glib_none().0, plugin.as_ref().to_glib_none().0); } } @@ -127,7 +128,7 @@ impl Registry { pub fn connect_feature_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"feature-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"feature-added\0".as_ptr() as *const _, transmute(feature_added_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -135,7 +136,7 @@ impl Registry { pub fn connect_plugin_added(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"plugin-added\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"plugin-added\0".as_ptr() as *const _, transmute(plugin_added_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -144,6 +145,8 @@ impl Registry { unsafe impl Send for Registry {} unsafe impl Sync for Registry {} +pub const NONE_REGISTRY: Option<&Registry> = None; + unsafe extern "C" fn feature_added_trampoline(this: *mut ffi::GstRegistry, feature: *mut ffi::GstPluginFeature, f: glib_ffi::gpointer) { let f: &&(Fn(&Registry, &PluginFeature) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this), &from_glib_borrow(feature)) diff --git a/gstreamer/src/auto/stream.rs b/gstreamer/src/auto/stream.rs index f61bb014b..df23da477 100644 --- a/gstreamer/src/auto/stream.rs +++ b/gstreamer/src/auto/stream.rs @@ -11,6 +11,7 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -20,7 +21,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct Stream(Object): Object; + pub struct Stream(Object) @extends Object; match fn { get_type => || ffi::gst_stream_get_type(), @@ -66,9 +67,8 @@ impl Stream { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn set_caps<'a, P: Into>>(&self, caps: P) { let caps = caps.into(); - let caps = caps.to_glib_none(); unsafe { - ffi::gst_stream_set_caps(self.to_glib_none().0, caps.0); + ffi::gst_stream_set_caps(self.to_glib_none().0, caps.to_glib_none().0); } } @@ -89,44 +89,43 @@ impl Stream { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn set_tags<'a, P: Into>>(&self, tags: P) { let tags = tags.into(); - let tags = tags.to_glib_none(); unsafe { - ffi::gst_stream_set_tags(self.to_glib_none().0, tags.0); + ffi::gst_stream_set_tags(self.to_glib_none().0, tags.to_glib_none().0); } } pub fn get_property_caps(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"caps\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"caps\0".as_ptr() as *const _, Value::from(caps).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"stream-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"stream-flags\0".as_ptr() as *const _, Value::from(&stream_flags).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"stream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"stream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -134,35 +133,35 @@ impl Stream { pub fn get_property_stream_type(&self) -> StreamType { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"stream-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"stream-type\0".as_ptr() as *const _, Value::from(&stream_type).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_get_property(self.to_glib_none().0, b"tags\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::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_ffi::g_object_set_property(self.to_glib_none().0, b"tags\0".as_ptr() as *const _, Value::from(tags).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::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 { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::caps\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _, transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -170,7 +169,7 @@ impl Stream { pub fn connect_property_stream_flags_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::stream-flags\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::stream-flags\0".as_ptr() as *const _, transmute(notify_stream_flags_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -178,7 +177,7 @@ impl Stream { pub fn connect_property_stream_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::stream-type\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _, transmute(notify_stream_type_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -186,7 +185,7 @@ impl Stream { pub fn connect_property_tags_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::tags\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::tags\0".as_ptr() as *const _, transmute(notify_tags_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -195,6 +194,8 @@ impl Stream { unsafe impl Send for Stream {} unsafe impl Sync for Stream {} +pub const NONE_STREAM: Option<&Stream> = None; + unsafe extern "C" fn notify_caps_trampoline(this: *mut ffi::GstStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&Stream) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer/src/auto/stream_collection.rs b/gstreamer/src/auto/stream_collection.rs index 5aa87b6d4..91ba361c2 100644 --- a/gstreamer/src/auto/stream_collection.rs +++ b/gstreamer/src/auto/stream_collection.rs @@ -9,6 +9,8 @@ use ffi; use glib::GString; use glib::StaticType; use glib::Value; +use glib::object::IsA; +use glib::object::ObjectType; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; @@ -18,7 +20,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct StreamCollection(Object): Object; + pub struct StreamCollection(Object) @extends Object; match fn { get_type => || ffi::gst_stream_collection_get_type(), @@ -27,9 +29,9 @@ glib_wrapper! { impl StreamCollection { #[cfg(any(feature = "v1_10", feature = "dox"))] - pub fn add_stream(&self, stream: &Stream) -> bool { + pub fn add_stream>(&self, stream: &P) -> bool { unsafe { - from_glib(ffi::gst_stream_collection_add_stream(self.to_glib_none().0, stream.to_glib_full())) + from_glib(ffi::gst_stream_collection_add_stream(self.to_glib_none().0, stream.as_ref().to_glib_full())) } } @@ -57,7 +59,7 @@ impl StreamCollection { pub fn get_property_upstream_id(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, b"upstream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"upstream-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -65,7 +67,7 @@ impl StreamCollection { pub fn set_property_upstream_id<'a, P: Into>>(&self, upstream_id: P) { let upstream_id = upstream_id.into(); unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, b"upstream-id\0".as_ptr() as *const _, Value::from(upstream_id).to_glib_none().0); + gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"upstream-id\0".as_ptr() as *const _, Value::from(upstream_id).to_glib_none().0); } } @@ -76,7 +78,7 @@ impl StreamCollection { pub fn connect_property_upstream_id_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0, b"notify::upstream-id\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::upstream-id\0".as_ptr() as *const _, transmute(notify_upstream_id_trampoline as usize), Box_::into_raw(f) as *mut _) } } @@ -85,6 +87,8 @@ impl StreamCollection { unsafe impl Send for StreamCollection {} unsafe impl Sync for StreamCollection {} +pub const NONE_STREAM_COLLECTION: Option<&StreamCollection> = None; + unsafe extern "C" fn notify_upstream_id_trampoline(this: *mut ffi::GstStreamCollection, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { let f: &&(Fn(&StreamCollection) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) diff --git a/gstreamer/src/auto/system_clock.rs b/gstreamer/src/auto/system_clock.rs index e5d687651..acc347086 100644 --- a/gstreamer/src/auto/system_clock.rs +++ b/gstreamer/src/auto/system_clock.rs @@ -8,7 +8,7 @@ use Object; use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; @@ -19,7 +19,7 @@ use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { - pub struct SystemClock(Object): Clock, Object; + pub struct SystemClock(Object) @extends Clock, Object; match fn { get_type => || ffi::gst_system_clock_get_type(), @@ -37,9 +37,8 @@ impl SystemClock { pub fn set_default<'a, P: IsA + 'a, Q: Into>>(new_clock: Q) { assert_initialized_main_thread!(); let new_clock = new_clock.into(); - let new_clock = new_clock.to_glib_none(); unsafe { - ffi::gst_system_clock_set_default(new_clock.0); + ffi::gst_system_clock_set_default(new_clock.map(|p| p.as_ref()).to_glib_none().0); } } } @@ -47,6 +46,8 @@ impl SystemClock { unsafe impl Send for SystemClock {} unsafe impl Sync for SystemClock {} +pub const NONE_SYSTEM_CLOCK: Option<&SystemClock> = None; + pub trait SystemClockExt: 'static { fn get_property_clock_type(&self) -> ClockType; @@ -73,7 +74,7 @@ impl> SystemClockExt for O { fn connect_property_clock_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect_raw(self.to_glib_none().0 as *mut _, b"notify::clock-type\0".as_ptr() as *const _, + connect_raw(self.as_ptr() as *mut _, b"notify::clock-type\0".as_ptr() as *const _, transmute(notify_clock_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } @@ -82,5 +83,5 @@ impl> SystemClockExt for O { unsafe extern "C" fn notify_clock_type_trampoline

(this: *mut ffi::GstSystemClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); - f(&SystemClock::from_glib_borrow(this).downcast_unchecked()) + f(&SystemClock::from_glib_borrow(this).unsafe_cast()) } diff --git a/gstreamer/src/auto/tag_setter.rs b/gstreamer/src/auto/tag_setter.rs index 1ba9bc638..8a1365687 100644 --- a/gstreamer/src/auto/tag_setter.rs +++ b/gstreamer/src/auto/tag_setter.rs @@ -11,7 +11,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct TagSetter(Object): Element, Object; + pub struct TagSetter(Interface) @requires Element, Object; match fn { get_type => || ffi::gst_tag_setter_get_type(), @@ -21,6 +21,8 @@ glib_wrapper! { unsafe impl Send for TagSetter {} unsafe impl Sync for TagSetter {} +pub const NONE_TAG_SETTER: Option<&TagSetter> = None; + pub trait TagSetterExt: 'static { //fn add_tag_valist(&self, mode: TagMergeMode, tag: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); @@ -66,31 +68,31 @@ impl> TagSetterExt for O { fn get_tag_list(&self) -> Option { unsafe { - from_glib_none(ffi::gst_tag_setter_get_tag_list(self.to_glib_none().0)) + from_glib_none(ffi::gst_tag_setter_get_tag_list(self.as_ref().to_glib_none().0)) } } fn get_tag_merge_mode(&self) -> TagMergeMode { unsafe { - from_glib(ffi::gst_tag_setter_get_tag_merge_mode(self.to_glib_none().0)) + from_glib(ffi::gst_tag_setter_get_tag_merge_mode(self.as_ref().to_glib_none().0)) } } fn merge_tags(&self, list: &TagList, mode: TagMergeMode) { unsafe { - ffi::gst_tag_setter_merge_tags(self.to_glib_none().0, list.to_glib_none().0, mode.to_glib()); + ffi::gst_tag_setter_merge_tags(self.as_ref().to_glib_none().0, list.to_glib_none().0, mode.to_glib()); } } fn reset_tags(&self) { unsafe { - ffi::gst_tag_setter_reset_tags(self.to_glib_none().0); + ffi::gst_tag_setter_reset_tags(self.as_ref().to_glib_none().0); } } fn set_tag_merge_mode(&self, mode: TagMergeMode) { unsafe { - ffi::gst_tag_setter_set_tag_merge_mode(self.to_glib_none().0, mode.to_glib()); + ffi::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 0f83f85f8..f36ef8555 100644 --- a/gstreamer/src/auto/toc_setter.rs +++ b/gstreamer/src/auto/toc_setter.rs @@ -10,7 +10,7 @@ use glib::object::IsA; use glib::translate::*; glib_wrapper! { - pub struct TocSetter(Object): Element, Object; + pub struct TocSetter(Interface) @requires Element, Object; match fn { get_type => || ffi::gst_toc_setter_get_type(), @@ -20,6 +20,8 @@ glib_wrapper! { unsafe impl Send for TocSetter {} unsafe impl Sync for TocSetter {} +pub const NONE_TOC_SETTER: Option<&TocSetter> = None; + pub trait TocSetterExt: 'static { fn get_toc(&self) -> Option; @@ -31,21 +33,20 @@ pub trait TocSetterExt: 'static { impl> TocSetterExt for O { fn get_toc(&self) -> Option { unsafe { - from_glib_full(ffi::gst_toc_setter_get_toc(self.to_glib_none().0)) + from_glib_full(ffi::gst_toc_setter_get_toc(self.as_ref().to_glib_none().0)) } } fn reset(&self) { unsafe { - ffi::gst_toc_setter_reset(self.to_glib_none().0); + ffi::gst_toc_setter_reset(self.as_ref().to_glib_none().0); } } fn set_toc<'a, P: Into>>(&self, toc: P) { let toc = toc.into(); - let toc = toc.to_glib_none(); unsafe { - ffi::gst_toc_setter_set_toc(self.to_glib_none().0, toc.0); + ffi::gst_toc_setter_set_toc(self.as_ref().to_glib_none().0, toc.to_glib_none().0); } } } diff --git a/gstreamer/src/auto/type_find_factory.rs b/gstreamer/src/auto/type_find_factory.rs index 85ed397c1..4feea8285 100644 --- a/gstreamer/src/auto/type_find_factory.rs +++ b/gstreamer/src/auto/type_find_factory.rs @@ -10,7 +10,7 @@ use glib::GString; use glib::translate::*; glib_wrapper! { - pub struct TypeFindFactory(Object): PluginFeature, Object; + pub struct TypeFindFactory(Object) @extends PluginFeature, Object; match fn { get_type => || ffi::gst_type_find_factory_get_type(), @@ -50,3 +50,5 @@ impl TypeFindFactory { unsafe impl Send for TypeFindFactory {} unsafe impl Sync for TypeFindFactory {} + +pub const NONE_TYPE_FIND_FACTORY: Option<&TypeFindFactory> = None; diff --git a/gstreamer/src/auto/uri_handler.rs b/gstreamer/src/auto/uri_handler.rs index 9fad626e7..dd4f73ad7 100644 --- a/gstreamer/src/auto/uri_handler.rs +++ b/gstreamer/src/auto/uri_handler.rs @@ -11,7 +11,7 @@ use glib::translate::*; use std::ptr; glib_wrapper! { - pub struct URIHandler(Object); + pub struct URIHandler(Interface); match fn { get_type => || ffi::gst_uri_handler_get_type(), @@ -21,6 +21,8 @@ glib_wrapper! { unsafe impl Send for URIHandler {} unsafe impl Sync for URIHandler {} +pub const NONE_URI_HANDLER: Option<&URIHandler> = None; + pub trait URIHandlerExt: 'static { fn get_protocols(&self) -> Vec; @@ -34,26 +36,26 @@ pub trait URIHandlerExt: 'static { impl> URIHandlerExt for O { fn get_protocols(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_uri_handler_get_protocols(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::gst_uri_handler_get_protocols(self.as_ref().to_glib_none().0)) } } fn get_uri(&self) -> Option { unsafe { - from_glib_full(ffi::gst_uri_handler_get_uri(self.to_glib_none().0)) + from_glib_full(ffi::gst_uri_handler_get_uri(self.as_ref().to_glib_none().0)) } } fn get_uri_type(&self) -> URIType { unsafe { - from_glib(ffi::gst_uri_handler_get_uri_type(self.to_glib_none().0)) + from_glib(ffi::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 _ = ffi::gst_uri_handler_set_uri(self.to_glib_none().0, uri.to_glib_none().0, &mut error); + let _ = ffi::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/auto/versions.txt b/gstreamer/src/auto/versions.txt index f5cdd492a..c2ed9e767 100644 --- a/gstreamer/src/auto/versions.txt +++ b/gstreamer/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ d41632a) +Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a) from gir-files (https://github.com/gtk-rs/gir-files @ ???)