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
110mod sealed {
111 pub trait Sealed {}
112 impl<T: super::IsA<super::Monitor>> Sealed for T {}
113}
114
115/// Trait containing all [`struct@Monitor`] methods.
116///
117/// # Implementors
118///
119/// [`ElementMonitor`][struct@crate::ElementMonitor], [`Monitor`][struct@crate::Monitor], [`PadMonitor`][struct@crate::PadMonitor]
120pub trait MonitorExt: IsA<Monitor> + sealed::Sealed + 'static {
121 //#[doc(alias = "gst_validate_monitor_attach_override")]
122 //fn attach_override(&self, override_: /*Ignored*/&Override) {
123 // unsafe { TODO: call ffi:gst_validate_monitor_attach_override() }
124 //}
125
126 ///
127 /// # Returns
128 ///
129 /// The GstElement associated with `self`
130 #[doc(alias = "gst_validate_monitor_get_element")]
131 #[doc(alias = "get_element")]
132 fn element(&self) -> Option<gst::Element> {
133 unsafe {
134 from_glib_none(ffi::gst_validate_monitor_get_element(
135 self.as_ref().to_glib_none().0,
136 ))
137 }
138 }
139
140 ///
141 /// # Returns
142 ///
143 /// The name of the element associated with `self`
144 #[doc(alias = "gst_validate_monitor_get_element_name")]
145 #[doc(alias = "get_element_name")]
146 fn element_name(&self) -> Option<glib::GString> {
147 unsafe {
148 from_glib_full(ffi::gst_validate_monitor_get_element_name(
149 self.as_ref().to_glib_none().0,
150 ))
151 }
152 }
153
154 ///
155 /// # Returns
156 ///
157 /// The pipeline in which `self`
158 /// target is in.
159 #[doc(alias = "gst_validate_monitor_get_pipeline")]
160 #[doc(alias = "get_pipeline")]
161 fn pipeline(&self) -> Option<gst::Pipeline> {
162 unsafe {
163 from_glib_full(ffi::gst_validate_monitor_get_pipeline(
164 self.as_ref().to_glib_none().0,
165 ))
166 }
167 }
168
169 ///
170 /// # Returns
171 ///
172 /// The target object
173 #[doc(alias = "gst_validate_monitor_get_target")]
174 #[doc(alias = "get_target")]
175 fn target(&self) -> Option<gst::Object> {
176 unsafe {
177 from_glib_full(ffi::gst_validate_monitor_get_target(
178 self.as_ref().to_glib_none().0,
179 ))
180 }
181 }
182
183 //#[doc(alias = "gst_validate_monitor_set_media_descriptor")]
184 //fn set_media_descriptor(&self, media_descriptor: /*Ignored*/&MediaDescriptor) {
185 // unsafe { TODO: call ffi:gst_validate_monitor_set_media_descriptor() }
186 //}
187
188 fn object(&self) -> Option<glib::Object> {
189 ObjectExt::property(self.as_ref(), "object")
190 }
191
192 fn set_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: Option<&P>) {
193 ObjectExt::set_property(self.as_ref(), "pipeline", pipeline)
194 }
195
196 #[doc(alias = "validate-parent")]
197 fn validate_parent(&self) -> Option<Monitor> {
198 ObjectExt::property(self.as_ref(), "validate-parent")
199 }
200
201 //fn verbosity(&self) -> /*Ignored*/VerbosityFlags {
202 // ObjectExt::property(self.as_ref(), "verbosity")
203 //}
204
205 //fn set_verbosity(&self, verbosity: /*Ignored*/VerbosityFlags) {
206 // ObjectExt::set_property(self.as_ref(),"verbosity", verbosity)
207 //}
208
209 #[doc(alias = "pipeline")]
210 fn connect_pipeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
211 &self,
212 f: F,
213 ) -> SignalHandlerId {
214 unsafe extern "C" fn notify_pipeline_trampoline<
215 P: IsA<Monitor>,
216 F: Fn(&P) + Send + Sync + 'static,
217 >(
218 this: *mut ffi::GstValidateMonitor,
219 _param_spec: glib::ffi::gpointer,
220 f: glib::ffi::gpointer,
221 ) {
222 let f: &F = &*(f as *const F);
223 f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
224 }
225 unsafe {
226 let f: Box_<F> = Box_::new(f);
227 connect_raw(
228 self.as_ptr() as *mut _,
229 b"notify::pipeline\0".as_ptr() as *const _,
230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
231 notify_pipeline_trampoline::<Self, F> as *const (),
232 )),
233 Box_::into_raw(f),
234 )
235 }
236 }
237
238 #[doc(alias = "verbosity")]
239 fn connect_verbosity_notify<F: Fn(&Self) + Send + Sync + 'static>(
240 &self,
241 f: F,
242 ) -> SignalHandlerId {
243 unsafe extern "C" fn notify_verbosity_trampoline<
244 P: IsA<Monitor>,
245 F: Fn(&P) + Send + Sync + 'static,
246 >(
247 this: *mut ffi::GstValidateMonitor,
248 _param_spec: glib::ffi::gpointer,
249 f: glib::ffi::gpointer,
250 ) {
251 let f: &F = &*(f as *const F);
252 f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
253 }
254 unsafe {
255 let f: Box_<F> = Box_::new(f);
256 connect_raw(
257 self.as_ptr() as *mut _,
258 b"notify::verbosity\0".as_ptr() as *const _,
259 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
260 notify_verbosity_trampoline::<Self, F> as *const (),
261 )),
262 Box_::into_raw(f),
263 )
264 }
265 }
266}
267
268impl<O: IsA<Monitor>> MonitorExt for O {}