diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index f49ab965b..b8b99cb57 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -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; diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index 6a01348e6..4efa55999 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -21,16 +21,42 @@ use glib::translate::{from_glib, from_glib_full, ToGlibPtr}; use gst_sys; -impl ProxyPad { - pub fn chain_default, Q: IsA>( - pad: &P, - parent: Option<&Q>, +pub trait ProxyPadExtManual: 'static { + fn proxy_pad_chain_default>( + &self, + parent: Option<&P>, + buffer: Buffer, + ) -> Result; + + fn proxy_pad_chain_list_default>( + &self, + parent: Option<&P>, + list: BufferList, + ) -> Result; + + fn proxy_pad_getrange_default>( + &self, + parent: Option<&P>, + offset: u64, + size: u32, + ) -> Result; + + fn proxy_pad_iterate_internal_links_default>( + &self, + parent: Option<&P>, + ) -> Option<::Iterator>; +} + +impl> ProxyPadExtManual for O { + fn proxy_pad_chain_default>( + &self, + parent: Option<&P>, buffer: Buffer, ) -> Result { 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, Q: IsA>( - pad: &P, - parent: Option<&Q>, + fn proxy_pad_chain_list_default>( + &self, + parent: Option<&P>, list: BufferList, ) -> Result { 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, Q: IsA>( - pad: &P, - parent: &Q, + fn proxy_pad_getrange_default>( + &self, + parent: Option<&P>, offset: u64, size: u32, ) -> Result { @@ -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, Q: IsA>( - pad: &P, - parent: Option<&Q>, + fn proxy_pad_iterate_internal_links_default>( + &self, + parent: Option<&P>, ) -> Option<::Iterator> { 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, )) }