forked from mirrors/gstreamer-rs
ffa9697edd
The array size is now provided since [1], yet mutability and `*Ref` makes it impossible to generate these functions properly. Implement them by hand. [1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1190
63 lines
1.7 KiB
Rust
63 lines
1.7 KiB
Rust
use crate::RTPHeaderExtension;
|
|
use crate::RTPHeaderExtensionFlags;
|
|
use glib::object::IsA;
|
|
use glib::translate::*;
|
|
|
|
pub trait RTPHeaderExtensionExtManual: 'static {
|
|
#[doc(alias = "gst_rtp_header_extension_read")]
|
|
fn read(
|
|
&self,
|
|
read_flags: RTPHeaderExtensionFlags,
|
|
data: &[u8],
|
|
buffer: &mut gst::BufferRef,
|
|
) -> bool;
|
|
|
|
#[doc(alias = "gst_rtp_header_extension_write")]
|
|
fn write(
|
|
&self,
|
|
input_meta: &gst::Buffer,
|
|
write_flags: RTPHeaderExtensionFlags,
|
|
output: &mut gst::BufferRef,
|
|
data: &mut [u8],
|
|
) -> usize;
|
|
}
|
|
|
|
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
|
|
fn read(
|
|
&self,
|
|
read_flags: RTPHeaderExtensionFlags,
|
|
data: &[u8],
|
|
buffer: &mut gst::BufferRef,
|
|
) -> bool {
|
|
let size = data.len() as usize;
|
|
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(),
|
|
))
|
|
}
|
|
}
|
|
|
|
fn write(
|
|
&self,
|
|
input_meta: &gst::Buffer,
|
|
write_flags: RTPHeaderExtensionFlags,
|
|
output: &mut gst::BufferRef,
|
|
data: &mut [u8],
|
|
) -> usize {
|
|
let size = data.len() as usize;
|
|
unsafe {
|
|
ffi::gst_rtp_header_extension_write(
|
|
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,
|
|
)
|
|
}
|
|
}
|
|
}
|