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