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/// Buffer dropping scheme to avoid the element's internal queue to block when
10/// full.
11#[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    /// Not Leaky
18    #[doc(alias = "GST_APP_LEAKY_TYPE_NONE")]
19    None,
20    /// Leaky on upstream (new buffers)
21    #[doc(alias = "GST_APP_LEAKY_TYPE_UPSTREAM")]
22    Upstream,
23    /// Leaky on downstream (old buffers)
24    #[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#[cfg(feature = "v1_20")]
133#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
134impl Default for AppLeakyType {
135    fn default() -> Self {
136        Self::None
137    }
138}
139
140/// The stream type.
141#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
142#[non_exhaustive]
143#[doc(alias = "GstAppStreamType")]
144pub enum AppStreamType {
145    /// No seeking is supported in the stream, such as a
146    /// live stream.
147    #[doc(alias = "GST_APP_STREAM_TYPE_STREAM")]
148    Stream,
149    /// The stream is seekable but seeking might not
150    /// be very fast, such as data from a webserver.
151    #[doc(alias = "GST_APP_STREAM_TYPE_SEEKABLE")]
152    Seekable,
153    /// The stream is seekable and seeking is fast,
154    /// such as in a local file.
155    #[doc(alias = "GST_APP_STREAM_TYPE_RANDOM_ACCESS")]
156    RandomAccess,
157    #[doc(hidden)]
158    __Unknown(i32),
159}
160
161#[doc(hidden)]
162impl IntoGlib for AppStreamType {
163    type GlibType = ffi::GstAppStreamType;
164
165    #[inline]
166    fn into_glib(self) -> ffi::GstAppStreamType {
167        match self {
168            Self::Stream => ffi::GST_APP_STREAM_TYPE_STREAM,
169            Self::Seekable => ffi::GST_APP_STREAM_TYPE_SEEKABLE,
170            Self::RandomAccess => ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS,
171            Self::__Unknown(value) => value,
172        }
173    }
174}
175
176#[doc(hidden)]
177impl FromGlib<ffi::GstAppStreamType> for AppStreamType {
178    #[inline]
179    unsafe fn from_glib(value: ffi::GstAppStreamType) -> Self {
180        skip_assert_initialized!();
181
182        match value {
183            ffi::GST_APP_STREAM_TYPE_STREAM => Self::Stream,
184            ffi::GST_APP_STREAM_TYPE_SEEKABLE => Self::Seekable,
185            ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS => Self::RandomAccess,
186            value => Self::__Unknown(value),
187        }
188    }
189}
190
191impl StaticType for AppStreamType {
192    #[inline]
193    #[doc(alias = "gst_app_stream_type_get_type")]
194    fn static_type() -> glib::Type {
195        unsafe { from_glib(ffi::gst_app_stream_type_get_type()) }
196    }
197}
198
199impl glib::HasParamSpec for AppStreamType {
200    type ParamSpec = glib::ParamSpecEnum;
201    type SetValue = Self;
202    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
203
204    fn param_spec_builder() -> Self::BuilderFn {
205        Self::ParamSpec::builder_with_default
206    }
207}
208
209impl glib::value::ValueType for AppStreamType {
210    type Type = Self;
211}
212
213unsafe impl<'a> glib::value::FromValue<'a> for AppStreamType {
214    type Checker = glib::value::GenericValueTypeChecker<Self>;
215
216    #[inline]
217    unsafe fn from_value(value: &'a glib::Value) -> Self {
218        skip_assert_initialized!();
219        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
220    }
221}
222
223impl ToValue for AppStreamType {
224    #[inline]
225    fn to_value(&self) -> glib::Value {
226        let mut value = glib::Value::for_value_type::<Self>();
227        unsafe {
228            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
229        }
230        value
231    }
232
233    #[inline]
234    fn value_type(&self) -> glib::Type {
235        Self::static_type()
236    }
237}
238
239impl From<AppStreamType> for glib::Value {
240    #[inline]
241    fn from(v: AppStreamType) -> Self {
242        skip_assert_initialized!();
243        ToValue::to_value(&v)
244    }
245}
246
247impl Default for AppStreamType {
248    fn default() -> Self {
249        Self::Stream
250    }
251}