gstreamer_app/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::*};
8
9#[cfg(feature = "v1_20")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
11#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
12#[non_exhaustive]
13#[doc(alias = "GstAppLeakyType")]
14pub enum AppLeakyType {
15    #[doc(alias = "GST_APP_LEAKY_TYPE_NONE")]
16    None,
17    #[doc(alias = "GST_APP_LEAKY_TYPE_UPSTREAM")]
18    Upstream,
19    #[doc(alias = "GST_APP_LEAKY_TYPE_DOWNSTREAM")]
20    Downstream,
21    #[doc(hidden)]
22    __Unknown(i32),
23}
24
25#[cfg(feature = "v1_20")]
26#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
27#[doc(hidden)]
28impl IntoGlib for AppLeakyType {
29    type GlibType = ffi::GstAppLeakyType;
30
31    #[inline]
32    fn into_glib(self) -> ffi::GstAppLeakyType {
33        match self {
34            Self::None => ffi::GST_APP_LEAKY_TYPE_NONE,
35            Self::Upstream => ffi::GST_APP_LEAKY_TYPE_UPSTREAM,
36            Self::Downstream => ffi::GST_APP_LEAKY_TYPE_DOWNSTREAM,
37            Self::__Unknown(value) => value,
38        }
39    }
40}
41
42#[cfg(feature = "v1_20")]
43#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
44#[doc(hidden)]
45impl FromGlib<ffi::GstAppLeakyType> for AppLeakyType {
46    #[inline]
47    unsafe fn from_glib(value: ffi::GstAppLeakyType) -> Self {
48        skip_assert_initialized!();
49
50        match value {
51            ffi::GST_APP_LEAKY_TYPE_NONE => Self::None,
52            ffi::GST_APP_LEAKY_TYPE_UPSTREAM => Self::Upstream,
53            ffi::GST_APP_LEAKY_TYPE_DOWNSTREAM => Self::Downstream,
54            value => Self::__Unknown(value),
55        }
56    }
57}
58
59#[cfg(feature = "v1_20")]
60#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
61impl StaticType for AppLeakyType {
62    #[inline]
63    #[doc(alias = "gst_app_leaky_type_get_type")]
64    fn static_type() -> glib::Type {
65        unsafe { from_glib(ffi::gst_app_leaky_type_get_type()) }
66    }
67}
68
69#[cfg(feature = "v1_20")]
70#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
71impl glib::HasParamSpec for AppLeakyType {
72    type ParamSpec = glib::ParamSpecEnum;
73    type SetValue = Self;
74    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
75
76    fn param_spec_builder() -> Self::BuilderFn {
77        Self::ParamSpec::builder_with_default
78    }
79}
80
81#[cfg(feature = "v1_20")]
82#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
83impl glib::value::ValueType for AppLeakyType {
84    type Type = Self;
85}
86
87#[cfg(feature = "v1_20")]
88#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
89unsafe impl<'a> glib::value::FromValue<'a> for AppLeakyType {
90    type Checker = glib::value::GenericValueTypeChecker<Self>;
91
92    #[inline]
93    unsafe fn from_value(value: &'a glib::Value) -> Self {
94        skip_assert_initialized!();
95        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
96    }
97}
98
99#[cfg(feature = "v1_20")]
100#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
101impl ToValue for AppLeakyType {
102    #[inline]
103    fn to_value(&self) -> glib::Value {
104        let mut value = glib::Value::for_value_type::<Self>();
105        unsafe {
106            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
107        }
108        value
109    }
110
111    #[inline]
112    fn value_type(&self) -> glib::Type {
113        Self::static_type()
114    }
115}
116
117#[cfg(feature = "v1_20")]
118#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
119impl From<AppLeakyType> for glib::Value {
120    #[inline]
121    fn from(v: AppLeakyType) -> Self {
122        skip_assert_initialized!();
123        ToValue::to_value(&v)
124    }
125}
126
127#[cfg(feature = "v1_20")]
128#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
129impl Default for AppLeakyType {
130    fn default() -> Self {
131        Self::None
132    }
133}
134
135#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
136#[non_exhaustive]
137#[doc(alias = "GstAppStreamType")]
138pub enum AppStreamType {
139    #[doc(alias = "GST_APP_STREAM_TYPE_STREAM")]
140    Stream,
141    #[doc(alias = "GST_APP_STREAM_TYPE_SEEKABLE")]
142    Seekable,
143    #[doc(alias = "GST_APP_STREAM_TYPE_RANDOM_ACCESS")]
144    RandomAccess,
145    #[doc(hidden)]
146    __Unknown(i32),
147}
148
149#[doc(hidden)]
150impl IntoGlib for AppStreamType {
151    type GlibType = ffi::GstAppStreamType;
152
153    #[inline]
154    fn into_glib(self) -> ffi::GstAppStreamType {
155        match self {
156            Self::Stream => ffi::GST_APP_STREAM_TYPE_STREAM,
157            Self::Seekable => ffi::GST_APP_STREAM_TYPE_SEEKABLE,
158            Self::RandomAccess => ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS,
159            Self::__Unknown(value) => value,
160        }
161    }
162}
163
164#[doc(hidden)]
165impl FromGlib<ffi::GstAppStreamType> for AppStreamType {
166    #[inline]
167    unsafe fn from_glib(value: ffi::GstAppStreamType) -> Self {
168        skip_assert_initialized!();
169
170        match value {
171            ffi::GST_APP_STREAM_TYPE_STREAM => Self::Stream,
172            ffi::GST_APP_STREAM_TYPE_SEEKABLE => Self::Seekable,
173            ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS => Self::RandomAccess,
174            value => Self::__Unknown(value),
175        }
176    }
177}
178
179impl StaticType for AppStreamType {
180    #[inline]
181    #[doc(alias = "gst_app_stream_type_get_type")]
182    fn static_type() -> glib::Type {
183        unsafe { from_glib(ffi::gst_app_stream_type_get_type()) }
184    }
185}
186
187impl glib::HasParamSpec for AppStreamType {
188    type ParamSpec = glib::ParamSpecEnum;
189    type SetValue = Self;
190    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
191
192    fn param_spec_builder() -> Self::BuilderFn {
193        Self::ParamSpec::builder_with_default
194    }
195}
196
197impl glib::value::ValueType for AppStreamType {
198    type Type = Self;
199}
200
201unsafe impl<'a> glib::value::FromValue<'a> for AppStreamType {
202    type Checker = glib::value::GenericValueTypeChecker<Self>;
203
204    #[inline]
205    unsafe fn from_value(value: &'a glib::Value) -> Self {
206        skip_assert_initialized!();
207        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
208    }
209}
210
211impl ToValue for AppStreamType {
212    #[inline]
213    fn to_value(&self) -> glib::Value {
214        let mut value = glib::Value::for_value_type::<Self>();
215        unsafe {
216            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
217        }
218        value
219    }
220
221    #[inline]
222    fn value_type(&self) -> glib::Type {
223        Self::static_type()
224    }
225}
226
227impl From<AppStreamType> for glib::Value {
228    #[inline]
229    fn from(v: AppStreamType) -> Self {
230        skip_assert_initialized!();
231        ToValue::to_value(&v)
232    }
233}
234
235impl Default for AppStreamType {
236    fn default() -> Self {
237        Self::Stream
238    }
239}