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 // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4 // DO NOT EDIT
5 
6 #[cfg(any(feature = "v1_18", feature = "dox"))]
7 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
8 use crate::AggregatorPad;
9 #[cfg(any(feature = "v1_18", feature = "dox"))]
10 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
11 use crate::AggregatorStartTimeSelection;
12 use glib::object::Cast;
13 use glib::object::IsA;
14 use glib::signal::connect_raw;
15 use glib::signal::SignalHandlerId;
16 use glib::translate::*;
17 use glib::StaticType;
18 use glib::ToValue;
19 use std::boxed::Box as Box_;
20 use std::mem::transmute;
21 
22 glib::wrapper! {
23     #[doc(alias = "GstAggregator")]
24     pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass>) @extends gst::Element, gst::Object;
25 
26     match fn {
27         type_ => || ffi::gst_aggregator_get_type(),
28     }
29 }
30 
31 unsafe impl Send for Aggregator {}
32 unsafe impl Sync for Aggregator {}
33 
34 pub const NONE_AGGREGATOR: Option<&Aggregator> = None;
35 
36 pub trait AggregatorExt: 'static {
37     #[doc(alias = "gst_aggregator_get_buffer_pool")]
38     #[doc(alias = "get_buffer_pool")]
buffer_pool(&self) -> Option<gst::BufferPool>39     fn buffer_pool(&self) -> Option<gst::BufferPool>;
40 
41     #[doc(alias = "gst_aggregator_get_latency")]
42     #[doc(alias = "get_latency")]
latency(&self) -> Option<gst::ClockTime>43     fn latency(&self) -> Option<gst::ClockTime>;
44 
45     #[cfg(any(feature = "v1_18", feature = "dox"))]
46     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
47     #[doc(alias = "gst_aggregator_negotiate")]
negotiate(&self) -> bool48     fn negotiate(&self) -> bool;
49 
50     #[cfg(any(feature = "v1_18", feature = "dox"))]
51     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
52     #[doc(alias = "gst_aggregator_peek_next_sample")]
peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>53     fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>;
54 
55     #[doc(alias = "gst_aggregator_set_latency")]
set_latency( &self, min_latency: gst::ClockTime, max_latency: impl Into<Option<gst::ClockTime>>, )56     fn set_latency(
57         &self,
58         min_latency: gst::ClockTime,
59         max_latency: impl Into<Option<gst::ClockTime>>,
60     );
61 
62     #[doc(alias = "gst_aggregator_set_src_caps")]
set_src_caps(&self, caps: &gst::Caps)63     fn set_src_caps(&self, caps: &gst::Caps);
64 
65     #[cfg(any(feature = "v1_16", feature = "dox"))]
66     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
67     #[doc(alias = "gst_aggregator_simple_get_next_time")]
simple_get_next_time(&self) -> Option<gst::ClockTime>68     fn simple_get_next_time(&self) -> Option<gst::ClockTime>;
69 
70     #[cfg(any(feature = "v1_18", feature = "dox"))]
71     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
72     #[doc(alias = "emit-signals")]
emits_signals(&self) -> bool73     fn emits_signals(&self) -> bool;
74 
75     #[cfg(any(feature = "v1_18", feature = "dox"))]
76     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
77     #[doc(alias = "emit-signals")]
set_emit_signals(&self, emit_signals: bool)78     fn set_emit_signals(&self, emit_signals: bool);
79 
80     #[doc(alias = "start-time")]
start_time(&self) -> u6481     fn start_time(&self) -> u64;
82 
83     #[doc(alias = "start-time")]
set_start_time(&self, start_time: u64)84     fn set_start_time(&self, start_time: u64);
85 
86     #[cfg(any(feature = "v1_18", feature = "dox"))]
87     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
88     #[doc(alias = "start-time-selection")]
start_time_selection(&self) -> AggregatorStartTimeSelection89     fn start_time_selection(&self) -> AggregatorStartTimeSelection;
90 
91     #[cfg(any(feature = "v1_18", feature = "dox"))]
92     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
93     #[doc(alias = "start-time-selection")]
set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection)94     fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection);
95 
96     #[cfg(any(feature = "v1_18", feature = "dox"))]
97     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
98     #[doc(alias = "emit-signals")]
connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId99     fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
100         &self,
101         f: F,
102     ) -> SignalHandlerId;
103 
104     #[cfg(any(feature = "v1_14", feature = "dox"))]
105     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
106     #[doc(alias = "latency")]
connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId107     fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F)
108         -> SignalHandlerId;
109 
110     #[doc(alias = "start-time")]
connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId111     fn connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
112         &self,
113         f: F,
114     ) -> SignalHandlerId;
115 
116     #[cfg(any(feature = "v1_18", feature = "dox"))]
117     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
118     #[doc(alias = "start-time-selection")]
connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId119     fn connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>(
120         &self,
121         f: F,
122     ) -> SignalHandlerId;
123 }
124 
125 impl<O: IsA<Aggregator>> AggregatorExt for O {
buffer_pool(&self) -> Option<gst::BufferPool>126     fn buffer_pool(&self) -> Option<gst::BufferPool> {
127         unsafe {
128             from_glib_full(ffi::gst_aggregator_get_buffer_pool(
129                 self.as_ref().to_glib_none().0,
130             ))
131         }
132     }
133 
latency(&self) -> Option<gst::ClockTime>134     fn latency(&self) -> Option<gst::ClockTime> {
135         unsafe {
136             from_glib(ffi::gst_aggregator_get_latency(
137                 self.as_ref().to_glib_none().0,
138             ))
139         }
140     }
141 
142     #[cfg(any(feature = "v1_18", feature = "dox"))]
143     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
negotiate(&self) -> bool144     fn negotiate(&self) -> bool {
145         unsafe {
146             from_glib(ffi::gst_aggregator_negotiate(
147                 self.as_ref().to_glib_none().0,
148             ))
149         }
150     }
151 
152     #[cfg(any(feature = "v1_18", feature = "dox"))]
153     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>154     fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample> {
155         unsafe {
156             from_glib_full(ffi::gst_aggregator_peek_next_sample(
157                 self.as_ref().to_glib_none().0,
158                 pad.as_ref().to_glib_none().0,
159             ))
160         }
161     }
162 
set_latency( &self, min_latency: gst::ClockTime, max_latency: impl Into<Option<gst::ClockTime>>, )163     fn set_latency(
164         &self,
165         min_latency: gst::ClockTime,
166         max_latency: impl Into<Option<gst::ClockTime>>,
167     ) {
168         unsafe {
169             ffi::gst_aggregator_set_latency(
170                 self.as_ref().to_glib_none().0,
171                 min_latency.into_glib(),
172                 max_latency.into().into_glib(),
173             );
174         }
175     }
176 
set_src_caps(&self, caps: &gst::Caps)177     fn set_src_caps(&self, caps: &gst::Caps) {
178         unsafe {
179             ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
180         }
181     }
182 
183     #[cfg(any(feature = "v1_16", feature = "dox"))]
184     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
simple_get_next_time(&self) -> Option<gst::ClockTime>185     fn simple_get_next_time(&self) -> Option<gst::ClockTime> {
186         unsafe {
187             from_glib(ffi::gst_aggregator_simple_get_next_time(
188                 self.as_ref().to_glib_none().0,
189             ))
190         }
191     }
192 
193     #[cfg(any(feature = "v1_18", feature = "dox"))]
194     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
emits_signals(&self) -> bool195     fn emits_signals(&self) -> bool {
196         unsafe {
197             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
198             glib::gobject_ffi::g_object_get_property(
199                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
200                 b"emit-signals\0".as_ptr() as *const _,
201                 value.to_glib_none_mut().0,
202             );
203             value
204                 .get()
205                 .expect("Return Value for property `emit-signals` getter")
206         }
207     }
208 
209     #[cfg(any(feature = "v1_18", feature = "dox"))]
210     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
set_emit_signals(&self, emit_signals: bool)211     fn set_emit_signals(&self, emit_signals: bool) {
212         unsafe {
213             glib::gobject_ffi::g_object_set_property(
214                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
215                 b"emit-signals\0".as_ptr() as *const _,
216                 emit_signals.to_value().to_glib_none().0,
217             );
218         }
219     }
220 
start_time(&self) -> u64221     fn start_time(&self) -> u64 {
222         unsafe {
223             let mut value = glib::Value::from_type(<u64 as StaticType>::static_type());
224             glib::gobject_ffi::g_object_get_property(
225                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
226                 b"start-time\0".as_ptr() as *const _,
227                 value.to_glib_none_mut().0,
228             );
229             value
230                 .get()
231                 .expect("Return Value for property `start-time` getter")
232         }
233     }
234 
set_start_time(&self, start_time: u64)235     fn set_start_time(&self, start_time: u64) {
236         unsafe {
237             glib::gobject_ffi::g_object_set_property(
238                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
239                 b"start-time\0".as_ptr() as *const _,
240                 start_time.to_value().to_glib_none().0,
241             );
242         }
243     }
244 
245     #[cfg(any(feature = "v1_18", feature = "dox"))]
246     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
start_time_selection(&self) -> AggregatorStartTimeSelection247     fn start_time_selection(&self) -> AggregatorStartTimeSelection {
248         unsafe {
249             let mut value =
250                 glib::Value::from_type(<AggregatorStartTimeSelection as StaticType>::static_type());
251             glib::gobject_ffi::g_object_get_property(
252                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
253                 b"start-time-selection\0".as_ptr() as *const _,
254                 value.to_glib_none_mut().0,
255             );
256             value
257                 .get()
258                 .expect("Return Value for property `start-time-selection` getter")
259         }
260     }
261 
262     #[cfg(any(feature = "v1_18", feature = "dox"))]
263     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection)264     fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection) {
265         unsafe {
266             glib::gobject_ffi::g_object_set_property(
267                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
268                 b"start-time-selection\0".as_ptr() as *const _,
269                 start_time_selection.to_value().to_glib_none().0,
270             );
271         }
272     }
273 
274     #[cfg(any(feature = "v1_18", feature = "dox"))]
275     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId276     fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
277         &self,
278         f: F,
279     ) -> SignalHandlerId {
280         unsafe extern "C" fn notify_emit_signals_trampoline<
281             P: IsA<Aggregator>,
282             F: Fn(&P) + Send + Sync + 'static,
283         >(
284             this: *mut ffi::GstAggregator,
285             _param_spec: glib::ffi::gpointer,
286             f: glib::ffi::gpointer,
287         ) {
288             let f: &F = &*(f as *const F);
289             f(Aggregator::from_glib_borrow(this).unsafe_cast_ref())
290         }
291         unsafe {
292             let f: Box_<F> = Box_::new(f);
293             connect_raw(
294                 self.as_ptr() as *mut _,
295                 b"notify::emit-signals\0".as_ptr() as *const _,
296                 Some(transmute::<_, unsafe extern "C" fn()>(
297                     notify_emit_signals_trampoline::<Self, F> as *const (),
298                 )),
299                 Box_::into_raw(f),
300             )
301         }
302     }
303 
304     #[cfg(any(feature = "v1_14", feature = "dox"))]
305     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId306     fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
307         &self,
308         f: F,
309     ) -> SignalHandlerId {
310         unsafe extern "C" fn notify_latency_trampoline<
311             P: IsA<Aggregator>,
312             F: Fn(&P) + Send + Sync + 'static,
313         >(
314             this: *mut ffi::GstAggregator,
315             _param_spec: glib::ffi::gpointer,
316             f: glib::ffi::gpointer,
317         ) {
318             let f: &F = &*(f as *const F);
319             f(Aggregator::from_glib_borrow(this).unsafe_cast_ref())
320         }
321         unsafe {
322             let f: Box_<F> = Box_::new(f);
323             connect_raw(
324                 self.as_ptr() as *mut _,
325                 b"notify::latency\0".as_ptr() as *const _,
326                 Some(transmute::<_, unsafe extern "C" fn()>(
327                     notify_latency_trampoline::<Self, F> as *const (),
328                 )),
329                 Box_::into_raw(f),
330             )
331         }
332     }
333 
connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId334     fn connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
335         &self,
336         f: F,
337     ) -> SignalHandlerId {
338         unsafe extern "C" fn notify_start_time_trampoline<
339             P: IsA<Aggregator>,
340             F: Fn(&P) + Send + Sync + 'static,
341         >(
342             this: *mut ffi::GstAggregator,
343             _param_spec: glib::ffi::gpointer,
344             f: glib::ffi::gpointer,
345         ) {
346             let f: &F = &*(f as *const F);
347             f(Aggregator::from_glib_borrow(this).unsafe_cast_ref())
348         }
349         unsafe {
350             let f: Box_<F> = Box_::new(f);
351             connect_raw(
352                 self.as_ptr() as *mut _,
353                 b"notify::start-time\0".as_ptr() as *const _,
354                 Some(transmute::<_, unsafe extern "C" fn()>(
355                     notify_start_time_trampoline::<Self, F> as *const (),
356                 )),
357                 Box_::into_raw(f),
358             )
359         }
360     }
361 
362     #[cfg(any(feature = "v1_18", feature = "dox"))]
363     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId364     fn connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>(
365         &self,
366         f: F,
367     ) -> SignalHandlerId {
368         unsafe extern "C" fn notify_start_time_selection_trampoline<
369             P: IsA<Aggregator>,
370             F: Fn(&P) + Send + Sync + 'static,
371         >(
372             this: *mut ffi::GstAggregator,
373             _param_spec: glib::ffi::gpointer,
374             f: glib::ffi::gpointer,
375         ) {
376             let f: &F = &*(f as *const F);
377             f(Aggregator::from_glib_borrow(this).unsafe_cast_ref())
378         }
379         unsafe {
380             let f: Box_<F> = Box_::new(f);
381             connect_raw(
382                 self.as_ptr() as *mut _,
383                 b"notify::start-time-selection\0".as_ptr() as *const _,
384                 Some(transmute::<_, unsafe extern "C" fn()>(
385                     notify_start_time_selection_trampoline::<Self, F> as *const (),
386                 )),
387                 Box_::into_raw(f),
388             )
389         }
390     }
391 }
392