gstreamer_base/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;
7#[cfg(feature = "v1_18")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
9use glib::{prelude::*, translate::*};
10
11#[cfg(feature = "v1_18")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
13#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
14#[non_exhaustive]
15#[doc(alias = "GstAggregatorStartTimeSelection")]
16pub enum AggregatorStartTimeSelection {
17    #[doc(alias = "GST_AGGREGATOR_START_TIME_SELECTION_ZERO")]
18    Zero,
19    #[doc(alias = "GST_AGGREGATOR_START_TIME_SELECTION_FIRST")]
20    First,
21    #[doc(alias = "GST_AGGREGATOR_START_TIME_SELECTION_SET")]
22    Set,
23    #[doc(hidden)]
24    __Unknown(i32),
25}
26
27#[cfg(feature = "v1_18")]
28#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
29#[doc(hidden)]
30impl IntoGlib for AggregatorStartTimeSelection {
31    type GlibType = ffi::GstAggregatorStartTimeSelection;
32
33    #[inline]
34    fn into_glib(self) -> ffi::GstAggregatorStartTimeSelection {
35        match self {
36            Self::Zero => ffi::GST_AGGREGATOR_START_TIME_SELECTION_ZERO,
37            Self::First => ffi::GST_AGGREGATOR_START_TIME_SELECTION_FIRST,
38            Self::Set => ffi::GST_AGGREGATOR_START_TIME_SELECTION_SET,
39            Self::__Unknown(value) => value,
40        }
41    }
42}
43
44#[cfg(feature = "v1_18")]
45#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
46#[doc(hidden)]
47impl FromGlib<ffi::GstAggregatorStartTimeSelection> for AggregatorStartTimeSelection {
48    #[inline]
49    unsafe fn from_glib(value: ffi::GstAggregatorStartTimeSelection) -> Self {
50        skip_assert_initialized!();
51
52        match value {
53            ffi::GST_AGGREGATOR_START_TIME_SELECTION_ZERO => Self::Zero,
54            ffi::GST_AGGREGATOR_START_TIME_SELECTION_FIRST => Self::First,
55            ffi::GST_AGGREGATOR_START_TIME_SELECTION_SET => Self::Set,
56            value => Self::__Unknown(value),
57        }
58    }
59}
60
61#[cfg(feature = "v1_18")]
62#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
63impl StaticType for AggregatorStartTimeSelection {
64    #[inline]
65    #[doc(alias = "gst_aggregator_start_time_selection_get_type")]
66    fn static_type() -> glib::Type {
67        unsafe { from_glib(ffi::gst_aggregator_start_time_selection_get_type()) }
68    }
69}
70
71#[cfg(feature = "v1_18")]
72#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
73impl glib::HasParamSpec for AggregatorStartTimeSelection {
74    type ParamSpec = glib::ParamSpecEnum;
75    type SetValue = Self;
76    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
77
78    fn param_spec_builder() -> Self::BuilderFn {
79        Self::ParamSpec::builder_with_default
80    }
81}
82
83#[cfg(feature = "v1_18")]
84#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
85impl glib::value::ValueType for AggregatorStartTimeSelection {
86    type Type = Self;
87}
88
89#[cfg(feature = "v1_18")]
90#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
91unsafe impl<'a> glib::value::FromValue<'a> for AggregatorStartTimeSelection {
92    type Checker = glib::value::GenericValueTypeChecker<Self>;
93
94    #[inline]
95    unsafe fn from_value(value: &'a glib::Value) -> Self {
96        skip_assert_initialized!();
97        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
98    }
99}
100
101#[cfg(feature = "v1_18")]
102#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
103impl ToValue for AggregatorStartTimeSelection {
104    #[inline]
105    fn to_value(&self) -> glib::Value {
106        let mut value = glib::Value::for_value_type::<Self>();
107        unsafe {
108            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
109        }
110        value
111    }
112
113    #[inline]
114    fn value_type(&self) -> glib::Type {
115        Self::static_type()
116    }
117}
118
119#[cfg(feature = "v1_18")]
120#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
121impl From<AggregatorStartTimeSelection> for glib::Value {
122    #[inline]
123    fn from(v: AggregatorStartTimeSelection) -> Self {
124        skip_assert_initialized!();
125        ToValue::to_value(&v)
126    }
127}