mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
gstreamer-base: Make virtual methods take wrapper of type, not parent
This commit is contained in:
parent
4eaf574cf8
commit
145f0ed6f5
8 changed files with 659 additions and 451 deletions
|
@ -164,18 +164,14 @@ mod fir_filter {
|
||||||
// Returns the size of one processing unit (i.e. a frame in our case) corresponding
|
// Returns the size of one processing unit (i.e. a frame in our case) corresponding
|
||||||
// to the given caps. This is used for allocating a big enough output buffer and
|
// to the given caps. This is used for allocating a big enough output buffer and
|
||||||
// sanity checking the input buffer size, among other things.
|
// sanity checking the input buffer size, among other things.
|
||||||
fn get_unit_size(
|
fn get_unit_size(&self, _element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
|
||||||
&self,
|
|
||||||
_element: &gst_base::BaseTransform,
|
|
||||||
caps: &gst::Caps,
|
|
||||||
) -> Option<usize> {
|
|
||||||
let audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
let audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
||||||
audio_info.map(|info| info.bpf() as usize)
|
audio_info.map(|info| info.bpf() as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when shutting down the element so we can release all stream-related state
|
// Called when shutting down the element so we can release all stream-related state
|
||||||
// There's also start(), which is called whenever starting the element again
|
// There's also start(), which is called whenever starting the element again
|
||||||
fn stop(&self, element: &gst_base::BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
// Drop state
|
// Drop state
|
||||||
self.history.lock().unwrap().clear();
|
self.history.lock().unwrap().clear();
|
||||||
|
|
||||||
|
@ -187,7 +183,7 @@ mod fir_filter {
|
||||||
// Does the actual transformation of the input buffer to the output buffer
|
// Does the actual transformation of the input buffer to the output buffer
|
||||||
fn transform_ip(
|
fn transform_ip(
|
||||||
&self,
|
&self,
|
||||||
element: &gst_base::BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &mut gst::BufferRef,
|
buf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
// Get coefficients and return directly if we have none
|
// Get coefficients and return directly if we have none
|
||||||
|
|
|
@ -12,6 +12,7 @@ use glib_sys;
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
|
@ -24,13 +25,13 @@ use Aggregator;
|
||||||
use AggregatorPad;
|
use AggregatorPad;
|
||||||
|
|
||||||
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
fn flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_flush(aggregator)
|
self.parent_flush(aggregator)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clip(
|
fn clip(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Option<gst::Buffer> {
|
) -> Option<gst::Buffer> {
|
||||||
|
@ -40,7 +41,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn finish_buffer_list(
|
fn finish_buffer_list(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer_list: gst::BufferList,
|
buffer_list: gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_finish_buffer_list(aggregator, buffer_list)
|
self.parent_finish_buffer_list(aggregator, buffer_list)
|
||||||
|
@ -48,7 +49,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
|
|
||||||
fn finish_buffer(
|
fn finish_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_finish_buffer(aggregator, buffer)
|
self.parent_finish_buffer(aggregator, buffer)
|
||||||
|
@ -56,7 +57,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
|
|
||||||
fn sink_event(
|
fn sink_event(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -66,7 +67,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn sink_event_pre_queue(
|
fn sink_event_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -75,7 +76,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
|
|
||||||
fn sink_query(
|
fn sink_query(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -85,24 +86,24 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn sink_query_pre_queue(
|
fn sink_query_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
self.parent_sink_query_pre_queue(aggregator, aggregator_pad, query)
|
self.parent_sink_query_pre_queue(aggregator, aggregator_pad, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool {
|
fn src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool {
|
||||||
self.parent_src_event(aggregator, event)
|
self.parent_src_event(aggregator, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool {
|
fn src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
self.parent_src_query(aggregator, query)
|
self.parent_src_query(aggregator, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn src_activate(
|
fn src_activate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
mode: gst::PadMode,
|
mode: gst::PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -111,27 +112,27 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
|
|
||||||
fn aggregate(
|
fn aggregate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
timeout: bool,
|
timeout: bool,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_aggregate(aggregator, timeout)
|
self.parent_aggregate(aggregator, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_start(aggregator)
|
self.parent_start(aggregator)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_stop(aggregator)
|
self.parent_stop(aggregator)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime {
|
fn get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
|
||||||
self.parent_get_next_time(aggregator)
|
self.parent_get_next_time(aggregator)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_new_pad(
|
fn create_new_pad(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
templ: &gst::PadTemplate,
|
templ: &gst::PadTemplate,
|
||||||
req_name: Option<&str>,
|
req_name: Option<&str>,
|
||||||
caps: Option<&gst::Caps>,
|
caps: Option<&gst::Caps>,
|
||||||
|
@ -141,65 +142,65 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
|
|
||||||
fn update_src_caps(
|
fn update_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<gst::Caps, gst::FlowError> {
|
) -> Result<gst::Caps, gst::FlowError> {
|
||||||
self.parent_update_src_caps(aggregator, caps)
|
self.parent_update_src_caps(aggregator, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps {
|
fn fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
self.parent_fixate_src_caps(aggregator, caps)
|
self.parent_fixate_src_caps(aggregator, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn negotiated_src_caps(
|
fn negotiated_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
self.parent_negotiated_src_caps(aggregator, caps)
|
self.parent_negotiated_src_caps(aggregator, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn negotiate(&self, aggregator: &Aggregator) -> bool {
|
fn negotiate(&self, aggregator: &Self::Type) -> bool {
|
||||||
self.parent_negotiate(aggregator)
|
self.parent_negotiate(aggregator)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn peek_next_sample(
|
fn peek_next_sample(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
pad: &AggregatorPad,
|
pad: &AggregatorPad,
|
||||||
) -> Option<gst::Sample> {
|
) -> Option<gst::Sample> {
|
||||||
self.parent_peek_next_sample(aggregator, pad)
|
self.parent_peek_next_sample(aggregator, pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait AggregatorImplExt {
|
pub trait AggregatorImplExt: ObjectSubclass {
|
||||||
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError>;
|
fn parent_flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_clip(
|
fn parent_clip(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Option<gst::Buffer>;
|
) -> Option<gst::Buffer>;
|
||||||
|
|
||||||
fn parent_finish_buffer(
|
fn parent_finish_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_finish_buffer_list(
|
fn parent_finish_buffer_list(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer_list: gst::BufferList,
|
buffer_list: gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_sink_event(
|
fn parent_sink_event(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
@ -207,14 +208,14 @@ pub trait AggregatorImplExt {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_sink_event_pre_queue(
|
fn parent_sink_event_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_sink_query(
|
fn parent_sink_query(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
@ -222,37 +223,37 @@ pub trait AggregatorImplExt {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_sink_query_pre_queue(
|
fn parent_sink_query_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool;
|
fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool;
|
||||||
|
|
||||||
fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool;
|
fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool;
|
||||||
|
|
||||||
fn parent_src_activate(
|
fn parent_src_activate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
mode: gst::PadMode,
|
mode: gst::PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_aggregate(
|
fn parent_aggregate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
timeout: bool,
|
timeout: bool,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage>;
|
fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage>;
|
fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime;
|
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime;
|
||||||
|
|
||||||
fn parent_create_new_pad(
|
fn parent_create_new_pad(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
templ: &gst::PadTemplate,
|
templ: &gst::PadTemplate,
|
||||||
req_name: Option<&str>,
|
req_name: Option<&str>,
|
||||||
caps: Option<&gst::Caps>,
|
caps: Option<&gst::Caps>,
|
||||||
|
@ -260,38 +261,43 @@ pub trait AggregatorImplExt {
|
||||||
|
|
||||||
fn parent_update_src_caps(
|
fn parent_update_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<gst::Caps, gst::FlowError>;
|
) -> Result<gst::Caps, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps;
|
fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps;
|
||||||
|
|
||||||
fn parent_negotiated_src_caps(
|
fn parent_negotiated_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_negotiate(&self, aggregator: &Aggregator) -> bool;
|
fn parent_negotiate(&self, aggregator: &Self::Type) -> bool;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_peek_next_sample(
|
fn parent_peek_next_sample(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
pad: &AggregatorPad,
|
pad: &AggregatorPad,
|
||||||
) -> Option<gst::Sample>;
|
) -> Option<gst::Sample>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: AggregatorImpl> AggregatorImplExt for T {
|
impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn parent_flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.flush
|
.flush
|
||||||
.map(|f| from_glib(f(aggregator.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(aggregator
|
||||||
|
.unsafe_cast_ref::<Aggregator>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
})
|
||||||
.unwrap_or(gst::FlowReturn::Ok)
|
.unwrap_or(gst::FlowReturn::Ok)
|
||||||
.into_result()
|
.into_result()
|
||||||
}
|
}
|
||||||
|
@ -299,7 +305,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
fn parent_clip(
|
fn parent_clip(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Option<gst::Buffer> {
|
) -> Option<gst::Buffer> {
|
||||||
|
@ -310,7 +316,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
match (*parent_class).clip {
|
match (*parent_class).clip {
|
||||||
None => Some(buffer),
|
None => Some(buffer),
|
||||||
Some(ref func) => from_glib_full(func(
|
Some(ref func) => from_glib_full(func(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad.to_glib_none().0,
|
||||||
buffer.into_ptr(),
|
buffer.into_ptr(),
|
||||||
)),
|
)),
|
||||||
|
@ -320,7 +326,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
fn parent_finish_buffer(
|
fn parent_finish_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -330,15 +336,18 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.finish_buffer
|
.finish_buffer
|
||||||
.expect("Missing parent function `finish_buffer`");
|
.expect("Missing parent function `finish_buffer`");
|
||||||
gst::FlowReturn::from_glib(f(aggregator.to_glib_none().0, buffer.into_ptr()))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
buffer.into_ptr(),
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_finish_buffer_list(
|
fn parent_finish_buffer_list(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
buffer_list: gst::BufferList,
|
buffer_list: gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -348,14 +357,17 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.finish_buffer_list
|
.finish_buffer_list
|
||||||
.expect("Missing parent function `finish_buffer_list`");
|
.expect("Missing parent function `finish_buffer_list`");
|
||||||
gst::FlowReturn::from_glib(f(aggregator.to_glib_none().0, buffer_list.into_ptr()))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
buffer_list.into_ptr(),
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_sink_event(
|
fn parent_sink_event(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -367,7 +379,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.sink_event
|
.sink_event
|
||||||
.expect("Missing parent function `sink_event`");
|
.expect("Missing parent function `sink_event`");
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad.to_glib_none().0,
|
||||||
event.into_ptr(),
|
event.into_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -377,7 +389,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_sink_event_pre_queue(
|
fn parent_sink_event_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
event: gst::Event,
|
event: gst::Event,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -389,7 +401,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.sink_event_pre_queue
|
.sink_event_pre_queue
|
||||||
.expect("Missing parent function `sink_event_pre_queue`");
|
.expect("Missing parent function `sink_event_pre_queue`");
|
||||||
gst::FlowReturn::from_glib(f(
|
gst::FlowReturn::from_glib(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad.to_glib_none().0,
|
||||||
event.into_ptr(),
|
event.into_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -399,7 +411,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
fn parent_sink_query(
|
fn parent_sink_query(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -411,7 +423,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.sink_query
|
.sink_query
|
||||||
.expect("Missing parent function `sink_query`");
|
.expect("Missing parent function `sink_query`");
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad.to_glib_none().0,
|
||||||
query.as_mut_ptr(),
|
query.as_mut_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -421,7 +433,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_sink_query_pre_queue(
|
fn parent_sink_query_pre_queue(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &AggregatorPad,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -433,14 +445,14 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.sink_query_pre_queue
|
.sink_query_pre_queue
|
||||||
.expect("Missing parent function `sink_query`");
|
.expect("Missing parent function `sink_query`");
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad.to_glib_none().0,
|
||||||
query.as_mut_ptr(),
|
query.as_mut_ptr(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool {
|
fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -448,11 +460,14 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.src_event
|
.src_event
|
||||||
.expect("Missing parent function `src_event`");
|
.expect("Missing parent function `src_event`");
|
||||||
from_glib(f(aggregator.to_glib_none().0, event.into_ptr()))
|
from_glib(f(
|
||||||
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
event.into_ptr(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool {
|
fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -460,13 +475,16 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.src_query
|
.src_query
|
||||||
.expect("Missing parent function `src_query`");
|
.expect("Missing parent function `src_query`");
|
||||||
from_glib(f(aggregator.to_glib_none().0, query.as_mut_ptr()))
|
from_glib(f(
|
||||||
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
query.as_mut_ptr(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_src_activate(
|
fn parent_src_activate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
mode: gst::PadMode,
|
mode: gst::PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -478,7 +496,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
None => Ok(()),
|
None => Ok(()),
|
||||||
Some(f) => gst_result_from_gboolean!(
|
Some(f) => gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
mode.to_glib(),
|
mode.to_glib(),
|
||||||
active.to_glib()
|
active.to_glib()
|
||||||
),
|
),
|
||||||
|
@ -491,7 +509,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
fn parent_aggregate(
|
fn parent_aggregate(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
timeout: bool,
|
timeout: bool,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -501,12 +519,15 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.aggregate
|
.aggregate
|
||||||
.expect("Missing parent function `aggregate`");
|
.expect("Missing parent function `aggregate`");
|
||||||
gst::FlowReturn::from_glib(f(aggregator.to_glib_none().0, timeout.to_glib()))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
timeout.to_glib(),
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -514,7 +535,11 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(aggregator.to_glib_none().0)) {
|
if from_glib(f(aggregator
|
||||||
|
.unsafe_cast_ref::<Aggregator>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -527,7 +552,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -535,7 +560,11 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(aggregator.to_glib_none().0)) {
|
if from_glib(f(aggregator
|
||||||
|
.unsafe_cast_ref::<Aggregator>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -548,21 +577,26 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime {
|
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_next_time
|
.get_next_time
|
||||||
.map(|f| from_glib(f(aggregator.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(aggregator
|
||||||
|
.unsafe_cast_ref::<Aggregator>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
})
|
||||||
.unwrap_or(gst::CLOCK_TIME_NONE)
|
.unwrap_or(gst::CLOCK_TIME_NONE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_create_new_pad(
|
fn parent_create_new_pad(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
templ: &gst::PadTemplate,
|
templ: &gst::PadTemplate,
|
||||||
req_name: Option<&str>,
|
req_name: Option<&str>,
|
||||||
caps: Option<&gst::Caps>,
|
caps: Option<&gst::Caps>,
|
||||||
|
@ -575,7 +609,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.create_new_pad
|
.create_new_pad
|
||||||
.expect("Missing parent function `create_new_pad`");
|
.expect("Missing parent function `create_new_pad`");
|
||||||
from_glib_full(f(
|
from_glib_full(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
templ.to_glib_none().0,
|
templ.to_glib_none().0,
|
||||||
req_name.to_glib_none().0,
|
req_name.to_glib_none().0,
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
|
@ -585,7 +619,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
fn parent_update_src_caps(
|
fn parent_update_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<gst::Caps, gst::FlowError> {
|
) -> Result<gst::Caps, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -598,7 +632,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
|
|
||||||
let mut out_caps = ptr::null_mut();
|
let mut out_caps = ptr::null_mut();
|
||||||
gst::FlowReturn::from_glib(f(
|
gst::FlowReturn::from_glib(f(
|
||||||
aggregator.to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
caps.as_mut_ptr(),
|
caps.as_mut_ptr(),
|
||||||
&mut out_caps,
|
&mut out_caps,
|
||||||
))
|
))
|
||||||
|
@ -606,7 +640,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps {
|
fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -615,13 +649,16 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.fixate_src_caps
|
.fixate_src_caps
|
||||||
.expect("Missing parent function `fixate_src_caps`");
|
.expect("Missing parent function `fixate_src_caps`");
|
||||||
from_glib_full(f(aggregator.to_glib_none().0, caps.into_ptr()))
|
from_glib_full(f(
|
||||||
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
caps.into_ptr(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_negotiated_src_caps(
|
fn parent_negotiated_src_caps(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -632,7 +669,10 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
.negotiated_src_caps
|
.negotiated_src_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(aggregator.to_glib_none().0, caps.to_glib_none().0),
|
f(
|
||||||
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
caps.to_glib_none().0
|
||||||
|
),
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
"Parent function `negotiated_src_caps` failed"
|
"Parent function `negotiated_src_caps` failed"
|
||||||
)
|
)
|
||||||
|
@ -642,14 +682,19 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_negotiate(&self, aggregator: &Aggregator) -> bool {
|
fn parent_negotiate(&self, aggregator: &Self::Type) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.negotiate
|
.negotiate
|
||||||
.map(|f| from_glib(f(aggregator.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(aggregator
|
||||||
|
.unsafe_cast_ref::<Aggregator>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
})
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -657,7 +702,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
fn parent_peek_next_sample(
|
fn parent_peek_next_sample(
|
||||||
&self,
|
&self,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Self::Type,
|
||||||
pad: &AggregatorPad,
|
pad: &AggregatorPad,
|
||||||
) -> Option<gst::Sample> {
|
) -> Option<gst::Sample> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -666,7 +711,12 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.peek_next_sample
|
.peek_next_sample
|
||||||
.map(|f| from_glib_full(f(aggregator.to_glib_none().0, pad.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib_full(f(
|
||||||
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
|
pad.to_glib_none().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(None)
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -717,7 +767,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.flush(&wrap).into()
|
imp.flush(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -736,7 +786,7 @@ where
|
||||||
|
|
||||||
let ret = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
let ret = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.clip(
|
imp.clip(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
from_glib_full(buffer),
|
from_glib_full(buffer),
|
||||||
)
|
)
|
||||||
|
@ -757,7 +807,8 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish_buffer(&wrap, from_glib_full(buffer)).into()
|
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
|
||||||
|
.into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -775,7 +826,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish_buffer_list(&wrap, from_glib_full(buffer_list))
|
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -793,9 +844,9 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(wrap, &instance.panicked(), false, {
|
||||||
imp.sink_event(
|
imp.sink_event(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
from_glib_full(event),
|
from_glib_full(event),
|
||||||
)
|
)
|
||||||
|
@ -818,7 +869,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.sink_event_pre_queue(
|
imp.sink_event_pre_queue(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
from_glib_full(event),
|
from_glib_full(event),
|
||||||
)
|
)
|
||||||
|
@ -841,7 +892,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_query(
|
imp.sink_query(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
gst::QueryRef::from_mut_ptr(query),
|
gst::QueryRef::from_mut_ptr(query),
|
||||||
)
|
)
|
||||||
|
@ -864,7 +915,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_query_pre_queue(
|
imp.sink_query_pre_queue(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
gst::QueryRef::from_mut_ptr(query),
|
gst::QueryRef::from_mut_ptr(query),
|
||||||
)
|
)
|
||||||
|
@ -884,7 +935,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_event(&wrap, from_glib_full(event))
|
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -901,7 +952,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_query(&wrap, gst::QueryRef::from_mut_ptr(query))
|
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -919,7 +970,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.src_activate(&wrap, from_glib(mode), from_glib(active)) {
|
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -942,7 +993,8 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.aggregate(&wrap, from_glib(timeout)).into()
|
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
|
||||||
|
.into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -958,7 +1010,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(&wrap) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -980,7 +1032,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(&wrap) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -1002,7 +1054,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
|
||||||
imp.get_next_time(&wrap)
|
imp.get_next_time(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1076,7 @@ where
|
||||||
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
|
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
|
||||||
|
|
||||||
imp.create_new_pad(
|
imp.create_new_pad(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(templ),
|
&from_glib_borrow(templ),
|
||||||
req_name.as_ref().as_ref().map(|s| s.as_str()),
|
req_name.as_ref().as_ref().map(|s| s.as_str()),
|
||||||
Option::<gst::Caps>::from_glib_borrow(caps)
|
Option::<gst::Caps>::from_glib_borrow(caps)
|
||||||
|
@ -1050,7 +1102,7 @@ where
|
||||||
*res = ptr::null_mut();
|
*res = ptr::null_mut();
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.update_src_caps(&wrap, &from_glib_borrow(caps)) {
|
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Ok(res_caps) => {
|
Ok(res_caps) => {
|
||||||
*res = res_caps.into_ptr();
|
*res = res_caps.into_ptr();
|
||||||
gst::FlowReturn::Ok
|
gst::FlowReturn::Ok
|
||||||
|
@ -1073,7 +1125,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate_src_caps(&wrap, from_glib_full(caps))
|
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1142,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.negotiated_src_caps(&wrap, &from_glib_borrow(caps)) {
|
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -1112,7 +1164,10 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, { imp.negotiate(&wrap) }).to_glib()
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
|
imp.negotiate(wrap.unsafe_cast_ref())
|
||||||
|
})
|
||||||
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
@ -1128,7 +1183,7 @@ where
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.peek_next_sample(&wrap, &from_glib_borrow(pad))
|
imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad))
|
||||||
})
|
})
|
||||||
.to_glib_full()
|
.to_glib_full()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,11 @@ use glib_sys;
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::prelude::*;
|
||||||
use gst;
|
|
||||||
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
use gst;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use Aggregator;
|
use Aggregator;
|
||||||
|
@ -22,7 +23,7 @@ use AggregatorPad;
|
||||||
pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
||||||
fn flush(
|
fn flush(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_flush(aggregator_pad, aggregator)
|
self.parent_flush(aggregator_pad, aggregator)
|
||||||
|
@ -30,7 +31,7 @@ pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
||||||
|
|
||||||
fn skip_buffer(
|
fn skip_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -38,16 +39,16 @@ pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait AggregatorPadImplExt {
|
pub trait AggregatorPadImplExt: ObjectSubclass {
|
||||||
fn parent_flush(
|
fn parent_flush(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_skip_buffer(
|
fn parent_skip_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
@ -56,7 +57,7 @@ pub trait AggregatorPadImplExt {
|
||||||
impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
||||||
fn parent_flush(
|
fn parent_flush(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -67,7 +68,10 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
||||||
.flush
|
.flush
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad
|
||||||
|
.unsafe_cast_ref::<AggregatorPad>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0,
|
||||||
aggregator.to_glib_none().0,
|
aggregator.to_glib_none().0,
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
|
@ -78,7 +82,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
||||||
|
|
||||||
fn parent_skip_buffer(
|
fn parent_skip_buffer(
|
||||||
&self,
|
&self,
|
||||||
aggregator_pad: &AggregatorPad,
|
aggregator_pad: &Self::Type,
|
||||||
aggregator: &Aggregator,
|
aggregator: &Aggregator,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -90,7 +94,10 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
||||||
.skip_buffer
|
.skip_buffer
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
aggregator_pad.to_glib_none().0,
|
aggregator_pad
|
||||||
|
.unsafe_cast_ref::<AggregatorPad>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0,
|
||||||
aggregator.to_glib_none().0,
|
aggregator.to_glib_none().0,
|
||||||
buffer.to_glib_none().0,
|
buffer.to_glib_none().0,
|
||||||
))
|
))
|
||||||
|
@ -116,7 +123,9 @@ unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let res: gst::FlowReturn = imp.flush(&wrap, &from_glib_borrow(aggregator)).into();
|
let res: gst::FlowReturn = imp
|
||||||
|
.flush(wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator))
|
||||||
|
.into();
|
||||||
res.to_glib()
|
res.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +139,7 @@ unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>(
|
||||||
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
imp.skip_buffer(
|
imp.skip_buffer(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator),
|
&from_glib_borrow(aggregator),
|
||||||
&from_glib_borrow(buffer),
|
&from_glib_borrow(buffer),
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,10 +12,11 @@ use gst_sys;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use glib::translate::*;
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
|
@ -23,17 +24,17 @@ use BaseParse;
|
||||||
use BaseParseFrame;
|
use BaseParseFrame;
|
||||||
|
|
||||||
pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
||||||
fn start(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_start(element)
|
self.parent_start(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_stop(element)
|
self.parent_stop(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_sink_caps(
|
fn set_sink_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::ErrorMessage> {
|
) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_set_sink_caps(element, caps)
|
self.parent_set_sink_caps(element, caps)
|
||||||
|
@ -41,7 +42,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
||||||
|
|
||||||
fn handle_frame<'a>(
|
fn handle_frame<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
frame: BaseParseFrame,
|
frame: BaseParseFrame,
|
||||||
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
||||||
self.parent_handle_frame(element, frame)
|
self.parent_handle_frame(element, frame)
|
||||||
|
@ -49,7 +50,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
||||||
|
|
||||||
fn convert<V: Into<gst::GenericFormattedValue>>(
|
fn convert<V: Into<gst::GenericFormattedValue>>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
src_val: V,
|
src_val: V,
|
||||||
dest_format: gst::Format,
|
dest_format: gst::Format,
|
||||||
) -> Option<gst::GenericFormattedValue> {
|
) -> Option<gst::GenericFormattedValue> {
|
||||||
|
@ -57,33 +58,33 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BaseParseImplExt {
|
pub trait BaseParseImplExt: ObjectSubclass {
|
||||||
fn parent_start(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage>;
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage>;
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_set_sink_caps(
|
fn parent_set_sink_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::ErrorMessage>;
|
) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_handle_frame<'a>(
|
fn parent_handle_frame<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
frame: BaseParseFrame,
|
frame: BaseParseFrame,
|
||||||
) -> Result<(gst::FlowSuccess, u32), gst::FlowError>;
|
) -> Result<(gst::FlowSuccess, u32), gst::FlowError>;
|
||||||
|
|
||||||
fn parent_convert<V: Into<gst::GenericFormattedValue>>(
|
fn parent_convert<V: Into<gst::GenericFormattedValue>>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
src_val: V,
|
src_val: V,
|
||||||
dest_format: gst::Format,
|
dest_format: gst::Format,
|
||||||
) -> Option<gst::GenericFormattedValue>;
|
) -> Option<gst::GenericFormattedValue>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: BaseParseImpl> BaseParseImplExt for T {
|
impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
fn parent_start(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -91,7 +92,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -104,7 +105,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -112,7 +113,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -127,7 +128,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
|
|
||||||
fn parent_set_sink_caps(
|
fn parent_set_sink_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::ErrorMessage> {
|
) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -137,7 +138,10 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.set_sink_caps
|
.set_sink_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0, caps.to_glib_none().0)) {
|
if from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseParse>().to_glib_none().0,
|
||||||
|
caps.to_glib_none().0,
|
||||||
|
)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -152,7 +156,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
|
|
||||||
fn parent_handle_frame<'a>(
|
fn parent_handle_frame<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
element: &'a BaseParse,
|
element: &'a Self::Type,
|
||||||
frame: BaseParseFrame,
|
frame: BaseParseFrame,
|
||||||
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -162,7 +166,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
let mut skipsize = 0;
|
let mut skipsize = 0;
|
||||||
let res = (*parent_class).handle_frame.map(|f| {
|
let res = (*parent_class).handle_frame.map(|f| {
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseParse>().to_glib_none().0,
|
||||||
frame.to_glib_none().0,
|
frame.to_glib_none().0,
|
||||||
&mut skipsize,
|
&mut skipsize,
|
||||||
));
|
));
|
||||||
|
@ -181,7 +185,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
|
|
||||||
fn parent_convert<V: Into<gst::GenericFormattedValue>>(
|
fn parent_convert<V: Into<gst::GenericFormattedValue>>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseParse,
|
element: &Self::Type,
|
||||||
src_val: V,
|
src_val: V,
|
||||||
dest_format: gst::Format,
|
dest_format: gst::Format,
|
||||||
) -> Option<gst::GenericFormattedValue> {
|
) -> Option<gst::GenericFormattedValue> {
|
||||||
|
@ -194,7 +198,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
let mut dest_val = mem::MaybeUninit::uninit();
|
let mut dest_val = mem::MaybeUninit::uninit();
|
||||||
|
|
||||||
let res = from_glib(f(
|
let res = from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseParse>().to_glib_none().0,
|
||||||
src_val.get_format().to_glib(),
|
src_val.get_format().to_glib(),
|
||||||
src_val.to_raw_value(),
|
src_val.to_raw_value(),
|
||||||
dest_format.to_glib(),
|
dest_format.to_glib(),
|
||||||
|
@ -240,7 +244,7 @@ where
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(&wrap) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -262,7 +266,7 @@ where
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(&wrap) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -286,7 +290,7 @@ where
|
||||||
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
|
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_sink_caps(&wrap, &caps) {
|
match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -311,7 +315,7 @@ where
|
||||||
let wrap_frame = BaseParseFrame::new(frame, &wrap);
|
let wrap_frame = BaseParseFrame::new(frame, &wrap);
|
||||||
|
|
||||||
let res = gst_panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), {
|
let res = gst_panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), {
|
||||||
imp.handle_frame(&wrap, wrap_frame)
|
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
|
||||||
});
|
});
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
|
@ -340,7 +344,7 @@ where
|
||||||
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
|
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
|
||||||
|
|
||||||
let res = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
let res = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.convert(&wrap, source, from_glib(dest_format))
|
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
|
||||||
});
|
});
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
|
|
|
@ -10,6 +10,7 @@ use glib_sys;
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
|
@ -21,17 +22,17 @@ use std::ptr;
|
||||||
use BaseSink;
|
use BaseSink;
|
||||||
|
|
||||||
pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
||||||
fn start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_start(element)
|
self.parent_start(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_stop(element)
|
self.parent_stop(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_render(element, buffer)
|
self.parent_render(element, buffer)
|
||||||
|
@ -39,7 +40,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
||||||
|
|
||||||
fn prepare(
|
fn prepare(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_prepare(element, buffer)
|
self.parent_prepare(element, buffer)
|
||||||
|
@ -47,7 +48,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
||||||
|
|
||||||
fn render_list(
|
fn render_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_render_list(element, list)
|
self.parent_render_list(element, list)
|
||||||
|
@ -55,91 +56,95 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
||||||
|
|
||||||
fn prepare_list(
|
fn prepare_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_prepare_list(element, list)
|
self.parent_prepare_list(element, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool {
|
fn query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
BaseSinkImplExt::parent_query(self, element, query)
|
BaseSinkImplExt::parent_query(self, element, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn event(&self, element: &BaseSink, event: gst::Event) -> bool {
|
fn event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
self.parent_event(element, event)
|
self.parent_event(element, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_caps(&self, element: &BaseSink, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||||
self.parent_get_caps(element, filter)
|
self.parent_get_caps(element, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_caps(&self, element: &BaseSink, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
|
fn set_caps(&self, element: &Self::Type, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
|
||||||
self.parent_set_caps(element, caps)
|
self.parent_set_caps(element, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps {
|
fn fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
self.parent_fixate(element, caps)
|
self.parent_fixate(element, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_unlock(element)
|
self.parent_unlock(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_unlock_stop(element)
|
self.parent_unlock_stop(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BaseSinkImplExt {
|
pub trait BaseSinkImplExt: ObjectSubclass {
|
||||||
fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage>;
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage>;
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_render(
|
fn parent_render(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_prepare(
|
fn parent_prepare(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_render_list(
|
fn parent_render_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_prepare_list(
|
fn parent_prepare_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool;
|
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool;
|
||||||
|
|
||||||
fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool;
|
fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool;
|
||||||
|
|
||||||
fn parent_get_caps(&self, element: &BaseSink, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
|
fn parent_get_caps(
|
||||||
|
&self,
|
||||||
|
element: &Self::Type,
|
||||||
|
filter: Option<&gst::Caps>,
|
||||||
|
) -> Option<gst::Caps>;
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps;
|
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps;
|
||||||
|
|
||||||
fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage>;
|
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage>;
|
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -147,7 +152,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -160,7 +165,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -168,7 +173,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -183,7 +188,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
|
|
||||||
fn parent_render(
|
fn parent_render(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -193,7 +198,10 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.render
|
.render
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, buffer.to_glib_none().0))
|
gst::FlowReturn::from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
buffer.to_glib_none().0,
|
||||||
|
))
|
||||||
})
|
})
|
||||||
.unwrap_or(gst::FlowReturn::Ok)
|
.unwrap_or(gst::FlowReturn::Ok)
|
||||||
.into_result()
|
.into_result()
|
||||||
|
@ -202,7 +210,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
|
|
||||||
fn parent_prepare(
|
fn parent_prepare(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -211,7 +219,12 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.prepare
|
.prepare
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, buffer.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
buffer.to_glib_none().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(gst::FlowReturn::Ok)
|
.unwrap_or(gst::FlowReturn::Ok)
|
||||||
.into_result()
|
.into_result()
|
||||||
}
|
}
|
||||||
|
@ -219,7 +232,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
|
|
||||||
fn parent_render_list(
|
fn parent_render_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -229,8 +242,11 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.render_list
|
.render_list
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, list.to_glib_none().0))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
list.to_glib_none().0,
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
for buffer in list.iter() {
|
for buffer in list.iter() {
|
||||||
|
@ -243,7 +259,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
|
|
||||||
fn parent_prepare_list(
|
fn parent_prepare_list(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
list: &gst::BufferList,
|
list: &gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -253,8 +269,11 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.prepare_list
|
.prepare_list
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, list.to_glib_none().0))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
list.to_glib_none().0,
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
for buffer in list.iter() {
|
for buffer in list.iter() {
|
||||||
|
@ -265,31 +284,45 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool {
|
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.query
|
.query
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr())))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
query.as_mut_ptr(),
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool {
|
fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.event
|
.event
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
event.into_ptr(),
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_get_caps(&self, element: &BaseSink, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
fn parent_get_caps(
|
||||||
|
&self,
|
||||||
|
element: &Self::Type,
|
||||||
|
filter: Option<&gst::Caps>,
|
||||||
|
) -> Option<gst::Caps> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -297,14 +330,19 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_caps
|
.get_caps
|
||||||
.map(|f| from_glib_full(f(element.to_glib_none().0, filter.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib_full(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
filter.to_glib_none().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(None)
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSink,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -315,7 +353,10 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
.set_caps
|
.set_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(element.to_glib_none().0, caps.to_glib_none().0),
|
f(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
caps.to_glib_none().0
|
||||||
|
),
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
"Parent function `set_caps` failed"
|
"Parent function `set_caps` failed"
|
||||||
)
|
)
|
||||||
|
@ -324,20 +365,23 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps {
|
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
||||||
|
|
||||||
match (*parent_class).fixate {
|
match (*parent_class).fixate {
|
||||||
Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())),
|
Some(fixate) => from_glib_full(fixate(
|
||||||
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
|
caps.into_ptr(),
|
||||||
|
)),
|
||||||
None => caps,
|
None => caps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -345,7 +389,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock
|
.unlock
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -358,7 +402,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -366,7 +410,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock_stop
|
.unlock_stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -414,7 +458,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(&wrap) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -436,7 +480,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(&wrap) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -460,7 +504,7 @@ where
|
||||||
let buffer = from_glib_borrow(buffer);
|
let buffer = from_glib_borrow(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.render(&wrap, &buffer).into()
|
imp.render(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -478,7 +522,7 @@ where
|
||||||
let buffer = from_glib_borrow(buffer);
|
let buffer = from_glib_borrow(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.prepare(&wrap, &buffer).into()
|
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -496,7 +540,7 @@ where
|
||||||
let list = from_glib_borrow(list);
|
let list = from_glib_borrow(list);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.render_list(&wrap, &list).into()
|
imp.render_list(wrap.unsafe_cast_ref(), &list).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -514,7 +558,7 @@ where
|
||||||
let list = from_glib_borrow(list);
|
let list = from_glib_borrow(list);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.prepare_list(&wrap, &list).into()
|
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -532,7 +576,7 @@ where
|
||||||
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseSinkImpl::query(imp, &wrap, query)
|
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -549,7 +593,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.event(&wrap, from_glib_full(event_ptr))
|
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -567,7 +611,7 @@ where
|
||||||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.get_caps(&wrap, filter.as_ref().as_ref())
|
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||||
})
|
})
|
||||||
.map(|caps| caps.into_ptr())
|
.map(|caps| caps.into_ptr())
|
||||||
.unwrap_or(ptr::null_mut())
|
.unwrap_or(ptr::null_mut())
|
||||||
|
@ -586,7 +630,7 @@ where
|
||||||
let caps = from_glib_borrow(caps);
|
let caps = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(&wrap, &caps) {
|
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -610,7 +654,7 @@ where
|
||||||
let caps = from_glib_full(caps);
|
let caps = from_glib_full(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(&wrap, caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
@ -626,7 +670,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock(&wrap) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -648,7 +692,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock_stop(&wrap) {
|
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
|
|
@ -10,6 +10,7 @@ use glib_sys;
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
|
@ -28,25 +29,25 @@ pub enum CreateSuccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
||||||
fn start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_start(element)
|
self.parent_start(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_stop(element)
|
self.parent_stop(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_seekable(&self, element: &BaseSrc) -> bool {
|
fn is_seekable(&self, element: &Self::Type) -> bool {
|
||||||
self.parent_is_seekable(element)
|
self.parent_is_seekable(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_size(&self, element: &BaseSrc) -> Option<u64> {
|
fn get_size(&self, element: &Self::Type) -> Option<u64> {
|
||||||
self.parent_get_size(element)
|
self.parent_get_size(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_times(
|
fn get_times(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
buffer: &gst::BufferRef,
|
buffer: &gst::BufferRef,
|
||||||
) -> (gst::ClockTime, gst::ClockTime) {
|
) -> (gst::ClockTime, gst::ClockTime) {
|
||||||
self.parent_get_times(element, buffer)
|
self.parent_get_times(element, buffer)
|
||||||
|
@ -54,7 +55,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
||||||
|
|
||||||
fn fill(
|
fn fill(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
|
@ -64,7 +65,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
||||||
|
|
||||||
fn alloc(
|
fn alloc(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
) -> Result<gst::Buffer, gst::FlowError> {
|
) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
|
@ -73,7 +74,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
||||||
|
|
||||||
fn create(
|
fn create(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
buffer: Option<&mut gst::BufferRef>,
|
buffer: Option<&mut gst::BufferRef>,
|
||||||
length: u32,
|
length: u32,
|
||||||
|
@ -81,61 +82,61 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
||||||
self.parent_create(element, offset, buffer, length)
|
self.parent_create(element, offset, buffer, length)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool {
|
fn do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> bool {
|
||||||
self.parent_do_seek(element, segment)
|
self.parent_do_seek(element, segment)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool {
|
fn query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
BaseSrcImplExt::parent_query(self, element, query)
|
BaseSrcImplExt::parent_query(self, element, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn event(&self, element: &BaseSrc, event: &gst::Event) -> bool {
|
fn event(&self, element: &Self::Type, event: &gst::Event) -> bool {
|
||||||
self.parent_event(element, event)
|
self.parent_event(element, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_caps(&self, element: &BaseSrc, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||||
self.parent_get_caps(element, filter)
|
self.parent_get_caps(element, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> {
|
fn negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> {
|
||||||
self.parent_negotiate(element)
|
self.parent_negotiate(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_caps(&self, element: &BaseSrc, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
|
fn set_caps(&self, element: &Self::Type, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
|
||||||
self.parent_set_caps(element, caps)
|
self.parent_set_caps(element, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps {
|
fn fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
self.parent_fixate(element, caps)
|
self.parent_fixate(element, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_unlock(element)
|
self.parent_unlock(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_unlock_stop(element)
|
self.parent_unlock_stop(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BaseSrcImplExt {
|
pub trait BaseSrcImplExt: ObjectSubclass {
|
||||||
fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage>;
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage>;
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_is_seekable(&self, element: &BaseSrc) -> bool;
|
fn parent_is_seekable(&self, element: &Self::Type) -> bool;
|
||||||
|
|
||||||
fn parent_get_size(&self, element: &BaseSrc) -> Option<u64>;
|
fn parent_get_size(&self, element: &Self::Type) -> Option<u64>;
|
||||||
|
|
||||||
fn parent_get_times(
|
fn parent_get_times(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
buffer: &gst::BufferRef,
|
buffer: &gst::BufferRef,
|
||||||
) -> (gst::ClockTime, gst::ClockTime);
|
) -> (gst::ClockTime, gst::ClockTime);
|
||||||
|
|
||||||
fn parent_fill(
|
fn parent_fill(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
|
@ -143,44 +144,48 @@ pub trait BaseSrcImplExt {
|
||||||
|
|
||||||
fn parent_alloc(
|
fn parent_alloc(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
) -> Result<gst::Buffer, gst::FlowError>;
|
) -> Result<gst::Buffer, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_create(
|
fn parent_create(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
buffer: Option<&mut gst::BufferRef>,
|
buffer: Option<&mut gst::BufferRef>,
|
||||||
length: u32,
|
length: u32,
|
||||||
) -> Result<CreateSuccess, gst::FlowError>;
|
) -> Result<CreateSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool;
|
fn parent_do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> bool;
|
||||||
|
|
||||||
fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool;
|
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool;
|
||||||
|
|
||||||
fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool;
|
fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool;
|
||||||
|
|
||||||
fn parent_get_caps(&self, element: &BaseSrc, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
|
fn parent_get_caps(
|
||||||
|
&self,
|
||||||
|
element: &Self::Type,
|
||||||
|
filter: Option<&gst::Caps>,
|
||||||
|
) -> Option<gst::Caps>;
|
||||||
|
|
||||||
fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError>;
|
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps;
|
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps;
|
||||||
|
|
||||||
fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage>;
|
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage>;
|
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -188,7 +193,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -201,7 +206,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -209,7 +214,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -222,19 +227,19 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_is_seekable(&self, element: &BaseSrc) -> bool {
|
fn parent_is_seekable(&self, element: &Self::Type) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.is_seekable
|
.is_seekable
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0)))
|
.map(|f| from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_get_size(&self, element: &BaseSrc) -> Option<u64> {
|
fn parent_get_size(&self, element: &Self::Type) -> Option<u64> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -243,7 +248,10 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
.get_size
|
.get_size
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut size = mem::MaybeUninit::uninit();
|
let mut size = mem::MaybeUninit::uninit();
|
||||||
if from_glib(f(element.to_glib_none().0, size.as_mut_ptr())) {
|
if from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
size.as_mut_ptr(),
|
||||||
|
)) {
|
||||||
Some(size.assume_init())
|
Some(size.assume_init())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -255,7 +263,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
fn parent_get_times(
|
fn parent_get_times(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
buffer: &gst::BufferRef,
|
buffer: &gst::BufferRef,
|
||||||
) -> (gst::ClockTime, gst::ClockTime) {
|
) -> (gst::ClockTime, gst::ClockTime) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -268,7 +276,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
let mut start = mem::MaybeUninit::uninit();
|
let mut start = mem::MaybeUninit::uninit();
|
||||||
let mut stop = mem::MaybeUninit::uninit();
|
let mut stop = mem::MaybeUninit::uninit();
|
||||||
f(
|
f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
start.as_mut_ptr(),
|
start.as_mut_ptr(),
|
||||||
stop.as_mut_ptr(),
|
stop.as_mut_ptr(),
|
||||||
|
@ -284,7 +292,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
fn parent_fill(
|
fn parent_fill(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
|
@ -297,7 +305,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
.fill
|
.fill
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst::FlowReturn::from_glib(f(
|
gst::FlowReturn::from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
offset,
|
offset,
|
||||||
length,
|
length,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
@ -310,7 +318,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
fn parent_alloc(
|
fn parent_alloc(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
) -> Result<gst::Buffer, gst::FlowError> {
|
) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
|
@ -328,7 +336,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
offset,
|
offset,
|
||||||
length,
|
length,
|
||||||
buffer_ref,
|
buffer_ref,
|
||||||
|
@ -341,7 +349,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
fn parent_create(
|
fn parent_create(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
mut buffer: Option<&mut gst::BufferRef>,
|
mut buffer: Option<&mut gst::BufferRef>,
|
||||||
length: u32,
|
length: u32,
|
||||||
|
@ -365,7 +373,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
gst::FlowReturn::from_glib(
|
gst::FlowReturn::from_glib(
|
||||||
f(
|
f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
offset,
|
offset,
|
||||||
length,
|
length,
|
||||||
buffer_ref,
|
buffer_ref,
|
||||||
|
@ -378,7 +386,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
gst::CAT_PERFORMANCE,
|
gst::CAT_PERFORMANCE,
|
||||||
obj: element,
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Returned new buffer from parent create function, copying into passed buffer"
|
"Returned new buffer from parent create function, copying into passed buffer"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -387,7 +395,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: element,
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Failed to map passed buffer writable"
|
"Failed to map passed buffer writable"
|
||||||
);
|
);
|
||||||
return Err(gst::FlowError::Error);
|
return Err(gst::FlowError::Error);
|
||||||
|
@ -406,7 +414,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: element,
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Failed to copy buffer metadata"
|
"Failed to copy buffer metadata"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -424,43 +432,62 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool {
|
fn parent_do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.do_seek
|
.do_seek
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, segment.to_glib_none_mut().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
segment.to_glib_none_mut().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool {
|
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.query
|
.query
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr())))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
query.as_mut_ptr(),
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool {
|
fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.event
|
.event
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, event.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
event.to_glib_none().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_get_caps(&self, element: &BaseSrc, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
fn parent_get_caps(
|
||||||
|
&self,
|
||||||
|
element: &Self::Type,
|
||||||
|
filter: Option<&gst::Caps>,
|
||||||
|
) -> Option<gst::Caps> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -468,12 +495,17 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_caps
|
.get_caps
|
||||||
.map(|f| from_glib_full(f(element.to_glib_none().0, filter.to_glib_none().0)))
|
.map(|f| {
|
||||||
|
from_glib_full(f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
filter.to_glib_none().0,
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(None)
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> {
|
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -482,7 +514,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
.negotiate
|
.negotiate
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(element.to_glib_none().0),
|
f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0),
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
"Parent function `negotiate` failed"
|
"Parent function `negotiate` failed"
|
||||||
)
|
)
|
||||||
|
@ -493,7 +525,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseSrc,
|
element: &Self::Type,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -504,7 +536,10 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
.set_caps
|
.set_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(element.to_glib_none().0, caps.to_glib_none().0),
|
f(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
caps.to_glib_none().0
|
||||||
|
),
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
"Parent function `set_caps` failed"
|
"Parent function `set_caps` failed"
|
||||||
)
|
)
|
||||||
|
@ -513,20 +548,23 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps {
|
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
||||||
|
|
||||||
match (*parent_class).fixate {
|
match (*parent_class).fixate {
|
||||||
Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())),
|
Some(fixate) => from_glib_full(fixate(
|
||||||
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
caps.into_ptr(),
|
||||||
|
)),
|
||||||
None => caps,
|
None => caps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -534,7 +572,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock
|
.unlock
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -547,7 +585,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -555,7 +593,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock_stop
|
.unlock_stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -607,7 +645,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(&wrap) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -629,7 +667,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(&wrap) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -651,7 +689,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.is_seekable(&wrap)
|
imp.is_seekable(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -668,7 +706,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.get_size(&wrap) {
|
match imp.get_size(wrap.unsafe_cast_ref()) {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
*size = s;
|
*size = s;
|
||||||
true
|
true
|
||||||
|
@ -696,7 +734,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
*stop = gst_sys::GST_CLOCK_TIME_NONE;
|
*stop = gst_sys::GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
||||||
let (start_, stop_) = imp.get_times(&wrap, buffer);
|
let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer);
|
||||||
*start = start_.to_glib();
|
*start = start_.to_glib();
|
||||||
*stop = stop_.to_glib();
|
*stop = stop_.to_glib();
|
||||||
});
|
});
|
||||||
|
@ -717,7 +755,8 @@ where
|
||||||
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.fill(&wrap, offset, length, buffer).into()
|
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
|
||||||
|
.into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -739,7 +778,7 @@ where
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.alloc(&wrap, offset, length) {
|
match imp.alloc(wrap.unsafe_cast_ref(), offset, length) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
gst::FlowReturn::Ok
|
gst::FlowReturn::Ok
|
||||||
|
@ -773,7 +812,12 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.create(&wrap, offset, buffer.as_deref_mut(), length) {
|
match imp.create(
|
||||||
|
wrap.unsafe_cast_ref(),
|
||||||
|
offset,
|
||||||
|
buffer.as_deref_mut(),
|
||||||
|
length,
|
||||||
|
) {
|
||||||
Ok(CreateSuccess::NewBuffer(new_buffer)) => {
|
Ok(CreateSuccess::NewBuffer(new_buffer)) => {
|
||||||
if let Some(passed_buffer) = buffer {
|
if let Some(passed_buffer) = buffer {
|
||||||
if passed_buffer.as_ptr() != new_buffer.as_ptr() {
|
if passed_buffer.as_ptr() != new_buffer.as_ptr() {
|
||||||
|
@ -847,7 +891,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
let mut s = from_glib_none(segment);
|
let mut s = from_glib_none(segment);
|
||||||
let res = imp.do_seek(&wrap, &mut s);
|
let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s);
|
||||||
ptr::write(segment, *(s.to_glib_none().0));
|
ptr::write(segment, *(s.to_glib_none().0));
|
||||||
|
|
||||||
res
|
res
|
||||||
|
@ -868,7 +912,7 @@ where
|
||||||
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseSrcImpl::query(imp, &wrap, query)
|
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -885,7 +929,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.event(&wrap, &from_glib_borrow(event_ptr))
|
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -903,7 +947,7 @@ where
|
||||||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.get_caps(&wrap, filter.as_ref().as_ref())
|
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||||
})
|
})
|
||||||
.map(|caps| caps.into_ptr())
|
.map(|caps| caps.into_ptr())
|
||||||
.unwrap_or(ptr::null_mut())
|
.unwrap_or(ptr::null_mut())
|
||||||
|
@ -920,7 +964,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.negotiate(&wrap) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -944,7 +988,7 @@ where
|
||||||
let caps = from_glib_borrow(caps);
|
let caps = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(&wrap, &caps) {
|
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -968,7 +1012,7 @@ where
|
||||||
let caps = from_glib_full(caps);
|
let caps = from_glib_full(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(&wrap, caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
@ -984,7 +1028,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock(&wrap) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -1006,7 +1050,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock_stop(&wrap) {
|
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
|
|
@ -10,10 +10,11 @@ use glib_sys;
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
use glib::translate::*;
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
|
@ -23,17 +24,17 @@ use std::ptr;
|
||||||
use BaseTransform;
|
use BaseTransform;
|
||||||
|
|
||||||
pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
fn start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_start(element)
|
self.parent_start(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
self.parent_stop(element)
|
self.parent_stop(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transform_caps(
|
fn transform_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
filter: Option<&gst::Caps>,
|
filter: Option<&gst::Caps>,
|
||||||
|
@ -43,7 +44,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn fixate_caps(
|
fn fixate_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
othercaps: gst::Caps,
|
othercaps: gst::Caps,
|
||||||
|
@ -53,7 +54,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn set_caps(
|
fn set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -62,7 +63,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn accept_caps(
|
fn accept_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -71,7 +72,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn query(
|
fn query(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -80,7 +81,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn transform_size(
|
fn transform_size(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
size: usize,
|
size: usize,
|
||||||
|
@ -89,21 +90,21 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
self.parent_transform_size(element, direction, caps, size, othercaps)
|
self.parent_transform_size(element, direction, caps, size, othercaps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option<usize> {
|
fn get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
|
||||||
self.parent_get_unit_size(element, caps)
|
self.parent_get_unit_size(element, caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
|
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
self.parent_sink_event(element, event)
|
self.parent_sink_event(element, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn src_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
|
fn src_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
self.parent_src_event(element, event)
|
self.parent_src_event(element, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_output_buffer(
|
fn prepare_output_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
|
) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
|
||||||
self.parent_prepare_output_buffer(element, inbuf)
|
self.parent_prepare_output_buffer(element, inbuf)
|
||||||
|
@ -111,7 +112,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn transform(
|
fn transform(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::Buffer,
|
inbuf: &gst::Buffer,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -120,7 +121,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn transform_ip(
|
fn transform_ip(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &mut gst::BufferRef,
|
buf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_transform_ip(element, buf)
|
self.parent_transform_ip(element, buf)
|
||||||
|
@ -128,7 +129,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn transform_ip_passthrough(
|
fn transform_ip_passthrough(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &gst::Buffer,
|
buf: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
self.parent_transform_ip_passthrough(element, buf)
|
self.parent_transform_ip_passthrough(element, buf)
|
||||||
|
@ -136,7 +137,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn copy_metadata(
|
fn copy_metadata(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -145,7 +146,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn transform_meta<'a>(
|
fn transform_meta<'a>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
meta: gst::MetaRef<'a, gst::Meta>,
|
meta: gst::MetaRef<'a, gst::Meta>,
|
||||||
inbuf: &'a gst::BufferRef,
|
inbuf: &'a gst::BufferRef,
|
||||||
|
@ -153,13 +154,13 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
self.parent_transform_meta(element, outbuf, meta, inbuf)
|
self.parent_transform_meta(element, outbuf, meta, inbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_transform(&self, element: &BaseTransform, inbuf: &gst::BufferRef) {
|
fn before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef) {
|
||||||
self.parent_before_transform(element, inbuf);
|
self.parent_before_transform(element, inbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn submit_input_buffer(
|
fn submit_input_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
is_discont: bool,
|
is_discont: bool,
|
||||||
inbuf: gst::Buffer,
|
inbuf: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -168,20 +169,20 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
|
|
||||||
fn generate_output(
|
fn generate_output(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
) -> Result<GenerateOutputSuccess, gst::FlowError> {
|
) -> Result<GenerateOutputSuccess, gst::FlowError> {
|
||||||
self.parent_generate_output(element)
|
self.parent_generate_output(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BaseTransformImplExt {
|
pub trait BaseTransformImplExt: ObjectSubclass {
|
||||||
fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage>;
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage>;
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage>;
|
||||||
|
|
||||||
fn parent_transform_caps(
|
fn parent_transform_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
filter: Option<&gst::Caps>,
|
filter: Option<&gst::Caps>,
|
||||||
|
@ -189,7 +190,7 @@ pub trait BaseTransformImplExt {
|
||||||
|
|
||||||
fn parent_fixate_caps(
|
fn parent_fixate_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
othercaps: gst::Caps,
|
othercaps: gst::Caps,
|
||||||
|
@ -197,92 +198,92 @@ pub trait BaseTransformImplExt {
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_accept_caps(
|
fn parent_accept_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
fn parent_query(
|
fn parent_query(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
fn parent_transform_size(
|
fn parent_transform_size(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
size: usize,
|
size: usize,
|
||||||
othercaps: &gst::Caps,
|
othercaps: &gst::Caps,
|
||||||
) -> Option<usize>;
|
) -> Option<usize>;
|
||||||
|
|
||||||
fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option<usize>;
|
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize>;
|
||||||
|
|
||||||
fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool;
|
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
|
||||||
|
|
||||||
fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool;
|
fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool;
|
||||||
|
|
||||||
fn parent_prepare_output_buffer(
|
fn parent_prepare_output_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
) -> Result<PrepareOutputBufferSuccess, gst::FlowError>;
|
) -> Result<PrepareOutputBufferSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_transform(
|
fn parent_transform(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::Buffer,
|
inbuf: &gst::Buffer,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_transform_ip(
|
fn parent_transform_ip(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &mut gst::BufferRef,
|
buf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_transform_ip_passthrough(
|
fn parent_transform_ip_passthrough(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &gst::Buffer,
|
buf: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_copy_metadata(
|
fn parent_copy_metadata(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<(), gst::LoggableError>;
|
) -> Result<(), gst::LoggableError>;
|
||||||
|
|
||||||
fn parent_transform_meta<'a>(
|
fn parent_transform_meta<'a>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
meta: gst::MetaRef<'a, gst::Meta>,
|
meta: gst::MetaRef<'a, gst::Meta>,
|
||||||
inbuf: &'a gst::BufferRef,
|
inbuf: &'a gst::BufferRef,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
fn parent_before_transform(&self, element: &BaseTransform, inbuf: &gst::BufferRef);
|
fn parent_before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef);
|
||||||
|
|
||||||
fn parent_submit_input_buffer(
|
fn parent_submit_input_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
is_discont: bool,
|
is_discont: bool,
|
||||||
inbuf: gst::Buffer,
|
inbuf: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_generate_output(
|
fn parent_generate_output(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
) -> Result<GenerateOutputSuccess, gst::FlowError>;
|
) -> Result<GenerateOutputSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn take_queued_buffer(&self) -> Option<gst::Buffer>
|
fn take_queued_buffer(&self) -> Option<gst::Buffer>
|
||||||
|
@ -297,7 +298,7 @@ pub trait BaseTransformImplExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -305,7 +306,11 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element
|
||||||
|
.unsafe_cast_ref::<BaseTransform>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -318,7 +323,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -326,7 +331,11 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.to_glib_none().0)) {
|
if from_glib(f(element
|
||||||
|
.unsafe_cast_ref::<BaseTransform>()
|
||||||
|
.to_glib_none()
|
||||||
|
.0))
|
||||||
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst_error_msg!(
|
||||||
|
@ -341,7 +350,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_transform_caps(
|
fn parent_transform_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
filter: Option<&gst::Caps>,
|
filter: Option<&gst::Caps>,
|
||||||
|
@ -354,7 +363,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.transform_caps
|
.transform_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib_full(f(
|
from_glib_full(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
direction.to_glib(),
|
direction.to_glib(),
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
filter.to_glib_none().0,
|
filter.to_glib_none().0,
|
||||||
|
@ -366,7 +375,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_fixate_caps(
|
fn parent_fixate_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
othercaps: gst::Caps,
|
othercaps: gst::Caps,
|
||||||
|
@ -377,7 +386,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
match (*parent_class).fixate_caps {
|
match (*parent_class).fixate_caps {
|
||||||
Some(f) => from_glib_full(f(
|
Some(f) => from_glib_full(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
direction.to_glib(),
|
direction.to_glib(),
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
othercaps.into_ptr(),
|
othercaps.into_ptr(),
|
||||||
|
@ -389,7 +398,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_set_caps(
|
fn parent_set_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -402,7 +411,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
incaps.to_glib_none().0,
|
incaps.to_glib_none().0,
|
||||||
outcaps.to_glib_none().0,
|
outcaps.to_glib_none().0,
|
||||||
),
|
),
|
||||||
|
@ -416,7 +425,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_accept_caps(
|
fn parent_accept_caps(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -428,7 +437,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.accept_caps
|
.accept_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
direction.to_glib(),
|
direction.to_glib(),
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
))
|
))
|
||||||
|
@ -439,7 +448,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_query(
|
fn parent_query(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -451,7 +460,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.query
|
.query
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
direction.to_glib(),
|
direction.to_glib(),
|
||||||
query.as_mut_ptr(),
|
query.as_mut_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -462,7 +471,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_transform_size(
|
fn parent_transform_size(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
direction: gst::PadDirection,
|
direction: gst::PadDirection,
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
size: usize,
|
size: usize,
|
||||||
|
@ -477,7 +486,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut othersize = mem::MaybeUninit::uninit();
|
let mut othersize = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(f(
|
let res: bool = from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
direction.to_glib(),
|
direction.to_glib(),
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
size,
|
size,
|
||||||
|
@ -494,13 +503,13 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option<usize> {
|
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
|
let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
|
||||||
if !element.is_in_place() {
|
if !element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
unimplemented!(concat!(
|
unimplemented!(concat!(
|
||||||
"Missing parent function `get_unit_size`. Required because ",
|
"Missing parent function `get_unit_size`. Required because ",
|
||||||
"transform element doesn't operate in-place"
|
"transform element doesn't operate in-place"
|
||||||
|
@ -515,7 +524,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
let mut size = mem::MaybeUninit::uninit();
|
let mut size = mem::MaybeUninit::uninit();
|
||||||
if from_glib(f(
|
if from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
caps.to_glib_none().0,
|
caps.to_glib_none().0,
|
||||||
size.as_mut_ptr(),
|
size.as_mut_ptr(),
|
||||||
)) {
|
)) {
|
||||||
|
@ -526,33 +535,43 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
|
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.sink_event
|
.sink_event
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
event.into_ptr(),
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
|
fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.src_event
|
.src_event
|
||||||
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
|
.map(|f| {
|
||||||
|
from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
event.into_ptr(),
|
||||||
|
))
|
||||||
|
})
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_prepare_output_buffer(
|
fn parent_prepare_output_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
|
) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -565,7 +584,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
let mut outbuf: *mut gst_sys::GstBuffer = ptr::null_mut();
|
let mut outbuf: *mut gst_sys::GstBuffer = ptr::null_mut();
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let res = from_glib(f(
|
let res = from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
inbuf.as_ptr() as *mut gst_sys::GstBuffer,
|
inbuf.as_ptr() as *mut gst_sys::GstBuffer,
|
||||||
(&mut outbuf) as *mut *mut gst_sys::GstBuffer as *mut gst_sys::GstBuffer,
|
(&mut outbuf) as *mut *mut gst_sys::GstBuffer as *mut gst_sys::GstBuffer,
|
||||||
));
|
));
|
||||||
|
@ -587,7 +606,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_transform(
|
fn parent_transform(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::Buffer,
|
inbuf: &gst::Buffer,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -599,13 +618,13 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.transform
|
.transform
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
inbuf.to_glib_none().0,
|
inbuf.to_glib_none().0,
|
||||||
outbuf.as_mut_ptr(),
|
outbuf.as_mut_ptr(),
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
if !element.is_in_place() {
|
if !element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
gst::FlowReturn::NotSupported
|
gst::FlowReturn::NotSupported
|
||||||
} else {
|
} else {
|
||||||
unreachable!(concat!(
|
unreachable!(concat!(
|
||||||
|
@ -620,7 +639,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_transform_ip(
|
fn parent_transform_ip(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &mut gst::BufferRef,
|
buf: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -628,7 +647,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
||||||
if element.is_in_place() {
|
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
panic!(concat!(
|
panic!(concat!(
|
||||||
"Missing parent function `transform_ip`. Required because ",
|
"Missing parent function `transform_ip`. Required because ",
|
||||||
"transform element operates in-place"
|
"transform element operates in-place"
|
||||||
|
@ -641,14 +660,17 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, buf.as_mut_ptr() as *mut _))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
buf.as_mut_ptr() as *mut _,
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_transform_ip_passthrough(
|
fn parent_transform_ip_passthrough(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
buf: &gst::Buffer,
|
buf: &gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -656,7 +678,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
||||||
if element.is_in_place() {
|
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
panic!(concat!(
|
panic!(concat!(
|
||||||
"Missing parent function `transform_ip`. Required because ",
|
"Missing parent function `transform_ip`. Required because ",
|
||||||
"transform element operates in-place (passthrough mode)"
|
"transform element operates in-place (passthrough mode)"
|
||||||
|
@ -671,13 +693,17 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let buf: *mut gst_sys::GstBuffer = buf.to_glib_none().0;
|
let buf: *mut gst_sys::GstBuffer = buf.to_glib_none().0;
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, buf as *mut _)).into_result()
|
gst::FlowReturn::from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
buf as *mut _,
|
||||||
|
))
|
||||||
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_copy_metadata(
|
fn parent_copy_metadata(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
inbuf: &gst::BufferRef,
|
inbuf: &gst::BufferRef,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
|
@ -688,7 +714,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
if let Some(ref f) = (*parent_class).copy_metadata {
|
if let Some(ref f) = (*parent_class).copy_metadata {
|
||||||
gst_result_from_gboolean!(
|
gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
inbuf.as_ptr() as *mut _,
|
inbuf.as_ptr() as *mut _,
|
||||||
outbuf.as_mut_ptr()
|
outbuf.as_mut_ptr()
|
||||||
),
|
),
|
||||||
|
@ -703,7 +729,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_transform_meta<'a>(
|
fn parent_transform_meta<'a>(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
outbuf: &mut gst::BufferRef,
|
outbuf: &mut gst::BufferRef,
|
||||||
meta: gst::MetaRef<'a, gst::Meta>,
|
meta: gst::MetaRef<'a, gst::Meta>,
|
||||||
inbuf: &'a gst::BufferRef,
|
inbuf: &'a gst::BufferRef,
|
||||||
|
@ -716,7 +742,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.transform_meta
|
.transform_meta
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
from_glib(f(
|
from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
outbuf.as_mut_ptr(),
|
outbuf.as_mut_ptr(),
|
||||||
meta.as_ptr() as *mut _,
|
meta.as_ptr() as *mut _,
|
||||||
inbuf.as_ptr() as *mut _,
|
inbuf.as_ptr() as *mut _,
|
||||||
|
@ -726,20 +752,23 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_before_transform(&self, element: &BaseTransform, inbuf: &gst::BufferRef) {
|
fn parent_before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
||||||
if let Some(ref f) = (*parent_class).before_transform {
|
if let Some(ref f) = (*parent_class).before_transform {
|
||||||
f(element.to_glib_none().0, inbuf.as_ptr() as *mut _);
|
f(
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
inbuf.as_ptr() as *mut _,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_submit_input_buffer(
|
fn parent_submit_input_buffer(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
is_discont: bool,
|
is_discont: bool,
|
||||||
inbuf: gst::Buffer,
|
inbuf: gst::Buffer,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -752,7 +781,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.expect("Missing parent function `submit_input_buffer`");
|
.expect("Missing parent function `submit_input_buffer`");
|
||||||
|
|
||||||
gst::FlowReturn::from_glib(f(
|
gst::FlowReturn::from_glib(f(
|
||||||
element.to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
is_discont.to_glib(),
|
is_discont.to_glib(),
|
||||||
inbuf.into_ptr(),
|
inbuf.into_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -762,7 +791,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
|
|
||||||
fn parent_generate_output(
|
fn parent_generate_output(
|
||||||
&self,
|
&self,
|
||||||
element: &BaseTransform,
|
element: &Self::Type,
|
||||||
) -> Result<GenerateOutputSuccess, gst::FlowError> {
|
) -> Result<GenerateOutputSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
|
@ -773,17 +802,20 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
.expect("Missing parent function `generate_output`");
|
.expect("Missing parent function `generate_output`");
|
||||||
|
|
||||||
let mut outbuf = ptr::null_mut();
|
let mut outbuf = ptr::null_mut();
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, &mut outbuf))
|
gst::FlowReturn::from_glib(f(
|
||||||
.into_result()
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
.map(|res| {
|
&mut outbuf,
|
||||||
if res == ::BASE_TRANSFORM_FLOW_DROPPED {
|
))
|
||||||
GenerateOutputSuccess::Dropped
|
.into_result()
|
||||||
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
|
.map(|res| {
|
||||||
GenerateOutputSuccess::NoOutput
|
if res == ::BASE_TRANSFORM_FLOW_DROPPED {
|
||||||
} else {
|
GenerateOutputSuccess::Dropped
|
||||||
GenerateOutputSuccess::Buffer(from_glib_full(outbuf))
|
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
|
||||||
}
|
GenerateOutputSuccess::NoOutput
|
||||||
})
|
} else {
|
||||||
|
GenerateOutputSuccess::Buffer(from_glib_full(outbuf))
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +826,8 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let element = self.get_instance();
|
let element = self.get_instance();
|
||||||
let ptr: *mut gst_base_sys::GstBaseTransform = element.to_glib_none().0 as *mut _;
|
let ptr: *mut gst_base_sys::GstBaseTransform =
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
||||||
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
||||||
let _stream_lock = sinkpad.stream_lock();
|
let _stream_lock = sinkpad.stream_lock();
|
||||||
let buffer = (*ptr).queued_buf;
|
let buffer = (*ptr).queued_buf;
|
||||||
|
@ -810,7 +843,8 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let element = self.get_instance();
|
let element = self.get_instance();
|
||||||
let ptr: *mut gst_base_sys::GstBaseTransform = element.to_glib_none().0 as *mut _;
|
let ptr: *mut gst_base_sys::GstBaseTransform =
|
||||||
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
||||||
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
||||||
let _stream_lock = sinkpad.stream_lock();
|
let _stream_lock = sinkpad.stream_lock();
|
||||||
let buffer = (*ptr).queued_buf;
|
let buffer = (*ptr).queued_buf;
|
||||||
|
@ -918,7 +952,7 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(&wrap) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -940,7 +974,7 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(&wrap) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
wrap.post_error_message(err);
|
wrap.post_error_message(err);
|
||||||
|
@ -968,7 +1002,7 @@ where
|
||||||
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
|
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
|
||||||
|
|
||||||
imp.transform_caps(
|
imp.transform_caps(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
&from_glib_borrow(caps),
|
&from_glib_borrow(caps),
|
||||||
filter.as_ref().as_ref(),
|
filter.as_ref().as_ref(),
|
||||||
|
@ -993,7 +1027,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate_caps(
|
imp.fixate_caps(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
&from_glib_borrow(caps),
|
&from_glib_borrow(caps),
|
||||||
from_glib_full(othercaps),
|
from_glib_full(othercaps),
|
||||||
|
@ -1015,7 +1049,11 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(&wrap, &from_glib_borrow(incaps), &from_glib_borrow(outcaps)) {
|
match imp.set_caps(
|
||||||
|
wrap.unsafe_cast_ref(),
|
||||||
|
&from_glib_borrow(incaps),
|
||||||
|
&from_glib_borrow(outcaps),
|
||||||
|
) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.log_with_object(&*wrap);
|
err.log_with_object(&*wrap);
|
||||||
|
@ -1039,7 +1077,11 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.accept_caps(&wrap, from_glib(direction), &from_glib_borrow(caps))
|
imp.accept_caps(
|
||||||
|
wrap.unsafe_cast_ref(),
|
||||||
|
from_glib(direction),
|
||||||
|
&from_glib_borrow(caps),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1101,7 @@ where
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseTransformImpl::query(
|
BaseTransformImpl::query(
|
||||||
imp,
|
imp,
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
gst::QueryRef::from_mut_ptr(query),
|
gst::QueryRef::from_mut_ptr(query),
|
||||||
)
|
)
|
||||||
|
@ -1084,7 +1126,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.transform_size(
|
match imp.transform_size(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
&from_glib_borrow(caps),
|
&from_glib_borrow(caps),
|
||||||
size,
|
size,
|
||||||
|
@ -1113,7 +1155,7 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.get_unit_size(&wrap, &from_glib_borrow(caps)) {
|
match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
*size = s;
|
*size = s;
|
||||||
true
|
true
|
||||||
|
@ -1140,7 +1182,7 @@ where
|
||||||
let outbuf = outbuf as *mut *mut gst_sys::GstBuffer;
|
let outbuf = outbuf as *mut *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.prepare_output_buffer(&wrap, gst::BufferRef::from_ptr(inbuf)) {
|
match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) {
|
||||||
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
|
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
|
||||||
*outbuf = inbuf;
|
*outbuf = inbuf;
|
||||||
gst::FlowReturn::Ok
|
gst::FlowReturn::Ok
|
||||||
|
@ -1167,7 +1209,7 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_event(&wrap, from_glib_full(event))
|
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1226,7 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_event(&wrap, from_glib_full(event))
|
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1245,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.transform(
|
imp.transform(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(inbuf),
|
&from_glib_borrow(inbuf),
|
||||||
gst::BufferRef::from_mut_ptr(outbuf),
|
gst::BufferRef::from_mut_ptr(outbuf),
|
||||||
)
|
)
|
||||||
|
@ -1228,10 +1270,10 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
if from_glib(gst_base_sys::gst_base_transform_is_passthrough(ptr)) {
|
if from_glib(gst_base_sys::gst_base_transform_is_passthrough(ptr)) {
|
||||||
imp.transform_ip_passthrough(&wrap, &from_glib_borrow(buf))
|
imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf))
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
imp.transform_ip(&wrap, gst::BufferRef::from_mut_ptr(buf))
|
imp.transform_ip(wrap.unsafe_cast_ref(), gst::BufferRef::from_mut_ptr(buf))
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1255,7 +1297,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.transform_meta(
|
imp.transform_meta(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
gst::BufferRef::from_mut_ptr(outbuf),
|
gst::BufferRef::from_mut_ptr(outbuf),
|
||||||
gst::Meta::from_ptr(inbuf, meta),
|
gst::Meta::from_ptr(inbuf, meta),
|
||||||
inbuf,
|
inbuf,
|
||||||
|
@ -1288,7 +1330,7 @@ where
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), true, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), true, {
|
||||||
match imp.copy_metadata(
|
match imp.copy_metadata(
|
||||||
&wrap,
|
wrap.unsafe_cast_ref(),
|
||||||
gst::BufferRef::from_ptr(inbuf),
|
gst::BufferRef::from_ptr(inbuf),
|
||||||
gst::BufferRef::from_mut_ptr(outbuf),
|
gst::BufferRef::from_mut_ptr(outbuf),
|
||||||
) {
|
) {
|
||||||
|
@ -1313,7 +1355,7 @@ unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
||||||
imp.before_transform(&wrap, gst::BufferRef::from_ptr(inbuf));
|
imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1330,8 +1372,12 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.submit_input_buffer(&wrap, from_glib(is_discont), from_glib_full(buf))
|
imp.submit_input_buffer(
|
||||||
.into()
|
wrap.unsafe_cast_ref(),
|
||||||
|
from_glib(is_discont),
|
||||||
|
from_glib_full(buf),
|
||||||
|
)
|
||||||
|
.into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -1350,7 +1396,7 @@ where
|
||||||
*buf = ptr::null_mut();
|
*buf = ptr::null_mut();
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.generate_output(&wrap) {
|
match imp.generate_output(wrap.unsafe_cast_ref()) {
|
||||||
Ok(GenerateOutputSuccess::Dropped) => ::BASE_TRANSFORM_FLOW_DROPPED.into(),
|
Ok(GenerateOutputSuccess::Dropped) => ::BASE_TRANSFORM_FLOW_DROPPED.into(),
|
||||||
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,
|
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,
|
||||||
Ok(GenerateOutputSuccess::Buffer(outbuf)) => {
|
Ok(GenerateOutputSuccess::Buffer(outbuf)) => {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
use gst_base_sys;
|
use gst_base_sys;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
|
||||||
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
|
@ -23,37 +24,37 @@ use PushSrc;
|
||||||
pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
|
pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
|
||||||
fn fill(
|
fn fill(
|
||||||
&self,
|
&self,
|
||||||
element: &PushSrc,
|
element: &Self::Type,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
PushSrcImplExt::parent_fill(self, element, buffer)
|
PushSrcImplExt::parent_fill(self, element, buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn alloc(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError> {
|
fn alloc(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
PushSrcImplExt::parent_alloc(self, element)
|
PushSrcImplExt::parent_alloc(self, element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError> {
|
fn create(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
PushSrcImplExt::parent_create(self, element)
|
PushSrcImplExt::parent_create(self, element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait PushSrcImplExt {
|
pub trait PushSrcImplExt: ObjectSubclass {
|
||||||
fn parent_fill(
|
fn parent_fill(
|
||||||
&self,
|
&self,
|
||||||
element: &PushSrc,
|
element: &Self::Type,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_alloc(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError>;
|
fn parent_alloc(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError>;
|
||||||
|
|
||||||
fn parent_create(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError>;
|
fn parent_create(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: PushSrcImpl> PushSrcImplExt for T {
|
impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
fn parent_fill(
|
fn parent_fill(
|
||||||
&self,
|
&self,
|
||||||
element: &PushSrc,
|
element: &Self::Type,
|
||||||
buffer: &mut gst::BufferRef,
|
buffer: &mut gst::BufferRef,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -63,14 +64,17 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.fill
|
.fill
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst::FlowReturn::from_glib(f(element.to_glib_none().0, buffer.as_mut_ptr()))
|
gst::FlowReturn::from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||||
|
buffer.as_mut_ptr(),
|
||||||
|
))
|
||||||
})
|
})
|
||||||
.unwrap_or(gst::FlowReturn::NotSupported)
|
.unwrap_or(gst::FlowReturn::NotSupported)
|
||||||
.into_result()
|
.into_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_alloc(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError> {
|
fn parent_alloc(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -84,14 +88,17 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(element.to_glib_none().0, buffer_ref));
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||||
|
buffer_ref,
|
||||||
|
));
|
||||||
res.into_result_value(|| from_glib_full(buffer_ref))
|
res.into_result_value(|| from_glib_full(buffer_ref))
|
||||||
})
|
})
|
||||||
.unwrap_or(Err(gst::FlowError::NotSupported))
|
.unwrap_or(Err(gst::FlowError::NotSupported))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_create(&self, element: &PushSrc) -> Result<gst::Buffer, gst::FlowError> {
|
fn parent_create(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = T::type_data();
|
let data = T::type_data();
|
||||||
let parent_class =
|
let parent_class =
|
||||||
|
@ -105,7 +112,10 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(element.to_glib_none().0, buffer_ref));
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
|
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||||
|
buffer_ref,
|
||||||
|
));
|
||||||
res.into_result_value(|| from_glib_full(buffer_ref))
|
res.into_result_value(|| from_glib_full(buffer_ref))
|
||||||
})
|
})
|
||||||
.unwrap_or(Err(gst::FlowError::NotSupported))
|
.unwrap_or(Err(gst::FlowError::NotSupported))
|
||||||
|
@ -139,7 +149,7 @@ where
|
||||||
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
PushSrcImpl::fill(imp, &wrap, buffer).into()
|
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
@ -159,7 +169,7 @@ where
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match PushSrcImpl::alloc(imp, &wrap) {
|
match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
gst::FlowReturn::Ok
|
gst::FlowReturn::Ok
|
||||||
|
@ -185,7 +195,7 @@ where
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match PushSrcImpl::create(imp, &wrap) {
|
match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
gst::FlowReturn::Ok
|
gst::FlowReturn::Ok
|
||||||
|
|
Loading…
Reference in a new issue