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
use bitflags::bitflags;
use std::fmt;
use crate::timestamp::Timestamp;
#[allow(clippy::unreadable_literal)]
#[rustfmt::skip]
#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub enum Type {
VideoCapture = 1,
VideoOutput = 2,
VideoOverlay = 3,
VbiCaputre = 4,
VbiOutput = 5,
SlicedVbiCapture = 6,
SlicedVbiOutput = 7,
VideoOutputOverlay = 8,
VideoCaptureMplane = 9,
VideoOutputMplane = 10,
SdrCapture = 11,
SdrOutput = 12,
MetaCapture = 13,
MetaOutput = 14,
Private = 0x80,
}
bitflags! {
#[allow(clippy::unreadable_literal)]
pub struct Flags: u32 {
const MAPPED = 0x00000001;
const QUEUED = 0x00000002;
const DONE = 0x00000004;
const KEYFRAME = 0x00000008;
const PFRAME = 0x00000010;
const BFRAME = 0x00000020;
const ERROR = 0x00000040;
const IN_REQUEST = 0x00000080;
const TIMECODE = 0x00000100;
const M2M_HOLD_CAPTURE_BUF = 0x00000200;
const PREPARED = 0x00000400;
const NO_CACHE_INVALIDATE = 0x00000800;
const NO_CACHE_CLEAN = 0x00001000;
const TIMESTAMP_MASK = 0x0000e000;
const TIMESTAMP_UNKNOWN = 0x00000000;
const TIMESTAMP_MONOTONIC = 0x00002000;
const TIMESTAMP_COPY = 0x00004000;
const TSTAMP_SRC_MASK = 0x00070000;
const TSTAMP_SRC_EOF = 0x00000000;
const TSTAMP_SRC_SOE = 0x00010000;
const LAST = 0x00100000;
const REQUEST_FD = 0x00800000;
}
}
impl Default for Flags {
fn default() -> Self {
Flags::from(0)
}
}
impl From<u32> for Flags {
fn from(flags: u32) -> Flags {
Flags::from_bits_truncate(flags)
}
}
impl Into<u32> for Flags {
fn into(self) -> u32 {
self.bits()
}
}
impl fmt::Display for Flags {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self, f)
}
}
#[derive(Copy, Clone, Default)]
pub struct Metadata {
pub bytesused: u32,
pub flags: Flags,
pub field: u32,
pub timestamp: Timestamp,
pub sequence: u32,
}