Skip to main content

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