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 | use crate::ffi; |
7 | #[cfg (feature = "v1_18" )] |
8 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
9 | use crate::{AggregatorPad, AggregatorStartTimeSelection}; |
10 | use glib::{ |
11 | prelude::*, |
12 | signal::{connect_raw, SignalHandlerId}, |
13 | translate::*, |
14 | }; |
15 | use std::boxed::Box as Box_; |
16 | |
17 | glib::wrapper! { |
18 | #[doc (alias = "GstAggregator" )] |
19 | pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass>) @extends gst::Element, gst::Object; |
20 | |
21 | match fn { |
22 | type_ => || ffi::gst_aggregator_get_type(), |
23 | } |
24 | } |
25 | |
26 | impl Aggregator { |
27 | pub const NONE: Option<&'static Aggregator> = None; |
28 | } |
29 | |
30 | unsafe impl Send for Aggregator {} |
31 | unsafe impl Sync for Aggregator {} |
32 | |
33 | mod sealed { |
34 | pub trait Sealed {} |
35 | impl<T: super::IsA<super::Aggregator>> Sealed for T {} |
36 | } |
37 | |
38 | pub trait AggregatorExt: IsA<Aggregator> + sealed::Sealed + 'static { |
39 | #[doc (alias = "gst_aggregator_finish_buffer" )] |
40 | fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { |
41 | unsafe { |
42 | try_from_glib(ffi::gst_aggregator_finish_buffer( |
43 | self.as_ref().to_glib_none().0, |
44 | buffer.into_glib_ptr(), |
45 | )) |
46 | } |
47 | } |
48 | |
49 | #[cfg (feature = "v1_18" )] |
50 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
51 | #[doc (alias = "gst_aggregator_finish_buffer_list" )] |
52 | fn finish_buffer_list( |
53 | &self, |
54 | bufferlist: gst::BufferList, |
55 | ) -> Result<gst::FlowSuccess, gst::FlowError> { |
56 | unsafe { |
57 | try_from_glib(ffi::gst_aggregator_finish_buffer_list( |
58 | self.as_ref().to_glib_none().0, |
59 | bufferlist.into_glib_ptr(), |
60 | )) |
61 | } |
62 | } |
63 | |
64 | #[doc (alias = "gst_aggregator_get_buffer_pool" )] |
65 | #[doc (alias = "get_buffer_pool" )] |
66 | fn buffer_pool(&self) -> Option<gst::BufferPool> { |
67 | unsafe { |
68 | from_glib_full(ffi::gst_aggregator_get_buffer_pool( |
69 | self.as_ref().to_glib_none().0, |
70 | )) |
71 | } |
72 | } |
73 | |
74 | #[cfg (feature = "v1_22" )] |
75 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_22" )))] |
76 | #[doc (alias = "gst_aggregator_get_force_live" )] |
77 | #[doc (alias = "get_force_live" )] |
78 | fn is_force_live(&self) -> bool { |
79 | unsafe { |
80 | from_glib(ffi::gst_aggregator_get_force_live( |
81 | self.as_ref().to_glib_none().0, |
82 | )) |
83 | } |
84 | } |
85 | |
86 | #[cfg (feature = "v1_20" )] |
87 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
88 | #[doc (alias = "gst_aggregator_get_ignore_inactive_pads" )] |
89 | #[doc (alias = "get_ignore_inactive_pads" )] |
90 | fn ignores_inactive_pads(&self) -> bool { |
91 | unsafe { |
92 | from_glib(ffi::gst_aggregator_get_ignore_inactive_pads( |
93 | self.as_ref().to_glib_none().0, |
94 | )) |
95 | } |
96 | } |
97 | |
98 | #[doc (alias = "gst_aggregator_get_latency" )] |
99 | #[doc (alias = "get_latency" )] |
100 | fn latency(&self) -> Option<gst::ClockTime> { |
101 | unsafe { |
102 | from_glib(ffi::gst_aggregator_get_latency( |
103 | self.as_ref().to_glib_none().0, |
104 | )) |
105 | } |
106 | } |
107 | |
108 | #[cfg (feature = "v1_18" )] |
109 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
110 | #[doc (alias = "gst_aggregator_negotiate" )] |
111 | fn negotiate(&self) -> bool { |
112 | unsafe { |
113 | from_glib(ffi::gst_aggregator_negotiate( |
114 | self.as_ref().to_glib_none().0, |
115 | )) |
116 | } |
117 | } |
118 | |
119 | #[cfg (feature = "v1_18" )] |
120 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
121 | #[doc (alias = "gst_aggregator_peek_next_sample" )] |
122 | fn peek_next_sample(&self, pad: &impl IsA<AggregatorPad>) -> Option<gst::Sample> { |
123 | unsafe { |
124 | from_glib_full(ffi::gst_aggregator_peek_next_sample( |
125 | self.as_ref().to_glib_none().0, |
126 | pad.as_ref().to_glib_none().0, |
127 | )) |
128 | } |
129 | } |
130 | |
131 | #[cfg (feature = "v1_26" )] |
132 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_26" )))] |
133 | #[doc (alias = "gst_aggregator_push_src_event" )] |
134 | fn push_src_event(&self, event: gst::Event) -> bool { |
135 | unsafe { |
136 | from_glib(ffi::gst_aggregator_push_src_event( |
137 | self.as_ref().to_glib_none().0, |
138 | event.into_glib_ptr(), |
139 | )) |
140 | } |
141 | } |
142 | |
143 | #[cfg (feature = "v1_22" )] |
144 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_22" )))] |
145 | #[doc (alias = "gst_aggregator_set_force_live" )] |
146 | fn set_force_live(&self, force_live: bool) { |
147 | unsafe { |
148 | ffi::gst_aggregator_set_force_live( |
149 | self.as_ref().to_glib_none().0, |
150 | force_live.into_glib(), |
151 | ); |
152 | } |
153 | } |
154 | |
155 | #[cfg (feature = "v1_20" )] |
156 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
157 | #[doc (alias = "gst_aggregator_set_ignore_inactive_pads" )] |
158 | fn set_ignore_inactive_pads(&self, ignore: bool) { |
159 | unsafe { |
160 | ffi::gst_aggregator_set_ignore_inactive_pads( |
161 | self.as_ref().to_glib_none().0, |
162 | ignore.into_glib(), |
163 | ); |
164 | } |
165 | } |
166 | |
167 | #[doc (alias = "gst_aggregator_set_latency" )] |
168 | #[doc (alias = "latency" )] |
169 | fn set_latency( |
170 | &self, |
171 | min_latency: gst::ClockTime, |
172 | max_latency: impl Into<Option<gst::ClockTime>>, |
173 | ) { |
174 | unsafe { |
175 | ffi::gst_aggregator_set_latency( |
176 | self.as_ref().to_glib_none().0, |
177 | min_latency.into_glib(), |
178 | max_latency.into().into_glib(), |
179 | ); |
180 | } |
181 | } |
182 | |
183 | #[doc (alias = "gst_aggregator_set_src_caps" )] |
184 | fn set_src_caps(&self, caps: &gst::Caps) { |
185 | unsafe { |
186 | ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0); |
187 | } |
188 | } |
189 | |
190 | #[cfg (feature = "v1_16" )] |
191 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
192 | #[doc (alias = "gst_aggregator_simple_get_next_time" )] |
193 | fn simple_get_next_time(&self) -> Option<gst::ClockTime> { |
194 | unsafe { |
195 | from_glib(ffi::gst_aggregator_simple_get_next_time( |
196 | self.as_ref().to_glib_none().0, |
197 | )) |
198 | } |
199 | } |
200 | |
201 | #[cfg (feature = "v1_18" )] |
202 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
203 | #[doc (alias = "emit-signals" )] |
204 | fn emits_signals(&self) -> bool { |
205 | ObjectExt::property(self.as_ref(), "emit-signals" ) |
206 | } |
207 | |
208 | #[cfg (feature = "v1_18" )] |
209 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
210 | #[doc (alias = "emit-signals" )] |
211 | fn set_emit_signals(&self, emit_signals: bool) { |
212 | ObjectExt::set_property(self.as_ref(), "emit-signals" , emit_signals) |
213 | } |
214 | |
215 | #[doc (alias = "start-time" )] |
216 | fn start_time(&self) -> u64 { |
217 | ObjectExt::property(self.as_ref(), "start-time" ) |
218 | } |
219 | |
220 | #[doc (alias = "start-time" )] |
221 | fn set_start_time(&self, start_time: u64) { |
222 | ObjectExt::set_property(self.as_ref(), "start-time" , start_time) |
223 | } |
224 | |
225 | #[cfg (feature = "v1_18" )] |
226 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
227 | #[doc (alias = "start-time-selection" )] |
228 | fn start_time_selection(&self) -> AggregatorStartTimeSelection { |
229 | ObjectExt::property(self.as_ref(), "start-time-selection" ) |
230 | } |
231 | |
232 | #[cfg (feature = "v1_18" )] |
233 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
234 | #[doc (alias = "start-time-selection" )] |
235 | fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection) { |
236 | ObjectExt::set_property(self.as_ref(), "start-time-selection" , start_time_selection) |
237 | } |
238 | |
239 | #[cfg (feature = "v1_18" )] |
240 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
241 | #[doc (alias = "emit-signals" )] |
242 | fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>( |
243 | &self, |
244 | f: F, |
245 | ) -> SignalHandlerId { |
246 | unsafe extern "C" fn notify_emit_signals_trampoline< |
247 | P: IsA<Aggregator>, |
248 | F: Fn(&P) + Send + Sync + 'static, |
249 | >( |
250 | this: *mut ffi::GstAggregator, |
251 | _param_spec: glib::ffi::gpointer, |
252 | f: glib::ffi::gpointer, |
253 | ) { |
254 | let f: &F = &*(f as *const F); |
255 | f(Aggregator::from_glib_borrow(this).unsafe_cast_ref()) |
256 | } |
257 | unsafe { |
258 | let f: Box_<F> = Box_::new(f); |
259 | connect_raw( |
260 | self.as_ptr() as *mut _, |
261 | b"notify::emit-signals \0" .as_ptr() as *const _, |
262 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
263 | notify_emit_signals_trampoline::<Self, F> as *const (), |
264 | )), |
265 | Box_::into_raw(f), |
266 | ) |
267 | } |
268 | } |
269 | |
270 | #[doc (alias = "latency" )] |
271 | fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( |
272 | &self, |
273 | f: F, |
274 | ) -> SignalHandlerId { |
275 | unsafe extern "C" fn notify_latency_trampoline< |
276 | P: IsA<Aggregator>, |
277 | F: Fn(&P) + Send + Sync + 'static, |
278 | >( |
279 | this: *mut ffi::GstAggregator, |
280 | _param_spec: glib::ffi::gpointer, |
281 | f: glib::ffi::gpointer, |
282 | ) { |
283 | let f: &F = &*(f as *const F); |
284 | f(Aggregator::from_glib_borrow(this).unsafe_cast_ref()) |
285 | } |
286 | unsafe { |
287 | let f: Box_<F> = Box_::new(f); |
288 | connect_raw( |
289 | self.as_ptr() as *mut _, |
290 | b"notify::latency \0" .as_ptr() as *const _, |
291 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
292 | notify_latency_trampoline::<Self, F> as *const (), |
293 | )), |
294 | Box_::into_raw(f), |
295 | ) |
296 | } |
297 | } |
298 | |
299 | #[doc (alias = "start-time" )] |
300 | fn connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
301 | &self, |
302 | f: F, |
303 | ) -> SignalHandlerId { |
304 | unsafe extern "C" fn notify_start_time_trampoline< |
305 | P: IsA<Aggregator>, |
306 | F: Fn(&P) + Send + Sync + 'static, |
307 | >( |
308 | this: *mut ffi::GstAggregator, |
309 | _param_spec: glib::ffi::gpointer, |
310 | f: glib::ffi::gpointer, |
311 | ) { |
312 | let f: &F = &*(f as *const F); |
313 | f(Aggregator::from_glib_borrow(this).unsafe_cast_ref()) |
314 | } |
315 | unsafe { |
316 | let f: Box_<F> = Box_::new(f); |
317 | connect_raw( |
318 | self.as_ptr() as *mut _, |
319 | b"notify::start-time \0" .as_ptr() as *const _, |
320 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
321 | notify_start_time_trampoline::<Self, F> as *const (), |
322 | )), |
323 | Box_::into_raw(f), |
324 | ) |
325 | } |
326 | } |
327 | |
328 | #[cfg (feature = "v1_18" )] |
329 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
330 | #[doc (alias = "start-time-selection" )] |
331 | fn connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>( |
332 | &self, |
333 | f: F, |
334 | ) -> SignalHandlerId { |
335 | unsafe extern "C" fn notify_start_time_selection_trampoline< |
336 | P: IsA<Aggregator>, |
337 | F: Fn(&P) + Send + Sync + 'static, |
338 | >( |
339 | this: *mut ffi::GstAggregator, |
340 | _param_spec: glib::ffi::gpointer, |
341 | f: glib::ffi::gpointer, |
342 | ) { |
343 | let f: &F = &*(f as *const F); |
344 | f(Aggregator::from_glib_borrow(this).unsafe_cast_ref()) |
345 | } |
346 | unsafe { |
347 | let f: Box_<F> = Box_::new(f); |
348 | connect_raw( |
349 | self.as_ptr() as *mut _, |
350 | b"notify::start-time-selection \0" .as_ptr() as *const _, |
351 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
352 | notify_start_time_selection_trampoline::<Self, F> as *const (), |
353 | )), |
354 | Box_::into_raw(f), |
355 | ) |
356 | } |
357 | } |
358 | } |
359 | |
360 | impl<O: IsA<Aggregator>> AggregatorExt for O {} |
361 | |