-
Notifications
You must be signed in to change notification settings - Fork 5
/
structs.go
76 lines (64 loc) · 1.36 KB
/
structs.go
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
//go:build linux
// +build linux
package v4l2
import "unsafe"
const (
maxSizeExtControlDotValue = 8
maxSizeFormatDotFmt = 200
sizePixFormat = 48
)
type v4l2_capability struct {
driver [16]uint8
card [32]uint8
bus_info [32]uint8
version uint32
capabilities uint32
device_caps uint32
reserved [3]uint32
}
type v4l2_pix_format struct {
width uint32
height uint32
pixelformat uint32
field uint32
bytesperline uint32
sizeimage uint32
colorspace uint32
priv uint32
flags uint32
xx_enc uint32
quantization uint32
xfer_func uint32
}
type v4l2_control struct {
id uint32
value int32
}
type v4l2_timecode struct {
typ uint32
flags uint32
frames uint8
seconds uint8
minutes uint8
hours uint8
userbits [4]uint8
}
type v4l2_ext_control struct {
id uint32
size uint32
reserved2 [1]uint32
value [maxSizeExtControlDotValue]byte // union
}
type v4l2_ext_controls struct {
ctrl_class uint32
count uint32
error_idx uint32
reserved [2]uint32
controls unsafe.Pointer
}
// marshals v4l2_pix_format struct into v4l2_format.fmt union
func (pfmt *v4l2_pix_format) marshal() [maxSizeFormatDotFmt]byte {
var b [maxSizeFormatDotFmt]byte
copy(b[0:sizePixFormat], (*[sizePixFormat]byte)(unsafe.Pointer(pfmt))[:])
return b
}