gstreamer_rtp/auto/
rtp_base_depayload.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;
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::RTPHeaderExtension;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use glib::object::ObjectType as _;
13use glib::{
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21    /// Provides a base class for RTP depayloaders
22    ///
23    /// In order to handle RTP header extensions correctly if the
24    /// depayloader aggregates multiple RTP packet payloads into one output
25    /// buffer this class provides the function
26    /// [`RTPBaseDepayloadExt::set_aggregate_hdrext_enabled()`][crate::prelude::RTPBaseDepayloadExt::set_aggregate_hdrext_enabled()]. If the
27    /// aggregation is enabled the virtual functions
28    /// [`RTPBaseDepayload`][crate::RTPBaseDepayload] or
29    /// [`RTPBaseDepayload`][crate::RTPBaseDepayload] must tell the base class
30    /// what happens to the current RTP packet. By default the base class
31    /// assumes that the packet payload is used with the next output
32    /// buffer.
33    ///
34    /// If the RTP packet will not be used with an output buffer
35    /// [`RTPBaseDepayloadExt::dropped()`][crate::prelude::RTPBaseDepayloadExt::dropped()] must be called. A typical
36    /// situation would be if we are waiting for a keyframe.
37    ///
38    /// If the RTP packet will be used but not with the current output
39    /// buffer but with the next one [`RTPBaseDepayloadExt::delayed()`][crate::prelude::RTPBaseDepayloadExt::delayed()] must
40    /// be called. This may happen if the current RTP packet signals the
41    /// start of a new output buffer and the currently processed output
42    /// buffer will be pushed first. The undelay happens implicitly once
43    /// the current buffer has been pushed or
44    /// [`RTPBaseDepayloadExt::flush()`][crate::prelude::RTPBaseDepayloadExt::flush()] has been called.
45    ///
46    /// If [`RTPBaseDepayloadExt::flush()`][crate::prelude::RTPBaseDepayloadExt::flush()] is called all RTP packets that
47    /// have not been dropped since the last output buffer are dropped,
48    /// e.g. if an output buffer is discarded due to malformed data. This
49    /// may or may not include the current RTP packet depending on the 2nd
50    /// parameter `keep_current`.
51    ///
52    /// Be aware that in case [`RTPBaseDepayloadExt::push_list()`][crate::prelude::RTPBaseDepayloadExt::push_list()] is used
53    /// each buffer will see the same list of RTP header extensions.
54    ///
55    /// This is an Abstract Base Class, you cannot instantiate it.
56    ///
57    /// ## Properties
58    ///
59    ///
60    /// #### `auto-header-extension`
61    ///  If enabled, the depayloader will automatically try to enable all the
62    /// RTP header extensions provided in the sink caps, saving the application
63    /// the need to handle these extensions manually using the
64    /// GstRTPBaseDepayload::request-extension: signal.
65    ///
66    /// Readable | Writeable
67    ///
68    ///
69    /// #### `extensions`
70    ///  A list of already enabled RTP header extensions. This may be useful for finding
71    /// out which extensions are already enabled (with add-extension signal) and picking a non-conflicting
72    /// ID for a new extension that needs to be added on top of the existing ones.
73    ///
74    /// Note that the value returned by reading this property is not dynamically updated when the set of
75    /// enabled extensions changes by any of existing action signals. Rather, it represents the current state
76    /// at the time the property is read.
77    ///
78    /// Dynamic updates of this property can be received by subscribing to its corresponding "notify" signal, i.e.
79    /// "notify::extensions".
80    ///
81    /// Readable
82    ///
83    ///
84    /// #### `max-reorder`
85    ///  Max seqnum reorder before the sender is assumed to have restarted.
86    ///
87    /// When max-reorder is set to 0 all reordered/duplicate packets are
88    /// considered coming from a restarted sender.
89    ///
90    /// Readable | Writeable
91    ///
92    ///
93    /// #### `source-info`
94    ///  Add RTP source information found in RTP header as meta to output buffer.
95    ///
96    /// Readable | Writeable
97    ///
98    ///
99    /// #### `stats`
100    ///  Various depayloader statistics retrieved atomically (and are therefore
101    /// synchroized with each other). This property return a GstStructure named
102    /// application/x-rtp-depayload-stats containing the following fields relating to
103    /// the last processed buffer and current state of the stream being depayloaded:
104    ///
105    ///  * `clock-rate`: `G_TYPE_UINT`, clock-rate of the stream
106    ///  * `npt-start`: `G_TYPE_UINT64`, time of playback start
107    ///  * `npt-stop`: `G_TYPE_UINT64`, time of playback stop
108    ///  * `play-speed`: `G_TYPE_DOUBLE`, the playback speed
109    ///  * `play-scale`: `G_TYPE_DOUBLE`, the playback scale
110    ///  * `running-time-dts`: `G_TYPE_UINT64`, the last running-time of the
111    ///  last DTS
112    ///  * `running-time-pts`: `G_TYPE_UINT64`, the last running-time of the
113    ///  last PTS
114    ///  * `seqnum`: `G_TYPE_UINT`, the last seen seqnum
115    ///  * `timestamp`: `G_TYPE_UINT`, the last seen RTP timestamp
116    ///
117    /// Readable
118    /// <details><summary><h4>Object</h4></summary>
119    ///
120    ///
121    /// #### `name`
122    ///  Readable | Writeable | Construct
123    ///
124    ///
125    /// #### `parent`
126    ///  The parent of the object. Please note, that when changing the 'parent'
127    /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
128    /// signals due to locking issues. In some cases one can use
129    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
130    /// achieve a similar effect.
131    ///
132    /// Readable | Writeable
133    /// </details>
134    ///
135    /// ## Signals
136    ///
137    ///
138    /// #### `add-extension`
139    ///  Add `ext` as an extension for reading part of an RTP header extension from
140    /// incoming RTP packets.
141    ///
142    /// Action
143    ///
144    ///
145    /// #### `clear-extensions`
146    ///  Clear all RTP header extensions used by this depayloader.
147    ///
148    /// Action
149    ///
150    ///
151    /// #### `request-extension`
152    ///  The returned `ext` must be configured with the correct `ext_id` and with the
153    /// necessary attributes as required by the extension implementation.
154    ///
155    ///
156    /// <details><summary><h4>Element</h4></summary>
157    ///
158    ///
159    /// #### `no-more-pads`
160    ///  This signals that the element will not generate more dynamic pads.
161    /// Note that this signal will usually be emitted from the context of
162    /// the streaming thread.
163    ///
164    ///
165    ///
166    ///
167    /// #### `pad-added`
168    ///  a new `GstPad` has been added to the element. Note that this signal will
169    /// usually be emitted from the context of the streaming thread. Also keep in
170    /// mind that if you add new elements to the pipeline in the signal handler
171    /// you will need to set them to the desired target state with
172    /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
173    ///
174    ///
175    ///
176    ///
177    /// #### `pad-removed`
178    ///  a `GstPad` has been removed from the element
179    ///
180    ///
181    /// </details>
182    /// <details><summary><h4>Object</h4></summary>
183    ///
184    ///
185    /// #### `deep-notify`
186    ///  The deep notify signal is used to be notified of property changes. It is
187    /// typically attached to the toplevel bin to receive notifications from all
188    /// the elements contained in that bin.
189    ///
190    /// Detailed
191    /// </details>
192    ///
193    /// # Implements
194    ///
195    /// [`RTPBaseDepayloadExt`][trait@crate::prelude::RTPBaseDepayloadExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`RTPBaseDepayloadExtManual`][trait@crate::prelude::RTPBaseDepayloadExtManual]
196    #[doc(alias = "GstRTPBaseDepayload")]
197    pub struct RTPBaseDepayload(Object<ffi::GstRTPBaseDepayload, ffi::GstRTPBaseDepayloadClass>) @extends gst::Element, gst::Object;
198
199    match fn {
200        type_ => || ffi::gst_rtp_base_depayload_get_type(),
201    }
202}
203
204impl RTPBaseDepayload {
205    pub const NONE: Option<&'static RTPBaseDepayload> = None;
206}
207
208unsafe impl Send for RTPBaseDepayload {}
209unsafe impl Sync for RTPBaseDepayload {}
210
211mod sealed {
212    pub trait Sealed {}
213    impl<T: super::IsA<super::RTPBaseDepayload>> Sealed for T {}
214}
215
216/// Trait containing all [`struct@RTPBaseDepayload`] methods.
217///
218/// # Implementors
219///
220/// [`RTPBaseDepayload`][struct@crate::RTPBaseDepayload]
221pub trait RTPBaseDepayloadExt: IsA<RTPBaseDepayload> + sealed::Sealed + 'static {
222    /// Called from [`RTPBaseDepayload`][crate::RTPBaseDepayload] or
223    /// [`RTPBaseDepayload`][crate::RTPBaseDepayload] when the depayloader needs
224    /// to keep the current input RTP header for use with the next output
225    /// buffer.
226    ///
227    /// The delayed buffer will remain until the end of processing the
228    /// current output buffer and then enqueued for processing with the
229    /// next output buffer.
230    ///
231    /// A typical use-case is when the depayloader implementation will
232    /// start a new output buffer for the current input RTP buffer but push
233    /// the current output buffer first.
234    ///
235    /// Must be called with the stream lock held.
236    #[cfg(feature = "v1_24")]
237    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
238    #[doc(alias = "gst_rtp_base_depayload_delayed")]
239    fn delayed(&self) {
240        unsafe {
241            ffi::gst_rtp_base_depayload_delayed(self.as_ref().to_glib_none().0);
242        }
243    }
244
245    /// Called from [`RTPBaseDepayload`][crate::RTPBaseDepayload] or
246    /// [`RTPBaseDepayload`][crate::RTPBaseDepayload] if the depayloader does not
247    /// use the current buffer for the output buffer. This will either drop
248    /// the delayed buffer or the last buffer from the header extension
249    /// cache.
250    ///
251    /// A typical use-case is when the depayloader implementation is
252    /// dropping an input RTP buffer while waiting for the first keyframe.
253    ///
254    /// Must be called with the stream lock held.
255    #[cfg(feature = "v1_24")]
256    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
257    #[doc(alias = "gst_rtp_base_depayload_dropped")]
258    fn dropped(&self) {
259        unsafe {
260            ffi::gst_rtp_base_depayload_dropped(self.as_ref().to_glib_none().0);
261        }
262    }
263
264    /// If [`RTPBaseDepayload`][crate::RTPBaseDepayload] or
265    /// [`RTPBaseDepayload`][crate::RTPBaseDepayload] drop an output buffer this
266    /// function tells the base class to flush header extension cache as
267    /// well.
268    ///
269    /// This will not drop an input RTP header marked as delayed from
270    /// [`delayed()`][Self::delayed()].
271    ///
272    /// If `keep_current` is [`true`] the current input RTP header will be kept
273    /// and enqueued after flushing the previous input RTP headers.
274    ///
275    /// A typical use-case for `keep_current` is when the depayloader
276    /// implementation invalidates the current output buffer and starts a
277    /// new one with the current RTP input buffer.
278    ///
279    /// Must be called with the stream lock held.
280    /// ## `keep_current`
281    /// if the current RTP buffer shall be kept
282    #[cfg(feature = "v1_24")]
283    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
284    #[doc(alias = "gst_rtp_base_depayload_flush")]
285    fn flush(&self, keep_current: bool) {
286        unsafe {
287            ffi::gst_rtp_base_depayload_flush(
288                self.as_ref().to_glib_none().0,
289                keep_current.into_glib(),
290            );
291        }
292    }
293
294    /// Queries whether header extensions will be aggregated per depayloaded buffers.
295    ///
296    /// # Returns
297    ///
298    /// [`true`] if aggregate-header-extension is enabled.
299    #[cfg(feature = "v1_24")]
300    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
301    #[doc(alias = "gst_rtp_base_depayload_is_aggregate_hdrext_enabled")]
302    fn is_aggregate_hdrext_enabled(&self) -> bool {
303        unsafe {
304            from_glib(ffi::gst_rtp_base_depayload_is_aggregate_hdrext_enabled(
305                self.as_ref().to_glib_none().0,
306            ))
307        }
308    }
309
310    /// Queries whether `GstRTPSourceMeta` will be added to depayloaded buffers.
311    ///
312    /// # Returns
313    ///
314    /// [`true`] if source-info is enabled.
315    #[cfg(feature = "v1_16")]
316    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
317    #[doc(alias = "gst_rtp_base_depayload_is_source_info_enabled")]
318    fn is_source_info_enabled(&self) -> bool {
319        unsafe {
320            from_glib(ffi::gst_rtp_base_depayload_is_source_info_enabled(
321                self.as_ref().to_glib_none().0,
322            ))
323        }
324    }
325
326    /// Push `out_buf` to the peer of `self`. This function takes ownership of
327    /// `out_buf`.
328    ///
329    /// This function will by default apply the last incoming timestamp on
330    /// the outgoing buffer when it didn't have a timestamp already.
331    /// ## `out_buf`
332    /// a [`gst::Buffer`][crate::gst::Buffer]
333    ///
334    /// # Returns
335    ///
336    /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
337    #[doc(alias = "gst_rtp_base_depayload_push")]
338    fn push(&self, out_buf: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
339        unsafe {
340            try_from_glib(ffi::gst_rtp_base_depayload_push(
341                self.as_ref().to_glib_none().0,
342                out_buf.into_glib_ptr(),
343            ))
344        }
345    }
346
347    /// Push `out_list` to the peer of `self`. This function takes ownership of
348    /// `out_list`.
349    /// ## `out_list`
350    /// a [`gst::BufferList`][crate::gst::BufferList]
351    ///
352    /// # Returns
353    ///
354    /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
355    #[doc(alias = "gst_rtp_base_depayload_push_list")]
356    fn push_list(&self, out_list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError> {
357        unsafe {
358            try_from_glib(ffi::gst_rtp_base_depayload_push_list(
359                self.as_ref().to_glib_none().0,
360                out_list.into_glib_ptr(),
361            ))
362        }
363    }
364
365    /// Enable or disable aggregating header extensions.
366    /// ## `enable`
367    /// whether to aggregate header extensions per output buffer
368    #[cfg(feature = "v1_24")]
369    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
370    #[doc(alias = "gst_rtp_base_depayload_set_aggregate_hdrext_enabled")]
371    fn set_aggregate_hdrext_enabled(&self, enable: bool) {
372        unsafe {
373            ffi::gst_rtp_base_depayload_set_aggregate_hdrext_enabled(
374                self.as_ref().to_glib_none().0,
375                enable.into_glib(),
376            );
377        }
378    }
379
380    /// Enable or disable adding `GstRTPSourceMeta` to depayloaded buffers.
381    /// ## `enable`
382    /// whether to add meta about RTP sources to buffer
383    #[cfg(feature = "v1_16")]
384    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
385    #[doc(alias = "gst_rtp_base_depayload_set_source_info_enabled")]
386    fn set_source_info_enabled(&self, enable: bool) {
387        unsafe {
388            ffi::gst_rtp_base_depayload_set_source_info_enabled(
389                self.as_ref().to_glib_none().0,
390                enable.into_glib(),
391            );
392        }
393    }
394
395    /// If enabled, the depayloader will automatically try to enable all the
396    /// RTP header extensions provided in the sink caps, saving the application
397    /// the need to handle these extensions manually using the
398    /// GstRTPBaseDepayload::request-extension: signal.
399    #[cfg(feature = "v1_20")]
400    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
401    #[doc(alias = "auto-header-extension")]
402    fn is_auto_header_extension(&self) -> bool {
403        ObjectExt::property(self.as_ref(), "auto-header-extension")
404    }
405
406    /// If enabled, the depayloader will automatically try to enable all the
407    /// RTP header extensions provided in the sink caps, saving the application
408    /// the need to handle these extensions manually using the
409    /// GstRTPBaseDepayload::request-extension: signal.
410    #[cfg(feature = "v1_20")]
411    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
412    #[doc(alias = "auto-header-extension")]
413    fn set_auto_header_extension(&self, auto_header_extension: bool) {
414        ObjectExt::set_property(
415            self.as_ref(),
416            "auto-header-extension",
417            auto_header_extension,
418        )
419    }
420
421    /// Max seqnum reorder before the sender is assumed to have restarted.
422    ///
423    /// When max-reorder is set to 0 all reordered/duplicate packets are
424    /// considered coming from a restarted sender.
425    #[cfg(feature = "v1_18")]
426    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
427    #[doc(alias = "max-reorder")]
428    fn max_reorder(&self) -> i32 {
429        ObjectExt::property(self.as_ref(), "max-reorder")
430    }
431
432    /// Max seqnum reorder before the sender is assumed to have restarted.
433    ///
434    /// When max-reorder is set to 0 all reordered/duplicate packets are
435    /// considered coming from a restarted sender.
436    #[cfg(feature = "v1_18")]
437    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
438    #[doc(alias = "max-reorder")]
439    fn set_max_reorder(&self, max_reorder: i32) {
440        ObjectExt::set_property(self.as_ref(), "max-reorder", max_reorder)
441    }
442
443    /// Add RTP source information found in RTP header as meta to output buffer.
444    #[cfg(feature = "v1_16")]
445    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
446    #[doc(alias = "source-info")]
447    fn is_source_info(&self) -> bool {
448        ObjectExt::property(self.as_ref(), "source-info")
449    }
450
451    /// Add RTP source information found in RTP header as meta to output buffer.
452    #[cfg(feature = "v1_16")]
453    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
454    #[doc(alias = "source-info")]
455    fn set_source_info(&self, source_info: bool) {
456        ObjectExt::set_property(self.as_ref(), "source-info", source_info)
457    }
458
459    /// Various depayloader statistics retrieved atomically (and are therefore
460    /// synchroized with each other). This property return a GstStructure named
461    /// application/x-rtp-depayload-stats containing the following fields relating to
462    /// the last processed buffer and current state of the stream being depayloaded:
463    ///
464    ///  * `clock-rate`: `G_TYPE_UINT`, clock-rate of the stream
465    ///  * `npt-start`: `G_TYPE_UINT64`, time of playback start
466    ///  * `npt-stop`: `G_TYPE_UINT64`, time of playback stop
467    ///  * `play-speed`: `G_TYPE_DOUBLE`, the playback speed
468    ///  * `play-scale`: `G_TYPE_DOUBLE`, the playback scale
469    ///  * `running-time-dts`: `G_TYPE_UINT64`, the last running-time of the
470    ///  last DTS
471    ///  * `running-time-pts`: `G_TYPE_UINT64`, the last running-time of the
472    ///  last PTS
473    ///  * `seqnum`: `G_TYPE_UINT`, the last seen seqnum
474    ///  * `timestamp`: `G_TYPE_UINT`, the last seen RTP timestamp
475    fn stats(&self) -> Option<gst::Structure> {
476        ObjectExt::property(self.as_ref(), "stats")
477    }
478
479    /// Add `ext` as an extension for reading part of an RTP header extension from
480    /// incoming RTP packets.
481    /// ## `ext`
482    /// the [`RTPHeaderExtension`][crate::RTPHeaderExtension]
483    #[cfg(feature = "v1_20")]
484    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
485    #[doc(alias = "add-extension")]
486    fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
487        &self,
488        f: F,
489    ) -> SignalHandlerId {
490        unsafe extern "C" fn add_extension_trampoline<
491            P: IsA<RTPBaseDepayload>,
492            F: Fn(&P, &RTPHeaderExtension) + Send + Sync + 'static,
493        >(
494            this: *mut ffi::GstRTPBaseDepayload,
495            ext: *mut ffi::GstRTPHeaderExtension,
496            f: glib::ffi::gpointer,
497        ) {
498            let f: &F = &*(f as *const F);
499            f(
500                RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
501                &from_glib_full(ext),
502            )
503        }
504        unsafe {
505            let f: Box_<F> = Box_::new(f);
506            connect_raw(
507                self.as_ptr() as *mut _,
508                b"add-extension\0".as_ptr() as *const _,
509                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
510                    add_extension_trampoline::<Self, F> as *const (),
511                )),
512                Box_::into_raw(f),
513            )
514        }
515    }
516
517    #[cfg(feature = "v1_20")]
518    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
519    fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
520        self.emit_by_name::<()>("add-extension", &[&ext]);
521    }
522
523    /// Clear all RTP header extensions used by this depayloader.
524    #[cfg(feature = "v1_20")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
526    #[doc(alias = "clear-extensions")]
527    fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
528        &self,
529        f: F,
530    ) -> SignalHandlerId {
531        unsafe extern "C" fn clear_extensions_trampoline<
532            P: IsA<RTPBaseDepayload>,
533            F: Fn(&P) + Send + Sync + 'static,
534        >(
535            this: *mut ffi::GstRTPBaseDepayload,
536            f: glib::ffi::gpointer,
537        ) {
538            let f: &F = &*(f as *const F);
539            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
540        }
541        unsafe {
542            let f: Box_<F> = Box_::new(f);
543            connect_raw(
544                self.as_ptr() as *mut _,
545                b"clear-extensions\0".as_ptr() as *const _,
546                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
547                    clear_extensions_trampoline::<Self, F> as *const (),
548                )),
549                Box_::into_raw(f),
550            )
551        }
552    }
553
554    #[cfg(feature = "v1_20")]
555    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
556    fn emit_clear_extensions(&self) {
557        self.emit_by_name::<()>("clear-extensions", &[]);
558    }
559
560    /// The returned `ext` must be configured with the correct `ext_id` and with the
561    /// necessary attributes as required by the extension implementation.
562    /// ## `ext_id`
563    /// the extension id being requested
564    /// ## `ext_uri`
565    /// the extension URI being requested
566    ///
567    /// # Returns
568    ///
569    /// the [`RTPHeaderExtension`][crate::RTPHeaderExtension] for `ext_id`, or [`None`]
570    #[cfg(feature = "v1_20")]
571    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
572    #[doc(alias = "request-extension")]
573    fn connect_request_extension<
574        F: Fn(&Self, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
575    >(
576        &self,
577        f: F,
578    ) -> SignalHandlerId {
579        unsafe extern "C" fn request_extension_trampoline<
580            P: IsA<RTPBaseDepayload>,
581            F: Fn(&P, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
582        >(
583            this: *mut ffi::GstRTPBaseDepayload,
584            ext_id: std::ffi::c_uint,
585            ext_uri: *mut std::ffi::c_char,
586            f: glib::ffi::gpointer,
587        ) -> *mut ffi::GstRTPHeaderExtension {
588            let f: &F = &*(f as *const F);
589            f(
590                RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
591                ext_id,
592                Option::<glib::GString>::from_glib_borrow(ext_uri)
593                    .as_ref()
594                    .as_ref()
595                    .map(|s| s.as_str()),
596            )
597            .to_glib_full()
598        }
599        unsafe {
600            let f: Box_<F> = Box_::new(f);
601            connect_raw(
602                self.as_ptr() as *mut _,
603                b"request-extension\0".as_ptr() as *const _,
604                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
605                    request_extension_trampoline::<Self, F> as *const (),
606                )),
607                Box_::into_raw(f),
608            )
609        }
610    }
611
612    #[cfg(feature = "v1_20")]
613    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
614    #[doc(alias = "auto-header-extension")]
615    fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
616        &self,
617        f: F,
618    ) -> SignalHandlerId {
619        unsafe extern "C" fn notify_auto_header_extension_trampoline<
620            P: IsA<RTPBaseDepayload>,
621            F: Fn(&P) + Send + Sync + 'static,
622        >(
623            this: *mut ffi::GstRTPBaseDepayload,
624            _param_spec: glib::ffi::gpointer,
625            f: glib::ffi::gpointer,
626        ) {
627            let f: &F = &*(f as *const F);
628            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
629        }
630        unsafe {
631            let f: Box_<F> = Box_::new(f);
632            connect_raw(
633                self.as_ptr() as *mut _,
634                b"notify::auto-header-extension\0".as_ptr() as *const _,
635                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
636                    notify_auto_header_extension_trampoline::<Self, F> as *const (),
637                )),
638                Box_::into_raw(f),
639            )
640        }
641    }
642
643    #[cfg(feature = "v1_18")]
644    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
645    #[doc(alias = "max-reorder")]
646    fn connect_max_reorder_notify<F: Fn(&Self) + Send + Sync + 'static>(
647        &self,
648        f: F,
649    ) -> SignalHandlerId {
650        unsafe extern "C" fn notify_max_reorder_trampoline<
651            P: IsA<RTPBaseDepayload>,
652            F: Fn(&P) + Send + Sync + 'static,
653        >(
654            this: *mut ffi::GstRTPBaseDepayload,
655            _param_spec: glib::ffi::gpointer,
656            f: glib::ffi::gpointer,
657        ) {
658            let f: &F = &*(f as *const F);
659            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
660        }
661        unsafe {
662            let f: Box_<F> = Box_::new(f);
663            connect_raw(
664                self.as_ptr() as *mut _,
665                b"notify::max-reorder\0".as_ptr() as *const _,
666                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
667                    notify_max_reorder_trampoline::<Self, F> as *const (),
668                )),
669                Box_::into_raw(f),
670            )
671        }
672    }
673
674    #[cfg(feature = "v1_16")]
675    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
676    #[doc(alias = "source-info")]
677    fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
678        &self,
679        f: F,
680    ) -> SignalHandlerId {
681        unsafe extern "C" fn notify_source_info_trampoline<
682            P: IsA<RTPBaseDepayload>,
683            F: Fn(&P) + Send + Sync + 'static,
684        >(
685            this: *mut ffi::GstRTPBaseDepayload,
686            _param_spec: glib::ffi::gpointer,
687            f: glib::ffi::gpointer,
688        ) {
689            let f: &F = &*(f as *const F);
690            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
691        }
692        unsafe {
693            let f: Box_<F> = Box_::new(f);
694            connect_raw(
695                self.as_ptr() as *mut _,
696                b"notify::source-info\0".as_ptr() as *const _,
697                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
698                    notify_source_info_trampoline::<Self, F> as *const (),
699                )),
700                Box_::into_raw(f),
701            )
702        }
703    }
704
705    #[doc(alias = "stats")]
706    fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
707        unsafe extern "C" fn notify_stats_trampoline<
708            P: IsA<RTPBaseDepayload>,
709            F: Fn(&P) + Send + Sync + 'static,
710        >(
711            this: *mut ffi::GstRTPBaseDepayload,
712            _param_spec: glib::ffi::gpointer,
713            f: glib::ffi::gpointer,
714        ) {
715            let f: &F = &*(f as *const F);
716            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
717        }
718        unsafe {
719            let f: Box_<F> = Box_::new(f);
720            connect_raw(
721                self.as_ptr() as *mut _,
722                b"notify::stats\0".as_ptr() as *const _,
723                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
724                    notify_stats_trampoline::<Self, F> as *const (),
725                )),
726                Box_::into_raw(f),
727            )
728        }
729    }
730}
731
732impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExt for O {}