Skip to main content

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::{Action, Reporter, Runner, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
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
52unsafe impl Send for Scenario {}
53unsafe impl Sync for Scenario {}
54
55pub trait ScenarioExt: IsA<Scenario> + 'static {
56    //#[doc(alias = "gst_validate_scenario_execute_seek")]
57    //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 {
58    //    unsafe { TODO: call ffi:gst_validate_scenario_execute_seek() }
59    //}
60
61    #[doc(alias = "gst_validate_scenario_get_actions")]
62    #[doc(alias = "get_actions")]
63    fn actions(&self) -> Vec<Action> {
64        unsafe {
65            FromGlibPtrContainer::from_glib_full(ffi::gst_validate_scenario_get_actions(
66                self.as_ref().to_glib_none().0,
67            ))
68        }
69    }
70
71    #[doc(alias = "gst_validate_scenario_get_pipeline")]
72    #[doc(alias = "get_pipeline")]
73    fn pipeline(&self) -> Option<gst::Element> {
74        unsafe {
75            from_glib_full(ffi::gst_validate_scenario_get_pipeline(
76                self.as_ref().to_glib_none().0,
77            ))
78        }
79    }
80
81    #[doc(alias = "gst_validate_scenario_get_target_state")]
82    #[doc(alias = "get_target_state")]
83    fn target_state(&self) -> gst::State {
84        unsafe {
85            from_glib(ffi::gst_validate_scenario_get_target_state(
86                self.as_ref().to_glib_none().0,
87            ))
88        }
89    }
90
91    #[doc(alias = "execute-on-idle")]
92    fn is_execute_on_idle(&self) -> bool {
93        ObjectExt::property(self.as_ref(), "execute-on-idle")
94    }
95
96    #[doc(alias = "execute-on-idle")]
97    fn set_execute_on_idle(&self, execute_on_idle: bool) {
98        ObjectExt::set_property(self.as_ref(), "execute-on-idle", execute_on_idle)
99    }
100
101    #[doc(alias = "handles-states")]
102    fn is_handles_states(&self) -> bool {
103        ObjectExt::property(self.as_ref(), "handles-states")
104    }
105
106    #[doc(alias = "action-done")]
107    fn connect_action_done<F: Fn(&Self, &Action) + Send + Sync + 'static>(
108        &self,
109        f: F,
110    ) -> SignalHandlerId {
111        unsafe extern "C" fn action_done_trampoline<
112            P: IsA<Scenario>,
113            F: Fn(&P, &Action) + Send + Sync + 'static,
114        >(
115            this: *mut ffi::GstValidateScenario,
116            action: *mut ffi::GstValidateAction,
117            f: glib::ffi::gpointer,
118        ) {
119            unsafe {
120                let f: &F = &*(f as *const F);
121                f(
122                    Scenario::from_glib_borrow(this).unsafe_cast_ref(),
123                    &from_glib_borrow(action),
124                )
125            }
126        }
127        unsafe {
128            let f: Box_<F> = Box_::new(f);
129            connect_raw(
130                self.as_ptr() as *mut _,
131                c"action-done".as_ptr(),
132                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
133                    action_done_trampoline::<Self, F> as *const (),
134                )),
135                Box_::into_raw(f),
136            )
137        }
138    }
139
140    #[doc(alias = "done")]
141    fn connect_done<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
142        unsafe extern "C" fn done_trampoline<
143            P: IsA<Scenario>,
144            F: Fn(&P) + Send + Sync + 'static,
145        >(
146            this: *mut ffi::GstValidateScenario,
147            f: glib::ffi::gpointer,
148        ) {
149            unsafe {
150                let f: &F = &*(f as *const F);
151                f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
152            }
153        }
154        unsafe {
155            let f: Box_<F> = Box_::new(f);
156            connect_raw(
157                self.as_ptr() as *mut _,
158                c"done".as_ptr(),
159                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
160                    done_trampoline::<Self, F> as *const (),
161                )),
162                Box_::into_raw(f),
163            )
164        }
165    }
166
167    #[cfg(feature = "v1_26")]
168    #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
169    #[doc(alias = "stopping")]
170    fn connect_stopping<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
171        unsafe extern "C" fn stopping_trampoline<
172            P: IsA<Scenario>,
173            F: Fn(&P) + Send + Sync + 'static,
174        >(
175            this: *mut ffi::GstValidateScenario,
176            f: glib::ffi::gpointer,
177        ) {
178            unsafe {
179                let f: &F = &*(f as *const F);
180                f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
181            }
182        }
183        unsafe {
184            let f: Box_<F> = Box_::new(f);
185            connect_raw(
186                self.as_ptr() as *mut _,
187                c"stopping".as_ptr(),
188                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
189                    stopping_trampoline::<Self, F> as *const (),
190                )),
191                Box_::into_raw(f),
192            )
193        }
194    }
195
196    #[doc(alias = "execute-on-idle")]
197    fn connect_execute_on_idle_notify<F: Fn(&Self) + Send + Sync + 'static>(
198        &self,
199        f: F,
200    ) -> SignalHandlerId {
201        unsafe extern "C" fn notify_execute_on_idle_trampoline<
202            P: IsA<Scenario>,
203            F: Fn(&P) + Send + Sync + 'static,
204        >(
205            this: *mut ffi::GstValidateScenario,
206            _param_spec: glib::ffi::gpointer,
207            f: glib::ffi::gpointer,
208        ) {
209            unsafe {
210                let f: &F = &*(f as *const F);
211                f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
212            }
213        }
214        unsafe {
215            let f: Box_<F> = Box_::new(f);
216            connect_raw(
217                self.as_ptr() as *mut _,
218                c"notify::execute-on-idle".as_ptr(),
219                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220                    notify_execute_on_idle_trampoline::<Self, F> as *const (),
221                )),
222                Box_::into_raw(f),
223            )
224        }
225    }
226
227    #[doc(alias = "handles-states")]
228    fn connect_handles_states_notify<F: Fn(&Self) + Send + Sync + 'static>(
229        &self,
230        f: F,
231    ) -> SignalHandlerId {
232        unsafe extern "C" fn notify_handles_states_trampoline<
233            P: IsA<Scenario>,
234            F: Fn(&P) + Send + Sync + 'static,
235        >(
236            this: *mut ffi::GstValidateScenario,
237            _param_spec: glib::ffi::gpointer,
238            f: glib::ffi::gpointer,
239        ) {
240            unsafe {
241                let f: &F = &*(f as *const F);
242                f(Scenario::from_glib_borrow(this).unsafe_cast_ref())
243            }
244        }
245        unsafe {
246            let f: Box_<F> = Box_::new(f);
247            connect_raw(
248                self.as_ptr() as *mut _,
249                c"notify::handles-states".as_ptr(),
250                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
251                    notify_handles_states_trampoline::<Self, F> as *const (),
252                )),
253                Box_::into_raw(f),
254            )
255        }
256    }
257}
258
259impl<O: IsA<Scenario>> ScenarioExt for O {}