[490] | 1 | /* |
---|
| 2 | Copyright 2006 Bill Dirks <bdirks@pacbell.net> |
---|
| 3 | Justin Schoeman |
---|
| 4 | et al. |
---|
| 5 | This program is free software; you can redistribute it and/or |
---|
| 6 | modify it under the terms of the GNU General Public License |
---|
| 7 | as published by the Free Software Foundation; either version 2 |
---|
| 8 | of the License, or (at your option) any later version. |
---|
| 9 | |
---|
| 10 | This program is distributed in the hope that it will be useful, |
---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | GNU General Public License for more details. |
---|
| 14 | |
---|
| 15 | You should have received a copy of the GNU General Public License |
---|
| 16 | along with this program; if not, write to the Free Software |
---|
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #ifndef __LINUX_VIDEODEV2_H |
---|
| 21 | #define __LINUX_VIDEODEV2_H |
---|
| 22 | /* |
---|
| 23 | * Video for Linux Two |
---|
| 24 | * |
---|
| 25 | * Header file for v4l or V4L2 drivers and applications, for |
---|
| 26 | * Linux kernels 2.2.x or 2.4.x. |
---|
| 27 | * |
---|
| 28 | * See http://bytesex.org/v4l/ for API specs and other |
---|
| 29 | * v4l2 documentation. |
---|
| 30 | * |
---|
| 31 | * Author: Bill Dirks <bdirks@pacbell.net> |
---|
| 32 | * Justin Schoeman |
---|
| 33 | * et al. |
---|
| 34 | */ |
---|
| 35 | /* |
---|
| 36 | * M I S C E L L A N E O U S |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | /* Four-character-code (FOURCC) */ |
---|
| 40 | #define v4l2_fourcc(a,b,c,d)\ |
---|
| 41 | (((unsigned int)(a)<<0)|((unsigned int)(b)<<8)|((unsigned int)(c)<<16)|((unsigned int)(d)<<24)) |
---|
| 42 | |
---|
| 43 | /* |
---|
| 44 | * E N U M S |
---|
| 45 | */ |
---|
| 46 | enum v4l2_field { |
---|
| 47 | V4L2_FIELD_ANY = 0, /* driver can choose from none, |
---|
| 48 | top, bottom, interlaced |
---|
| 49 | depending on whatever it thinks |
---|
| 50 | is approximate ... */ |
---|
| 51 | V4L2_FIELD_NONE = 1, /* this device has no fields ... */ |
---|
| 52 | V4L2_FIELD_TOP = 2, /* top field only */ |
---|
| 53 | V4L2_FIELD_BOTTOM = 3, /* bottom field only */ |
---|
| 54 | V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ |
---|
| 55 | V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one |
---|
| 56 | buffer, top-bottom order */ |
---|
| 57 | V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ |
---|
| 58 | V4L2_FIELD_ALTERNATE = 7 /* both fields alternating into |
---|
| 59 | separate buffers */ |
---|
| 60 | }; |
---|
| 61 | #define V4L2_FIELD_HAS_TOP(field) \ |
---|
| 62 | ((field) == V4L2_FIELD_TOP ||\ |
---|
| 63 | (field) == V4L2_FIELD_INTERLACED ||\ |
---|
| 64 | (field) == V4L2_FIELD_SEQ_TB ||\ |
---|
| 65 | (field) == V4L2_FIELD_SEQ_BT) |
---|
| 66 | #define V4L2_FIELD_HAS_BOTTOM(field) \ |
---|
| 67 | ((field) == V4L2_FIELD_BOTTOM ||\ |
---|
| 68 | (field) == V4L2_FIELD_INTERLACED ||\ |
---|
| 69 | (field) == V4L2_FIELD_SEQ_TB ||\ |
---|
| 70 | (field) == V4L2_FIELD_SEQ_BT) |
---|
| 71 | #define V4L2_FIELD_HAS_BOTH(field) \ |
---|
| 72 | ((field) == V4L2_FIELD_INTERLACED ||\ |
---|
| 73 | (field) == V4L2_FIELD_SEQ_TB ||\ |
---|
| 74 | (field) == V4L2_FIELD_SEQ_BT) |
---|
| 75 | |
---|
| 76 | enum v4l2_buf_type { |
---|
| 77 | V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, |
---|
| 78 | V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, |
---|
| 79 | V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, |
---|
| 80 | V4L2_BUF_TYPE_VBI_CAPTURE = 4, |
---|
| 81 | V4L2_BUF_TYPE_VBI_OUTPUT = 5, |
---|
| 82 | V4L2_BUF_TYPE_PRIVATE = 0x80 |
---|
| 83 | }; |
---|
| 84 | |
---|
| 85 | enum v4l2_ctrl_type { |
---|
| 86 | V4L2_CTRL_TYPE_INTEGER = 1, |
---|
| 87 | V4L2_CTRL_TYPE_BOOLEAN = 2, |
---|
| 88 | V4L2_CTRL_TYPE_MENU = 3, |
---|
| 89 | V4L2_CTRL_TYPE_BUTTON = 4 |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | enum v4l2_tuner_type { |
---|
| 93 | V4L2_TUNER_RADIO = 1, |
---|
| 94 | V4L2_TUNER_ANALOG_TV = 2 |
---|
| 95 | }; |
---|
| 96 | |
---|
| 97 | enum v4l2_memory { |
---|
| 98 | V4L2_MEMORY_MMAP = 1, |
---|
| 99 | V4L2_MEMORY_USERPTR = 2, |
---|
| 100 | V4L2_MEMORY_OVERLAY = 3 |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ |
---|
| 104 | enum v4l2_colorspace { |
---|
| 105 | /* ITU-R 601 -- broadcast NTSC/PAL */ |
---|
| 106 | V4L2_COLORSPACE_SMPTE170M = 1, |
---|
| 107 | |
---|
| 108 | /* 1125-Line (US) HDTV */ |
---|
| 109 | V4L2_COLORSPACE_SMPTE240M = 2, |
---|
| 110 | |
---|
| 111 | /* HD and modern captures. */ |
---|
| 112 | V4L2_COLORSPACE_REC709 = 3, |
---|
| 113 | |
---|
| 114 | /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ |
---|
| 115 | V4L2_COLORSPACE_BT878 = 4, |
---|
| 116 | |
---|
| 117 | /* These should be useful. Assume 601 extents. */ |
---|
| 118 | V4L2_COLORSPACE_470_SYSTEM_M = 5, |
---|
| 119 | V4L2_COLORSPACE_470_SYSTEM_BG = 6, |
---|
| 120 | |
---|
| 121 | /* I know there will be cameras that send this. So, this is |
---|
| 122 | * unspecified chromaticities and full 0-255 on each of the |
---|
| 123 | * Y'CbCr components |
---|
| 124 | */ |
---|
| 125 | V4L2_COLORSPACE_JPEG = 7, |
---|
| 126 | |
---|
| 127 | /* For RGB colourspaces, this is probably a good start. */ |
---|
| 128 | V4L2_COLORSPACE_SRGB = 8 |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | enum v4l2_priority { |
---|
| 132 | V4L2_PRIORITY_UNSET = 0, /* not initialized */ |
---|
| 133 | V4L2_PRIORITY_BACKGROUND = 1, |
---|
| 134 | V4L2_PRIORITY_INTERACTIVE = 2, |
---|
| 135 | V4L2_PRIORITY_RECORD = 3, |
---|
| 136 | V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | struct v4l2_rect { |
---|
| 140 | int left; |
---|
| 141 | int top; |
---|
| 142 | int width; |
---|
| 143 | int height; |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | struct v4l2_fract { |
---|
| 147 | unsigned int numerator; |
---|
| 148 | unsigned int denominator; |
---|
| 149 | }; |
---|
| 150 | |
---|
| 151 | /* |
---|
| 152 | * D R I V E R C A P A B I L I T I E S |
---|
| 153 | */ |
---|
| 154 | struct v4l2_capability |
---|
| 155 | { |
---|
| 156 | unsigned char driver[16]; /* i.e. "bttv" */ |
---|
| 157 | unsigned char card[32]; /* i.e. "Hauppauge WinTV" */ |
---|
| 158 | unsigned char bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ |
---|
| 159 | unsigned int version; /* should use KERNEL_VERSION() */ |
---|
| 160 | unsigned int capabilities; /* Device capabilities */ |
---|
| 161 | unsigned int reserved[4]; |
---|
| 162 | }; |
---|
| 163 | |
---|
| 164 | /* Values for 'capabilities' field */ |
---|
| 165 | #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ |
---|
| 166 | #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ |
---|
| 167 | #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ |
---|
| 168 | #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a VBI capture device */ |
---|
| 169 | #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a VBI output device */ |
---|
| 170 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ |
---|
| 171 | |
---|
| 172 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ |
---|
| 173 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ |
---|
| 174 | #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ |
---|
| 175 | |
---|
| 176 | #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ |
---|
| 177 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |
---|
| 178 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ |
---|
| 179 | |
---|
| 180 | /* |
---|
| 181 | * V I D E O I M A G E F O R M A T |
---|
| 182 | */ |
---|
| 183 | |
---|
| 184 | struct v4l2_pix_format |
---|
| 185 | { |
---|
| 186 | unsigned int width; |
---|
| 187 | unsigned int height; |
---|
| 188 | unsigned int pixelformat; |
---|
| 189 | enum v4l2_field field; |
---|
| 190 | unsigned int bytesperline; /* for padding, zero if unused */ |
---|
| 191 | unsigned int sizeimage; |
---|
| 192 | enum v4l2_colorspace colorspace; |
---|
| 193 | unsigned int priv; /* private data, depends on pixelformat */ |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | /* Pixel format FOURCC depth Description */ |
---|
| 197 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ |
---|
| 198 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ |
---|
| 199 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ |
---|
| 200 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ |
---|
| 201 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ |
---|
| 202 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ |
---|
| 203 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ |
---|
| 204 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ |
---|
| 205 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ |
---|
| 206 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ |
---|
| 207 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ |
---|
| 208 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ |
---|
| 209 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ |
---|
| 210 | #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ |
---|
| 211 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ |
---|
| 212 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ |
---|
| 213 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ |
---|
| 214 | |
---|
| 215 | /* two planes -- one Y, one Cr + Cb interleaved */ |
---|
| 216 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ |
---|
| 217 | #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ |
---|
| 218 | |
---|
| 219 | /* The following formats are not defined in the V4L2 specification */ |
---|
| 220 | #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ |
---|
| 221 | #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ |
---|
| 222 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ |
---|
| 223 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ |
---|
| 224 | |
---|
| 225 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
---|
| 226 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ |
---|
| 227 | |
---|
| 228 | /* compressed formats */ |
---|
| 229 | #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ |
---|
| 230 | #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ |
---|
| 231 | #define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ |
---|
| 232 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */ |
---|
| 233 | |
---|
| 234 | /* Vendor-specific formats */ |
---|
| 235 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ |
---|
| 236 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ |
---|
| 237 | #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ |
---|
| 238 | #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ |
---|
| 239 | |
---|
| 240 | /* |
---|
| 241 | * F O R M A T E N U M E R A T I O N |
---|
| 242 | */ |
---|
| 243 | struct v4l2_fmtdesc |
---|
| 244 | { |
---|
| 245 | unsigned int index; /* Format number */ |
---|
| 246 | enum v4l2_buf_type type; /* buffer type */ |
---|
| 247 | unsigned int flags; |
---|
| 248 | unsigned char description[32]; /* Description string */ |
---|
| 249 | unsigned int pixelformat; /* Format fourcc */ |
---|
| 250 | unsigned int reserved[4]; |
---|
| 251 | }; |
---|
| 252 | |
---|
| 253 | #define V4L2_FMT_FLAG_COMPRESSED 0x0001 |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | /* |
---|
| 257 | * T I M E C O D E |
---|
| 258 | */ |
---|
| 259 | struct v4l2_timecode |
---|
| 260 | { |
---|
| 261 | unsigned int type; |
---|
| 262 | unsigned int flags; |
---|
| 263 | unsigned char frames; |
---|
| 264 | unsigned char seconds; |
---|
| 265 | unsigned char minutes; |
---|
| 266 | unsigned char hours; |
---|
| 267 | unsigned char userbits[4]; |
---|
| 268 | }; |
---|
| 269 | |
---|
| 270 | /* Type */ |
---|
| 271 | #define V4L2_TC_TYPE_24FPS 1 |
---|
| 272 | #define V4L2_TC_TYPE_25FPS 2 |
---|
| 273 | #define V4L2_TC_TYPE_30FPS 3 |
---|
| 274 | #define V4L2_TC_TYPE_50FPS 4 |
---|
| 275 | #define V4L2_TC_TYPE_60FPS 5 |
---|
| 276 | |
---|
| 277 | /* Flags */ |
---|
| 278 | #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ |
---|
| 279 | #define V4L2_TC_FLAG_COLORFRAME 0x0002 |
---|
| 280 | #define V4L2_TC_USERBITS_field 0x000C |
---|
| 281 | #define V4L2_TC_USERBITS_USERDEFINED 0x0000 |
---|
| 282 | #define V4L2_TC_USERBITS_8BITCHARS 0x0008 |
---|
| 283 | /* The above is based on SMPTE timecodes */ |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | /* |
---|
| 287 | * C O M P R E S S I O N P A R A M E T E R S |
---|
| 288 | */ |
---|
| 289 | #if 0 |
---|
| 290 | /* ### generic compression settings don't work, there is too much |
---|
| 291 | * ### codec-specific stuff. Maybe reuse that for MPEG codec settings |
---|
| 292 | * ### later ... */ |
---|
| 293 | struct v4l2_compression |
---|
| 294 | { |
---|
| 295 | unsigned int quality; |
---|
| 296 | unsigned int keyframerate; |
---|
| 297 | unsigned int pframerate; |
---|
| 298 | unsigned int reserved[5]; |
---|
| 299 | |
---|
| 300 | /* what we'll need for MPEG, extracted from some postings on |
---|
| 301 | the v4l list (Gert Vervoort, PlasmaJohn). |
---|
| 302 | |
---|
| 303 | system stream: |
---|
| 304 | - type: elementary stream(ES), packatised elementary stream(s) (PES) |
---|
| 305 | program stream(PS), transport stream(TS) |
---|
| 306 | - system bitrate |
---|
| 307 | - PS packet size (DVD: 2048 bytes, VCD: 2324 bytes) |
---|
| 308 | - TS video PID |
---|
| 309 | - TS audio PID |
---|
| 310 | - TS PCR PID |
---|
| 311 | - TS system information tables (PAT, PMT, CAT, NIT and SIT) |
---|
| 312 | - (MPEG-1 systems stream vs. MPEG-2 program stream (TS not supported |
---|
| 313 | by MPEG-1 systems) |
---|
| 314 | |
---|
| 315 | audio: |
---|
| 316 | - type: MPEG (+Layer I,II,III), AC-3, LPCM |
---|
| 317 | - bitrate |
---|
| 318 | - sampling frequency (DVD: 48 Khz, VCD: 44.1 KHz, 32 kHz) |
---|
| 319 | - Trick Modes? (ff, rew) |
---|
| 320 | - Copyright |
---|
| 321 | - Inverse Telecine |
---|
| 322 | |
---|
| 323 | video: |
---|
| 324 | - picturesize (SIF, 1/2 D1, 2/3 D1, D1) and PAL/NTSC norm can be set |
---|
| 325 | through excisting V4L2 controls |
---|
| 326 | - noise reduction, parameters encoder specific? |
---|
| 327 | - MPEG video version: MPEG-1, MPEG-2 |
---|
| 328 | - GOP (Group Of Pictures) definition: |
---|
| 329 | - N: number of frames per GOP |
---|
| 330 | - M: distance between reference (I,P) frames |
---|
| 331 | - open/closed GOP |
---|
| 332 | - quantiser matrix: inter Q matrix (64 bytes) and intra Q matrix (64 bytes) |
---|
| 333 | - quantiser scale: linear or logarithmic |
---|
| 334 | - scanning: alternate or zigzag |
---|
| 335 | - bitrate mode: CBR (constant bitrate) or VBR (variable bitrate). |
---|
| 336 | - target video bitrate for CBR |
---|
| 337 | - target video bitrate for VBR |
---|
| 338 | - maximum video bitrate for VBR - min. quantiser value for VBR |
---|
| 339 | - max. quantiser value for VBR |
---|
| 340 | - adaptive quantisation value |
---|
| 341 | - return the number of bytes per GOP or bitrate for bitrate monitoring |
---|
| 342 | |
---|
| 343 | */ |
---|
| 344 | }; |
---|
| 345 | #endif |
---|
| 346 | |
---|
| 347 | struct v4l2_jpegcompression |
---|
| 348 | { |
---|
| 349 | int quality; |
---|
| 350 | |
---|
| 351 | int APPn; /* Number of APP segment to be written, |
---|
| 352 | * must be 0..15 */ |
---|
| 353 | int APP_len; /* Length of data in JPEG APPn segment */ |
---|
| 354 | char APP_data[60]; /* Data in the JPEG APPn segment. */ |
---|
| 355 | |
---|
| 356 | int COM_len; /* Length of data in JPEG COM segment */ |
---|
| 357 | char COM_data[60]; /* Data in JPEG COM segment */ |
---|
| 358 | |
---|
| 359 | unsigned int jpeg_markers; /* Which markers should go into the JPEG |
---|
| 360 | * output. Unless you exactly know what |
---|
| 361 | * you do, leave them untouched. |
---|
| 362 | * Inluding less markers will make the |
---|
| 363 | * resulting code smaller, but there will |
---|
| 364 | * be fewer aplications which can read it. |
---|
| 365 | * The presence of the APP and COM marker |
---|
| 366 | * is influenced by APP_len and COM_len |
---|
| 367 | * ONLY, not by this property! */ |
---|
| 368 | |
---|
| 369 | #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ |
---|
| 370 | #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ |
---|
| 371 | #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ |
---|
| 372 | #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ |
---|
| 373 | #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will |
---|
| 374 | * always use APP0 */ |
---|
| 375 | }; |
---|
| 376 | |
---|
| 377 | |
---|
| 378 | /* |
---|
| 379 | * M E M O R Y - M A P P I N G B U F F E R S |
---|
| 380 | */ |
---|
| 381 | struct v4l2_requestbuffers |
---|
| 382 | { |
---|
| 383 | unsigned int count; |
---|
| 384 | enum v4l2_buf_type type; |
---|
| 385 | enum v4l2_memory memory; |
---|
| 386 | unsigned int reserved[2]; |
---|
| 387 | }; |
---|
| 388 | |
---|
| 389 | struct v4l2_buffer |
---|
| 390 | { |
---|
| 391 | unsigned int index; |
---|
| 392 | enum v4l2_buf_type type; |
---|
| 393 | unsigned int bytesused; |
---|
| 394 | unsigned int flags; |
---|
| 395 | enum v4l2_field field; |
---|
| 396 | struct timeval timestamp; |
---|
| 397 | struct v4l2_timecode timecode; |
---|
| 398 | unsigned int sequence; |
---|
| 399 | |
---|
| 400 | /* memory location */ |
---|
| 401 | enum v4l2_memory memory; |
---|
| 402 | union { |
---|
| 403 | unsigned int offset; |
---|
| 404 | unsigned long userptr; |
---|
| 405 | } m; |
---|
| 406 | unsigned int length; |
---|
| 407 | unsigned int input; |
---|
| 408 | unsigned int reserved; |
---|
| 409 | }; |
---|
| 410 | |
---|
| 411 | /* Flags for 'flags' field */ |
---|
| 412 | #define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ |
---|
| 413 | #define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ |
---|
| 414 | #define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ |
---|
| 415 | #define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ |
---|
| 416 | #define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ |
---|
| 417 | #define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ |
---|
| 418 | #define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ |
---|
| 419 | #define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ |
---|
| 420 | |
---|
| 421 | /* |
---|
| 422 | * O V E R L A Y P R E V I E W |
---|
| 423 | */ |
---|
| 424 | struct v4l2_framebuffer |
---|
| 425 | { |
---|
| 426 | unsigned int capability; |
---|
| 427 | unsigned int flags; |
---|
| 428 | /* FIXME: in theory we should pass something like PCI device + memory |
---|
| 429 | * region + offset instead of some physical address */ |
---|
| 430 | void* base; |
---|
| 431 | struct v4l2_pix_format fmt; |
---|
| 432 | }; |
---|
| 433 | /* Flags for the 'capability' field. Read only */ |
---|
| 434 | #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 |
---|
| 435 | #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 |
---|
| 436 | #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 |
---|
| 437 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 |
---|
| 438 | /* Flags for the 'flags' field. */ |
---|
| 439 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
---|
| 440 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
---|
| 441 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 |
---|
| 442 | |
---|
| 443 | struct v4l2_clip |
---|
| 444 | { |
---|
| 445 | struct v4l2_rect c; |
---|
| 446 | struct v4l2_clip *next; |
---|
| 447 | }; |
---|
| 448 | |
---|
| 449 | struct v4l2_window |
---|
| 450 | { |
---|
| 451 | struct v4l2_rect w; |
---|
| 452 | enum v4l2_field field; |
---|
| 453 | unsigned int chromakey; |
---|
| 454 | struct v4l2_clip *clips; |
---|
| 455 | unsigned int clipcount; |
---|
| 456 | void *bitmap; |
---|
| 457 | }; |
---|
| 458 | |
---|
| 459 | |
---|
| 460 | /* |
---|
| 461 | * C A P T U R E P A R A M E T E R S |
---|
| 462 | */ |
---|
| 463 | struct v4l2_captureparm |
---|
| 464 | { |
---|
| 465 | unsigned int capability; /* Supported modes */ |
---|
| 466 | unsigned int capturemode; /* Current mode */ |
---|
| 467 | struct v4l2_fract timeperframe; /* Time per frame in .1us units */ |
---|
| 468 | unsigned int extendedmode; /* Driver-specific extensions */ |
---|
| 469 | unsigned int readbuffers; /* # of buffers for read */ |
---|
| 470 | unsigned int reserved[4]; |
---|
| 471 | }; |
---|
| 472 | /* Flags for 'capability' and 'capturemode' fields */ |
---|
| 473 | #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ |
---|
| 474 | #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ |
---|
| 475 | |
---|
| 476 | struct v4l2_outputparm |
---|
| 477 | { |
---|
| 478 | unsigned int capability; /* Supported modes */ |
---|
| 479 | unsigned int outputmode; /* Current mode */ |
---|
| 480 | struct v4l2_fract timeperframe; /* Time per frame in seconds */ |
---|
| 481 | unsigned int extendedmode; /* Driver-specific extensions */ |
---|
| 482 | unsigned int writebuffers; /* # of buffers for write */ |
---|
| 483 | unsigned int reserved[4]; |
---|
| 484 | }; |
---|
| 485 | |
---|
| 486 | /* |
---|
| 487 | * I N P U T I M A G E C R O P P I N G |
---|
| 488 | */ |
---|
| 489 | |
---|
| 490 | struct v4l2_cropcap { |
---|
| 491 | enum v4l2_buf_type type; |
---|
| 492 | struct v4l2_rect bounds; |
---|
| 493 | struct v4l2_rect defrect; |
---|
| 494 | struct v4l2_fract pixelaspect; |
---|
| 495 | }; |
---|
| 496 | |
---|
| 497 | struct v4l2_crop { |
---|
| 498 | enum v4l2_buf_type type; |
---|
| 499 | struct v4l2_rect c; |
---|
| 500 | }; |
---|
| 501 | |
---|
| 502 | /* |
---|
| 503 | * A N A L O G V I D E O S T A N D A R D |
---|
| 504 | */ |
---|
| 505 | |
---|
| 506 | typedef unsigned long long v4l2_std_id; |
---|
| 507 | |
---|
| 508 | /* one bit for each */ |
---|
| 509 | #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) |
---|
| 510 | #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) |
---|
| 511 | #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) |
---|
| 512 | #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) |
---|
| 513 | #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) |
---|
| 514 | #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) |
---|
| 515 | #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) |
---|
| 516 | #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) |
---|
| 517 | |
---|
| 518 | #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) |
---|
| 519 | #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) |
---|
| 520 | #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) |
---|
| 521 | #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) |
---|
| 522 | |
---|
| 523 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) |
---|
| 524 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) |
---|
| 525 | |
---|
| 526 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) |
---|
| 527 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) |
---|
| 528 | #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) |
---|
| 529 | #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) |
---|
| 530 | #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) |
---|
| 531 | #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) |
---|
| 532 | #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) |
---|
| 533 | |
---|
| 534 | /* ATSC/HDTV */ |
---|
| 535 | #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) |
---|
| 536 | #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) |
---|
| 537 | |
---|
| 538 | /* some common needed stuff */ |
---|
| 539 | #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ |
---|
| 540 | V4L2_STD_PAL_B1 |\ |
---|
| 541 | V4L2_STD_PAL_G) |
---|
| 542 | #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ |
---|
| 543 | V4L2_STD_PAL_D1 |\ |
---|
| 544 | V4L2_STD_PAL_K) |
---|
| 545 | #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ |
---|
| 546 | V4L2_STD_PAL_DK |\ |
---|
| 547 | V4L2_STD_PAL_H |\ |
---|
| 548 | V4L2_STD_PAL_I) |
---|
| 549 | #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ |
---|
| 550 | V4L2_STD_NTSC_M_JP) |
---|
| 551 | #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ |
---|
| 552 | V4L2_STD_SECAM_K |\ |
---|
| 553 | V4L2_STD_SECAM_K1) |
---|
| 554 | #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ |
---|
| 555 | V4L2_STD_SECAM_G |\ |
---|
| 556 | V4L2_STD_SECAM_H |\ |
---|
| 557 | V4L2_STD_SECAM_DK |\ |
---|
| 558 | V4L2_STD_SECAM_L) |
---|
| 559 | |
---|
| 560 | #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ |
---|
| 561 | V4L2_STD_PAL_60 |\ |
---|
| 562 | V4L2_STD_NTSC) |
---|
| 563 | #define V4L2_STD_625_50 (V4L2_STD_PAL |\ |
---|
| 564 | V4L2_STD_PAL_N |\ |
---|
| 565 | V4L2_STD_PAL_Nc |\ |
---|
| 566 | V4L2_STD_SECAM) |
---|
| 567 | #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ |
---|
| 568 | V4L2_STD_ATSC_16_VSB) |
---|
| 569 | |
---|
| 570 | #define V4L2_STD_UNKNOWN 0 |
---|
| 571 | #define V4L2_STD_ALL (V4L2_STD_525_60 |\ |
---|
| 572 | V4L2_STD_625_50) |
---|
| 573 | |
---|
| 574 | struct v4l2_standard |
---|
| 575 | { |
---|
| 576 | unsigned int index; |
---|
| 577 | v4l2_std_id id; |
---|
| 578 | unsigned char name[24]; |
---|
| 579 | struct v4l2_fract frameperiod; /* Frames, not fields */ |
---|
| 580 | unsigned int framelines; |
---|
| 581 | unsigned int reserved[4]; |
---|
| 582 | }; |
---|
| 583 | |
---|
| 584 | |
---|
| 585 | /* |
---|
| 586 | * V I D E O I N P U T S |
---|
| 587 | */ |
---|
| 588 | struct v4l2_input |
---|
| 589 | { |
---|
| 590 | unsigned int index; /* Which input */ |
---|
| 591 | unsigned char name[32]; /* Label */ |
---|
| 592 | unsigned int type; /* Type of input */ |
---|
| 593 | unsigned int audioset; /* Associated audios (bitfield) */ |
---|
| 594 | unsigned int tuner; /* Associated tuner */ |
---|
| 595 | v4l2_std_id std; |
---|
| 596 | unsigned int status; |
---|
| 597 | unsigned int reserved[4]; |
---|
| 598 | }; |
---|
| 599 | /* Values for the 'type' field */ |
---|
| 600 | #define V4L2_INPUT_TYPE_TUNER 1 |
---|
| 601 | #define V4L2_INPUT_TYPE_CAMERA 2 |
---|
| 602 | |
---|
| 603 | /* field 'status' - general */ |
---|
| 604 | #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ |
---|
| 605 | #define V4L2_IN_ST_NO_SIGNAL 0x00000002 |
---|
| 606 | #define V4L2_IN_ST_NO_COLOR 0x00000004 |
---|
| 607 | |
---|
| 608 | /* field 'status' - analog */ |
---|
| 609 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ |
---|
| 610 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ |
---|
| 611 | |
---|
| 612 | /* field 'status' - digital */ |
---|
| 613 | #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ |
---|
| 614 | #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ |
---|
| 615 | #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ |
---|
| 616 | |
---|
| 617 | /* field 'status' - VCR and set-top box */ |
---|
| 618 | #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ |
---|
| 619 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ |
---|
| 620 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ |
---|
| 621 | |
---|
| 622 | /* |
---|
| 623 | * V I D E O O U T P U T S |
---|
| 624 | */ |
---|
| 625 | struct v4l2_output |
---|
| 626 | { |
---|
| 627 | unsigned int index; /* Which output */ |
---|
| 628 | unsigned char name[32]; /* Label */ |
---|
| 629 | unsigned int type; /* Type of output */ |
---|
| 630 | unsigned int audioset; /* Associated audios (bitfield) */ |
---|
| 631 | unsigned int modulator; /* Associated modulator */ |
---|
| 632 | v4l2_std_id std; |
---|
| 633 | unsigned int reserved[4]; |
---|
| 634 | }; |
---|
| 635 | /* Values for the 'type' field */ |
---|
| 636 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 |
---|
| 637 | #define V4L2_OUTPUT_TYPE_ANALOG 2 |
---|
| 638 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 |
---|
| 639 | |
---|
| 640 | /* |
---|
| 641 | * C O N T R O L S |
---|
| 642 | */ |
---|
| 643 | struct v4l2_control |
---|
| 644 | { |
---|
| 645 | unsigned int id; |
---|
| 646 | int value; |
---|
| 647 | }; |
---|
| 648 | |
---|
| 649 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ |
---|
| 650 | struct v4l2_queryctrl |
---|
| 651 | { |
---|
| 652 | unsigned int id; |
---|
| 653 | enum v4l2_ctrl_type type; |
---|
| 654 | unsigned char name[32]; /* Whatever */ |
---|
| 655 | int minimum; /* Note signedness */ |
---|
| 656 | int maximum; |
---|
| 657 | int step; |
---|
| 658 | int default_value; |
---|
| 659 | unsigned int flags; |
---|
| 660 | unsigned int reserved[2]; |
---|
| 661 | }; |
---|
| 662 | |
---|
| 663 | /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ |
---|
| 664 | struct v4l2_querymenu |
---|
| 665 | { |
---|
| 666 | unsigned int id; |
---|
| 667 | unsigned int index; |
---|
| 668 | unsigned char name[32]; /* Whatever */ |
---|
| 669 | unsigned int reserved; |
---|
| 670 | }; |
---|
| 671 | |
---|
| 672 | /* Control flags */ |
---|
| 673 | #define V4L2_CTRL_FLAG_DISABLED 0x0001 |
---|
| 674 | #define V4L2_CTRL_FLAG_GRABBED 0x0002 |
---|
| 675 | |
---|
| 676 | /* Control IDs defined by V4L2 */ |
---|
| 677 | #define V4L2_CID_BASE 0x00980900 |
---|
| 678 | /* IDs reserved for driver specific controls */ |
---|
| 679 | #define V4L2_CID_PRIVATE_BASE 0x08000000 |
---|
| 680 | |
---|
| 681 | #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) |
---|
| 682 | #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) |
---|
| 683 | #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) |
---|
| 684 | #define V4L2_CID_HUE (V4L2_CID_BASE+3) |
---|
| 685 | #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) |
---|
| 686 | #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) |
---|
| 687 | #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) |
---|
| 688 | #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) |
---|
| 689 | #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) |
---|
| 690 | #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) |
---|
| 691 | #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) |
---|
| 692 | #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) |
---|
| 693 | #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) |
---|
| 694 | #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) |
---|
| 695 | #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) |
---|
| 696 | #define V4L2_CID_GAMMA (V4L2_CID_BASE+16) |
---|
| 697 | #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */ |
---|
| 698 | #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) |
---|
| 699 | #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) |
---|
| 700 | #define V4L2_CID_GAIN (V4L2_CID_BASE+19) |
---|
| 701 | #define V4L2_CID_HFLIP (V4L2_CID_BASE+20) |
---|
| 702 | #define V4L2_CID_VFLIP (V4L2_CID_BASE+21) |
---|
| 703 | #define V4L2_CID_HCENTER (V4L2_CID_BASE+22) |
---|
| 704 | #define V4L2_CID_VCENTER (V4L2_CID_BASE+23) |
---|
| 705 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ |
---|
| 706 | |
---|
| 707 | /* |
---|
| 708 | * T U N I N G |
---|
| 709 | */ |
---|
| 710 | struct v4l2_tuner |
---|
| 711 | { |
---|
| 712 | unsigned int index; |
---|
| 713 | unsigned char name[32]; |
---|
| 714 | enum v4l2_tuner_type type; |
---|
| 715 | unsigned int capability; |
---|
| 716 | unsigned int rangelow; |
---|
| 717 | unsigned int rangehigh; |
---|
| 718 | unsigned int rxsubchans; |
---|
| 719 | unsigned int audmode; |
---|
| 720 | int signal; |
---|
| 721 | int afc; |
---|
| 722 | unsigned int reserved[4]; |
---|
| 723 | }; |
---|
| 724 | |
---|
| 725 | struct v4l2_modulator |
---|
| 726 | { |
---|
| 727 | unsigned int index; |
---|
| 728 | unsigned char name[32]; |
---|
| 729 | unsigned int capability; |
---|
| 730 | unsigned int rangelow; |
---|
| 731 | unsigned int rangehigh; |
---|
| 732 | unsigned int txsubchans; |
---|
| 733 | unsigned int reserved[4]; |
---|
| 734 | }; |
---|
| 735 | |
---|
| 736 | /* Flags for the 'capability' field */ |
---|
| 737 | #define V4L2_TUNER_CAP_LOW 0x0001 |
---|
| 738 | #define V4L2_TUNER_CAP_NORM 0x0002 |
---|
| 739 | #define V4L2_TUNER_CAP_STEREO 0x0010 |
---|
| 740 | #define V4L2_TUNER_CAP_LANG2 0x0020 |
---|
| 741 | #define V4L2_TUNER_CAP_SAP 0x0020 |
---|
| 742 | #define V4L2_TUNER_CAP_LANG1 0x0040 |
---|
| 743 | |
---|
| 744 | /* Flags for the 'rxsubchans' field */ |
---|
| 745 | #define V4L2_TUNER_SUB_MONO 0x0001 |
---|
| 746 | #define V4L2_TUNER_SUB_STEREO 0x0002 |
---|
| 747 | #define V4L2_TUNER_SUB_LANG2 0x0004 |
---|
| 748 | #define V4L2_TUNER_SUB_SAP 0x0004 |
---|
| 749 | #define V4L2_TUNER_SUB_LANG1 0x0008 |
---|
| 750 | |
---|
| 751 | /* Values for the 'audmode' field */ |
---|
| 752 | #define V4L2_TUNER_MODE_MONO 0x0000 |
---|
| 753 | #define V4L2_TUNER_MODE_STEREO 0x0001 |
---|
| 754 | #define V4L2_TUNER_MODE_LANG2 0x0002 |
---|
| 755 | #define V4L2_TUNER_MODE_SAP 0x0002 |
---|
| 756 | #define V4L2_TUNER_MODE_LANG1 0x0003 |
---|
| 757 | |
---|
| 758 | struct v4l2_frequency |
---|
| 759 | { |
---|
| 760 | unsigned int tuner; |
---|
| 761 | enum v4l2_tuner_type type; |
---|
| 762 | unsigned int frequency; |
---|
| 763 | unsigned int reserved[8]; |
---|
| 764 | }; |
---|
| 765 | |
---|
| 766 | /* |
---|
| 767 | * A U D I O |
---|
| 768 | */ |
---|
| 769 | struct v4l2_audio |
---|
| 770 | { |
---|
| 771 | unsigned int index; |
---|
| 772 | unsigned char name[32]; |
---|
| 773 | unsigned int capability; |
---|
| 774 | unsigned int mode; |
---|
| 775 | unsigned int reserved[2]; |
---|
| 776 | }; |
---|
| 777 | /* Flags for the 'capability' field */ |
---|
| 778 | #define V4L2_AUDCAP_STEREO 0x00001 |
---|
| 779 | #define V4L2_AUDCAP_AVL 0x00002 |
---|
| 780 | |
---|
| 781 | /* Flags for the 'mode' field */ |
---|
| 782 | #define V4L2_AUDMODE_AVL 0x00001 |
---|
| 783 | |
---|
| 784 | struct v4l2_audioout |
---|
| 785 | { |
---|
| 786 | unsigned int index; |
---|
| 787 | unsigned char name[32]; |
---|
| 788 | unsigned int capability; |
---|
| 789 | unsigned int mode; |
---|
| 790 | unsigned int reserved[2]; |
---|
| 791 | }; |
---|
| 792 | |
---|
| 793 | /* |
---|
| 794 | * D A T A S E R V I C E S ( V B I ) |
---|
| 795 | * |
---|
| 796 | * Data services API by Michael Schimek |
---|
| 797 | */ |
---|
| 798 | |
---|
| 799 | struct v4l2_vbi_format |
---|
| 800 | { |
---|
| 801 | unsigned int sampling_rate; /* in 1 Hz */ |
---|
| 802 | unsigned int offset; |
---|
| 803 | unsigned int samples_per_line; |
---|
| 804 | unsigned int sample_format; /* V4L2_PIX_FMT_* */ |
---|
| 805 | int start[2]; |
---|
| 806 | unsigned int count[2]; |
---|
| 807 | unsigned int flags; /* V4L2_VBI_* */ |
---|
| 808 | unsigned int reserved[2]; /* must be zero */ |
---|
| 809 | }; |
---|
| 810 | |
---|
| 811 | /* VBI flags */ |
---|
| 812 | #define V4L2_VBI_UNSYNC (1<< 0) |
---|
| 813 | #define V4L2_VBI_INTERLACED (1<< 1) |
---|
| 814 | |
---|
| 815 | |
---|
| 816 | /* |
---|
| 817 | * A G G R E G A T E S T R U C T U R E S |
---|
| 818 | */ |
---|
| 819 | |
---|
| 820 | /* Stream data format |
---|
| 821 | */ |
---|
| 822 | struct v4l2_format |
---|
| 823 | { |
---|
| 824 | enum v4l2_buf_type type; |
---|
| 825 | union |
---|
| 826 | { |
---|
| 827 | struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE |
---|
| 828 | struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY |
---|
| 829 | struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE |
---|
| 830 | unsigned char raw_data[200]; // user-defined |
---|
| 831 | } fmt; |
---|
| 832 | }; |
---|
| 833 | |
---|
| 834 | |
---|
| 835 | /* Stream type-dependent parameters |
---|
| 836 | */ |
---|
| 837 | struct v4l2_streamparm |
---|
| 838 | { |
---|
| 839 | enum v4l2_buf_type type; |
---|
| 840 | union |
---|
| 841 | { |
---|
| 842 | struct v4l2_captureparm capture; |
---|
| 843 | struct v4l2_outputparm output; |
---|
| 844 | unsigned char raw_data[200]; /* user-defined */ |
---|
| 845 | } parm; |
---|
| 846 | }; |
---|
| 847 | |
---|
| 848 | |
---|
| 849 | |
---|
| 850 | /* |
---|
| 851 | * 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 |
---|
| 852 | * |
---|
| 853 | */ |
---|
| 854 | #define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) |
---|
| 855 | #define VIDIOC_RESERVED _IO ('V', 1) |
---|
| 856 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) |
---|
| 857 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) |
---|
| 858 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) |
---|
| 859 | #if 0 |
---|
| 860 | #define VIDIOC_G_COMP _IOR ('V', 6, struct v4l2_compression) |
---|
| 861 | #define VIDIOC_S_COMP _IOW ('V', 7, struct v4l2_compression) |
---|
| 862 | #endif |
---|
| 863 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) |
---|
| 864 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) |
---|
| 865 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) |
---|
| 866 | #define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) |
---|
| 867 | #define VIDIOC_OVERLAY _IOW ('V', 14, int) |
---|
| 868 | #define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) |
---|
| 869 | #define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) |
---|
| 870 | #define VIDIOC_STREAMON _IOW ('V', 18, int) |
---|
| 871 | #define VIDIOC_STREAMOFF _IOW ('V', 19, int) |
---|
| 872 | #define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) |
---|
| 873 | #define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) |
---|
| 874 | #define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) |
---|
| 875 | #define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) |
---|
| 876 | #define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) |
---|
| 877 | #define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) |
---|
| 878 | #define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) |
---|
| 879 | #define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) |
---|
| 880 | #define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) |
---|
| 881 | #define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) |
---|
| 882 | #define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) |
---|
| 883 | #define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) |
---|
| 884 | #define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) |
---|
| 885 | #define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) |
---|
| 886 | #define VIDIOC_G_INPUT _IOR ('V', 38, int) |
---|
| 887 | #define VIDIOC_S_INPUT _IOWR ('V', 39, int) |
---|
| 888 | #define VIDIOC_G_OUTPUT _IOR ('V', 46, int) |
---|
| 889 | #define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) |
---|
| 890 | #define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) |
---|
| 891 | #define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) |
---|
| 892 | #define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) |
---|
| 893 | #define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) |
---|
| 894 | #define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) |
---|
| 895 | #define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) |
---|
| 896 | #define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) |
---|
| 897 | #define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) |
---|
| 898 | #define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) |
---|
| 899 | #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) |
---|
| 900 | #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) |
---|
| 901 | #define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) |
---|
| 902 | #define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) |
---|
| 903 | #define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) |
---|
| 904 | #define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) |
---|
| 905 | #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) |
---|
| 906 | #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) |
---|
| 907 | #define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) |
---|
| 908 | |
---|
| 909 | /* for compatibility, will go away some day */ |
---|
| 910 | #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) |
---|
| 911 | #define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) |
---|
| 912 | #define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) |
---|
| 913 | #define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) |
---|
| 914 | #define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) |
---|
| 915 | #define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) |
---|
| 916 | |
---|
| 917 | #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ |
---|
| 918 | |
---|
| 919 | #endif /* __LINUX_VIDEODEV2_H */ |
---|
| 920 | |
---|
| 921 | /* |
---|
| 922 | * Local variables: |
---|
| 923 | * c-basic-offset: 8 |
---|
| 924 | * End: |
---|
| 925 | */ |
---|