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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
// 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::*};

/// Set of available dithering methods.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioDitherMethod")]
pub enum AudioDitherMethod {
    /// No dithering
    #[doc(alias = "GST_AUDIO_DITHER_NONE")]
    None,
    /// Rectangular dithering
    #[doc(alias = "GST_AUDIO_DITHER_RPDF")]
    Rpdf,
    /// Triangular dithering (default)
    #[doc(alias = "GST_AUDIO_DITHER_TPDF")]
    Tpdf,
    /// High frequency triangular dithering
    #[doc(alias = "GST_AUDIO_DITHER_TPDF_HF")]
    TpdfHf,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::GstAudioDitherMethod {
        match self {
            Self::None => ffi::GST_AUDIO_DITHER_NONE,
            Self::Rpdf => ffi::GST_AUDIO_DITHER_RPDF,
            Self::Tpdf => ffi::GST_AUDIO_DITHER_TPDF,
            Self::TpdfHf => ffi::GST_AUDIO_DITHER_TPDF_HF,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_DITHER_NONE => Self::None,
            ffi::GST_AUDIO_DITHER_RPDF => Self::Rpdf,
            ffi::GST_AUDIO_DITHER_TPDF => Self::Tpdf,
            ffi::GST_AUDIO_DITHER_TPDF_HF => Self::TpdfHf,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioDitherMethod {
    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 AudioDitherMethod {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioDitherMethod {
    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 AudioDitherMethod {
    #[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<AudioDitherMethod> for glib::Value {
    #[inline]
    fn from(v: AudioDitherMethod) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Enum value describing the most common audio formats.
#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioFormat")]
pub enum AudioFormat {
    /// unknown or unset audio format
    #[doc(alias = "GST_AUDIO_FORMAT_UNKNOWN")]
    Unknown,
    /// encoded audio format
    #[doc(alias = "GST_AUDIO_FORMAT_ENCODED")]
    Encoded,
    /// 8 bits in 8 bits, signed
    #[doc(alias = "GST_AUDIO_FORMAT_S8")]
    S8,
    /// 8 bits in 8 bits, unsigned
    #[doc(alias = "GST_AUDIO_FORMAT_U8")]
    U8,
    /// 16 bits in 16 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S16LE")]
    S16le,
    /// 16 bits in 16 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S16BE")]
    S16be,
    /// 16 bits in 16 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U16LE")]
    U16le,
    /// 16 bits in 16 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U16BE")]
    U16be,
    /// 24 bits in 32 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S24_32LE")]
    S2432le,
    /// 24 bits in 32 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S24_32BE")]
    S2432be,
    /// 24 bits in 32 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U24_32LE")]
    U2432le,
    /// 24 bits in 32 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U24_32BE")]
    U2432be,
    /// 32 bits in 32 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S32LE")]
    S32le,
    /// 32 bits in 32 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S32BE")]
    S32be,
    /// 32 bits in 32 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U32LE")]
    U32le,
    /// 32 bits in 32 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U32BE")]
    U32be,
    /// 24 bits in 24 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S24LE")]
    S24le,
    /// 24 bits in 24 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S24BE")]
    S24be,
    /// 24 bits in 24 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U24LE")]
    U24le,
    /// 24 bits in 24 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U24BE")]
    U24be,
    /// 20 bits in 24 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S20LE")]
    S20le,
    /// 20 bits in 24 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S20BE")]
    S20be,
    /// 20 bits in 24 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U20LE")]
    U20le,
    /// 20 bits in 24 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U20BE")]
    U20be,
    /// 18 bits in 24 bits, signed, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_S18LE")]
    S18le,
    /// 18 bits in 24 bits, signed, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_S18BE")]
    S18be,
    /// 18 bits in 24 bits, unsigned, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_U18LE")]
    U18le,
    /// 18 bits in 24 bits, unsigned, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_U18BE")]
    U18be,
    /// 32-bit floating point samples, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_F32LE")]
    F32le,
    /// 32-bit floating point samples, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_F32BE")]
    F32be,
    /// 64-bit floating point samples, little endian
    #[doc(alias = "GST_AUDIO_FORMAT_F64LE")]
    F64le,
    /// 64-bit floating point samples, big endian
    #[doc(alias = "GST_AUDIO_FORMAT_F64BE")]
    F64be,
    #[doc(hidden)]
    __Unknown(i32),
}

impl AudioFormat {
    #[doc(alias = "gst_audio_format_from_string")]
    pub fn from_string(format: &str) -> AudioFormat {
        assert_initialized_main_thread!();
        unsafe { from_glib(ffi::gst_audio_format_from_string(format.to_glib_none().0)) }
    }
}

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

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

    fn into_glib(self) -> ffi::GstAudioFormat {
        match self {
            Self::Unknown => ffi::GST_AUDIO_FORMAT_UNKNOWN,
            Self::Encoded => ffi::GST_AUDIO_FORMAT_ENCODED,
            Self::S8 => ffi::GST_AUDIO_FORMAT_S8,
            Self::U8 => ffi::GST_AUDIO_FORMAT_U8,
            Self::S16le => ffi::GST_AUDIO_FORMAT_S16LE,
            Self::S16be => ffi::GST_AUDIO_FORMAT_S16BE,
            Self::U16le => ffi::GST_AUDIO_FORMAT_U16LE,
            Self::U16be => ffi::GST_AUDIO_FORMAT_U16BE,
            Self::S2432le => ffi::GST_AUDIO_FORMAT_S24_32LE,
            Self::S2432be => ffi::GST_AUDIO_FORMAT_S24_32BE,
            Self::U2432le => ffi::GST_AUDIO_FORMAT_U24_32LE,
            Self::U2432be => ffi::GST_AUDIO_FORMAT_U24_32BE,
            Self::S32le => ffi::GST_AUDIO_FORMAT_S32LE,
            Self::S32be => ffi::GST_AUDIO_FORMAT_S32BE,
            Self::U32le => ffi::GST_AUDIO_FORMAT_U32LE,
            Self::U32be => ffi::GST_AUDIO_FORMAT_U32BE,
            Self::S24le => ffi::GST_AUDIO_FORMAT_S24LE,
            Self::S24be => ffi::GST_AUDIO_FORMAT_S24BE,
            Self::U24le => ffi::GST_AUDIO_FORMAT_U24LE,
            Self::U24be => ffi::GST_AUDIO_FORMAT_U24BE,
            Self::S20le => ffi::GST_AUDIO_FORMAT_S20LE,
            Self::S20be => ffi::GST_AUDIO_FORMAT_S20BE,
            Self::U20le => ffi::GST_AUDIO_FORMAT_U20LE,
            Self::U20be => ffi::GST_AUDIO_FORMAT_U20BE,
            Self::S18le => ffi::GST_AUDIO_FORMAT_S18LE,
            Self::S18be => ffi::GST_AUDIO_FORMAT_S18BE,
            Self::U18le => ffi::GST_AUDIO_FORMAT_U18LE,
            Self::U18be => ffi::GST_AUDIO_FORMAT_U18BE,
            Self::F32le => ffi::GST_AUDIO_FORMAT_F32LE,
            Self::F32be => ffi::GST_AUDIO_FORMAT_F32BE,
            Self::F64le => ffi::GST_AUDIO_FORMAT_F64LE,
            Self::F64be => ffi::GST_AUDIO_FORMAT_F64BE,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_FORMAT_UNKNOWN => Self::Unknown,
            ffi::GST_AUDIO_FORMAT_ENCODED => Self::Encoded,
            ffi::GST_AUDIO_FORMAT_S8 => Self::S8,
            ffi::GST_AUDIO_FORMAT_U8 => Self::U8,
            ffi::GST_AUDIO_FORMAT_S16LE => Self::S16le,
            ffi::GST_AUDIO_FORMAT_S16BE => Self::S16be,
            ffi::GST_AUDIO_FORMAT_U16LE => Self::U16le,
            ffi::GST_AUDIO_FORMAT_U16BE => Self::U16be,
            ffi::GST_AUDIO_FORMAT_S24_32LE => Self::S2432le,
            ffi::GST_AUDIO_FORMAT_S24_32BE => Self::S2432be,
            ffi::GST_AUDIO_FORMAT_U24_32LE => Self::U2432le,
            ffi::GST_AUDIO_FORMAT_U24_32BE => Self::U2432be,
            ffi::GST_AUDIO_FORMAT_S32LE => Self::S32le,
            ffi::GST_AUDIO_FORMAT_S32BE => Self::S32be,
            ffi::GST_AUDIO_FORMAT_U32LE => Self::U32le,
            ffi::GST_AUDIO_FORMAT_U32BE => Self::U32be,
            ffi::GST_AUDIO_FORMAT_S24LE => Self::S24le,
            ffi::GST_AUDIO_FORMAT_S24BE => Self::S24be,
            ffi::GST_AUDIO_FORMAT_U24LE => Self::U24le,
            ffi::GST_AUDIO_FORMAT_U24BE => Self::U24be,
            ffi::GST_AUDIO_FORMAT_S20LE => Self::S20le,
            ffi::GST_AUDIO_FORMAT_S20BE => Self::S20be,
            ffi::GST_AUDIO_FORMAT_U20LE => Self::U20le,
            ffi::GST_AUDIO_FORMAT_U20BE => Self::U20be,
            ffi::GST_AUDIO_FORMAT_S18LE => Self::S18le,
            ffi::GST_AUDIO_FORMAT_S18BE => Self::S18be,
            ffi::GST_AUDIO_FORMAT_U18LE => Self::U18le,
            ffi::GST_AUDIO_FORMAT_U18BE => Self::U18be,
            ffi::GST_AUDIO_FORMAT_F32LE => Self::F32le,
            ffi::GST_AUDIO_FORMAT_F32BE => Self::F32be,
            ffi::GST_AUDIO_FORMAT_F64LE => Self::F64le,
            ffi::GST_AUDIO_FORMAT_F64BE => Self::F64be,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioFormat {
    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 AudioFormat {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioFormat {
    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 AudioFormat {
    #[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<AudioFormat> for glib::Value {
    #[inline]
    fn from(v: AudioFormat) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Layout of the audio samples for the different channels.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioLayout")]
pub enum AudioLayout {
    /// interleaved audio
    #[doc(alias = "GST_AUDIO_LAYOUT_INTERLEAVED")]
    Interleaved,
    /// non-interleaved audio
    #[doc(alias = "GST_AUDIO_LAYOUT_NON_INTERLEAVED")]
    NonInterleaved,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::GstAudioLayout {
        match self {
            Self::Interleaved => ffi::GST_AUDIO_LAYOUT_INTERLEAVED,
            Self::NonInterleaved => ffi::GST_AUDIO_LAYOUT_NON_INTERLEAVED,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_LAYOUT_INTERLEAVED => Self::Interleaved,
            ffi::GST_AUDIO_LAYOUT_NON_INTERLEAVED => Self::NonInterleaved,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioLayout {
    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 AudioLayout {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioLayout {
    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 AudioLayout {
    #[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<AudioLayout> for glib::Value {
    #[inline]
    fn from(v: AudioLayout) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Set of available noise shaping methods
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioNoiseShapingMethod")]
pub enum AudioNoiseShapingMethod {
    /// No noise shaping (default)
    #[doc(alias = "GST_AUDIO_NOISE_SHAPING_NONE")]
    None,
    /// Error feedback
    #[doc(alias = "GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK")]
    ErrorFeedback,
    /// Simple 2-pole noise shaping
    #[doc(alias = "GST_AUDIO_NOISE_SHAPING_SIMPLE")]
    Simple,
    /// Medium 5-pole noise shaping
    #[doc(alias = "GST_AUDIO_NOISE_SHAPING_MEDIUM")]
    Medium,
    /// High 8-pole noise shaping
    #[doc(alias = "GST_AUDIO_NOISE_SHAPING_HIGH")]
    High,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::GstAudioNoiseShapingMethod {
        match self {
            Self::None => ffi::GST_AUDIO_NOISE_SHAPING_NONE,
            Self::ErrorFeedback => ffi::GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK,
            Self::Simple => ffi::GST_AUDIO_NOISE_SHAPING_SIMPLE,
            Self::Medium => ffi::GST_AUDIO_NOISE_SHAPING_MEDIUM,
            Self::High => ffi::GST_AUDIO_NOISE_SHAPING_HIGH,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_NOISE_SHAPING_NONE => Self::None,
            ffi::GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK => Self::ErrorFeedback,
            ffi::GST_AUDIO_NOISE_SHAPING_SIMPLE => Self::Simple,
            ffi::GST_AUDIO_NOISE_SHAPING_MEDIUM => Self::Medium,
            ffi::GST_AUDIO_NOISE_SHAPING_HIGH => Self::High,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioNoiseShapingMethod {
    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 AudioNoiseShapingMethod {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioNoiseShapingMethod {
    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 AudioNoiseShapingMethod {
    #[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<AudioNoiseShapingMethod> for glib::Value {
    #[inline]
    fn from(v: AudioNoiseShapingMethod) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Different subsampling and upsampling methods
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioResamplerMethod")]
pub enum AudioResamplerMethod {
    /// Duplicates the samples when
    ///  upsampling and drops when downsampling
    #[doc(alias = "GST_AUDIO_RESAMPLER_METHOD_NEAREST")]
    Nearest,
    /// Uses linear interpolation to reconstruct
    ///  missing samples and averaging to downsample
    #[doc(alias = "GST_AUDIO_RESAMPLER_METHOD_LINEAR")]
    Linear,
    /// Uses cubic interpolation
    #[doc(alias = "GST_AUDIO_RESAMPLER_METHOD_CUBIC")]
    Cubic,
    /// Uses Blackman-Nuttall windowed sinc interpolation
    #[doc(alias = "GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL")]
    BlackmanNuttall,
    /// Uses Kaiser windowed sinc interpolation
    #[doc(alias = "GST_AUDIO_RESAMPLER_METHOD_KAISER")]
    Kaiser,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::GstAudioResamplerMethod {
        match self {
            Self::Nearest => ffi::GST_AUDIO_RESAMPLER_METHOD_NEAREST,
            Self::Linear => ffi::GST_AUDIO_RESAMPLER_METHOD_LINEAR,
            Self::Cubic => ffi::GST_AUDIO_RESAMPLER_METHOD_CUBIC,
            Self::BlackmanNuttall => ffi::GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL,
            Self::Kaiser => ffi::GST_AUDIO_RESAMPLER_METHOD_KAISER,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_RESAMPLER_METHOD_NEAREST => Self::Nearest,
            ffi::GST_AUDIO_RESAMPLER_METHOD_LINEAR => Self::Linear,
            ffi::GST_AUDIO_RESAMPLER_METHOD_CUBIC => Self::Cubic,
            ffi::GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL => Self::BlackmanNuttall,
            ffi::GST_AUDIO_RESAMPLER_METHOD_KAISER => Self::Kaiser,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioResamplerMethod {
    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 AudioResamplerMethod {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioResamplerMethod {
    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 AudioResamplerMethod {
    #[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<AudioResamplerMethod> for glib::Value {
    #[inline]
    fn from(v: AudioResamplerMethod) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// The format of the samples in the ringbuffer.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioRingBufferFormatType")]
pub enum AudioRingBufferFormatType {
    /// samples in linear or float
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW")]
    Raw,
    /// samples in mulaw
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW")]
    MuLaw,
    /// samples in alaw
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW")]
    ALaw,
    /// samples in ima adpcm
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM")]
    ImaAdpcm,
    /// samples in mpeg audio (but not AAC) format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG")]
    Mpeg,
    /// samples in gsm format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM")]
    Gsm,
    /// samples in IEC958 frames (e.g. AC3)
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958")]
    Iec958,
    /// samples in AC3 format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3")]
    Ac3,
    /// samples in EAC3 format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3")]
    Eac3,
    /// samples in DTS format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS")]
    Dts,
    /// samples in MPEG-2 AAC ADTS format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC")]
    Mpeg2Aac,
    /// samples in MPEG-4 AAC ADTS format
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC")]
    Mpeg4Aac,
    /// samples in MPEG-2 AAC raw format (Since: 1.12)
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW")]
    Mpeg2AacRaw,
    /// samples in MPEG-4 AAC raw format (Since: 1.12)
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW")]
    Mpeg4AacRaw,
    /// samples in FLAC format (Since: 1.12)
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC")]
    Flac,
    /// samples in DSD format (Since: 1.24)
    #[cfg(feature = "v1_24")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
    #[doc(alias = "GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DSD")]
    Dsd,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    fn into_glib(self) -> ffi::GstAudioRingBufferFormatType {
        match self {
            Self::Raw => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW,
            Self::MuLaw => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW,
            Self::ALaw => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW,
            Self::ImaAdpcm => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM,
            Self::Mpeg => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG,
            Self::Gsm => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM,
            Self::Iec958 => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958,
            Self::Ac3 => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3,
            Self::Eac3 => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3,
            Self::Dts => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS,
            Self::Mpeg2Aac => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC,
            Self::Mpeg4Aac => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC,
            Self::Mpeg2AacRaw => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW,
            Self::Mpeg4AacRaw => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW,
            Self::Flac => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC,
            #[cfg(feature = "v1_24")]
            Self::Dsd => ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DSD,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW => Self::Raw,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW => Self::MuLaw,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW => Self::ALaw,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM => Self::ImaAdpcm,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG => Self::Mpeg,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM => Self::Gsm,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958 => Self::Iec958,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3 => Self::Ac3,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3 => Self::Eac3,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS => Self::Dts,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC => Self::Mpeg2Aac,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC => Self::Mpeg4Aac,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW => Self::Mpeg2AacRaw,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW => Self::Mpeg4AacRaw,
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC => Self::Flac,
            #[cfg(feature = "v1_24")]
            ffi::GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DSD => Self::Dsd,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for AudioRingBufferFormatType {
    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 AudioRingBufferFormatType {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioRingBufferFormatType {
    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 AudioRingBufferFormatType {
    #[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<AudioRingBufferFormatType> for glib::Value {
    #[inline]
    fn from(v: AudioRingBufferFormatType) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

/// Different representations of a stream volume. [`StreamVolume::convert_volume()`][crate::StreamVolume::convert_volume()]
/// allows to convert between the different representations.
///
/// Formulas to convert from a linear to a cubic or dB volume are
/// cbrt(val) and 20 * log10 (val).
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstStreamVolumeFormat")]
pub enum StreamVolumeFormat {
    /// Linear scale factor, 1.0 = 100%
    #[doc(alias = "GST_STREAM_VOLUME_FORMAT_LINEAR")]
    Linear,
    /// Cubic volume scale
    #[doc(alias = "GST_STREAM_VOLUME_FORMAT_CUBIC")]
    Cubic,
    /// Logarithmic volume scale (dB, amplitude not power)
    #[doc(alias = "GST_STREAM_VOLUME_FORMAT_DB")]
    Db,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::GstStreamVolumeFormat {
        match self {
            Self::Linear => ffi::GST_STREAM_VOLUME_FORMAT_LINEAR,
            Self::Cubic => ffi::GST_STREAM_VOLUME_FORMAT_CUBIC,
            Self::Db => ffi::GST_STREAM_VOLUME_FORMAT_DB,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::GST_STREAM_VOLUME_FORMAT_LINEAR => Self::Linear,
            ffi::GST_STREAM_VOLUME_FORMAT_CUBIC => Self::Cubic,
            ffi::GST_STREAM_VOLUME_FORMAT_DB => Self::Db,
            value => Self::__Unknown(value),
        }
    }
}