gstreamer_audio/auto/audio_aggregator.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 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// Subclasses must use (a subclass of) [`AudioAggregatorPad`][crate::AudioAggregatorPad] for both
16 /// their source and sink pads,
17 /// `gst_element_class_add_static_pad_template_with_gtype()` is a convenient
18 /// helper.
19 ///
20 /// [`AudioAggregator`][crate::AudioAggregator] can perform conversion on the data arriving
21 /// on its sink pads, based on the format expected downstream: in order
22 /// to enable that behaviour, the GType of the sink pads must either be
23 /// a (subclass of) [`AudioAggregatorConvertPad`][crate::AudioAggregatorConvertPad] to use the default
24 /// `GstAudioConverter` implementation, or a subclass of [`AudioAggregatorPad`][crate::AudioAggregatorPad]
25 /// implementing `GstAudioAggregatorPadClass.convert_buffer`.
26 ///
27 /// To allow for the output caps to change, the mechanism is the same as
28 /// above, with the GType of the source pad.
29 ///
30 /// See `GstAudioMixer` for an example.
31 ///
32 /// When conversion is enabled, [`AudioAggregator`][crate::AudioAggregator] will accept
33 /// any type of raw audio caps and perform conversion
34 /// on the data arriving on its sink pads, with whatever downstream
35 /// expects as the target format.
36 ///
37 /// In case downstream caps are not fully fixated, it will use
38 /// the first configured sink pad to finish fixating its source pad
39 /// caps.
40 ///
41 /// A notable exception for now is the sample rate, sink pads must
42 /// have the same sample rate as either the downstream requirement,
43 /// or the first configured pad, or a combination of both (when
44 /// downstream specifies a range or a set of acceptable rates).
45 ///
46 /// The [`samples-selected`][struct@crate::gst_base::Aggregator#samples-selected] signal is provided with some
47 /// additional information about the output buffer:
48 /// - "offset" G_TYPE_UINT64 Offset in samples since segment start
49 /// for the position that is next to be filled in the output buffer.
50 /// - "frames" G_TYPE_UINT Number of frames per output buffer.
51 ///
52 /// In addition the [`AggregatorExtManual::peek_next_sample()`][crate::gst_base::prelude::AggregatorExtManual::peek_next_sample()] function returns
53 /// additional information in the info `GstStructure` of the returned sample:
54 /// - "output-offset" G_TYPE_UINT64 Sample offset in output segment relative to
55 /// the output segment's start where the current position of this input
56 /// buffer would be placed
57 /// - "position" G_TYPE_UINT current position in the input buffer in samples
58 /// - "size" G_TYPE_UINT size of the input buffer in samples
59 ///
60 /// This is an Abstract Base Class, you cannot instantiate it.
61 ///
62 /// ## Properties
63 ///
64 ///
65 /// #### `alignment-threshold`
66 /// Readable | Writeable
67 ///
68 ///
69 /// #### `discont-wait`
70 /// Readable | Writeable
71 ///
72 ///
73 /// #### `force-live`
74 /// Causes the element to aggregate on a timeout even when no live source is
75 /// connected to its sinks. See [`min-upstream-latency`][struct@crate::gst_base::Aggregator#min-upstream-latency] for a
76 /// companion property: in the vast majority of cases where you plan to plug in
77 /// live sources with a non-zero latency, you should set it to a non-zero value.
78 ///
79 /// Readable | Writeable | Construct Only
80 ///
81 ///
82 /// #### `ignore-inactive-pads`
83 /// Don't wait for inactive pads when live. An inactive pad
84 /// is a pad that hasn't yet received a buffer, but that has
85 /// been waited on at least once.
86 ///
87 /// The purpose of this property is to avoid aggregating on
88 /// timeout when new pads are requested in advance of receiving
89 /// data flow, for example the user may decide to connect it later,
90 /// but wants to configure it already.
91 ///
92 /// Readable | Writeable
93 ///
94 ///
95 /// #### `output-buffer-duration`
96 /// Readable | Writeable
97 ///
98 ///
99 /// #### `output-buffer-duration-fraction`
100 /// Output block size in nanoseconds, expressed as a fraction.
101 ///
102 /// Readable | Writeable
103 /// <details><summary><h4>Aggregator</h4></summary>
104 ///
105 ///
106 /// #### `emit-signals`
107 /// Enables the emission of signals such as [`samples-selected`][struct@crate::gst_base::Aggregator#samples-selected]
108 ///
109 /// Readable | Writeable
110 ///
111 ///
112 /// #### `latency`
113 /// Readable | Writeable
114 ///
115 ///
116 /// #### `min-upstream-latency`
117 /// Force minimum upstream latency (in nanoseconds). When sources with a
118 /// higher latency are expected to be plugged in dynamically after the
119 /// aggregator has started playing, this allows overriding the minimum
120 /// latency reported by the initial source(s). This is only taken into
121 /// account when larger than the actually reported minimum latency.
122 ///
123 /// Readable | Writeable
124 ///
125 ///
126 /// #### `start-time`
127 /// Readable | Writeable
128 ///
129 ///
130 /// #### `start-time-selection`
131 /// Readable | Writeable
132 /// </details>
133 /// <details><summary><h4>Object</h4></summary>
134 ///
135 ///
136 /// #### `name`
137 /// Readable | Writeable | Construct
138 ///
139 ///
140 /// #### `parent`
141 /// The parent of the object. Please note, that when changing the 'parent'
142 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
143 /// signals due to locking issues. In some cases one can use
144 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
145 /// achieve a similar effect.
146 ///
147 /// Readable | Writeable
148 /// </details>
149 ///
150 /// # Implements
151 ///
152 /// [`AudioAggregatorExt`][trait@crate::prelude::AudioAggregatorExt], [`trait@gst_base::prelude::AggregatorExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`]
153 #[doc(alias = "GstAudioAggregator")]
154 pub struct AudioAggregator(Object<ffi::GstAudioAggregator, ffi::GstAudioAggregatorClass>) @extends gst_base::Aggregator, gst::Element, gst::Object;
155
156 match fn {
157 type_ => || ffi::gst_audio_aggregator_get_type(),
158 }
159}
160
161impl AudioAggregator {
162 pub const NONE: Option<&'static AudioAggregator> = None;
163}
164
165unsafe impl Send for AudioAggregator {}
166unsafe impl Sync for AudioAggregator {}
167
168mod sealed {
169 pub trait Sealed {}
170 impl<T: super::IsA<super::AudioAggregator>> Sealed for T {}
171}
172
173/// Trait containing all [`struct@AudioAggregator`] methods.
174///
175/// # Implementors
176///
177/// [`AudioAggregator`][struct@crate::AudioAggregator]
178pub trait AudioAggregatorExt: IsA<AudioAggregator> + sealed::Sealed + 'static {
179 #[doc(alias = "alignment-threshold")]
180 fn alignment_threshold(&self) -> u64 {
181 ObjectExt::property(self.as_ref(), "alignment-threshold")
182 }
183
184 #[doc(alias = "alignment-threshold")]
185 fn set_alignment_threshold(&self, alignment_threshold: u64) {
186 ObjectExt::set_property(self.as_ref(), "alignment-threshold", alignment_threshold)
187 }
188
189 #[doc(alias = "discont-wait")]
190 fn discont_wait(&self) -> u64 {
191 ObjectExt::property(self.as_ref(), "discont-wait")
192 }
193
194 #[doc(alias = "discont-wait")]
195 fn set_discont_wait(&self, discont_wait: u64) {
196 ObjectExt::set_property(self.as_ref(), "discont-wait", discont_wait)
197 }
198
199 #[doc(alias = "output-buffer-duration")]
200 fn output_buffer_duration(&self) -> u64 {
201 ObjectExt::property(self.as_ref(), "output-buffer-duration")
202 }
203
204 #[doc(alias = "output-buffer-duration")]
205 fn set_output_buffer_duration(&self, output_buffer_duration: u64) {
206 ObjectExt::set_property(
207 self.as_ref(),
208 "output-buffer-duration",
209 output_buffer_duration,
210 )
211 }
212
213 #[doc(alias = "alignment-threshold")]
214 fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
215 &self,
216 f: F,
217 ) -> SignalHandlerId {
218 unsafe extern "C" fn notify_alignment_threshold_trampoline<
219 P: IsA<AudioAggregator>,
220 F: Fn(&P) + Send + Sync + 'static,
221 >(
222 this: *mut ffi::GstAudioAggregator,
223 _param_spec: glib::ffi::gpointer,
224 f: glib::ffi::gpointer,
225 ) {
226 let f: &F = &*(f as *const F);
227 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
228 }
229 unsafe {
230 let f: Box_<F> = Box_::new(f);
231 connect_raw(
232 self.as_ptr() as *mut _,
233 b"notify::alignment-threshold\0".as_ptr() as *const _,
234 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
235 notify_alignment_threshold_trampoline::<Self, F> as *const (),
236 )),
237 Box_::into_raw(f),
238 )
239 }
240 }
241
242 #[doc(alias = "discont-wait")]
243 fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
244 &self,
245 f: F,
246 ) -> SignalHandlerId {
247 unsafe extern "C" fn notify_discont_wait_trampoline<
248 P: IsA<AudioAggregator>,
249 F: Fn(&P) + Send + Sync + 'static,
250 >(
251 this: *mut ffi::GstAudioAggregator,
252 _param_spec: glib::ffi::gpointer,
253 f: glib::ffi::gpointer,
254 ) {
255 let f: &F = &*(f as *const F);
256 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
257 }
258 unsafe {
259 let f: Box_<F> = Box_::new(f);
260 connect_raw(
261 self.as_ptr() as *mut _,
262 b"notify::discont-wait\0".as_ptr() as *const _,
263 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
264 notify_discont_wait_trampoline::<Self, F> as *const (),
265 )),
266 Box_::into_raw(f),
267 )
268 }
269 }
270
271 #[doc(alias = "output-buffer-duration")]
272 fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
273 &self,
274 f: F,
275 ) -> SignalHandlerId {
276 unsafe extern "C" fn notify_output_buffer_duration_trampoline<
277 P: IsA<AudioAggregator>,
278 F: Fn(&P) + Send + Sync + 'static,
279 >(
280 this: *mut ffi::GstAudioAggregator,
281 _param_spec: glib::ffi::gpointer,
282 f: glib::ffi::gpointer,
283 ) {
284 let f: &F = &*(f as *const F);
285 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
286 }
287 unsafe {
288 let f: Box_<F> = Box_::new(f);
289 connect_raw(
290 self.as_ptr() as *mut _,
291 b"notify::output-buffer-duration\0".as_ptr() as *const _,
292 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
293 notify_output_buffer_duration_trampoline::<Self, F> as *const (),
294 )),
295 Box_::into_raw(f),
296 )
297 }
298 }
299}
300
301impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {}