1use bitflags::bitflags;
2use std::fmt;
3
4use crate::timestamp::Timestamp;
5
6#[allow(clippy::unreadable_literal)]
10#[rustfmt::skip]
11#[repr(u32)]
12#[derive(Debug, Clone, Copy)]
13pub enum Type {
14 VideoCapture = 1,
15 VideoOutput = 2,
16 VideoOverlay = 3,
17 VbiCaputre = 4,
18 VbiOutput = 5,
19 SlicedVbiCapture = 6,
20 SlicedVbiOutput = 7,
21 VideoOutputOverlay = 8,
22 VideoCaptureMplane = 9,
23 VideoOutputMplane = 10,
24 SdrCapture = 11,
25 SdrOutput = 12,
26 MetaCapture = 13,
27 MetaOutput = 14,
28
29 Private = 0x80,
31}
32
33bitflags! {
34 #[allow(clippy::unreadable_literal)]
35 pub struct Flags: u32 {
36 const MAPPED = 0x00000001;
38 const QUEUED = 0x00000002;
40 const DONE = 0x00000004;
42 const KEYFRAME = 0x00000008;
44 const PFRAME = 0x00000010;
46 const BFRAME = 0x00000020;
48 const ERROR = 0x00000040;
50 const IN_REQUEST = 0x00000080;
52 const TIMECODE = 0x00000100;
54 const M2M_HOLD_CAPTURE_BUF = 0x00000200;
56 const PREPARED = 0x00000400;
58 const NO_CACHE_INVALIDATE = 0x00000800;
60 const NO_CACHE_CLEAN = 0x00001000;
61 const TIMESTAMP_MASK = 0x0000e000;
63 const TIMESTAMP_UNKNOWN = 0x00000000;
64 const TIMESTAMP_MONOTONIC = 0x00002000;
65 const TIMESTAMP_COPY = 0x00004000;
66 const TSTAMP_SRC_MASK = 0x00070000;
68 const TSTAMP_SRC_EOF = 0x00000000;
69 const TSTAMP_SRC_SOE = 0x00010000;
70 const LAST = 0x00100000;
72 const REQUEST_FD = 0x00800000;
74 }
75}
76
77impl Default for Flags {
78 fn default() -> Self {
79 Flags::from(0)
80 }
81}
82
83impl From<u32> for Flags {
84 fn from(flags: u32) -> Self {
85 Self::from_bits_truncate(flags)
86 }
87}
88
89impl From<Flags> for u32 {
90 fn from(flags: Flags) -> Self {
91 flags.bits()
92 }
93}
94
95impl fmt::Display for Flags {
96 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
97 fmt::Debug::fmt(self, f)
98 }
99}
100
101#[derive(Copy, Clone, Default)]
103pub struct Metadata {
104 pub bytesused: u32,
106 pub flags: Flags,
108 pub field: u32,
110 pub timestamp: Timestamp,
112 pub sequence: u32,
114}