Commit b5dcbe38 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Sebastian Dröge

gstreamer/proxypad: Move default functions to extension trait

parent 86e969d9
......@@ -187,6 +187,7 @@ mod object;
mod pad;
mod parse_context;
mod proxy_pad;
pub use proxy_pad::ProxyPadExtManual;
mod tag_setter;
pub use bin::GstBinExtManual;
pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId};
......@@ -336,6 +337,7 @@ pub mod prelude {
pub use object::GstObjectExtManual;
pub use pad::PadExtManual;
pub use param_spec::GstParamSpecExt;
pub use proxy_pad::ProxyPadExtManual;
pub use tag_setter::TagSetterExtManual;
pub use value::GstValueExt;
......
......@@ -21,16 +21,42 @@ use glib::translate::{from_glib, from_glib_full, ToGlibPtr};
use gst_sys;
impl ProxyPad {
pub fn chain_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P,
parent: Option<&Q>,
pub trait ProxyPadExtManual: 'static {
fn proxy_pad_chain_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
buffer: Buffer,
) -> Result<FlowSuccess, FlowError>;
fn proxy_pad_chain_list_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
list: BufferList,
) -> Result<FlowSuccess, FlowError>;
fn proxy_pad_getrange_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
offset: u64,
size: u32,
) -> Result<Buffer, FlowError>;
fn proxy_pad_iterate_internal_links_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
) -> Option<::Iterator<Pad>>;
}
impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
fn proxy_pad_chain_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
buffer: Buffer,
) -> Result<FlowSuccess, FlowError> {
skip_assert_initialized!();
let ret: FlowReturn = unsafe {
from_glib(gst_sys::gst_proxy_pad_chain_default(
pad.as_ptr() as *mut gst_sys::GstPad,
self.as_ptr() as *mut gst_sys::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
buffer.into_ptr(),
))
......@@ -38,15 +64,15 @@ impl ProxyPad {
ret.into_result()
}
pub fn chain_list_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P,
parent: Option<&Q>,
fn proxy_pad_chain_list_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
list: BufferList,
) -> Result<FlowSuccess, FlowError> {
skip_assert_initialized!();
let ret: FlowReturn = unsafe {
from_glib(gst_sys::gst_proxy_pad_chain_list_default(
pad.as_ptr() as *mut gst_sys::GstPad,
self.as_ptr() as *mut gst_sys::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
list.into_ptr(),
))
......@@ -54,9 +80,9 @@ impl ProxyPad {
ret.into_result()
}
pub fn getrange_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P,
parent: &Q,
fn proxy_pad_getrange_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
offset: u64,
size: u32,
) -> Result<Buffer, FlowError> {
......@@ -64,8 +90,8 @@ impl ProxyPad {
unsafe {
let mut buffer = ptr::null_mut();
let ret: FlowReturn = from_glib(gst_sys::gst_proxy_pad_getrange_default(
pad.as_ptr() as *mut gst_sys::GstPad,
parent.as_ref().to_glib_none().0,
self.as_ptr() as *mut gst_sys::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
offset,
size,
&mut buffer,
......@@ -74,14 +100,14 @@ impl ProxyPad {
}
}
pub fn iterate_internal_links_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P,
parent: Option<&Q>,
fn proxy_pad_iterate_internal_links_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
) -> Option<::Iterator<Pad>> {
skip_assert_initialized!();
unsafe {
from_glib_full(gst_sys::gst_proxy_pad_iterate_internal_links_default(
pad.as_ptr() as *mut gst_sys::GstPad,
self.as_ptr() as *mut gst_sys::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
))
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment