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    #[doc(alias = "GstValidateBinMonitor")]
16    pub struct BinMonitor(Object<ffi::GstValidateBinMonitor, ffi::GstValidateBinMonitorClass>) @extends ElementMonitor, Monitor, gst::Object, @implements Reporter;
17
18    match fn {
19        type_ => || ffi::gst_validate_bin_monitor_get_type(),
20    }
21}
22
23impl BinMonitor {
24    pub const NONE: Option<&'static BinMonitor> = None;
25
26    #[doc(alias = "gst_validate_bin_monitor_new")]
27    pub fn new(
28        bin: &impl IsA<gst::Bin>,
29        runner: &impl IsA<Runner>,
30        parent: Option<&impl IsA<Monitor>>,
31    ) -> BinMonitor {
32        skip_assert_initialized!();
33        unsafe {
34            from_glib_full(ffi::gst_validate_bin_monitor_new(
35                bin.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 BinMonitor {}
44unsafe impl Sync for BinMonitor {}
45
46mod sealed {
47    pub trait Sealed {}
48    impl<T: super::IsA<super::BinMonitor>> Sealed for T {}
49}
50
51pub trait BinMonitorExt: IsA<BinMonitor> + sealed::Sealed + 'static {
52    #[doc(alias = "gst_validate_bin_monitor_get_scenario")]
53    #[doc(alias = "get_scenario")]
54    fn scenario(&self) -> Option<Scenario> {
55        unsafe {
56            from_glib_full(ffi::gst_validate_bin_monitor_get_scenario(
57                self.as_ref().to_glib_none().0,
58            ))
59        }
60    }
61
62    #[doc(alias = "handles-states")]
63    fn is_handles_states(&self) -> bool {
64        ObjectExt::property(self.as_ref(), "handles-states")
65    }
66
67    #[doc(alias = "handles-states")]
68    fn connect_handles_states_notify<F: Fn(&Self) + Send + Sync + 'static>(
69        &self,
70        f: F,
71    ) -> SignalHandlerId {
72        unsafe extern "C" fn notify_handles_states_trampoline<
73            P: IsA<BinMonitor>,
74            F: Fn(&P) + Send + Sync + 'static,
75        >(
76            this: *mut ffi::GstValidateBinMonitor,
77            _param_spec: glib::ffi::gpointer,
78            f: glib::ffi::gpointer,
79        ) {
80            let f: &F = &*(f as *const F);
81            f(BinMonitor::from_glib_borrow(this).unsafe_cast_ref())
82        }
83        unsafe {
84            let f: Box_<F> = Box_::new(f);
85            connect_raw(
86                self.as_ptr() as *mut _,
87                b"notify::handles-states\0".as_ptr() as *const _,
88                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
89                    notify_handles_states_trampoline::<Self, F> as *const (),
90                )),
91                Box_::into_raw(f),
92            )
93        }
94    }
95}
96
97impl<O: IsA<BinMonitor>> BinMonitorExt for O {}