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::{SignalHandlerId, connect_raw},
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 | Writable
67 ///
68 ///
69 /// #### `discont-wait`
70 /// Readable | Writable
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 | Writable | 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 | Writable
93 ///
94 ///
95 /// #### `output-buffer-duration`
96 /// Readable | Writable
97 ///
98 ///
99 /// #### `output-buffer-duration-fraction`
100 /// Output block size in nanoseconds, expressed as a fraction.
101 ///
102 /// Readable | Writable
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 | Writable
110 ///
111 ///
112 /// #### `latency`
113 /// Readable | Writable
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 | Writable
124 ///
125 ///
126 /// #### `start-time`
127 /// Readable | Writable
128 ///
129 ///
130 /// #### `start-time-selection`
131 /// Readable | Writable
132 /// </details>
133 /// <details><summary><h4>Object</h4></summary>
134 ///
135 ///
136 /// #### `name`
137 /// Readable | Writable | 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 | Writable
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`], [`AudioAggregatorExtManual`][trait@crate::prelude::AudioAggregatorExtManual]
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
168/// Trait containing all [`struct@AudioAggregator`] methods.
169///
170/// # Implementors
171///
172/// [`AudioAggregator`][struct@crate::AudioAggregator]
173pub trait AudioAggregatorExt: IsA<AudioAggregator> + 'static {
174 /// This can be used by subclasses to delay renegotiation until the current
175 /// output buffer is finished to avoid dropping/converting it.
176 ///
177 /// # Returns
178 ///
179 /// [`true`] if there's currently a pending output buffer.
180 #[cfg(feature = "v1_30")]
181 #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
182 #[doc(alias = "gst_audio_aggregator_has_current_output_buffer")]
183 fn has_current_output_buffer(&self) -> bool {
184 unsafe {
185 from_glib(ffi::gst_audio_aggregator_has_current_output_buffer(
186 self.as_ref().to_glib_none().0,
187 ))
188 }
189 }
190
191 #[doc(alias = "alignment-threshold")]
192 fn alignment_threshold(&self) -> u64 {
193 ObjectExt::property(self.as_ref(), "alignment-threshold")
194 }
195
196 #[doc(alias = "alignment-threshold")]
197 fn set_alignment_threshold(&self, alignment_threshold: u64) {
198 ObjectExt::set_property(self.as_ref(), "alignment-threshold", alignment_threshold)
199 }
200
201 #[doc(alias = "discont-wait")]
202 fn discont_wait(&self) -> u64 {
203 ObjectExt::property(self.as_ref(), "discont-wait")
204 }
205
206 #[doc(alias = "discont-wait")]
207 fn set_discont_wait(&self, discont_wait: u64) {
208 ObjectExt::set_property(self.as_ref(), "discont-wait", discont_wait)
209 }
210
211 #[doc(alias = "output-buffer-duration")]
212 fn output_buffer_duration(&self) -> u64 {
213 ObjectExt::property(self.as_ref(), "output-buffer-duration")
214 }
215
216 #[doc(alias = "output-buffer-duration")]
217 fn set_output_buffer_duration(&self, output_buffer_duration: u64) {
218 ObjectExt::set_property(
219 self.as_ref(),
220 "output-buffer-duration",
221 output_buffer_duration,
222 )
223 }
224
225 #[doc(alias = "alignment-threshold")]
226 fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
227 &self,
228 f: F,
229 ) -> SignalHandlerId {
230 unsafe extern "C" fn notify_alignment_threshold_trampoline<
231 P: IsA<AudioAggregator>,
232 F: Fn(&P) + Send + Sync + 'static,
233 >(
234 this: *mut ffi::GstAudioAggregator,
235 _param_spec: glib::ffi::gpointer,
236 f: glib::ffi::gpointer,
237 ) {
238 unsafe {
239 let f: &F = &*(f as *const F);
240 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
241 }
242 }
243 unsafe {
244 let f: Box_<F> = Box_::new(f);
245 connect_raw(
246 self.as_ptr() as *mut _,
247 c"notify::alignment-threshold".as_ptr(),
248 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
249 notify_alignment_threshold_trampoline::<Self, F> as *const (),
250 )),
251 Box_::into_raw(f),
252 )
253 }
254 }
255
256 #[doc(alias = "discont-wait")]
257 fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
258 &self,
259 f: F,
260 ) -> SignalHandlerId {
261 unsafe extern "C" fn notify_discont_wait_trampoline<
262 P: IsA<AudioAggregator>,
263 F: Fn(&P) + Send + Sync + 'static,
264 >(
265 this: *mut ffi::GstAudioAggregator,
266 _param_spec: glib::ffi::gpointer,
267 f: glib::ffi::gpointer,
268 ) {
269 unsafe {
270 let f: &F = &*(f as *const F);
271 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
272 }
273 }
274 unsafe {
275 let f: Box_<F> = Box_::new(f);
276 connect_raw(
277 self.as_ptr() as *mut _,
278 c"notify::discont-wait".as_ptr(),
279 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
280 notify_discont_wait_trampoline::<Self, F> as *const (),
281 )),
282 Box_::into_raw(f),
283 )
284 }
285 }
286
287 #[doc(alias = "output-buffer-duration")]
288 fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
289 &self,
290 f: F,
291 ) -> SignalHandlerId {
292 unsafe extern "C" fn notify_output_buffer_duration_trampoline<
293 P: IsA<AudioAggregator>,
294 F: Fn(&P) + Send + Sync + 'static,
295 >(
296 this: *mut ffi::GstAudioAggregator,
297 _param_spec: glib::ffi::gpointer,
298 f: glib::ffi::gpointer,
299 ) {
300 unsafe {
301 let f: &F = &*(f as *const F);
302 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
303 }
304 }
305 unsafe {
306 let f: Box_<F> = Box_::new(f);
307 connect_raw(
308 self.as_ptr() as *mut _,
309 c"notify::output-buffer-duration".as_ptr(),
310 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
311 notify_output_buffer_duration_trampoline::<Self, F> as *const (),
312 )),
313 Box_::into_raw(f),
314 )
315 }
316 }
317}
318
319impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {}