mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-02 01:43:49 +00:00
base: Manually implement AggregatorPad::current-level-time
bindings to get correct type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1729>
This commit is contained in:
parent
faffa6bb84
commit
1f1989e70d
2 changed files with 42 additions and 0 deletions
|
@ -238,6 +238,10 @@ manual_traits = ["AggregatorExtManual"]
|
|||
name = "GstBase.AggregatorPad"
|
||||
status = "generate"
|
||||
manual_traits = ["AggregatorPadExtManual"]
|
||||
[[object.property]]
|
||||
name = "current-level-time"
|
||||
# ClockTime
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstBase.BaseParse"
|
||||
|
|
|
@ -14,6 +14,44 @@ pub trait AggregatorPadExtManual: IsA<AggregatorPad> + 'static {
|
|||
from_glib_none(&ptr.segment as *const gst::ffi::GstSegment)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_28")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
|
||||
#[doc(alias = "current-level-time")]
|
||||
fn current_level_time(&self) -> Option<gst::ClockTime> {
|
||||
ObjectExt::property(self.as_ref(), "current-level-time")
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_28")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
|
||||
#[doc(alias = "current-level-time")]
|
||||
fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> glib::SignalHandlerId {
|
||||
unsafe extern "C" fn notify_current_level_time_trampoline<
|
||||
P: IsA<AggregatorPad>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstAggregatorPad,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box<F> = Box::new(f);
|
||||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::current-level-time".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_current_level_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {}
|
||||
|
|
Loading…
Reference in a new issue