gstreamer_editing_services/auto/
marker.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, MetaContainer};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A timed [`MetaContainer`][crate::MetaContainer] object.
16    ///
17    /// ## Properties
18    ///
19    ///
20    /// #### `position`
21    ///  Current position (in nanoseconds) of the [`Marker`][crate::Marker]
22    ///
23    /// Readable
24    ///
25    /// # Implements
26    ///
27    /// [`trait@glib::ObjectExt`], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
28    #[doc(alias = "GESMarker")]
29    pub struct Marker(Object<ffi::GESMarker, ffi::GESMarkerClass>) @implements MetaContainer;
30
31    match fn {
32        type_ => || ffi::ges_marker_get_type(),
33    }
34}
35
36impl Marker {
37    /// Current position (in nanoseconds) of the [`Marker`][crate::Marker]
38    #[cfg(feature = "v1_18")]
39    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
40    pub fn position(&self) -> u64 {
41        ObjectExt::property(self, "position")
42    }
43
44    #[cfg(feature = "v1_18")]
45    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
46    #[doc(alias = "position")]
47    pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
48        unsafe extern "C" fn notify_position_trampoline<F: Fn(&Marker) + 'static>(
49            this: *mut ffi::GESMarker,
50            _param_spec: glib::ffi::gpointer,
51            f: glib::ffi::gpointer,
52        ) {
53            let f: &F = &*(f as *const F);
54            f(&from_glib_borrow(this))
55        }
56        unsafe {
57            let f: Box_<F> = Box_::new(f);
58            connect_raw(
59                self.as_ptr() as *mut _,
60                c"notify::position".as_ptr() as *const _,
61                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
62                    notify_position_trampoline::<F> as *const (),
63                )),
64                Box_::into_raw(f),
65            )
66        }
67    }
68}