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    /// GStreamer Validate Monitor class.
16    ///
17    /// Class that wraps a [`glib::Object`][crate::glib::Object] for Validate checks
18    ///
19    /// This is an Abstract Base Class, you cannot instantiate it.
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `object`
25    ///  Readable | Writeable | Construct Only
26    ///
27    ///
28    /// #### `pipeline`
29    ///  Readable | Writeable | Construct
30    ///
31    ///
32    /// #### `validate-parent`
33    ///  Readable | Writeable | Construct Only
34    ///
35    ///
36    /// #### `validate-runner`
37    ///  Readable | Writeable | Construct Only
38    ///
39    ///
40    /// #### `verbosity`
41    ///  Readable | Writeable
42    /// <details><summary><h4>Object</h4></summary>
43    ///
44    ///
45    /// #### `name`
46    ///  Readable | Writeable | Construct
47    ///
48    ///
49    /// #### `parent`
50    ///  The parent of the object. Please note, that when changing the 'parent'
51    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
52    /// signals due to locking issues. In some cases one can use
53    /// [`element-added`][struct@crate::gst::Bin#element-added] or [`element-removed`][struct@crate::gst::Bin#element-removed] signals on the parent to
54    /// achieve a similar effect.
55    ///
56    /// Readable | Writeable
57    /// </details>
58    /// <details><summary><h4>Reporter</h4></summary>
59    ///
60    ///
61    /// #### `validate-runner`
62    ///  Readable | Writeable | Construct Only
63    /// </details>
64    ///
65    /// # Implements
66    ///
67    /// [`MonitorExt`][trait@crate::prelude::MonitorExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`ReporterExt`][trait@crate::prelude::ReporterExt]
68    #[doc(alias = "GstValidateMonitor")]
69    pub struct Monitor(Object<ffi::GstValidateMonitor, ffi::GstValidateMonitorClass>) @extends gst::Object, @implements Reporter;
70
71    match fn {
72        type_ => || ffi::gst_validate_monitor_get_type(),
73    }
74}
75
76impl Monitor {
77    pub const NONE: Option<&'static Monitor> = None;
78
79    /// Create a new monitor for `target` and starts monitoring it.
80    /// ## `target`
81    /// The [`gst::Object`][crate::gst::Object] to create a [`Monitor`][crate::Monitor] for
82    /// ## `runner`
83    /// The [`Runner`][crate::Runner] to use for the new monitor
84    /// ## `parent`
85    /// The parent of the new monitor
86    ///
87    /// # Returns
88    ///
89    /// The newly created [`Monitor`][crate::Monitor]
90    #[doc(alias = "gst_validate_monitor_factory_create")]
91    pub fn factory_create(
92        target: &impl IsA<gst::Object>,
93        runner: &impl IsA<Runner>,
94        parent: Option<&impl IsA<Monitor>>,
95    ) -> Monitor {
96        skip_assert_initialized!();
97        unsafe {
98            from_glib_full(ffi::gst_validate_monitor_factory_create(
99                target.as_ref().to_glib_none().0,
100                runner.as_ref().to_glib_none().0,
101                parent.map(|p| p.as_ref()).to_glib_none().0,
102            ))
103        }
104    }
105}
106
107unsafe impl Send for Monitor {}
108unsafe impl Sync for Monitor {}
109
110/// Trait containing all [`struct@Monitor`] methods.
111///
112/// # Implementors
113///
114/// [`ElementMonitor`][struct@crate::ElementMonitor], [`Monitor`][struct@crate::Monitor], [`PadMonitor`][struct@crate::PadMonitor]
115pub trait MonitorExt: IsA<Monitor> + 'static {
116    //#[doc(alias = "gst_validate_monitor_attach_override")]
117    //fn attach_override(&self, override_: /*Ignored*/&Override) {
118    //    unsafe { TODO: call ffi:gst_validate_monitor_attach_override() }
119    //}
120
121    ///
122    /// # Returns
123    ///
124    /// The GstElement associated with `self`
125    #[doc(alias = "gst_validate_monitor_get_element")]
126    #[doc(alias = "get_element")]
127    fn element(&self) -> Option<gst::Element> {
128        unsafe {
129            from_glib_none(ffi::gst_validate_monitor_get_element(
130                self.as_ref().to_glib_none().0,
131            ))
132        }
133    }
134
135    ///
136    /// # Returns
137    ///
138    /// The name of the element associated with `self`
139    #[doc(alias = "gst_validate_monitor_get_element_name")]
140    #[doc(alias = "get_element_name")]
141    fn element_name(&self) -> Option<glib::GString> {
142        unsafe {
143            from_glib_full(ffi::gst_validate_monitor_get_element_name(
144                self.as_ref().to_glib_none().0,
145            ))
146        }
147    }
148
149    ///
150    /// # Returns
151    ///
152    /// The pipeline in which `self`
153    /// target is in.
154    #[doc(alias = "gst_validate_monitor_get_pipeline")]
155    #[doc(alias = "get_pipeline")]
156    fn pipeline(&self) -> Option<gst::Pipeline> {
157        unsafe {
158            from_glib_full(ffi::gst_validate_monitor_get_pipeline(
159                self.as_ref().to_glib_none().0,
160            ))
161        }
162    }
163
164    ///
165    /// # Returns
166    ///
167    /// The target object
168    #[doc(alias = "gst_validate_monitor_get_target")]
169    #[doc(alias = "get_target")]
170    fn target(&self) -> Option<gst::Object> {
171        unsafe {
172            from_glib_full(ffi::gst_validate_monitor_get_target(
173                self.as_ref().to_glib_none().0,
174            ))
175        }
176    }
177
178    //#[doc(alias = "gst_validate_monitor_set_media_descriptor")]
179    //fn set_media_descriptor(&self, media_descriptor: /*Ignored*/&MediaDescriptor) {
180    //    unsafe { TODO: call ffi:gst_validate_monitor_set_media_descriptor() }
181    //}
182
183    fn object(&self) -> Option<glib::Object> {
184        ObjectExt::property(self.as_ref(), "object")
185    }
186
187    fn set_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: Option<&P>) {
188        ObjectExt::set_property(self.as_ref(), "pipeline", pipeline)
189    }
190
191    #[doc(alias = "validate-parent")]
192    fn validate_parent(&self) -> Option<Monitor> {
193        ObjectExt::property(self.as_ref(), "validate-parent")
194    }
195
196    //fn verbosity(&self) -> /*Ignored*/VerbosityFlags {
197    //    ObjectExt::property(self.as_ref(), "verbosity")
198    //}
199
200    //fn set_verbosity(&self, verbosity: /*Ignored*/VerbosityFlags) {
201    //    ObjectExt::set_property(self.as_ref(),"verbosity", verbosity)
202    //}
203
204    #[doc(alias = "pipeline")]
205    fn connect_pipeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
206        &self,
207        f: F,
208    ) -> SignalHandlerId {
209        unsafe extern "C" fn notify_pipeline_trampoline<
210            P: IsA<Monitor>,
211            F: Fn(&P) + Send + Sync + 'static,
212        >(
213            this: *mut ffi::GstValidateMonitor,
214            _param_spec: glib::ffi::gpointer,
215            f: glib::ffi::gpointer,
216        ) {
217            let f: &F = &*(f as *const F);
218            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
219        }
220        unsafe {
221            let f: Box_<F> = Box_::new(f);
222            connect_raw(
223                self.as_ptr() as *mut _,
224                c"notify::pipeline".as_ptr() as *const _,
225                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
226                    notify_pipeline_trampoline::<Self, F> as *const (),
227                )),
228                Box_::into_raw(f),
229            )
230        }
231    }
232
233    #[doc(alias = "verbosity")]
234    fn connect_verbosity_notify<F: Fn(&Self) + Send + Sync + 'static>(
235        &self,
236        f: F,
237    ) -> SignalHandlerId {
238        unsafe extern "C" fn notify_verbosity_trampoline<
239            P: IsA<Monitor>,
240            F: Fn(&P) + Send + Sync + 'static,
241        >(
242            this: *mut ffi::GstValidateMonitor,
243            _param_spec: glib::ffi::gpointer,
244            f: glib::ffi::gpointer,
245        ) {
246            let f: &F = &*(f as *const F);
247            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
248        }
249        unsafe {
250            let f: Box_<F> = Box_::new(f);
251            connect_raw(
252                self.as_ptr() as *mut _,
253                c"notify::verbosity".as_ptr() as *const _,
254                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
255                    notify_verbosity_trampoline::<Self, F> as *const (),
256                )),
257                Box_::into_raw(f),
258            )
259        }
260    }
261}
262
263impl<O: IsA<Monitor>> MonitorExt for O {}