1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use glib; 6 use glib::object::Cast; 7 use glib::object::IsA; 8 use glib::signal::connect_raw; 9 use glib::signal::SignalHandlerId; 10 use glib::translate::*; 11 use glib::StaticType; 12 use glib::Value; 13 use glib_sys; 14 use gobject_sys; 15 use gst; 16 use gst_base_sys; 17 use std::boxed::Box as Box_; 18 use std::mem::transmute; 19 20 glib_wrapper! { 21 pub struct BaseTransform(Object<gst_base_sys::GstBaseTransform, gst_base_sys::GstBaseTransformClass, BaseTransformClass>) @extends gst::Element, gst::Object; 22 23 match fn { 24 get_type => || gst_base_sys::gst_base_transform_get_type(), 25 } 26 } 27 28 unsafe impl Send for BaseTransform {} 29 unsafe impl Sync for BaseTransform {} 30 31 pub const NONE_BASE_TRANSFORM: Option<&BaseTransform> = None; 32 33 pub trait BaseTransformExt: 'static { 34 //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); 35 get_buffer_pool(&self) -> Option<gst::BufferPool>36 fn get_buffer_pool(&self) -> Option<gst::BufferPool>; 37 is_in_place(&self) -> bool38 fn is_in_place(&self) -> bool; 39 is_passthrough(&self) -> bool40 fn is_passthrough(&self) -> bool; 41 is_qos_enabled(&self) -> bool42 fn is_qos_enabled(&self) -> bool; 43 reconfigure_sink(&self)44 fn reconfigure_sink(&self); 45 reconfigure_src(&self)46 fn reconfigure_src(&self); 47 set_gap_aware(&self, gap_aware: bool)48 fn set_gap_aware(&self, gap_aware: bool); 49 set_in_place(&self, in_place: bool)50 fn set_in_place(&self, in_place: bool); 51 set_passthrough(&self, passthrough: bool)52 fn set_passthrough(&self, passthrough: bool); 53 set_prefer_passthrough(&self, prefer_passthrough: bool)54 fn set_prefer_passthrough(&self, prefer_passthrough: bool); 55 set_qos_enabled(&self, enabled: bool)56 fn set_qos_enabled(&self, enabled: bool); 57 update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime)58 fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime); 59 update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError>60 fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError>; 61 get_property_qos(&self) -> bool62 fn get_property_qos(&self) -> bool; 63 set_property_qos(&self, qos: bool)64 fn set_property_qos(&self, qos: bool); 65 connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId66 fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>( 67 &self, 68 f: F, 69 ) -> SignalHandlerId; 70 } 71 72 impl<O: IsA<BaseTransform>> BaseTransformExt for O { 73 //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) { 74 // unsafe { TODO: call gst_base_sys:gst_base_transform_get_allocator() } 75 //} 76 get_buffer_pool(&self) -> Option<gst::BufferPool>77 fn get_buffer_pool(&self) -> Option<gst::BufferPool> { 78 unsafe { 79 from_glib_full(gst_base_sys::gst_base_transform_get_buffer_pool( 80 self.as_ref().to_glib_none().0, 81 )) 82 } 83 } 84 is_in_place(&self) -> bool85 fn is_in_place(&self) -> bool { 86 unsafe { 87 from_glib(gst_base_sys::gst_base_transform_is_in_place( 88 self.as_ref().to_glib_none().0, 89 )) 90 } 91 } 92 is_passthrough(&self) -> bool93 fn is_passthrough(&self) -> bool { 94 unsafe { 95 from_glib(gst_base_sys::gst_base_transform_is_passthrough( 96 self.as_ref().to_glib_none().0, 97 )) 98 } 99 } 100 is_qos_enabled(&self) -> bool101 fn is_qos_enabled(&self) -> bool { 102 unsafe { 103 from_glib(gst_base_sys::gst_base_transform_is_qos_enabled( 104 self.as_ref().to_glib_none().0, 105 )) 106 } 107 } 108 reconfigure_sink(&self)109 fn reconfigure_sink(&self) { 110 unsafe { 111 gst_base_sys::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0); 112 } 113 } 114 reconfigure_src(&self)115 fn reconfigure_src(&self) { 116 unsafe { 117 gst_base_sys::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0); 118 } 119 } 120 set_gap_aware(&self, gap_aware: bool)121 fn set_gap_aware(&self, gap_aware: bool) { 122 unsafe { 123 gst_base_sys::gst_base_transform_set_gap_aware( 124 self.as_ref().to_glib_none().0, 125 gap_aware.to_glib(), 126 ); 127 } 128 } 129 set_in_place(&self, in_place: bool)130 fn set_in_place(&self, in_place: bool) { 131 unsafe { 132 gst_base_sys::gst_base_transform_set_in_place( 133 self.as_ref().to_glib_none().0, 134 in_place.to_glib(), 135 ); 136 } 137 } 138 set_passthrough(&self, passthrough: bool)139 fn set_passthrough(&self, passthrough: bool) { 140 unsafe { 141 gst_base_sys::gst_base_transform_set_passthrough( 142 self.as_ref().to_glib_none().0, 143 passthrough.to_glib(), 144 ); 145 } 146 } 147 set_prefer_passthrough(&self, prefer_passthrough: bool)148 fn set_prefer_passthrough(&self, prefer_passthrough: bool) { 149 unsafe { 150 gst_base_sys::gst_base_transform_set_prefer_passthrough( 151 self.as_ref().to_glib_none().0, 152 prefer_passthrough.to_glib(), 153 ); 154 } 155 } 156 set_qos_enabled(&self, enabled: bool)157 fn set_qos_enabled(&self, enabled: bool) { 158 unsafe { 159 gst_base_sys::gst_base_transform_set_qos_enabled( 160 self.as_ref().to_glib_none().0, 161 enabled.to_glib(), 162 ); 163 } 164 } 165 update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime)166 fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) { 167 unsafe { 168 gst_base_sys::gst_base_transform_update_qos( 169 self.as_ref().to_glib_none().0, 170 proportion, 171 diff, 172 timestamp.to_glib(), 173 ); 174 } 175 } 176 update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError>177 fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { 178 unsafe { 179 glib_result_from_gboolean!( 180 gst_base_sys::gst_base_transform_update_src_caps( 181 self.as_ref().to_glib_none().0, 182 updated_caps.to_glib_none().0 183 ), 184 "Failed to update src caps" 185 ) 186 } 187 } 188 get_property_qos(&self) -> bool189 fn get_property_qos(&self) -> bool { 190 unsafe { 191 let mut value = Value::from_type(<bool as StaticType>::static_type()); 192 gobject_sys::g_object_get_property( 193 self.to_glib_none().0 as *mut gobject_sys::GObject, 194 b"qos\0".as_ptr() as *const _, 195 value.to_glib_none_mut().0, 196 ); 197 value 198 .get() 199 .expect("Return Value for property `qos` getter") 200 .unwrap() 201 } 202 } 203 set_property_qos(&self, qos: bool)204 fn set_property_qos(&self, qos: bool) { 205 unsafe { 206 gobject_sys::g_object_set_property( 207 self.to_glib_none().0 as *mut gobject_sys::GObject, 208 b"qos\0".as_ptr() as *const _, 209 Value::from(&qos).to_glib_none().0, 210 ); 211 } 212 } 213 connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId214 fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>( 215 &self, 216 f: F, 217 ) -> SignalHandlerId { 218 unsafe extern "C" fn notify_qos_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( 219 this: *mut gst_base_sys::GstBaseTransform, 220 _param_spec: glib_sys::gpointer, 221 f: glib_sys::gpointer, 222 ) where 223 P: IsA<BaseTransform>, 224 { 225 let f: &F = &*(f as *const F); 226 f(&BaseTransform::from_glib_borrow(this).unsafe_cast()) 227 } 228 unsafe { 229 let f: Box_<F> = Box_::new(f); 230 connect_raw( 231 self.as_ptr() as *mut _, 232 b"notify::qos\0".as_ptr() as *const _, 233 Some(transmute(notify_qos_trampoline::<Self, F> as usize)), 234 Box_::into_raw(f), 235 ) 236 } 237 } 238 } 239