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
62/// Trait containing all [`struct@Tracer`] methods.
63///
64/// # Implementors
65///
66/// [`Tracer`][struct@crate::Tracer]
67pub trait TracerExt: IsA<Tracer> + 'static {
68 fn params(&self) -> Option<glib::GString> {
69 ObjectExt::property(self.as_ref(), "params")
70 }
71
72 fn set_params(&self, params: Option<&str>) {
73 ObjectExt::set_property(self.as_ref(), "params", params)
74 }
75
76 #[doc(alias = "params")]
77 fn connect_params_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
78 unsafe extern "C" fn notify_params_trampoline<
79 P: IsA<Tracer>,
80 F: Fn(&P) + Send + Sync + 'static,
81 >(
82 this: *mut ffi::GstTracer,
83 _param_spec: glib::ffi::gpointer,
84 f: glib::ffi::gpointer,
85 ) {
86 let f: &F = &*(f as *const F);
87 f(Tracer::from_glib_borrow(this).unsafe_cast_ref())
88 }
89 unsafe {
90 let f: Box_<F> = Box_::new(f);
91 connect_raw(
92 self.as_ptr() as *mut _,
93 c"notify::params".as_ptr() as *const _,
94 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
95 notify_params_trampoline::<Self, F> as *const (),
96 )),
97 Box_::into_raw(f),
98 )
99 }
100 }
101}
102
103impl<O: IsA<Tracer>> TracerExt for O {}