1<programlisting>
2/*
3 *  Video for Linux Two header file
4 *
5 *  Copyright (C) 1999-2012 the contributors
6 *
7 *  This program is free software; you can redistribute it and/or modify
8 *  it under the terms of the GNU General Public License as published by
9 *  the Free Software Foundation; either version 2 of the License, or
10 *  (at your option) any later version.
11 *
12 *  This program is distributed in the hope that it will be useful,
13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *  GNU General Public License for more details.
16 *
17 *  Alternatively you can redistribute this file under the terms of the
18 *  BSD license as stated below:
19 *
20 *  Redistribution and use in source and binary forms, with or without
21 *  modification, are permitted provided that the following conditions
22 *  are met:
23 *  1. Redistributions of source code must retain the above copyright
24 *     notice, this list of conditions and the following disclaimer.
25 *  2. Redistributions in binary form must reproduce the above copyright
26 *     notice, this list of conditions and the following disclaimer in
27 *     the documentation and/or other materials provided with the
28 *     distribution.
29 *  3. The names of its contributors may not be used to endorse or promote
30 *     products derived from this software without specific prior written
31 *     permission.
32 *
33 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
39 *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40 *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 *
45 *      Header file for v4l or V4L2 drivers and applications
46 * with public API.
47 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
48 * no #if __KERNEL tests are allowed here
49 *
50 *      See http://linuxtv.org for more info
51 *
52 *      Author: Bill Dirks &lt;bill@thedirks.org&gt;
53 *              Justin Schoeman
54 *              Hans Verkuil &lt;hverkuil@xs4all.nl&gt;
55 *              et al.
56 */
57#ifndef _UAPI__LINUX_VIDEODEV2_H
58#define _UAPI__LINUX_VIDEODEV2_H
59
60#ifndef __KERNEL__
61#include &lt;sys/time.h&gt;
62#endif
63#include &lt;linux/compiler.h&gt;
64#include &lt;linux/ioctl.h&gt;
65#include &lt;linux/types.h&gt;
66#include &lt;linux/v4l2-common.h&gt;
67#include &lt;linux/v4l2-controls.h&gt;
68
69/*
70 * Common stuff for both V4L1 and V4L2
71 * Moved from videodev.h
72 */
73#define VIDEO_MAX_FRAME               32
74#define VIDEO_MAX_PLANES               8
75
76/*
77 *      M I S C E L L A N E O U S
78 */
79
80/*  Four-character-code (FOURCC) */
81#define v4l2_fourcc(a, b, c, d)\
82        ((__u32)(a) | ((__u32)(b) &lt;&lt; 8) | ((__u32)(c) &lt;&lt; 16) | ((__u32)(d) &lt;&lt; 24))
83#define v4l2_fourcc_be(a, b, c, d)      (v4l2_fourcc(a, b, c, d) | (1 &lt;&lt; 31))
84
85/*
86 *      E N U M S
87 */
88enum <link linkend="v4l2-field">v4l2_field</link> {
89        V4L2_FIELD_ANY           = 0, /* driver can choose from none,
90                                         top, bottom, interlaced
91                                         depending on whatever it thinks
92                                         is approximate ... */
93        V4L2_FIELD_NONE          = 1, /* this device has no fields ... */
94        V4L2_FIELD_TOP           = 2, /* top field only */
95        V4L2_FIELD_BOTTOM        = 3, /* bottom field only */
96        V4L2_FIELD_INTERLACED    = 4, /* both fields interlaced */
97        V4L2_FIELD_SEQ_TB        = 5, /* both fields sequential into one
98                                         buffer, top-bottom order */
99        V4L2_FIELD_SEQ_BT        = 6, /* same as above + bottom-top order */
100        V4L2_FIELD_ALTERNATE     = 7, /* both fields alternating into
101                                         separate buffers */
102        V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
103                                         first and the top field is
104                                         transmitted first */
105        V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
106                                         first and the bottom field is
107                                         transmitted first */
108};
109#define V4L2_FIELD_HAS_TOP(field)       \
110        ((field) == V4L2_FIELD_TOP      ||\
111         (field) == V4L2_FIELD_INTERLACED ||\
112         (field) == V4L2_FIELD_INTERLACED_TB ||\
113         (field) == V4L2_FIELD_INTERLACED_BT ||\
114         (field) == V4L2_FIELD_SEQ_TB   ||\
115         (field) == V4L2_FIELD_SEQ_BT)
116#define V4L2_FIELD_HAS_BOTTOM(field)    \
117        ((field) == V4L2_FIELD_BOTTOM   ||\
118         (field) == V4L2_FIELD_INTERLACED ||\
119         (field) == V4L2_FIELD_INTERLACED_TB ||\
120         (field) == V4L2_FIELD_INTERLACED_BT ||\
121         (field) == V4L2_FIELD_SEQ_TB   ||\
122         (field) == V4L2_FIELD_SEQ_BT)
123#define V4L2_FIELD_HAS_BOTH(field)      \
124        ((field) == V4L2_FIELD_INTERLACED ||\
125         (field) == V4L2_FIELD_INTERLACED_TB ||\
126         (field) == V4L2_FIELD_INTERLACED_BT ||\
127         (field) == V4L2_FIELD_SEQ_TB ||\
128         (field) == V4L2_FIELD_SEQ_BT)
129#define V4L2_FIELD_HAS_T_OR_B(field)    \
130        ((field) == V4L2_FIELD_BOTTOM ||\
131         (field) == V4L2_FIELD_TOP ||\
132         (field) == V4L2_FIELD_ALTERNATE)
133
134enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> {
135        V4L2_BUF_TYPE_VIDEO_CAPTURE        = 1,
136        V4L2_BUF_TYPE_VIDEO_OUTPUT         = 2,
137        V4L2_BUF_TYPE_VIDEO_OVERLAY        = 3,
138        V4L2_BUF_TYPE_VBI_CAPTURE          = 4,
139        V4L2_BUF_TYPE_VBI_OUTPUT           = 5,
140        V4L2_BUF_TYPE_SLICED_VBI_CAPTURE   = 6,
141        V4L2_BUF_TYPE_SLICED_VBI_OUTPUT    = 7,
142#if 1
143        /* Experimental */
144        V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
145#endif
146        V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
147        V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE  = 10,
148        V4L2_BUF_TYPE_SDR_CAPTURE          = 11,
149        /* Deprecated, do not use */
150        V4L2_BUF_TYPE_PRIVATE              = 0x80,
151};
152
153#define V4L2_TYPE_IS_MULTIPLANAR(type)                  \
154        ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE   \
155         || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
156
157#define V4L2_TYPE_IS_OUTPUT(type)                               \
158        ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT                   \
159         || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE         \
160         || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY               \
161         || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY        \
162         || (type) == V4L2_BUF_TYPE_VBI_OUTPUT                  \
163         || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
164
165enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> {
166        V4L2_TUNER_RADIO             = 1,
167        V4L2_TUNER_ANALOG_TV         = 2,
168        V4L2_TUNER_DIGITAL_TV        = 3,
169        V4L2_TUNER_ADC               = 4,
170        V4L2_TUNER_RF                = 5,
171};
172
173enum <link linkend="v4l2-memory">v4l2_memory</link> {
174        V4L2_MEMORY_MMAP             = 1,
175        V4L2_MEMORY_USERPTR          = 2,
176        V4L2_MEMORY_OVERLAY          = 3,
177        V4L2_MEMORY_DMABUF           = 4,
178};
179
180/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
181enum <link linkend="v4l2-colorspace">v4l2_colorspace</link> {
182        /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
183        V4L2_COLORSPACE_SMPTE170M     = 1,
184
185        /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
186        V4L2_COLORSPACE_SMPTE240M     = 2,
187
188        /* Rec.709: used for HDTV */
189        V4L2_COLORSPACE_REC709        = 3,
190
191        /*
192         * Deprecated, do not use. No driver will ever return this. This was
193         * based on a misunderstanding of the bt878 datasheet.
194         */
195        V4L2_COLORSPACE_BT878         = 4,
196
197        /*
198         * NTSC 1953 colorspace. This only makes sense when dealing with
199         * really, really old NTSC recordings. Superseded by SMPTE 170M.
200         */
201        V4L2_COLORSPACE_470_SYSTEM_M  = 5,
202
203        /*
204         * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
205         * dealing with really old PAL/SECAM recordings. Superseded by
206         * SMPTE 170M.
207         */
208        V4L2_COLORSPACE_470_SYSTEM_BG = 6,
209
210        /*
211         * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
212         * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
213         */
214        V4L2_COLORSPACE_JPEG          = 7,
215
216        /* For RGB colorspaces such as produces by most webcams. */
217        V4L2_COLORSPACE_SRGB          = 8,
218
219        /* AdobeRGB colorspace */
220        V4L2_COLORSPACE_ADOBERGB      = 9,
221
222        /* BT.2020 colorspace, used for UHDTV. */
223        V4L2_COLORSPACE_BT2020        = 10,
224};
225
226enum <link linkend="v4l2-ycbcr-encoding">v4l2_ycbcr_encoding</link> {
227        /*
228         * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
229         * various colorspaces:
230         *
231         * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
232         * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
233         * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
234         *
235         * V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
236         *
237         * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC
238         *
239         * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
240         *
241         * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
242         */
243        V4L2_YCBCR_ENC_DEFAULT        = 0,
244
245        /* ITU-R 601 -- SDTV */
246        V4L2_YCBCR_ENC_601            = 1,
247
248        /* Rec. 709 -- HDTV */
249        V4L2_YCBCR_ENC_709            = 2,
250
251        /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */
252        V4L2_YCBCR_ENC_XV601          = 3,
253
254        /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
255        V4L2_YCBCR_ENC_XV709          = 4,
256
257        /* sYCC (Y'CbCr encoding of sRGB) */
258        V4L2_YCBCR_ENC_SYCC           = 5,
259
260        /* BT.2020 Non-constant Luminance Y'CbCr */
261        V4L2_YCBCR_ENC_BT2020         = 6,
262
263        /* BT.2020 Constant Luminance Y'CbcCrc */
264        V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7,
265
266        /* SMPTE 240M -- Obsolete HDTV */
267        V4L2_YCBCR_ENC_SMPTE240M      = 8,
268};
269
270enum <link linkend="v4l2-quantization">v4l2_quantization</link> {
271        /*
272         * The default for R'G'B' quantization is always full range, except
273         * for the BT2020 colorspace. For Y'CbCr the quantization is always
274         * limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709:
275         * those are full range.
276         */
277        V4L2_QUANTIZATION_DEFAULT     = 0,
278        V4L2_QUANTIZATION_FULL_RANGE  = 1,
279        V4L2_QUANTIZATION_LIM_RANGE   = 2,
280};
281
282enum <link linkend="v4l2-priority">v4l2_priority</link> {
283        V4L2_PRIORITY_UNSET       = 0,  /* not initialized */
284        V4L2_PRIORITY_BACKGROUND  = 1,
285        V4L2_PRIORITY_INTERACTIVE = 2,
286        V4L2_PRIORITY_RECORD      = 3,
287        V4L2_PRIORITY_DEFAULT     = V4L2_PRIORITY_INTERACTIVE,
288};
289
290struct <link linkend="v4l2-rect">v4l2_rect</link> {
291        __s32   left;
292        __s32   top;
293        __u32   width;
294        __u32   height;
295};
296
297struct <link linkend="v4l2-fract">v4l2_fract</link> {
298        __u32   numerator;
299        __u32   denominator;
300};
301
302/**
303  * struct <link linkend="v4l2-capability">v4l2_capability</link> - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
304  *
305  * @driver:       name of the driver module (e.g. "bttv")
306  * @card:         name of the card (e.g. "Hauppauge WinTV")
307  * @bus_info:     name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
308  * @version:      KERNEL_VERSION
309  * @capabilities: capabilities of the physical device as a whole
310  * @device_caps:  capabilities accessed via this particular device (node)
311  * @reserved:     reserved fields for future extensions
312  */
313struct <link linkend="v4l2-capability">v4l2_capability</link> {
314        __u8    driver[16];
315        __u8    card[32];
316        __u8    bus_info[32];
317        __u32   version;
318        __u32   capabilities;
319        __u32   device_caps;
320        __u32   reserved[3];
321};
322
323/* Values for 'capabilities' field */
324#define V4L2_CAP_VIDEO_CAPTURE          0x00000001  /* Is a video capture device */
325#define V4L2_CAP_VIDEO_OUTPUT           0x00000002  /* Is a video output device */
326#define V4L2_CAP_VIDEO_OVERLAY          0x00000004  /* Can do video overlay */
327#define V4L2_CAP_VBI_CAPTURE            0x00000010  /* Is a raw VBI capture device */
328#define V4L2_CAP_VBI_OUTPUT             0x00000020  /* Is a raw VBI output device */
329#define V4L2_CAP_SLICED_VBI_CAPTURE     0x00000040  /* Is a sliced VBI capture device */
330#define V4L2_CAP_SLICED_VBI_OUTPUT      0x00000080  /* Is a sliced VBI output device */
331#define V4L2_CAP_RDS_CAPTURE            0x00000100  /* RDS data capture */
332#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY   0x00000200  /* Can do video output overlay */
333#define V4L2_CAP_HW_FREQ_SEEK           0x00000400  /* Can do hardware frequency seek  */
334#define V4L2_CAP_RDS_OUTPUT             0x00000800  /* Is an RDS encoder */
335
336/* Is a video capture device that supports multiplanar formats */
337#define V4L2_CAP_VIDEO_CAPTURE_MPLANE   0x00001000
338/* Is a video output device that supports multiplanar formats */
339#define V4L2_CAP_VIDEO_OUTPUT_MPLANE    0x00002000
340/* Is a video mem-to-mem device that supports multiplanar formats */
341#define V4L2_CAP_VIDEO_M2M_MPLANE       0x00004000
342/* Is a video mem-to-mem device */
343#define V4L2_CAP_VIDEO_M2M              0x00008000
344
345#define V4L2_CAP_TUNER                  0x00010000  /* has a tuner */
346#define V4L2_CAP_AUDIO                  0x00020000  /* has audio support */
347#define V4L2_CAP_RADIO                  0x00040000  /* is a radio device */
348#define V4L2_CAP_MODULATOR              0x00080000  /* has a modulator */
349
350#define V4L2_CAP_SDR_CAPTURE            0x00100000  /* Is a SDR capture device */
351#define V4L2_CAP_EXT_PIX_FORMAT         0x00200000  /* Supports the extended pixel format */
352
353#define V4L2_CAP_READWRITE              0x01000000  /* read/write systemcalls */
354#define V4L2_CAP_ASYNCIO                0x02000000  /* async I/O */
355#define V4L2_CAP_STREAMING              0x04000000  /* streaming I/O ioctls */
356
357#define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
358
359/*
360 *      V I D E O   I M A G E   F O R M A T
361 */
362struct <link linkend="v4l2-pix-format">v4l2_pix_format</link> {
363        __u32                   width;
364        __u32                   height;
365        __u32                   pixelformat;
366        __u32                   field;          /* enum <link linkend="v4l2-field">v4l2_field</link> */
367        __u32                   bytesperline;   /* for padding, zero if unused */
368        __u32                   sizeimage;
369        __u32                   colorspace;     /* enum <link linkend="v4l2-colorspace">v4l2_colorspace</link> */
370        __u32                   priv;           /* private data, depends on pixelformat */
371        __u32                   flags;          /* format flags (V4L2_PIX_FMT_FLAG_*) */
372        __u32                   ycbcr_enc;      /* enum <link linkend="v4l2-ycbcr-encoding">v4l2_ycbcr_encoding</link> */
373        __u32                   quantization;   /* enum <link linkend="v4l2-quantization">v4l2_quantization</link> */
374};
375
376/*      Pixel format         FOURCC                          depth  Description  */
377
378/* RGB formats */
379#define <link linkend="V4L2-PIX-FMT-RGB332">V4L2_PIX_FMT_RGB332</link>  v4l2_fourcc('R', 'G', 'B', '1') /*  8  RGB-3-3-2     */
380#define <link linkend="V4L2-PIX-FMT-RGB444">V4L2_PIX_FMT_RGB444</link>  v4l2_fourcc('R', '4', '4', '4') /* 16  xxxxrrrr ggggbbbb */
381#define <link linkend="V4L2-PIX-FMT-ARGB444">V4L2_PIX_FMT_ARGB444</link> v4l2_fourcc('A', 'R', '1', '2') /* 16  aaaarrrr ggggbbbb */
382#define <link linkend="V4L2-PIX-FMT-XRGB444">V4L2_PIX_FMT_XRGB444</link> v4l2_fourcc('X', 'R', '1', '2') /* 16  xxxxrrrr ggggbbbb */
383#define <link linkend="V4L2-PIX-FMT-RGB555">V4L2_PIX_FMT_RGB555</link>  v4l2_fourcc('R', 'G', 'B', 'O') /* 16  RGB-5-5-5     */
384#define <link linkend="V4L2-PIX-FMT-ARGB555">V4L2_PIX_FMT_ARGB555</link> v4l2_fourcc('A', 'R', '1', '5') /* 16  ARGB-1-5-5-5  */
385#define <link linkend="V4L2-PIX-FMT-XRGB555">V4L2_PIX_FMT_XRGB555</link> v4l2_fourcc('X', 'R', '1', '5') /* 16  XRGB-1-5-5-5  */
386#define <link linkend="V4L2-PIX-FMT-RGB565">V4L2_PIX_FMT_RGB565</link>  v4l2_fourcc('R', 'G', 'B', 'P') /* 16  RGB-5-6-5     */
387#define <link linkend="V4L2-PIX-FMT-RGB555X">V4L2_PIX_FMT_RGB555X</link> v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 BE  */
388#define <link linkend="V4L2-PIX-FMT-ARGB555X">V4L2_PIX_FMT_ARGB555X</link> v4l2_fourcc_be('A', 'R', '1', '5') /* 16  ARGB-5-5-5 BE */
389#define <link linkend="V4L2-PIX-FMT-XRGB555X">V4L2_PIX_FMT_XRGB555X</link> v4l2_fourcc_be('X', 'R', '1', '5') /* 16  XRGB-5-5-5 BE */
390#define <link linkend="V4L2-PIX-FMT-RGB565X">V4L2_PIX_FMT_RGB565X</link> v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 BE  */
391#define <link linkend="V4L2-PIX-FMT-BGR666">V4L2_PIX_FMT_BGR666</link>  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6     */
392#define <link linkend="V4L2-PIX-FMT-BGR24">V4L2_PIX_FMT_BGR24</link>   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8     */
393#define <link linkend="V4L2-PIX-FMT-RGB24">V4L2_PIX_FMT_RGB24</link>   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8     */
394#define <link linkend="V4L2-PIX-FMT-BGR32">V4L2_PIX_FMT_BGR32</link>   v4l2_fourcc('B', 'G', 'R', '4') /* 32  BGR-8-8-8-8   */
395#define <link linkend="V4L2-PIX-FMT-ABGR32">V4L2_PIX_FMT_ABGR32</link>  v4l2_fourcc('A', 'R', '2', '4') /* 32  BGRA-8-8-8-8  */
396#define <link linkend="V4L2-PIX-FMT-XBGR32">V4L2_PIX_FMT_XBGR32</link>  v4l2_fourcc('X', 'R', '2', '4') /* 32  BGRX-8-8-8-8  */
397#define <link linkend="V4L2-PIX-FMT-RGB32">V4L2_PIX_FMT_RGB32</link>   v4l2_fourcc('R', 'G', 'B', '4') /* 32  RGB-8-8-8-8   */
398#define <link linkend="V4L2-PIX-FMT-ARGB32">V4L2_PIX_FMT_ARGB32</link>  v4l2_fourcc('B', 'A', '2', '4') /* 32  ARGB-8-8-8-8  */
399#define <link linkend="V4L2-PIX-FMT-XRGB32">V4L2_PIX_FMT_XRGB32</link>  v4l2_fourcc('B', 'X', '2', '4') /* 32  XRGB-8-8-8-8  */
400
401/* Grey formats */
402#define <link linkend="V4L2-PIX-FMT-GREY">V4L2_PIX_FMT_GREY</link>    v4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale     */
403#define <link linkend="V4L2-PIX-FMT-Y4">V4L2_PIX_FMT_Y4</link>      v4l2_fourcc('Y', '0', '4', ' ') /*  4  Greyscale     */
404#define <link linkend="V4L2-PIX-FMT-Y6">V4L2_PIX_FMT_Y6</link>      v4l2_fourcc('Y', '0', '6', ' ') /*  6  Greyscale     */
405#define <link linkend="V4L2-PIX-FMT-Y10">V4L2_PIX_FMT_Y10</link>     v4l2_fourcc('Y', '1', '0', ' ') /* 10  Greyscale     */
406#define <link linkend="V4L2-PIX-FMT-Y12">V4L2_PIX_FMT_Y12</link>     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale     */
407#define <link linkend="V4L2-PIX-FMT-Y16">V4L2_PIX_FMT_Y16</link>     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale     */
408
409/* Grey bit-packed formats */
410#define <link linkend="V4L2-PIX-FMT-Y10BPACK">V4L2_PIX_FMT_Y10BPACK</link>    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
411
412/* Palette formats */
413#define <link linkend="V4L2-PIX-FMT-PAL8">V4L2_PIX_FMT_PAL8</link>    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */
414
415/* Chrominance formats */
416#define <link linkend="V4L2-PIX-FMT-UV8">V4L2_PIX_FMT_UV8</link>     v4l2_fourcc('U', 'V', '8', ' ') /*  8  UV 4:4 */
417
418/* Luminance+Chrominance formats */
419#define <link linkend="V4L2-PIX-FMT-YVU410">V4L2_PIX_FMT_YVU410</link>  v4l2_fourcc('Y', 'V', 'U', '9') /*  9  YVU 4:1:0     */
420#define <link linkend="V4L2-PIX-FMT-YVU420">V4L2_PIX_FMT_YVU420</link>  v4l2_fourcc('Y', 'V', '1', '2') /* 12  YVU 4:2:0     */
421#define <link linkend="V4L2-PIX-FMT-YUYV">V4L2_PIX_FMT_YUYV</link>    v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16  YUV 4:2:2     */
422#define <link linkend="V4L2-PIX-FMT-YYUV">V4L2_PIX_FMT_YYUV</link>    v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16  YUV 4:2:2     */
423#define <link linkend="V4L2-PIX-FMT-YVYU">V4L2_PIX_FMT_YVYU</link>    v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
424#define <link linkend="V4L2-PIX-FMT-UYVY">V4L2_PIX_FMT_UYVY</link>    v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16  YUV 4:2:2     */
425#define <link linkend="V4L2-PIX-FMT-VYUY">V4L2_PIX_FMT_VYUY</link>    v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16  YUV 4:2:2     */
426#define <link linkend="V4L2-PIX-FMT-YUV422P">V4L2_PIX_FMT_YUV422P</link> v4l2_fourcc('4', '2', '2', 'P') /* 16  YVU422 planar */
427#define <link linkend="V4L2-PIX-FMT-YUV411P">V4L2_PIX_FMT_YUV411P</link> v4l2_fourcc('4', '1', '1', 'P') /* 16  YVU411 planar */
428#define <link linkend="V4L2-PIX-FMT-Y41P">V4L2_PIX_FMT_Y41P</link>    v4l2_fourcc('Y', '4', '1', 'P') /* 12  YUV 4:1:1     */
429#define <link linkend="V4L2-PIX-FMT-YUV444">V4L2_PIX_FMT_YUV444</link>  v4l2_fourcc('Y', '4', '4', '4') /* 16  xxxxyyyy uuuuvvvv */
430#define <link linkend="V4L2-PIX-FMT-YUV555">V4L2_PIX_FMT_YUV555</link>  v4l2_fourcc('Y', 'U', 'V', 'O') /* 16  YUV-5-5-5     */
431#define <link linkend="V4L2-PIX-FMT-YUV565">V4L2_PIX_FMT_YUV565</link>  v4l2_fourcc('Y', 'U', 'V', 'P') /* 16  YUV-5-6-5     */
432#define <link linkend="V4L2-PIX-FMT-YUV32">V4L2_PIX_FMT_YUV32</link>   v4l2_fourcc('Y', 'U', 'V', '4') /* 32  YUV-8-8-8-8   */
433#define <link linkend="V4L2-PIX-FMT-YUV410">V4L2_PIX_FMT_YUV410</link>  v4l2_fourcc('Y', 'U', 'V', '9') /*  9  YUV 4:1:0     */
434#define <link linkend="V4L2-PIX-FMT-YUV420">V4L2_PIX_FMT_YUV420</link>  v4l2_fourcc('Y', 'U', '1', '2') /* 12  YUV 4:2:0     */
435#define <link linkend="V4L2-PIX-FMT-HI240">V4L2_PIX_FMT_HI240</link>   v4l2_fourcc('H', 'I', '2', '4') /*  8  8-bit color   */
436#define <link linkend="V4L2-PIX-FMT-HM12">V4L2_PIX_FMT_HM12</link>    v4l2_fourcc('H', 'M', '1', '2') /*  8  YUV 4:2:0 16x16 macroblocks */
437#define <link linkend="V4L2-PIX-FMT-M420">V4L2_PIX_FMT_M420</link>    v4l2_fourcc('M', '4', '2', '0') /* 12  YUV 4:2:0 2 lines y, 1 line uv interleaved */
438
439/* two planes -- one Y, one Cr + Cb interleaved  */
440#define <link linkend="V4L2-PIX-FMT-NV12">V4L2_PIX_FMT_NV12</link>    v4l2_fourcc('N', 'V', '1', '2') /* 12  Y/CbCr 4:2:0  */
441#define <link linkend="V4L2-PIX-FMT-NV21">V4L2_PIX_FMT_NV21</link>    v4l2_fourcc('N', 'V', '2', '1') /* 12  Y/CrCb 4:2:0  */
442#define <link linkend="V4L2-PIX-FMT-NV16">V4L2_PIX_FMT_NV16</link>    v4l2_fourcc('N', 'V', '1', '6') /* 16  Y/CbCr 4:2:2  */
443#define <link linkend="V4L2-PIX-FMT-NV61">V4L2_PIX_FMT_NV61</link>    v4l2_fourcc('N', 'V', '6', '1') /* 16  Y/CrCb 4:2:2  */
444#define <link linkend="V4L2-PIX-FMT-NV24">V4L2_PIX_FMT_NV24</link>    v4l2_fourcc('N', 'V', '2', '4') /* 24  Y/CbCr 4:4:4  */
445#define <link linkend="V4L2-PIX-FMT-NV42">V4L2_PIX_FMT_NV42</link>    v4l2_fourcc('N', 'V', '4', '2') /* 24  Y/CrCb 4:4:4  */
446
447/* two non contiguous planes - one Y, one Cr + Cb interleaved  */
448#define <link linkend="V4L2-PIX-FMT-NV12M">V4L2_PIX_FMT_NV12M</link>   v4l2_fourcc('N', 'M', '1', '2') /* 12  Y/CbCr 4:2:0  */
449#define <link linkend="V4L2-PIX-FMT-NV21M">V4L2_PIX_FMT_NV21M</link>   v4l2_fourcc('N', 'M', '2', '1') /* 21  Y/CrCb 4:2:0  */
450#define <link linkend="V4L2-PIX-FMT-NV16M">V4L2_PIX_FMT_NV16M</link>   v4l2_fourcc('N', 'M', '1', '6') /* 16  Y/CbCr 4:2:2  */
451#define <link linkend="V4L2-PIX-FMT-NV61M">V4L2_PIX_FMT_NV61M</link>   v4l2_fourcc('N', 'M', '6', '1') /* 16  Y/CrCb 4:2:2  */
452#define <link linkend="V4L2-PIX-FMT-NV12MT">V4L2_PIX_FMT_NV12MT</link>  v4l2_fourcc('T', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 64x32 macroblocks */
453#define <link linkend="V4L2-PIX-FMT-NV12MT-16X16">V4L2_PIX_FMT_NV12MT_16X16</link> v4l2_fourcc('V', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 16x16 macroblocks */
454
455/* three non contiguous planes - Y, Cb, Cr */
456#define <link linkend="V4L2-PIX-FMT-YUV420M">V4L2_PIX_FMT_YUV420M</link> v4l2_fourcc('Y', 'M', '1', '2') /* 12  YUV420 planar */
457#define <link linkend="V4L2-PIX-FMT-YVU420M">V4L2_PIX_FMT_YVU420M</link> v4l2_fourcc('Y', 'M', '2', '1') /* 12  YVU420 planar */
458
459/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
460#define <link linkend="V4L2-PIX-FMT-SBGGR8">V4L2_PIX_FMT_SBGGR8</link>  v4l2_fourcc('B', 'A', '8', '1') /*  8  BGBG.. GRGR.. */
461#define <link linkend="V4L2-PIX-FMT-SGBRG8">V4L2_PIX_FMT_SGBRG8</link>  v4l2_fourcc('G', 'B', 'R', 'G') /*  8  GBGB.. RGRG.. */
462#define <link linkend="V4L2-PIX-FMT-SGRBG8">V4L2_PIX_FMT_SGRBG8</link>  v4l2_fourcc('G', 'R', 'B', 'G') /*  8  GRGR.. BGBG.. */
463#define <link linkend="V4L2-PIX-FMT-SRGGB8">V4L2_PIX_FMT_SRGGB8</link>  v4l2_fourcc('R', 'G', 'G', 'B') /*  8  RGRG.. GBGB.. */
464#define <link linkend="V4L2-PIX-FMT-SBGGR10">V4L2_PIX_FMT_SBGGR10</link> v4l2_fourcc('B', 'G', '1', '0') /* 10  BGBG.. GRGR.. */
465#define <link linkend="V4L2-PIX-FMT-SGBRG10">V4L2_PIX_FMT_SGBRG10</link> v4l2_fourcc('G', 'B', '1', '0') /* 10  GBGB.. RGRG.. */
466#define <link linkend="V4L2-PIX-FMT-SGRBG10">V4L2_PIX_FMT_SGRBG10</link> v4l2_fourcc('B', 'A', '1', '0') /* 10  GRGR.. BGBG.. */
467#define <link linkend="V4L2-PIX-FMT-SRGGB10">V4L2_PIX_FMT_SRGGB10</link> v4l2_fourcc('R', 'G', '1', '0') /* 10  RGRG.. GBGB.. */
468        /* 10bit raw bayer packed, 5 bytes for every 4 pixels */
469#define <link linkend="V4L2-PIX-FMT-SBGGR10P">V4L2_PIX_FMT_SBGGR10P</link> v4l2_fourcc('p', 'B', 'A', 'A')
470#define <link linkend="V4L2-PIX-FMT-SGBRG10P">V4L2_PIX_FMT_SGBRG10P</link> v4l2_fourcc('p', 'G', 'A', 'A')
471#define <link linkend="V4L2-PIX-FMT-SGRBG10P">V4L2_PIX_FMT_SGRBG10P</link> v4l2_fourcc('p', 'g', 'A', 'A')
472#define <link linkend="V4L2-PIX-FMT-SRGGB10P">V4L2_PIX_FMT_SRGGB10P</link> v4l2_fourcc('p', 'R', 'A', 'A')
473        /* 10bit raw bayer a-law compressed to 8 bits */
474#define <link linkend="V4L2-PIX-FMT-SBGGR10ALAW8">V4L2_PIX_FMT_SBGGR10ALAW8</link> v4l2_fourcc('a', 'B', 'A', '8')
475#define <link linkend="V4L2-PIX-FMT-SGBRG10ALAW8">V4L2_PIX_FMT_SGBRG10ALAW8</link> v4l2_fourcc('a', 'G', 'A', '8')
476#define <link linkend="V4L2-PIX-FMT-SGRBG10ALAW8">V4L2_PIX_FMT_SGRBG10ALAW8</link> v4l2_fourcc('a', 'g', 'A', '8')
477#define <link linkend="V4L2-PIX-FMT-SRGGB10ALAW8">V4L2_PIX_FMT_SRGGB10ALAW8</link> v4l2_fourcc('a', 'R', 'A', '8')
478        /* 10bit raw bayer DPCM compressed to 8 bits */
479#define <link linkend="V4L2-PIX-FMT-SBGGR10DPCM8">V4L2_PIX_FMT_SBGGR10DPCM8</link> v4l2_fourcc('b', 'B', 'A', '8')
480#define <link linkend="V4L2-PIX-FMT-SGBRG10DPCM8">V4L2_PIX_FMT_SGBRG10DPCM8</link> v4l2_fourcc('b', 'G', 'A', '8')
481#define <link linkend="V4L2-PIX-FMT-SGRBG10DPCM8">V4L2_PIX_FMT_SGRBG10DPCM8</link> v4l2_fourcc('B', 'D', '1', '0')
482#define <link linkend="V4L2-PIX-FMT-SRGGB10DPCM8">V4L2_PIX_FMT_SRGGB10DPCM8</link> v4l2_fourcc('b', 'R', 'A', '8')
483#define <link linkend="V4L2-PIX-FMT-SBGGR12">V4L2_PIX_FMT_SBGGR12</link> v4l2_fourcc('B', 'G', '1', '2') /* 12  BGBG.. GRGR.. */
484#define <link linkend="V4L2-PIX-FMT-SGBRG12">V4L2_PIX_FMT_SGBRG12</link> v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
485#define <link linkend="V4L2-PIX-FMT-SGRBG12">V4L2_PIX_FMT_SGRBG12</link> v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
486#define <link linkend="V4L2-PIX-FMT-SRGGB12">V4L2_PIX_FMT_SRGGB12</link> v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
487#define <link linkend="V4L2-PIX-FMT-SBGGR16">V4L2_PIX_FMT_SBGGR16</link> v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
488
489/* compressed formats */
490#define <link linkend="V4L2-PIX-FMT-MJPEG">V4L2_PIX_FMT_MJPEG</link>    v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   */
491#define <link linkend="V4L2-PIX-FMT-JPEG">V4L2_PIX_FMT_JPEG</link>     v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG     */
492#define <link linkend="V4L2-PIX-FMT-DV">V4L2_PIX_FMT_DV</link>       v4l2_fourcc('d', 'v', 's', 'd') /* 1394          */
493#define <link linkend="V4L2-PIX-FMT-MPEG">V4L2_PIX_FMT_MPEG</link>     v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
494#define <link linkend="V4L2-PIX-FMT-H264">V4L2_PIX_FMT_H264</link>     v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
495#define <link linkend="V4L2-PIX-FMT-H264-NO-SC">V4L2_PIX_FMT_H264_NO_SC</link> v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
496#define <link linkend="V4L2-PIX-FMT-H264-MVC">V4L2_PIX_FMT_H264_MVC</link> v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
497#define <link linkend="V4L2-PIX-FMT-H263">V4L2_PIX_FMT_H263</link>     v4l2_fourcc('H', '2', '6', '3') /* H263          */
498#define <link linkend="V4L2-PIX-FMT-MPEG1">V4L2_PIX_FMT_MPEG1</link>    v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES     */
499#define <link linkend="V4L2-PIX-FMT-MPEG2">V4L2_PIX_FMT_MPEG2</link>    v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES     */
500#define <link linkend="V4L2-PIX-FMT-MPEG4">V4L2_PIX_FMT_MPEG4</link>    v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */
501#define <link linkend="V4L2-PIX-FMT-XVID">V4L2_PIX_FMT_XVID</link>     v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid           */
502#define <link linkend="V4L2-PIX-FMT-VC1-ANNEX-G">V4L2_PIX_FMT_VC1_ANNEX_G</link> v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
503#define <link linkend="V4L2-PIX-FMT-VC1-ANNEX-L">V4L2_PIX_FMT_VC1_ANNEX_L</link> v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
504#define <link linkend="V4L2-PIX-FMT-VP8">V4L2_PIX_FMT_VP8</link>      v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
505
506/*  Vendor-specific formats   */
507#define <link linkend="V4L2-PIX-FMT-CPIA1">V4L2_PIX_FMT_CPIA1</link>    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
508#define <link linkend="V4L2-PIX-FMT-WNVA">V4L2_PIX_FMT_WNVA</link>     v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
509#define <link linkend="V4L2-PIX-FMT-SN9C10X">V4L2_PIX_FMT_SN9C10X</link>  v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
510#define <link linkend="V4L2-PIX-FMT-SN9C20X-I420">V4L2_PIX_FMT_SN9C20X_I420</link> v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
511#define <link linkend="V4L2-PIX-FMT-PWC1">V4L2_PIX_FMT_PWC1</link>     v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
512#define <link linkend="V4L2-PIX-FMT-PWC2">V4L2_PIX_FMT_PWC2</link>     v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
513#define <link linkend="V4L2-PIX-FMT-ET61X251">V4L2_PIX_FMT_ET61X251</link> v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
514#define <link linkend="V4L2-PIX-FMT-SPCA501">V4L2_PIX_FMT_SPCA501</link>  v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
515#define <link linkend="V4L2-PIX-FMT-SPCA505">V4L2_PIX_FMT_SPCA505</link>  v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
516#define <link linkend="V4L2-PIX-FMT-SPCA508">V4L2_PIX_FMT_SPCA508</link>  v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
517#define <link linkend="V4L2-PIX-FMT-SPCA561">V4L2_PIX_FMT_SPCA561</link>  v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
518#define <link linkend="V4L2-PIX-FMT-PAC207">V4L2_PIX_FMT_PAC207</link>   v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
519#define <link linkend="V4L2-PIX-FMT-MR97310A">V4L2_PIX_FMT_MR97310A</link> v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
520#define <link linkend="V4L2-PIX-FMT-JL2005BCD">V4L2_PIX_FMT_JL2005BCD</link> v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
521#define <link linkend="V4L2-PIX-FMT-SN9C2028">V4L2_PIX_FMT_SN9C2028</link> v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
522#define <link linkend="V4L2-PIX-FMT-SQ905C">V4L2_PIX_FMT_SQ905C</link>   v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
523#define <link linkend="V4L2-PIX-FMT-PJPG">V4L2_PIX_FMT_PJPG</link>     v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
524#define <link linkend="V4L2-PIX-FMT-OV511">V4L2_PIX_FMT_OV511</link>    v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
525#define <link linkend="V4L2-PIX-FMT-OV518">V4L2_PIX_FMT_OV518</link>    v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
526#define <link linkend="V4L2-PIX-FMT-STV0680">V4L2_PIX_FMT_STV0680</link>  v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
527#define <link linkend="V4L2-PIX-FMT-TM6000">V4L2_PIX_FMT_TM6000</link>   v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
528#define <link linkend="V4L2-PIX-FMT-CIT-YYVYUY">V4L2_PIX_FMT_CIT_YYVYUY</link> v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
529#define <link linkend="V4L2-PIX-FMT-KONICA420">V4L2_PIX_FMT_KONICA420</link>  v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
530#define <link linkend="V4L2-PIX-FMT-JPGL">V4L2_PIX_FMT_JPGL</link>       v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
531#define <link linkend="V4L2-PIX-FMT-SE401">V4L2_PIX_FMT_SE401</link>      v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
532#define <link linkend="V4L2-PIX-FMT-S5C-UYVY-JPG">V4L2_PIX_FMT_S5C_UYVY_JPG</link> v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
533
534/* SDR formats - used only for Software Defined Radio devices */
535#define V4L2_SDR_FMT_CU8          v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
536#define V4L2_SDR_FMT_CU16LE       v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
537#define V4L2_SDR_FMT_CS8          v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */
538#define V4L2_SDR_FMT_CS14LE       v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */
539#define V4L2_SDR_FMT_RU12LE       v4l2_fourcc('R', 'U', '1', '2') /* real u12le */
540
541/* priv field value to indicates that subsequent fields are valid. */
542#define V4L2_PIX_FMT_PRIV_MAGIC         0xfeedcafe
543
544/* Flags */
545#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA  0x00000001
546
547/*
548 *      F O R M A T   E N U M E R A T I O N
549 */
550struct <link linkend="v4l2-fmtdesc">v4l2_fmtdesc</link> {
551        __u32               index;             /* Format number      */
552        __u32               type;              /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
553        __u32               flags;
554        __u8                description[32];   /* Description string */
555        __u32               pixelformat;       /* Format fourcc      */
556        __u32               reserved[4];
557};
558
559#define V4L2_FMT_FLAG_COMPRESSED 0x0001
560#define V4L2_FMT_FLAG_EMULATED   0x0002
561
562#if 1
563        /* Experimental Frame Size and frame rate enumeration */
564/*
565 *      F R A M E   S I Z E   E N U M E R A T I O N
566 */
567enum <link linkend="v4l2-frmsizetypes">v4l2_frmsizetypes</link> {
568        V4L2_FRMSIZE_TYPE_DISCRETE      = 1,
569        V4L2_FRMSIZE_TYPE_CONTINUOUS    = 2,
570        V4L2_FRMSIZE_TYPE_STEPWISE      = 3,
571};
572
573struct <link linkend="v4l2-frmsize-discrete">v4l2_frmsize_discrete</link> {
574        __u32                   width;          /* Frame width [pixel] */
575        __u32                   height;         /* Frame height [pixel] */
576};
577
578struct <link linkend="v4l2-frmsize-stepwise">v4l2_frmsize_stepwise</link> {
579        __u32                   min_width;      /* Minimum frame width [pixel] */
580        __u32                   max_width;      /* Maximum frame width [pixel] */
581        __u32                   step_width;     /* Frame width step size [pixel] */
582        __u32                   min_height;     /* Minimum frame height [pixel] */
583        __u32                   max_height;     /* Maximum frame height [pixel] */
584        __u32                   step_height;    /* Frame height step size [pixel] */
585};
586
587struct <link linkend="v4l2-frmsizeenum">v4l2_frmsizeenum</link> {
588        __u32                   index;          /* Frame size number */
589        __u32                   pixel_format;   /* Pixel format */
590        __u32                   type;           /* Frame size type the device supports. */
591
592        union {                                 /* Frame size */
593                struct <link linkend="v4l2-frmsize-discrete">v4l2_frmsize_discrete</link>    discrete;
594                struct <link linkend="v4l2-frmsize-stepwise">v4l2_frmsize_stepwise</link>    stepwise;
595        };
596
597        __u32   reserved[2];                    /* Reserved space for future use */
598};
599
600/*
601 *      F R A M E   R A T E   E N U M E R A T I O N
602 */
603enum <link linkend="v4l2-frmivaltypes">v4l2_frmivaltypes</link> {
604        V4L2_FRMIVAL_TYPE_DISCRETE      = 1,
605        V4L2_FRMIVAL_TYPE_CONTINUOUS    = 2,
606        V4L2_FRMIVAL_TYPE_STEPWISE      = 3,
607};
608
609struct <link linkend="v4l2-frmival-stepwise">v4l2_frmival_stepwise</link> {
610        struct <link linkend="v4l2-fract">v4l2_fract</link>       min;            /* Minimum frame interval [s] */
611        struct <link linkend="v4l2-fract">v4l2_fract</link>       max;            /* Maximum frame interval [s] */
612        struct <link linkend="v4l2-fract">v4l2_fract</link>       step;           /* Frame interval step size [s] */
613};
614
615struct <link linkend="v4l2-frmivalenum">v4l2_frmivalenum</link> {
616        __u32                   index;          /* Frame format index */
617        __u32                   pixel_format;   /* Pixel format */
618        __u32                   width;          /* Frame width */
619        __u32                   height;         /* Frame height */
620        __u32                   type;           /* Frame interval type the device supports. */
621
622        union {                                 /* Frame interval */
623                struct <link linkend="v4l2-fract">v4l2_fract</link>               discrete;
624                struct <link linkend="v4l2-frmival-stepwise">v4l2_frmival_stepwise</link>    stepwise;
625        };
626
627        __u32   reserved[2];                    /* Reserved space for future use */
628};
629#endif
630
631/*
632 *      T I M E C O D E
633 */
634struct <link linkend="v4l2-timecode">v4l2_timecode</link> {
635        __u32   type;
636        __u32   flags;
637        __u8    frames;
638        __u8    seconds;
639        __u8    minutes;
640        __u8    hours;
641        __u8    userbits[4];
642};
643
644/*  Type  */
645#define V4L2_TC_TYPE_24FPS              1
646#define V4L2_TC_TYPE_25FPS              2
647#define V4L2_TC_TYPE_30FPS              3
648#define V4L2_TC_TYPE_50FPS              4
649#define V4L2_TC_TYPE_60FPS              5
650
651/*  Flags  */
652#define V4L2_TC_FLAG_DROPFRAME          0x0001 /* "drop-frame" mode */
653#define V4L2_TC_FLAG_COLORFRAME         0x0002
654#define V4L2_TC_USERBITS_field          0x000C
655#define V4L2_TC_USERBITS_USERDEFINED    0x0000
656#define V4L2_TC_USERBITS_8BITCHARS      0x0008
657/* The above is based on SMPTE timecodes */
658
659struct <link linkend="v4l2-jpegcompression">v4l2_jpegcompression</link> {
660        int quality;
661
662        int  APPn;              /* Number of APP segment to be written,
663                                 * must be 0..15 */
664        int  APP_len;           /* Length of data in JPEG APPn segment */
665        char APP_data[60];      /* Data in the JPEG APPn segment. */
666
667        int  COM_len;           /* Length of data in JPEG COM segment */
668        char COM_data[60];      /* Data in JPEG COM segment */
669
670        __u32 jpeg_markers;     /* Which markers should go into the JPEG
671                                 * output. Unless you exactly know what
672                                 * you do, leave them untouched.
673                                 * Including less markers will make the
674                                 * resulting code smaller, but there will
675                                 * be fewer applications which can read it.
676                                 * The presence of the APP and COM marker
677                                 * is influenced by APP_len and COM_len
678                                 * ONLY, not by this property! */
679
680#define V4L2_JPEG_MARKER_DHT (1&lt;&lt;3)    /* Define Huffman Tables */
681#define V4L2_JPEG_MARKER_DQT (1&lt;&lt;4)    /* Define Quantization Tables */
682#define V4L2_JPEG_MARKER_DRI (1&lt;&lt;5)    /* Define Restart Interval */
683#define V4L2_JPEG_MARKER_COM (1&lt;&lt;6)    /* Comment segment */
684#define V4L2_JPEG_MARKER_APP (1&lt;&lt;7)    /* App segment, driver will
685                                        * always use APP0 */
686};
687
688/*
689 *      M E M O R Y - M A P P I N G   B U F F E R S
690 */
691struct <link linkend="v4l2-requestbuffers">v4l2_requestbuffers</link> {
692        __u32                   count;
693        __u32                   type;           /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
694        __u32                   memory;         /* enum <link linkend="v4l2-memory">v4l2_memory</link> */
695        __u32                   reserved[2];
696};
697
698/**
699 * struct <link linkend="v4l2-plane">v4l2_plane</link> - plane info for multi-planar buffers
700 * @bytesused:          number of bytes occupied by data in the plane (payload)
701 * @length:             size of this plane (NOT the payload) in bytes
702 * @mem_offset:         when memory in the associated struct <link linkend="v4l2-buffer">v4l2_buffer</link> is
703 *                      V4L2_MEMORY_MMAP, equals the offset from the start of
704 *                      the device memory for this plane (or is a "cookie" that
705 *                      should be passed to mmap() called on the video node)
706 * @userptr:            when memory is V4L2_MEMORY_USERPTR, a userspace pointer
707 *                      pointing to this plane
708 * @fd:                 when memory is V4L2_MEMORY_DMABUF, a userspace file
709 *                      descriptor associated with this plane
710 * @data_offset:        offset in the plane to the start of data; usually 0,
711 *                      unless there is a header in front of the data
712 *
713 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
714 * with two planes can have one plane for Y, and another for interleaved CbCr
715 * components. Each plane can reside in a separate memory buffer, or even in
716 * a completely separate memory node (e.g. in embedded devices).
717 */
718struct <link linkend="v4l2-plane">v4l2_plane</link> {
719        __u32                   bytesused;
720        __u32                   length;
721        union {
722                __u32           mem_offset;
723                unsigned long   userptr;
724                __s32           fd;
725        } m;
726        __u32                   data_offset;
727        __u32                   reserved[11];
728};
729
730/**
731 * struct <link linkend="v4l2-buffer">v4l2_buffer</link> - video buffer info
732 * @index:      id number of the buffer
733 * @type:       enum <link linkend="v4l2-buf-type">v4l2_buf_type</link>; buffer type (type == *_MPLANE for
734 *              multiplanar buffers);
735 * @bytesused:  number of bytes occupied by data in the buffer (payload);
736 *              unused (set to 0) for multiplanar buffers
737 * @flags:      buffer informational flags
738 * @field:      enum <link linkend="v4l2-field">v4l2_field</link>; field order of the image in the buffer
739 * @timestamp:  frame timestamp
740 * @timecode:   frame timecode
741 * @sequence:   sequence count of this frame
742 * @memory:     enum <link linkend="v4l2-memory">v4l2_memory</link>; the method, in which the actual video data is
743 *              passed
744 * @offset:     for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
745 *              offset from the start of the device memory for this plane,
746 *              (or a "cookie" that should be passed to mmap() as offset)
747 * @userptr:    for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
748 *              a userspace pointer pointing to this buffer
749 * @fd:         for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF;
750 *              a userspace file descriptor associated with this buffer
751 * @planes:     for multiplanar buffers; userspace pointer to the array of plane
752 *              info structs for this buffer
753 * @length:     size in bytes of the buffer (NOT its payload) for single-plane
754 *              buffers (when type != *_MPLANE); number of elements in the
755 *              planes array for multi-plane buffers
756 *
757 * Contains data exchanged by application and driver using one of the Streaming
758 * I/O methods.
759 */
760struct <link linkend="v4l2-buffer">v4l2_buffer</link> {
761        __u32                   index;
762        __u32                   type;
763        __u32                   bytesused;
764        __u32                   flags;
765        __u32                   field;
766        struct timeval          timestamp;
767        struct <link linkend="v4l2-timecode">v4l2_timecode</link>    timecode;
768        __u32                   sequence;
769
770        /* memory location */
771        __u32                   memory;
772        union {
773                __u32           offset;
774                unsigned long   userptr;
775                struct <link linkend="v4l2-plane">v4l2_plane</link> *planes;
776                __s32           fd;
777        } m;
778        __u32                   length;
779        __u32                   reserved2;
780        __u32                   reserved;
781};
782
783/*  Flags for 'flags' field */
784/* Buffer is mapped (flag) */
785#define V4L2_BUF_FLAG_MAPPED                    0x00000001
786/* Buffer is queued for processing */
787#define V4L2_BUF_FLAG_QUEUED                    0x00000002
788/* Buffer is ready */
789#define V4L2_BUF_FLAG_DONE                      0x00000004
790/* Image is a keyframe (I-frame) */
791#define V4L2_BUF_FLAG_KEYFRAME                  0x00000008
792/* Image is a P-frame */
793#define V4L2_BUF_FLAG_PFRAME                    0x00000010
794/* Image is a B-frame */
795#define V4L2_BUF_FLAG_BFRAME                    0x00000020
796/* Buffer is ready, but the data contained within is corrupted. */
797#define V4L2_BUF_FLAG_ERROR                     0x00000040
798/* timecode field is valid */
799#define V4L2_BUF_FLAG_TIMECODE                  0x00000100
800/* Buffer is prepared for queuing */
801#define V4L2_BUF_FLAG_PREPARED                  0x00000400
802/* Cache handling flags */
803#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE       0x00000800
804#define V4L2_BUF_FLAG_NO_CACHE_CLEAN            0x00001000
805/* Timestamp type */
806#define V4L2_BUF_FLAG_TIMESTAMP_MASK            0x0000e000
807#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN         0x00000000
808#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC       0x00002000
809#define V4L2_BUF_FLAG_TIMESTAMP_COPY            0x00004000
810/* Timestamp sources. */
811#define V4L2_BUF_FLAG_TSTAMP_SRC_MASK           0x00070000
812#define V4L2_BUF_FLAG_TSTAMP_SRC_EOF            0x00000000
813#define V4L2_BUF_FLAG_TSTAMP_SRC_SOE            0x00010000
814
815/**
816 * struct <link linkend="v4l2-exportbuffer">v4l2_exportbuffer</link> - export of video buffer as DMABUF file descriptor
817 *
818 * @index:      id number of the buffer
819 * @type:       enum <link linkend="v4l2-buf-type">v4l2_buf_type</link>; buffer type (type == *_MPLANE for
820 *              multiplanar buffers);
821 * @plane:      index of the plane to be exported, 0 for single plane queues
822 * @flags:      flags for newly created file, currently only O_CLOEXEC is
823 *              supported, refer to manual of open syscall for more details
824 * @fd:         file descriptor associated with DMABUF (set by driver)
825 *
826 * Contains data used for exporting a video buffer as DMABUF file descriptor.
827 * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF
828 * (identical to the cookie used to mmap() the buffer to userspace). All
829 * reserved fields must be set to zero. The field reserved0 is expected to
830 * become a structure 'type' allowing an alternative layout of the structure
831 * content. Therefore this field should not be used for any other extensions.
832 */
833struct <link linkend="v4l2-exportbuffer">v4l2_exportbuffer</link> {
834        __u32           type; /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
835        __u32           index;
836        __u32           plane;
837        __u32           flags;
838        __s32           fd;
839        __u32           reserved[11];
840};
841
842/*
843 *      O V E R L A Y   P R E V I E W
844 */
845struct <link linkend="v4l2-framebuffer">v4l2_framebuffer</link> {
846        __u32                   capability;
847        __u32                   flags;
848/* FIXME: in theory we should pass something like PCI device + memory
849 * region + offset instead of some physical address */
850        void                    *base;
851        struct {
852                __u32           width;
853                __u32           height;
854                __u32           pixelformat;
855                __u32           field;          /* enum <link linkend="v4l2-field">v4l2_field</link> */
856                __u32           bytesperline;   /* for padding, zero if unused */
857                __u32           sizeimage;
858                __u32           colorspace;     /* enum <link linkend="v4l2-colorspace">v4l2_colorspace</link> */
859                __u32           priv;           /* reserved field, set to 0 */
860        } fmt;
861};
862/*  Flags for the 'capability' field. Read only */
863#define V4L2_FBUF_CAP_EXTERNOVERLAY     0x0001
864#define V4L2_FBUF_CAP_CHROMAKEY         0x0002
865#define V4L2_FBUF_CAP_LIST_CLIPPING     0x0004
866#define V4L2_FBUF_CAP_BITMAP_CLIPPING   0x0008
867#define V4L2_FBUF_CAP_LOCAL_ALPHA       0x0010
868#define V4L2_FBUF_CAP_GLOBAL_ALPHA      0x0020
869#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA   0x0040
870#define V4L2_FBUF_CAP_SRC_CHROMAKEY     0x0080
871/*  Flags for the 'flags' field. */
872#define V4L2_FBUF_FLAG_PRIMARY          0x0001
873#define V4L2_FBUF_FLAG_OVERLAY          0x0002
874#define V4L2_FBUF_FLAG_CHROMAKEY        0x0004
875#define V4L2_FBUF_FLAG_LOCAL_ALPHA      0x0008
876#define V4L2_FBUF_FLAG_GLOBAL_ALPHA     0x0010
877#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA  0x0020
878#define V4L2_FBUF_FLAG_SRC_CHROMAKEY    0x0040
879
880struct <link linkend="v4l2-clip">v4l2_clip</link> {
881        struct <link linkend="v4l2-rect">v4l2_rect</link>        c;
882        struct <link linkend="v4l2-clip">v4l2_clip</link>        __user *next;
883};
884
885struct <link linkend="v4l2-window">v4l2_window</link> {
886        struct <link linkend="v4l2-rect">v4l2_rect</link>        w;
887        __u32                   field;   /* enum <link linkend="v4l2-field">v4l2_field</link> */
888        __u32                   chromakey;
889        struct <link linkend="v4l2-clip">v4l2_clip</link>        __user *clips;
890        __u32                   clipcount;
891        void                    __user *bitmap;
892        __u8                    global_alpha;
893};
894
895/*
896 *      C A P T U R E   P A R A M E T E R S
897 */
898struct <link linkend="v4l2-captureparm">v4l2_captureparm</link> {
899        __u32              capability;    /*  Supported modes */
900        __u32              capturemode;   /*  Current mode */
901        struct <link linkend="v4l2-fract">v4l2_fract</link>  timeperframe;  /*  Time per frame in seconds */
902        __u32              extendedmode;  /*  Driver-specific extensions */
903        __u32              readbuffers;   /*  # of buffers for read */
904        __u32              reserved[4];
905};
906
907/*  Flags for 'capability' and 'capturemode' fields */
908#define V4L2_MODE_HIGHQUALITY   0x0001  /*  High quality imaging mode */
909#define V4L2_CAP_TIMEPERFRAME   0x1000  /*  timeperframe field is supported */
910
911struct <link linkend="v4l2-outputparm">v4l2_outputparm</link> {
912        __u32              capability;   /*  Supported modes */
913        __u32              outputmode;   /*  Current mode */
914        struct <link linkend="v4l2-fract">v4l2_fract</link>  timeperframe; /*  Time per frame in seconds */
915        __u32              extendedmode; /*  Driver-specific extensions */
916        __u32              writebuffers; /*  # of buffers for write */
917        __u32              reserved[4];
918};
919
920/*
921 *      I N P U T   I M A G E   C R O P P I N G
922 */
923struct <link linkend="v4l2-cropcap">v4l2_cropcap</link> {
924        __u32                   type;   /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
925        struct <link linkend="v4l2-rect">v4l2_rect</link>        bounds;
926        struct <link linkend="v4l2-rect">v4l2_rect</link>        defrect;
927        struct <link linkend="v4l2-fract">v4l2_fract</link>       pixelaspect;
928};
929
930struct <link linkend="v4l2-crop">v4l2_crop</link> {
931        __u32                   type;   /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
932        struct <link linkend="v4l2-rect">v4l2_rect</link>        c;
933};
934
935/**
936 * struct <link linkend="v4l2-selection">v4l2_selection</link> - selection info
937 * @type:       buffer type (do not use *_MPLANE types)
938 * @target:     Selection target, used to choose one of possible rectangles;
939 *              defined in v4l2-common.h; V4L2_SEL_TGT_* .
940 * @flags:      constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
941 * @r:          coordinates of selection window
942 * @reserved:   for future use, rounds structure size to 64 bytes, set to zero
943 *
944 * Hardware may use multiple helper windows to process a video stream.
945 * The structure is used to exchange this selection areas between
946 * an application and a driver.
947 */
948struct <link linkend="v4l2-selection">v4l2_selection</link> {
949        __u32                   type;
950        __u32                   target;
951        __u32                   flags;
952        struct <link linkend="v4l2-rect">v4l2_rect</link>        r;
953        __u32                   reserved[9];
954};
955
956
957/*
958 *      A N A L O G   V I D E O   S T A N D A R D
959 */
960
961typedef __u64 v4l2_std_id;
962
963/* one bit for each */
964#define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
965#define V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
966#define V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
967#define V4L2_STD_PAL_H          ((v4l2_std_id)0x00000008)
968#define V4L2_STD_PAL_I          ((v4l2_std_id)0x00000010)
969#define V4L2_STD_PAL_D          ((v4l2_std_id)0x00000020)
970#define V4L2_STD_PAL_D1         ((v4l2_std_id)0x00000040)
971#define V4L2_STD_PAL_K          ((v4l2_std_id)0x00000080)
972
973#define V4L2_STD_PAL_M          ((v4l2_std_id)0x00000100)
974#define V4L2_STD_PAL_N          ((v4l2_std_id)0x00000200)
975#define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
976#define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
977
978#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)       /* BTSC */
979#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)       /* EIA-J */
980#define V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
981#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)       /* FM A2 */
982
983#define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
984#define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
985#define V4L2_STD_SECAM_G        ((v4l2_std_id)0x00040000)
986#define V4L2_STD_SECAM_H        ((v4l2_std_id)0x00080000)
987#define V4L2_STD_SECAM_K        ((v4l2_std_id)0x00100000)
988#define V4L2_STD_SECAM_K1       ((v4l2_std_id)0x00200000)
989#define V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
990#define V4L2_STD_SECAM_LC       ((v4l2_std_id)0x00800000)
991
992/* ATSC/HDTV */
993#define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
994#define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
995
996/* FIXME:
997   Although std_id is 64 bits, there is an issue on PPC32 architecture that
998   makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
999   this value to 32 bits.
1000   As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
1001   it should work fine. However, if needed to add more than two standards,
1002   v4l2-common.c should be fixed.
1003 */
1004
1005/*
1006 * Some macros to merge video standards in order to make live easier for the
1007 * drivers and V4L2 applications
1008 */
1009
1010/*
1011 * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
1012 * Missing here.
1013 */
1014#define V4L2_STD_NTSC           (V4L2_STD_NTSC_M        |\
1015                                 V4L2_STD_NTSC_M_JP     |\
1016                                 V4L2_STD_NTSC_M_KR)
1017/* Secam macros */
1018#define V4L2_STD_SECAM_DK       (V4L2_STD_SECAM_D       |\
1019                                 V4L2_STD_SECAM_K       |\
1020                                 V4L2_STD_SECAM_K1)
1021/* All Secam Standards */
1022#define V4L2_STD_SECAM          (V4L2_STD_SECAM_B       |\
1023                                 V4L2_STD_SECAM_G       |\
1024                                 V4L2_STD_SECAM_H       |\
1025                                 V4L2_STD_SECAM_DK      |\
1026                                 V4L2_STD_SECAM_L       |\
1027                                 V4L2_STD_SECAM_LC)
1028/* PAL macros */
1029#define V4L2_STD_PAL_BG         (V4L2_STD_PAL_B         |\
1030                                 V4L2_STD_PAL_B1        |\
1031                                 V4L2_STD_PAL_G)
1032#define V4L2_STD_PAL_DK         (V4L2_STD_PAL_D         |\
1033                                 V4L2_STD_PAL_D1        |\
1034                                 V4L2_STD_PAL_K)
1035/*
1036 * "Common" PAL - This macro is there to be compatible with the old
1037 * V4L1 concept of "PAL": /BGDKHI.
1038 * Several PAL standards are missing here: /M, /N and /Nc
1039 */
1040#define V4L2_STD_PAL            (V4L2_STD_PAL_BG        |\
1041                                 V4L2_STD_PAL_DK        |\
1042                                 V4L2_STD_PAL_H         |\
1043                                 V4L2_STD_PAL_I)
1044/* Chroma "agnostic" standards */
1045#define V4L2_STD_B              (V4L2_STD_PAL_B         |\
1046                                 V4L2_STD_PAL_B1        |\
1047                                 V4L2_STD_SECAM_B)
1048#define V4L2_STD_G              (V4L2_STD_PAL_G         |\
1049                                 V4L2_STD_SECAM_G)
1050#define V4L2_STD_H              (V4L2_STD_PAL_H         |\
1051                                 V4L2_STD_SECAM_H)
1052#define V4L2_STD_L              (V4L2_STD_SECAM_L       |\
1053                                 V4L2_STD_SECAM_LC)
1054#define V4L2_STD_GH             (V4L2_STD_G             |\
1055                                 V4L2_STD_H)
1056#define V4L2_STD_DK             (V4L2_STD_PAL_DK        |\
1057                                 V4L2_STD_SECAM_DK)
1058#define V4L2_STD_BG             (V4L2_STD_B             |\
1059                                 V4L2_STD_G)
1060#define V4L2_STD_MN             (V4L2_STD_PAL_M         |\
1061                                 V4L2_STD_PAL_N         |\
1062                                 V4L2_STD_PAL_Nc        |\
1063                                 V4L2_STD_NTSC)
1064
1065/* Standards where MTS/BTSC stereo could be found */
1066#define V4L2_STD_MTS            (V4L2_STD_NTSC_M        |\
1067                                 V4L2_STD_PAL_M         |\
1068                                 V4L2_STD_PAL_N         |\
1069                                 V4L2_STD_PAL_Nc)
1070
1071/* Standards for Countries with 60Hz Line frequency */
1072#define V4L2_STD_525_60         (V4L2_STD_PAL_M         |\
1073                                 V4L2_STD_PAL_60        |\
1074                                 V4L2_STD_NTSC          |\
1075                                 V4L2_STD_NTSC_443)
1076/* Standards for Countries with 50Hz Line frequency */
1077#define V4L2_STD_625_50         (V4L2_STD_PAL           |\
1078                                 V4L2_STD_PAL_N         |\
1079                                 V4L2_STD_PAL_Nc        |\
1080                                 V4L2_STD_SECAM)
1081
1082#define V4L2_STD_ATSC           (V4L2_STD_ATSC_8_VSB    |\
1083                                 V4L2_STD_ATSC_16_VSB)
1084/* Macros with none and all analog standards */
1085#define V4L2_STD_UNKNOWN        0
1086#define V4L2_STD_ALL            (V4L2_STD_525_60        |\
1087                                 V4L2_STD_625_50)
1088
1089struct <link linkend="v4l2-standard">v4l2_standard</link> {
1090        __u32                index;
1091        v4l2_std_id          id;
1092        __u8                 name[24];
1093        struct <link linkend="v4l2-fract">v4l2_fract</link>    frameperiod; /* Frames, not fields */
1094        __u32                framelines;
1095        __u32                reserved[4];
1096};
1097
1098/*
1099 *      D V     B T     T I M I N G S
1100 */
1101
1102/** struct <link linkend="v4l2-bt-timings">v4l2_bt_timings</link> - BT.656/BT.1120 timing data
1103 * @width:      total width of the active video in pixels
1104 * @height:     total height of the active video in lines
1105 * @interlaced: Interlaced or progressive
1106 * @polarities: Positive or negative polarities
1107 * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz-&gt;74250000
1108 * @hfrontporch:Horizontal front porch in pixels
1109 * @hsync:      Horizontal Sync length in pixels
1110 * @hbackporch: Horizontal back porch in pixels
1111 * @vfrontporch:Vertical front porch in lines
1112 * @vsync:      Vertical Sync length in lines
1113 * @vbackporch: Vertical back porch in lines
1114 * @il_vfrontporch:Vertical front porch for the even field
1115 *              (aka field 2) of interlaced field formats
1116 * @il_vsync:   Vertical Sync length for the even field
1117 *              (aka field 2) of interlaced field formats
1118 * @il_vbackporch:Vertical back porch for the even field
1119 *              (aka field 2) of interlaced field formats
1120 * @standards:  Standards the timing belongs to
1121 * @flags:      Flags
1122 * @reserved:   Reserved fields, must be zeroed.
1123 *
1124 * A note regarding vertical interlaced timings: height refers to the total
1125 * height of the active video frame (= two fields). The blanking timings refer
1126 * to the blanking of each field. So the height of the total frame is
1127 * calculated as follows:
1128 *
1129 * tot_height = height + vfrontporch + vsync + vbackporch +
1130 *                       il_vfrontporch + il_vsync + il_vbackporch
1131 *
1132 * The active height of each field is height / 2.
1133 */
1134struct <link linkend="v4l2-bt-timings">v4l2_bt_timings</link> {
1135        __u32   width;
1136        __u32   height;
1137        __u32   interlaced;
1138        __u32   polarities;
1139        __u64   pixelclock;
1140        __u32   hfrontporch;
1141        __u32   hsync;
1142        __u32   hbackporch;
1143        __u32   vfrontporch;
1144        __u32   vsync;
1145        __u32   vbackporch;
1146        __u32   il_vfrontporch;
1147        __u32   il_vsync;
1148        __u32   il_vbackporch;
1149        __u32   standards;
1150        __u32   flags;
1151        __u32   reserved[14];
1152} __attribute__ ((packed));
1153
1154/* Interlaced or progressive format */
1155#define V4L2_DV_PROGRESSIVE     0
1156#define V4L2_DV_INTERLACED      1
1157
1158/* Polarities. If bit is not set, it is assumed to be negative polarity */
1159#define V4L2_DV_VSYNC_POS_POL   0x00000001
1160#define V4L2_DV_HSYNC_POS_POL   0x00000002
1161
1162/* Timings standards */
1163#define V4L2_DV_BT_STD_CEA861   (1 &lt;&lt; 0)  /* CEA-861 Digital TV Profile */
1164#define V4L2_DV_BT_STD_DMT      (1 &lt;&lt; 1)  /* VESA Discrete Monitor Timings */
1165#define V4L2_DV_BT_STD_CVT      (1 &lt;&lt; 2)  /* VESA Coordinated Video Timings */
1166#define V4L2_DV_BT_STD_GTF      (1 &lt;&lt; 3)  /* VESA Generalized Timings Formula */
1167
1168/* Flags */
1169
1170/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
1171   GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
1172   intervals are reduced, allowing a higher resolution over the same
1173   bandwidth. This is a read-only flag. */
1174#define V4L2_DV_FL_REDUCED_BLANKING             (1 &lt;&lt; 0)
1175/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
1176   of six. These formats can be optionally played at 1 / 1.001 speed.
1177   This is a read-only flag. */
1178#define V4L2_DV_FL_CAN_REDUCE_FPS               (1 &lt;&lt; 1)
1179/* CEA-861 specific: only valid for video transmitters, the flag is cleared
1180   by receivers.
1181   If the framerate of the format is a multiple of six, then the pixelclock
1182   used to set up the transmitter is divided by 1.001 to make it compatible
1183   with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
1184   29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
1185   such frequencies, then the flag will also be cleared. */
1186#define V4L2_DV_FL_REDUCED_FPS                  (1 &lt;&lt; 2)
1187/* Specific to interlaced formats: if set, then field 1 is really one half-line
1188   longer and field 2 is really one half-line shorter, so each field has
1189   exactly the same number of half-lines. Whether half-lines can be detected
1190   or used depends on the hardware. */
1191#define V4L2_DV_FL_HALF_LINE                    (1 &lt;&lt; 3)
1192/* If set, then this is a Consumer Electronics (CE) video format. Such formats
1193 * differ from other formats (commonly called IT formats) in that if RGB
1194 * encoding is used then by default the RGB values use limited range (i.e.ie;
1195 * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
1196 * except for the 640x480 format are CE formats. */
1197#define V4L2_DV_FL_IS_CE_VIDEO                  (1 &lt;&lt; 4)
1198
1199/* A few useful defines to calculate the total blanking and frame sizes */
1200#define V4L2_DV_BT_BLANKING_WIDTH(bt) \
1201        ((bt)-&gt;hfrontporch + (bt)-&gt;hsync + (bt)-&gt;hbackporch)
1202#define V4L2_DV_BT_FRAME_WIDTH(bt) \
1203        ((bt)-&gt;width + V4L2_DV_BT_BLANKING_WIDTH(bt))
1204#define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
1205        ((bt)-&gt;vfrontporch + (bt)-&gt;vsync + (bt)-&gt;vbackporch + \
1206         (bt)-&gt;il_vfrontporch + (bt)-&gt;il_vsync + (bt)-&gt;il_vbackporch)
1207#define V4L2_DV_BT_FRAME_HEIGHT(bt) \
1208        ((bt)-&gt;height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
1209
1210/** struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link> - DV timings
1211 * @type:       the type of the timings
1212 * @bt: BT656/1120 timings
1213 */
1214struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link> {
1215        __u32 type;
1216        union {
1217                struct <link linkend="v4l2-bt-timings">v4l2_bt_timings</link>  bt;
1218                __u32   reserved[32];
1219        };
1220} __attribute__ ((packed));
1221
1222/* Values for the type field */
1223#define V4L2_DV_BT_656_1120     0       /* BT.656/1120 timing type */
1224
1225
1226/** struct <link linkend="v4l2-enum-dv-timings">v4l2_enum_dv_timings</link> - DV timings enumeration
1227 * @index:      enumeration index
1228 * @pad:        the pad number for which to enumerate timings (used with
1229 *              v4l-subdev nodes only)
1230 * @reserved:   must be zeroed
1231 * @timings:    the timings for the given index
1232 */
1233struct <link linkend="v4l2-enum-dv-timings">v4l2_enum_dv_timings</link> {
1234        __u32 index;
1235        __u32 pad;
1236        __u32 reserved[2];
1237        struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link> timings;
1238};
1239
1240/** struct <link linkend="v4l2-bt-timings-cap">v4l2_bt_timings_cap</link> - BT.656/BT.1120 timing capabilities
1241 * @min_width:          width in pixels
1242 * @max_width:          width in pixels
1243 * @min_height:         height in lines
1244 * @max_height:         height in lines
1245 * @min_pixelclock:     Pixel clock in HZ. Ex. 74.25MHz-&gt;74250000
1246 * @max_pixelclock:     Pixel clock in HZ. Ex. 74.25MHz-&gt;74250000
1247 * @standards:          Supported standards
1248 * @capabilities:       Supported capabilities
1249 * @reserved:           Must be zeroed
1250 */
1251struct <link linkend="v4l2-bt-timings-cap">v4l2_bt_timings_cap</link> {
1252        __u32   min_width;
1253        __u32   max_width;
1254        __u32   min_height;
1255        __u32   max_height;
1256        __u64   min_pixelclock;
1257        __u64   max_pixelclock;
1258        __u32   standards;
1259        __u32   capabilities;
1260        __u32   reserved[16];
1261} __attribute__ ((packed));
1262
1263/* Supports interlaced formats */
1264#define V4L2_DV_BT_CAP_INTERLACED       (1 &lt;&lt; 0)
1265/* Supports progressive formats */
1266#define V4L2_DV_BT_CAP_PROGRESSIVE      (1 &lt;&lt; 1)
1267/* Supports CVT/GTF reduced blanking */
1268#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 &lt;&lt; 2)
1269/* Supports custom formats */
1270#define V4L2_DV_BT_CAP_CUSTOM           (1 &lt;&lt; 3)
1271
1272/** struct <link linkend="v4l2-dv-timings-cap">v4l2_dv_timings_cap</link> - DV timings capabilities
1273 * @type:       the type of the timings (same as in struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link>)
1274 * @pad:        the pad number for which to query capabilities (used with
1275 *              v4l-subdev nodes only)
1276 * @bt:         the BT656/1120 timings capabilities
1277 */
1278struct <link linkend="v4l2-dv-timings-cap">v4l2_dv_timings_cap</link> {
1279        __u32 type;
1280        __u32 pad;
1281        __u32 reserved[2];
1282        union {
1283                struct <link linkend="v4l2-bt-timings-cap">v4l2_bt_timings_cap</link> bt;
1284                __u32 raw_data[32];
1285        };
1286};
1287
1288
1289/*
1290 *      V I D E O   I N P U T S
1291 */
1292struct <link linkend="v4l2-input">v4l2_input</link> {
1293        __u32        index;             /*  Which input */
1294        __u8         name[32];          /*  Label */
1295        __u32        type;              /*  Type of input */
1296        __u32        audioset;          /*  Associated audios (bitfield) */
1297        __u32        tuner;             /*  enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> */
1298        v4l2_std_id  std;
1299        __u32        status;
1300        __u32        capabilities;
1301        __u32        reserved[3];
1302};
1303
1304/*  Values for the 'type' field */
1305#define V4L2_INPUT_TYPE_TUNER           1
1306#define V4L2_INPUT_TYPE_CAMERA          2
1307
1308/* field 'status' - general */
1309#define V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
1310#define V4L2_IN_ST_NO_SIGNAL   0x00000002
1311#define V4L2_IN_ST_NO_COLOR    0x00000004
1312
1313/* field 'status' - sensor orientation */
1314/* If sensor is mounted upside down set both bits */
1315#define V4L2_IN_ST_HFLIP       0x00000010 /* Frames are flipped horizontally */
1316#define V4L2_IN_ST_VFLIP       0x00000020 /* Frames are flipped vertically */
1317
1318/* field 'status' - analog */
1319#define V4L2_IN_ST_NO_H_LOCK   0x00000100  /* No horizontal sync lock */
1320#define V4L2_IN_ST_COLOR_KILL  0x00000200  /* Color killer is active */
1321
1322/* field 'status' - digital */
1323#define V4L2_IN_ST_NO_SYNC     0x00010000  /* No synchronization lock */
1324#define V4L2_IN_ST_NO_EQU      0x00020000  /* No equalizer lock */
1325#define V4L2_IN_ST_NO_CARRIER  0x00040000  /* Carrier recovery failed */
1326
1327/* field 'status' - VCR and set-top box */
1328#define V4L2_IN_ST_MACROVISION 0x01000000  /* Macrovision detected */
1329#define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
1330#define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
1331
1332/* capabilities flags */
1333#define V4L2_IN_CAP_DV_TIMINGS          0x00000002 /* Supports S_DV_TIMINGS */
1334#define V4L2_IN_CAP_CUSTOM_TIMINGS      V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
1335#define V4L2_IN_CAP_STD                 0x00000004 /* Supports S_STD */
1336#define V4L2_IN_CAP_NATIVE_SIZE         0x00000008 /* Supports setting native size */
1337
1338/*
1339 *      V I D E O   O U T P U T S
1340 */
1341struct <link linkend="v4l2-output">v4l2_output</link> {
1342        __u32        index;             /*  Which output */
1343        __u8         name[32];          /*  Label */
1344        __u32        type;              /*  Type of output */
1345        __u32        audioset;          /*  Associated audios (bitfield) */
1346        __u32        modulator;         /*  Associated modulator */
1347        v4l2_std_id  std;
1348        __u32        capabilities;
1349        __u32        reserved[3];
1350};
1351/*  Values for the 'type' field */
1352#define V4L2_OUTPUT_TYPE_MODULATOR              1
1353#define V4L2_OUTPUT_TYPE_ANALOG                 2
1354#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY       3
1355
1356/* capabilities flags */
1357#define V4L2_OUT_CAP_DV_TIMINGS         0x00000002 /* Supports S_DV_TIMINGS */
1358#define V4L2_OUT_CAP_CUSTOM_TIMINGS     V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
1359#define V4L2_OUT_CAP_STD                0x00000004 /* Supports S_STD */
1360#define V4L2_OUT_CAP_NATIVE_SIZE        0x00000008 /* Supports setting native size */
1361
1362/*
1363 *      C O N T R O L S
1364 */
1365struct <link linkend="v4l2-control">v4l2_control</link> {
1366        __u32                id;
1367        __s32                value;
1368};
1369
1370struct <link linkend="v4l2-ext-control">v4l2_ext_control</link> {
1371        __u32 id;
1372        __u32 size;
1373        __u32 reserved2[1];
1374        union {
1375                __s32 value;
1376                __s64 value64;
1377                char __user *string;
1378                __u8 __user *p_u8;
1379                __u16 __user *p_u16;
1380                __u32 __user *p_u32;
1381                void __user *ptr;
1382        };
1383} __attribute__ ((packed));
1384
1385struct <link linkend="v4l2-ext-controls">v4l2_ext_controls</link> {
1386        __u32 ctrl_class;
1387        __u32 count;
1388        __u32 error_idx;
1389        __u32 reserved[2];
1390        struct <link linkend="v4l2-ext-control">v4l2_ext_control</link> *controls;
1391};
1392
1393#define V4L2_CTRL_ID_MASK         (0x0fffffff)
1394#define V4L2_CTRL_ID2CLASS(id)    ((id) &amp; 0x0fff0000UL)
1395#define V4L2_CTRL_DRIVER_PRIV(id) (((id) &amp; 0xffff) &gt;= 0x1000)
1396#define V4L2_CTRL_MAX_DIMS        (4)
1397
1398enum <link linkend="v4l2-ctrl-type">v4l2_ctrl_type</link> {
1399        V4L2_CTRL_TYPE_INTEGER       = 1,
1400        V4L2_CTRL_TYPE_BOOLEAN       = 2,
1401        V4L2_CTRL_TYPE_MENU          = 3,
1402        V4L2_CTRL_TYPE_BUTTON        = 4,
1403        V4L2_CTRL_TYPE_INTEGER64     = 5,
1404        V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
1405        V4L2_CTRL_TYPE_STRING        = 7,
1406        V4L2_CTRL_TYPE_BITMASK       = 8,
1407        V4L2_CTRL_TYPE_INTEGER_MENU  = 9,
1408
1409        /* Compound types are &gt;= 0x0100 */
1410        V4L2_CTRL_COMPOUND_TYPES     = 0x0100,
1411        V4L2_CTRL_TYPE_U8            = 0x0100,
1412        V4L2_CTRL_TYPE_U16           = 0x0101,
1413        V4L2_CTRL_TYPE_U32           = 0x0102,
1414};
1415
1416/*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
1417struct <link linkend="v4l2-queryctrl">v4l2_queryctrl</link> {
1418        __u32                id;
1419        __u32                type;      /* enum <link linkend="v4l2-ctrl-type">v4l2_ctrl_type</link> */
1420        __u8                 name[32];  /* Whatever */
1421        __s32                minimum;   /* Note signedness */
1422        __s32                maximum;
1423        __s32                step;
1424        __s32                default_value;
1425        __u32                flags;
1426        __u32                reserved[2];
1427};
1428
1429/*  Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls */
1430struct <link linkend="v4l2-query-ext-ctrl">v4l2_query_ext_ctrl</link> {
1431        __u32                id;
1432        __u32                type;
1433        char                 name[32];
1434        __s64                minimum;
1435        __s64                maximum;
1436        __u64                step;
1437        __s64                default_value;
1438        __u32                flags;
1439        __u32                elem_size;
1440        __u32                elems;
1441        __u32                nr_of_dims;
1442        __u32                dims[V4L2_CTRL_MAX_DIMS];
1443        __u32                reserved[32];
1444};
1445
1446/*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
1447struct <link linkend="v4l2-querymenu">v4l2_querymenu</link> {
1448        __u32           id;
1449        __u32           index;
1450        union {
1451                __u8    name[32];       /* Whatever */
1452                __s64   value;
1453        };
1454        __u32           reserved;
1455} __attribute__ ((packed));
1456
1457/*  Control flags  */
1458#define V4L2_CTRL_FLAG_DISABLED         0x0001
1459#define V4L2_CTRL_FLAG_GRABBED          0x0002
1460#define V4L2_CTRL_FLAG_READ_ONLY        0x0004
1461#define V4L2_CTRL_FLAG_UPDATE           0x0008
1462#define V4L2_CTRL_FLAG_INACTIVE         0x0010
1463#define V4L2_CTRL_FLAG_SLIDER           0x0020
1464#define V4L2_CTRL_FLAG_WRITE_ONLY       0x0040
1465#define V4L2_CTRL_FLAG_VOLATILE         0x0080
1466#define V4L2_CTRL_FLAG_HAS_PAYLOAD      0x0100
1467#define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200
1468
1469/*  Query flags, to be ORed with the control ID */
1470#define V4L2_CTRL_FLAG_NEXT_CTRL        0x80000000
1471#define V4L2_CTRL_FLAG_NEXT_COMPOUND    0x40000000
1472
1473/*  User-class control IDs defined by V4L2 */
1474#define V4L2_CID_MAX_CTRLS              1024
1475/*  IDs reserved for driver specific controls */
1476#define V4L2_CID_PRIVATE_BASE           0x08000000
1477
1478
1479/*
1480 *      T U N I N G
1481 */
1482struct <link linkend="v4l2-tuner">v4l2_tuner</link> {
1483        __u32                   index;
1484        __u8                    name[32];
1485        __u32                   type;   /* enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> */
1486        __u32                   capability;
1487        __u32                   rangelow;
1488        __u32                   rangehigh;
1489        __u32                   rxsubchans;
1490        __u32                   audmode;
1491        __s32                   signal;
1492        __s32                   afc;
1493        __u32                   reserved[4];
1494};
1495
1496struct <link linkend="v4l2-modulator">v4l2_modulator</link> {
1497        __u32                   index;
1498        __u8                    name[32];
1499        __u32                   capability;
1500        __u32                   rangelow;
1501        __u32                   rangehigh;
1502        __u32                   txsubchans;
1503        __u32                   reserved[4];
1504};
1505
1506/*  Flags for the 'capability' field */
1507#define V4L2_TUNER_CAP_LOW              0x0001
1508#define V4L2_TUNER_CAP_NORM             0x0002
1509#define V4L2_TUNER_CAP_HWSEEK_BOUNDED   0x0004
1510#define V4L2_TUNER_CAP_HWSEEK_WRAP      0x0008
1511#define V4L2_TUNER_CAP_STEREO           0x0010
1512#define V4L2_TUNER_CAP_LANG2            0x0020
1513#define V4L2_TUNER_CAP_SAP              0x0020
1514#define V4L2_TUNER_CAP_LANG1            0x0040
1515#define V4L2_TUNER_CAP_RDS              0x0080
1516#define V4L2_TUNER_CAP_RDS_BLOCK_IO     0x0100
1517#define V4L2_TUNER_CAP_RDS_CONTROLS     0x0200
1518#define V4L2_TUNER_CAP_FREQ_BANDS       0x0400
1519#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM  0x0800
1520#define V4L2_TUNER_CAP_1HZ              0x1000
1521
1522/*  Flags for the 'rxsubchans' field */
1523#define V4L2_TUNER_SUB_MONO             0x0001
1524#define V4L2_TUNER_SUB_STEREO           0x0002
1525#define V4L2_TUNER_SUB_LANG2            0x0004
1526#define V4L2_TUNER_SUB_SAP              0x0004
1527#define V4L2_TUNER_SUB_LANG1            0x0008
1528#define V4L2_TUNER_SUB_RDS              0x0010
1529
1530/*  Values for the 'audmode' field */
1531#define V4L2_TUNER_MODE_MONO            0x0000
1532#define V4L2_TUNER_MODE_STEREO          0x0001
1533#define V4L2_TUNER_MODE_LANG2           0x0002
1534#define V4L2_TUNER_MODE_SAP             0x0002
1535#define V4L2_TUNER_MODE_LANG1           0x0003
1536#define V4L2_TUNER_MODE_LANG1_LANG2     0x0004
1537
1538struct <link linkend="v4l2-frequency">v4l2_frequency</link> {
1539        __u32   tuner;
1540        __u32   type;   /* enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> */
1541        __u32   frequency;
1542        __u32   reserved[8];
1543};
1544
1545#define V4L2_BAND_MODULATION_VSB        (1 &lt;&lt; 1)
1546#define V4L2_BAND_MODULATION_FM         (1 &lt;&lt; 2)
1547#define V4L2_BAND_MODULATION_AM         (1 &lt;&lt; 3)
1548
1549struct <link linkend="v4l2-frequency-band">v4l2_frequency_band</link> {
1550        __u32   tuner;
1551        __u32   type;   /* enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> */
1552        __u32   index;
1553        __u32   capability;
1554        __u32   rangelow;
1555        __u32   rangehigh;
1556        __u32   modulation;
1557        __u32   reserved[9];
1558};
1559
1560struct <link linkend="v4l2-hw-freq-seek">v4l2_hw_freq_seek</link> {
1561        __u32   tuner;
1562        __u32   type;   /* enum <link linkend="v4l2-tuner-type">v4l2_tuner_type</link> */
1563        __u32   seek_upward;
1564        __u32   wrap_around;
1565        __u32   spacing;
1566        __u32   rangelow;
1567        __u32   rangehigh;
1568        __u32   reserved[5];
1569};
1570
1571/*
1572 *      R D S
1573 */
1574
1575struct <link linkend="v4l2-rds-data">v4l2_rds_data</link> {
1576        __u8    lsb;
1577        __u8    msb;
1578        __u8    block;
1579} __attribute__ ((packed));
1580
1581#define V4L2_RDS_BLOCK_MSK       0x7
1582#define V4L2_RDS_BLOCK_A         0
1583#define V4L2_RDS_BLOCK_B         1
1584#define V4L2_RDS_BLOCK_C         2
1585#define V4L2_RDS_BLOCK_D         3
1586#define V4L2_RDS_BLOCK_C_ALT     4
1587#define V4L2_RDS_BLOCK_INVALID   7
1588
1589#define V4L2_RDS_BLOCK_CORRECTED 0x40
1590#define V4L2_RDS_BLOCK_ERROR     0x80
1591
1592/*
1593 *      A U D I O
1594 */
1595struct <link linkend="v4l2-audio">v4l2_audio</link> {
1596        __u32   index;
1597        __u8    name[32];
1598        __u32   capability;
1599        __u32   mode;
1600        __u32   reserved[2];
1601};
1602
1603/*  Flags for the 'capability' field */
1604#define V4L2_AUDCAP_STEREO              0x00001
1605#define V4L2_AUDCAP_AVL                 0x00002
1606
1607/*  Flags for the 'mode' field */
1608#define V4L2_AUDMODE_AVL                0x00001
1609
1610struct <link linkend="v4l2-audioout">v4l2_audioout</link> {
1611        __u32   index;
1612        __u8    name[32];
1613        __u32   capability;
1614        __u32   mode;
1615        __u32   reserved[2];
1616};
1617
1618/*
1619 *      M P E G   S E R V I C E S
1620 *
1621 *      NOTE: EXPERIMENTAL API
1622 */
1623#if 1
1624#define V4L2_ENC_IDX_FRAME_I    (0)
1625#define V4L2_ENC_IDX_FRAME_P    (1)
1626#define V4L2_ENC_IDX_FRAME_B    (2)
1627#define V4L2_ENC_IDX_FRAME_MASK (0xf)
1628
1629struct <link linkend="v4l2-enc-idx-entry">v4l2_enc_idx_entry</link> {
1630        __u64 offset;
1631        __u64 pts;
1632        __u32 length;
1633        __u32 flags;
1634        __u32 reserved[2];
1635};
1636
1637#define V4L2_ENC_IDX_ENTRIES (64)
1638struct <link linkend="v4l2-enc-idx">v4l2_enc_idx</link> {
1639        __u32 entries;
1640        __u32 entries_cap;
1641        __u32 reserved[4];
1642        struct <link linkend="v4l2-enc-idx-entry">v4l2_enc_idx_entry</link> entry[V4L2_ENC_IDX_ENTRIES];
1643};
1644
1645
1646#define V4L2_ENC_CMD_START      (0)
1647#define V4L2_ENC_CMD_STOP       (1)
1648#define V4L2_ENC_CMD_PAUSE      (2)
1649#define V4L2_ENC_CMD_RESUME     (3)
1650
1651/* Flags for V4L2_ENC_CMD_STOP */
1652#define V4L2_ENC_CMD_STOP_AT_GOP_END    (1 &lt;&lt; 0)
1653
1654struct <link linkend="v4l2-encoder-cmd">v4l2_encoder_cmd</link> {
1655        __u32 cmd;
1656        __u32 flags;
1657        union {
1658                struct {
1659                        __u32 data[8];
1660                } raw;
1661        };
1662};
1663
1664/* Decoder commands */
1665#define V4L2_DEC_CMD_START       (0)
1666#define V4L2_DEC_CMD_STOP        (1)
1667#define V4L2_DEC_CMD_PAUSE       (2)
1668#define V4L2_DEC_CMD_RESUME      (3)
1669
1670/* Flags for V4L2_DEC_CMD_START */
1671#define V4L2_DEC_CMD_START_MUTE_AUDIO   (1 &lt;&lt; 0)
1672
1673/* Flags for V4L2_DEC_CMD_PAUSE */
1674#define V4L2_DEC_CMD_PAUSE_TO_BLACK     (1 &lt;&lt; 0)
1675
1676/* Flags for V4L2_DEC_CMD_STOP */
1677#define V4L2_DEC_CMD_STOP_TO_BLACK      (1 &lt;&lt; 0)
1678#define V4L2_DEC_CMD_STOP_IMMEDIATELY   (1 &lt;&lt; 1)
1679
1680/* Play format requirements (returned by the driver): */
1681
1682/* The decoder has no special format requirements */
1683#define V4L2_DEC_START_FMT_NONE         (0)
1684/* The decoder requires full GOPs */
1685#define V4L2_DEC_START_FMT_GOP          (1)
1686
1687/* The structure must be zeroed before use by the application
1688   This ensures it can be extended safely in the future. */
1689struct <link linkend="v4l2-decoder-cmd">v4l2_decoder_cmd</link> {
1690        __u32 cmd;
1691        __u32 flags;
1692        union {
1693                struct {
1694                        __u64 pts;
1695                } stop;
1696
1697                struct {
1698                        /* 0 or 1000 specifies normal speed,
1699                           1 specifies forward single stepping,
1700                           -1 specifies backward single stepping,
1701                           &gt;1: playback at speed/1000 of the normal speed,
1702                           &lt;-1: reverse playback at (-speed/1000) of the normal speed. */
1703                        __s32 speed;
1704                        __u32 format;
1705                } start;
1706
1707                struct {
1708                        __u32 data[16];
1709                } raw;
1710        };
1711};
1712#endif
1713
1714
1715/*
1716 *      D A T A   S E R V I C E S   ( V B I )
1717 *
1718 *      Data services API by Michael Schimek
1719 */
1720
1721/* Raw VBI */
1722struct <link linkend="v4l2-vbi-format">v4l2_vbi_format</link> {
1723        __u32   sampling_rate;          /* in 1 Hz */
1724        __u32   offset;
1725        __u32   samples_per_line;
1726        __u32   sample_format;          /* V4L2_PIX_FMT_* */
1727        __s32   start[2];
1728        __u32   count[2];
1729        __u32   flags;                  /* V4L2_VBI_* */
1730        __u32   reserved[2];            /* must be zero */
1731};
1732
1733/*  VBI flags  */
1734#define V4L2_VBI_UNSYNC         (1 &lt;&lt; 0)
1735#define V4L2_VBI_INTERLACED     (1 &lt;&lt; 1)
1736
1737/* ITU-R start lines for each field */
1738#define V4L2_VBI_ITU_525_F1_START (1)
1739#define V4L2_VBI_ITU_525_F2_START (264)
1740#define V4L2_VBI_ITU_625_F1_START (1)
1741#define V4L2_VBI_ITU_625_F2_START (314)
1742
1743/* Sliced VBI
1744 *
1745 *    This implements is a proposal V4L2 API to allow SLICED VBI
1746 * required for some hardware encoders. It should change without
1747 * notice in the definitive implementation.
1748 */
1749
1750struct <link linkend="v4l2-sliced-vbi-format">v4l2_sliced_vbi_format</link> {
1751        __u16   service_set;
1752        /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1753           service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
1754                                 (equals frame lines 313-336 for 625 line video
1755                                  standards, 263-286 for 525 line standards) */
1756        __u16   service_lines[2][24];
1757        __u32   io_size;
1758        __u32   reserved[2];            /* must be zero */
1759};
1760
1761/* Teletext World System Teletext
1762   (WST), defined on ITU-R BT.653-2 */
1763#define V4L2_SLICED_TELETEXT_B          (0x0001)
1764/* Video Program System, defined on ETS 300 231*/
1765#define V4L2_SLICED_VPS                 (0x0400)
1766/* Closed Caption, defined on EIA-608 */
1767#define V4L2_SLICED_CAPTION_525         (0x1000)
1768/* Wide Screen System, defined on ITU-R BT1119.1 */
1769#define V4L2_SLICED_WSS_625             (0x4000)
1770
1771#define V4L2_SLICED_VBI_525             (V4L2_SLICED_CAPTION_525)
1772#define V4L2_SLICED_VBI_625             (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1773
1774struct <link linkend="v4l2-sliced-vbi-cap">v4l2_sliced_vbi_cap</link> {
1775        __u16   service_set;
1776        /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1777           service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
1778                                 (equals frame lines 313-336 for 625 line video
1779                                  standards, 263-286 for 525 line standards) */
1780        __u16   service_lines[2][24];
1781        __u32   type;           /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
1782        __u32   reserved[3];    /* must be 0 */
1783};
1784
1785struct <link linkend="v4l2-sliced-vbi-data">v4l2_sliced_vbi_data</link> {
1786        __u32   id;
1787        __u32   field;          /* 0: first field, 1: second field */
1788        __u32   line;           /* 1-23 */
1789        __u32   reserved;       /* must be 0 */
1790        __u8    data[48];
1791};
1792
1793/*
1794 * Sliced VBI data inserted into MPEG Streams
1795 */
1796
1797/*
1798 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
1799 *
1800 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
1801 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
1802 * data
1803 *
1804 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
1805 * definitions are not included here.  See the MPEG-2 specifications for details
1806 * on these headers.
1807 */
1808
1809/* Line type IDs */
1810#define V4L2_MPEG_VBI_IVTV_TELETEXT_B     (1)
1811#define V4L2_MPEG_VBI_IVTV_CAPTION_525    (4)
1812#define V4L2_MPEG_VBI_IVTV_WSS_625        (5)
1813#define V4L2_MPEG_VBI_IVTV_VPS            (7)
1814
1815struct <link linkend="v4l2-mpeg-vbi-itv0-line">v4l2_mpeg_vbi_itv0_line</link> {
1816        __u8 id;        /* One of V4L2_MPEG_VBI_IVTV_* above */
1817        __u8 data[42];  /* Sliced VBI data for the line */
1818} __attribute__ ((packed));
1819
1820struct <link linkend="v4l2-mpeg-vbi-itv0">v4l2_mpeg_vbi_itv0</link> {
1821        __le32 linemask[2]; /* Bitmasks of VBI service lines present */
1822        struct <link linkend="v4l2-mpeg-vbi-itv0-line">v4l2_mpeg_vbi_itv0_line</link> line[35];
1823} __attribute__ ((packed));
1824
1825struct <link linkend="v4l2-mpeg-vbi-itv0-1">v4l2_mpeg_vbi_ITV0</link> {
1826        struct <link linkend="v4l2-mpeg-vbi-itv0-line">v4l2_mpeg_vbi_itv0_line</link> line[36];
1827} __attribute__ ((packed));
1828
1829#define V4L2_MPEG_VBI_IVTV_MAGIC0       "itv0"
1830#define V4L2_MPEG_VBI_IVTV_MAGIC1       "ITV0"
1831
1832struct <link linkend="v4l2-mpeg-vbi-fmt-ivtv">v4l2_mpeg_vbi_fmt_ivtv</link> {
1833        __u8 magic[4];
1834        union {
1835                struct <link linkend="v4l2-mpeg-vbi-itv0">v4l2_mpeg_vbi_itv0</link> itv0;
1836                struct <link linkend="v4l2-mpeg-vbi-itv0-1">v4l2_mpeg_vbi_ITV0</link> ITV0;
1837        };
1838} __attribute__ ((packed));
1839
1840/*
1841 *      A G G R E G A T E   S T R U C T U R E S
1842 */
1843
1844/**
1845 * struct <link linkend="v4l2-plane-pix-format">v4l2_plane_pix_format</link> - additional, per-plane format definition
1846 * @sizeimage:          maximum size in bytes required for data, for which
1847 *                      this plane will be used
1848 * @bytesperline:       distance in bytes between the leftmost pixels in two
1849 *                      adjacent lines
1850 */
1851struct <link linkend="v4l2-plane-pix-format">v4l2_plane_pix_format</link> {
1852        __u32           sizeimage;
1853        __u32           bytesperline;
1854        __u16           reserved[6];
1855} __attribute__ ((packed));
1856
1857/**
1858 * struct <link linkend="v4l2-pix-format-mplane">v4l2_pix_format_mplane</link> - multiplanar format definition
1859 * @width:              image width in pixels
1860 * @height:             image height in pixels
1861 * @pixelformat:        little endian four character code (fourcc)
1862 * @field:              enum <link linkend="v4l2-field">v4l2_field</link>; field order (for interlaced video)
1863 * @colorspace:         enum <link linkend="v4l2-colorspace">v4l2_colorspace</link>; supplemental to pixelformat
1864 * @plane_fmt:          per-plane information
1865 * @num_planes:         number of planes for this format
1866 * @flags:              format flags (V4L2_PIX_FMT_FLAG_*)
1867 * @ycbcr_enc:          enum <link linkend="v4l2-ycbcr-encoding">v4l2_ycbcr_encoding</link>, Y'CbCr encoding
1868 * @quantization:       enum <link linkend="v4l2-quantization">v4l2_quantization</link>, colorspace quantization
1869 */
1870struct <link linkend="v4l2-pix-format-mplane">v4l2_pix_format_mplane</link> {
1871        __u32                           width;
1872        __u32                           height;
1873        __u32                           pixelformat;
1874        __u32                           field;
1875        __u32                           colorspace;
1876
1877        struct <link linkend="v4l2-plane-pix-format">v4l2_plane_pix_format</link>    plane_fmt[VIDEO_MAX_PLANES];
1878        __u8                            num_planes;
1879        __u8                            flags;
1880        __u8                            ycbcr_enc;
1881        __u8                            quantization;
1882        __u8                            reserved[8];
1883} __attribute__ ((packed));
1884
1885/**
1886 * struct <link linkend="v4l2-sdr-format">v4l2_sdr_format</link> - SDR format definition
1887 * @pixelformat:        little endian four character code (fourcc)
1888 * @buffersize:         maximum size in bytes required for data
1889 */
1890struct <link linkend="v4l2-sdr-format">v4l2_sdr_format</link> {
1891        __u32                           pixelformat;
1892        __u32                           buffersize;
1893        __u8                            reserved[24];
1894} __attribute__ ((packed));
1895
1896/**
1897 * struct <link linkend="v4l2-format">v4l2_format</link> - stream data format
1898 * @type:       enum <link linkend="v4l2-buf-type">v4l2_buf_type</link>; type of the data stream
1899 * @pix:        definition of an image format
1900 * @pix_mp:     definition of a multiplanar image format
1901 * @win:        definition of an overlaid image
1902 * @vbi:        raw VBI capture or output parameters
1903 * @sliced:     sliced VBI capture or output parameters
1904 * @raw_data:   placeholder for future extensions and custom formats
1905 */
1906struct <link linkend="v4l2-format">v4l2_format</link> {
1907        __u32    type;
1908        union {
1909                struct <link linkend="v4l2-pix-format">v4l2_pix_format</link>          pix;     /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1910                struct <link linkend="v4l2-pix-format-mplane">v4l2_pix_format_mplane</link>   pix_mp;  /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
1911                struct <link linkend="v4l2-window">v4l2_window</link>              win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1912                struct <link linkend="v4l2-vbi-format">v4l2_vbi_format</link>          vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
1913                struct <link linkend="v4l2-sliced-vbi-format">v4l2_sliced_vbi_format</link>   sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1914                struct <link linkend="v4l2-sdr-format">v4l2_sdr_format</link>          sdr;     /* V4L2_BUF_TYPE_SDR_CAPTURE */
1915                __u8    raw_data[200];                   /* user-defined */
1916        } fmt;
1917};
1918
1919/*      Stream type-dependent parameters
1920 */
1921struct <link linkend="v4l2-streamparm">v4l2_streamparm</link> {
1922        __u32    type;                  /* enum <link linkend="v4l2-buf-type">v4l2_buf_type</link> */
1923        union {
1924                struct <link linkend="v4l2-captureparm">v4l2_captureparm</link> capture;
1925                struct <link linkend="v4l2-outputparm">v4l2_outputparm</link>  output;
1926                __u8    raw_data[200];  /* user-defined */
1927        } parm;
1928};
1929
1930/*
1931 *      E V E N T S
1932 */
1933
1934#define V4L2_EVENT_ALL                          0
1935#define V4L2_EVENT_VSYNC                        1
1936#define V4L2_EVENT_EOS                          2
1937#define V4L2_EVENT_CTRL                         3
1938#define V4L2_EVENT_FRAME_SYNC                   4
1939#define V4L2_EVENT_SOURCE_CHANGE                5
1940#define V4L2_EVENT_MOTION_DET                   6
1941#define V4L2_EVENT_PRIVATE_START                0x08000000
1942
1943/* Payload for V4L2_EVENT_VSYNC */
1944struct <link linkend="v4l2-event-vsync">v4l2_event_vsync</link> {
1945        /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1946        __u8 field;
1947} __attribute__ ((packed));
1948
1949/* Payload for V4L2_EVENT_CTRL */
1950#define V4L2_EVENT_CTRL_CH_VALUE                (1 &lt;&lt; 0)
1951#define V4L2_EVENT_CTRL_CH_FLAGS                (1 &lt;&lt; 1)
1952#define V4L2_EVENT_CTRL_CH_RANGE                (1 &lt;&lt; 2)
1953
1954struct <link linkend="v4l2-event-ctrl">v4l2_event_ctrl</link> {
1955        __u32 changes;
1956        __u32 type;
1957        union {
1958                __s32 value;
1959                __s64 value64;
1960        };
1961        __u32 flags;
1962        __s32 minimum;
1963        __s32 maximum;
1964        __s32 step;
1965        __s32 default_value;
1966};
1967
1968struct <link linkend="v4l2-event-frame-sync">v4l2_event_frame_sync</link> {
1969        __u32 frame_sequence;
1970};
1971
1972#define V4L2_EVENT_SRC_CH_RESOLUTION            (1 &lt;&lt; 0)
1973
1974struct <link linkend="v4l2-event-src-change">v4l2_event_src_change</link> {
1975        __u32 changes;
1976};
1977
1978#define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ (1 &lt;&lt; 0)
1979
1980/**
1981 * struct <link linkend="v4l2-event-motion-det">v4l2_event_motion_det</link> - motion detection event
1982 * @flags:             if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the
1983 *                     frame_sequence field is valid.
1984 * @frame_sequence:    the frame sequence number associated with this event.
1985 * @region_mask:       which regions detected motion.
1986 */
1987struct <link linkend="v4l2-event-motion-det">v4l2_event_motion_det</link> {
1988        __u32 flags;
1989        __u32 frame_sequence;
1990        __u32 region_mask;
1991};
1992
1993struct <link linkend="v4l2-event">v4l2_event</link> {
1994        __u32                           type;
1995        union {
1996                struct <link linkend="v4l2-event-vsync">v4l2_event_vsync</link>         vsync;
1997                struct <link linkend="v4l2-event-ctrl">v4l2_event_ctrl</link>          ctrl;
1998                struct <link linkend="v4l2-event-frame-sync">v4l2_event_frame_sync</link>    frame_sync;
1999                struct <link linkend="v4l2-event-src-change">v4l2_event_src_change</link>    src_change;
2000                struct <link linkend="v4l2-event-motion-det">v4l2_event_motion_det</link>    motion_det;
2001                __u8                            data[64];
2002        } u;
2003        __u32                           pending;
2004        __u32                           sequence;
2005        struct timespec                 timestamp;
2006        __u32                           id;
2007        __u32                           reserved[8];
2008};
2009
2010#define V4L2_EVENT_SUB_FL_SEND_INITIAL          (1 &lt;&lt; 0)
2011#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK        (1 &lt;&lt; 1)
2012
2013struct <link linkend="v4l2-event-subscription">v4l2_event_subscription</link> {
2014        __u32                           type;
2015        __u32                           id;
2016        __u32                           flags;
2017        __u32                           reserved[5];
2018};
2019
2020/*
2021 *      A D V A N C E D   D E B U G G I N G
2022 *
2023 *      NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
2024 *      FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
2025 */
2026
2027/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
2028
2029#define V4L2_CHIP_MATCH_BRIDGE      0  /* Match against chip ID on the bridge (0 for the bridge) */
2030#define V4L2_CHIP_MATCH_SUBDEV      4  /* Match against subdev index */
2031
2032/* The following four defines are no longer in use */
2033#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE
2034#define V4L2_CHIP_MATCH_I2C_DRIVER  1  /* Match against I2C driver name */
2035#define V4L2_CHIP_MATCH_I2C_ADDR    2  /* Match against I2C 7-bit address */
2036#define V4L2_CHIP_MATCH_AC97        3  /* Match against ancillary AC97 chip */
2037
2038struct <link linkend="v4l2-dbg-match">v4l2_dbg_match</link> {
2039        __u32 type; /* Match type */
2040        union {     /* Match this chip, meaning determined by type */
2041                __u32 addr;
2042                char name[32];
2043        };
2044} __attribute__ ((packed));
2045
2046struct <link linkend="v4l2-dbg-register">v4l2_dbg_register</link> {
2047        struct <link linkend="v4l2-dbg-match">v4l2_dbg_match</link> match;
2048        __u32 size;     /* register size in bytes */
2049        __u64 reg;
2050        __u64 val;
2051} __attribute__ ((packed));
2052
2053#define V4L2_CHIP_FL_READABLE (1 &lt;&lt; 0)
2054#define V4L2_CHIP_FL_WRITABLE (1 &lt;&lt; 1)
2055
2056/* VIDIOC_DBG_G_CHIP_INFO */
2057struct <link linkend="v4l2-dbg-chip-info">v4l2_dbg_chip_info</link> {
2058        struct <link linkend="v4l2-dbg-match">v4l2_dbg_match</link> match;
2059        char name[32];
2060        __u32 flags;
2061        __u32 reserved[32];
2062} __attribute__ ((packed));
2063
2064/**
2065 * struct <link linkend="v4l2-create-buffers">v4l2_create_buffers</link> - VIDIOC_CREATE_BUFS argument
2066 * @index:      on return, index of the first created buffer
2067 * @count:      entry: number of requested buffers,
2068 *              return: number of created buffers
2069 * @memory:     enum <link linkend="v4l2-memory">v4l2_memory</link>; buffer memory type
2070 * @format:     frame format, for which buffers are requested
2071 * @reserved:   future extensions
2072 */
2073struct <link linkend="v4l2-create-buffers">v4l2_create_buffers</link> {
2074        __u32                   index;
2075        __u32                   count;
2076        __u32                   memory;
2077        struct <link linkend="v4l2-format">v4l2_format</link>      format;
2078        __u32                   reserved[8];
2079};
2080
2081/*
2082 *      I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
2083 *
2084 */
2085#define VIDIOC_QUERYCAP          _IOR('V',  0, struct <link linkend="v4l2-capability">v4l2_capability</link>)
2086#define VIDIOC_RESERVED           _IO('V',  1)
2087#define VIDIOC_ENUM_FMT         _IOWR('V',  2, struct <link linkend="v4l2-fmtdesc">v4l2_fmtdesc</link>)
2088#define VIDIOC_G_FMT            _IOWR('V',  4, struct <link linkend="v4l2-format">v4l2_format</link>)
2089#define VIDIOC_S_FMT            _IOWR('V',  5, struct <link linkend="v4l2-format">v4l2_format</link>)
2090#define VIDIOC_REQBUFS          _IOWR('V',  8, struct <link linkend="v4l2-requestbuffers">v4l2_requestbuffers</link>)
2091#define VIDIOC_QUERYBUF         _IOWR('V',  9, struct <link linkend="v4l2-buffer">v4l2_buffer</link>)
2092#define VIDIOC_G_FBUF            _IOR('V', 10, struct <link linkend="v4l2-framebuffer">v4l2_framebuffer</link>)
2093#define VIDIOC_S_FBUF            _IOW('V', 11, struct <link linkend="v4l2-framebuffer">v4l2_framebuffer</link>)
2094#define VIDIOC_OVERLAY           _IOW('V', 14, int)
2095#define VIDIOC_QBUF             _IOWR('V', 15, struct <link linkend="v4l2-buffer">v4l2_buffer</link>)
2096#define VIDIOC_EXPBUF           _IOWR('V', 16, struct <link linkend="v4l2-exportbuffer">v4l2_exportbuffer</link>)
2097#define VIDIOC_DQBUF            _IOWR('V', 17, struct <link linkend="v4l2-buffer">v4l2_buffer</link>)
2098#define VIDIOC_STREAMON          _IOW('V', 18, int)
2099#define VIDIOC_STREAMOFF         _IOW('V', 19, int)
2100#define VIDIOC_G_PARM           _IOWR('V', 21, struct <link linkend="v4l2-streamparm">v4l2_streamparm</link>)
2101#define VIDIOC_S_PARM           _IOWR('V', 22, struct <link linkend="v4l2-streamparm">v4l2_streamparm</link>)
2102#define VIDIOC_G_STD             _IOR('V', 23, v4l2_std_id)
2103#define VIDIOC_S_STD             _IOW('V', 24, v4l2_std_id)
2104#define VIDIOC_ENUMSTD          _IOWR('V', 25, struct <link linkend="v4l2-standard">v4l2_standard</link>)
2105#define VIDIOC_ENUMINPUT        _IOWR('V', 26, struct <link linkend="v4l2-input">v4l2_input</link>)
2106#define VIDIOC_G_CTRL           _IOWR('V', 27, struct <link linkend="v4l2-control">v4l2_control</link>)
2107#define VIDIOC_S_CTRL           _IOWR('V', 28, struct <link linkend="v4l2-control">v4l2_control</link>)
2108#define VIDIOC_G_TUNER          _IOWR('V', 29, struct <link linkend="v4l2-tuner">v4l2_tuner</link>)
2109#define VIDIOC_S_TUNER           _IOW('V', 30, struct <link linkend="v4l2-tuner">v4l2_tuner</link>)
2110#define VIDIOC_G_AUDIO           _IOR('V', 33, struct <link linkend="v4l2-audio">v4l2_audio</link>)
2111#define VIDIOC_S_AUDIO           _IOW('V', 34, struct <link linkend="v4l2-audio">v4l2_audio</link>)
2112#define VIDIOC_QUERYCTRL        _IOWR('V', 36, struct <link linkend="v4l2-queryctrl">v4l2_queryctrl</link>)
2113#define VIDIOC_QUERYMENU        _IOWR('V', 37, struct <link linkend="v4l2-querymenu">v4l2_querymenu</link>)
2114#define VIDIOC_G_INPUT           _IOR('V', 38, int)
2115#define VIDIOC_S_INPUT          _IOWR('V', 39, int)
2116#define VIDIOC_G_EDID           _IOWR('V', 40, struct <link linkend="v4l2-edid">v4l2_edid</link>)
2117#define VIDIOC_S_EDID           _IOWR('V', 41, struct <link linkend="v4l2-edid">v4l2_edid</link>)
2118#define VIDIOC_G_OUTPUT          _IOR('V', 46, int)
2119#define VIDIOC_S_OUTPUT         _IOWR('V', 47, int)
2120#define VIDIOC_ENUMOUTPUT       _IOWR('V', 48, struct <link linkend="v4l2-output">v4l2_output</link>)
2121#define VIDIOC_G_AUDOUT          _IOR('V', 49, struct <link linkend="v4l2-audioout">v4l2_audioout</link>)
2122#define VIDIOC_S_AUDOUT          _IOW('V', 50, struct <link linkend="v4l2-audioout">v4l2_audioout</link>)
2123#define VIDIOC_G_MODULATOR      _IOWR('V', 54, struct <link linkend="v4l2-modulator">v4l2_modulator</link>)
2124#define VIDIOC_S_MODULATOR       _IOW('V', 55, struct <link linkend="v4l2-modulator">v4l2_modulator</link>)
2125#define VIDIOC_G_FREQUENCY      _IOWR('V', 56, struct <link linkend="v4l2-frequency">v4l2_frequency</link>)
2126#define VIDIOC_S_FREQUENCY       _IOW('V', 57, struct <link linkend="v4l2-frequency">v4l2_frequency</link>)
2127#define VIDIOC_CROPCAP          _IOWR('V', 58, struct <link linkend="v4l2-cropcap">v4l2_cropcap</link>)
2128#define VIDIOC_G_CROP           _IOWR('V', 59, struct <link linkend="v4l2-crop">v4l2_crop</link>)
2129#define VIDIOC_S_CROP            _IOW('V', 60, struct <link linkend="v4l2-crop">v4l2_crop</link>)
2130#define VIDIOC_G_JPEGCOMP        _IOR('V', 61, struct <link linkend="v4l2-jpegcompression">v4l2_jpegcompression</link>)
2131#define VIDIOC_S_JPEGCOMP        _IOW('V', 62, struct <link linkend="v4l2-jpegcompression">v4l2_jpegcompression</link>)
2132#define VIDIOC_QUERYSTD          _IOR('V', 63, v4l2_std_id)
2133#define VIDIOC_TRY_FMT          _IOWR('V', 64, struct <link linkend="v4l2-format">v4l2_format</link>)
2134#define VIDIOC_ENUMAUDIO        _IOWR('V', 65, struct <link linkend="v4l2-audio">v4l2_audio</link>)
2135#define VIDIOC_ENUMAUDOUT       _IOWR('V', 66, struct <link linkend="v4l2-audioout">v4l2_audioout</link>)
2136#define VIDIOC_G_PRIORITY        _IOR('V', 67, __u32) /* enum <link linkend="v4l2-priority">v4l2_priority</link> */
2137#define VIDIOC_S_PRIORITY        _IOW('V', 68, __u32) /* enum <link linkend="v4l2-priority">v4l2_priority</link> */
2138#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct <link linkend="v4l2-sliced-vbi-cap">v4l2_sliced_vbi_cap</link>)
2139#define VIDIOC_LOG_STATUS         _IO('V', 70)
2140#define VIDIOC_G_EXT_CTRLS      _IOWR('V', 71, struct <link linkend="v4l2-ext-controls">v4l2_ext_controls</link>)
2141#define VIDIOC_S_EXT_CTRLS      _IOWR('V', 72, struct <link linkend="v4l2-ext-controls">v4l2_ext_controls</link>)
2142#define VIDIOC_TRY_EXT_CTRLS    _IOWR('V', 73, struct <link linkend="v4l2-ext-controls">v4l2_ext_controls</link>)
2143#define VIDIOC_ENUM_FRAMESIZES  _IOWR('V', 74, struct <link linkend="v4l2-frmsizeenum">v4l2_frmsizeenum</link>)
2144#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct <link linkend="v4l2-frmivalenum">v4l2_frmivalenum</link>)
2145#define VIDIOC_G_ENC_INDEX       _IOR('V', 76, struct <link linkend="v4l2-enc-idx">v4l2_enc_idx</link>)
2146#define VIDIOC_ENCODER_CMD      _IOWR('V', 77, struct <link linkend="v4l2-encoder-cmd">v4l2_encoder_cmd</link>)
2147#define VIDIOC_TRY_ENCODER_CMD  _IOWR('V', 78, struct <link linkend="v4l2-encoder-cmd">v4l2_encoder_cmd</link>)
2148
2149/* Experimental, meant for debugging, testing and internal use.
2150   Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
2151   You must be root to use these ioctls. Never use these in applications! */
2152#define VIDIOC_DBG_S_REGISTER    _IOW('V', 79, struct <link linkend="v4l2-dbg-register">v4l2_dbg_register</link>)
2153#define VIDIOC_DBG_G_REGISTER   _IOWR('V', 80, struct <link linkend="v4l2-dbg-register">v4l2_dbg_register</link>)
2154
2155#define VIDIOC_S_HW_FREQ_SEEK    _IOW('V', 82, struct <link linkend="v4l2-hw-freq-seek">v4l2_hw_freq_seek</link>)
2156
2157#define VIDIOC_S_DV_TIMINGS     _IOWR('V', 87, struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link>)
2158#define VIDIOC_G_DV_TIMINGS     _IOWR('V', 88, struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link>)
2159#define VIDIOC_DQEVENT           _IOR('V', 89, struct <link linkend="v4l2-event">v4l2_event</link>)
2160#define VIDIOC_SUBSCRIBE_EVENT   _IOW('V', 90, struct <link linkend="v4l2-event-subscription">v4l2_event_subscription</link>)
2161#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct <link linkend="v4l2-event-subscription">v4l2_event_subscription</link>)
2162
2163/* Experimental, the below two ioctls may change over the next couple of kernel
2164   versions */
2165#define VIDIOC_CREATE_BUFS      _IOWR('V', 92, struct <link linkend="v4l2-create-buffers">v4l2_create_buffers</link>)
2166#define VIDIOC_PREPARE_BUF      _IOWR('V', 93, struct <link linkend="v4l2-buffer">v4l2_buffer</link>)
2167
2168/* Experimental selection API */
2169#define VIDIOC_G_SELECTION      _IOWR('V', 94, struct <link linkend="v4l2-selection">v4l2_selection</link>)
2170#define VIDIOC_S_SELECTION      _IOWR('V', 95, struct <link linkend="v4l2-selection">v4l2_selection</link>)
2171
2172/* Experimental, these two ioctls may change over the next couple of kernel
2173   versions. */
2174#define VIDIOC_DECODER_CMD      _IOWR('V', 96, struct <link linkend="v4l2-decoder-cmd">v4l2_decoder_cmd</link>)
2175#define VIDIOC_TRY_DECODER_CMD  _IOWR('V', 97, struct <link linkend="v4l2-decoder-cmd">v4l2_decoder_cmd</link>)
2176
2177/* Experimental, these three ioctls may change over the next couple of kernel
2178   versions. */
2179#define VIDIOC_ENUM_DV_TIMINGS  _IOWR('V', 98, struct <link linkend="v4l2-enum-dv-timings">v4l2_enum_dv_timings</link>)
2180#define VIDIOC_QUERY_DV_TIMINGS  _IOR('V', 99, struct <link linkend="v4l2-dv-timings">v4l2_dv_timings</link>)
2181#define VIDIOC_DV_TIMINGS_CAP   _IOWR('V', 100, struct <link linkend="v4l2-dv-timings-cap">v4l2_dv_timings_cap</link>)
2182
2183/* Experimental, this ioctl may change over the next couple of kernel
2184   versions. */
2185#define VIDIOC_ENUM_FREQ_BANDS  _IOWR('V', 101, struct <link linkend="v4l2-frequency-band">v4l2_frequency_band</link>)
2186
2187/* Experimental, meant for debugging, testing and internal use.
2188   Never use these in applications! */
2189#define VIDIOC_DBG_G_CHIP_INFO  _IOWR('V', 102, struct <link linkend="v4l2-dbg-chip-info">v4l2_dbg_chip_info</link>)
2190
2191#define VIDIOC_QUERY_EXT_CTRL   _IOWR('V', 103, struct <link linkend="v4l2-query-ext-ctrl">v4l2_query_ext_ctrl</link>)
2192
2193/* Reminder: when adding new ioctls please add support for them to
2194   drivers/media/video/v4l2-compat-ioctl32.c as well! */
2195
2196#define BASE_VIDIOC_PRIVATE     192             /* 192-255 are private */
2197
2198#endif /* _UAPI__LINUX_VIDEODEV2_H */
2199</programlisting>
2200