xref: /illumos-gate/usr/src/uts/common/sys/videodev2.h (revision 48011479)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef __LINUX_VIDEODEV2_H
27 #define	__LINUX_VIDEODEV2_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  *	Video for Linux Two
37  *
38  *	Header file for v4l or V4L2 drivers and applications
39  * with public API.
40  * All kernel-specific stuff were moved to media/v4l2-dev.h, so
41  * no #if __KERNEL tests are allowed here
42  *
43  *	See http://linuxtv.org for more info
44  *
45  *	Author: Bill Dirks <bdirks@pacbell.net>
46  *		Justin Schoeman
47  *		et al.
48  */
49 
50 /*
51  * Common stuff for both V4L1 and V4L2
52  * Moved from videodev.h
53  */
54 #define	VIDEO_MAX_FRAME		32
55 
56 #define	VID_TYPE_CAPTURE	1	/* Can capture */
57 #define	VID_TYPE_TUNER		2	/* Can tune */
58 #define	VID_TYPE_TELETEXT	4	/* Does teletext */
59 #define	VID_TYPE_OVERLAY	8	/* Overlay onto frame buffer */
60 #define	VID_TYPE_CHROMAKEY	16	/* Overlay by chromakey */
61 #define	VID_TYPE_CLIPPING	32	/* Can clip */
62 #define	VID_TYPE_FRAMERAM	64	/* Uses the frame buffer memory */
63 #define	VID_TYPE_SCALES		128	/* Scalable */
64 #define	VID_TYPE_MONOCHROME	256	/* Monochrome only */
65 #define	VID_TYPE_SUBCAPTURE	512	/* Can capture subareas of the image */
66 #define	VID_TYPE_MPEG_DECODER	1024	/* Can decode MPEG streams */
67 #define	VID_TYPE_MPEG_ENCODER	2048	/* Can encode MPEG streams */
68 #define	VID_TYPE_MJPEG_DECODER	4096	/* Can decode MJPEG streams */
69 #define	VID_TYPE_MJPEG_ENCODER	8192	/* Can encode MJPEG streams */
70 
71 /*
72  *	M I S C E L L A N E O U S
73  */
74 
75 /*  Four-character-code (FOURCC) */
76 #define	v4l2_fourcc(a, b, c, d) \
77 	(((uint32_t)(a)<<0) | ((uint32_t)(b)<<8) | \
78 	((uint32_t)(c)<<16)|((uint32_t)(d)<<24))
79 
80 /*
81  *	E N U M S
82  */
83 enum v4l2_field {
84 
85 	/*
86 	 * driver can choose from none, top, bottom, interlaced
87 	 * depending on whatever it thinks is approximate ...
88 	 */
89 	V4L2_FIELD_ANY		= 0,
90 	V4L2_FIELD_NONE		= 1, /* this device has no fields ... */
91 	V4L2_FIELD_TOP		= 2, /* top field only */
92 	V4L2_FIELD_BOTTOM	= 3, /* bottom field only */
93 	V4L2_FIELD_INTERLACED	= 4, /* both fields interlaced */
94 
95 	/* both fields sequential into one buffer, top-bottom order */
96 	V4L2_FIELD_SEQ_TB	= 5,
97 
98 	V4L2_FIELD_SEQ_BT	= 6, /* same as above + bottom-top order */
99 
100 	/* both fields alternating into	separate buffers */
101 	V4L2_FIELD_ALTERNATE	= 7
102 };
103 #define	V4L2_FIELD_HAS_TOP(field)	 \
104 	((field) == V4L2_FIELD_TOP	|| \
105 	(field) == V4L2_FIELD_INTERLACED || \
106 	(field) == V4L2_FIELD_SEQ_TB	|| \
107 	(field) == V4L2_FIELD_SEQ_BT)
108 #define	V4L2_FIELD_HAS_BOTTOM(field)	 \
109 	((field) == V4L2_FIELD_BOTTOM	|| \
110 	(field) == V4L2_FIELD_INTERLACED || \
111 	(field) == V4L2_FIELD_SEQ_TB	|| \
112 	(field) == V4L2_FIELD_SEQ_BT)
113 #define	V4L2_FIELD_HAS_BOTH(field)	 \
114 	((field) == V4L2_FIELD_INTERLACED || \
115 	(field) == V4L2_FIELD_SEQ_TB	|| \
116 	(field) == V4L2_FIELD_SEQ_BT)
117 
118 enum v4l2_buf_type {
119 	V4L2_BUF_TYPE_VIDEO_CAPTURE	 = 1,
120 	V4L2_BUF_TYPE_VIDEO_OUTPUT	 = 2,
121 	V4L2_BUF_TYPE_VIDEO_OVERLAY	 = 3,
122 	V4L2_BUF_TYPE_VBI_CAPTURE	 = 4,
123 	V4L2_BUF_TYPE_VBI_OUTPUT	 = 5,
124 #if 1
125 	/* Experimental Sliced VBI */
126 	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
127 	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT  = 7,
128 #endif
129 	V4L2_BUF_TYPE_PRIVATE		 = 0x80
130 };
131 
132 enum v4l2_ctrl_type {
133 	V4L2_CTRL_TYPE_INTEGER		= 1,
134 	V4L2_CTRL_TYPE_BOOLEAN		= 2,
135 	V4L2_CTRL_TYPE_MENU		= 3,
136 	V4L2_CTRL_TYPE_BUTTON		= 4,
137 	V4L2_CTRL_TYPE_INTEGER64	= 5,
138 	V4L2_CTRL_TYPE_CTRL_CLASS	= 6
139 };
140 
141 enum v4l2_tuner_type {
142 	V4L2_TUNER_RADIO	= 1,
143 	V4L2_TUNER_ANALOG_TV	= 2,
144 	V4L2_TUNER_DIGITAL_TV	= 3
145 };
146 
147 enum v4l2_memory {
148 	V4L2_MEMORY_MMAP	= 1,
149 	V4L2_MEMORY_USERPTR	= 2,
150 	V4L2_MEMORY_OVERLAY	= 3
151 };
152 
153 /* see also http: vektor.theorem.ca/graphics/ycbcr/ */
154 enum v4l2_colorspace {
155 	/* ITU-R 601 -- broadcast NTSC/PAL */
156 	V4L2_COLORSPACE_SMPTE170M	= 1,
157 
158 	/* 1125-Line (US) HDTV */
159 	V4L2_COLORSPACE_SMPTE240M	= 2,
160 
161 	/* HD and modern captures. */
162 	V4L2_COLORSPACE_REC709		= 3,
163 
164 	/* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
165 	V4L2_COLORSPACE_BT878		= 4,
166 
167 	/* These should be useful.  Assume 601 extents. */
168 	V4L2_COLORSPACE_470_SYSTEM_M  = 5,
169 	V4L2_COLORSPACE_470_SYSTEM_BG = 6,
170 
171 	/*
172 	 * I know there will be cameras that send this.  So, this is
173 	 * unspecified chromaticities and full 0-255 on each of the
174 	 * Y'CbCr components
175 	 */
176 	V4L2_COLORSPACE_JPEG		= 7,
177 
178 	/* For RGB colourspaces, this is probably a good start. */
179 	V4L2_COLORSPACE_SRGB		= 8
180 };
181 
182 enum v4l2_priority {
183 	V4L2_PRIORITY_UNSET	  = 0,	/* not initialized */
184 	V4L2_PRIORITY_BACKGROUND  = 1,
185 	V4L2_PRIORITY_INTERACTIVE = 2,
186 	V4L2_PRIORITY_RECORD	  = 3,
187 	V4L2_PRIORITY_DEFAULT	  = V4L2_PRIORITY_INTERACTIVE
188 };
189 
190 struct v4l2_rect {
191 	int32_t   left;
192 	int32_t   top;
193 	int32_t   width;
194 	int32_t   height;
195 };
196 
197 struct v4l2_fract {
198 	uint32_t   numerator;
199 	uint32_t   denominator;
200 };
201 
202 /*
203  *	D R I V E R   C A P A B I L I T I E S
204  */
205 struct v4l2_capability
206 {
207 	uint8_t		driver[16];	/* i.e. "bttv" */
208 	uint8_t		card[32];	/* i.e. "Hauppauge WinTV" */
209 	uint8_t		bus_info[32];	/* "PCI:" + pci_name(pci_dev) */
210 	uint32_t	version;	/* should use KERNEL_VERSION() */
211 	uint32_t	capabilities;	/* Device capabilities */
212 	uint32_t	reserved[4];
213 };
214 
215 /* Values for 'capabilities' field */
216 
217 /* Is a video capture device */
218 #define	V4L2_CAP_VIDEO_CAPTURE		0x00000001
219 
220 /* Is a video output device */
221 #define	V4L2_CAP_VIDEO_OUTPUT		0x00000002
222 #define	V4L2_CAP_VIDEO_OVERLAY		0x00000004  /* Can do video overlay */
223 
224 /* Is a raw VBI capture device */
225 #define	V4L2_CAP_VBI_CAPTURE		0x00000010
226 
227 /* Is a raw VBI output device */
228 #define	V4L2_CAP_VBI_OUTPUT		0x00000020
229 #if 1
230 
231 /* Is a sliced VBI capture device */
232 #define	V4L2_CAP_SLICED_VBI_CAPTURE	0x00000040
233 
234 /* Is a sliced VBI output device */
235 #define	V4L2_CAP_SLICED_VBI_OUTPUT	0x00000080
236 #endif
237 #define	V4L2_CAP_RDS_CAPTURE		0x00000100  /* RDS data capture */
238 
239 #define	V4L2_CAP_TUNER			0x00010000  /* has a tuner */
240 #define	V4L2_CAP_AUDIO			0x00020000  /* has audio support */
241 #define	V4L2_CAP_RADIO			0x00040000  /* is a radio device */
242 
243 #define	V4L2_CAP_READWRITE		0x01000000  /* read/write systemcalls */
244 #define	V4L2_CAP_ASYNCIO		0x02000000  /* async I/O */
245 #define	V4L2_CAP_STREAMING		0x04000000  /* streaming I/O ioctls */
246 
247 /*
248  *	V I D E O   I M A G E	F O R M A T
249  */
250 struct v4l2_pix_format
251 {
252 	uint32_t		width;
253 	uint32_t		height;
254 	uint32_t		pixelformat;
255 	enum			v4l2_field	field;
256 	uint32_t		bytesperline; /* for padding, zero if unused */
257 	uint32_t		sizeimage;
258 	enum v4l2_colorspace	colorspace;
259 	uint32_t		priv; /* private data, depends on pixelformat */
260 };
261 
262 /*	Pixel format		FOURCC			depth Description */
263 #define	V4L2_PIX_FMT_RGB332  v4l2_fourcc('R', 'G', 'B', '1') /*  8 RGB-3-3-2 */
264 #define	V4L2_PIX_FMT_RGB555  v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
265 #define	V4L2_PIX_FMT_RGB565  v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
266 
267 /* 16 RGB-5-5-5 BE */
268 #define	V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q')
269 
270 /* 16 RGB-5-6-5 BE */
271 #define	V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R')
272 
273 #define	V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
274 #define	V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
275 #define	V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
276 #define	V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
277 #define	V4L2_PIX_FMT_GREY  v4l2_fourcc('G', 'R', 'E', 'Y') /*  8 Greyscale */
278 #define	V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /*	9 YVU 4:1:0 */
279 #define	V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
280 #define	V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
281 #define	V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
282 
283 /* 16 YVU422 planar */
284 #define	V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P')
285 
286 /* 16 YVU411 planar */
287 #define	V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P')
288 
289 #define	V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
290 
291 /* two planes -- one Y, one Cr + Cb interleaved  */
292 #define	V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
293 #define	V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
294 
295 /* The following formats are not defined in the V4L2 specification */
296 #define	V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
297 #define	V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12  YUV 4:2:0 */
298 #define	V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16  YUV 4:2:2 */
299 #define	V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit colo */
300 
301 /* 8  YUV 4:1:1 16x16 macroblocks */
302 #define	V4L2_PIX_FMT_HM12    v4l2_fourcc('H', 'M', '1', '2')
303 
304 /* see www.siliconimaging.com/RGB%20Bayer.htm */
305 
306 /* 8 BGBG.. GRGR.. */
307 #define	V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1')
308 
309 /* compressed formats */
310 
311 /* Motion-JPEG */
312 #define	V4L2_PIX_FMT_MJPEG	v4l2_fourcc('M', 'J', 'P', 'G')
313 #define	V4L2_PIX_FMT_JPEG	v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
314 #define	V4L2_PIX_FMT_DV		v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
315 #define	V4L2_PIX_FMT_MPEG	v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
316 
317 /*  Vendor-specific formats   */
318 
319 /* Winnov hw compress */
320 #define	V4L2_PIX_FMT_WNVA	v4l2_fourcc('W', 'N', 'V', 'A')
321 
322 /* SN9C10x compression */
323 #define	V4L2_PIX_FMT_SN9C10X	v4l2_fourcc('S', '9', '1', '0')
324 
325 /* pwc older webcam */
326 #define	V4L2_PIX_FMT_PWC1	v4l2_fourcc('P', 'W', 'C', '1')
327 
328 /* pwc newer webcam */
329 #define	V4L2_PIX_FMT_PWC2	v4l2_fourcc('P', 'W', 'C', '2')
330 
331 /* ET61X251 compression */
332 #define	V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5')
333 
334 /*
335  *	F O R M A T   E N U M E R A T I O N
336  */
337 struct v4l2_fmtdesc
338 {
339 	uint32_t		index;			/* Format number */
340 	enum			v4l2_buf_type  type;	/* buffer type */
341 	uint32_t		flags;
342 	char			description[32];   /* Description string */
343 	uint32_t		pixelformat;	   /* Format fourcc	 */
344 	uint32_t		reserved[4];
345 };
346 
347 #define	V4L2_FMT_FLAG_COMPRESSED 0x0001
348 
349 /*
350  *	T I M E C O D E
351  */
352 struct v4l2_timecode
353 {
354 	uint32_t	type;
355 	uint32_t	flags;
356 	uint8_t	frames;
357 	uint8_t	seconds;
358 	uint8_t	minutes;
359 	uint8_t	hours;
360 	uint8_t	userbits[4];
361 };
362 
363 /*  Type  */
364 #define	V4L2_TC_TYPE_24FPS		1
365 #define	V4L2_TC_TYPE_25FPS		2
366 #define	V4L2_TC_TYPE_30FPS		3
367 #define	V4L2_TC_TYPE_50FPS		4
368 #define	V4L2_TC_TYPE_60FPS		5
369 
370 /*  Flags  */
371 #define	V4L2_TC_FLAG_DROPFRAME		0x0001 /* "drop-frame" mode */
372 #define	V4L2_TC_FLAG_COLORFRAME		0x0002
373 #define	V4L2_TC_USERBITS_field		0x000C
374 #define	V4L2_TC_USERBITS_USERDEFINED	0x0000
375 #define	V4L2_TC_USERBITS_8BITCHARS	0x0008
376 /* The above is based on SMPTE timecodes */
377 
378 #ifdef __KERNEL__
379 /*
380  *	M P E G   C O M P R E S S I O N   P A R A M E T E R S
381  *
382  *  ### WARNING: This experimental MPEG compression API is obsolete.
383  *  ###		It is replaced by the MPEG controls API.
384  *  ###		This old API will disappear in the near future!
385  *
386  */
387 enum v4l2_bitrate_mode {
388 	V4L2_BITRATE_NONE = 0,	/* not specified */
389 	V4L2_BITRATE_CBR,	/* constant bitrate */
390 	V4L2_BITRATE_VBR	/* variable bitrate */
391 };
392 struct v4l2_bitrate {
393 	/* rates are specified in kbit/sec */
394 	enum v4l2_bitrate_mode	mode;
395 	uint32_t			min;
396 	uint32_t			target;  /* use this one for CBR */
397 	uint32_t			max;
398 };
399 
400 enum v4l2_mpeg_streamtype {
401 	V4L2_MPEG_SS_1,		/* MPEG-1 system stream */
402 	V4L2_MPEG_PS_2,		/* MPEG-2 program stream */
403 	V4L2_MPEG_TS_2,		/* MPEG-2 transport stream */
404 
405 	/* MPEG-2 program stream with DVD header fixups */
406 	V4L2_MPEG_PS_DVD
407 };
408 enum v4l2_mpeg_audiotype {
409 	V4L2_MPEG_AU_2_I,	/* MPEG-2 layer 1 */
410 	V4L2_MPEG_AU_2_II,	/* MPEG-2 layer 2 */
411 	V4L2_MPEG_AU_2_III,	/* MPEG-2 layer 3 */
412 	V4L2_MPEG_AC3,		/* AC3 */
413 	V4L2_MPEG_LPCM		/* LPCM */
414 };
415 enum v4l2_mpeg_videotype {
416 	V4L2_MPEG_VI_1,		/* MPEG-1 */
417 	V4L2_MPEG_VI_2		/* MPEG-2 */
418 };
419 enum v4l2_mpeg_aspectratio {
420 	V4L2_MPEG_ASPECT_SQUARE	= 1,	/* square pixel */
421 	V4L2_MPEG_ASPECT_4_3	= 2,	/* 4 : 3 */
422 	V4L2_MPEG_ASPECT_16_9	= 3,	/* 16 : 9 */
423 	V4L2_MPEG_ASPECT_1_221	= 4	/* 1 : 2,21 */
424 };
425 
426 struct v4l2_mpeg_compression {
427 	/* general */
428 	enum v4l2_mpeg_streamtype	st_type;
429 	struct v4l2_bitrate		st_bitrate;
430 
431 	/* transport streams */
432 	uint16_t				ts_pid_pmt;
433 	uint16_t				ts_pid_audio;
434 	uint16_t				ts_pid_video;
435 	uint16_t				ts_pid_pcr;
436 
437 	/* program stream */
438 	uint16_t				ps_size;
439 	uint16_t				reserved_1;    /* align */
440 
441 	/* audio */
442 	enum v4l2_mpeg_audiotype	au_type;
443 	struct v4l2_bitrate		au_bitrate;
444 	uint32_t			au_sample_rate;
445 	uint8_t 			au_pesid;
446 	uint8_t 			reserved_2[3]; /* align */
447 
448 	/* video */
449 	enum v4l2_mpeg_videotype	vi_type;
450 	enum v4l2_mpeg_aspectratio	vi_aspect_ratio;
451 	struct v4l2_bitrate		vi_bitrate;
452 	uint32_t			vi_frame_rate;
453 	uint16_t			vi_frames_per_gop;
454 	uint16_t			vi_bframes_count;
455 	uint8_t 			vi_pesid;
456 	uint8_t 			reserved_3[3]; /* align */
457 
458 	/* misc flags */
459 	uint32_t			closed_gops:1;
460 	uint32_t			pulldown:1;
461 	uint32_t			reserved_4:30; /* align */
462 
463 	/* I don't expect the above being perfect yet ;) */
464 	uint32_t				reserved_5[8];
465 };
466 #endif
467 
468 struct v4l2_jpegcompression
469 {
470 	int quality;
471 
472 	/* Number of APP segment to be written, must be 0..15 */
473 	int  APPn;
474 
475 	int  APP_len;		/* Length of data in JPEG APPn segment */
476 	char APP_data[60];	/* Data in the JPEG APPn segment. */
477 
478 	int  COM_len;		/* Length of data in JPEG COM segment */
479 	char COM_data[60];	/* Data in JPEG COM segment */
480 
481 	/*
482 	 * Which markers should go into the JPEG output. Unless you exactly
483 	 * know what you do, leave them untouched. Inluding less markers will
484 	 * make the resulting code smaller, but there will be fewer
485 	 * aplications which can read it. The presence of the APP and COM
486 	 * marker is influenced by APP_len and COM_len
487 	 * ONLY, not by this property!
488 	 */
489 	uint32_t jpeg_markers;
490 
491 #define	V4L2_JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
492 #define	V4L2_JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
493 #define	V4L2_JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
494 #define	V4L2_JPEG_MARKER_COM (1<<6)    /* Comment segment */
495 
496 /* App segment, driver will allways use APP0 */
497 #define	V4L2_JPEG_MARKER_APP (1<<7)
498 };
499 
500 /*
501  *	M E M O R Y - M A P P I N G   B U F F E R S
502  */
503 struct v4l2_requestbuffers
504 {
505 	uint32_t			count;
506 	enum v4l2_buf_type	type;
507 	enum v4l2_memory	memory;
508 	uint32_t			reserved[2];
509 };
510 
511 /*
512  * this structure is defined to replace timeval structure which includes
513  * "long" type elements
514  */
515 struct v4l2_timeval {
516 	uint64_t	tv_sec;	/* seconds */
517 	uint64_t	tv_usec; /* and microseconds */
518 };
519 
520 /* this structure is now 64bits alignment */
521 struct v4l2_buffer
522 {
523 	uint32_t			index;
524 	uint32_t			bytesused;
525 	enum v4l2_buf_type	type;
526 	enum v4l2_field		field;
527 	struct v4l2_timeval		timestamp;
528 	struct v4l2_timecode	timecode;
529 	uint32_t			flags;
530 	uint32_t			sequence;
531 	union {
532 		uint32_t	   offset;
533 		uint64_t   userptr;
534 	} m;
535 	/* memory location */
536 	enum v4l2_memory	memory;
537 	uint32_t			length;
538 	uint32_t			input;
539 	uint32_t			reserved;
540 };
541 
542 /*  Flags for 'flags' field */
543 #define	V4L2_BUF_FLAG_MAPPED	0x0001	/* Buffer is mapped (flag) */
544 #define	V4L2_BUF_FLAG_QUEUED	0x0002	/* Buffer is queued for processing */
545 #define	V4L2_BUF_FLAG_DONE	0x0004	/* Buffer is ready */
546 #define	V4L2_BUF_FLAG_KEYFRAME	0x0008	/* Image is a keyframe (I-frame) */
547 #define	V4L2_BUF_FLAG_PFRAME	0x0010	/* Image is a P-frame */
548 #define	V4L2_BUF_FLAG_BFRAME	0x0020	/* Image is a B-frame */
549 #define	V4L2_BUF_FLAG_TIMECODE	0x0100	/* timecode field is valid */
550 #define	V4L2_BUF_FLAG_INPUT	0x0200	/* input field is valid */
551 
552 /*
553  *	O V E R L A Y	P R E V I E W
554  */
555 struct v4l2_framebuffer
556 {
557 	uint32_t			capability;
558 	uint32_t			flags;
559 /*
560  * FIXME: in theory we should pass something like PCI device + memory
561  * region + offset instead of some physical address
562  */
563 	void*			base;
564 	struct v4l2_pix_format	fmt;
565 };
566 /*  Flags for the 'capability' field. Read only */
567 #define	V4L2_FBUF_CAP_EXTERNOVERLAY	0x0001
568 #define	V4L2_FBUF_CAP_CHROMAKEY		0x0002
569 #define	V4L2_FBUF_CAP_LIST_CLIPPING	0x0004
570 #define	V4L2_FBUF_CAP_BITMAP_CLIPPING	0x0008
571 /*  Flags for the 'flags' field. */
572 #define	V4L2_FBUF_FLAG_PRIMARY		0x0001
573 #define	V4L2_FBUF_FLAG_OVERLAY		0x0002
574 #define	V4L2_FBUF_FLAG_CHROMAKEY	0x0004
575 
576 struct v4l2_clip
577 {
578 	struct v4l2_rect	c;
579 	struct v4l2_clip	 *next; /* __user */
580 };
581 
582 struct v4l2_window
583 {
584 	struct v4l2_rect	w;
585 	enum v4l2_field 	field;
586 	uint32_t			chromakey;
587 	struct v4l2_clip	 *clips; /* __user */
588 	uint32_t			clipcount;
589 	void			 *bitmap; /* __user */
590 };
591 
592 /*
593  *	C A P T U R E	P A R A M E T E R S
594  */
595 struct v4l2_captureparm
596 {
597 	uint32_t	capability;	  /*  Supported modes */
598 	uint32_t	capturemode;	  /*  Current mode */
599 
600 	/*  Time per frame in .1us units */
601 	struct		v4l2_fract  timeperframe;
602 	uint32_t	extendedmode;  /*  Driver-specific extensions */
603 	uint32_t	readbuffers;   /*  # of buffers for read */
604 	uint32_t	reserved[4];
605 };
606 
607 /*  Flags for 'capability' and 'capturemode' fields */
608 #define	V4L2_MODE_HIGHQUALITY	0x0001	/*  High quality imaging mode */
609 #define	V4L2_CAP_TIMEPERFRAME	0x1000	/*  timeperframe field is supported */
610 
611 struct v4l2_outputparm
612 {
613 	uint32_t	capability;	 /*  Supported modes */
614 	uint32_t	outputmode;	 /*  Current mode */
615 
616 	/*  Time per frame in seconds */
617 	struct		v4l2_fract  timeperframe;
618 	uint32_t	extendedmode; /*  Driver-specific extensions */
619 	uint32_t	writebuffers; /*	# of buffers for write */
620 	uint32_t	reserved[4];
621 };
622 
623 /*
624  *	I N P U T   I M A G E	C R O P P I N G
625  */
626 struct v4l2_cropcap {
627 	enum v4l2_buf_type	type;
628 	struct v4l2_rect	bounds;
629 	struct v4l2_rect	defrect;
630 	struct v4l2_fract	pixelaspect;
631 };
632 
633 struct v4l2_crop {
634 	enum v4l2_buf_type	type;
635 	struct v4l2_rect	c;
636 };
637 
638 /*
639  *	A N A L O G   V I D E O   S T A N D A R D
640  */
641 
642 typedef uint64_t v4l2_std_id;
643 
644 /* one bit for each */
645 #define	V4L2_STD_PAL_B		((v4l2_std_id)0x00000001)
646 #define	V4L2_STD_PAL_B1 	((v4l2_std_id)0x00000002)
647 #define	V4L2_STD_PAL_G		((v4l2_std_id)0x00000004)
648 #define	V4L2_STD_PAL_H		((v4l2_std_id)0x00000008)
649 #define	V4L2_STD_PAL_I		((v4l2_std_id)0x00000010)
650 #define	V4L2_STD_PAL_D		((v4l2_std_id)0x00000020)
651 #define	V4L2_STD_PAL_D1 	((v4l2_std_id)0x00000040)
652 #define	V4L2_STD_PAL_K		((v4l2_std_id)0x00000080)
653 
654 #define	V4L2_STD_PAL_M		((v4l2_std_id)0x00000100)
655 #define	V4L2_STD_PAL_N		((v4l2_std_id)0x00000200)
656 #define	V4L2_STD_PAL_Nc 	((v4l2_std_id)0x00000400)
657 #define	V4L2_STD_PAL_60 	((v4l2_std_id)0x00000800)
658 
659 #define	V4L2_STD_NTSC_M 	((v4l2_std_id)0x00001000)
660 #define	V4L2_STD_NTSC_M_JP	((v4l2_std_id)0x00002000)
661 #define	V4L2_STD_NTSC_443	((v4l2_std_id)0x00004000)
662 #define	V4L2_STD_NTSC_M_KR	((v4l2_std_id)0x00008000)
663 
664 #define	V4L2_STD_SECAM_B	((v4l2_std_id)0x00010000)
665 #define	V4L2_STD_SECAM_D	((v4l2_std_id)0x00020000)
666 #define	V4L2_STD_SECAM_G	((v4l2_std_id)0x00040000)
667 #define	V4L2_STD_SECAM_H	((v4l2_std_id)0x00080000)
668 #define	V4L2_STD_SECAM_K	((v4l2_std_id)0x00100000)
669 #define	V4L2_STD_SECAM_K1	((v4l2_std_id)0x00200000)
670 #define	V4L2_STD_SECAM_L	((v4l2_std_id)0x00400000)
671 #define	V4L2_STD_SECAM_LC	((v4l2_std_id)0x00800000)
672 
673 /* ATSC/HDTV */
674 #define	V4L2_STD_ATSC_8_VSB	((v4l2_std_id)0x01000000)
675 #define	V4L2_STD_ATSC_16_VSB	((v4l2_std_id)0x02000000)
676 
677 /* some merged standards */
678 #define	V4L2_STD_MN \
679 	(V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
680 #define	V4L2_STD_B \
681 	(V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
682 #define	V4L2_STD_GH \
683 	(V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
684 #define	V4L2_STD_DK	(V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
685 
686 /* some common needed stuff */
687 #define	V4L2_STD_PAL_BG		(V4L2_STD_PAL_B		|\
688 				V4L2_STD_PAL_B1	|\
689 				V4L2_STD_PAL_G)
690 #define	V4L2_STD_PAL_DK		(V4L2_STD_PAL_D		|\
691 				V4L2_STD_PAL_D1	|\
692 				V4L2_STD_PAL_K)
693 #define	V4L2_STD_PAL		(V4L2_STD_PAL_BG	|\
694 				V4L2_STD_PAL_DK	|\
695 				V4L2_STD_PAL_H		|\
696 				V4L2_STD_PAL_I)
697 #define	V4L2_STD_NTSC		(V4L2_STD_NTSC_M	|\
698 				V4L2_STD_NTSC_M_JP	|\
699 				V4L2_STD_NTSC_M_KR)
700 #define	V4L2_STD_SECAM_DK	(V4L2_STD_SECAM_D	|\
701 				V4L2_STD_SECAM_K	|\
702 				V4L2_STD_SECAM_K1)
703 #define	V4L2_STD_SECAM		(V4L2_STD_SECAM_B	|\
704 				V4L2_STD_SECAM_G	|\
705 				V4L2_STD_SECAM_H	|\
706 				V4L2_STD_SECAM_DK	|\
707 				V4L2_STD_SECAM_L	|\
708 				V4L2_STD_SECAM_LC)
709 
710 #define	V4L2_STD_525_60		(V4L2_STD_PAL_M		|\
711 				V4L2_STD_PAL_60	|\
712 				V4L2_STD_NTSC		|\
713 				V4L2_STD_NTSC_443)
714 #define	V4L2_STD_625_50		(V4L2_STD_PAL		|\
715 				V4L2_STD_PAL_N		|\
716 				V4L2_STD_PAL_Nc	|\
717 				V4L2_STD_SECAM)
718 #define	V4L2_STD_ATSC		(V4L2_STD_ATSC_8_VSB	|\
719 				V4L2_STD_ATSC_16_VSB)
720 
721 #define	V4L2_STD_UNKNOWN	0
722 #define	V4L2_STD_ALL		(V4L2_STD_525_60	|\
723 				V4L2_STD_625_50)
724 
725 struct v4l2_standard
726 {
727 	uint32_t		index;
728 	v4l2_std_id		id;
729 	uint8_t			name[24];
730 	struct v4l2_fract	frameperiod; /* Frames, not fields */
731 	uint32_t		framelines;
732 	uint32_t		reserved[4];
733 };
734 
735 /*
736  *	V I D E O   I N P U T S
737  */
738 struct v4l2_input
739 {
740 	uint8_t		name[32];	/*  Label */
741 	uint32_t	index;		/*  Which input */
742 	uint32_t	type;		/*  Type of input */
743 	uint32_t	audioset;	/*  Associated audios (bitfield) */
744 	uint32_t	tuner;		/*  Associated tuner */
745 	v4l2_std_id	std;
746 	uint32_t	status;
747 
748 	/*
749 	 * Added for 64bits alignment, or, ENUMINPUT ioctl will fail. Because
750 	 * 32 bits app and 64bits driver will get different structure size
751 	 * which cause the values of ENUMINPUT are different. v4l2_input has a
752 	 * 64-bit element which make v4l2_input structure has to be 64bit
753 	 * alignment.
754 	 */
755 	uint32_t pad;
756 
757 	uint32_t	reserved[4];
758 };
759 
760 /*  Values for the 'type' field */
761 #define	V4L2_INPUT_TYPE_TUNER		1
762 #define	V4L2_INPUT_TYPE_CAMERA		2
763 
764 /* field 'status' - general */
765 #define	V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
766 #define	V4L2_IN_ST_NO_SIGNAL   0x00000002
767 #define	V4L2_IN_ST_NO_COLOR    0x00000004
768 
769 /* field 'status' - analog */
770 #define	V4L2_IN_ST_NO_H_LOCK	0x00000100  /* No horizontal sync lock */
771 #define	V4L2_IN_ST_COLOR_KILL	0x00000200  /* Color killer is active */
772 
773 /* field 'status' - digital */
774 #define	V4L2_IN_ST_NO_SYNC	0x00010000  /* No synchronization lock */
775 #define	V4L2_IN_ST_NO_EQU	0x00020000  /* No equalizer lock */
776 #define	V4L2_IN_ST_NO_CARRIER	0x00040000  /* Carrier recovery failed */
777 
778 /* field 'status' - VCR and set-top box */
779 #define	V4L2_IN_ST_MACROVISION	0x01000000  /* Macrovision detected */
780 #define	V4L2_IN_ST_NO_ACCESS	0x02000000  /* Conditional access denied */
781 #define	V4L2_IN_ST_VTR		0x04000000  /* VTR time constant */
782 
783 /*
784  *	V I D E O   O U T P U T S
785  */
786 struct v4l2_output
787 {
788 	uint32_t	index;		/* Which output */
789 	uint8_t		name[32];	/* Label */
790 	uint32_t	type;		/* Type of output */
791 	uint32_t	audioset;	/* Associated audios (bitfield) */
792 	uint32_t	modulator;	/* Associated modulator */
793 	v4l2_std_id	std;
794 	uint32_t	reserved[4];
795 };
796 /*  Values for the 'type' field */
797 #define	V4L2_OUTPUT_TYPE_MODULATOR		1
798 #define	V4L2_OUTPUT_TYPE_ANALOG			2
799 #define	V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
800 
801 /*
802  *	C O N T R O L S
803  */
804 struct v4l2_control
805 {
806 	uint32_t	id;
807 	int32_t		value;
808 };
809 
810 struct v4l2_ext_control
811 {
812 	uint32_t id;
813 	uint32_t reserved2[2];
814 	union {
815 		int32_t value;
816 		int64_t value64;
817 		void *reserved;
818 	} value;
819 }; /*  __attribute__ ((packed)), comment for solaris to compile */
820 
821 struct v4l2_ext_controls
822 {
823 	uint32_t ctrl_class;
824 	uint32_t count;
825 	uint32_t error_idx;
826 	uint32_t reserved[2];
827 	struct v4l2_ext_control *controls;
828 };
829 
830 /*  Values for ctrl_class field */
831 #define	V4L2_CTRL_CLASS_USER 0x00980000	/* Old-style 'user' controls */
832 #define	V4L2_CTRL_CLASS_MPEG 0x00990000	/* MPEG-compression controls */
833 
834 #define	V4L2_CTRL_ID_MASK	  (0x0fffffff)
835 #define	V4L2_CTRL_ID2CLASS(id)	  ((id) & 0x0fff0000UL)
836 #define	V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
837 
838 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
839 struct v4l2_queryctrl
840 {
841 	uint32_t		id;
842 	enum			v4l2_ctrl_type type;
843 	char			name[32];	/* Whatever */
844 	int32_t			minimum; /* Note signedness */
845 	int32_t			maximum;
846 	int32_t			step;
847 	int32_t			default_value;
848 	uint32_t		flags;
849 	uint32_t		reserved[2];
850 };
851 
852 /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
853 struct v4l2_querymenu
854 {
855 	uint32_t		id;
856 	uint32_t		index;
857 	uint8_t		name[32];	/* Whatever */
858 	uint32_t		reserved;
859 };
860 
861 /*  Control flags  */
862 #define	V4L2_CTRL_FLAG_DISABLED		0x0001
863 #define	V4L2_CTRL_FLAG_GRABBED		0x0002
864 #define	V4L2_CTRL_FLAG_READ_ONLY	0x0004
865 #define	V4L2_CTRL_FLAG_UPDATE		0x0008
866 #define	V4L2_CTRL_FLAG_INACTIVE 	0x0010
867 #define	V4L2_CTRL_FLAG_SLIDER		0x0020
868 
869 /*  Query flag, to be ORed with the control ID */
870 #define	V4L2_CTRL_FLAG_NEXT_CTRL	0x80000000
871 
872 /*  User-class control IDs defined by V4L2 */
873 #define	V4L2_CID_BASE			(V4L2_CTRL_CLASS_USER | 0x900)
874 #define	V4L2_CID_USER_BASE		V4L2_CID_BASE
875 /*  IDs reserved for driver specific controls */
876 #define	V4L2_CID_PRIVATE_BASE		0x08000000
877 
878 #define	V4L2_CID_USER_CLASS		(V4L2_CTRL_CLASS_USER | 1)
879 #define	V4L2_CID_BRIGHTNESS		(V4L2_CID_BASE+0)
880 #define	V4L2_CID_CONTRAST		(V4L2_CID_BASE+1)
881 #define	V4L2_CID_SATURATION		(V4L2_CID_BASE+2)
882 #define	V4L2_CID_HUE			(V4L2_CID_BASE+3)
883 #define	V4L2_CID_AUDIO_VOLUME		(V4L2_CID_BASE+5)
884 #define	V4L2_CID_AUDIO_BALANCE		(V4L2_CID_BASE+6)
885 #define	V4L2_CID_AUDIO_BASS		(V4L2_CID_BASE+7)
886 #define	V4L2_CID_AUDIO_TREBLE		(V4L2_CID_BASE+8)
887 #define	V4L2_CID_AUDIO_MUTE		(V4L2_CID_BASE+9)
888 #define	V4L2_CID_AUDIO_LOUDNESS		(V4L2_CID_BASE+10)
889 #define	V4L2_CID_BLACK_LEVEL		(V4L2_CID_BASE+11)
890 #define	V4L2_CID_AUTO_WHITE_BALANCE	(V4L2_CID_BASE+12)
891 #define	V4L2_CID_DO_WHITE_BALANCE	(V4L2_CID_BASE+13)
892 #define	V4L2_CID_RED_BALANCE		(V4L2_CID_BASE+14)
893 #define	V4L2_CID_BLUE_BALANCE		(V4L2_CID_BASE+15)
894 #define	V4L2_CID_GAMMA			(V4L2_CID_BASE+16)
895 #define	V4L2_CID_WHITENESS		(V4L2_CID_GAMMA) /* ? Not sure */
896 #define	V4L2_CID_EXPOSURE		(V4L2_CID_BASE+17)
897 #define	V4L2_CID_AUTOGAIN		(V4L2_CID_BASE+18)
898 #define	V4L2_CID_GAIN			(V4L2_CID_BASE+19)
899 #define	V4L2_CID_HFLIP			(V4L2_CID_BASE+20)
900 #define	V4L2_CID_VFLIP			(V4L2_CID_BASE+21)
901 #define	V4L2_CID_HCENTER		(V4L2_CID_BASE+22)
902 #define	V4L2_CID_VCENTER		(V4L2_CID_BASE+23)
903 #define	V4L2_CID_LASTP1			(V4L2_CID_BASE+24) /* last CID + 1 */
904 
905 /*  MPEG-class control IDs defined by V4L2 */
906 #define	V4L2_CID_MPEG_BASE			(V4L2_CTRL_CLASS_MPEG | 0x900)
907 #define	V4L2_CID_MPEG_CLASS			(V4L2_CTRL_CLASS_MPEG | 1)
908 
909 /*  MPEG streams */
910 #define	V4L2_CID_MPEG_STREAM_TYPE		(V4L2_CID_MPEG_BASE+0)
911 enum v4l2_mpeg_stream_type {
912 	V4L2_MPEG_STREAM_TYPE_MPEG2_PS	 = 0, /* MPEG-2 program stream */
913 	V4L2_MPEG_STREAM_TYPE_MPEG2_TS	 = 1, /* MPEG-2 transport stream */
914 	V4L2_MPEG_STREAM_TYPE_MPEG1_SS	 = 2, /* MPEG-1 system stream */
915 	V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  = 3, /* MPEG-2 DVD-compatible stream */
916 	V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  = 4, /* MPEG-1 VCD-compatible stream */
917 	V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5 /* MPEG-2 SVCD-compatible stream */
918 };
919 #define	V4L2_CID_MPEG_STREAM_PID_PMT		(V4L2_CID_MPEG_BASE+1)
920 #define	V4L2_CID_MPEG_STREAM_PID_AUDIO		(V4L2_CID_MPEG_BASE+2)
921 #define	V4L2_CID_MPEG_STREAM_PID_VIDEO		(V4L2_CID_MPEG_BASE+3)
922 #define	V4L2_CID_MPEG_STREAM_PID_PCR		(V4L2_CID_MPEG_BASE+4)
923 #define	V4L2_CID_MPEG_STREAM_PES_ID_AUDIO	(V4L2_CID_MPEG_BASE+5)
924 #define	V4L2_CID_MPEG_STREAM_PES_ID_VIDEO	(V4L2_CID_MPEG_BASE+6)
925 #define	V4L2_CID_MPEG_STREAM_VBI_FMT		(V4L2_CID_MPEG_BASE+7)
926 enum v4l2_mpeg_stream_vbi_fmt {
927 	V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,  /* No VBI in the MPEG stream */
928 
929 	/* VBI in private packets, IVTV format */
930 	V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1
931 };
932 
933 /*  MPEG audio */
934 #define	V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ	(V4L2_CID_MPEG_BASE+100)
935 enum v4l2_mpeg_audio_sampling_freq {
936 	V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
937 	V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
938 	V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2
939 };
940 #define	V4L2_CID_MPEG_AUDIO_ENCODING		(V4L2_CID_MPEG_BASE+101)
941 enum v4l2_mpeg_audio_encoding {
942 	V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
943 	V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
944 	V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2
945 };
946 #define	V4L2_CID_MPEG_AUDIO_L1_BITRATE		(V4L2_CID_MPEG_BASE+102)
947 enum v4l2_mpeg_audio_l1_bitrate {
948 	V4L2_MPEG_AUDIO_L1_BITRATE_32K	= 0,
949 	V4L2_MPEG_AUDIO_L1_BITRATE_64K	= 1,
950 	V4L2_MPEG_AUDIO_L1_BITRATE_96K	= 2,
951 	V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
952 	V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
953 	V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
954 	V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
955 	V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
956 	V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
957 	V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
958 	V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
959 	V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
960 	V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
961 	V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13
962 };
963 #define	V4L2_CID_MPEG_AUDIO_L2_BITRATE		(V4L2_CID_MPEG_BASE+103)
964 enum v4l2_mpeg_audio_l2_bitrate {
965 	V4L2_MPEG_AUDIO_L2_BITRATE_32K	= 0,
966 	V4L2_MPEG_AUDIO_L2_BITRATE_48K	= 1,
967 	V4L2_MPEG_AUDIO_L2_BITRATE_56K	= 2,
968 	V4L2_MPEG_AUDIO_L2_BITRATE_64K	= 3,
969 	V4L2_MPEG_AUDIO_L2_BITRATE_80K	= 4,
970 	V4L2_MPEG_AUDIO_L2_BITRATE_96K	= 5,
971 	V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
972 	V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
973 	V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
974 	V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
975 	V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
976 	V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
977 	V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
978 	V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13
979 };
980 #define	V4L2_CID_MPEG_AUDIO_L3_BITRATE		(V4L2_CID_MPEG_BASE+104)
981 enum v4l2_mpeg_audio_l3_bitrate {
982 	V4L2_MPEG_AUDIO_L3_BITRATE_32K	= 0,
983 	V4L2_MPEG_AUDIO_L3_BITRATE_40K	= 1,
984 	V4L2_MPEG_AUDIO_L3_BITRATE_48K	= 2,
985 	V4L2_MPEG_AUDIO_L3_BITRATE_56K	= 3,
986 	V4L2_MPEG_AUDIO_L3_BITRATE_64K	= 4,
987 	V4L2_MPEG_AUDIO_L3_BITRATE_80K	= 5,
988 	V4L2_MPEG_AUDIO_L3_BITRATE_96K	= 6,
989 	V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
990 	V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
991 	V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
992 	V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
993 	V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
994 	V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
995 	V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13
996 };
997 #define	V4L2_CID_MPEG_AUDIO_MODE		(V4L2_CID_MPEG_BASE+105)
998 enum v4l2_mpeg_audio_mode {
999 	V4L2_MPEG_AUDIO_MODE_STEREO		= 0,
1000 	V4L2_MPEG_AUDIO_MODE_JOINT_STEREO	= 1,
1001 	V4L2_MPEG_AUDIO_MODE_DUAL		= 2,
1002 	V4L2_MPEG_AUDIO_MODE_MONO		= 3
1003 };
1004 #define	V4L2_CID_MPEG_AUDIO_MODE_EXTENSION	(V4L2_CID_MPEG_BASE+106)
1005 enum v4l2_mpeg_audio_mode_extension {
1006 	V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4	= 0,
1007 	V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8	= 1,
1008 	V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
1009 	V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3
1010 };
1011 #define	V4L2_CID_MPEG_AUDIO_EMPHASIS		(V4L2_CID_MPEG_BASE+107)
1012 enum v4l2_mpeg_audio_emphasis {
1013 	V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
1014 	V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
1015 	V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2
1016 };
1017 #define	V4L2_CID_MPEG_AUDIO_CRC 		(V4L2_CID_MPEG_BASE+108)
1018 enum v4l2_mpeg_audio_crc {
1019 	V4L2_MPEG_AUDIO_CRC_NONE = 0,
1020 	V4L2_MPEG_AUDIO_CRC_CRC16 = 1
1021 };
1022 
1023 /*  MPEG video */
1024 #define	V4L2_CID_MPEG_VIDEO_ENCODING		(V4L2_CID_MPEG_BASE+200)
1025 enum v4l2_mpeg_video_encoding {
1026 	V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
1027 	V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1
1028 };
1029 #define	V4L2_CID_MPEG_VIDEO_ASPECT		(V4L2_CID_MPEG_BASE+201)
1030 enum v4l2_mpeg_video_aspect {
1031 	V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
1032 	V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
1033 	V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
1034 	V4L2_MPEG_VIDEO_ASPECT_221x100 = 3
1035 };
1036 #define	V4L2_CID_MPEG_VIDEO_B_FRAMES		(V4L2_CID_MPEG_BASE+202)
1037 #define	V4L2_CID_MPEG_VIDEO_GOP_SIZE		(V4L2_CID_MPEG_BASE+203)
1038 #define	V4L2_CID_MPEG_VIDEO_GOP_CLOSURE 	(V4L2_CID_MPEG_BASE+204)
1039 #define	V4L2_CID_MPEG_VIDEO_PULLDOWN		(V4L2_CID_MPEG_BASE+205)
1040 #define	V4L2_CID_MPEG_VIDEO_BITRATE_MODE	(V4L2_CID_MPEG_BASE+206)
1041 enum v4l2_mpeg_video_bitrate_mode {
1042 	V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
1043 	V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1
1044 };
1045 #define	V4L2_CID_MPEG_VIDEO_BITRATE		(V4L2_CID_MPEG_BASE+207)
1046 #define	V4L2_CID_MPEG_VIDEO_BITRATE_PEAK	(V4L2_CID_MPEG_BASE+208)
1047 #define	V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1048 
1049 /* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
1050 #define	V4L2_CID_MPEG_CX2341X_BASE \
1051 	(V4L2_CTRL_CLASS_MPEG | 0x1000)
1052 #define	V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE \
1053 	(V4L2_CID_MPEG_CX2341X_BASE+0)
1054 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
1055 	V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
1056 	V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO   = 1
1057 };
1058 #define	V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER \
1059 	(V4L2_CID_MPEG_CX2341X_BASE+1)
1060 #define	V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE \
1061 	(V4L2_CID_MPEG_CX2341X_BASE+2)
1062 enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
1063 	V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
1064 	V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR  = 1,
1065 	V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
1066 	V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
1067 	V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE =
1068 		4
1069 };
1070 #define	V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE \
1071 	(V4L2_CID_MPEG_CX2341X_BASE+3)
1072 enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
1073 	V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF	  = 0,
1074 	V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1
1075 };
1076 #define	V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE \
1077 	(V4L2_CID_MPEG_CX2341X_BASE+4)
1078 enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
1079 	V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
1080 	V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO   = 1
1081 };
1082 #define	V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER \
1083 	(V4L2_CID_MPEG_CX2341X_BASE+5)
1084 #define	V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE \
1085 	(V4L2_CID_MPEG_CX2341X_BASE+6)
1086 enum v4l2_mpeg_cx2341x_video_median_filter_type {
1087 	V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF		= 0,
1088 	V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR		= 1,
1089 	V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT		= 2,
1090 	V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT	= 3,
1091 	V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG		= 4
1092 };
1093 #define	V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM \
1094 	(V4L2_CID_MPEG_CX2341X_BASE+7)
1095 #define	V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP \
1096 	(V4L2_CID_MPEG_CX2341X_BASE+8)
1097 #define	V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM \
1098 	(V4L2_CID_MPEG_CX2341X_BASE+9)
1099 #define	V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP \
1100 	(V4L2_CID_MPEG_CX2341X_BASE+10)
1101 
1102 /*
1103  *	T U N I N G
1104  */
1105 struct v4l2_tuner
1106 {
1107 	uint32_t	index;
1108 	uint8_t		name[32];
1109 	enum		v4l2_tuner_type	type;
1110 	uint32_t	capability;
1111 	uint32_t	rangelow;
1112 	uint32_t	rangehigh;
1113 	uint32_t	rxsubchans;
1114 	uint32_t	audmode;
1115 	int32_t		signal;
1116 	int32_t		afc;
1117 	uint32_t	reserved[4];
1118 };
1119 
1120 struct v4l2_modulator
1121 {
1122 	uint32_t	index;
1123 	uint8_t		name[32];
1124 	uint32_t	capability;
1125 	uint32_t	rangelow;
1126 	uint32_t	rangehigh;
1127 	uint32_t	txsubchans;
1128 	uint32_t	reserved[4];
1129 };
1130 
1131 /*  Flags for the 'capability' field */
1132 #define	V4L2_TUNER_CAP_LOW		0x0001
1133 #define	V4L2_TUNER_CAP_NORM		0x0002
1134 #define	V4L2_TUNER_CAP_STEREO		0x0010
1135 #define	V4L2_TUNER_CAP_LANG2		0x0020
1136 #define	V4L2_TUNER_CAP_SAP		0x0020
1137 #define	V4L2_TUNER_CAP_LANG1		0x0040
1138 
1139 /*  Flags for the 'rxsubchans' field */
1140 #define	V4L2_TUNER_SUB_MONO		0x0001
1141 #define	V4L2_TUNER_SUB_STEREO		0x0002
1142 #define	V4L2_TUNER_SUB_LANG2		0x0004
1143 #define	V4L2_TUNER_SUB_SAP		0x0004
1144 #define	V4L2_TUNER_SUB_LANG1		0x0008
1145 
1146 /*  Values for the 'audmode' field */
1147 #define	V4L2_TUNER_MODE_MONO		0x0000
1148 #define	V4L2_TUNER_MODE_STEREO		0x0001
1149 #define	V4L2_TUNER_MODE_LANG2		0x0002
1150 #define	V4L2_TUNER_MODE_SAP		0x0002
1151 #define	V4L2_TUNER_MODE_LANG1		0x0003
1152 #define	V4L2_TUNER_MODE_LANG1_LANG2	0x0004
1153 
1154 struct v4l2_frequency
1155 {
1156 	uint32_t		tuner;
1157 	enum			v4l2_tuner_type  type;
1158 	uint32_t		frequency;
1159 	uint32_t		reserved[8];
1160 };
1161 
1162 /*
1163  *	A U D I O
1164  */
1165 struct v4l2_audio
1166 {
1167 	uint32_t	index;
1168 	uint8_t	name[32];
1169 	uint32_t	capability;
1170 	uint32_t	mode;
1171 	uint32_t	reserved[2];
1172 };
1173 
1174 /*  Flags for the 'capability' field */
1175 #define	V4L2_AUDCAP_STEREO		0x00001
1176 #define	V4L2_AUDCAP_AVL			0x00002
1177 
1178 /*  Flags for the 'mode' field */
1179 #define	V4L2_AUDMODE_AVL		0x00001
1180 
1181 struct v4l2_audioout
1182 {
1183 	uint32_t	index;
1184 	uint8_t	name[32];
1185 	uint32_t	capability;
1186 	uint32_t	mode;
1187 	uint32_t	reserved[2];
1188 };
1189 
1190 /*
1191  *	D A T A   S E R V I C E S   ( V B I )
1192  *
1193  *	Data services API by Michael Schimek
1194  */
1195 
1196 /* Raw VBI */
1197 struct v4l2_vbi_format
1198 {
1199 	uint32_t	sampling_rate;		/* in 1 Hz */
1200 	uint32_t	offset;
1201 	uint32_t	samples_per_line;
1202 	uint32_t	sample_format;		/* V4L2_PIX_FMT_* */
1203 	int32_t	start[2];
1204 	uint32_t	count[2];
1205 	uint32_t	flags;			/* V4L2_VBI_* */
1206 	uint32_t	reserved[2];		/* must be zero */
1207 };
1208 
1209 /*  VBI flags  */
1210 #define	V4L2_VBI_UNSYNC		(1<< 0)
1211 #define	V4L2_VBI_INTERLACED	(1<< 1)
1212 
1213 #if 1
1214 /*
1215  * Sliced VBI
1216  *
1217  *    This implements is a proposal V4L2 API to allow SLICED VBI
1218  * required for some hardware encoders. It should change without
1219  * notice in the definitive implementation.
1220  */
1221 
1222 struct v4l2_sliced_vbi_format
1223 {
1224 	uint16_t	service_set;
1225 
1226 	/*
1227 	 * service_lines[0][...] specifies lines 0-23 (1-23 used) of the first
1228 	 * field
1229 	 * service_lines[1][...] specifies lines 0-23 (1-23 used) of the second
1230 	 * field
1231 	 * (equals frame lines 313-336 for 625 line video standards,
1232 	 * 263-286 for 525 line standards)
1233 	 */
1234 	uint16_t   service_lines[2][24];
1235 	uint32_t   io_size;
1236 	uint32_t   reserved[2];	/* must be zero */
1237 };
1238 
1239 /*
1240  * Teletext World System Teletext
1241  * (WST), defined on ITU-R BT.653-2
1242  */
1243 #define	V4L2_SLICED_TELETEXT_B		(0x0001)
1244 /* Video Program System, defined on ETS 300 231 */
1245 #define	V4L2_SLICED_VPS 		(0x0400)
1246 /* Closed Caption, defined on EIA-608 */
1247 #define	V4L2_SLICED_CAPTION_525 	(0x1000)
1248 /* Wide Screen System, defined on ITU-R BT1119.1 */
1249 #define	V4L2_SLICED_WSS_625		(0x4000)
1250 
1251 #define	V4L2_SLICED_VBI_525	(V4L2_SLICED_CAPTION_525)
1252 #define	V4L2_SLICED_VBI_625	(V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | \
1253 				V4L2_SLICED_WSS_625)
1254 
1255 
1256 struct v4l2_sliced_vbi_cap
1257 {
1258 	uint16_t   service_set;
1259 	/*
1260 	 * service_lines[0][...] specifies lines 0-23 (1-23 used) of the first
1261 	 * field
1262 	 * service_lines[1][...] specifies lines 0-23 (1-23 used) of the second
1263 	 * field
1264 	 * (equals frame lines 313-336 for 625 line video standards, 263-286
1265 	 * for 525 line standards)
1266 	 */
1267 	uint16_t   service_lines[2][24];
1268 	uint32_t   reserved[4];    /* must be 0 */
1269 };
1270 
1271 struct v4l2_sliced_vbi_data
1272 {
1273 	uint32_t   id;
1274 	uint32_t   field;	   /* 0: first field, 1: second field */
1275 	uint32_t   line;	   /* 1-23 */
1276 	uint32_t   reserved;	   /* must be 0 */
1277 	uint8_t    data[48];
1278 };
1279 #endif
1280 
1281 /*
1282  *	A G G R E G A T E   S T R U C T U R E S
1283  */
1284 
1285 /*
1286  * Stream data format
1287  */
1288 struct v4l2_format
1289 {
1290 	enum v4l2_buf_type type;
1291 
1292 	/*
1293 	 * Added for 64bits alignment, or, S_FMT ioctl will fail. Because
1294 	 * 32 bits app and 64bits driver will get different structure size
1295 	 * which cause the values of S_FMT are different. v4l2_window has
1296 	 * pointers which make v4l2_format structure has to be 64bit alignment.
1297 	 */
1298 	uint32_t pad;
1299 	union
1300 	{
1301 		struct v4l2_pix_format	pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1302 		struct v4l2_window	win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1303 		struct v4l2_vbi_format	vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1304 #if 1
1305 
1306 		/* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1307 		struct v4l2_sliced_vbi_format	sliced;
1308 #endif
1309 		uint8_t	raw_data[200];			 /* user-defined */
1310 	} fmt;
1311 };
1312 
1313 
1314 /*
1315  * Stream type-dependent parameters
1316  */
1317 struct v4l2_streamparm
1318 {
1319 	enum v4l2_buf_type type;
1320 	union
1321 	{
1322 		struct v4l2_captureparm	capture;
1323 		struct v4l2_outputparm	output;
1324 		uint8_t	raw_data[200];	/* user-defined */
1325 	} parm;
1326 };
1327 
1328 /*
1329  *	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
1330  *
1331  */
1332 #define	VIDIOC_QUERYCAP		_IOR('V',  0, struct v4l2_capability)
1333 #define	VIDIOC_RESERVED		_IO('V',  1)
1334 #define	VIDIOC_ENUM_FMT 	_IOWR('V',  2, struct v4l2_fmtdesc)
1335 #define	VIDIOC_G_FMT		_IOWR('V',  4, struct v4l2_format)
1336 #define	VIDIOC_S_FMT		_IOWR('V',  5, struct v4l2_format)
1337 #ifdef __KERNEL__
1338 #define	VIDIOC_G_MPEGCOMP	_IOR('V',  6, struct v4l2_mpeg_compression)
1339 #define	VIDIOC_S_MPEGCOMP	_IOW('V',  7, struct v4l2_mpeg_compression)
1340 #endif
1341 #define	VIDIOC_REQBUFS		_IOWR('V',  8, struct v4l2_requestbuffers)
1342 #define	VIDIOC_QUERYBUF		_IOWR('V',  9, struct v4l2_buffer)
1343 #define	VIDIOC_G_FBUF		_IOR('V', 10, struct v4l2_framebuffer)
1344 #define	VIDIOC_S_FBUF		_IOW('V', 11, struct v4l2_framebuffer)
1345 #define	VIDIOC_OVERLAY		_IOW('V', 14, int)
1346 #define	VIDIOC_QBUF		_IOWR('V', 15, struct v4l2_buffer)
1347 #define	VIDIOC_DQBUF		_IOWR('V', 17, struct v4l2_buffer)
1348 #define	VIDIOC_STREAMON		_IOW('V', 18, int)
1349 #define	VIDIOC_STREAMOFF	_IOW('V', 19, int)
1350 #define	VIDIOC_G_PARM		_IOWR('V', 21, struct v4l2_streamparm)
1351 #define	VIDIOC_S_PARM		_IOWR('V', 22, struct v4l2_streamparm)
1352 #define	VIDIOC_G_STD		_IOR('V', 23, v4l2_std_id)
1353 #define	VIDIOC_S_STD		_IOW('V', 24, v4l2_std_id)
1354 #define	VIDIOC_ENUMSTD		_IOWR('V', 25, struct v4l2_standard)
1355 #define	VIDIOC_ENUMINPUT	_IOWR('V', 26, struct v4l2_input)
1356 #define	VIDIOC_G_CTRL		_IOWR('V', 27, struct v4l2_control)
1357 #define	VIDIOC_S_CTRL		_IOWR('V', 28, struct v4l2_control)
1358 #define	VIDIOC_G_TUNER		_IOWR('V', 29, struct v4l2_tuner)
1359 #define	VIDIOC_S_TUNER		_IOW('V', 30, struct v4l2_tuner)
1360 #define	VIDIOC_G_AUDIO		_IOR('V', 33, struct v4l2_audio)
1361 #define	VIDIOC_S_AUDIO		_IOW('V', 34, struct v4l2_audio)
1362 #define	VIDIOC_QUERYCTRL	_IOWR('V', 36, struct v4l2_queryctrl)
1363 #define	VIDIOC_QUERYMENU	_IOWR('V', 37, struct v4l2_querymenu)
1364 #define	VIDIOC_G_INPUT		_IOR('V', 38, int)
1365 #define	VIDIOC_S_INPUT		_IOWR('V', 39, int)
1366 #define	VIDIOC_G_OUTPUT		_IOR('V', 46, int)
1367 #define	VIDIOC_S_OUTPUT		_IOWR('V', 47, int)
1368 #define	VIDIOC_ENUMOUTPUT	_IOWR('V', 48, struct v4l2_output)
1369 #define	VIDIOC_G_AUDOUT		_IOR('V', 49, struct v4l2_audioout)
1370 #define	VIDIOC_S_AUDOUT		_IOW('V', 50, struct v4l2_audioout)
1371 #define	VIDIOC_G_MODULATOR	_IOWR('V', 54, struct v4l2_modulator)
1372 #define	VIDIOC_S_MODULATOR	_IOW('V', 55, struct v4l2_modulator)
1373 #define	VIDIOC_G_FREQUENCY	_IOWR('V', 56, struct v4l2_frequency)
1374 #define	VIDIOC_S_FREQUENCY	_IOW('V', 57, struct v4l2_frequency)
1375 #define	VIDIOC_CROPCAP		_IOWR('V', 58, struct v4l2_cropcap)
1376 #define	VIDIOC_G_CROP		_IOWR('V', 59, struct v4l2_crop)
1377 #define	VIDIOC_S_CROP		_IOW('V', 60, struct v4l2_crop)
1378 #define	VIDIOC_G_JPEGCOMP	_IOR('V', 61, struct v4l2_jpegcompression)
1379 #define	VIDIOC_S_JPEGCOMP	_IOW('V', 62, struct v4l2_jpegcompression)
1380 #define	VIDIOC_QUERYSTD 	_IOR('V', 63, v4l2_std_id)
1381 #define	VIDIOC_TRY_FMT		_IOWR('V', 64, struct v4l2_format)
1382 #define	VIDIOC_ENUMAUDIO	_IOWR('V', 65, struct v4l2_audio)
1383 #define	VIDIOC_ENUMAUDOUT	_IOWR('V', 66, struct v4l2_audioout)
1384 #define	VIDIOC_G_PRIORITY	_IOR('V', 67, enum v4l2_priority)
1385 #define	VIDIOC_S_PRIORITY	_IOW('V', 68, enum v4l2_priority)
1386 #if 1
1387 #define	VIDIOC_G_SLICED_VBI_CAP _IOR('V', 69, struct v4l2_sliced_vbi_cap)
1388 #endif
1389 #define	VIDIOC_LOG_STATUS	_IO('V', 70)
1390 #define	VIDIOC_G_EXT_CTRLS	_IOWR('V', 71, struct v4l2_ext_controls)
1391 #define	VIDIOC_S_EXT_CTRLS	_IOWR('V', 72, struct v4l2_ext_controls)
1392 #define	VIDIOC_TRY_EXT_CTRLS	_IOWR('V', 73, struct v4l2_ext_controls)
1393 
1394 #ifdef __OLD_VIDIOC_
1395 /* for compatibility, will go away some day */
1396 #define	VIDIOC_OVERLAY_OLD	_IOWR('V', 14, int)
1397 #define	VIDIOC_S_PARM_OLD	_IOW('V', 22, struct v4l2_streamparm)
1398 #define	VIDIOC_S_CTRL_OLD	_IOW('V', 28, struct v4l2_control)
1399 #define	VIDIOC_G_AUDIO_OLD	_IOWR('V', 33, struct v4l2_audio)
1400 #define	VIDIOC_G_AUDOUT_OLD	_IOWR('V', 49, struct v4l2_audioout)
1401 #define	VIDIOC_CROPCAP_OLD	_IOR('V', 58, struct v4l2_cropcap)
1402 #endif
1403 
1404 #define	BASE_VIDIOC_PRIVATE	192		/* 192-255 are private */
1405 
1406 
1407 #ifdef	__cplusplus
1408 }
1409 #endif
1410 
1411 #endif /* __LINUX_VIDEODEV2_H */
1412 
1413 /*
1414  * Local variables:
1415  * c-basic-offset: 8
1416  * End:
1417  */
1418