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::{Object, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstTracer")]
16    pub struct Tracer(Object<ffi::GstTracer, ffi::GstTracerClass>) @extends Object;
17
18    match fn {
19        type_ => || ffi::gst_tracer_get_type(),
20    }
21}
22
23impl Tracer {
24    pub const NONE: Option<&'static Tracer> = None;
25}
26
27unsafe impl Send for Tracer {}
28unsafe impl Sync for Tracer {}
29
30pub trait TracerExt: IsA<Tracer> + 'static {
31    fn params(&self) -> Option<glib::GString> {
32        ObjectExt::property(self.as_ref(), "params")
33    }
34
35    fn set_params(&self, params: Option<&str>) {
36        ObjectExt::set_property(self.as_ref(), "params", params)
37    }
38
39    #[doc(alias = "params")]
40    fn connect_params_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
41        unsafe extern "C" fn notify_params_trampoline<
42            P: IsA<Tracer>,
43            F: Fn(&P) + Send + Sync + 'static,
44        >(
45            this: *mut ffi::GstTracer,
46            _param_spec: glib::ffi::gpointer,
47            f: glib::ffi::gpointer,
48        ) {
49            unsafe {
50                let f: &F = &*(f as *const F);
51                f(Tracer::from_glib_borrow(this).unsafe_cast_ref())
52            }
53        }
54        unsafe {
55            let f: Box_<F> = Box_::new(f);
56            connect_raw(
57                self.as_ptr() as *mut _,
58                c"notify::params".as_ptr(),
59                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
60                    notify_params_trampoline::<Self, F> as *const (),
61                )),
62                Box_::into_raw(f),
63            )
64        }
65    }
66}
67
68impl<O: IsA<Tracer>> TracerExt for O {}