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