2022-04-07 00:09:44 +00:00
|
|
|
use std::ptr;
|
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use glib::{object::IsA, translate::*};
|
|
|
|
|
|
|
|
use crate::RTPBasePayload;
|
|
|
|
|
2022-04-07 00:09:44 +00:00
|
|
|
pub trait RTPBasePayloadExtManual: 'static {
|
2023-05-04 05:55:48 +00:00
|
|
|
#[cfg(feature = "v1_20")]
|
|
|
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
2022-04-07 00:09:44 +00:00
|
|
|
#[doc(alias = "gst_rtp_base_payload_set_outcaps_structure")]
|
|
|
|
#[doc(alias = "gst_rtp_base_payload_set_outcaps")]
|
|
|
|
fn set_outcaps(&self, s: Option<&gst::StructureRef>) -> Result<(), glib::error::BoolError>;
|
|
|
|
|
2022-05-05 10:24:46 +00:00
|
|
|
fn sink_pad(&self) -> &gst::Pad;
|
2022-05-03 22:04:08 +00:00
|
|
|
|
2022-05-05 10:24:46 +00:00
|
|
|
fn src_pad(&self) -> &gst::Pad;
|
2022-04-07 00:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {
|
2023-05-04 05:55:48 +00:00
|
|
|
#[cfg(feature = "v1_20")]
|
|
|
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
2022-04-07 00:09:44 +00:00
|
|
|
fn set_outcaps(&self, s: Option<&gst::StructureRef>) -> Result<(), glib::error::BoolError> {
|
|
|
|
unsafe {
|
|
|
|
glib::result_from_gboolean!(
|
|
|
|
ffi::gst_rtp_base_payload_set_outcaps_structure(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
s.as_ref()
|
|
|
|
.map(|s| s.as_ptr() as *mut _)
|
|
|
|
.unwrap_or(ptr::null_mut()),
|
|
|
|
),
|
|
|
|
"Failed to negotiate by setting outcaps structure"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-05 10:24:46 +00:00
|
|
|
fn sink_pad(&self) -> &gst::Pad {
|
2022-05-03 22:04:08 +00:00
|
|
|
unsafe {
|
2022-05-05 10:24:46 +00:00
|
|
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
|
|
|
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
2022-05-03 22:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-05 10:24:46 +00:00
|
|
|
fn src_pad(&self) -> &gst::Pad {
|
2022-05-03 22:04:08 +00:00
|
|
|
unsafe {
|
2022-05-05 10:24:46 +00:00
|
|
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
|
|
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
2022-05-03 22:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2022-04-07 00:09:44 +00:00
|
|
|
}
|