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