gstreamer_validate/auto/
runner.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, Report, ReportingDetails};
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 = "GstValidateRunner")]
17    pub struct Runner(Object<ffi::GstValidateRunner, ffi::GstValidateRunnerClass>) @extends gst::Object;
18
19    match fn {
20        type_ => || ffi::gst_validate_runner_get_type(),
21    }
22}
23
24impl Runner {
25    pub const NONE: Option<&'static Runner> = None;
26
27    #[doc(alias = "gst_validate_runner_new")]
28    pub fn new() -> Runner {
29        assert_initialized_main_thread!();
30        unsafe { from_glib_none(ffi::gst_validate_runner_new()) }
31    }
32}
33
34impl Default for Runner {
35    fn default() -> Self {
36        Self::new()
37    }
38}
39
40unsafe impl Send for Runner {}
41unsafe impl Sync for Runner {}
42
43pub trait RunnerExt: IsA<Runner> + 'static {
44    #[doc(alias = "gst_validate_runner_add_report")]
45    fn add_report(&self, report: &Report) {
46        unsafe {
47            ffi::gst_validate_runner_add_report(
48                self.as_ref().to_glib_none().0,
49                report.to_glib_none().0,
50            );
51        }
52    }
53
54    #[doc(alias = "gst_validate_runner_exit")]
55    fn exit(&self, print_result: bool) -> i32 {
56        unsafe {
57            ffi::gst_validate_runner_exit(self.as_ref().to_glib_none().0, print_result.into_glib())
58        }
59    }
60
61    #[doc(alias = "gst_validate_runner_get_default_reporting_level")]
62    #[doc(alias = "get_default_reporting_level")]
63    fn default_reporting_level(&self) -> ReportingDetails {
64        unsafe {
65            from_glib(ffi::gst_validate_runner_get_default_reporting_level(
66                self.as_ref().to_glib_none().0,
67            ))
68        }
69    }
70
71    #[doc(alias = "gst_validate_runner_get_reporting_level_for_name")]
72    #[doc(alias = "get_reporting_level_for_name")]
73    fn reporting_level_for_name(&self, name: &str) -> ReportingDetails {
74        unsafe {
75            from_glib(ffi::gst_validate_runner_get_reporting_level_for_name(
76                self.as_ref().to_glib_none().0,
77                name.to_glib_none().0,
78            ))
79        }
80    }
81
82    #[doc(alias = "gst_validate_runner_get_reports")]
83    #[doc(alias = "get_reports")]
84    fn reports(&self) -> Vec<Report> {
85        unsafe {
86            FromGlibPtrContainer::from_glib_full(ffi::gst_validate_runner_get_reports(
87                self.as_ref().to_glib_none().0,
88            ))
89        }
90    }
91
92    #[doc(alias = "gst_validate_runner_get_reports_count")]
93    #[doc(alias = "get_reports_count")]
94    fn reports_count(&self) -> u32 {
95        unsafe { ffi::gst_validate_runner_get_reports_count(self.as_ref().to_glib_none().0) }
96    }
97
98    #[doc(alias = "gst_validate_runner_printf")]
99    fn printf(&self) -> i32 {
100        unsafe { ffi::gst_validate_runner_printf(self.as_ref().to_glib_none().0) }
101    }
102
103    #[doc(alias = "report-added")]
104    fn connect_report_added<F: Fn(&Self, &Report) + Send + Sync + 'static>(
105        &self,
106        f: F,
107    ) -> SignalHandlerId {
108        unsafe extern "C" fn report_added_trampoline<
109            P: IsA<Runner>,
110            F: Fn(&P, &Report) + Send + Sync + 'static,
111        >(
112            this: *mut ffi::GstValidateRunner,
113            object: *mut ffi::GstValidateReport,
114            f: glib::ffi::gpointer,
115        ) {
116            let f: &F = &*(f as *const F);
117            f(
118                Runner::from_glib_borrow(this).unsafe_cast_ref(),
119                &from_glib_borrow(object),
120            )
121        }
122        unsafe {
123            let f: Box_<F> = Box_::new(f);
124            connect_raw(
125                self.as_ptr() as *mut _,
126                c"report-added".as_ptr() as *const _,
127                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128                    report_added_trampoline::<Self, F> as *const (),
129                )),
130                Box_::into_raw(f),
131            )
132        }
133    }
134
135    #[doc(alias = "stopping")]
136    fn connect_stopping<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
137        unsafe extern "C" fn stopping_trampoline<
138            P: IsA<Runner>,
139            F: Fn(&P) + Send + Sync + 'static,
140        >(
141            this: *mut ffi::GstValidateRunner,
142            f: glib::ffi::gpointer,
143        ) {
144            let f: &F = &*(f as *const F);
145            f(Runner::from_glib_borrow(this).unsafe_cast_ref())
146        }
147        unsafe {
148            let f: Box_<F> = Box_::new(f);
149            connect_raw(
150                self.as_ptr() as *mut _,
151                c"stopping".as_ptr() as *const _,
152                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
153                    stopping_trampoline::<Self, F> as *const (),
154                )),
155                Box_::into_raw(f),
156            )
157        }
158    }
159}
160
161impl<O: IsA<Runner>> RunnerExt for O {}