2023-01-03 18:58:25 +00:00
|
|
|
use glib::{object::IsA, translate::*};
|
|
|
|
|
|
|
|
use crate::{RTPHeaderExtension, RTPHeaderExtensionFlags};
|
2021-06-28 12:17:13 +00:00
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
mod sealed {
|
|
|
|
pub trait Sealed {}
|
|
|
|
impl<T: super::IsA<super::RTPHeaderExtension>> Sealed for T {}
|
2021-06-28 12:17:13 +00:00
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
pub trait RTPHeaderExtensionExtManual: sealed::Sealed + IsA<RTPHeaderExtension> + 'static {
|
|
|
|
#[doc(alias = "gst_rtp_header_extension_read")]
|
2021-06-28 12:17:13 +00:00
|
|
|
fn read(
|
|
|
|
&self,
|
|
|
|
read_flags: RTPHeaderExtensionFlags,
|
|
|
|
data: &[u8],
|
|
|
|
buffer: &mut gst::BufferRef,
|
|
|
|
) -> bool {
|
2022-12-15 16:35:29 +00:00
|
|
|
let size = data.len();
|
2021-06-28 12:17:13 +00:00
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_rtp_header_extension_read(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
read_flags.into_glib(),
|
|
|
|
data.to_glib_none().0,
|
|
|
|
size,
|
|
|
|
buffer.as_mut_ptr(),
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_rtp_header_extension_write")]
|
2021-06-28 12:17:13 +00:00
|
|
|
fn write(
|
|
|
|
&self,
|
|
|
|
input_meta: &gst::Buffer,
|
|
|
|
write_flags: RTPHeaderExtensionFlags,
|
|
|
|
output: &mut gst::BufferRef,
|
|
|
|
data: &mut [u8],
|
2021-09-19 08:10:18 +00:00
|
|
|
) -> Result<usize, glib::BoolError> {
|
2022-12-15 16:35:29 +00:00
|
|
|
let size = data.len();
|
2021-06-28 12:17:13 +00:00
|
|
|
unsafe {
|
2021-09-19 08:10:18 +00:00
|
|
|
let res = ffi::gst_rtp_header_extension_write(
|
2021-06-28 12:17:13 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
input_meta.to_glib_none().0,
|
|
|
|
write_flags.into_glib(),
|
|
|
|
output.as_mut_ptr(),
|
|
|
|
data.to_glib_none().0,
|
|
|
|
size,
|
2021-09-19 08:10:18 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if res < 0 {
|
|
|
|
Err(glib::bool_error!("Failed to write header extension"))
|
|
|
|
} else {
|
|
|
|
Ok(res as usize)
|
|
|
|
}
|
2021-06-28 12:17:13 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-08 16:57:14 +00:00
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes")]
|
2021-10-08 16:57:14 +00:00
|
|
|
fn set_caps_from_attributes(&self, caps: &mut gst::CapsRef) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_rtp_header_extension_set_caps_from_attributes(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
caps.as_mut_ptr(),
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes_helper")]
|
2021-10-08 16:57:14 +00:00
|
|
|
fn set_caps_from_attributes_helper(&self, caps: &mut gst::CapsRef, attributes: &str) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(
|
|
|
|
ffi::gst_rtp_header_extension_set_caps_from_attributes_helper(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
caps.as_mut_ptr(),
|
|
|
|
attributes.to_glib_none().0,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_rtp_header_extension_update_non_rtp_src_caps")]
|
2021-10-08 16:57:14 +00:00
|
|
|
fn update_non_rtp_src_caps(&self, caps: &mut gst::CapsRef) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_rtp_header_extension_update_non_rtp_src_caps(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
caps.as_mut_ptr(),
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
2021-06-28 12:17:13 +00:00
|
|
|
}
|
2023-07-05 20:21:43 +00:00
|
|
|
|
|
|
|
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {}
|