Skip to main content

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 | 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            unsafe {
222                let f: &F = &*(f as *const F);
223                f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
224            }
225        }
226        unsafe {
227            let f: Box_<F> = Box_::new(f);
228            connect_raw(
229                self.as_ptr() as *mut _,
230                c"notify::alignment-threshold".as_ptr(),
231                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
232                    notify_alignment_threshold_trampoline::<Self, F> as *const (),
233                )),
234                Box_::into_raw(f),
235            )
236        }
237    }
238
239    #[doc(alias = "discont-wait")]
240    fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
241        &self,
242        f: F,
243    ) -> SignalHandlerId {
244        unsafe extern "C" fn notify_discont_wait_trampoline<
245            P: IsA<AudioAggregator>,
246            F: Fn(&P) + Send + Sync + 'static,
247        >(
248            this: *mut ffi::GstAudioAggregator,
249            _param_spec: glib::ffi::gpointer,
250            f: glib::ffi::gpointer,
251        ) {
252            unsafe {
253                let f: &F = &*(f as *const F);
254                f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
255            }
256        }
257        unsafe {
258            let f: Box_<F> = Box_::new(f);
259            connect_raw(
260                self.as_ptr() as *mut _,
261                c"notify::discont-wait".as_ptr(),
262                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
263                    notify_discont_wait_trampoline::<Self, F> as *const (),
264                )),
265                Box_::into_raw(f),
266            )
267        }
268    }
269
270    #[doc(alias = "output-buffer-duration")]
271    fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
272        &self,
273        f: F,
274    ) -> SignalHandlerId {
275        unsafe extern "C" fn notify_output_buffer_duration_trampoline<
276            P: IsA<AudioAggregator>,
277            F: Fn(&P) + Send + Sync + 'static,
278        >(
279            this: *mut ffi::GstAudioAggregator,
280            _param_spec: glib::ffi::gpointer,
281            f: glib::ffi::gpointer,
282        ) {
283            unsafe {
284                let f: &F = &*(f as *const F);
285                f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
286            }
287        }
288        unsafe {
289            let f: Box_<F> = Box_::new(f);
290            connect_raw(
291                self.as_ptr() as *mut _,
292                c"notify::output-buffer-duration".as_ptr(),
293                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
294                    notify_output_buffer_duration_trampoline::<Self, F> as *const (),
295                )),
296                Box_::into_raw(f),
297            )
298        }
299    }
300}
301
302impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {}