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
// 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 bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;

bitflags! {
    /// Additional video buffer flags. These flags can potentially be used on any
    /// buffers carrying closed caption data, or video data - even encoded data.
    ///
    /// Note that these are only valid for [`crate::gst::Caps`] of type: video/... and caption/...
    /// They can conflict with other extended buffer flags.
    pub struct VideoBufferFlags: u32 {
        /// If the [`crate::gst::Buffer`] is interlaced. In mixed
        ///  interlace-mode, this flags specifies if the frame is
        ///  interlaced or progressive.
        const INTERLACED = 1048576;
        /// If the [`crate::gst::Buffer`] is interlaced, then the first field
        ///  in the video frame is the top field. If unset, the
        ///  bottom field is first.
        const TFF = 2097152;
        /// If the [`crate::gst::Buffer`] is interlaced, then the first field
        ///  (as defined by the [`Self::Tff`] flag setting)
        ///  is repeated.
        const RFF = 4194304;
        /// If the [`crate::gst::Buffer`] is interlaced, then only the
        ///  first field (as defined by the [`Self::Tff`]
        ///  flag setting) is to be displayed (Since: 1.16).
        const ONEFIELD = 8388608;
        /// The [`crate::gst::Buffer`] contains one or more specific views,
        ///  such as left or right eye view. This flags is set on
        ///  any buffer that contains non-mono content - even for
        ///  streams that contain only a single viewpoint. In mixed
        ///  mono / non-mono streams, the absence of the flag marks
        ///  mono buffers.
        const MULTIPLE_VIEW = 16777216;
        /// When conveying stereo/multiview content with
        ///  frame-by-frame methods, this flag marks the first buffer
        ///  in a bundle of frames that belong together.
        const FIRST_IN_BUNDLE = 33554432;
        /// The video frame has the top field only. This is the
        ///  same as GST_VIDEO_BUFFER_FLAG_TFF |
        ///  GST_VIDEO_BUFFER_FLAG_ONEFIELD (Since: 1.16).
        ///  Use GST_VIDEO_BUFFER_IS_TOP_FIELD() to check for this flag.
        #[cfg(any(feature = "v1_16", feature = "dox"))]
        #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
        const TOP_FIELD = 10485760;
        /// The video frame has the bottom field only. This is
        ///  the same as GST_VIDEO_BUFFER_FLAG_ONEFIELD
        ///  (GST_VIDEO_BUFFER_FLAG_TFF flag unset) (Since: 1.16).
        ///  Use GST_VIDEO_BUFFER_IS_BOTTOM_FIELD() to check for this flag.
        #[cfg(any(feature = "v1_16", feature = "dox"))]
        #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
        const BOTTOM_FIELD = 8388608;
        /// The [`crate::gst::Buffer`] contains the end of a video field or frame
        ///  boundary such as the last subframe or packet (Since: 1.18).
        #[cfg(any(feature = "v1_18", feature = "dox"))]
        #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
        const MARKER = 512;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoBufferFlags {
        self.bits()
    }
}

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

impl StaticType for VideoBufferFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_buffer_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoBufferFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Various Chroma sitings.
    pub struct VideoChromaSite: u32 {
        /// no cositing
        const NONE = 1;
        /// chroma is horizontally cosited
        const H_COSITED = 2;
        /// chroma is vertically cosited
        const V_COSITED = 4;
        /// choma samples are sited on alternate lines
        const ALT_LINE = 8;
        /// chroma samples cosited with luma samples
        const COSITED = 6;
        /// jpeg style cositing, also for mpeg1 and mjpeg
        const JPEG = 1;
        /// mpeg2 style cositing
        const MPEG2 = 2;
        /// DV style cositing
        const DV = 14;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoChromaSite {
        self.bits()
    }
}

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

impl StaticType for VideoChromaSite {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_chroma_site_get_type()) }
    }
}

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

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

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

impl ToValue for VideoChromaSite {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags for [`crate::VideoCodecFrame`]
    pub struct VideoCodecFrameFlags: u32 {
        /// is the frame only meant to be decoded
        const DECODE_ONLY = 1;
        /// is the frame a synchronization point (keyframe)
        const SYNC_POINT = 2;
        /// should the output frame be made a keyframe
        const FORCE_KEYFRAME = 4;
        /// should the encoder output stream headers
        const FORCE_KEYFRAME_HEADERS = 8;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoCodecFrameFlags {
        self.bits()
    }
}

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

bitflags! {
    /// Extra video flags
    pub struct VideoFlags: u32 {
        /// a variable fps is selected, fps_n and fps_d
        ///  denote the maximum fps of the video
        const VARIABLE_FPS = 1;
        /// Each color has been scaled by the alpha
        ///  value.
        const PREMULTIPLIED_ALPHA = 2;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoFlags {
        self.bits()
    }
}

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

impl StaticType for VideoFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// The different video flags that a format info can have.
    pub struct VideoFormatFlags: u32 {
        /// The video format is YUV, components are numbered
        ///  0=Y, 1=U, 2=V.
        const YUV = 1;
        /// The video format is RGB, components are numbered
        ///  0=R, 1=G, 2=B.
        const RGB = 2;
        /// The video is gray, there is one gray component
        ///  with index 0.
        const GRAY = 4;
        /// The video format has an alpha components with
        ///  the number 3.
        const ALPHA = 8;
        /// The video format has data stored in little
        ///  endianness.
        const LE = 16;
        /// The video format has a palette. The palette
        ///  is stored in the second plane and indexes are stored in the first plane.
        const PALETTE = 32;
        /// The video format has a complex layout that
        ///  can't be described with the usual information in the [`crate::VideoFormatInfo`].
        const COMPLEX = 64;
        /// This format can be used in a
        ///  `GstVideoFormatUnpack` and `GstVideoFormatPack` function.
        const UNPACK = 128;
        /// The format is tiled, there is tiling information
        ///  in the last plane.
        const TILED = 256;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoFormatFlags {
        self.bits()
    }
}

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

impl StaticType for VideoFormatFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_format_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoFormatFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Extra video frame flags
    pub struct VideoFrameFlags: u32 {
        /// The video frame is interlaced. In mixed
        ///  interlace-mode, this flag specifies if the frame is interlaced or
        ///  progressive.
        const INTERLACED = 1;
        /// The video frame has the top field first
        const TFF = 2;
        /// The video frame has the repeat flag
        const RFF = 4;
        /// The video frame has one field
        const ONEFIELD = 8;
        /// The video contains one or
        ///  more non-mono views
        const MULTIPLE_VIEW = 16;
        /// The video frame is the first
        ///  in a set of corresponding views provided as sequential frames.
        const FIRST_IN_BUNDLE = 32;
        /// The video frame has the top field only. This
        ///  is the same as GST_VIDEO_FRAME_FLAG_TFF | GST_VIDEO_FRAME_FLAG_ONEFIELD
        ///  (Since: 1.16).
        const TOP_FIELD = 10;
        /// The video frame has the bottom field
        ///  only. This is the same as GST_VIDEO_FRAME_FLAG_ONEFIELD
        ///  (GST_VIDEO_FRAME_FLAG_TFF flag unset) (Since: 1.16).
        const BOTTOM_FIELD = 8;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoFrameFlags {
        self.bits()
    }
}

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

impl StaticType for VideoFrameFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_frame_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoFrameFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// GstVideoMultiviewFlags are used to indicate extra properties of a
    /// stereo/multiview stream beyond the frame layout and buffer mapping
    /// that is conveyed in the [`crate::VideoMultiviewMode`].
    pub struct VideoMultiviewFlags: u32 {
        /// For stereo streams, the
        ///  normal arrangement of left and right views is reversed.
        const RIGHT_VIEW_FIRST = 1;
        /// The left view is vertically
        ///  mirrored.
        const LEFT_FLIPPED = 2;
        /// The left view is horizontally
        ///  mirrored.
        const LEFT_FLOPPED = 4;
        /// The right view is
        ///  vertically mirrored.
        const RIGHT_FLIPPED = 8;
        /// The right view is
        ///  horizontally mirrored.
        const RIGHT_FLOPPED = 16;
        /// For frame-packed
        ///  multiview modes, indicates that the individual
        ///  views have been encoded with half the true width or height
        ///  and should be scaled back up for display. This flag
        ///  is used for overriding input layout interpretation
        ///  by adjusting pixel-aspect-ratio.
        ///  For side-by-side, column interleaved or checkerboard packings, the
        ///  pixel width will be doubled. For row interleaved and top-bottom
        ///  encodings, pixel height will be doubled.
        const HALF_ASPECT = 16384;
        /// The video stream contains both
        ///  mono and multiview portions, signalled on each buffer by the
        ///  absence or presence of the [`crate::VideoBufferFlags::MultipleView`] (XXX: @-reference does not belong to VideoMultiviewFlags!)
        ///  buffer flag.
        const MIXED_MONO = 32768;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoMultiviewFlags {
        self.bits()
    }
}

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

impl StaticType for VideoMultiviewFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_multiview_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoMultiviewFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Overlay format flags.
    pub struct VideoOverlayFormatFlags: u32 {
        /// RGB are premultiplied by A/255.
        const PREMULTIPLIED_ALPHA = 1;
        /// a global-alpha value != 1 is set.
        const GLOBAL_ALPHA = 2;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoOverlayFormatFlags {
        self.bits()
    }
}

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

#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
impl StaticType for VideoOverlayFormatFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_overlay_format_flags_get_type()) }
    }
}

#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
impl glib::value::ValueType for VideoOverlayFormatFlags {
    type Type = Self;
}

#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
unsafe impl<'a> FromValue<'a> for VideoOverlayFormatFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

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

#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
impl ToValue for VideoOverlayFormatFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// The different flags that can be used when packing and unpacking.
    pub struct VideoPackFlags: u32 {
        /// When the source has a smaller depth
        ///  than the target format, set the least significant bits of the target
        ///  to 0. This is likely slightly faster but less accurate. When this flag
        ///  is not specified, the most significant bits of the source are duplicated
        ///  in the least significant bits of the destination.
        const TRUNCATE_RANGE = 1;
        /// The source is interlaced. The unpacked
        ///  format will be interlaced as well with each line containing
        ///  information from alternating fields. (Since: 1.2)
        const INTERLACED = 2;
    }
}

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

    fn into_glib(self) -> ffi::GstVideoPackFlags {
        self.bits()
    }
}

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

impl StaticType for VideoPackFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_pack_flags_get_type()) }
    }
}

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

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

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

impl ToValue for VideoPackFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
bitflags! {
    /// Flags related to the time code information.
    /// For drop frame, only 30000/1001 and 60000/1001 frame rates are supported.
    pub struct VideoTimeCodeFlags: u32 {
        /// Whether we have drop frame rate
        const DROP_FRAME = 1;
        /// Whether we have interlaced video
        const INTERLACED = 2;
    }
}

#[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(hidden)]
impl IntoGlib for VideoTimeCodeFlags {
    type GlibType = ffi::GstVideoTimeCodeFlags;

    fn into_glib(self) -> ffi::GstVideoTimeCodeFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(hidden)]
impl FromGlib<ffi::GstVideoTimeCodeFlags> for VideoTimeCodeFlags {
    unsafe fn from_glib(value: ffi::GstVideoTimeCodeFlags) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
impl StaticType for VideoTimeCodeFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_video_time_code_flags_get_type()) }
    }
}

#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
impl glib::value::ValueType for VideoTimeCodeFlags {
    type Type = Self;
}

#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
unsafe impl<'a> FromValue<'a> for VideoTimeCodeFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

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

#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
impl ToValue for VideoTimeCodeFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}