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::object::Cast;
6 use glib::object::IsA;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib::StaticType;
11 use glib::Value;
12 use glib_sys;
13 use gobject_sys;
14 use gst;
15 use gst_base_sys;
16 use std::boxed::Box as Box_;
17 use std::mem::transmute;
18 
19 glib_wrapper! {
20     pub struct Aggregator(Object<gst_base_sys::GstAggregator, gst_base_sys::GstAggregatorClass, AggregatorClass>) @extends gst::Element, gst::Object;
21 
22     match fn {
23         get_type => || gst_base_sys::gst_aggregator_get_type(),
24     }
25 }
26 
27 unsafe impl Send for Aggregator {}
28 unsafe impl Sync for Aggregator {}
29 
30 pub const NONE_AGGREGATOR: Option<&Aggregator> = None;
31 
32 pub trait AggregatorExt: 'static {
33     //#[cfg(any(feature = "v1_14", feature = "dox"))]
34     //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
35 
36     #[cfg(any(feature = "v1_14", feature = "dox"))]
get_buffer_pool(&self) -> Option<gst::BufferPool>37     fn get_buffer_pool(&self) -> Option<gst::BufferPool>;
38 
39     #[cfg(any(feature = "v1_14", feature = "dox"))]
get_latency(&self) -> gst::ClockTime40     fn get_latency(&self) -> gst::ClockTime;
41 
42     #[cfg(any(feature = "v1_14", feature = "dox"))]
set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime)43     fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime);
44 
45     #[cfg(any(feature = "v1_14", feature = "dox"))]
set_src_caps(&self, caps: &gst::Caps)46     fn set_src_caps(&self, caps: &gst::Caps);
47 
48     #[cfg(any(feature = "v1_16", feature = "dox"))]
simple_get_next_time(&self) -> gst::ClockTime49     fn simple_get_next_time(&self) -> gst::ClockTime;
50 
get_property_start_time(&self) -> u6451     fn get_property_start_time(&self) -> u64;
52 
set_property_start_time(&self, start_time: u64)53     fn set_property_start_time(&self, start_time: u64);
54 
55     #[cfg(any(feature = "v1_14", feature = "dox"))]
connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId56     fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
57         &self,
58         f: F,
59     ) -> SignalHandlerId;
60 
connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId61     fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
62         &self,
63         f: F,
64     ) -> SignalHandlerId;
65 }
66 
67 impl<O: IsA<Aggregator>> AggregatorExt for O {
68     //#[cfg(any(feature = "v1_14", feature = "dox"))]
69     //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
70     //    unsafe { TODO: call gst_base_sys:gst_aggregator_get_allocator() }
71     //}
72 
73     #[cfg(any(feature = "v1_14", feature = "dox"))]
get_buffer_pool(&self) -> Option<gst::BufferPool>74     fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
75         unsafe {
76             from_glib_full(gst_base_sys::gst_aggregator_get_buffer_pool(
77                 self.as_ref().to_glib_none().0,
78             ))
79         }
80     }
81 
82     #[cfg(any(feature = "v1_14", feature = "dox"))]
get_latency(&self) -> gst::ClockTime83     fn get_latency(&self) -> gst::ClockTime {
84         unsafe {
85             from_glib(gst_base_sys::gst_aggregator_get_latency(
86                 self.as_ref().to_glib_none().0,
87             ))
88         }
89     }
90 
91     #[cfg(any(feature = "v1_14", feature = "dox"))]
set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime)92     fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
93         unsafe {
94             gst_base_sys::gst_aggregator_set_latency(
95                 self.as_ref().to_glib_none().0,
96                 min_latency.to_glib(),
97                 max_latency.to_glib(),
98             );
99         }
100     }
101 
102     #[cfg(any(feature = "v1_14", feature = "dox"))]
set_src_caps(&self, caps: &gst::Caps)103     fn set_src_caps(&self, caps: &gst::Caps) {
104         unsafe {
105             gst_base_sys::gst_aggregator_set_src_caps(
106                 self.as_ref().to_glib_none().0,
107                 caps.to_glib_none().0,
108             );
109         }
110     }
111 
112     #[cfg(any(feature = "v1_16", feature = "dox"))]
simple_get_next_time(&self) -> gst::ClockTime113     fn simple_get_next_time(&self) -> gst::ClockTime {
114         unsafe {
115             from_glib(gst_base_sys::gst_aggregator_simple_get_next_time(
116                 self.as_ref().to_glib_none().0,
117             ))
118         }
119     }
120 
get_property_start_time(&self) -> u64121     fn get_property_start_time(&self) -> u64 {
122         unsafe {
123             let mut value = Value::from_type(<u64 as StaticType>::static_type());
124             gobject_sys::g_object_get_property(
125                 self.to_glib_none().0 as *mut gobject_sys::GObject,
126                 b"start-time\0".as_ptr() as *const _,
127                 value.to_glib_none_mut().0,
128             );
129             value
130                 .get()
131                 .expect("Return Value for property `start-time` getter")
132                 .unwrap()
133         }
134     }
135 
set_property_start_time(&self, start_time: u64)136     fn set_property_start_time(&self, start_time: u64) {
137         unsafe {
138             gobject_sys::g_object_set_property(
139                 self.to_glib_none().0 as *mut gobject_sys::GObject,
140                 b"start-time\0".as_ptr() as *const _,
141                 Value::from(&start_time).to_glib_none().0,
142             );
143         }
144     }
145 
146     #[cfg(any(feature = "v1_14", feature = "dox"))]
connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId147     fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
148         &self,
149         f: F,
150     ) -> SignalHandlerId {
151         unsafe extern "C" fn notify_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
152             this: *mut gst_base_sys::GstAggregator,
153             _param_spec: glib_sys::gpointer,
154             f: glib_sys::gpointer,
155         ) where
156             P: IsA<Aggregator>,
157         {
158             let f: &F = &*(f as *const F);
159             f(&Aggregator::from_glib_borrow(this).unsafe_cast())
160         }
161         unsafe {
162             let f: Box_<F> = Box_::new(f);
163             connect_raw(
164                 self.as_ptr() as *mut _,
165                 b"notify::latency\0".as_ptr() as *const _,
166                 Some(transmute(notify_latency_trampoline::<Self, F> as usize)),
167                 Box_::into_raw(f),
168             )
169         }
170     }
171 
connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId172     fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
173         &self,
174         f: F,
175     ) -> SignalHandlerId {
176         unsafe extern "C" fn notify_start_time_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
177             this: *mut gst_base_sys::GstAggregator,
178             _param_spec: glib_sys::gpointer,
179             f: glib_sys::gpointer,
180         ) where
181             P: IsA<Aggregator>,
182         {
183             let f: &F = &*(f as *const F);
184             f(&Aggregator::from_glib_borrow(this).unsafe_cast())
185         }
186         unsafe {
187             let f: Box_<F> = Box_::new(f);
188             connect_raw(
189                 self.as_ptr() as *mut _,
190                 b"notify::start-time\0".as_ptr() as *const _,
191                 Some(transmute(notify_start_time_trampoline::<Self, F> as usize)),
192                 Box_::into_raw(f),
193             )
194         }
195     }
196 }
197