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#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
128#[non_exhaustive]
129#[doc(alias = "GstAppStreamType")]
130pub enum AppStreamType {
131    #[doc(alias = "GST_APP_STREAM_TYPE_STREAM")]
132    Stream,
133    #[doc(alias = "GST_APP_STREAM_TYPE_SEEKABLE")]
134    Seekable,
135    #[doc(alias = "GST_APP_STREAM_TYPE_RANDOM_ACCESS")]
136    RandomAccess,
137    #[doc(hidden)]
138    __Unknown(i32),
139}
140
141#[doc(hidden)]
142impl IntoGlib for AppStreamType {
143    type GlibType = ffi::GstAppStreamType;
144
145    #[inline]
146    fn into_glib(self) -> ffi::GstAppStreamType {
147        match self {
148            Self::Stream => ffi::GST_APP_STREAM_TYPE_STREAM,
149            Self::Seekable => ffi::GST_APP_STREAM_TYPE_SEEKABLE,
150            Self::RandomAccess => ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS,
151            Self::__Unknown(value) => value,
152        }
153    }
154}
155
156#[doc(hidden)]
157impl FromGlib<ffi::GstAppStreamType> for AppStreamType {
158    #[inline]
159    unsafe fn from_glib(value: ffi::GstAppStreamType) -> Self {
160        skip_assert_initialized!();
161
162        match value {
163            ffi::GST_APP_STREAM_TYPE_STREAM => Self::Stream,
164            ffi::GST_APP_STREAM_TYPE_SEEKABLE => Self::Seekable,
165            ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS => Self::RandomAccess,
166            value => Self::__Unknown(value),
167        }
168    }
169}
170
171impl StaticType for AppStreamType {
172    #[inline]
173    #[doc(alias = "gst_app_stream_type_get_type")]
174    fn static_type() -> glib::Type {
175        unsafe { from_glib(ffi::gst_app_stream_type_get_type()) }
176    }
177}
178
179impl glib::HasParamSpec for AppStreamType {
180    type ParamSpec = glib::ParamSpecEnum;
181    type SetValue = Self;
182    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
183
184    fn param_spec_builder() -> Self::BuilderFn {
185        Self::ParamSpec::builder_with_default
186    }
187}
188
189impl glib::value::ValueType for AppStreamType {
190    type Type = Self;
191}
192
193unsafe impl<'a> glib::value::FromValue<'a> for AppStreamType {
194    type Checker = glib::value::GenericValueTypeChecker<Self>;
195
196    #[inline]
197    unsafe fn from_value(value: &'a glib::Value) -> Self {
198        skip_assert_initialized!();
199        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
200    }
201}
202
203impl ToValue for AppStreamType {
204    #[inline]
205    fn to_value(&self) -> glib::Value {
206        let mut value = glib::Value::for_value_type::<Self>();
207        unsafe {
208            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
209        }
210        value
211    }
212
213    #[inline]
214    fn value_type(&self) -> glib::Type {
215        Self::static_type()
216    }
217}
218
219impl From<AppStreamType> for glib::Value {
220    #[inline]
221    fn from(v: AppStreamType) -> Self {
222        skip_assert_initialized!();
223        ToValue::to_value(&v)
224    }
225}