gstreamer_validate/auto/
monitor.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, Reporter, Runner};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstValidateMonitor")]
16    pub struct Monitor(Object<ffi::GstValidateMonitor, ffi::GstValidateMonitorClass>) @extends gst::Object, @implements Reporter;
17
18    match fn {
19        type_ => || ffi::gst_validate_monitor_get_type(),
20    }
21}
22
23impl Monitor {
24    pub const NONE: Option<&'static Monitor> = None;
25
26    #[doc(alias = "gst_validate_monitor_factory_create")]
27    pub fn factory_create(
28        target: &impl IsA<gst::Object>,
29        runner: &impl IsA<Runner>,
30        parent: Option<&impl IsA<Monitor>>,
31    ) -> Monitor {
32        skip_assert_initialized!();
33        unsafe {
34            from_glib_full(ffi::gst_validate_monitor_factory_create(
35                target.as_ref().to_glib_none().0,
36                runner.as_ref().to_glib_none().0,
37                parent.map(|p| p.as_ref()).to_glib_none().0,
38            ))
39        }
40    }
41}
42
43unsafe impl Send for Monitor {}
44unsafe impl Sync for Monitor {}
45
46pub trait MonitorExt: IsA<Monitor> + 'static {
47    //#[doc(alias = "gst_validate_monitor_attach_override")]
48    //fn attach_override(&self, override_: /*Ignored*/&Override) {
49    //    unsafe { TODO: call ffi:gst_validate_monitor_attach_override() }
50    //}
51
52    #[doc(alias = "gst_validate_monitor_get_element")]
53    #[doc(alias = "get_element")]
54    fn element(&self) -> Option<gst::Element> {
55        unsafe {
56            from_glib_none(ffi::gst_validate_monitor_get_element(
57                self.as_ref().to_glib_none().0,
58            ))
59        }
60    }
61
62    #[doc(alias = "gst_validate_monitor_get_element_name")]
63    #[doc(alias = "get_element_name")]
64    fn element_name(&self) -> Option<glib::GString> {
65        unsafe {
66            from_glib_full(ffi::gst_validate_monitor_get_element_name(
67                self.as_ref().to_glib_none().0,
68            ))
69        }
70    }
71
72    #[doc(alias = "gst_validate_monitor_get_pipeline")]
73    #[doc(alias = "get_pipeline")]
74    fn pipeline(&self) -> Option<gst::Pipeline> {
75        unsafe {
76            from_glib_full(ffi::gst_validate_monitor_get_pipeline(
77                self.as_ref().to_glib_none().0,
78            ))
79        }
80    }
81
82    #[doc(alias = "gst_validate_monitor_get_target")]
83    #[doc(alias = "get_target")]
84    fn target(&self) -> Option<gst::Object> {
85        unsafe {
86            from_glib_full(ffi::gst_validate_monitor_get_target(
87                self.as_ref().to_glib_none().0,
88            ))
89        }
90    }
91
92    //#[doc(alias = "gst_validate_monitor_set_media_descriptor")]
93    //fn set_media_descriptor(&self, media_descriptor: /*Ignored*/&MediaDescriptor) {
94    //    unsafe { TODO: call ffi:gst_validate_monitor_set_media_descriptor() }
95    //}
96
97    fn object(&self) -> Option<glib::Object> {
98        ObjectExt::property(self.as_ref(), "object")
99    }
100
101    fn set_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: Option<&P>) {
102        ObjectExt::set_property(self.as_ref(), "pipeline", pipeline)
103    }
104
105    #[doc(alias = "validate-parent")]
106    fn validate_parent(&self) -> Option<Monitor> {
107        ObjectExt::property(self.as_ref(), "validate-parent")
108    }
109
110    //fn verbosity(&self) -> /*Ignored*/VerbosityFlags {
111    //    ObjectExt::property(self.as_ref(), "verbosity")
112    //}
113
114    //fn set_verbosity(&self, verbosity: /*Ignored*/VerbosityFlags) {
115    //    ObjectExt::set_property(self.as_ref(),"verbosity", verbosity)
116    //}
117
118    #[doc(alias = "pipeline")]
119    fn connect_pipeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
120        &self,
121        f: F,
122    ) -> SignalHandlerId {
123        unsafe extern "C" fn notify_pipeline_trampoline<
124            P: IsA<Monitor>,
125            F: Fn(&P) + Send + Sync + 'static,
126        >(
127            this: *mut ffi::GstValidateMonitor,
128            _param_spec: glib::ffi::gpointer,
129            f: glib::ffi::gpointer,
130        ) {
131            let f: &F = &*(f as *const F);
132            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
133        }
134        unsafe {
135            let f: Box_<F> = Box_::new(f);
136            connect_raw(
137                self.as_ptr() as *mut _,
138                c"notify::pipeline".as_ptr() as *const _,
139                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
140                    notify_pipeline_trampoline::<Self, F> as *const (),
141                )),
142                Box_::into_raw(f),
143            )
144        }
145    }
146
147    #[doc(alias = "verbosity")]
148    fn connect_verbosity_notify<F: Fn(&Self) + Send + Sync + 'static>(
149        &self,
150        f: F,
151    ) -> SignalHandlerId {
152        unsafe extern "C" fn notify_verbosity_trampoline<
153            P: IsA<Monitor>,
154            F: Fn(&P) + Send + Sync + 'static,
155        >(
156            this: *mut ffi::GstValidateMonitor,
157            _param_spec: glib::ffi::gpointer,
158            f: glib::ffi::gpointer,
159        ) {
160            let f: &F = &*(f as *const F);
161            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
162        }
163        unsafe {
164            let f: Box_<F> = Box_::new(f);
165            connect_raw(
166                self.as_ptr() as *mut _,
167                c"notify::verbosity".as_ptr() as *const _,
168                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
169                    notify_verbosity_trampoline::<Self, F> as *const (),
170                )),
171                Box_::into_raw(f),
172            )
173        }
174    }
175}
176
177impl<O: IsA<Monitor>> MonitorExt for O {}