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