More V4L2_PIX_FMT formats
[cl-v4l2.git] / videodev2.lisp
blob026cd73e2e951f4f4f1043e70376fb4f3a3402c9
1 (in-package :cl-v4l2)
3 (defcstruct v4l2-capability
4 (driver :uchar :count 16)
5 (card :uchar :count 32)
6 (bus-info :uchar :count 32)
7 (version :uint32)
8 (capabilities :uint32)
9 (reserved :uint32 :count 4))
11 (defcstruct v4l2-fract
12 (numerator :uint32)
13 (denominator :uint32))
15 (defcstruct v4l2-captureparm
16 (capability :uint32) ; Supported modes
17 (capturemode :uint32) ; Current mode
18 (timeperframe v4l2-fract) ; Time per frame in .1us units
19 (extendedmode :uint32) ; Driver-specific extensions
20 (readbuffers :uint32) ; # of buffers for read
21 (reserved :uint32 :count 4))
23 (defcstruct v4l2-outputparm
24 (capability :uint32) ; Supported modes
25 (outputmode :uint32) ; Current mode
26 (timeperframe v4l2-fract) ; Time per frame in .1us units
27 (extendedmode :uint32) ; Driver-specific extensions
28 (writebuffers :uint32) ; # of buffers for write
29 (reserved :uint32 :count 4))
31 (defcunion v4l2-streamparm-union
32 (capture v4l2-captureparm)
33 (output v4l2-outputparm)
34 (raw-data :uchar :count 200))
36 (defcenum v4l2-buf-type
37 (:buf-type-video-capture 1)
38 :buf-type-video-output
39 :buf-type-video-overlay
40 :buf-type-vbi-capture
41 :buf-type-vbi-output
42 :buf-type-sliced-vbi-capture
43 :buf-type-sliced-vbi-output
44 :buf-type-video-output-overlay)
46 (defcstruct v4l2-streamparm
47 (type v4l2-buf-type)
48 (parm v4l2-streamparm-union))
50 (defcenum v4l2-tuner-type
51 (:tuner-radio 1)
52 :tuner-analog-tv
53 :tuner-digital-tv)
55 (defcstruct v4l2-tuner
56 (index :uint32)
57 (name :uchar :count 32)
58 (type v4l2-tuner-type)
59 (capability :uint32)
60 (rangelow :uint32)
61 (rangehigh :uint32)
62 (rxsubchans :uint32)
63 (audmode :uint32)
64 (signal :int32)
65 (afc :int32)
66 (reserved :uint32 :count 4))
68 (defcstruct v4l2-standard
69 (index :uint32)
70 (id :uint64)
71 (name :uchar :count 24)
72 (frameperiod v4l2-fract)
73 (framelines :uint32)
74 (reserved :uint32 :count 4))
76 (defcstruct v4l2-input
77 (index :uint32) ; Which input
78 (name :uchar :count 32) ; Label
79 (type :uint32) ; Type of input
80 (audioset :uint32) ; Associated audios (bitfield)
81 (tuner :uint32) ; Associated tuner
82 (std :uint64)
83 (status :uint32)
84 (reserved :uint32 :count 4))
87 ;; F O R M A T E N U M E R A T I O N
89 (defcstruct v4l2-fmtdesc
90 (index :uint32) ; Format number
91 (type v4l2-buf-type) ; buffer type
92 (flags :uint32)
93 (description :uchar :count 32) ; Description string
94 (pixelformat :uint32) ; Format fourcc
95 (reserved :uint32 :count 4))
97 ;; Values for the 'type' field
98 (defconstant v4l2-input-type-tuner 1)
100 (defconstant v4l2-input-type-camera 2)
102 (defcenum v4l2-field
103 :field-any ; driver can choose from none
104 ; top, bottom, interlaced
105 ; depending on whatever it thinks
106 ; is approximate ...
107 :field-none ; this device has no fields ...
108 :field-top ; top field only
109 :field-bottom ; bottom field only
110 :field-interlaced ; both fields interlaced
111 :field-seq-tb ; both fields sequential into one
112 ; buffer, top-bottom order
113 :field-seq-bt ; same as above + bottom-top order
114 :field-alternate ; both fields alternating into
115 ; separate buffers
116 :field-interlaced-tb ; both fields interlaced, top field
117 ; first and the top field is
118 ; transmitted first
119 :field-interlaced-bt ; both fields interlaced, top field
120 ; first and the bottom field is
121 ; transmitted first
124 (defcenum v4l2-colorspace
125 (:colorspace-smpte170m 1) ; ITU-R 601 -- broadcast NTSC/PAL
126 :colorspace_smpte240m ; 1125-Line (US) HDTV
127 :colorspace-rec709 ; HD and modern captures.
128 ; broken BT878 extents (601, luma range 16-253 instead of 16-235)
129 :colorspace-bt878
130 ; These should be useful. Assume 601 extents.
131 :colorspace-470-system-m
132 :colorspace-470-system-bg
134 ; I know there will be cameras that send this. So, this is
135 ; unspecified chromaticities and full 0-255 on each of the
136 ; Y'CbCr components
137 :colorspace-jpeg
139 ; For RGB colourspaces, this is probably a good start.
140 :colorspace-srgb)
143 ;; V I D E O I M A G E F O R M A T
145 (defcstruct v4l2-pix-format
146 (width :uint32)
147 (height :uint32)
148 (pixelformat :uint32)
149 (field v4l2-field)
150 (bytesperline :uint32) ; for padding, zero if unused
151 (sizeimage :uint32)
152 (colorspace v4l2-colorspace)
153 (priv :uint32)) ; private data, depends on pixelformat
155 ;; Stream data format
158 (defcstruct v4l2-timecode
159 (type :uint32)
160 (flags :uint32)
161 (frames :uchar)
162 (seconds :uchar)
163 (minutes :uchar)
164 (hours :uchar)
165 (userbits :uchar :count 4))
167 (defcenum v4l2-memory
168 (:memory-mmap 1)
169 :memory-userptr
170 :memory-overlay)
172 ;; M E M O R Y - M A P P I N G B U F F E R S
174 (defcstruct v4l2-requestbuffers
175 (count :uint32)
176 (type v4l2-buf-type)
177 (memory v4l2-memory)
178 (reserved :uint32 :count 2))
180 (defcunion v4l2-buffer-union
181 (offset :uint32)
182 (userptr :ulong))
184 (defcstruct v4l2-buffer
185 (index :uint32)
186 (type v4l2-buf-type)
187 (bytesused :uint32)
188 (flags :uint32)
189 (field v4l2-field)
190 (timestamp timeval)
191 (timecode v4l2-timecode)
192 (sequence :uint32)
193 ; memory location
194 (memory v4l2-memory)
195 (m v4l2-buffer-union)
196 (length :uint32)
197 (input :uint32)
198 (reserved :uint32))