| 1 | /* $NetBSD: videoio.h,v 1.9 2015/09/06 06:01:02 dholland Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 2005, 2008 Jared D. McNeill <jmcneill@invisible.ca> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. The name of the author may not be used to endorse or promote products |
| 13 | * derived from this software without specific prior written permission. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 20 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 22 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 23 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 25 | * SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | /* See http://v4l2spec.bytesex.org/ for Video4Linux 2 specifications */ |
| 29 | |
| 30 | #ifndef _HAVE_SYS_VIDEOIO_H |
| 31 | #define _HAVE_SYS_VIDEOIO_H |
| 32 | |
| 33 | #include <sys/types.h> |
| 34 | #include <sys/ioccom.h> |
| 35 | #include <sys/time.h> |
| 36 | #ifdef _KERNEL |
| 37 | #include <compat/sys/time.h> |
| 38 | #endif |
| 39 | |
| 40 | #ifndef _KERNEL |
| 41 | #define __u64 uint64_t |
| 42 | #define __u32 uint32_t |
| 43 | #define __u16 uint16_t |
| 44 | #define __u8 uint8_t |
| 45 | #define __s64 int64_t |
| 46 | #define __s32 int32_t |
| 47 | #define __s16 int16_t |
| 48 | #define __s8 int8_t |
| 49 | #endif |
| 50 | |
| 51 | typedef uint64_t v4l2_std_id; |
| 52 | #define v4l2_fourcc(a,b,c,d) (((uint32_t)(a) << 0) | \ |
| 53 | ((uint32_t)(b) << 8) | \ |
| 54 | ((uint32_t)(c) << 16) | \ |
| 55 | ((uint32_t)(d) << 24)) |
| 56 | #if 0 |
| 57 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
| 58 | #endif |
| 59 | |
| 60 | #define V4L2_CTRL_ID2CLASS(id) ((id >> 16) & 0xfff) |
| 61 | #define V4L2_CTRL_ID2CID(id) (id & 0xffff) |
| 62 | |
| 63 | enum v4l2_colorspace { |
| 64 | V4L2_COLORSPACE_SMPTE170M = 1, |
| 65 | V4L2_COLORSPACE_SMPTE240M, |
| 66 | V4L2_COLORSPACE_REC709, |
| 67 | V4L2_COLORSPACE_BT878, |
| 68 | V4L2_COLORSPACE_470_SYSTEM_M, |
| 69 | V4L2_COLORSPACE_470_SYSTEM_BG, |
| 70 | V4L2_COLORSPACE_JPEG, |
| 71 | V4L2_COLORSPACE_SRGB |
| 72 | }; |
| 73 | |
| 74 | enum v4l2_field { |
| 75 | V4L2_FIELD_ANY = 0, |
| 76 | V4L2_FIELD_NONE, |
| 77 | V4L2_FIELD_TOP, |
| 78 | V4L2_FIELD_BOTTOM, |
| 79 | V4L2_FIELD_INTERLACED, |
| 80 | V4L2_FIELD_SEQ_TB, |
| 81 | V4L2_FIELD_SEQ_BT, |
| 82 | V4L2_FIELD_ALTERNATE |
| 83 | }; |
| 84 | |
| 85 | enum v4l2_buf_type { |
| 86 | V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, |
| 87 | V4L2_BUF_TYPE_VIDEO_OUTPUT, |
| 88 | V4L2_BUF_TYPE_VIDEO_OVERLAY, |
| 89 | V4L2_BUF_TYPE_VBI_CAPTURE, |
| 90 | V4L2_BUF_TYPE_VBI_OUTPUT, |
| 91 | V4L2_BUF_TYPE_PRIVATE = 0x80 |
| 92 | }; |
| 93 | |
| 94 | enum v4l2_memory { |
| 95 | V4L2_MEMORY_MMAP = 1, |
| 96 | V4L2_MEMORY_USERPTR, |
| 97 | V4L2_MEMORY_OVERLAY |
| 98 | }; |
| 99 | |
| 100 | enum v4l2_priority { |
| 101 | V4L2_PRIORITY_UNSET = 0, |
| 102 | V4L2_PRIORITY_BACKGROUND, |
| 103 | V4L2_PRIORITY_INTERACTIVE, |
| 104 | V4L2_PRIORITY_RECORD, |
| 105 | V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE |
| 106 | }; |
| 107 | |
| 108 | enum v4l2_tuner_type { |
| 109 | V4L2_TUNER_RADIO = 1, |
| 110 | V4L2_TUNER_ANALOG_TV |
| 111 | }; |
| 112 | |
| 113 | enum v4l2_ctrl_type { |
| 114 | V4L2_CTRL_TYPE_INTEGER = 1, |
| 115 | V4L2_CTRL_TYPE_BOOLEAN, |
| 116 | , |
| 117 | V4L2_CTRL_TYPE_BUTTON |
| 118 | }; |
| 119 | |
| 120 | struct v4l2_timecode { |
| 121 | uint32_t type; |
| 122 | uint32_t flags; |
| 123 | uint8_t frames; |
| 124 | uint8_t seconds; |
| 125 | uint8_t minutes; |
| 126 | uint8_t hours; |
| 127 | uint8_t userbits[4]; |
| 128 | }; |
| 129 | |
| 130 | struct v4l2_pix_format { |
| 131 | uint32_t width; |
| 132 | uint32_t height; |
| 133 | uint32_t pixelformat; |
| 134 | enum v4l2_field field; |
| 135 | uint32_t bytesperline; |
| 136 | uint32_t sizeimage; |
| 137 | enum v4l2_colorspace colorspace; |
| 138 | uint32_t priv; |
| 139 | }; |
| 140 | |
| 141 | struct v4l2_buffer { |
| 142 | uint32_t index; |
| 143 | enum v4l2_buf_type type; |
| 144 | uint32_t bytesused; |
| 145 | uint32_t flags; |
| 146 | enum v4l2_field field; |
| 147 | struct timeval timestamp; |
| 148 | struct v4l2_timecode timecode; |
| 149 | uint32_t sequence; |
| 150 | enum v4l2_memory memory; |
| 151 | union { |
| 152 | uint32_t offset; |
| 153 | unsigned long userptr; |
| 154 | } m; |
| 155 | uint32_t length; |
| 156 | uint32_t input; |
| 157 | uint32_t reserved; |
| 158 | }; |
| 159 | |
| 160 | #ifdef _KERNEL |
| 161 | struct v4l2_buffer50 { |
| 162 | uint32_t index; |
| 163 | enum v4l2_buf_type type; |
| 164 | uint32_t bytesused; |
| 165 | uint32_t flags; |
| 166 | enum v4l2_field field; |
| 167 | struct timeval50 timestamp; |
| 168 | struct v4l2_timecode timecode; |
| 169 | uint32_t sequence; |
| 170 | enum v4l2_memory memory; |
| 171 | union { |
| 172 | uint32_t offset; |
| 173 | unsigned long userptr; |
| 174 | } m; |
| 175 | uint32_t length; |
| 176 | uint32_t input; |
| 177 | uint32_t reserved; |
| 178 | }; |
| 179 | |
| 180 | #endif |
| 181 | struct v4l2_rect { |
| 182 | int32_t left; |
| 183 | int32_t top; |
| 184 | int32_t width; |
| 185 | int32_t height; |
| 186 | }; |
| 187 | |
| 188 | struct v4l2_fract { |
| 189 | uint32_t numerator; |
| 190 | uint32_t denominator; |
| 191 | }; |
| 192 | |
| 193 | struct v4l2_fmtdesc { |
| 194 | uint32_t index; |
| 195 | enum v4l2_buf_type type; |
| 196 | uint32_t flags; |
| 197 | uint8_t description[32]; |
| 198 | uint32_t pixelformat; |
| 199 | uint32_t reserved[4]; |
| 200 | }; |
| 201 | |
| 202 | struct v4l2_clip { |
| 203 | struct v4l2_rect c; |
| 204 | struct v4l2_clip *next; |
| 205 | }; |
| 206 | |
| 207 | struct v4l2_window { |
| 208 | struct v4l2_rect w; |
| 209 | enum v4l2_field field; |
| 210 | uint32_t chromakey; |
| 211 | struct v4l2_clip *clips; |
| 212 | uint32_t clipcount; |
| 213 | void *bitmap; |
| 214 | }; |
| 215 | |
| 216 | struct v4l2_vbi_format { |
| 217 | uint32_t sampling_rate; |
| 218 | uint32_t offset; |
| 219 | uint32_t samples_per_line; |
| 220 | uint32_t sample_format; |
| 221 | uint32_t start[2]; |
| 222 | uint32_t count[2]; |
| 223 | uint32_t flags; |
| 224 | uint32_t reserved[2]; |
| 225 | }; |
| 226 | |
| 227 | /* In the API docs, but not the Linux implementation |
| 228 | * |
| 229 | * struct v4l2_sliced_vbi_format { |
| 230 | * uint32_t service_set; |
| 231 | * uint32_t packet_size; |
| 232 | * uint32_t io_size; |
| 233 | * uint32_t reserved; |
| 234 | * }; |
| 235 | * |
| 236 | * |
| 237 | * struct v4l2_sliced_data { |
| 238 | * uint32_t id; |
| 239 | * uint32_t line; |
| 240 | * uint8_t data[]; |
| 241 | * }; |
| 242 | */ |
| 243 | |
| 244 | struct v4l2_cropcap { |
| 245 | enum v4l2_buf_type type; |
| 246 | struct v4l2_rect bounds; |
| 247 | struct v4l2_rect defrect; |
| 248 | struct v4l2_fract pixelaspect; |
| 249 | }; |
| 250 | |
| 251 | struct v4l2_input { |
| 252 | uint32_t index; |
| 253 | uint8_t name[32]; |
| 254 | uint32_t type; |
| 255 | uint32_t audioset; |
| 256 | uint32_t tuner; |
| 257 | v4l2_std_id std; |
| 258 | uint32_t status; |
| 259 | uint32_t reserved[4]; |
| 260 | }; |
| 261 | |
| 262 | struct v4l2_output { |
| 263 | uint32_t index; |
| 264 | uint8_t name[32]; |
| 265 | uint32_t type; |
| 266 | uint32_t audioset; |
| 267 | uint32_t modulator; |
| 268 | v4l2_std_id std; |
| 269 | uint32_t reserved[4]; |
| 270 | }; |
| 271 | |
| 272 | struct v4l2_audio { |
| 273 | uint32_t index; |
| 274 | uint8_t name[32]; |
| 275 | uint32_t capability; |
| 276 | uint32_t mode; |
| 277 | uint32_t reserved[2]; |
| 278 | }; |
| 279 | |
| 280 | struct v4l2_audioout { |
| 281 | uint32_t index; |
| 282 | uint8_t name[32]; |
| 283 | uint32_t capability; |
| 284 | uint32_t mode; |
| 285 | uint32_t reserved[2]; |
| 286 | }; |
| 287 | |
| 288 | struct v4l2_compression { |
| 289 | uint32_t quality; |
| 290 | uint32_t keyframerate; |
| 291 | uint32_t pframerate; |
| 292 | uint32_t reserved[5]; |
| 293 | }; |
| 294 | |
| 295 | struct v4l2_crop { |
| 296 | enum v4l2_buf_type type; |
| 297 | struct v4l2_rect c; |
| 298 | }; |
| 299 | |
| 300 | struct v4l2_control { |
| 301 | uint32_t id; |
| 302 | int32_t value; |
| 303 | }; |
| 304 | |
| 305 | struct v4l2_framebuffer { |
| 306 | uint32_t capability; |
| 307 | uint32_t flags; |
| 308 | void *base; |
| 309 | struct v4l2_pix_format fmt; |
| 310 | }; |
| 311 | |
| 312 | struct v4l2_standard { |
| 313 | uint32_t index; |
| 314 | v4l2_std_id id; |
| 315 | uint8_t name[24]; |
| 316 | struct v4l2_fract frameperiod; |
| 317 | uint32_t framelines; |
| 318 | uint32_t reserved[4]; |
| 319 | }; |
| 320 | |
| 321 | struct v4l2_format { |
| 322 | enum v4l2_buf_type type; |
| 323 | union { |
| 324 | struct v4l2_pix_format pix; |
| 325 | struct v4l2_window win; |
| 326 | struct v4l2_vbi_format vbi; |
| 327 | uint8_t raw_data[200]; |
| 328 | } fmt; |
| 329 | }; |
| 330 | |
| 331 | struct v4l2_frequency { |
| 332 | uint32_t tuner; |
| 333 | enum v4l2_tuner_type type; |
| 334 | uint32_t frequency; |
| 335 | uint32_t reserved[8]; |
| 336 | }; |
| 337 | |
| 338 | struct v4l2_jpegcompression { |
| 339 | int quality; |
| 340 | int APPn; |
| 341 | int APP_len; |
| 342 | char APP_data[60]; |
| 343 | int COM_len; |
| 344 | char COM_data[60]; |
| 345 | uint32_t jpeg_markers; |
| 346 | }; |
| 347 | |
| 348 | struct v4l2_modulator { |
| 349 | uint32_t index; |
| 350 | uint8_t name[32]; |
| 351 | uint32_t capability; |
| 352 | uint32_t rangelow; |
| 353 | uint32_t rangehigh; |
| 354 | uint32_t txsubchans; |
| 355 | uint32_t reserved[4]; |
| 356 | }; |
| 357 | |
| 358 | struct v4l2_captureparm { |
| 359 | uint32_t capability; |
| 360 | uint32_t capturemode; |
| 361 | struct v4l2_fract timeperframe; |
| 362 | uint32_t extendedmode; |
| 363 | uint32_t readbuffers; |
| 364 | uint32_t reserved[4]; |
| 365 | }; |
| 366 | |
| 367 | struct v4l2_outputparm { |
| 368 | uint32_t capability; |
| 369 | uint32_t outputmode; |
| 370 | struct v4l2_fract timeperframe; |
| 371 | uint32_t extendedmode; |
| 372 | uint32_t writebuffers; |
| 373 | uint32_t reserved[4]; |
| 374 | }; |
| 375 | |
| 376 | struct v4l2_streamparm { |
| 377 | enum v4l2_buf_type type; |
| 378 | union { |
| 379 | struct v4l2_captureparm capture; |
| 380 | struct v4l2_outputparm output; |
| 381 | uint8_t raw_data[200]; |
| 382 | } parm; |
| 383 | }; |
| 384 | |
| 385 | struct v4l2_tuner { |
| 386 | uint32_t index; |
| 387 | uint8_t name[32]; |
| 388 | enum v4l2_tuner_type type; |
| 389 | uint32_t capability; |
| 390 | uint32_t rangelow; |
| 391 | uint32_t rangehigh; |
| 392 | uint32_t rxsubchans; |
| 393 | uint32_t audmode; |
| 394 | uint32_t signal; |
| 395 | int32_t afc; |
| 396 | uint32_t reserved[4]; |
| 397 | }; |
| 398 | |
| 399 | struct v4l2_capability { |
| 400 | uint8_t driver[16]; |
| 401 | uint8_t card[32]; |
| 402 | uint8_t bus_info[32]; |
| 403 | uint32_t version; |
| 404 | uint32_t capabilities; |
| 405 | uint32_t reserved[4]; |
| 406 | }; |
| 407 | |
| 408 | struct v4l2_queryctrl { |
| 409 | uint32_t id; |
| 410 | enum v4l2_ctrl_type type; |
| 411 | uint8_t name[32]; |
| 412 | int32_t minimum; |
| 413 | int32_t maximum; |
| 414 | int32_t step; |
| 415 | int32_t default_value; |
| 416 | uint32_t flags; |
| 417 | uint32_t reserved[2]; |
| 418 | }; |
| 419 | |
| 420 | struct { |
| 421 | uint32_t ; |
| 422 | uint32_t ; |
| 423 | uint8_t [32]; |
| 424 | uint32_t ; |
| 425 | }; |
| 426 | |
| 427 | struct v4l2_requestbuffers { |
| 428 | uint32_t count; |
| 429 | enum v4l2_buf_type type; |
| 430 | enum v4l2_memory memory; |
| 431 | uint32_t reserved[2]; |
| 432 | }; |
| 433 | |
| 434 | /* Timecode types */ |
| 435 | #define V4L2_TC_TYPE_24FPS 1 |
| 436 | #define V4L2_TC_TYPE_25FPS 2 |
| 437 | #define V4L2_TC_TYPE_30FPS 3 |
| 438 | #define V4L2_TC_TYPE_50FPS 4 |
| 439 | #define V4L2_TC_TYPE_60FPS 5 |
| 440 | |
| 441 | /* Timecode flags */ |
| 442 | #define V4L2_TC_FLAG_DROPFRAME 0x0001 |
| 443 | #define V4L2_TC_FLAG_COLORFRAME 0x0002 |
| 444 | #define V4L2_TC_USERBITS_field 0x000c |
| 445 | #define V4L2_TC_USERBITS_USERDEFINED 0x0000 |
| 446 | #define V4L2_TC_USERBITS_8BITCHARS 0x0008 |
| 447 | |
| 448 | /* Buffer flags */ |
| 449 | #define V4L2_BUF_FLAG_MAPPED 0x0001 |
| 450 | #define V4L2_BUF_FLAG_QUEUED 0x0002 |
| 451 | #define V4L2_BUF_FLAG_DONE 0x0004 |
| 452 | #define V4L2_BUF_FLAG_KEYFRAME 0x0008 |
| 453 | #define V4L2_BUF_FLAG_PFRAME 0x0010 |
| 454 | #define V4L2_BUF_FLAG_BFRAME 0x0020 |
| 455 | #define V4L2_BUF_FLAG_TIMECODE 0x0100 |
| 456 | #define V4L2_BUF_FLAG_INPUT 0x0200 |
| 457 | |
| 458 | /* Image format description flags */ |
| 459 | #define V4L2_FMT_FLAG_COMPRESSED 0x0001 |
| 460 | |
| 461 | /* Input types */ |
| 462 | #define V4L2_INPUT_TYPE_TUNER 1 |
| 463 | #define V4L2_INPUT_TYPE_CAMERA 2 |
| 464 | |
| 465 | /* Input status flags */ |
| 466 | #define V4L2_IN_ST_NO_POWER 0x00000001 |
| 467 | #define V4L2_IN_ST_NO_SIGNAL 0x00000002 |
| 468 | #define V4L2_IN_ST_NO_COLOR 0x00000004 |
| 469 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 |
| 470 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 |
| 471 | #define V4L2_IN_ST_NO_SYNC 0x00010000 |
| 472 | #define V4L2_IN_ST_NO_EQU 0x00020000 |
| 473 | #define V4L2_IN_ST_NO_CARRIER 0x00040000 |
| 474 | #define V4L2_IN_ST_MACROVISION 0x01000000 |
| 475 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 |
| 476 | #define V4L2_IN_ST_VTR 0x04000000 |
| 477 | |
| 478 | /* Output types */ |
| 479 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 |
| 480 | #define V4L2_OUTPUT_TYPE_ANALOG 2 |
| 481 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 |
| 482 | |
| 483 | /* Audio capability flags */ |
| 484 | #define V4L2_AUDCAP_STEREO 0x00001 |
| 485 | #define V4L2_AUDCAP_AVL 0x00002 |
| 486 | |
| 487 | /* Audio modes */ |
| 488 | #define V4L2_AUDMODE_AVL 0x00001 |
| 489 | |
| 490 | /* Frame buffer capability flags */ |
| 491 | #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 |
| 492 | #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 |
| 493 | #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 |
| 494 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 |
| 495 | |
| 496 | /* Frame buffer flags */ |
| 497 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
| 498 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
| 499 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 |
| 500 | |
| 501 | /* JPEG markers flags */ |
| 502 | #define V4L2_JPEG_MARKER_DHT (1 << 3) |
| 503 | #define V4L2_JPEG_MARKER_DQT (1 << 4) |
| 504 | #define V4L2_JPEG_MARKER_DRI (1 << 5) |
| 505 | #define V4L2_JPEG_MARKER_COM (1 << 6) |
| 506 | #define V4L2_JPEG_MARKER_APP (1 << 7) |
| 507 | |
| 508 | /* Streaming parameters capabilities */ |
| 509 | #define V4L2_CAP_TIMEPERFRAME 0x1000 |
| 510 | |
| 511 | /* Capture parameters flags */ |
| 512 | #define V4L2_MODE_HIGHQUALITY 0x0001 |
| 513 | |
| 514 | /* Tuner and modulator capability flags */ |
| 515 | #define V4L2_TUNER_CAP_LOW 0x0001 |
| 516 | #define V4L2_TUNER_CAP_NORM 0x0002 |
| 517 | #define V4L2_TUNER_CAP_STEREO 0x0010 |
| 518 | #define V4L2_TUNER_CAP_LANG2 0x0020 |
| 519 | #define V4L2_TUNER_CAP_SAP 0x0020 |
| 520 | #define V4L2_TUNER_CAP_LANG1 0x0040 |
| 521 | |
| 522 | /* Tuner and modulation audio transmission flags */ |
| 523 | #define V4L2_TUNER_SUB_MONO 0x0001 |
| 524 | #define V4L2_TUNER_SUB_STEREO 0x0002 |
| 525 | #define V4L2_TUNER_SUB_LANG2 0x0004 |
| 526 | #define V4L2_TUNER_SUB_SAP 0x0004 |
| 527 | #define V4L2_TUNER_SUB_LANG1 0x0008 |
| 528 | |
| 529 | /* Tuner audio modes */ |
| 530 | #define V4L2_TUNER_MODE_MONO 0 |
| 531 | #define V4L2_TUNER_MODE_STEREO 1 |
| 532 | #define V4L2_TUNER_MODE_LANG2 2 |
| 533 | #define V4L2_TUNER_MODE_SAP 2 |
| 534 | #define V4L2_TUNER_MODE_LANG1 3 |
| 535 | #define V4L2_TUNER_MODE_LANG1_LANG2 4 |
| 536 | |
| 537 | /* Control flags */ |
| 538 | #define V4L2_CTRL_FLAG_DISABLED 0x0001 |
| 539 | #define V4L2_CTRL_FLAG_GRABBED 0x0002 |
| 540 | #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 |
| 541 | #define V4L2_CTRL_FLAG_UPDATE 0x0008 |
| 542 | #define V4L2_CTRL_FLAG_INACTIVE 0x0010 |
| 543 | #define V4L2_CTRL_FLAG_SLIDER 0x0020 |
| 544 | |
| 545 | /* Control IDs defined by V4L2 */ |
| 546 | #define V4L2_CID_BASE 0x00980900 |
| 547 | #define V4L2_CID_PRIVATE_BASE 0x08000000 |
| 548 | |
| 549 | #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE + 0) |
| 550 | #define V4L2_CID_CONTRAST (V4L2_CID_BASE + 1) |
| 551 | #define V4L2_CID_SATURATION (V4L2_CID_BASE + 2) |
| 552 | #define V4L2_CID_HUE (V4L2_CID_BASE + 3) |
| 553 | #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE + 5) |
| 554 | #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE + 6) |
| 555 | #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE + 7) |
| 556 | #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE + 8) |
| 557 | #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE + 9) |
| 558 | #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE + 10) |
| 559 | #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE + 11) |
| 560 | #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE + 12) |
| 561 | #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE + 13) |
| 562 | #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE + 14) |
| 563 | #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE + 15) |
| 564 | #define V4L2_CID_GAMMA (V4L2_CID_BASE + 16) |
| 565 | #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) |
| 566 | #define V4L2_CID_EXPOSURE (V4L2_CID_BASE + 17) |
| 567 | #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE + 18) |
| 568 | #define V4L2_CID_GAIN (V4L2_CID_BASE + 19) |
| 569 | #define V4L2_CID_HFLIP (V4L2_CID_BASE + 20) |
| 570 | #define V4L2_CID_VFLIP (V4L2_CID_BASE + 21) |
| 571 | #define V4L2_CID_HCENTER_DEPRECATED (V4L2_CID_BASE + 22) |
| 572 | #define V4L2_CID_VCENTER_DEPRECATED (V4L2_CID_BASE + 23) |
| 573 | #define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED |
| 574 | #define V4L2_CID_VCENTER V4L2_CID_VCENTER_DEPRECATED |
| 575 | #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE + 24) |
| 576 | #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE + 25) |
| 577 | #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26) |
| 578 | #define V4L2_CID_SHARPNESS (V4L2_CID_BASE + 27) |
| 579 | #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE + 28) |
| 580 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE + 29) |
| 581 | |
| 582 | /* Pixel formats */ |
| 583 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') |
| 584 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') |
| 585 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') |
| 586 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') |
| 587 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') |
| 588 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') |
| 589 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') |
| 590 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') |
| 591 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') |
| 592 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') |
| 593 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') |
| 594 | #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') |
| 595 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') |
| 596 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') |
| 597 | #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') |
| 598 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') |
| 599 | #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') |
| 600 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') |
| 601 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('Y', '1', '1', 'P') |
| 602 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') |
| 603 | #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') |
| 604 | /* http://www.siliconimaging.com/RGB%20Bayer.htm */ |
| 605 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') |
| 606 | /* Reserved pixel formats */ |
| 607 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') |
| 608 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') |
| 609 | #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') |
| 610 | #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') |
| 611 | #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') |
| 612 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') |
| 613 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') |
| 614 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') |
| 615 | |
| 616 | /* Video standards */ |
| 617 | #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) |
| 618 | #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) |
| 619 | #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) |
| 620 | #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) |
| 621 | #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) |
| 622 | #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) |
| 623 | #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) |
| 624 | #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) |
| 625 | #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) |
| 626 | #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) |
| 627 | #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) |
| 628 | #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) |
| 629 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) |
| 630 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) |
| 631 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) |
| 632 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) |
| 633 | #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) |
| 634 | #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) |
| 635 | #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) |
| 636 | #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) |
| 637 | #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) |
| 638 | #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) |
| 639 | #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) |
| 640 | #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B | \ |
| 641 | V4L2_STD_PAL_B1 | \ |
| 642 | V4L2_STD_PAL_G) |
| 643 | #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D | \ |
| 644 | V4L2_STD_PAL_D1 | \ |
| 645 | V4L2_STD_PAL_K) |
| 646 | #define V4L2_STD_PAL (V4L2_STD_PAL_BG | \ |
| 647 | V4L2_STD_PAL_DK | \ |
| 648 | V4L2_STD_PAL_H | \ |
| 649 | V4L2_STD_PAL_I) |
| 650 | #define V4L2_STD_NTSC (V4L2_STD_NTSC_M | \ |
| 651 | V4L2_STD_NTSC_M_JP) |
| 652 | #define V4L2_STD_SECAM (V4L2_STD_SECAM_B | \ |
| 653 | V4L2_STD_SECAM_D | \ |
| 654 | V4L2_STD_SECAM_G | \ |
| 655 | V4L2_STD_SECAM_H | \ |
| 656 | V4L2_STD_SECAM_K | \ |
| 657 | V4L2_STD_SECAM_K1 | \ |
| 658 | V4L2_STD_SECAM_L) |
| 659 | #define V4L2_STD_525_60 (V4L2_STD_PAL_M | \ |
| 660 | V4L2_STD_PAL_60 | \ |
| 661 | V4L2_STD_NTSC) |
| 662 | #define V4L2_STD_625_50 (V4L2_STD_PAL | \ |
| 663 | V4L2_STD_PAL_N | \ |
| 664 | V4L2_STD_PAL_Nc | \ |
| 665 | V4L2_STD_SECAM) |
| 666 | #define V4L2_STD_UNKNOWN 0 |
| 667 | #define V4L2_STD_ALL (V4L2_STD_525_60 | \ |
| 668 | V4L2_STD_625_50) |
| 669 | |
| 670 | /* Raw VBI format flags */ |
| 671 | #define V4L2_VBI_UNSYNC 0x0001 |
| 672 | #define V4L2_VBI_INTERLACED 0x0002 |
| 673 | |
| 674 | /* Device capabilities */ |
| 675 | #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 |
| 676 | #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 |
| 677 | #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 |
| 678 | #define V4L2_CAP_VBI_CAPTURE 0x00000010 |
| 679 | #define V4L2_CAP_VBI_OUTPUT 0x00000020 |
| 680 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 |
| 681 | #define V4L2_CAP_TUNER 0x00010000 |
| 682 | #define V4L2_CAP_AUDIO 0x00020000 |
| 683 | #define V4L2_CAP_READWRITE 0x01000000 |
| 684 | #define V4L2_CAP_ASYNCIO 0x02000000 |
| 685 | #define V4L2_CAP_STREAMING 0x04000000 |
| 686 | #define V4L2_CAP_BITMASK \ |
| 687 | "\20\1VIDEO_CAPTURE\2VIDEO_OUTPUT\3VIDEO_OVERLAY" \ |
| 688 | "\5VBI_CAPTURE\6VBI_OUTPUT\10RDS_CAPTURE" \ |
| 689 | "\21TUNER\22AUDIO\31READWRITE" \ |
| 690 | "\32ASYNCIO\33STREAMING" |
| 691 | |
| 692 | /* Device ioctls -- try to keep them the same as Linux for compat_linux */ |
| 693 | #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) |
| 694 | #define VIDIOC_RESERVED _IO('V', 1) |
| 695 | #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) |
| 696 | #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) |
| 697 | #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) |
| 698 | /* 6 and 7 are VIDIOC_[SG]_COMP, which are unsupported */ |
| 699 | #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) |
| 700 | #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) |
| 701 | #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) |
| 702 | #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) |
| 703 | #define VIDIOC_OVERLAY _IOW('V', 14, int) |
| 704 | #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) |
| 705 | #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) |
| 706 | #define VIDIOC_STREAMON _IOW('V', 18, int) |
| 707 | #define VIDIOC_STREAMOFF _IOW('V', 19, int) |
| 708 | #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) |
| 709 | #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) |
| 710 | #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) |
| 711 | #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) |
| 712 | #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) |
| 713 | #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) |
| 714 | #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) |
| 715 | #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) |
| 716 | #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) |
| 717 | #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) |
| 718 | #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) |
| 719 | #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) |
| 720 | #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) |
| 721 | #define _IOWR('V', 37, struct v4l2_querymenu) |
| 722 | #define VIDIOC_G_INPUT _IOR('V', 38, int) |
| 723 | #define VIDIOC_S_INPUT _IOWR('V', 39, int) |
| 724 | #define VIDIOC_G_OUTPUT _IOR('V', 46, int) |
| 725 | #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) |
| 726 | #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) |
| 727 | #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) |
| 728 | #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) |
| 729 | #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) |
| 730 | #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) |
| 731 | #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) |
| 732 | #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) |
| 733 | #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) |
| 734 | #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) |
| 735 | #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) |
| 736 | #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) |
| 737 | #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) |
| 738 | #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) |
| 739 | #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) |
| 740 | #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) |
| 741 | #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) |
| 742 | #define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) |
| 743 | #define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) |
| 744 | |
| 745 | #ifdef _KERNEL |
| 746 | #define VIDIOC_QUERYBUF50 _IOWR('V', 9, struct v4l2_buffer50) |
| 747 | #define VIDIOC_QBUF50 _IOWR('V', 15, struct v4l2_buffer50) |
| 748 | #define VIDIOC_DQBUF50 _IOWR('V', 17, struct v4l2_buffer50) |
| 749 | #endif |
| 750 | |
| 751 | #endif /* !_HAVE_SYS_VIDEOIO_H */ |
| 752 | |