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