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