1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::{ffi, Report, ReportingDetails, Runner};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `validate-runner`
    ///  Readable | Writeable | Construct Only
    ///
    /// # Implements
    ///
    /// [`ReporterExt`][trait@crate::prelude::ReporterExt]
    #[doc(alias = "GstValidateReporter")]
    pub struct Reporter(Interface<ffi::GstValidateReporter, ffi::GstValidateReporterInterface>);

    match fn {
        type_ => || ffi::gst_validate_reporter_get_type(),
    }
}

impl Reporter {
    pub const NONE: Option<&'static Reporter> = None;
}

unsafe impl Send for Reporter {}
unsafe impl Sync for Reporter {}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Reporter>> Sealed for T {}
}

/// Trait containing all [`struct@Reporter`] methods.
///
/// # Implementors
///
/// [`BinMonitor`][struct@crate::BinMonitor], [`ElementMonitor`][struct@crate::ElementMonitor], [`Monitor`][struct@crate::Monitor], [`PadMonitor`][struct@crate::PadMonitor], [`PipelineMonitor`][struct@crate::PipelineMonitor], [`Reporter`][struct@crate::Reporter], [`Scenario`][struct@crate::Scenario]
pub trait ReporterExt: IsA<Reporter> + sealed::Sealed + 'static {
    /// Gets `name` of `self`
    ///
    /// # Returns
    ///
    /// The name of the reporter
    #[doc(alias = "gst_validate_reporter_get_name")]
    #[doc(alias = "get_name")]
    fn name(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::gst_validate_reporter_get_name(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// The [`gst::Pipeline`][crate::gst::Pipeline]
    #[doc(alias = "gst_validate_reporter_get_pipeline")]
    #[doc(alias = "get_pipeline")]
    fn pipeline(&self) -> Option<gst::Pipeline> {
        unsafe {
            from_glib_full(ffi::gst_validate_reporter_get_pipeline(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "gst_validate_reporter_get_report")]
    //#[doc(alias = "get_report")]
    //fn report(&self, issue_id: /*Ignored*/IssueId) -> Option<Report> {
    //    unsafe { TODO: call ffi:gst_validate_reporter_get_report() }
    //}

    #[doc(alias = "gst_validate_reporter_get_reporting_level")]
    #[doc(alias = "get_reporting_level")]
    fn reporting_level(&self) -> ReportingDetails {
        unsafe {
            from_glib(ffi::gst_validate_reporter_get_reporting_level(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the list of reports present in the reporter.
    ///
    /// # Returns
    ///
    /// the list of
    /// [`Report`][crate::Report] present in the reporter.
    /// The caller should unref each report once it is done with them.
    #[doc(alias = "gst_validate_reporter_get_reports")]
    #[doc(alias = "get_reports")]
    fn reports(&self) -> Vec<Report> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gst_validate_reporter_get_reports(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the number of reports present in the reporter.
    ///
    /// # Returns
    ///
    /// the number of reports currently present in `self`.
    #[doc(alias = "gst_validate_reporter_get_reports_count")]
    #[doc(alias = "get_reports_count")]
    fn reports_count(&self) -> i32 {
        unsafe { ffi::gst_validate_reporter_get_reports_count(self.as_ref().to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// The runner
    #[doc(alias = "gst_validate_reporter_get_runner")]
    #[doc(alias = "get_runner")]
    fn runner(&self) -> Option<Runner> {
        unsafe {
            from_glib_full(ffi::gst_validate_reporter_get_runner(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gst_validate_reporter_init")]
    fn init(&self, name: &str) {
        unsafe {
            ffi::gst_validate_reporter_init(self.as_ref().to_glib_none().0, name.to_glib_none().0);
        }
    }

    /// Remove all the [`Report`][crate::Report] from `self`. This should be called
    /// before unreffing the reporter to break cyclic references.
    #[doc(alias = "gst_validate_reporter_purge_reports")]
    fn purge_reports(&self) {
        unsafe {
            ffi::gst_validate_reporter_purge_reports(self.as_ref().to_glib_none().0);
        }
    }

    //#[doc(alias = "gst_validate_reporter_report_simple")]
    //fn report_simple(&self, issue_id: /*Ignored*/IssueId, message: &str) {
    //    unsafe { TODO: call ffi:gst_validate_reporter_report_simple() }
    //}

    /// Set `self` has the 'source' of any g_log happening during the
    /// execution. Usually the monitor of the first [`gst::Pipeline`][crate::gst::Pipeline] is used
    /// to handle g_logs.
    ///
    /// Basically this function is used in order to start tracking any
    /// issue reported with g_log in the process into GstValidate report
    /// in the GstValidate reporting system.
    #[doc(alias = "gst_validate_reporter_set_handle_g_logs")]
    fn set_handle_g_logs(&self) {
        unsafe {
            ffi::gst_validate_reporter_set_handle_g_logs(self.as_ref().to_glib_none().0);
        }
    }

    /// Sets `name` on `self`
    /// ## `name`
    /// The name of the reporter
    #[doc(alias = "gst_validate_reporter_set_name")]
    fn set_name(&self, name: Option<glib::GString>) {
        unsafe {
            ffi::gst_validate_reporter_set_name(
                self.as_ref().to_glib_none().0,
                name.into_glib_ptr(),
            );
        }
    }

    #[doc(alias = "gst_validate_reporter_set_runner")]
    fn set_runner(&self, runner: &impl IsA<Runner>) {
        unsafe {
            ffi::gst_validate_reporter_set_runner(
                self.as_ref().to_glib_none().0,
                runner.as_ref().to_glib_none().0,
            );
        }
    }

    #[doc(alias = "validate-runner")]
    fn validate_runner(&self) -> Option<Runner> {
        ObjectExt::property(self.as_ref(), "validate-runner")
    }
}

impl<O: IsA<Reporter>> ReporterExt for O {}