Skip to main content

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::{Reporter, Runner, 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 = "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            unsafe {
132                let f: &F = &*(f as *const F);
133                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
134            }
135        }
136        unsafe {
137            let f: Box_<F> = Box_::new(f);
138            connect_raw(
139                self.as_ptr() as *mut _,
140                c"notify::pipeline".as_ptr() as *const _,
141                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
142                    notify_pipeline_trampoline::<Self, F> as *const (),
143                )),
144                Box_::into_raw(f),
145            )
146        }
147    }
148
149    #[doc(alias = "verbosity")]
150    fn connect_verbosity_notify<F: Fn(&Self) + Send + Sync + 'static>(
151        &self,
152        f: F,
153    ) -> SignalHandlerId {
154        unsafe extern "C" fn notify_verbosity_trampoline<
155            P: IsA<Monitor>,
156            F: Fn(&P) + Send + Sync + 'static,
157        >(
158            this: *mut ffi::GstValidateMonitor,
159            _param_spec: glib::ffi::gpointer,
160            f: glib::ffi::gpointer,
161        ) {
162            unsafe {
163                let f: &F = &*(f as *const F);
164                f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
165            }
166        }
167        unsafe {
168            let f: Box_<F> = Box_::new(f);
169            connect_raw(
170                self.as_ptr() as *mut _,
171                c"notify::verbosity".as_ptr() as *const _,
172                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
173                    notify_verbosity_trampoline::<Self, F> as *const (),
174                )),
175                Box_::into_raw(f),
176            )
177        }
178    }
179}
180
181impl<O: IsA<Monitor>> MonitorExt for O {}