gstreamer/auto/
tracer.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, Object};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// Tracing modules will subclass [`Tracer`][crate::Tracer] and register through
16    /// `gst_tracer_register()`. Modules can attach to various hook-types - see
17    /// [`tracing_register_hook()`][crate::tracing_register_hook()]. When invoked they receive hook specific
18    /// contextual data, which they must not modify.
19    ///
20    /// This is an Abstract Base Class, you cannot instantiate it.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `params`
26    ///  Readable | Writeable | Construct
27    /// <details><summary><h4>Object</h4></summary>
28    ///
29    ///
30    /// #### `name`
31    ///  Readable | Writeable | Construct
32    ///
33    ///
34    /// #### `parent`
35    ///  The parent of the object. Please note, that when changing the 'parent'
36    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::Object#deep-notify]
37    /// signals due to locking issues. In some cases one can use
38    /// [`element-added`][struct@crate::Bin#element-added] or [`element-removed`][struct@crate::Bin#element-removed] signals on the parent to
39    /// achieve a similar effect.
40    ///
41    /// Readable | Writeable
42    /// </details>
43    ///
44    /// # Implements
45    ///
46    /// [`TracerExt`][trait@crate::prelude::TracerExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`]
47    #[doc(alias = "GstTracer")]
48    pub struct Tracer(Object<ffi::GstTracer, ffi::GstTracerClass>) @extends Object;
49
50    match fn {
51        type_ => || ffi::gst_tracer_get_type(),
52    }
53}
54
55impl Tracer {
56    pub const NONE: Option<&'static Tracer> = None;
57}
58
59unsafe impl Send for Tracer {}
60unsafe impl Sync for Tracer {}
61
62mod sealed {
63    pub trait Sealed {}
64    impl<T: super::IsA<super::Tracer>> Sealed for T {}
65}
66
67/// Trait containing all [`struct@Tracer`] methods.
68///
69/// # Implementors
70///
71/// [`Tracer`][struct@crate::Tracer]
72pub trait TracerExt: IsA<Tracer> + sealed::Sealed + 'static {
73    fn params(&self) -> Option<glib::GString> {
74        ObjectExt::property(self.as_ref(), "params")
75    }
76
77    fn set_params(&self, params: Option<&str>) {
78        ObjectExt::set_property(self.as_ref(), "params", params)
79    }
80
81    #[doc(alias = "params")]
82    fn connect_params_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
83        unsafe extern "C" fn notify_params_trampoline<
84            P: IsA<Tracer>,
85            F: Fn(&P) + Send + Sync + 'static,
86        >(
87            this: *mut ffi::GstTracer,
88            _param_spec: glib::ffi::gpointer,
89            f: glib::ffi::gpointer,
90        ) {
91            let f: &F = &*(f as *const F);
92            f(Tracer::from_glib_borrow(this).unsafe_cast_ref())
93        }
94        unsafe {
95            let f: Box_<F> = Box_::new(f);
96            connect_raw(
97                self.as_ptr() as *mut _,
98                b"notify::params\0".as_ptr() as *const _,
99                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
100                    notify_params_trampoline::<Self, F> as *const (),
101                )),
102                Box_::into_raw(f),
103            )
104        }
105    }
106}
107
108impl<O: IsA<Tracer>> TracerExt for O {}