gstreamer_base/
aggregator_pad.rs1use glib::{prelude::*, translate::*};
4use gst::prelude::*;
5
6use crate::{ffi, AggregatorPad};
7
8pub trait AggregatorPadExtManual: IsA<AggregatorPad> + 'static {
9 #[doc(alias = "get_segment")]
10 fn segment(&self) -> gst::Segment {
11 unsafe {
12 let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _);
13 let _guard = self.as_ref().object_lock();
14 from_glib_none(&ptr.segment as *const gst::ffi::GstSegment)
15 }
16 }
17
18 #[cfg(feature = "v1_28")]
19 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
20 #[doc(alias = "current-level-time")]
21 fn current_level_time(&self) -> Option<gst::ClockTime> {
22 ObjectExt::property(self.as_ref(), "current-level-time")
23 }
24
25 #[cfg(feature = "v1_28")]
26 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
27 #[doc(alias = "current-level-time")]
28 fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
29 &self,
30 f: F,
31 ) -> glib::SignalHandlerId {
32 unsafe extern "C" fn notify_current_level_time_trampoline<
33 P: IsA<AggregatorPad>,
34 F: Fn(&P) + Send + Sync + 'static,
35 >(
36 this: *mut ffi::GstAggregatorPad,
37 _param_spec: glib::ffi::gpointer,
38 f: glib::ffi::gpointer,
39 ) {
40 let f: &F = &*(f as *const F);
41 f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
42 }
43 unsafe {
44 let f: Box<F> = Box::new(f);
45 glib::signal::connect_raw(
46 self.as_ptr() as *mut _,
47 c"notify::current-level-time".as_ptr() as *const _,
48 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
49 notify_current_level_time_trampoline::<Self, F> as *const (),
50 )),
51 Box::into_raw(f),
52 )
53 }
54 }
55}
56
57impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {}