1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::ffi;
use glib::{prelude::*, translate::*, GStr};

/// Different types of supported background shading functions.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioVisualizerShader")]
pub enum AudioVisualizerShader {
    /// no shading
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_NONE")]
    None,
    /// plain fading
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE")]
    Fade,
    /// fade and move up
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP")]
    FadeAndMoveUp,
    /// fade and move down
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN")]
    FadeAndMoveDown,
    /// fade and move left
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT")]
    FadeAndMoveLeft,
    /// fade and move right
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT")]
    FadeAndMoveRight,
    /// fade and move horizontally out
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT")]
    FadeAndMoveHorizOut,
    /// fade and move horizontally in
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN")]
    FadeAndMoveHorizIn,
    /// fade and move vertically out
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT")]
    FadeAndMoveVertOut,
    /// fade and move vertically in
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN")]
    FadeAndMoveVertIn,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for AudioVisualizerShader {
    type GlibType = ffi::GstAudioVisualizerShader;

    #[inline]
    fn into_glib(self) -> ffi::GstAudioVisualizerShader {
        match self {
            Self::None => ffi::GST_AUDIO_VISUALIZER_SHADER_NONE,
            Self::Fade => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE,
            Self::FadeAndMoveUp => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP,
            Self::FadeAndMoveDown => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN,
            Self::FadeAndMoveLeft => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT,
            Self::FadeAndMoveRight => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
            Self::FadeAndMoveHorizOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
            Self::FadeAndMoveHorizIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
            Self::FadeAndMoveVertOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
            Self::FadeAndMoveVertIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstAudioVisualizerShader> for AudioVisualizerShader {
    #[inline]
    unsafe fn from_glib(value: ffi::GstAudioVisualizerShader) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_AUDIO_VISUALIZER_SHADER_NONE => Self::None,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE => Self::Fade,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP => Self::FadeAndMoveUp,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN => Self::FadeAndMoveDown,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT => Self::FadeAndMoveLeft,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT => Self::FadeAndMoveRight,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT => Self::FadeAndMoveHorizOut,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN => Self::FadeAndMoveHorizIn,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT => Self::FadeAndMoveVertOut,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN => Self::FadeAndMoveVertIn,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for AudioVisualizerShader {
    #[inline]
    #[doc(alias = "gst_audio_visualizer_shader_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_audio_visualizer_shader_get_type()) }
    }
}

impl glib::HasParamSpec for AudioVisualizerShader {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for AudioVisualizerShader {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioVisualizerShader {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for AudioVisualizerShader {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<AudioVisualizerShader> for glib::Value {
    #[inline]
    fn from(v: AudioVisualizerShader) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Result values for the discovery process.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstDiscovererResult")]
pub enum DiscovererResult {
    /// The discovery was successful
    #[doc(alias = "GST_DISCOVERER_OK")]
    Ok,
    /// the URI is invalid
    #[doc(alias = "GST_DISCOVERER_URI_INVALID")]
    UriInvalid,
    /// an error happened and the GError is set
    #[doc(alias = "GST_DISCOVERER_ERROR")]
    Error,
    /// the discovery timed-out
    #[doc(alias = "GST_DISCOVERER_TIMEOUT")]
    Timeout,
    /// the discoverer was already discovering a file
    #[doc(alias = "GST_DISCOVERER_BUSY")]
    Busy,
    /// Some plugins are missing for full discovery
    #[doc(alias = "GST_DISCOVERER_MISSING_PLUGINS")]
    MissingPlugins,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for DiscovererResult {
    type GlibType = ffi::GstDiscovererResult;

    #[inline]
    fn into_glib(self) -> ffi::GstDiscovererResult {
        match self {
            Self::Ok => ffi::GST_DISCOVERER_OK,
            Self::UriInvalid => ffi::GST_DISCOVERER_URI_INVALID,
            Self::Error => ffi::GST_DISCOVERER_ERROR,
            Self::Timeout => ffi::GST_DISCOVERER_TIMEOUT,
            Self::Busy => ffi::GST_DISCOVERER_BUSY,
            Self::MissingPlugins => ffi::GST_DISCOVERER_MISSING_PLUGINS,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstDiscovererResult> for DiscovererResult {
    #[inline]
    unsafe fn from_glib(value: ffi::GstDiscovererResult) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_DISCOVERER_OK => Self::Ok,
            ffi::GST_DISCOVERER_URI_INVALID => Self::UriInvalid,
            ffi::GST_DISCOVERER_ERROR => Self::Error,
            ffi::GST_DISCOVERER_TIMEOUT => Self::Timeout,
            ffi::GST_DISCOVERER_BUSY => Self::Busy,
            ffi::GST_DISCOVERER_MISSING_PLUGINS => Self::MissingPlugins,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for DiscovererResult {
    #[inline]
    #[doc(alias = "gst_discoverer_result_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_discoverer_result_get_type()) }
    }
}

impl glib::HasParamSpec for DiscovererResult {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for DiscovererResult {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for DiscovererResult {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for DiscovererResult {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<DiscovererResult> for glib::Value {
    #[inline]
    fn from(v: DiscovererResult) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Result codes returned by `gst_install_plugins_async()` and
/// `gst_install_plugins_sync()`, and also the result code passed to the
/// `GstInstallPluginsResultFunc` specified with `gst_install_plugins_async()`.
///
/// These codes indicate success or failure of starting an external installer
/// program and to what extent the requested plugins could be installed.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstInstallPluginsReturn")]
pub enum InstallPluginsReturn {
    /// all of the requested plugins could be
    ///  installed
    #[doc(alias = "GST_INSTALL_PLUGINS_SUCCESS")]
    Success,
    /// no appropriate installation candidate for
    ///  any of the requested plugins could be found. Only return this if nothing
    ///  has been installed. Return [`PartialSuccess`][Self::PartialSuccess] if
    ///  some (but not all) of the requested plugins could be installed.
    #[doc(alias = "GST_INSTALL_PLUGINS_NOT_FOUND")]
    NotFound,
    /// an error occurred during the installation. If
    ///  this happens, the user has already seen an error message and another
    ///  one should not be displayed
    #[doc(alias = "GST_INSTALL_PLUGINS_ERROR")]
    Error,
    /// some of the requested plugins could
    ///  be installed, but not all
    #[doc(alias = "GST_INSTALL_PLUGINS_PARTIAL_SUCCESS")]
    PartialSuccess,
    /// the user has aborted the installation
    #[doc(alias = "GST_INSTALL_PLUGINS_USER_ABORT")]
    UserAbort,
    /// the installer had an unclean exit code
    ///  (ie. death by signal)
    #[doc(alias = "GST_INSTALL_PLUGINS_CRASHED")]
    Crashed,
    /// the helper returned an invalid status code
    #[doc(alias = "GST_INSTALL_PLUGINS_INVALID")]
    Invalid,
    /// returned by `gst_install_plugins_async()` to
    ///  indicate that everything went fine so far and the provided callback
    ///  will be called with the result of the installation later
    #[doc(alias = "GST_INSTALL_PLUGINS_STARTED_OK")]
    StartedOk,
    /// some internal failure has
    ///  occurred when trying to start the installer
    #[doc(alias = "GST_INSTALL_PLUGINS_INTERNAL_FAILURE")]
    InternalFailure,
    /// the helper script to call the
    ///  actual installer is not installed
    #[doc(alias = "GST_INSTALL_PLUGINS_HELPER_MISSING")]
    HelperMissing,
    /// a previously-started plugin
    ///  installation is still in progress, try again later
    #[doc(alias = "GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS")]
    InstallInProgress,
    #[doc(hidden)]
    __Unknown(i32),
}

impl InstallPluginsReturn {
    pub fn name<'a>(self) -> &'a GStr {
        unsafe {
            GStr::from_ptr(
                ffi::gst_install_plugins_return_get_name(self.into_glib())
                    .as_ref()
                    .expect("gst_install_plugins_return_get_name returned NULL"),
            )
        }
    }
}

impl std::fmt::Display for InstallPluginsReturn {
    #[inline]
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(&self.name())
    }
}

#[doc(hidden)]
impl IntoGlib for InstallPluginsReturn {
    type GlibType = ffi::GstInstallPluginsReturn;

    #[inline]
    fn into_glib(self) -> ffi::GstInstallPluginsReturn {
        match self {
            Self::Success => ffi::GST_INSTALL_PLUGINS_SUCCESS,
            Self::NotFound => ffi::GST_INSTALL_PLUGINS_NOT_FOUND,
            Self::Error => ffi::GST_INSTALL_PLUGINS_ERROR,
            Self::PartialSuccess => ffi::GST_INSTALL_PLUGINS_PARTIAL_SUCCESS,
            Self::UserAbort => ffi::GST_INSTALL_PLUGINS_USER_ABORT,
            Self::Crashed => ffi::GST_INSTALL_PLUGINS_CRASHED,
            Self::Invalid => ffi::GST_INSTALL_PLUGINS_INVALID,
            Self::StartedOk => ffi::GST_INSTALL_PLUGINS_STARTED_OK,
            Self::InternalFailure => ffi::GST_INSTALL_PLUGINS_INTERNAL_FAILURE,
            Self::HelperMissing => ffi::GST_INSTALL_PLUGINS_HELPER_MISSING,
            Self::InstallInProgress => ffi::GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstInstallPluginsReturn> for InstallPluginsReturn {
    #[inline]
    unsafe fn from_glib(value: ffi::GstInstallPluginsReturn) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_INSTALL_PLUGINS_SUCCESS => Self::Success,
            ffi::GST_INSTALL_PLUGINS_NOT_FOUND => Self::NotFound,
            ffi::GST_INSTALL_PLUGINS_ERROR => Self::Error,
            ffi::GST_INSTALL_PLUGINS_PARTIAL_SUCCESS => Self::PartialSuccess,
            ffi::GST_INSTALL_PLUGINS_USER_ABORT => Self::UserAbort,
            ffi::GST_INSTALL_PLUGINS_CRASHED => Self::Crashed,
            ffi::GST_INSTALL_PLUGINS_INVALID => Self::Invalid,
            ffi::GST_INSTALL_PLUGINS_STARTED_OK => Self::StartedOk,
            ffi::GST_INSTALL_PLUGINS_INTERNAL_FAILURE => Self::InternalFailure,
            ffi::GST_INSTALL_PLUGINS_HELPER_MISSING => Self::HelperMissing,
            ffi::GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS => Self::InstallInProgress,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for InstallPluginsReturn {
    #[inline]
    #[doc(alias = "gst_install_plugins_return_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_install_plugins_return_get_type()) }
    }
}

impl glib::HasParamSpec for InstallPluginsReturn {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for InstallPluginsReturn {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for InstallPluginsReturn {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for InstallPluginsReturn {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<InstallPluginsReturn> for glib::Value {
    #[inline]
    fn from(v: InstallPluginsReturn) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}