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