1 /* $NetBSD: videoio.h,v 1.10 2017/10/02 13:47:58 jmcneill 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 V4L2_CTRL_TYPE_MENU, 117 V4L2_CTRL_TYPE_BUTTON 118 }; 119 120 enum v4l2_frmsizetypes { 121 V4L2_FRMSIZE_TYPE_DISCRETE = 1, 122 V4L2_FRMSIZE_TYPE_CONTINUOUS, 123 V4L2_FRMSIZE_TYPE_STEPWISE 124 }; 125 126 struct v4l2_timecode { 127 uint32_t type; 128 uint32_t flags; 129 uint8_t frames; 130 uint8_t seconds; 131 uint8_t minutes; 132 uint8_t hours; 133 uint8_t userbits[4]; 134 }; 135 136 struct v4l2_pix_format { 137 uint32_t width; 138 uint32_t height; 139 uint32_t pixelformat; 140 enum v4l2_field field; 141 uint32_t bytesperline; 142 uint32_t sizeimage; 143 enum v4l2_colorspace colorspace; 144 uint32_t priv; 145 }; 146 147 struct v4l2_buffer { 148 uint32_t index; 149 enum v4l2_buf_type type; 150 uint32_t bytesused; 151 uint32_t flags; 152 enum v4l2_field field; 153 struct timeval timestamp; 154 struct v4l2_timecode timecode; 155 uint32_t sequence; 156 enum v4l2_memory memory; 157 union { 158 uint32_t offset; 159 unsigned long userptr; 160 } m; 161 uint32_t length; 162 uint32_t input; 163 uint32_t reserved; 164 }; 165 166 #ifdef _KERNEL 167 struct v4l2_buffer50 { 168 uint32_t index; 169 enum v4l2_buf_type type; 170 uint32_t bytesused; 171 uint32_t flags; 172 enum v4l2_field field; 173 struct timeval50 timestamp; 174 struct v4l2_timecode timecode; 175 uint32_t sequence; 176 enum v4l2_memory memory; 177 union { 178 uint32_t offset; 179 unsigned long userptr; 180 } m; 181 uint32_t length; 182 uint32_t input; 183 uint32_t reserved; 184 }; 185 186 #endif 187 struct v4l2_rect { 188 int32_t left; 189 int32_t top; 190 int32_t width; 191 int32_t height; 192 }; 193 194 struct v4l2_fract { 195 uint32_t numerator; 196 uint32_t denominator; 197 }; 198 199 struct v4l2_fmtdesc { 200 uint32_t index; 201 enum v4l2_buf_type type; 202 uint32_t flags; 203 uint8_t description[32]; 204 uint32_t pixelformat; 205 uint32_t reserved[4]; 206 }; 207 208 struct v4l2_clip { 209 struct v4l2_rect c; 210 struct v4l2_clip *next; 211 }; 212 213 struct v4l2_window { 214 struct v4l2_rect w; 215 enum v4l2_field field; 216 uint32_t chromakey; 217 struct v4l2_clip *clips; 218 uint32_t clipcount; 219 void *bitmap; 220 }; 221 222 struct v4l2_vbi_format { 223 uint32_t sampling_rate; 224 uint32_t offset; 225 uint32_t samples_per_line; 226 uint32_t sample_format; 227 uint32_t start[2]; 228 uint32_t count[2]; 229 uint32_t flags; 230 uint32_t reserved[2]; 231 }; 232 233 /* In the API docs, but not the Linux implementation 234 * 235 * struct v4l2_sliced_vbi_format { 236 * uint32_t service_set; 237 * uint32_t packet_size; 238 * uint32_t io_size; 239 * uint32_t reserved; 240 * }; 241 * 242 * 243 * struct v4l2_sliced_data { 244 * uint32_t id; 245 * uint32_t line; 246 * uint8_t data[]; 247 * }; 248 */ 249 250 struct v4l2_cropcap { 251 enum v4l2_buf_type type; 252 struct v4l2_rect bounds; 253 struct v4l2_rect defrect; 254 struct v4l2_fract pixelaspect; 255 }; 256 257 struct v4l2_input { 258 uint32_t index; 259 uint8_t name[32]; 260 uint32_t type; 261 uint32_t audioset; 262 uint32_t tuner; 263 v4l2_std_id std; 264 uint32_t status; 265 uint32_t reserved[4]; 266 }; 267 268 struct v4l2_output { 269 uint32_t index; 270 uint8_t name[32]; 271 uint32_t type; 272 uint32_t audioset; 273 uint32_t modulator; 274 v4l2_std_id std; 275 uint32_t reserved[4]; 276 }; 277 278 struct v4l2_audio { 279 uint32_t index; 280 uint8_t name[32]; 281 uint32_t capability; 282 uint32_t mode; 283 uint32_t reserved[2]; 284 }; 285 286 struct v4l2_audioout { 287 uint32_t index; 288 uint8_t name[32]; 289 uint32_t capability; 290 uint32_t mode; 291 uint32_t reserved[2]; 292 }; 293 294 struct v4l2_compression { 295 uint32_t quality; 296 uint32_t keyframerate; 297 uint32_t pframerate; 298 uint32_t reserved[5]; 299 }; 300 301 struct v4l2_crop { 302 enum v4l2_buf_type type; 303 struct v4l2_rect c; 304 }; 305 306 struct v4l2_control { 307 uint32_t id; 308 int32_t value; 309 }; 310 311 struct v4l2_framebuffer { 312 uint32_t capability; 313 uint32_t flags; 314 void *base; 315 struct v4l2_pix_format fmt; 316 }; 317 318 struct v4l2_standard { 319 uint32_t index; 320 v4l2_std_id id; 321 uint8_t name[24]; 322 struct v4l2_fract frameperiod; 323 uint32_t framelines; 324 uint32_t reserved[4]; 325 }; 326 327 struct v4l2_format { 328 enum v4l2_buf_type type; 329 union { 330 struct v4l2_pix_format pix; 331 struct v4l2_window win; 332 struct v4l2_vbi_format vbi; 333 uint8_t raw_data[200]; 334 } fmt; 335 }; 336 337 struct v4l2_frequency { 338 uint32_t tuner; 339 enum v4l2_tuner_type type; 340 uint32_t frequency; 341 uint32_t reserved[8]; 342 }; 343 344 struct v4l2_jpegcompression { 345 int quality; 346 int APPn; 347 int APP_len; 348 char APP_data[60]; 349 int COM_len; 350 char COM_data[60]; 351 uint32_t jpeg_markers; 352 }; 353 354 struct v4l2_modulator { 355 uint32_t index; 356 uint8_t name[32]; 357 uint32_t capability; 358 uint32_t rangelow; 359 uint32_t rangehigh; 360 uint32_t txsubchans; 361 uint32_t reserved[4]; 362 }; 363 364 struct v4l2_captureparm { 365 uint32_t capability; 366 uint32_t capturemode; 367 struct v4l2_fract timeperframe; 368 uint32_t extendedmode; 369 uint32_t readbuffers; 370 uint32_t reserved[4]; 371 }; 372 373 struct v4l2_outputparm { 374 uint32_t capability; 375 uint32_t outputmode; 376 struct v4l2_fract timeperframe; 377 uint32_t extendedmode; 378 uint32_t writebuffers; 379 uint32_t reserved[4]; 380 }; 381 382 struct v4l2_streamparm { 383 enum v4l2_buf_type type; 384 union { 385 struct v4l2_captureparm capture; 386 struct v4l2_outputparm output; 387 uint8_t raw_data[200]; 388 } parm; 389 }; 390 391 struct v4l2_tuner { 392 uint32_t index; 393 uint8_t name[32]; 394 enum v4l2_tuner_type type; 395 uint32_t capability; 396 uint32_t rangelow; 397 uint32_t rangehigh; 398 uint32_t rxsubchans; 399 uint32_t audmode; 400 uint32_t signal; 401 int32_t afc; 402 uint32_t reserved[4]; 403 }; 404 405 struct v4l2_capability { 406 uint8_t driver[16]; 407 uint8_t card[32]; 408 uint8_t bus_info[32]; 409 uint32_t version; 410 uint32_t capabilities; 411 uint32_t reserved[4]; 412 }; 413 414 struct v4l2_queryctrl { 415 uint32_t id; 416 enum v4l2_ctrl_type type; 417 uint8_t name[32]; 418 int32_t minimum; 419 int32_t maximum; 420 int32_t step; 421 int32_t default_value; 422 uint32_t flags; 423 uint32_t reserved[2]; 424 }; 425 426 struct v4l2_querymenu { 427 uint32_t id; 428 uint32_t index; 429 uint8_t name[32]; 430 uint32_t reserved; 431 }; 432 433 struct v4l2_requestbuffers { 434 uint32_t count; 435 enum v4l2_buf_type type; 436 enum v4l2_memory memory; 437 uint32_t reserved[2]; 438 }; 439 440 struct v4l2_frmsize_discrete { 441 uint32_t width; 442 uint32_t height; 443 }; 444 445 struct v4l2_frmsize_stepwise { 446 uint32_t min_width; 447 uint32_t max_width; 448 uint32_t step_width; 449 uint32_t min_height; 450 uint32_t max_height; 451 uint32_t step_height; 452 }; 453 454 struct v4l2_frmsizeenum { 455 uint32_t index; 456 uint32_t pixel_format; 457 uint32_t type; 458 union { 459 struct v4l2_frmsize_discrete discrete; 460 struct v4l2_frmsize_stepwise stepwise; 461 }; 462 uint32_t reserved[2]; 463 }; 464 465 struct v4l2_frmival_stepwise { 466 struct v4l2_fract min; 467 struct v4l2_fract max; 468 struct v4l2_fract step; 469 }; 470 471 struct v4l2_frmivalenum { 472 uint32_t index; 473 uint32_t pixel_format; 474 uint32_t width; 475 uint32_t height; 476 uint32_t type; 477 union { 478 struct v4l2_fract discrete; 479 struct v4l2_frmival_stepwise stepwise; 480 }; 481 uint32_t reserved[2]; 482 }; 483 484 /* Timecode types */ 485 #define V4L2_TC_TYPE_24FPS 1 486 #define V4L2_TC_TYPE_25FPS 2 487 #define V4L2_TC_TYPE_30FPS 3 488 #define V4L2_TC_TYPE_50FPS 4 489 #define V4L2_TC_TYPE_60FPS 5 490 491 /* Timecode flags */ 492 #define V4L2_TC_FLAG_DROPFRAME 0x0001 493 #define V4L2_TC_FLAG_COLORFRAME 0x0002 494 #define V4L2_TC_USERBITS_field 0x000c 495 #define V4L2_TC_USERBITS_USERDEFINED 0x0000 496 #define V4L2_TC_USERBITS_8BITCHARS 0x0008 497 498 /* Buffer flags */ 499 #define V4L2_BUF_FLAG_MAPPED 0x0001 500 #define V4L2_BUF_FLAG_QUEUED 0x0002 501 #define V4L2_BUF_FLAG_DONE 0x0004 502 #define V4L2_BUF_FLAG_KEYFRAME 0x0008 503 #define V4L2_BUF_FLAG_PFRAME 0x0010 504 #define V4L2_BUF_FLAG_BFRAME 0x0020 505 #define V4L2_BUF_FLAG_TIMECODE 0x0100 506 #define V4L2_BUF_FLAG_INPUT 0x0200 507 508 /* Image format description flags */ 509 #define V4L2_FMT_FLAG_COMPRESSED 0x0001 510 511 /* Input types */ 512 #define V4L2_INPUT_TYPE_TUNER 1 513 #define V4L2_INPUT_TYPE_CAMERA 2 514 515 /* Input status flags */ 516 #define V4L2_IN_ST_NO_POWER 0x00000001 517 #define V4L2_IN_ST_NO_SIGNAL 0x00000002 518 #define V4L2_IN_ST_NO_COLOR 0x00000004 519 #define V4L2_IN_ST_NO_H_LOCK 0x00000100 520 #define V4L2_IN_ST_COLOR_KILL 0x00000200 521 #define V4L2_IN_ST_NO_SYNC 0x00010000 522 #define V4L2_IN_ST_NO_EQU 0x00020000 523 #define V4L2_IN_ST_NO_CARRIER 0x00040000 524 #define V4L2_IN_ST_MACROVISION 0x01000000 525 #define V4L2_IN_ST_NO_ACCESS 0x02000000 526 #define V4L2_IN_ST_VTR 0x04000000 527 528 /* Output types */ 529 #define V4L2_OUTPUT_TYPE_MODULATOR 1 530 #define V4L2_OUTPUT_TYPE_ANALOG 2 531 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 532 533 /* Audio capability flags */ 534 #define V4L2_AUDCAP_STEREO 0x00001 535 #define V4L2_AUDCAP_AVL 0x00002 536 537 /* Audio modes */ 538 #define V4L2_AUDMODE_AVL 0x00001 539 540 /* Frame buffer capability flags */ 541 #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 542 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 543 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 544 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 545 546 /* Frame buffer flags */ 547 #define V4L2_FBUF_FLAG_PRIMARY 0x0001 548 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 549 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 550 551 /* JPEG markers flags */ 552 #define V4L2_JPEG_MARKER_DHT (1 << 3) 553 #define V4L2_JPEG_MARKER_DQT (1 << 4) 554 #define V4L2_JPEG_MARKER_DRI (1 << 5) 555 #define V4L2_JPEG_MARKER_COM (1 << 6) 556 #define V4L2_JPEG_MARKER_APP (1 << 7) 557 558 /* Streaming parameters capabilities */ 559 #define V4L2_CAP_TIMEPERFRAME 0x1000 560 561 /* Capture parameters flags */ 562 #define V4L2_MODE_HIGHQUALITY 0x0001 563 564 /* Tuner and modulator capability flags */ 565 #define V4L2_TUNER_CAP_LOW 0x0001 566 #define V4L2_TUNER_CAP_NORM 0x0002 567 #define V4L2_TUNER_CAP_STEREO 0x0010 568 #define V4L2_TUNER_CAP_LANG2 0x0020 569 #define V4L2_TUNER_CAP_SAP 0x0020 570 #define V4L2_TUNER_CAP_LANG1 0x0040 571 572 /* Tuner and modulation audio transmission flags */ 573 #define V4L2_TUNER_SUB_MONO 0x0001 574 #define V4L2_TUNER_SUB_STEREO 0x0002 575 #define V4L2_TUNER_SUB_LANG2 0x0004 576 #define V4L2_TUNER_SUB_SAP 0x0004 577 #define V4L2_TUNER_SUB_LANG1 0x0008 578 579 /* Tuner audio modes */ 580 #define V4L2_TUNER_MODE_MONO 0 581 #define V4L2_TUNER_MODE_STEREO 1 582 #define V4L2_TUNER_MODE_LANG2 2 583 #define V4L2_TUNER_MODE_SAP 2 584 #define V4L2_TUNER_MODE_LANG1 3 585 #define V4L2_TUNER_MODE_LANG1_LANG2 4 586 587 /* Control flags */ 588 #define V4L2_CTRL_FLAG_DISABLED 0x0001 589 #define V4L2_CTRL_FLAG_GRABBED 0x0002 590 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 591 #define V4L2_CTRL_FLAG_UPDATE 0x0008 592 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 593 #define V4L2_CTRL_FLAG_SLIDER 0x0020 594 595 /* Control IDs defined by V4L2 */ 596 #define V4L2_CID_BASE 0x00980900 597 #define V4L2_CID_PRIVATE_BASE 0x08000000 598 599 #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE + 0) 600 #define V4L2_CID_CONTRAST (V4L2_CID_BASE + 1) 601 #define V4L2_CID_SATURATION (V4L2_CID_BASE + 2) 602 #define V4L2_CID_HUE (V4L2_CID_BASE + 3) 603 #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE + 5) 604 #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE + 6) 605 #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE + 7) 606 #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE + 8) 607 #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE + 9) 608 #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE + 10) 609 #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE + 11) 610 #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE + 12) 611 #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE + 13) 612 #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE + 14) 613 #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE + 15) 614 #define V4L2_CID_GAMMA (V4L2_CID_BASE + 16) 615 #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) 616 #define V4L2_CID_EXPOSURE (V4L2_CID_BASE + 17) 617 #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE + 18) 618 #define V4L2_CID_GAIN (V4L2_CID_BASE + 19) 619 #define V4L2_CID_HFLIP (V4L2_CID_BASE + 20) 620 #define V4L2_CID_VFLIP (V4L2_CID_BASE + 21) 621 #define V4L2_CID_HCENTER_DEPRECATED (V4L2_CID_BASE + 22) 622 #define V4L2_CID_VCENTER_DEPRECATED (V4L2_CID_BASE + 23) 623 #define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED 624 #define V4L2_CID_VCENTER V4L2_CID_VCENTER_DEPRECATED 625 #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE + 24) 626 #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE + 25) 627 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26) 628 #define V4L2_CID_SHARPNESS (V4L2_CID_BASE + 27) 629 #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE + 28) 630 #define V4L2_CID_LASTP1 (V4L2_CID_BASE + 29) 631 632 /* Pixel formats */ 633 #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') 634 #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') 635 #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') 636 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') 637 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') 638 #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') 639 #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') 640 #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') 641 #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') 642 #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') 643 #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') 644 #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') 645 #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') 646 #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') 647 #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') 648 #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') 649 #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') 650 #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') 651 #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('Y', '1', '1', 'P') 652 #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') 653 #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') 654 /* http://www.siliconimaging.com/RGB%20Bayer.htm */ 655 #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') 656 /* Reserved pixel formats */ 657 #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') 658 #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') 659 #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') 660 #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') 661 #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') 662 #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') 663 #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') 664 #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') 665 666 /* Video standards */ 667 #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) 668 #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) 669 #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) 670 #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) 671 #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) 672 #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) 673 #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) 674 #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) 675 #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) 676 #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) 677 #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) 678 #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) 679 #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 680 #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 681 #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 682 #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) 683 #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) 684 #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) 685 #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) 686 #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) 687 #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) 688 #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 689 #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 690 #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B | \ 691 V4L2_STD_PAL_B1 | \ 692 V4L2_STD_PAL_G) 693 #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D | \ 694 V4L2_STD_PAL_D1 | \ 695 V4L2_STD_PAL_K) 696 #define V4L2_STD_PAL (V4L2_STD_PAL_BG | \ 697 V4L2_STD_PAL_DK | \ 698 V4L2_STD_PAL_H | \ 699 V4L2_STD_PAL_I) 700 #define V4L2_STD_NTSC (V4L2_STD_NTSC_M | \ 701 V4L2_STD_NTSC_M_JP) 702 #define V4L2_STD_SECAM (V4L2_STD_SECAM_B | \ 703 V4L2_STD_SECAM_D | \ 704 V4L2_STD_SECAM_G | \ 705 V4L2_STD_SECAM_H | \ 706 V4L2_STD_SECAM_K | \ 707 V4L2_STD_SECAM_K1 | \ 708 V4L2_STD_SECAM_L) 709 #define V4L2_STD_525_60 (V4L2_STD_PAL_M | \ 710 V4L2_STD_PAL_60 | \ 711 V4L2_STD_NTSC) 712 #define V4L2_STD_625_50 (V4L2_STD_PAL | \ 713 V4L2_STD_PAL_N | \ 714 V4L2_STD_PAL_Nc | \ 715 V4L2_STD_SECAM) 716 #define V4L2_STD_UNKNOWN 0 717 #define V4L2_STD_ALL (V4L2_STD_525_60 | \ 718 V4L2_STD_625_50) 719 720 /* Raw VBI format flags */ 721 #define V4L2_VBI_UNSYNC 0x0001 722 #define V4L2_VBI_INTERLACED 0x0002 723 724 /* Device capabilities */ 725 #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 726 #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 727 #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 728 #define V4L2_CAP_VBI_CAPTURE 0x00000010 729 #define V4L2_CAP_VBI_OUTPUT 0x00000020 730 #define V4L2_CAP_RDS_CAPTURE 0x00000100 731 #define V4L2_CAP_TUNER 0x00010000 732 #define V4L2_CAP_AUDIO 0x00020000 733 #define V4L2_CAP_READWRITE 0x01000000 734 #define V4L2_CAP_ASYNCIO 0x02000000 735 #define V4L2_CAP_STREAMING 0x04000000 736 #define V4L2_CAP_BITMASK \ 737 "\20\1VIDEO_CAPTURE\2VIDEO_OUTPUT\3VIDEO_OVERLAY" \ 738 "\5VBI_CAPTURE\6VBI_OUTPUT\10RDS_CAPTURE" \ 739 "\21TUNER\22AUDIO\31READWRITE" \ 740 "\32ASYNCIO\33STREAMING" 741 742 /* Device ioctls -- try to keep them the same as Linux for compat_linux */ 743 #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) 744 #define VIDIOC_RESERVED _IO('V', 1) 745 #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) 746 #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) 747 #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) 748 /* 6 and 7 are VIDIOC_[SG]_COMP, which are unsupported */ 749 #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) 750 #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) 751 #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) 752 #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) 753 #define VIDIOC_OVERLAY _IOW('V', 14, int) 754 #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) 755 #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) 756 #define VIDIOC_STREAMON _IOW('V', 18, int) 757 #define VIDIOC_STREAMOFF _IOW('V', 19, int) 758 #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) 759 #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) 760 #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) 761 #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) 762 #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) 763 #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) 764 #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) 765 #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) 766 #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) 767 #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) 768 #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) 769 #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) 770 #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) 771 #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) 772 #define VIDIOC_G_INPUT _IOR('V', 38, int) 773 #define VIDIOC_S_INPUT _IOWR('V', 39, int) 774 #define VIDIOC_G_OUTPUT _IOR('V', 46, int) 775 #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) 776 #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) 777 #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) 778 #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) 779 #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) 780 #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) 781 #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) 782 #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) 783 #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) 784 #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) 785 #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) 786 #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) 787 #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) 788 #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) 789 #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) 790 #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) 791 #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) 792 #define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) 793 #define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) 794 #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) 795 #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) 796 797 #ifdef _KERNEL 798 #define VIDIOC_QUERYBUF50 _IOWR('V', 9, struct v4l2_buffer50) 799 #define VIDIOC_QBUF50 _IOWR('V', 15, struct v4l2_buffer50) 800 #define VIDIOC_DQBUF50 _IOWR('V', 17, struct v4l2_buffer50) 801 #endif 802 803 #endif /* !_HAVE_SYS_VIDEOIO_H */ 804