gstreamer_audio/auto/
flags.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::{bitflags::bitflags, prelude::*, translate::*};
8
9bitflags! {
10    /// Extra audio flags
11    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
12    #[doc(alias = "GstAudioFlags")]
13    pub struct AudioFlags: u32 {
14        /// the position array explicitly
15        ///  contains unpositioned channels.
16        #[doc(alias = "GST_AUDIO_FLAG_UNPOSITIONED")]
17        const UNPOSITIONED = ffi::GST_AUDIO_FLAG_UNPOSITIONED as _;
18    }
19}
20
21#[doc(hidden)]
22impl IntoGlib for AudioFlags {
23    type GlibType = ffi::GstAudioFlags;
24
25    #[inline]
26    fn into_glib(self) -> ffi::GstAudioFlags {
27        self.bits()
28    }
29}
30
31#[doc(hidden)]
32impl FromGlib<ffi::GstAudioFlags> for AudioFlags {
33    #[inline]
34    unsafe fn from_glib(value: ffi::GstAudioFlags) -> Self {
35        skip_assert_initialized!();
36        Self::from_bits_truncate(value)
37    }
38}
39
40impl StaticType for AudioFlags {
41    #[inline]
42    #[doc(alias = "gst_audio_flags_get_type")]
43    fn static_type() -> glib::Type {
44        unsafe { from_glib(ffi::gst_audio_flags_get_type()) }
45    }
46}
47
48impl glib::HasParamSpec for AudioFlags {
49    type ParamSpec = glib::ParamSpecFlags;
50    type SetValue = Self;
51    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
52
53    fn param_spec_builder() -> Self::BuilderFn {
54        Self::ParamSpec::builder
55    }
56}
57
58impl glib::value::ValueType for AudioFlags {
59    type Type = Self;
60}
61
62unsafe impl<'a> glib::value::FromValue<'a> for AudioFlags {
63    type Checker = glib::value::GenericValueTypeChecker<Self>;
64
65    #[inline]
66    unsafe fn from_value(value: &'a glib::Value) -> Self {
67        skip_assert_initialized!();
68        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
69    }
70}
71
72impl ToValue for AudioFlags {
73    #[inline]
74    fn to_value(&self) -> glib::Value {
75        let mut value = glib::Value::for_value_type::<Self>();
76        unsafe {
77            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
78        }
79        value
80    }
81
82    #[inline]
83    fn value_type(&self) -> glib::Type {
84        Self::static_type()
85    }
86}
87
88impl From<AudioFlags> for glib::Value {
89    #[inline]
90    fn from(v: AudioFlags) -> Self {
91        skip_assert_initialized!();
92        ToValue::to_value(&v)
93    }
94}
95
96bitflags! {
97    /// The different audio flags that a format info can have.
98    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
99    #[doc(alias = "GstAudioFormatFlags")]
100    pub struct AudioFormatFlags: u32 {
101        /// integer samples
102        #[doc(alias = "GST_AUDIO_FORMAT_FLAG_INTEGER")]
103        const INTEGER = ffi::GST_AUDIO_FORMAT_FLAG_INTEGER as _;
104        /// float samples
105        #[doc(alias = "GST_AUDIO_FORMAT_FLAG_FLOAT")]
106        const FLOAT = ffi::GST_AUDIO_FORMAT_FLAG_FLOAT as _;
107        /// signed samples
108        #[doc(alias = "GST_AUDIO_FORMAT_FLAG_SIGNED")]
109        const SIGNED = ffi::GST_AUDIO_FORMAT_FLAG_SIGNED as _;
110        /// complex layout
111        #[doc(alias = "GST_AUDIO_FORMAT_FLAG_COMPLEX")]
112        const COMPLEX = ffi::GST_AUDIO_FORMAT_FLAG_COMPLEX as _;
113        /// the format can be used in
114        /// `GstAudioFormatUnpack` and `GstAudioFormatPack` functions
115        #[doc(alias = "GST_AUDIO_FORMAT_FLAG_UNPACK")]
116        const UNPACK = ffi::GST_AUDIO_FORMAT_FLAG_UNPACK as _;
117    }
118}
119
120#[doc(hidden)]
121impl IntoGlib for AudioFormatFlags {
122    type GlibType = ffi::GstAudioFormatFlags;
123
124    #[inline]
125    fn into_glib(self) -> ffi::GstAudioFormatFlags {
126        self.bits()
127    }
128}
129
130#[doc(hidden)]
131impl FromGlib<ffi::GstAudioFormatFlags> for AudioFormatFlags {
132    #[inline]
133    unsafe fn from_glib(value: ffi::GstAudioFormatFlags) -> Self {
134        skip_assert_initialized!();
135        Self::from_bits_truncate(value)
136    }
137}
138
139impl StaticType for AudioFormatFlags {
140    #[inline]
141    #[doc(alias = "gst_audio_format_flags_get_type")]
142    fn static_type() -> glib::Type {
143        unsafe { from_glib(ffi::gst_audio_format_flags_get_type()) }
144    }
145}
146
147impl glib::HasParamSpec for AudioFormatFlags {
148    type ParamSpec = glib::ParamSpecFlags;
149    type SetValue = Self;
150    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
151
152    fn param_spec_builder() -> Self::BuilderFn {
153        Self::ParamSpec::builder
154    }
155}
156
157impl glib::value::ValueType for AudioFormatFlags {
158    type Type = Self;
159}
160
161unsafe impl<'a> glib::value::FromValue<'a> for AudioFormatFlags {
162    type Checker = glib::value::GenericValueTypeChecker<Self>;
163
164    #[inline]
165    unsafe fn from_value(value: &'a glib::Value) -> Self {
166        skip_assert_initialized!();
167        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
168    }
169}
170
171impl ToValue for AudioFormatFlags {
172    #[inline]
173    fn to_value(&self) -> glib::Value {
174        let mut value = glib::Value::for_value_type::<Self>();
175        unsafe {
176            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
177        }
178        value
179    }
180
181    #[inline]
182    fn value_type(&self) -> glib::Type {
183        Self::static_type()
184    }
185}
186
187impl From<AudioFormatFlags> for glib::Value {
188    #[inline]
189    fn from(v: AudioFormatFlags) -> Self {
190        skip_assert_initialized!();
191        ToValue::to_value(&v)
192    }
193}
194
195bitflags! {
196    /// The different flags that can be used when packing and unpacking.
197    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
198    #[doc(alias = "GstAudioPackFlags")]
199    pub struct AudioPackFlags: u32 {
200        /// When the source has a smaller depth
201        ///  than the target format, set the least significant bits of the target
202        ///  to 0. This is likely slightly faster but less accurate. When this flag
203        ///  is not specified, the most significant bits of the source are duplicated
204        ///  in the least significant bits of the destination.
205        #[doc(alias = "GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE")]
206        const TRUNCATE_RANGE = ffi::GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE as _;
207    }
208}
209
210#[doc(hidden)]
211impl IntoGlib for AudioPackFlags {
212    type GlibType = ffi::GstAudioPackFlags;
213
214    #[inline]
215    fn into_glib(self) -> ffi::GstAudioPackFlags {
216        self.bits()
217    }
218}
219
220#[doc(hidden)]
221impl FromGlib<ffi::GstAudioPackFlags> for AudioPackFlags {
222    #[inline]
223    unsafe fn from_glib(value: ffi::GstAudioPackFlags) -> Self {
224        skip_assert_initialized!();
225        Self::from_bits_truncate(value)
226    }
227}
228
229impl StaticType for AudioPackFlags {
230    #[inline]
231    #[doc(alias = "gst_audio_pack_flags_get_type")]
232    fn static_type() -> glib::Type {
233        unsafe { from_glib(ffi::gst_audio_pack_flags_get_type()) }
234    }
235}
236
237impl glib::HasParamSpec for AudioPackFlags {
238    type ParamSpec = glib::ParamSpecFlags;
239    type SetValue = Self;
240    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
241
242    fn param_spec_builder() -> Self::BuilderFn {
243        Self::ParamSpec::builder
244    }
245}
246
247impl glib::value::ValueType for AudioPackFlags {
248    type Type = Self;
249}
250
251unsafe impl<'a> glib::value::FromValue<'a> for AudioPackFlags {
252    type Checker = glib::value::GenericValueTypeChecker<Self>;
253
254    #[inline]
255    unsafe fn from_value(value: &'a glib::Value) -> Self {
256        skip_assert_initialized!();
257        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
258    }
259}
260
261impl ToValue for AudioPackFlags {
262    #[inline]
263    fn to_value(&self) -> glib::Value {
264        let mut value = glib::Value::for_value_type::<Self>();
265        unsafe {
266            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
267        }
268        value
269    }
270
271    #[inline]
272    fn value_type(&self) -> glib::Type {
273        Self::static_type()
274    }
275}
276
277impl From<AudioPackFlags> for glib::Value {
278    #[inline]
279    fn from(v: AudioPackFlags) -> Self {
280        skip_assert_initialized!();
281        ToValue::to_value(&v)
282    }
283}