gstreamer_audio/auto/
audio_decoder.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, AudioInfo};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// This base class is for audio decoders turning encoded data into
16    /// raw audio samples.
17    ///
18    /// GstAudioDecoder and subclass should cooperate as follows.
19    ///
20    /// ## Configuration
21    ///
22    ///  * Initially, GstAudioDecoder calls `start` when the decoder element
23    ///  is activated, which allows subclass to perform any global setup.
24    ///  Base class (context) parameters can already be set according to subclass
25    ///  capabilities (or possibly upon receive more information in subsequent
26    ///  `set_format`).
27    ///  * GstAudioDecoder calls `set_format` to inform subclass of the format
28    ///  of input audio data that it is about to receive.
29    ///  While unlikely, it might be called more than once, if changing input
30    ///  parameters require reconfiguration.
31    ///  * GstAudioDecoder calls `stop` at end of all processing.
32    ///
33    /// As of configuration stage, and throughout processing, GstAudioDecoder
34    /// provides various (context) parameters, e.g. describing the format of
35    /// output audio data (valid when output caps have been set) or current parsing state.
36    /// Conversely, subclass can and should configure context to inform
37    /// base class of its expectation w.r.t. buffer handling.
38    ///
39    /// ## Data processing
40    ///  * Base class gathers input data, and optionally allows subclass
41    ///  to parse this into subsequently manageable (as defined by subclass)
42    ///  chunks. Such chunks are subsequently referred to as 'frames',
43    ///  though they may or may not correspond to 1 (or more) audio format frame.
44    ///  * Input frame is provided to subclass' `handle_frame`.
45    ///  * If codec processing results in decoded data, subclass should call
46    ///  [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::finish_frame()] to have decoded data pushed
47    ///  downstream.
48    ///  * Just prior to actually pushing a buffer downstream,
49    ///  it is passed to `pre_push`. Subclass should either use this callback
50    ///  to arrange for additional downstream pushing or otherwise ensure such
51    ///  custom pushing occurs after at least a method call has finished since
52    ///  setting src pad caps.
53    ///  * During the parsing process GstAudioDecoderClass will handle both
54    ///  srcpad and sinkpad events. Sink events will be passed to subclass
55    ///  if `event` callback has been provided.
56    ///
57    /// ## Shutdown phase
58    ///
59    ///  * GstAudioDecoder class calls `stop` to inform the subclass that data
60    ///  parsing will be stopped.
61    ///
62    /// Subclass is responsible for providing pad template caps for
63    /// source and sink pads. The pads need to be named "sink" and "src". It also
64    /// needs to set the fixed caps on srcpad, when the format is ensured. This
65    /// is typically when base class calls subclass' `set_format` function, though
66    /// it might be delayed until calling [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::finish_frame()].
67    ///
68    /// In summary, above process should have subclass concentrating on
69    /// codec data processing while leaving other matters to base class,
70    /// such as most notably timestamp handling. While it may exert more control
71    /// in this area (see e.g. `pre_push`), it is very much not recommended.
72    ///
73    /// In particular, base class will try to arrange for perfect output timestamps
74    /// as much as possible while tracking upstream timestamps.
75    /// To this end, if deviation between the next ideal expected perfect timestamp
76    /// and upstream exceeds [`tolerance`][struct@crate::AudioDecoder#tolerance], then resync to upstream
77    /// occurs (which would happen always if the tolerance mechanism is disabled).
78    ///
79    /// In non-live pipelines, baseclass can also (configurably) arrange for
80    /// output buffer aggregation which may help to redue large(r) numbers of
81    /// small(er) buffers being pushed and processed downstream. Note that this
82    /// feature is only available if the buffer layout is interleaved. For planar
83    /// buffers, the decoder implementation is fully responsible for the output
84    /// buffer size.
85    ///
86    /// On the other hand, it should be noted that baseclass only provides limited
87    /// seeking support (upon explicit subclass request), as full-fledged support
88    /// should rather be left to upstream demuxer, parser or alike. This simple
89    /// approach caters for seeking and duration reporting using estimated input
90    /// bitrates.
91    ///
92    /// Things that subclass need to take care of:
93    ///
94    ///  * Provide pad templates
95    ///  * Set source pad caps when appropriate
96    ///  * Set user-configurable properties to sane defaults for format and
97    ///  implementing codec at hand, and convey some subclass capabilities and
98    ///  expectations in context.
99    ///
100    ///  * Accept data in `handle_frame` and provide encoded results to
101    ///  [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::finish_frame()]. If it is prepared to perform
102    ///  PLC, it should also accept NULL data in `handle_frame` and provide for
103    ///  data for indicated duration.
104    ///
105    /// This is an Abstract Base Class, you cannot instantiate it.
106    ///
107    /// ## Properties
108    ///
109    ///
110    /// #### `max-errors`
111    ///  Maximum number of tolerated consecutive decode errors. See
112    /// [`AudioDecoderExt::set_max_errors()`][crate::prelude::AudioDecoderExt::set_max_errors()] for more details.
113    ///
114    /// Readable | Writeable
115    ///
116    ///
117    /// #### `min-latency`
118    ///  Readable | Writeable
119    ///
120    ///
121    /// #### `plc`
122    ///  Readable | Writeable
123    ///
124    ///
125    /// #### `tolerance`
126    ///  Readable | Writeable
127    /// <details><summary><h4>Object</h4></summary>
128    ///
129    ///
130    /// #### `name`
131    ///  Readable | Writeable | Construct
132    ///
133    ///
134    /// #### `parent`
135    ///  The parent of the object. Please note, that when changing the 'parent'
136    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
137    /// signals due to locking issues. In some cases one can use
138    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
139    /// achieve a similar effect.
140    ///
141    /// Readable | Writeable
142    /// </details>
143    ///
144    /// # Implements
145    ///
146    /// [`AudioDecoderExt`][trait@crate::prelude::AudioDecoderExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`], [`AudioDecoderExtManual`][trait@crate::prelude::AudioDecoderExtManual]
147    #[doc(alias = "GstAudioDecoder")]
148    pub struct AudioDecoder(Object<ffi::GstAudioDecoder, ffi::GstAudioDecoderClass>) @extends gst::Element, gst::Object;
149
150    match fn {
151        type_ => || ffi::gst_audio_decoder_get_type(),
152    }
153}
154
155impl AudioDecoder {
156    pub const NONE: Option<&'static AudioDecoder> = None;
157}
158
159unsafe impl Send for AudioDecoder {}
160unsafe impl Sync for AudioDecoder {}
161
162/// Trait containing all [`struct@AudioDecoder`] methods.
163///
164/// # Implementors
165///
166/// [`AudioDecoder`][struct@crate::AudioDecoder]
167pub trait AudioDecoderExt: IsA<AudioDecoder> + 'static {
168    /// Helper function that allocates a buffer to hold an audio frame
169    /// for `self`'s current output format.
170    /// ## `size`
171    /// size of the buffer
172    ///
173    /// # Returns
174    ///
175    /// allocated buffer
176    #[doc(alias = "gst_audio_decoder_allocate_output_buffer")]
177    fn allocate_output_buffer(&self, size: usize) -> gst::Buffer {
178        unsafe {
179            from_glib_full(ffi::gst_audio_decoder_allocate_output_buffer(
180                self.as_ref().to_glib_none().0,
181                size,
182            ))
183        }
184    }
185
186    /// Collects decoded data and pushes it downstream.
187    ///
188    /// `buf` may be NULL in which case the indicated number of frames
189    /// are discarded and considered to have produced no output
190    /// (e.g. lead-in or setup frames).
191    /// Otherwise, source pad caps must be set when it is called with valid
192    /// data in `buf`.
193    ///
194    /// Note that a frame received in `GstAudioDecoderClass.handle_frame()` may be
195    /// invalidated by a call to this function.
196    /// ## `buf`
197    /// decoded data
198    /// ## `frames`
199    /// number of decoded frames represented by decoded data
200    ///
201    /// # Returns
202    ///
203    /// a [`gst::FlowReturn`][crate::gst::FlowReturn] that should be escalated to caller (of caller)
204    #[doc(alias = "gst_audio_decoder_finish_frame")]
205    fn finish_frame(
206        &self,
207        buf: Option<gst::Buffer>,
208        frames: i32,
209    ) -> Result<gst::FlowSuccess, gst::FlowError> {
210        unsafe {
211            try_from_glib(ffi::gst_audio_decoder_finish_frame(
212                self.as_ref().to_glib_none().0,
213                buf.into_glib_ptr(),
214                frames,
215            ))
216        }
217    }
218
219    /// Collects decoded data and pushes it downstream. This function may be called
220    /// multiple times for a given input frame.
221    ///
222    /// `buf` may be NULL in which case it is assumed that the current input frame is
223    /// finished. This is equivalent to calling [`finish_subframe()`][Self::finish_subframe()]
224    /// with a NULL buffer and frames=1 after having pushed out all decoded audio
225    /// subframes using this function.
226    ///
227    /// When called with valid data in `buf` the source pad caps must have been set
228    /// already.
229    ///
230    /// Note that a frame received in `GstAudioDecoderClass.handle_frame()` may be
231    /// invalidated by a call to this function.
232    /// ## `buf`
233    /// decoded data
234    ///
235    /// # Returns
236    ///
237    /// a [`gst::FlowReturn`][crate::gst::FlowReturn] that should be escalated to caller (of caller)
238    #[cfg(feature = "v1_16")]
239    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
240    #[doc(alias = "gst_audio_decoder_finish_subframe")]
241    fn finish_subframe(
242        &self,
243        buf: Option<gst::Buffer>,
244    ) -> Result<gst::FlowSuccess, gst::FlowError> {
245        unsafe {
246            try_from_glib(ffi::gst_audio_decoder_finish_subframe(
247                self.as_ref().to_glib_none().0,
248                buf.into_glib_ptr(),
249            ))
250        }
251    }
252
253    ///
254    /// # Returns
255    ///
256    /// a [`AudioInfo`][crate::AudioInfo] describing the input audio format
257    #[doc(alias = "gst_audio_decoder_get_audio_info")]
258    #[doc(alias = "get_audio_info")]
259    fn audio_info(&self) -> AudioInfo {
260        unsafe {
261            from_glib_none(ffi::gst_audio_decoder_get_audio_info(
262                self.as_ref().to_glib_none().0,
263            ))
264        }
265    }
266
267    ///
268    /// # Returns
269    ///
270    /// currently configured decoder delay
271    #[doc(alias = "gst_audio_decoder_get_delay")]
272    #[doc(alias = "get_delay")]
273    fn delay(&self) -> i32 {
274        unsafe { ffi::gst_audio_decoder_get_delay(self.as_ref().to_glib_none().0) }
275    }
276
277    /// Queries decoder drain handling.
278    ///
279    /// # Returns
280    ///
281    /// TRUE if drainable handling is enabled.
282    ///
283    /// MT safe.
284    #[doc(alias = "gst_audio_decoder_get_drainable")]
285    #[doc(alias = "get_drainable")]
286    fn is_drainable(&self) -> bool {
287        unsafe {
288            from_glib(ffi::gst_audio_decoder_get_drainable(
289                self.as_ref().to_glib_none().0,
290            ))
291        }
292    }
293
294    ///
295    /// # Returns
296    ///
297    /// currently configured byte to time conversion setting
298    #[doc(alias = "gst_audio_decoder_get_estimate_rate")]
299    #[doc(alias = "get_estimate_rate")]
300    fn estimate_rate(&self) -> i32 {
301        unsafe { ffi::gst_audio_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) }
302    }
303
304    /// Sets the variables pointed to by `min` and `max` to the currently configured
305    /// latency.
306    ///
307    /// # Returns
308    ///
309    ///
310    /// ## `min`
311    /// a pointer to storage to hold minimum latency
312    ///
313    /// ## `max`
314    /// a pointer to storage to hold maximum latency
315    #[doc(alias = "gst_audio_decoder_get_latency")]
316    #[doc(alias = "get_latency")]
317    fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
318        unsafe {
319            let mut min = std::mem::MaybeUninit::uninit();
320            let mut max = std::mem::MaybeUninit::uninit();
321            ffi::gst_audio_decoder_get_latency(
322                self.as_ref().to_glib_none().0,
323                min.as_mut_ptr(),
324                max.as_mut_ptr(),
325            );
326            (
327                try_from_glib(min.assume_init()).expect("mandatory glib value is None"),
328                from_glib(max.assume_init()),
329            )
330        }
331    }
332
333    ///
334    /// # Returns
335    ///
336    /// currently configured decoder tolerated error count.
337    #[doc(alias = "gst_audio_decoder_get_max_errors")]
338    #[doc(alias = "get_max_errors")]
339    #[doc(alias = "max-errors")]
340    fn max_errors(&self) -> i32 {
341        unsafe { ffi::gst_audio_decoder_get_max_errors(self.as_ref().to_glib_none().0) }
342    }
343
344    /// Queries decoder's latency aggregation.
345    ///
346    /// # Returns
347    ///
348    /// aggregation latency.
349    ///
350    /// MT safe.
351    #[doc(alias = "gst_audio_decoder_get_min_latency")]
352    #[doc(alias = "get_min_latency")]
353    #[doc(alias = "min-latency")]
354    fn min_latency(&self) -> gst::ClockTime {
355        unsafe {
356            try_from_glib(ffi::gst_audio_decoder_get_min_latency(
357                self.as_ref().to_glib_none().0,
358            ))
359            .expect("mandatory glib value is None")
360        }
361    }
362
363    /// Queries decoder required format handling.
364    ///
365    /// # Returns
366    ///
367    /// TRUE if required format handling is enabled.
368    ///
369    /// MT safe.
370    #[doc(alias = "gst_audio_decoder_get_needs_format")]
371    #[doc(alias = "get_needs_format")]
372    fn needs_format(&self) -> bool {
373        unsafe {
374            from_glib(ffi::gst_audio_decoder_get_needs_format(
375                self.as_ref().to_glib_none().0,
376            ))
377        }
378    }
379
380    /// Return current parsing (sync and eos) state.
381    ///
382    /// # Returns
383    ///
384    ///
385    /// ## `sync`
386    /// a pointer to a variable to hold the current sync state
387    ///
388    /// ## `eos`
389    /// a pointer to a variable to hold the current eos state
390    #[doc(alias = "gst_audio_decoder_get_parse_state")]
391    #[doc(alias = "get_parse_state")]
392    fn parse_state(&self) -> (bool, bool) {
393        unsafe {
394            let mut sync = std::mem::MaybeUninit::uninit();
395            let mut eos = std::mem::MaybeUninit::uninit();
396            ffi::gst_audio_decoder_get_parse_state(
397                self.as_ref().to_glib_none().0,
398                sync.as_mut_ptr(),
399                eos.as_mut_ptr(),
400            );
401            (from_glib(sync.assume_init()), from_glib(eos.assume_init()))
402        }
403    }
404
405    /// Queries decoder packet loss concealment handling.
406    ///
407    /// # Returns
408    ///
409    /// TRUE if packet loss concealment is enabled.
410    ///
411    /// MT safe.
412    #[doc(alias = "gst_audio_decoder_get_plc")]
413    #[doc(alias = "get_plc")]
414    #[doc(alias = "plc")]
415    fn is_plc(&self) -> bool {
416        unsafe {
417            from_glib(ffi::gst_audio_decoder_get_plc(
418                self.as_ref().to_glib_none().0,
419            ))
420        }
421    }
422
423    ///
424    /// # Returns
425    ///
426    /// currently configured plc handling
427    #[doc(alias = "gst_audio_decoder_get_plc_aware")]
428    #[doc(alias = "get_plc_aware")]
429    fn plc_aware(&self) -> i32 {
430        unsafe { ffi::gst_audio_decoder_get_plc_aware(self.as_ref().to_glib_none().0) }
431    }
432
433    /// Queries current audio jitter tolerance threshold.
434    ///
435    /// # Returns
436    ///
437    /// decoder audio jitter tolerance threshold.
438    ///
439    /// MT safe.
440    #[doc(alias = "gst_audio_decoder_get_tolerance")]
441    #[doc(alias = "get_tolerance")]
442    fn tolerance(&self) -> gst::ClockTime {
443        unsafe {
444            try_from_glib(ffi::gst_audio_decoder_get_tolerance(
445                self.as_ref().to_glib_none().0,
446            ))
447            .expect("mandatory glib value is None")
448        }
449    }
450
451    /// Sets the audio decoder tags and how they should be merged with any
452    /// upstream stream tags. This will override any tags previously-set
453    /// with [`merge_tags()`][Self::merge_tags()].
454    ///
455    /// Note that this is provided for convenience, and the subclass is
456    /// not required to use this and can still do tag handling on its own.
457    /// ## `tags`
458    /// a [`gst::TagList`][crate::gst::TagList] to merge, or NULL
459    /// ## `mode`
460    /// the [`gst::TagMergeMode`][crate::gst::TagMergeMode] to use, usually [`gst::TagMergeMode::Replace`][crate::gst::TagMergeMode::Replace]
461    #[doc(alias = "gst_audio_decoder_merge_tags")]
462    fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
463        unsafe {
464            ffi::gst_audio_decoder_merge_tags(
465                self.as_ref().to_glib_none().0,
466                tags.to_glib_none().0,
467                mode.into_glib(),
468            );
469        }
470    }
471
472    /// Returns caps that express `caps` (or sink template caps if `caps` == NULL)
473    /// restricted to rate/channels/... combinations supported by downstream
474    /// elements.
475    /// ## `caps`
476    /// initial caps
477    /// ## `filter`
478    /// filter caps
479    ///
480    /// # Returns
481    ///
482    /// a [`gst::Caps`][crate::gst::Caps] owned by caller
483    #[doc(alias = "gst_audio_decoder_proxy_getcaps")]
484    fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps {
485        unsafe {
486            from_glib_full(ffi::gst_audio_decoder_proxy_getcaps(
487                self.as_ref().to_glib_none().0,
488                caps.to_glib_none().0,
489                filter.to_glib_none().0,
490            ))
491        }
492    }
493
494    /// Sets a caps in allocation query which are different from the set
495    /// pad's caps. Use this function before calling
496    /// [`AudioDecoderExtManual::negotiate()`][crate::prelude::AudioDecoderExtManual::negotiate()]. Setting to [`None`] the allocation
497    /// query will use the caps from the pad.
498    /// ## `allocation_caps`
499    /// a [`gst::Caps`][crate::gst::Caps] or [`None`]
500    #[doc(alias = "gst_audio_decoder_set_allocation_caps")]
501    fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>) {
502        unsafe {
503            ffi::gst_audio_decoder_set_allocation_caps(
504                self.as_ref().to_glib_none().0,
505                allocation_caps.to_glib_none().0,
506            );
507        }
508    }
509
510    /// Configures decoder drain handling. If drainable, subclass might
511    /// be handed a NULL buffer to have it return any leftover decoded data.
512    /// Otherwise, it is not considered so capable and will only ever be passed
513    /// real data.
514    ///
515    /// MT safe.
516    /// ## `enabled`
517    /// new state
518    #[doc(alias = "gst_audio_decoder_set_drainable")]
519    fn set_drainable(&self, enabled: bool) {
520        unsafe {
521            ffi::gst_audio_decoder_set_drainable(
522                self.as_ref().to_glib_none().0,
523                enabled.into_glib(),
524            );
525        }
526    }
527
528    /// Allows baseclass to perform byte to time estimated conversion.
529    /// ## `enabled`
530    /// whether to enable byte to time conversion
531    #[doc(alias = "gst_audio_decoder_set_estimate_rate")]
532    fn set_estimate_rate(&self, enabled: bool) {
533        unsafe {
534            ffi::gst_audio_decoder_set_estimate_rate(
535                self.as_ref().to_glib_none().0,
536                enabled.into_glib(),
537            );
538        }
539    }
540
541    /// Sets decoder latency. If the provided values changed from
542    /// previously provided ones, this will also post a LATENCY message on the bus
543    /// so the pipeline can reconfigure its global latency.
544    /// ## `min`
545    /// minimum latency
546    /// ## `max`
547    /// maximum latency
548    #[doc(alias = "gst_audio_decoder_set_latency")]
549    fn set_latency(&self, min: gst::ClockTime, max: impl Into<Option<gst::ClockTime>>) {
550        unsafe {
551            ffi::gst_audio_decoder_set_latency(
552                self.as_ref().to_glib_none().0,
553                min.into_glib(),
554                max.into().into_glib(),
555            );
556        }
557    }
558
559    /// Sets numbers of tolerated decoder errors, where a tolerated one is then only
560    /// warned about, but more than tolerated will lead to fatal error. You can set
561    /// -1 for never returning fatal errors. Default is set to
562    /// GST_AUDIO_DECODER_MAX_ERRORS.
563    /// ## `num`
564    /// max tolerated errors
565    #[doc(alias = "gst_audio_decoder_set_max_errors")]
566    #[doc(alias = "max-errors")]
567    fn set_max_errors(&self, num: i32) {
568        unsafe {
569            ffi::gst_audio_decoder_set_max_errors(self.as_ref().to_glib_none().0, num);
570        }
571    }
572
573    /// Sets decoder minimum aggregation latency.
574    ///
575    /// MT safe.
576    /// ## `num`
577    /// new minimum latency
578    #[doc(alias = "gst_audio_decoder_set_min_latency")]
579    #[doc(alias = "min-latency")]
580    fn set_min_latency(&self, num: gst::ClockTime) {
581        unsafe {
582            ffi::gst_audio_decoder_set_min_latency(self.as_ref().to_glib_none().0, num.into_glib());
583        }
584    }
585
586    /// Configures decoder format needs. If enabled, subclass needs to be
587    /// negotiated with format caps before it can process any data. It will then
588    /// never be handed any data before it has been configured.
589    /// Otherwise, it might be handed data without having been configured and
590    /// is then expected being able to do so either by default
591    /// or based on the input data.
592    ///
593    /// MT safe.
594    /// ## `enabled`
595    /// new state
596    #[doc(alias = "gst_audio_decoder_set_needs_format")]
597    fn set_needs_format(&self, enabled: bool) {
598        unsafe {
599            ffi::gst_audio_decoder_set_needs_format(
600                self.as_ref().to_glib_none().0,
601                enabled.into_glib(),
602            );
603        }
604    }
605
606    /// Enable or disable decoder packet loss concealment, provided subclass
607    /// and codec are capable and allow handling plc.
608    ///
609    /// MT safe.
610    /// ## `enabled`
611    /// new state
612    #[doc(alias = "gst_audio_decoder_set_plc")]
613    #[doc(alias = "plc")]
614    fn set_plc(&self, enabled: bool) {
615        unsafe {
616            ffi::gst_audio_decoder_set_plc(self.as_ref().to_glib_none().0, enabled.into_glib());
617        }
618    }
619
620    /// Indicates whether or not subclass handles packet loss concealment (plc).
621    /// ## `plc`
622    /// new plc state
623    #[doc(alias = "gst_audio_decoder_set_plc_aware")]
624    fn set_plc_aware(&self, plc: bool) {
625        unsafe {
626            ffi::gst_audio_decoder_set_plc_aware(self.as_ref().to_glib_none().0, plc.into_glib());
627        }
628    }
629
630    /// Configures decoder audio jitter tolerance threshold.
631    ///
632    /// MT safe.
633    /// ## `tolerance`
634    /// new tolerance
635    #[doc(alias = "gst_audio_decoder_set_tolerance")]
636    #[doc(alias = "tolerance")]
637    fn set_tolerance(&self, tolerance: gst::ClockTime) {
638        unsafe {
639            ffi::gst_audio_decoder_set_tolerance(
640                self.as_ref().to_glib_none().0,
641                tolerance.into_glib(),
642            );
643        }
644    }
645
646    /// Lets [`AudioDecoder`][crate::AudioDecoder] sub-classes decide if they want the sink pad
647    /// to use the default pad query handler to reply to accept-caps queries.
648    ///
649    /// By setting this to true it is possible to further customize the default
650    /// handler with `GST_PAD_SET_ACCEPT_INTERSECT` and
651    /// `GST_PAD_SET_ACCEPT_TEMPLATE`
652    /// ## `use_`
653    /// if the default pad accept-caps query handling should be used
654    #[doc(alias = "gst_audio_decoder_set_use_default_pad_acceptcaps")]
655    fn set_use_default_pad_acceptcaps(&self, use_: bool) {
656        unsafe {
657            ffi::gst_audio_decoder_set_use_default_pad_acceptcaps(
658                self.as_ref().to_glib_none().0,
659                use_.into_glib(),
660            );
661        }
662    }
663
664    #[cfg(feature = "v1_18")]
665    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
666    #[doc(alias = "max-errors")]
667    fn connect_max_errors_notify<F: Fn(&Self) + Send + Sync + 'static>(
668        &self,
669        f: F,
670    ) -> SignalHandlerId {
671        unsafe extern "C" fn notify_max_errors_trampoline<
672            P: IsA<AudioDecoder>,
673            F: Fn(&P) + Send + Sync + 'static,
674        >(
675            this: *mut ffi::GstAudioDecoder,
676            _param_spec: glib::ffi::gpointer,
677            f: glib::ffi::gpointer,
678        ) {
679            let f: &F = &*(f as *const F);
680            f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
681        }
682        unsafe {
683            let f: Box_<F> = Box_::new(f);
684            connect_raw(
685                self.as_ptr() as *mut _,
686                c"notify::max-errors".as_ptr() as *const _,
687                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
688                    notify_max_errors_trampoline::<Self, F> as *const (),
689                )),
690                Box_::into_raw(f),
691            )
692        }
693    }
694
695    #[doc(alias = "min-latency")]
696    fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
697        &self,
698        f: F,
699    ) -> SignalHandlerId {
700        unsafe extern "C" fn notify_min_latency_trampoline<
701            P: IsA<AudioDecoder>,
702            F: Fn(&P) + Send + Sync + 'static,
703        >(
704            this: *mut ffi::GstAudioDecoder,
705            _param_spec: glib::ffi::gpointer,
706            f: glib::ffi::gpointer,
707        ) {
708            let f: &F = &*(f as *const F);
709            f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
710        }
711        unsafe {
712            let f: Box_<F> = Box_::new(f);
713            connect_raw(
714                self.as_ptr() as *mut _,
715                c"notify::min-latency".as_ptr() as *const _,
716                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
717                    notify_min_latency_trampoline::<Self, F> as *const (),
718                )),
719                Box_::into_raw(f),
720            )
721        }
722    }
723
724    #[doc(alias = "plc")]
725    fn connect_plc_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
726        unsafe extern "C" fn notify_plc_trampoline<
727            P: IsA<AudioDecoder>,
728            F: Fn(&P) + Send + Sync + 'static,
729        >(
730            this: *mut ffi::GstAudioDecoder,
731            _param_spec: glib::ffi::gpointer,
732            f: glib::ffi::gpointer,
733        ) {
734            let f: &F = &*(f as *const F);
735            f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
736        }
737        unsafe {
738            let f: Box_<F> = Box_::new(f);
739            connect_raw(
740                self.as_ptr() as *mut _,
741                c"notify::plc".as_ptr() as *const _,
742                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
743                    notify_plc_trampoline::<Self, F> as *const (),
744                )),
745                Box_::into_raw(f),
746            )
747        }
748    }
749
750    #[doc(alias = "tolerance")]
751    fn connect_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
752        &self,
753        f: F,
754    ) -> SignalHandlerId {
755        unsafe extern "C" fn notify_tolerance_trampoline<
756            P: IsA<AudioDecoder>,
757            F: Fn(&P) + Send + Sync + 'static,
758        >(
759            this: *mut ffi::GstAudioDecoder,
760            _param_spec: glib::ffi::gpointer,
761            f: glib::ffi::gpointer,
762        ) {
763            let f: &F = &*(f as *const F);
764            f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
765        }
766        unsafe {
767            let f: Box_<F> = Box_::new(f);
768            connect_raw(
769                self.as_ptr() as *mut _,
770                c"notify::tolerance".as_ptr() as *const _,
771                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
772                    notify_tolerance_trampoline::<Self, F> as *const (),
773                )),
774                Box_::into_raw(f),
775            )
776        }
777    }
778}
779
780impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {}