forked from mirrors/gstreamer-rs
gstreamer: Implement Element::request_pad_simple()
only once
With < 1.20 it will use `gst_element_get_request_pad()` and otherwise `gst_element_request_pad_simple()`. It's not marked as deprecated in either case. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/358
This commit is contained in:
parent
b4282c9444
commit
c942a1d563
3 changed files with 21 additions and 25 deletions
|
@ -875,9 +875,13 @@ manual_traits = ["ElementExtManual"]
|
|||
[[object.function]]
|
||||
name = "get_request_pad"
|
||||
# rename to more explicit name and avoid conflict with `request_pad`
|
||||
# TODO: request_pad_simple is now _also_ in the 1.20 bindings!
|
||||
rename = "request_pad_simple"
|
||||
# Renamed version only available in not(1.20)
|
||||
# Renamed version is not deprecated
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "request_pad_simple"
|
||||
# see above
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
|
|
|
@ -212,11 +212,6 @@ pub trait ElementExt: 'static {
|
|||
caps: Option<&Caps>,
|
||||
) -> Option<Pad>;
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_element_request_pad_simple")]
|
||||
fn request_pad_simple(&self, name: &str) -> Option<Pad>;
|
||||
|
||||
#[doc(alias = "gst_element_set_base_time")]
|
||||
fn set_base_time(&self, time: ClockTime);
|
||||
|
||||
|
@ -637,17 +632,6 @@ impl<O: IsA<Element>> ElementExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
fn request_pad_simple(&self, name: &str) -> Option<Pad> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_element_request_pad_simple(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn set_base_time(&self, time: ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_element_set_base_time(self.as_ref().to_glib_none().0, time.into_glib());
|
||||
|
|
|
@ -270,10 +270,9 @@ pub trait ElementExtManual: 'static {
|
|||
#[doc(alias = "get_current_clock_time")]
|
||||
fn current_clock_time(&self) -> Option<crate::ClockTime>;
|
||||
|
||||
#[cfg(any(not(feature = "v1_20"), feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(not(feature = "v1_20"))))]
|
||||
#[doc(alias = "gst_element_get_request_pad")]
|
||||
#[doc(alias = "get_request_pad")]
|
||||
#[doc(alias = "gst_element_request_pad_simple")]
|
||||
fn request_pad_simple(&self, name: &str) -> Option<Pad>;
|
||||
}
|
||||
|
||||
|
@ -797,13 +796,22 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(not(feature = "v1_20"), feature = "dox"))]
|
||||
fn request_pad_simple(&self, name: &str) -> Option<Pad> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_element_get_request_pad(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
#[cfg(feature = "v1_20")]
|
||||
{
|
||||
from_glib_full(ffi::gst_element_request_pad_simple(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
#[cfg(not(feature = "v1_20"))]
|
||||
{
|
||||
from_glib_full(ffi::gst_element_get_request_pad(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue