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::{connect_raw, SignalHandlerId},
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            let f: &F = &*(f as *const F);
132            f(
133                AggregatorPad::from_glib_borrow(this).unsafe_cast_ref(),
134                &from_glib_borrow(object),
135            )
136        }
137        unsafe {
138            let f: Box_<F> = Box_::new(f);
139            connect_raw(
140                self.as_ptr() as *mut _,
141                c"buffer-consumed".as_ptr() as *const _,
142                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
143                    buffer_consumed_trampoline::<Self, F> as *const (),
144                )),
145                Box_::into_raw(f),
146            )
147        }
148    }
149
150    #[cfg(feature = "v1_28")]
151    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
152    #[doc(alias = "current-level-buffers")]
153    fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
154        &self,
155        f: F,
156    ) -> SignalHandlerId {
157        unsafe extern "C" fn notify_current_level_buffers_trampoline<
158            P: IsA<AggregatorPad>,
159            F: Fn(&P) + Send + Sync + 'static,
160        >(
161            this: *mut ffi::GstAggregatorPad,
162            _param_spec: glib::ffi::gpointer,
163            f: glib::ffi::gpointer,
164        ) {
165            let f: &F = &*(f as *const F);
166            f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
167        }
168        unsafe {
169            let f: Box_<F> = Box_::new(f);
170            connect_raw(
171                self.as_ptr() as *mut _,
172                c"notify::current-level-buffers".as_ptr() as *const _,
173                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
174                    notify_current_level_buffers_trampoline::<Self, F> as *const (),
175                )),
176                Box_::into_raw(f),
177            )
178        }
179    }
180
181    #[cfg(feature = "v1_28")]
182    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
183    #[doc(alias = "current-level-bytes")]
184    fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
185        &self,
186        f: F,
187    ) -> SignalHandlerId {
188        unsafe extern "C" fn notify_current_level_bytes_trampoline<
189            P: IsA<AggregatorPad>,
190            F: Fn(&P) + Send + Sync + 'static,
191        >(
192            this: *mut ffi::GstAggregatorPad,
193            _param_spec: glib::ffi::gpointer,
194            f: glib::ffi::gpointer,
195        ) {
196            let f: &F = &*(f as *const F);
197            f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
198        }
199        unsafe {
200            let f: Box_<F> = Box_::new(f);
201            connect_raw(
202                self.as_ptr() as *mut _,
203                c"notify::current-level-bytes".as_ptr() as *const _,
204                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
205                    notify_current_level_bytes_trampoline::<Self, F> as *const (),
206                )),
207                Box_::into_raw(f),
208            )
209        }
210    }
211
212    #[cfg(feature = "v1_16")]
213    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
214    #[doc(alias = "emit-signals")]
215    fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
216        &self,
217        f: F,
218    ) -> SignalHandlerId {
219        unsafe extern "C" fn notify_emit_signals_trampoline<
220            P: IsA<AggregatorPad>,
221            F: Fn(&P) + Send + Sync + 'static,
222        >(
223            this: *mut ffi::GstAggregatorPad,
224            _param_spec: glib::ffi::gpointer,
225            f: glib::ffi::gpointer,
226        ) {
227            let f: &F = &*(f as *const F);
228            f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
229        }
230        unsafe {
231            let f: Box_<F> = Box_::new(f);
232            connect_raw(
233                self.as_ptr() as *mut _,
234                c"notify::emit-signals".as_ptr() as *const _,
235                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
236                    notify_emit_signals_trampoline::<Self, F> as *const (),
237                )),
238                Box_::into_raw(f),
239            )
240        }
241    }
242}
243
244impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {}