Aggregator is only available from gstreamer-base since 1.14

This commit is contained in:
Sebastian Dröge 2018-07-31 00:05:15 +03:00
parent 0eb6bcf0c0
commit c7fa48984e
5 changed files with 41 additions and 1 deletions

View file

@ -19,7 +19,6 @@ generate = [
"GstBase.BaseSink",
"GstBase.BaseTransform",
"GstBase.PushSrc",
"GstBase.AggregatorPad",
]
manual = [
@ -86,12 +85,22 @@ status = "generate"
[[object]]
name = "GstBase.Aggregator"
status = "generate"
version = "1.14"
[[object.function]]
name = "finish_buffer"
# Takes ownership
ignore = true
[[object.property]]
name = "latency"
version = "1.14"
[[object]]
name = "GstBase.AggregatorPad"
status = "generate"
version = "1.14"
[[object]]
name = "GstBase.*"
status = "generate"

View file

@ -35,48 +35,59 @@ unsafe impl Send for Aggregator {}
unsafe impl Sync for Aggregator {}
pub trait AggregatorExt {
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_buffer_pool(&self) -> Option<gst::BufferPool>;
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_latency(&self) -> gst::ClockTime;
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime);
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_src_caps(&self, caps: &gst::Caps);
fn get_property_start_time(&self) -> u64;
fn set_property_start_time(&self, start_time: u64);
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Aggregator> + IsA<glib::object::Object>> AggregatorExt for O {
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
// unsafe { TODO: call ffi::gst_aggregator_get_allocator() }
//}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe {
from_glib_full(ffi::gst_aggregator_get_buffer_pool(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_latency(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_aggregator_get_latency(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
unsafe {
ffi::gst_aggregator_set_latency(self.to_glib_none().0, min_latency.to_glib(), max_latency.to_glib());
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_src_caps(&self, caps: &gst::Caps) {
unsafe {
ffi::gst_aggregator_set_src_caps(self.to_glib_none().0, caps.to_glib_none().0);
@ -97,6 +108,7 @@ impl<O: IsA<Aggregator> + IsA<glib::object::Object>> AggregatorExt for O {
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
@ -114,6 +126,7 @@ impl<O: IsA<Aggregator> + IsA<glib::object::Object>> AggregatorExt for O {
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Aggregator> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);

View file

@ -27,19 +27,24 @@ unsafe impl Send for AggregatorPad {}
unsafe impl Sync for AggregatorPad {}
pub trait AggregatorPadExt {
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn drop_buffer(&self) -> bool;
#[cfg(any(feature = "v1_14_1", feature = "dox"))]
fn has_buffer(&self) -> bool;
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn is_eos(&self) -> bool;
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn peek_buffer(&self) -> Option<gst::Buffer>;
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn pop_buffer(&self) -> Option<gst::Buffer>;
}
impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn drop_buffer(&self) -> bool {
unsafe {
from_glib(ffi::gst_aggregator_pad_drop_buffer(self.to_glib_none().0))
@ -53,18 +58,21 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn is_eos(&self) -> bool {
unsafe {
from_glib(ffi::gst_aggregator_pad_is_eos(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn peek_buffer(&self) -> Option<gst::Buffer> {
unsafe {
from_glib_full(ffi::gst_aggregator_pad_peek_buffer(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn pop_buffer(&self) -> Option<gst::Buffer> {
unsafe {
from_glib_full(ffi::gst_aggregator_pad_pop_buffer(self.to_glib_none().0))

View file

@ -5,12 +5,18 @@
mod adapter;
pub use self::adapter::Adapter;
#[cfg(any(feature = "v1_14", feature = "dox"))]
mod aggregator;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator::Aggregator;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator::AggregatorExt;
#[cfg(any(feature = "v1_14", feature = "dox"))]
mod aggregator_pad;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator_pad::AggregatorPad;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator_pad::AggregatorPadExt;
mod base_sink;
@ -32,7 +38,9 @@ pub mod functions;
#[doc(hidden)]
pub mod traits {
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use super::AggregatorExt;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use super::AggregatorPadExt;
pub use super::BaseSinkExt;
pub use super::BaseSrcExt;

View file

@ -40,6 +40,7 @@ pub use functions::*;
mod adapter;
mod flow_combiner;
pub use flow_combiner::*;
#[cfg(any(feature = "v1_14", feature = "dox"))]
mod aggregator;
mod base_sink;
mod base_src;
@ -51,6 +52,7 @@ pub mod prelude {
pub use glib::prelude::*;
pub use gst::prelude::*;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub use aggregator::AggregatorExtManual;
pub use auto::traits::*;
pub use base_sink::BaseSinkExtManual;