gstreamer_validate/auto/
scenario.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, Action, Reporter, Runner};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    #[doc(alias = "GstValidateScenario")]
17    pub struct Scenario(Object<ffi::GstValidateScenario, ffi::GstValidateScenarioClass>) @extends gst::Object, @implements Reporter;
18
19    match fn {
20        type_ => || ffi::gst_validate_scenario_get_type(),
21    }
22}
23
24impl Scenario {
25    pub const NONE: Option<&'static Scenario> = None;
26
27    #[doc(alias = "gst_validate_scenario_deinit")]
28    pub fn deinit() {
29        assert_initialized_main_thread!();
30        unsafe {
31            ffi::gst_validate_scenario_deinit();
32        }
33    }
34
35    #[doc(alias = "gst_validate_scenario_factory_create")]
36    pub fn factory_create(
37        runner: &impl IsA<Runner>,
38        pipeline: &impl IsA<gst::Element>,
39        scenario_name: &str,
40    ) -> Option<Scenario> {
41        skip_assert_initialized!();
42        unsafe {
43            from_glib_full(ffi::gst_validate_scenario_factory_create(
44                runner.as_ref().to_glib_none().0,
45                pipeline.as_ref().to_glib_none().0,
46                scenario_name.to_glib_none().0,
47            ))
48        }
49    }
50}
51
52mod sealed {
53    pub trait Sealed {}
54    impl<T: super::IsA<super::Scenario>> Sealed for T {}
55}
56
57pub trait ScenarioExt: IsA<Scenario> + sealed::Sealed + 'static {
58    //#[doc(alias = "gst_validate_scenario_execute_seek")]
59    //fn execute_seek(&self, action: &Action, rate: f64, format: gst::Format, flags: gst::SeekFlags, start_type: gst::SeekType, start: /*Ignored*/gst::ClockTime, stop_type: gst::SeekType, stop: /*Ignored*/gst::ClockTime) -> i32 {
60    //    unsafe { TODO: call ffi:gst_validate_scenario_execute_seek() }
61    //}
62
63    #[doc(alias = "gst_validate_scenario_get_actions")]
64    #[doc(alias = "get_actions")]
65    fn actions(&self) -> Vec<Action> {
66        unsafe {
67            FromGlibPtrContainer::from_glib_full(ffi::gst_validate_scenario_get_actions(
68                self.as_ref().to_glib_none().0,
69            ))
70        }
71    }
72
73    #[doc(alias = "gst_validate_scenario_get_pipeline")]
74    #[doc(alias = "get_pipeline")]
75    fn pipeline(&self) -> Option<gst::Element> {
76        unsafe {
77            from_glib_full(ffi::gst_validate_scenario_get_pipeline(
78                self.as_ref().to_glib_none().0,
79            ))
80        }
81    }
82
83    #[doc(alias = "gst_validate_scenario_get_target_state")]
84    #[doc(alias = "get_target_state")]
85    fn target_state(&self) -> gst::State {
86        unsafe {
87            from_glib(ffi::gst_validate_scenario_get_target_state(
88                self.as_ref().to_glib_none().0,
89            ))
90        }
91    }
92
93    #[doc(alias = "execute-on-idle")]
94    fn is_execute_on_idle(&self) -> bool {
95        ObjectExt::property(self.as_ref(), "execute-on-idle")
96    }
97
98    #[doc(alias = "execute-on-idle")]
99    fn set_execute_on_idle(&self, execute_on_idle: bool) {
100        ObjectExt::set_property(self.as_ref(), "execute-on-idle", execute_on_idle)
101    }
102
103    #[doc(alias = "handles-states")]
104    fn is_handles_states(&self) -> bool {
105        ObjectExt::property(self.as_ref(), "handles-states")
106    }
107
108    #[doc(alias = "action-done")]
109    fn connect_action_done<F: Fn(&Self, &Action) + 'static>(&self, f: F) -> SignalHandlerId {
110        unsafe extern "C" fn action_done_trampoline<
111            P: IsA<Scenario>,
112            F: Fn(&P, &Action) + 'static,
113        >(
114            this: *mut ffi::GstValidateScenario,
115            action: *mut ffi::GstValidateAction,
116            f: glib::ffi::gpointer,
117        ) {
118            let f: &F = &*(f as *const F);
119            f(
120                Scenario::from_glib_borrow(this).unsafe_cast_ref(),
121                &from_glib_borrow(action),
122            )
123        }
124        unsafe {
125            let f: Box_<F> = Box_::new(f);
126            connect_raw(
127                self.as_ptr() as *mut _,
128                b"action-done\0".as_ptr() as *const _,
129                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
130                    action_done_trampoline::<Self, F> as *const (),
131                )),
132                Box_::into_raw(f),
133            )
134        }
135    }
136
137    #[doc(alias = "done")]
138    fn connect_done<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
139        unsafe extern "C" fn done_trampoline<P: IsA<Scenario>, F: Fn(&P) + 'static>(
140            this: *mut ffi::GstValidateScenario,
141            f: glib::ffi::gpointer,
142        ) {
143            let f: &F = &*(f as *const F);
144            f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
145        }
146        unsafe {
147            let f: Box_<F> = Box_::new(f);
148            connect_raw(
149                self.as_ptr() as *mut _,
150                b"done\0".as_ptr() as *const _,
151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
152                    done_trampoline::<Self, F> as *const (),
153                )),
154                Box_::into_raw(f),
155            )
156        }
157    }
158
159    #[cfg(feature = "v1_26")]
160    #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
161    #[doc(alias = "stopping")]
162    fn connect_stopping<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
163        unsafe extern "C" fn stopping_trampoline<P: IsA<Scenario>, F: Fn(&P) + 'static>(
164            this: *mut ffi::GstValidateScenario,
165            f: glib::ffi::gpointer,
166        ) {
167            let f: &F = &*(f as *const F);
168            f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
169        }
170        unsafe {
171            let f: Box_<F> = Box_::new(f);
172            connect_raw(
173                self.as_ptr() as *mut _,
174                b"stopping\0".as_ptr() as *const _,
175                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
176                    stopping_trampoline::<Self, F> as *const (),
177                )),
178                Box_::into_raw(f),
179            )
180        }
181    }
182
183    #[doc(alias = "execute-on-idle")]
184    fn connect_execute_on_idle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
185        unsafe extern "C" fn notify_execute_on_idle_trampoline<
186            P: IsA<Scenario>,
187            F: Fn(&P) + 'static,
188        >(
189            this: *mut ffi::GstValidateScenario,
190            _param_spec: glib::ffi::gpointer,
191            f: glib::ffi::gpointer,
192        ) {
193            let f: &F = &*(f as *const F);
194            f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
195        }
196        unsafe {
197            let f: Box_<F> = Box_::new(f);
198            connect_raw(
199                self.as_ptr() as *mut _,
200                b"notify::execute-on-idle\0".as_ptr() as *const _,
201                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
202                    notify_execute_on_idle_trampoline::<Self, F> as *const (),
203                )),
204                Box_::into_raw(f),
205            )
206        }
207    }
208
209    #[doc(alias = "handles-states")]
210    fn connect_handles_states_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
211        unsafe extern "C" fn notify_handles_states_trampoline<
212            P: IsA<Scenario>,
213            F: Fn(&P) + 'static,
214        >(
215            this: *mut ffi::GstValidateScenario,
216            _param_spec: glib::ffi::gpointer,
217            f: glib::ffi::gpointer,
218        ) {
219            let f: &F = &*(f as *const F);
220            f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
221        }
222        unsafe {
223            let f: Box_<F> = Box_::new(f);
224            connect_raw(
225                self.as_ptr() as *mut _,
226                b"notify::handles-states\0".as_ptr() as *const _,
227                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
228                    notify_handles_states_trampoline::<Self, F> as *const (),
229                )),
230                Box_::into_raw(f),
231            )
232        }
233    }
234}
235
236impl<O: IsA<Scenario>> ScenarioExt for O {}