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 glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, mem::transmute};
12
13glib::wrapper! {
14 #[doc(alias = "GstAggregatorPad")]
15 pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass>) @extends gst::Pad, gst::Object;
16
17 match fn {
18 type_ => || ffi::gst_aggregator_pad_get_type(),
19 }
20}
21
22impl AggregatorPad {
23 pub const NONE: Option<&'static AggregatorPad> = None;
24}
25
26unsafe impl Send for AggregatorPad {}
27unsafe impl Sync for AggregatorPad {}
28
29mod sealed {
30 pub trait Sealed {}
31 impl<T: super::IsA<super::AggregatorPad>> Sealed for T {}
32}
33
34pub trait AggregatorPadExt: IsA<AggregatorPad> + sealed::Sealed + 'static {
35 #[doc(alias = "gst_aggregator_pad_drop_buffer")]
36 fn drop_buffer(&self) -> bool {
37 unsafe {
38 from_glib(ffi::gst_aggregator_pad_drop_buffer(
39 self.as_ref().to_glib_none().0,
40 ))
41 }
42 }
43
44 #[cfg(feature = "v1_14_1")]
45 #[cfg_attr(docsrs, doc(cfg(feature = "v1_14_1")))]
46 #[doc(alias = "gst_aggregator_pad_has_buffer")]
47 fn has_buffer(&self) -> bool {
48 unsafe {
49 from_glib(ffi::gst_aggregator_pad_has_buffer(
50 self.as_ref().to_glib_none().0,
51 ))
52 }
53 }
54
55 #[doc(alias = "gst_aggregator_pad_is_eos")]
56 fn is_eos(&self) -> bool {
57 unsafe {
58 from_glib(ffi::gst_aggregator_pad_is_eos(
59 self.as_ref().to_glib_none().0,
60 ))
61 }
62 }
63
64 #[cfg(feature = "v1_20")]
65 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
66 #[doc(alias = "gst_aggregator_pad_is_inactive")]
67 fn is_inactive(&self) -> bool {
68 unsafe {
69 from_glib(ffi::gst_aggregator_pad_is_inactive(
70 self.as_ref().to_glib_none().0,
71 ))
72 }
73 }
74
75 #[doc(alias = "gst_aggregator_pad_peek_buffer")]
76 fn peek_buffer(&self) -> Option<gst::Buffer> {
77 unsafe {
78 from_glib_full(ffi::gst_aggregator_pad_peek_buffer(
79 self.as_ref().to_glib_none().0,
80 ))
81 }
82 }
83
84 #[doc(alias = "gst_aggregator_pad_pop_buffer")]
85 fn pop_buffer(&self) -> Option<gst::Buffer> {
86 unsafe {
87 from_glib_full(ffi::gst_aggregator_pad_pop_buffer(
88 self.as_ref().to_glib_none().0,
89 ))
90 }
91 }
92
93 #[cfg(feature = "v1_16")]
94 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
95 #[doc(alias = "emit-signals")]
96 fn emits_signals(&self) -> bool {
97 ObjectExt::property(self.as_ref(), "emit-signals")
98 }
99
100 #[cfg(feature = "v1_16")]
101 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
102 #[doc(alias = "emit-signals")]
103 fn set_emit_signals(&self, emit_signals: bool) {
104 ObjectExt::set_property(self.as_ref(), "emit-signals", emit_signals)
105 }
106
107 #[doc(alias = "buffer-consumed")]
108 fn connect_buffer_consumed<F: Fn(&Self, &gst::Buffer) + Send + Sync + 'static>(
109 &self,
110 f: F,
111 ) -> SignalHandlerId {
112 unsafe extern "C" fn buffer_consumed_trampoline<
113 P: IsA<AggregatorPad>,
114 F: Fn(&P, &gst::Buffer) + Send + Sync + 'static,
115 >(
116 this: *mut ffi::GstAggregatorPad,
117 object: *mut gst::ffi::GstBuffer,
118 f: glib::ffi::gpointer,
119 ) {
120 let f: &F = &*(f as *const F);
121 f(
122 AggregatorPad::from_glib_borrow(this).unsafe_cast_ref(),
123 &from_glib_borrow(object),
124 )
125 }
126 unsafe {
127 let f: Box_<F> = Box_::new(f);
128 connect_raw(
129 self.as_ptr() as *mut _,
130 b"buffer-consumed\0".as_ptr() as *const _,
131 Some(transmute::<_, unsafe extern "C" fn()>(
132 buffer_consumed_trampoline::<Self, F> as *const (),
133 )),
134 Box_::into_raw(f),
135 )
136 }
137 }
138
139 #[cfg(feature = "v1_16")]
140 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
141 #[doc(alias = "emit-signals")]
142 fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
143 &self,
144 f: F,
145 ) -> SignalHandlerId {
146 unsafe extern "C" fn notify_emit_signals_trampoline<
147 P: IsA<AggregatorPad>,
148 F: Fn(&P) + Send + Sync + 'static,
149 >(
150 this: *mut ffi::GstAggregatorPad,
151 _param_spec: glib::ffi::gpointer,
152 f: glib::ffi::gpointer,
153 ) {
154 let f: &F = &*(f as *const F);
155 f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
156 }
157 unsafe {
158 let f: Box_<F> = Box_::new(f);
159 connect_raw(
160 self.as_ptr() as *mut _,
161 b"notify::emit-signals\0".as_ptr() as *const _,
162 Some(transmute::<_, unsafe extern "C" fn()>(
163 notify_emit_signals_trampoline::<Self, F> as *const (),
164 )),
165 Box_::into_raw(f),
166 )
167 }
168 }
169}
170
171impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {}
172