gstreamer_validate/auto/
bin_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, ElementMonitor, Monitor, Reporter, Runner, Scenario};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// GStreamer Validate BinMonitor class.
16    ///
17    /// Class that wraps a [`gst::Bin`][crate::gst::Bin] for Validate checks
18    ///
19    /// ## Properties
20    ///
21    ///
22    /// #### `handles-states`
23    ///  Readable
24    /// <details><summary><h4>Monitor</h4></summary>
25    ///
26    ///
27    /// #### `object`
28    ///  Readable | Writeable | Construct Only
29    ///
30    ///
31    /// #### `pipeline`
32    ///  Readable | Writeable | Construct
33    ///
34    ///
35    /// #### `validate-parent`
36    ///  Readable | Writeable | Construct Only
37    ///
38    ///
39    /// #### `validate-runner`
40    ///  Readable | Writeable | Construct Only
41    ///
42    ///
43    /// #### `verbosity`
44    ///  Readable | Writeable
45    /// </details>
46    /// <details><summary><h4>Object</h4></summary>
47    ///
48    ///
49    /// #### `name`
50    ///  Readable | Writeable | Construct
51    ///
52    ///
53    /// #### `parent`
54    ///  The parent of the object. Please note, that when changing the 'parent'
55    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
56    /// signals due to locking issues. In some cases one can use
57    /// [`element-added`][struct@crate::gst::Bin#element-added] or [`element-removed`][struct@crate::gst::Bin#element-removed] signals on the parent to
58    /// achieve a similar effect.
59    ///
60    /// Readable | Writeable
61    /// </details>
62    /// <details><summary><h4>Reporter</h4></summary>
63    ///
64    ///
65    /// #### `validate-runner`
66    ///  Readable | Writeable | Construct Only
67    /// </details>
68    ///
69    /// # Implements
70    ///
71    /// [`BinMonitorExt`][trait@crate::prelude::BinMonitorExt], [`ElementMonitorExt`][trait@crate::prelude::ElementMonitorExt], [`MonitorExt`][trait@crate::prelude::MonitorExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`ReporterExt`][trait@crate::prelude::ReporterExt]
72    #[doc(alias = "GstValidateBinMonitor")]
73    pub struct BinMonitor(Object<ffi::GstValidateBinMonitor, ffi::GstValidateBinMonitorClass>) @extends ElementMonitor, Monitor, gst::Object, @implements Reporter;
74
75    match fn {
76        type_ => || ffi::gst_validate_bin_monitor_get_type(),
77    }
78}
79
80impl BinMonitor {
81    pub const NONE: Option<&'static BinMonitor> = None;
82
83    /// ## `bin`
84    /// a [`gst::Bin`][crate::gst::Bin] to run Validate on
85    /// ## `runner`
86    /// a [`Runner`][crate::Runner]
87    /// ## `parent`
88    /// The parent of the new monitor
89    ///
90    /// # Returns
91    ///
92    /// A [`BinMonitor`][crate::BinMonitor]
93    #[doc(alias = "gst_validate_bin_monitor_new")]
94    pub fn new(
95        bin: &impl IsA<gst::Bin>,
96        runner: &impl IsA<Runner>,
97        parent: Option<&impl IsA<Monitor>>,
98    ) -> BinMonitor {
99        skip_assert_initialized!();
100        unsafe {
101            from_glib_full(ffi::gst_validate_bin_monitor_new(
102                bin.as_ref().to_glib_none().0,
103                runner.as_ref().to_glib_none().0,
104                parent.map(|p| p.as_ref()).to_glib_none().0,
105            ))
106        }
107    }
108}
109
110unsafe impl Send for BinMonitor {}
111unsafe impl Sync for BinMonitor {}
112
113mod sealed {
114    pub trait Sealed {}
115    impl<T: super::IsA<super::BinMonitor>> Sealed for T {}
116}
117
118/// Trait containing all [`struct@BinMonitor`] methods.
119///
120/// # Implementors
121///
122/// [`BinMonitor`][struct@crate::BinMonitor], [`PipelineMonitor`][struct@crate::PipelineMonitor]
123pub trait BinMonitorExt: IsA<BinMonitor> + sealed::Sealed + 'static {
124    ///
125    /// # Returns
126    ///
127    /// The [`Scenario`][crate::Scenario] being executed
128    /// under `self` watch
129    #[doc(alias = "gst_validate_bin_monitor_get_scenario")]
130    #[doc(alias = "get_scenario")]
131    fn scenario(&self) -> Option<Scenario> {
132        unsafe {
133            from_glib_full(ffi::gst_validate_bin_monitor_get_scenario(
134                self.as_ref().to_glib_none().0,
135            ))
136        }
137    }
138
139    #[doc(alias = "handles-states")]
140    fn is_handles_states(&self) -> bool {
141        ObjectExt::property(self.as_ref(), "handles-states")
142    }
143
144    #[doc(alias = "handles-states")]
145    fn connect_handles_states_notify<F: Fn(&Self) + Send + Sync + 'static>(
146        &self,
147        f: F,
148    ) -> SignalHandlerId {
149        unsafe extern "C" fn notify_handles_states_trampoline<
150            P: IsA<BinMonitor>,
151            F: Fn(&P) + Send + Sync + 'static,
152        >(
153            this: *mut ffi::GstValidateBinMonitor,
154            _param_spec: glib::ffi::gpointer,
155            f: glib::ffi::gpointer,
156        ) {
157            let f: &F = &*(f as *const F);
158            f(BinMonitor::from_glib_borrow(this).unsafe_cast_ref())
159        }
160        unsafe {
161            let f: Box_<F> = Box_::new(f);
162            connect_raw(
163                self.as_ptr() as *mut _,
164                b"notify::handles-states\0".as_ptr() as *const _,
165                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
166                    notify_handles_states_trampoline::<Self, F> as *const (),
167                )),
168                Box_::into_raw(f),
169            )
170        }
171    }
172}
173
174impl<O: IsA<BinMonitor>> BinMonitorExt for O {}