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