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
168/// Trait containing all [`struct@AudioAggregator`] methods.
169///
170/// # Implementors
171///
172/// [`AudioAggregator`][struct@crate::AudioAggregator]
173pub trait AudioAggregatorExt: IsA<AudioAggregator> + 'static {
174    #[doc(alias = "alignment-threshold")]
175    fn alignment_threshold(&self) -> u64 {
176        ObjectExt::property(self.as_ref(), "alignment-threshold")
177    }
178
179    #[doc(alias = "alignment-threshold")]
180    fn set_alignment_threshold(&self, alignment_threshold: u64) {
181        ObjectExt::set_property(self.as_ref(), "alignment-threshold", alignment_threshold)
182    }
183
184    #[doc(alias = "discont-wait")]
185    fn discont_wait(&self) -> u64 {
186        ObjectExt::property(self.as_ref(), "discont-wait")
187    }
188
189    #[doc(alias = "discont-wait")]
190    fn set_discont_wait(&self, discont_wait: u64) {
191        ObjectExt::set_property(self.as_ref(), "discont-wait", discont_wait)
192    }
193
194    #[doc(alias = "output-buffer-duration")]
195    fn output_buffer_duration(&self) -> u64 {
196        ObjectExt::property(self.as_ref(), "output-buffer-duration")
197    }
198
199    #[doc(alias = "output-buffer-duration")]
200    fn set_output_buffer_duration(&self, output_buffer_duration: u64) {
201        ObjectExt::set_property(
202            self.as_ref(),
203            "output-buffer-duration",
204            output_buffer_duration,
205        )
206    }
207
208    #[doc(alias = "alignment-threshold")]
209    fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
210        &self,
211        f: F,
212    ) -> SignalHandlerId {
213        unsafe extern "C" fn notify_alignment_threshold_trampoline<
214            P: IsA<AudioAggregator>,
215            F: Fn(&P) + Send + Sync + 'static,
216        >(
217            this: *mut ffi::GstAudioAggregator,
218            _param_spec: glib::ffi::gpointer,
219            f: glib::ffi::gpointer,
220        ) {
221            let f: &F = &*(f as *const F);
222            f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
223        }
224        unsafe {
225            let f: Box_<F> = Box_::new(f);
226            connect_raw(
227                self.as_ptr() as *mut _,
228                c"notify::alignment-threshold".as_ptr() as *const _,
229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
230                    notify_alignment_threshold_trampoline::<Self, F> as *const (),
231                )),
232                Box_::into_raw(f),
233            )
234        }
235    }
236
237    #[doc(alias = "discont-wait")]
238    fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
239        &self,
240        f: F,
241    ) -> SignalHandlerId {
242        unsafe extern "C" fn notify_discont_wait_trampoline<
243            P: IsA<AudioAggregator>,
244            F: Fn(&P) + Send + Sync + 'static,
245        >(
246            this: *mut ffi::GstAudioAggregator,
247            _param_spec: glib::ffi::gpointer,
248            f: glib::ffi::gpointer,
249        ) {
250            let f: &F = &*(f as *const F);
251            f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
252        }
253        unsafe {
254            let f: Box_<F> = Box_::new(f);
255            connect_raw(
256                self.as_ptr() as *mut _,
257                c"notify::discont-wait".as_ptr() as *const _,
258                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
259                    notify_discont_wait_trampoline::<Self, F> as *const (),
260                )),
261                Box_::into_raw(f),
262            )
263        }
264    }
265
266    #[doc(alias = "output-buffer-duration")]
267    fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
268        &self,
269        f: F,
270    ) -> SignalHandlerId {
271        unsafe extern "C" fn notify_output_buffer_duration_trampoline<
272            P: IsA<AudioAggregator>,
273            F: Fn(&P) + Send + Sync + 'static,
274        >(
275            this: *mut ffi::GstAudioAggregator,
276            _param_spec: glib::ffi::gpointer,
277            f: glib::ffi::gpointer,
278        ) {
279            let f: &F = &*(f as *const F);
280            f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
281        }
282        unsafe {
283            let f: Box_<F> = Box_::new(f);
284            connect_raw(
285                self.as_ptr() as *mut _,
286                c"notify::output-buffer-duration".as_ptr() as *const _,
287                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
288                    notify_output_buffer_duration_trampoline::<Self, F> as *const (),
289                )),
290                Box_::into_raw(f),
291            )
292        }
293    }
294}
295
296impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {}