mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-25 00:18:26 +00:00
gstreamer: Implement pad default functions as associated functions
Making them associated functions clearer that special care is required and avoid conflicts with the same functions in ghostpad/proxypad.
This commit is contained in:
parent
69f05a1577
commit
734afa998b
4 changed files with 70 additions and 112 deletions
|
@ -5,7 +5,6 @@ use crate::FlowError;
|
||||||
use crate::FlowSuccess;
|
use crate::FlowSuccess;
|
||||||
use crate::GhostPad;
|
use crate::GhostPad;
|
||||||
use crate::LoggableError;
|
use crate::LoggableError;
|
||||||
use crate::Object;
|
|
||||||
use crate::Pad;
|
use crate::Pad;
|
||||||
use crate::PadBuilder;
|
use crate::PadBuilder;
|
||||||
use crate::PadFlags;
|
use crate::PadFlags;
|
||||||
|
@ -16,9 +15,9 @@ use glib::translate::*;
|
||||||
|
|
||||||
impl GhostPad {
|
impl GhostPad {
|
||||||
#[doc(alias = "gst_ghost_pad_activate_mode_default")]
|
#[doc(alias = "gst_ghost_pad_activate_mode_default")]
|
||||||
pub fn activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
pub fn activate_mode_default<P: IsA<GhostPad>>(
|
||||||
pad: &P,
|
pad: &P,
|
||||||
parent: Option<&Q>,
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
mode: PadMode,
|
mode: PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
|
@ -37,9 +36,9 @@ impl GhostPad {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_ghost_pad_internal_activate_mode_default")]
|
#[doc(alias = "gst_ghost_pad_internal_activate_mode_default")]
|
||||||
pub fn internal_activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
pub fn internal_activate_mode_default<P: IsA<GhostPad>>(
|
||||||
pad: &P,
|
pad: &P,
|
||||||
parent: Option<&Q>,
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
mode: PadMode,
|
mode: PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
|
|
|
@ -324,7 +324,6 @@ pub mod prelude {
|
||||||
pub use crate::pipeline::GstPipelineExtManual;
|
pub use crate::pipeline::GstPipelineExtManual;
|
||||||
pub use crate::plugin::GstPluginExtManual;
|
pub use crate::plugin::GstPluginExtManual;
|
||||||
pub use crate::plugin_feature::PluginFeatureExtManual;
|
pub use crate::plugin_feature::PluginFeatureExtManual;
|
||||||
pub use crate::proxy_pad::ProxyPadExtManual;
|
|
||||||
pub use crate::tag_setter::TagSetterExtManual;
|
pub use crate::tag_setter::TagSetterExtManual;
|
||||||
pub use crate::task_pool::{TaskHandle, TaskPoolExtManual};
|
pub use crate::task_pool::{TaskHandle, TaskPoolExtManual};
|
||||||
pub use crate::typefind::TypeFindImpl;
|
pub use crate::typefind::TypeFindImpl;
|
||||||
|
|
|
@ -143,22 +143,10 @@ pub trait PadExtManual: 'static {
|
||||||
fn peer_query(&self, query: &mut QueryRef) -> bool;
|
fn peer_query(&self, query: &mut QueryRef) -> bool;
|
||||||
#[doc(alias = "gst_pad_query")]
|
#[doc(alias = "gst_pad_query")]
|
||||||
fn query(&self, query: &mut QueryRef) -> bool;
|
fn query(&self, query: &mut QueryRef) -> bool;
|
||||||
#[doc(alias = "gst_pad_query_default")]
|
|
||||||
fn query_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
query: &mut QueryRef,
|
|
||||||
) -> bool;
|
|
||||||
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
|
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
|
||||||
#[doc(alias = "gst_pad_proxy_query_accept_caps")]
|
#[doc(alias = "gst_pad_proxy_query_accept_caps")]
|
||||||
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
|
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
|
||||||
|
|
||||||
#[doc(alias = "gst_pad_event_default")]
|
|
||||||
fn event_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
event: impl Into<Event>,
|
|
||||||
) -> bool;
|
|
||||||
#[doc(alias = "gst_pad_push_event")]
|
#[doc(alias = "gst_pad_push_event")]
|
||||||
fn push_event(&self, event: impl Into<Event>) -> bool;
|
fn push_event(&self, event: impl Into<Event>) -> bool;
|
||||||
#[doc(alias = "gst_pad_send_event")]
|
#[doc(alias = "gst_pad_send_event")]
|
||||||
|
@ -166,11 +154,6 @@ pub trait PadExtManual: 'static {
|
||||||
|
|
||||||
#[doc(alias = "gst_pad_iterate_internal_links")]
|
#[doc(alias = "gst_pad_iterate_internal_links")]
|
||||||
fn iterate_internal_links(&self) -> crate::Iterator<Pad>;
|
fn iterate_internal_links(&self) -> crate::Iterator<Pad>;
|
||||||
#[doc(alias = "gst_pad_iterate_internal_links_default")]
|
|
||||||
fn iterate_internal_links_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
) -> crate::Iterator<Pad>;
|
|
||||||
|
|
||||||
fn stream_lock(&self) -> StreamLock;
|
fn stream_lock(&self) -> StreamLock;
|
||||||
|
|
||||||
|
@ -502,21 +485,6 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
query: &mut QueryRef,
|
|
||||||
) -> bool {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
|
||||||
from_glib(ffi::gst_pad_query_default(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
|
||||||
query.as_mut_ptr(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool {
|
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_pad_proxy_query_accept_caps(
|
from_glib(ffi::gst_pad_proxy_query_accept_caps(
|
||||||
|
@ -535,21 +503,6 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn event_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
event: impl Into<Event>,
|
|
||||||
) -> bool {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
|
||||||
from_glib(ffi::gst_pad_event_default(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
|
||||||
event.into().into_glib_ptr(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn push_event(&self, event: impl Into<Event>) -> bool {
|
fn push_event(&self, event: impl Into<Event>) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_pad_push_event(
|
from_glib(ffi::gst_pad_push_event(
|
||||||
|
@ -576,18 +529,6 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iterate_internal_links_default<P: IsA<crate::Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
) -> crate::Iterator<Pad> {
|
|
||||||
unsafe {
|
|
||||||
from_glib_full(ffi::gst_pad_iterate_internal_links_default(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn stream_lock(&self) -> StreamLock {
|
fn stream_lock(&self) -> StreamLock {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr: &mut ffi::GstPad = &mut *(self.as_ptr() as *mut _);
|
let ptr: &mut ffi::GstPad = &mut *(self.as_ptr() as *mut _);
|
||||||
|
@ -1652,6 +1593,52 @@ impl Pad {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
PadBuilder::from_template(templ, name)
|
PadBuilder::from_template(templ, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_pad_query_default")]
|
||||||
|
pub fn query_default<O: IsA<Pad>>(
|
||||||
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
|
query: &mut QueryRef,
|
||||||
|
) -> bool {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
unsafe {
|
||||||
|
from_glib(ffi::gst_pad_query_default(
|
||||||
|
pad.as_ref().to_glib_none().0,
|
||||||
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
|
query.as_mut_ptr(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_pad_event_default")]
|
||||||
|
pub fn event_default<O: IsA<Pad>>(
|
||||||
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
|
event: impl Into<Event>,
|
||||||
|
) -> bool {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
unsafe {
|
||||||
|
from_glib(ffi::gst_pad_event_default(
|
||||||
|
pad.as_ref().to_glib_none().0,
|
||||||
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
|
event.into().into_glib_ptr(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_pad_iterate_internal_links_default")]
|
||||||
|
pub fn iterate_internal_links_default<O: IsA<Pad>>(
|
||||||
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
|
) -> crate::Iterator<Pad> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
unsafe {
|
||||||
|
from_glib_full(ffi::gst_pad_iterate_internal_links_default(
|
||||||
|
pad.as_ref().to_glib_none().0,
|
||||||
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use = "The builder must be built to be used"]
|
#[must_use = "The builder must be built to be used"]
|
||||||
|
|
|
@ -4,7 +4,6 @@ use crate::Buffer;
|
||||||
use crate::BufferList;
|
use crate::BufferList;
|
||||||
use crate::FlowError;
|
use crate::FlowError;
|
||||||
use crate::FlowSuccess;
|
use crate::FlowSuccess;
|
||||||
use crate::Object;
|
|
||||||
use crate::Pad;
|
use crate::Pad;
|
||||||
use crate::ProxyPad;
|
use crate::ProxyPad;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -12,70 +11,43 @@ use std::ptr;
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
pub trait ProxyPadExtManual: 'static {
|
impl ProxyPad {
|
||||||
#[doc(alias = "gst_proxy_pad_chain_default")]
|
#[doc(alias = "gst_proxy_pad_chain_default")]
|
||||||
fn chain_default<P: IsA<Object>>(
|
pub fn chain_default<O: IsA<ProxyPad>>(
|
||||||
&self,
|
pad: &O,
|
||||||
parent: Option<&P>,
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
buffer: Buffer,
|
|
||||||
) -> Result<FlowSuccess, FlowError>;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_proxy_pad_chain_list_default")]
|
|
||||||
fn chain_list_default<P: IsA<Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
list: BufferList,
|
|
||||||
) -> Result<FlowSuccess, FlowError>;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_proxy_pad_getrange_default")]
|
|
||||||
fn getrange_default<P: IsA<Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
offset: u64,
|
|
||||||
size: u32,
|
|
||||||
) -> Result<Buffer, FlowError>;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_proxy_pad_iterate_internal_links_default")]
|
|
||||||
fn iterate_internal_links_default<P: IsA<Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
) -> Option<crate::Iterator<Pad>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
|
|
||||||
fn chain_default<P: IsA<Object>>(
|
|
||||||
&self,
|
|
||||||
parent: Option<&P>,
|
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
) -> Result<FlowSuccess, FlowError> {
|
) -> Result<FlowSuccess, FlowError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
try_from_glib(ffi::gst_proxy_pad_chain_default(
|
try_from_glib(ffi::gst_proxy_pad_chain_default(
|
||||||
self.as_ptr() as *mut ffi::GstPad,
|
pad.as_ptr() as *mut ffi::GstPad,
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
buffer.into_glib_ptr(),
|
buffer.into_glib_ptr(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn chain_list_default<P: IsA<Object>>(
|
#[doc(alias = "gst_proxy_pad_chain_list_default")]
|
||||||
&self,
|
pub fn chain_list_default<O: IsA<ProxyPad>>(
|
||||||
parent: Option<&P>,
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
list: BufferList,
|
list: BufferList,
|
||||||
) -> Result<FlowSuccess, FlowError> {
|
) -> Result<FlowSuccess, FlowError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
try_from_glib(ffi::gst_proxy_pad_chain_list_default(
|
try_from_glib(ffi::gst_proxy_pad_chain_list_default(
|
||||||
self.as_ptr() as *mut ffi::GstPad,
|
pad.as_ptr() as *mut ffi::GstPad,
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
list.into_glib_ptr(),
|
list.into_glib_ptr(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getrange_default<P: IsA<Object>>(
|
#[doc(alias = "gst_proxy_pad_getrange_default")]
|
||||||
&self,
|
pub fn getrange_default<O: IsA<ProxyPad>>(
|
||||||
parent: Option<&P>,
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
size: u32,
|
size: u32,
|
||||||
) -> Result<Buffer, FlowError> {
|
) -> Result<Buffer, FlowError> {
|
||||||
|
@ -83,7 +55,7 @@ impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut buffer = ptr::null_mut();
|
let mut buffer = ptr::null_mut();
|
||||||
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_getrange_default(
|
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_getrange_default(
|
||||||
self.as_ptr() as *mut ffi::GstPad,
|
pad.as_ptr() as *mut ffi::GstPad,
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
offset,
|
offset,
|
||||||
size,
|
size,
|
||||||
|
@ -93,14 +65,15 @@ impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iterate_internal_links_default<P: IsA<Object>>(
|
#[doc(alias = "gst_proxy_pad_iterate_internal_links_default")]
|
||||||
&self,
|
pub fn iterate_internal_links_default<O: IsA<ProxyPad>>(
|
||||||
parent: Option<&P>,
|
pad: &O,
|
||||||
|
parent: Option<&impl IsA<crate::Object>>,
|
||||||
) -> Option<crate::Iterator<Pad>> {
|
) -> Option<crate::Iterator<Pad>> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(
|
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(
|
||||||
self.as_ptr() as *mut ffi::GstPad,
|
pad.as_ptr() as *mut ffi::GstPad,
|
||||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue