forked from mirrors/gstreamer-rs
gstreamer-base: Add get_allocator() functions to aggregator, basesrc and basetransform base classes
This commit is contained in:
parent
0651bfb51b
commit
68332e854e
3 changed files with 52 additions and 3 deletions
|
@ -18,11 +18,13 @@ use gst;
|
|||
use gst_base_sys;
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
use std::boxed::Box as Box_;
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
use std::mem::transmute;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use Aggregator;
|
||||
|
||||
pub trait AggregatorExtManual: 'static {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
|
||||
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
fn get_property_min_upstream_latency(&self) -> gst::ClockTime;
|
||||
|
@ -38,6 +40,19 @@ pub trait AggregatorExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
gst_base_sys::gst_aggregator_get_allocator(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut allocator,
|
||||
&mut params,
|
||||
);
|
||||
(from_glib_full(allocator), params.into())
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let ret: gst::FlowReturn = unsafe {
|
||||
from_glib(gst_base_sys::gst_aggregator_finish_buffer(
|
||||
|
@ -85,7 +100,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::min-upstream-latency\0".as_ptr() as *const _,
|
||||
Some(transmute(
|
||||
Some(mem::transmute(
|
||||
notify_min_upstream_latency_trampoline::<Self, F> as usize,
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -11,9 +11,13 @@ use glib::translate::*;
|
|||
use gst;
|
||||
use gst_base_sys;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use BaseSrc;
|
||||
|
||||
pub trait BaseSrcExtManual: 'static {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
|
||||
fn get_segment(&self) -> gst::Segment;
|
||||
|
||||
fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>);
|
||||
|
@ -26,6 +30,19 @@ pub trait BaseSrcExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
gst_base_sys::gst_base_src_get_allocator(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut allocator,
|
||||
&mut params,
|
||||
);
|
||||
(from_glib_full(allocator), params.into())
|
||||
}
|
||||
}
|
||||
|
||||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let src: &gst_base_sys::GstBaseSrc = &*(self.as_ptr() as *const _);
|
||||
|
|
|
@ -10,13 +10,30 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_base_sys;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use BaseTransform;
|
||||
|
||||
pub trait BaseTransformExtManual: 'static {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
|
||||
fn get_segment(&self) -> gst::Segment;
|
||||
}
|
||||
|
||||
impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
gst_base_sys::gst_base_transform_get_allocator(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut allocator,
|
||||
&mut params,
|
||||
);
|
||||
(from_glib_full(allocator), params.into())
|
||||
}
|
||||
}
|
||||
|
||||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let trans: &gst_base_sys::GstBaseTransform = &*(self.as_ptr() as *const _);
|
||||
|
|
Loading…
Reference in a new issue