Skip to main content

gstreamer_base/auto/
aggregator_pad.rs

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
6use crate::ffi;
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    #[doc(alias = "GstAggregatorPad")]
17    pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass>) @extends gst::Pad, gst::Object;
18
19    match fn {
20        type_ => || ffi::gst_aggregator_pad_get_type(),
21    }
22}
23
24impl AggregatorPad {
25    pub const NONE: Option<&'static AggregatorPad> = None;
26}
27
28unsafe impl Send for AggregatorPad {}
29unsafe impl Sync for AggregatorPad {}
30
31pub trait AggregatorPadExt: IsA<AggregatorPad> + 'static {
32    #[doc(alias = "gst_aggregator_pad_drop_buffer")]
33    fn drop_buffer(&self) -> bool {
34        unsafe {
35            from_glib(ffi::gst_aggregator_pad_drop_buffer(
36                self.as_ref().to_glib_none().0,
37            ))
38        }
39    }
40
41    #[cfg(feature = "v1_14_1")]
42    #[cfg_attr(docsrs, doc(cfg(feature = "v1_14_1")))]
43    #[doc(alias = "gst_aggregator_pad_has_buffer")]
44    fn has_buffer(&self) -> bool {
45        unsafe {
46            from_glib(ffi::gst_aggregator_pad_has_buffer(
47                self.as_ref().to_glib_none().0,
48            ))
49        }
50    }
51
52    #[doc(alias = "gst_aggregator_pad_is_eos")]
53    fn is_eos(&self) -> bool {
54        unsafe {
55            from_glib(ffi::gst_aggregator_pad_is_eos(
56                self.as_ref().to_glib_none().0,
57            ))
58        }
59    }
60
61    #[cfg(feature = "v1_20")]
62    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
63    #[doc(alias = "gst_aggregator_pad_is_inactive")]
64    fn is_inactive(&self) -> bool {
65        unsafe {
66            from_glib(ffi::gst_aggregator_pad_is_inactive(
67                self.as_ref().to_glib_none().0,
68            ))
69        }
70    }
71
72    #[doc(alias = "gst_aggregator_pad_peek_buffer")]
73    fn peek_buffer(&self) -> Option<gst::Buffer> {
74        unsafe {
75            from_glib_full(ffi::gst_aggregator_pad_peek_buffer(
76                self.as_ref().to_glib_none().0,
77            ))
78        }
79    }
80
81    #[doc(alias = "gst_aggregator_pad_pop_buffer")]
82    fn pop_buffer(&self) -> Option<gst::Buffer> {
83        unsafe {
84            from_glib_full(ffi::gst_aggregator_pad_pop_buffer(
85                self.as_ref().to_glib_none().0,
86            ))
87        }
88    }
89
90    #[cfg(feature = "v1_28")]
91    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
92    #[doc(alias = "current-level-buffers")]
93    fn current_level_buffers(&self) -> u64 {
94        ObjectExt::property(self.as_ref(), "current-level-buffers")
95    }
96
97    #[cfg(feature = "v1_28")]
98    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
99    #[doc(alias = "current-level-bytes")]
100    fn current_level_bytes(&self) -> u64 {
101        ObjectExt::property(self.as_ref(), "current-level-bytes")
102    }
103
104    #[cfg(feature = "v1_16")]
105    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
106    #[doc(alias = "emit-signals")]
107    fn emits_signals(&self) -> bool {
108        ObjectExt::property(self.as_ref(), "emit-signals")
109    }
110
111    #[cfg(feature = "v1_16")]
112    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
113    #[doc(alias = "emit-signals")]
114    fn set_emit_signals(&self, emit_signals: bool) {
115        ObjectExt::set_property(self.as_ref(), "emit-signals", emit_signals)
116    }
117
118    #[doc(alias = "buffer-consumed")]
119    fn connect_buffer_consumed<F: Fn(&Self, &gst::Buffer) + Send + Sync + 'static>(
120        &self,
121        f: F,
122    ) -> SignalHandlerId {
123        unsafe extern "C" fn buffer_consumed_trampoline<
124            P: IsA<AggregatorPad>,
125            F: Fn(&P, &gst::Buffer) + Send + Sync + 'static,
126        >(
127            this: *mut ffi::GstAggregatorPad,
128            object: *mut gst::ffi::GstBuffer,
129            f: glib::ffi::gpointer,
130        ) {
131            unsafe {
132                let f: &F = &*(f as *const F);
133                f(
134                    AggregatorPad::from_glib_borrow(this).unsafe_cast_ref(),
135                    &from_glib_borrow(object),
136                )
137            }
138        }
139        unsafe {
140            let f: Box_<F> = Box_::new(f);
141            connect_raw(
142                self.as_ptr() as *mut _,
143                c"buffer-consumed".as_ptr() as *const _,
144                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
145                    buffer_consumed_trampoline::<Self, F> as *const (),
146                )),
147                Box_::into_raw(f),
148            )
149        }
150    }
151
152    #[cfg(feature = "v1_28")]
153    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
154    #[doc(alias = "current-level-buffers")]
155    fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
156        &self,
157        f: F,
158    ) -> SignalHandlerId {
159        unsafe extern "C" fn notify_current_level_buffers_trampoline<
160            P: IsA<AggregatorPad>,
161            F: Fn(&P) + Send + Sync + 'static,
162        >(
163            this: *mut ffi::GstAggregatorPad,
164            _param_spec: glib::ffi::gpointer,
165            f: glib::ffi::gpointer,
166        ) {
167            unsafe {
168                let f: &F = &*(f as *const F);
169                f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
170            }
171        }
172        unsafe {
173            let f: Box_<F> = Box_::new(f);
174            connect_raw(
175                self.as_ptr() as *mut _,
176                c"notify::current-level-buffers".as_ptr() as *const _,
177                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
178                    notify_current_level_buffers_trampoline::<Self, F> as *const (),
179                )),
180                Box_::into_raw(f),
181            )
182        }
183    }
184
185    #[cfg(feature = "v1_28")]
186    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
187    #[doc(alias = "current-level-bytes")]
188    fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
189        &self,
190        f: F,
191    ) -> SignalHandlerId {
192        unsafe extern "C" fn notify_current_level_bytes_trampoline<
193            P: IsA<AggregatorPad>,
194            F: Fn(&P) + Send + Sync + 'static,
195        >(
196            this: *mut ffi::GstAggregatorPad,
197            _param_spec: glib::ffi::gpointer,
198            f: glib::ffi::gpointer,
199        ) {
200            unsafe {
201                let f: &F = &*(f as *const F);
202                f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
203            }
204        }
205        unsafe {
206            let f: Box_<F> = Box_::new(f);
207            connect_raw(
208                self.as_ptr() as *mut _,
209                c"notify::current-level-bytes".as_ptr() as *const _,
210                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
211                    notify_current_level_bytes_trampoline::<Self, F> as *const (),
212                )),
213                Box_::into_raw(f),
214            )
215        }
216    }
217
218    #[cfg(feature = "v1_16")]
219    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
220    #[doc(alias = "emit-signals")]
221    fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
222        &self,
223        f: F,
224    ) -> SignalHandlerId {
225        unsafe extern "C" fn notify_emit_signals_trampoline<
226            P: IsA<AggregatorPad>,
227            F: Fn(&P) + Send + Sync + 'static,
228        >(
229            this: *mut ffi::GstAggregatorPad,
230            _param_spec: glib::ffi::gpointer,
231            f: glib::ffi::gpointer,
232        ) {
233            unsafe {
234                let f: &F = &*(f as *const F);
235                f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
236            }
237        }
238        unsafe {
239            let f: Box_<F> = Box_::new(f);
240            connect_raw(
241                self.as_ptr() as *mut _,
242                c"notify::emit-signals".as_ptr() as *const _,
243                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
244                    notify_emit_signals_trampoline::<Self, F> as *const (),
245                )),
246                Box_::into_raw(f),
247            )
248        }
249    }
250}
251
252impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {}