From 750f8f5bb551c774fb3eefbb0002637ce2a8b111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 21 Jun 2020 19:41:56 +0300 Subject: [PATCH] gstreamer/pad: Don't allow changing a pad's template after construction That's generally not a good idea and not safe to do. --- Gir_Gst.toml | 5 ++++ gstreamer/src/auto/pad.rs | 60 --------------------------------------- 2 files changed, 5 insertions(+), 60 deletions(-) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 5d99dd9a9..e53f4b5db 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -887,6 +887,11 @@ manual_traits = ["PadExtManual"] # Complex closure argument handling ignore = true + [[object.property]] + name = "template" + # Has a proper getter + ignore = true + [[object]] name = "Gst.PadTemplate" status = "generate" diff --git a/gstreamer/src/auto/pad.rs b/gstreamer/src/auto/pad.rs index 5cfcad6b5..d6a2e0d9e 100644 --- a/gstreamer/src/auto/pad.rs +++ b/gstreamer/src/auto/pad.rs @@ -168,10 +168,6 @@ pub trait PadExt: 'static { fn get_property_caps(&self) -> Option; - fn get_property_template(&self) -> Option; - - fn set_property_template(&self, template: Option<&PadTemplate>); - fn connect_linked(&self, f: F) -> SignalHandlerId; fn connect_unlinked(&self, f: F) @@ -186,11 +182,6 @@ pub trait PadExt: 'static { &self, f: F, ) -> SignalHandlerId; - - fn connect_property_template_notify( - &self, - f: F, - ) -> SignalHandlerId; } impl> PadExt for O { @@ -551,30 +542,6 @@ impl> PadExt for O { } } - fn get_property_template(&self) -> Option { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.to_glib_none().0 as *mut gobject_sys::GObject, - b"template\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `template` getter") - } - } - - fn set_property_template(&self, template: Option<&PadTemplate>) { - unsafe { - gobject_sys::g_object_set_property( - self.to_glib_none().0 as *mut gobject_sys::GObject, - b"template\0".as_ptr() as *const _, - Value::from(template).to_glib_none().0, - ); - } - } - fn connect_linked(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn linked_trampoline( this: *mut gst_sys::GstPad, @@ -685,31 +652,4 @@ impl> PadExt for O { ) } } - - fn connect_property_template_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_template_trampoline( - this: *mut gst_sys::GstPad, - _param_spec: glib_sys::gpointer, - f: glib_sys::gpointer, - ) where - P: IsA, - { - let f: &F = &*(f as *const F); - f(&Pad::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::template\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - notify_template_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } }