gstreamer_validate/auto/
enums.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;
7use glib::{prelude::*, translate::*, GStr};
8
9#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
10#[non_exhaustive]
11#[doc(alias = "GstValidateReportLevel")]
12pub enum ReportLevel {
13    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_CRITICAL")]
14    Critical,
15    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_WARNING")]
16    Warning,
17    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_ISSUE")]
18    Issue,
19    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_IGNORE")]
20    Ignore,
21    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_UNKNOWN")]
22    Unknown,
23    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_EXPECTED")]
24    Expected,
25    #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES")]
26    NumEntries,
27    #[doc(hidden)]
28    __Unknown(i32),
29}
30
31impl ReportLevel {
32    #[doc(alias = "gst_validate_report_level_from_name")]
33    pub fn from_name(level_name: &str) -> ReportLevel {
34        assert_initialized_main_thread!();
35        unsafe {
36            from_glib(ffi::gst_validate_report_level_from_name(
37                level_name.to_glib_none().0,
38            ))
39        }
40    }
41
42    pub fn name<'a>(self) -> &'a GStr {
43        unsafe {
44            GStr::from_ptr(
45                ffi::gst_validate_report_level_get_name(self.into_glib())
46                    .as_ref()
47                    .expect("gst_validate_report_level_get_name returned NULL"),
48            )
49        }
50    }
51}
52
53impl std::fmt::Display for ReportLevel {
54    #[inline]
55    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
56        f.write_str(&self.name())
57    }
58}
59
60#[doc(hidden)]
61impl IntoGlib for ReportLevel {
62    type GlibType = ffi::GstValidateReportLevel;
63
64    #[inline]
65    fn into_glib(self) -> ffi::GstValidateReportLevel {
66        match self {
67            Self::Critical => ffi::GST_VALIDATE_REPORT_LEVEL_CRITICAL,
68            Self::Warning => ffi::GST_VALIDATE_REPORT_LEVEL_WARNING,
69            Self::Issue => ffi::GST_VALIDATE_REPORT_LEVEL_ISSUE,
70            Self::Ignore => ffi::GST_VALIDATE_REPORT_LEVEL_IGNORE,
71            Self::Unknown => ffi::GST_VALIDATE_REPORT_LEVEL_UNKNOWN,
72            Self::Expected => ffi::GST_VALIDATE_REPORT_LEVEL_EXPECTED,
73            Self::NumEntries => ffi::GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES,
74            Self::__Unknown(value) => value,
75        }
76    }
77}
78
79#[doc(hidden)]
80impl FromGlib<ffi::GstValidateReportLevel> for ReportLevel {
81    #[inline]
82    unsafe fn from_glib(value: ffi::GstValidateReportLevel) -> Self {
83        skip_assert_initialized!();
84
85        match value {
86            ffi::GST_VALIDATE_REPORT_LEVEL_CRITICAL => Self::Critical,
87            ffi::GST_VALIDATE_REPORT_LEVEL_WARNING => Self::Warning,
88            ffi::GST_VALIDATE_REPORT_LEVEL_ISSUE => Self::Issue,
89            ffi::GST_VALIDATE_REPORT_LEVEL_IGNORE => Self::Ignore,
90            ffi::GST_VALIDATE_REPORT_LEVEL_UNKNOWN => Self::Unknown,
91            ffi::GST_VALIDATE_REPORT_LEVEL_EXPECTED => Self::Expected,
92            ffi::GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES => Self::NumEntries,
93            value => Self::__Unknown(value),
94        }
95    }
96}
97
98impl StaticType for ReportLevel {
99    #[inline]
100    #[doc(alias = "gst_validate_report_level_get_type")]
101    fn static_type() -> glib::Type {
102        unsafe { from_glib(ffi::gst_validate_report_level_get_type()) }
103    }
104}
105
106impl glib::HasParamSpec for ReportLevel {
107    type ParamSpec = glib::ParamSpecEnum;
108    type SetValue = Self;
109    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
110
111    fn param_spec_builder() -> Self::BuilderFn {
112        Self::ParamSpec::builder_with_default
113    }
114}
115
116impl glib::value::ValueType for ReportLevel {
117    type Type = Self;
118}
119
120unsafe impl<'a> glib::value::FromValue<'a> for ReportLevel {
121    type Checker = glib::value::GenericValueTypeChecker<Self>;
122
123    #[inline]
124    unsafe fn from_value(value: &'a glib::Value) -> Self {
125        skip_assert_initialized!();
126        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
127    }
128}
129
130impl ToValue for ReportLevel {
131    #[inline]
132    fn to_value(&self) -> glib::Value {
133        let mut value = glib::Value::for_value_type::<Self>();
134        unsafe {
135            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
136        }
137        value
138    }
139
140    #[inline]
141    fn value_type(&self) -> glib::Type {
142        Self::static_type()
143    }
144}
145
146impl From<ReportLevel> for glib::Value {
147    #[inline]
148    fn from(v: ReportLevel) -> Self {
149        skip_assert_initialized!();
150        ToValue::to_value(&v)
151    }
152}
153
154/// Setting the reporting level allows to control the way issues are reported
155/// when calling `gst_validate_runner_printf`.
156///
157/// The reporting level can be set through the "GST_VALIDATE_REPORTING_DETAILS"
158/// environment variable, as a comma-separated list of (optional) object categories / names
159/// and levels. No object category / name sets the global level.
160///
161/// Examples: GST_VALIDATE_REPORTING_DETAILS=synthetic,h264parse:all
162///  GST_VALIDATE_REPORTING_DETAILS=none,h264parse::sink_0:synthetic
163#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
164#[non_exhaustive]
165#[doc(alias = "GstValidateReportingDetails")]
166pub enum ReportingDetails {
167    /// No reporting level known,
168    /// reporting will default to the global reporting level.
169    #[doc(alias = "GST_VALIDATE_SHOW_UNKNOWN")]
170    Unknown,
171    /// No debugging level specified or desired. Used to deactivate
172    ///  debugging output.
173    #[doc(alias = "GST_VALIDATE_SHOW_NONE")]
174    None,
175    /// Summary of the issues found, with no
176    ///  details.
177    #[doc(alias = "GST_VALIDATE_SHOW_SYNTHETIC")]
178    Synthetic,
179    /// If set as the default level, similar
180    ///  issues can be reported multiple times for different subchains.
181    ///  If set as the level for a particular object (my_object:subchain), validate
182    ///  will report the issues where the object is the first to report an issue for
183    ///  a subchain.
184    #[doc(alias = "GST_VALIDATE_SHOW_SUBCHAIN")]
185    Subchain,
186    /// If set as the default level, all the
187    /// distinct issues for all the monitors will be reported.
188    /// If set as the level for a particular object, all the distinct issues for this object
189    /// will be reported.
190    /// Note that if the same issue happens twice on the same object, up until this
191    /// level that issue is only reported once.
192    #[doc(alias = "GST_VALIDATE_SHOW_MONITOR")]
193    Monitor,
194    /// All the issues will be reported, even those
195    /// that repeat themselves inside the same object. This can be *very* verbose if
196    /// set globally.
197    #[doc(alias = "GST_VALIDATE_SHOW_ALL")]
198    All,
199    /// Sythetic for not fatal issues and detailed for
200    /// others
201    #[doc(alias = "GST_VALIDATE_SHOW_SMART")]
202    Smart,
203    #[doc(alias = "GST_VALIDATE_SHOW_COUNT")]
204    Count,
205    #[doc(hidden)]
206    __Unknown(i32),
207}
208
209#[doc(hidden)]
210impl IntoGlib for ReportingDetails {
211    type GlibType = ffi::GstValidateReportingDetails;
212
213    #[inline]
214    fn into_glib(self) -> ffi::GstValidateReportingDetails {
215        match self {
216            Self::Unknown => ffi::GST_VALIDATE_SHOW_UNKNOWN,
217            Self::None => ffi::GST_VALIDATE_SHOW_NONE,
218            Self::Synthetic => ffi::GST_VALIDATE_SHOW_SYNTHETIC,
219            Self::Subchain => ffi::GST_VALIDATE_SHOW_SUBCHAIN,
220            Self::Monitor => ffi::GST_VALIDATE_SHOW_MONITOR,
221            Self::All => ffi::GST_VALIDATE_SHOW_ALL,
222            Self::Smart => ffi::GST_VALIDATE_SHOW_SMART,
223            Self::Count => ffi::GST_VALIDATE_SHOW_COUNT,
224            Self::__Unknown(value) => value,
225        }
226    }
227}
228
229#[doc(hidden)]
230impl FromGlib<ffi::GstValidateReportingDetails> for ReportingDetails {
231    #[inline]
232    unsafe fn from_glib(value: ffi::GstValidateReportingDetails) -> Self {
233        skip_assert_initialized!();
234
235        match value {
236            ffi::GST_VALIDATE_SHOW_UNKNOWN => Self::Unknown,
237            ffi::GST_VALIDATE_SHOW_NONE => Self::None,
238            ffi::GST_VALIDATE_SHOW_SYNTHETIC => Self::Synthetic,
239            ffi::GST_VALIDATE_SHOW_SUBCHAIN => Self::Subchain,
240            ffi::GST_VALIDATE_SHOW_MONITOR => Self::Monitor,
241            ffi::GST_VALIDATE_SHOW_ALL => Self::All,
242            ffi::GST_VALIDATE_SHOW_SMART => Self::Smart,
243            ffi::GST_VALIDATE_SHOW_COUNT => Self::Count,
244            value => Self::__Unknown(value),
245        }
246    }
247}
248
249impl StaticType for ReportingDetails {
250    #[inline]
251    #[doc(alias = "gst_validate_reporting_details_get_type")]
252    fn static_type() -> glib::Type {
253        unsafe { from_glib(ffi::gst_validate_reporting_details_get_type()) }
254    }
255}
256
257impl glib::HasParamSpec for ReportingDetails {
258    type ParamSpec = glib::ParamSpecEnum;
259    type SetValue = Self;
260    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
261
262    fn param_spec_builder() -> Self::BuilderFn {
263        Self::ParamSpec::builder_with_default
264    }
265}
266
267impl glib::value::ValueType for ReportingDetails {
268    type Type = Self;
269}
270
271unsafe impl<'a> glib::value::FromValue<'a> for ReportingDetails {
272    type Checker = glib::value::GenericValueTypeChecker<Self>;
273
274    #[inline]
275    unsafe fn from_value(value: &'a glib::Value) -> Self {
276        skip_assert_initialized!();
277        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
278    }
279}
280
281impl ToValue for ReportingDetails {
282    #[inline]
283    fn to_value(&self) -> glib::Value {
284        let mut value = glib::Value::for_value_type::<Self>();
285        unsafe {
286            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
287        }
288        value
289    }
290
291    #[inline]
292    fn value_type(&self) -> glib::Type {
293        Self::static_type()
294    }
295}
296
297impl From<ReportingDetails> for glib::Value {
298    #[inline]
299    fn from(v: ReportingDetails) -> Self {
300        skip_assert_initialized!();
301        ToValue::to_value(&v)
302    }
303}