2023-01-03 18:58:25 +00:00
|
|
|
use glib::{object::IsA, translate::*};
|
2023-02-06 08:49:34 +00:00
|
|
|
use gst::prelude::*;
|
2023-01-03 18:58:25 +00:00
|
|
|
|
|
|
|
use crate::{auto::VideoAggregatorPad, subclass::AggregateFramesToken};
|
2022-03-21 17:18:54 +00:00
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
mod sealed {
|
|
|
|
pub trait Sealed {}
|
|
|
|
impl<T: super::IsA<super::VideoAggregatorPad>> Sealed for T {}
|
2022-03-21 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
pub trait VideoAggregatorPadExtManual: sealed::Sealed + IsA<VideoAggregatorPad> + 'static {
|
|
|
|
#[doc(alias = "gst_video_aggregator_pad_has_current_buffer")]
|
2022-03-21 17:18:54 +00:00
|
|
|
fn has_current_buffer(&self, _token: &AggregateFramesToken) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_video_aggregator_pad_has_current_buffer(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_video_aggregator_pad_get_current_buffer")]
|
2022-03-21 17:18:54 +00:00
|
|
|
fn current_buffer(&self, _token: &AggregateFramesToken) -> Option<gst::Buffer> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_none(ffi::gst_video_aggregator_pad_get_current_buffer(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_video_aggregator_pad_get_prepared_frame")]
|
2022-03-21 17:18:54 +00:00
|
|
|
fn prepared_frame<'a>(
|
|
|
|
&self,
|
|
|
|
_token: &'a AggregateFramesToken,
|
|
|
|
) -> Option<crate::VideoFrameRef<&'a gst::BufferRef>> {
|
|
|
|
unsafe {
|
|
|
|
let ptr =
|
|
|
|
ffi::gst_video_aggregator_pad_get_prepared_frame(self.as_ref().to_glib_none().0);
|
|
|
|
|
|
|
|
if ptr.is_null() {
|
|
|
|
None
|
|
|
|
} else {
|
|
|
|
Some(crate::VideoFrameRef::from_glib_borrow(ptr).into_inner())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn video_info(&self) -> Option<crate::VideoInfo> {
|
|
|
|
unsafe {
|
|
|
|
let ptr = self.as_ptr() as *mut ffi::GstVideoAggregatorPad;
|
2023-02-06 08:49:34 +00:00
|
|
|
let _guard = self.as_ref().object_lock();
|
2022-03-21 17:18:54 +00:00
|
|
|
|
|
|
|
let info = &(*ptr).info;
|
|
|
|
|
|
|
|
if info.finfo.is_null() || info.width <= 0 || info.height <= 0 {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
|
|
|
|
Some(from_glib_none(mut_override(
|
|
|
|
info as *const ffi::GstVideoInfo,
|
|
|
|
)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-05 20:21:43 +00:00
|
|
|
|
|
|
|
impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O {}
|