gstreamer_rtp/auto/
rtp_header_extension.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, RTPHeaderExtensionDirection, RTPHeaderExtensionFlags};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// Instance struct for a RTP Audio/Video header extension.
11    ///
12    /// This is an Abstract Base Class, you cannot instantiate it.
13    ///
14    /// # Implements
15    ///
16    /// [`RTPHeaderExtensionExt`][trait@crate::prelude::RTPHeaderExtensionExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`RTPHeaderExtensionExtManual`][trait@crate::prelude::RTPHeaderExtensionExtManual]
17    #[doc(alias = "GstRTPHeaderExtension")]
18    pub struct RTPHeaderExtension(Object<ffi::GstRTPHeaderExtension, ffi::GstRTPHeaderExtensionClass>) @extends gst::Element, gst::Object;
19
20    match fn {
21        type_ => || ffi::gst_rtp_header_extension_get_type(),
22    }
23}
24
25impl RTPHeaderExtension {
26    pub const NONE: Option<&'static RTPHeaderExtension> = None;
27
28    /// ## `uri`
29    /// the rtp header extension URI to search for
30    ///
31    /// # Returns
32    ///
33    /// the [`RTPHeaderExtension`][crate::RTPHeaderExtension] for `uri` or [`None`]
34    #[doc(alias = "gst_rtp_header_extension_create_from_uri")]
35    pub fn create_from_uri(uri: &str) -> Option<RTPHeaderExtension> {
36        assert_initialized_main_thread!();
37        unsafe {
38            from_glib_full(ffi::gst_rtp_header_extension_create_from_uri(
39                uri.to_glib_none().0,
40            ))
41        }
42    }
43}
44
45unsafe impl Send for RTPHeaderExtension {}
46unsafe impl Sync for RTPHeaderExtension {}
47
48mod sealed {
49    pub trait Sealed {}
50    impl<T: super::IsA<super::RTPHeaderExtension>> Sealed for T {}
51}
52
53/// Trait containing all [`struct@RTPHeaderExtension`] methods.
54///
55/// # Implementors
56///
57/// [`RTPHeaderExtension`][struct@crate::RTPHeaderExtension]
58pub trait RTPHeaderExtensionExt: IsA<RTPHeaderExtension> + sealed::Sealed + 'static {
59    /// Retrieve the direction
60    ///
61    /// # Returns
62    ///
63    /// The direction
64    #[doc(alias = "gst_rtp_header_extension_get_direction")]
65    #[doc(alias = "get_direction")]
66    fn direction(&self) -> RTPHeaderExtensionDirection {
67        unsafe {
68            from_glib(ffi::gst_rtp_header_extension_get_direction(
69                self.as_ref().to_glib_none().0,
70            ))
71        }
72    }
73
74    ///
75    /// # Returns
76    ///
77    /// the RTP extension id configured on `self`
78    #[doc(alias = "gst_rtp_header_extension_get_id")]
79    #[doc(alias = "get_id")]
80    fn id(&self) -> u32 {
81        unsafe { ffi::gst_rtp_header_extension_get_id(self.as_ref().to_glib_none().0) }
82    }
83
84    /// This is used to know how much data a certain header extension will need for
85    /// both allocating the resulting data, and deciding how much payload data can
86    /// be generated.
87    ///
88    /// Implementations should return as accurate a value as is possible using the
89    /// information given in the input `buffer`.
90    /// ## `input_meta`
91    /// a [`gst::Buffer`][crate::gst::Buffer]
92    ///
93    /// # Returns
94    ///
95    /// the maximum size of the data written by this extension
96    #[doc(alias = "gst_rtp_header_extension_get_max_size")]
97    #[doc(alias = "get_max_size")]
98    fn max_size(&self, input_meta: &gst::Buffer) -> usize {
99        unsafe {
100            ffi::gst_rtp_header_extension_get_max_size(
101                self.as_ref().to_glib_none().0,
102                input_meta.to_glib_none().0,
103            )
104        }
105    }
106
107    ///
108    /// # Returns
109    ///
110    /// the [`gst::Structure`][crate::gst::Structure] field name used in SDP-like [`gst::Caps`][crate::gst::Caps] for this `self` configuration
111    #[doc(alias = "gst_rtp_header_extension_get_sdp_caps_field_name")]
112    #[doc(alias = "get_sdp_caps_field_name")]
113    fn sdp_caps_field_name(&self) -> glib::GString {
114        unsafe {
115            from_glib_full(ffi::gst_rtp_header_extension_get_sdp_caps_field_name(
116                self.as_ref().to_glib_none().0,
117            ))
118        }
119    }
120
121    ///
122    /// # Returns
123    ///
124    /// the flags supported by this instance of `self`
125    #[doc(alias = "gst_rtp_header_extension_get_supported_flags")]
126    #[doc(alias = "get_supported_flags")]
127    fn supported_flags(&self) -> RTPHeaderExtensionFlags {
128        unsafe {
129            from_glib(ffi::gst_rtp_header_extension_get_supported_flags(
130                self.as_ref().to_glib_none().0,
131            ))
132        }
133    }
134
135    ///
136    /// # Returns
137    ///
138    /// the RTP extension URI for this object
139    #[doc(alias = "gst_rtp_header_extension_get_uri")]
140    #[doc(alias = "get_uri")]
141    fn uri(&self) -> Option<glib::GString> {
142        unsafe {
143            from_glib_none(ffi::gst_rtp_header_extension_get_uri(
144                self.as_ref().to_glib_none().0,
145            ))
146        }
147    }
148
149    /// [`set_id()`][Self::set_id()] must have been called with a valid
150    /// extension id that is contained in these caps.
151    ///
152    /// The only current known caps format is based on the SDP standard as produced
153    /// by `gst_sdp_media_attributes_to_caps()`.
154    /// ## `caps`
155    /// the [`gst::Caps`][crate::gst::Caps] to configure this extension with
156    ///
157    /// # Returns
158    ///
159    /// whether the `caps` could be successfully set on `self`.
160    #[doc(alias = "gst_rtp_header_extension_set_attributes_from_caps")]
161    fn set_attributes_from_caps(&self, caps: &gst::Caps) -> bool {
162        unsafe {
163            from_glib(ffi::gst_rtp_header_extension_set_attributes_from_caps(
164                self.as_ref().to_glib_none().0,
165                caps.to_glib_none().0,
166            ))
167        }
168    }
169
170    /// Set the direction that this header extension should be used in.
171    /// If [`RTPHeaderExtensionDirection::INHERITED`][crate::RTPHeaderExtensionDirection::INHERITED] is included, the
172    /// direction will not be included in the caps (as it shouldn't be in the
173    /// extmap line in the SDP).
174    /// ## `direction`
175    /// The direction
176    #[doc(alias = "gst_rtp_header_extension_set_direction")]
177    fn set_direction(&self, direction: RTPHeaderExtensionDirection) {
178        unsafe {
179            ffi::gst_rtp_header_extension_set_direction(
180                self.as_ref().to_glib_none().0,
181                direction.into_glib(),
182            );
183        }
184    }
185
186    /// sets the RTP extension id on `self`
187    /// ## `ext_id`
188    /// The id of this extension
189    #[doc(alias = "gst_rtp_header_extension_set_id")]
190    fn set_id(&self, ext_id: u32) {
191        unsafe {
192            ffi::gst_rtp_header_extension_set_id(self.as_ref().to_glib_none().0, ext_id);
193        }
194    }
195
196    /// Passes RTP payloader's sink (i.e. not payloaded) `caps` to the header
197    /// extension.
198    /// ## `caps`
199    /// sink [`gst::Caps`][crate::gst::Caps]
200    ///
201    /// # Returns
202    ///
203    /// Whether `caps` could be read successfully
204    #[doc(alias = "gst_rtp_header_extension_set_non_rtp_sink_caps")]
205    fn set_non_rtp_sink_caps(&self, caps: &gst::Caps) -> bool {
206        unsafe {
207            from_glib(ffi::gst_rtp_header_extension_set_non_rtp_sink_caps(
208                self.as_ref().to_glib_none().0,
209                caps.to_glib_none().0,
210            ))
211        }
212    }
213
214    /// Call this function in a subclass from `GstRTPHeaderExtensionClass::read` to
215    /// tell the depayloader whether the data just parsed from RTP packet require
216    /// updating its src (non-RTP) caps. If `state` is TRUE, [`RTPBaseDepayload`][crate::RTPBaseDepayload] will
217    /// eventually invoke [`RTPHeaderExtensionExtManual::update_non_rtp_src_caps()`][crate::prelude::RTPHeaderExtensionExtManual::update_non_rtp_src_caps()] to
218    /// have the caps update applied. Applying the update also flips the internal
219    /// "wants update" flag back to FALSE.
220    /// ## `state`
221    /// TRUE if caps update is needed
222    #[doc(alias = "gst_rtp_header_extension_set_wants_update_non_rtp_src_caps")]
223    fn set_wants_update_non_rtp_src_caps(&self, state: bool) {
224        unsafe {
225            ffi::gst_rtp_header_extension_set_wants_update_non_rtp_src_caps(
226                self.as_ref().to_glib_none().0,
227                state.into_glib(),
228            );
229        }
230    }
231
232    /// Call this function after [`RTPHeaderExtensionExtManual::read()`][crate::prelude::RTPHeaderExtensionExtManual::read()] to check if
233    /// the depayloader's src caps need updating with data received in the last RTP
234    /// packet.
235    ///
236    /// # Returns
237    ///
238    /// Whether `self` wants to update depayloader's src caps.
239    #[doc(alias = "gst_rtp_header_extension_wants_update_non_rtp_src_caps")]
240    fn wants_update_non_rtp_src_caps(&self) -> bool {
241        unsafe {
242            from_glib(ffi::gst_rtp_header_extension_wants_update_non_rtp_src_caps(
243                self.as_ref().to_glib_none().0,
244            ))
245        }
246    }
247}
248
249impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExt for O {}