Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 #ifndef __LINUX_VIDEODEV2_H
  2 #define __LINUX_VIDEODEV2_H
  3 /*
  4  *      Video for Linux Two
  5  *
  6  *      Header file for v4l or V4L2 drivers and applications, for
  7  *      Linux kernels 2.2.x or 2.4.x.
  8  *
  9  *      See http://www.thedirks.org/v4l2/ for API specs and other
 10  *      v4l2 documentation.
 11  *
 12  *      Author: Bill Dirks <bdirks@pacbell.net>
 13  *              Justin Schoeman
 14  *              et al.
 15  */
 16 
 17 #define V4L2_MAJOR_VERSION      0
 18 #define V4L2_MINOR_VERSION      20
 19 
 20 
 21 /*
 22  *      M I S C E L L A N E O U S
 23  */
 24 
 25 /*  Four-character-code (FOURCC) */
 26 #define v4l2_fourcc(a,b,c,d)\
 27         (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
 28 
 29 /*  Open flag for non-capturing opens on capture devices  */
 30 #define O_NONCAP        O_TRUNC
 31 #define O_NOIO          O_TRUNC
 32 
 33 /*  Timestamp data type, 64-bit signed integer, in nanoseconds  */
 34 #ifndef STAMP_T
 35 #define STAMP_T
 36 typedef __s64 stamp_t;
 37 #endif
 38 
 39 /*
 40  *      D R I V E R   C A P A B I L I T I E S
 41  */
 42 struct v4l2_capability
 43 {
 44         char            name[32];       /* Descriptive, and unique */
 45         unsigned int    type;           /* Device type, see below */
 46         unsigned int    inputs;         /* Num video inputs */
 47         unsigned int    outputs;        /* Num video outputs */
 48         unsigned int    audios;         /* Num audio devices */
 49         unsigned int    maxwidth;
 50         unsigned int    maxheight;
 51         unsigned int    minwidth;
 52         unsigned int    minheight;
 53         unsigned int    maxframerate;
 54         __u32           flags;          /* Feature flags, see below */
 55         __u32           reserved[4];
 56 };
 57 /* Values for 'type' field */
 58 #define V4L2_TYPE_CAPTURE       0       /* Is a video capture device */
 59 #define V4L2_TYPE_CODEC         1       /* Is a CODEC device */
 60 #define V4L2_TYPE_OUTPUT        2       /* Is a video output device */
 61 #define V4L2_TYPE_FX            3       /* Is a video effects device */
 62 #define V4L2_TYPE_VBI           4       /* Is a VBI capture device */
 63 #define V4L2_TYPE_VTR           5       /* Is a tape recorder controller */
 64 #define V4L2_TYPE_VTX           6       /* Is a teletext device */
 65 #define V4L2_TYPE_RADIO         7       /* Is a radio device */
 66 #define V4L2_TYPE_VBI_INPUT     4       /* Is a VBI capture device */
 67 #define V4L2_TYPE_VBI_OUTPUT    9       /* Is a VBI output device */
 68 #define V4L2_TYPE_PRIVATE       1000    /* Start of driver private types */
 69 /* Flags for 'flags' field */
 70 #define V4L2_FLAG_READ          0x00001 /* Can capture via read() call */
 71 #define V4L2_FLAG_WRITE         0x00002 /* Can accept data via write() */
 72 #define V4L2_FLAG_STREAMING     0x00004 /* Can capture streaming video */
 73 #define V4L2_FLAG_PREVIEW       0x00008 /* Can do automatic preview */
 74 #define V4L2_FLAG_SELECT        0x00010 /* Supports the select() call */
 75 #define V4L2_FLAG_TUNER         0x00020 /* Can tune */
 76 #define V4L2_FLAG_MONOCHROME    0x00040 /* Monochrome only */
 77 #define V4L2_FLAG_DATA_SERVICE  0x00080 /* Has a related data service dev. */
 78 
 79 
 80 /*
 81  *      V I D E O   I M A G E   F O R M A T
 82  */
 83 struct v4l2_pix_format
 84 {
 85         __u32   width;
 86         __u32   height;
 87         __u32   depth;
 88         __u32   pixelformat;
 89         __u32   flags;
 90         __u32   bytesperline;   /* only used when there are pad bytes */
 91         __u32   sizeimage;
 92         __u32   priv;           /* private data, depends on pixelformat */
 93 };
 94 /*           Pixel format    FOURCC                  depth  Description   */
 95 #define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R','G','B','1') /*  8  RGB-3-3-2     */
 96 #define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R','G','B','O') /* 16  RGB-5-5-5     */
 97 #define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R','G','B','P') /* 16  RGB-5-6-5     */
 98 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16  RGB-5-5-5 BE  */
 99 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16  RGB-5-6-5 BE  */
100 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B','G','R','3') /* 24  BGR-8-8-8     */
101 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R','G','B','3') /* 24  RGB-8-8-8     */
102 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B','G','R','4') /* 32  BGR-8-8-8-8   */
103 #define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R','G','B','4') /* 32  RGB-8-8-8-8   */
104 #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G','R','E','Y') /*  8  Greyscale     */
105 #define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y','V','U','9') /*  9  YVU 4:1:0     */
106 #define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y','V','1','2') /* 12  YVU 4:2:0     */
107 #define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y','U','Y','V') /* 16  YUV 4:2:2     */
108 #define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U','Y','V','Y') /* 16  YUV 4:2:2     */
109 #if 0
110 #define V4L2_PIX_FMT_YVU422P v4l2_fourcc('4','2','2','P') /* 16  YVU422 planar */
111 #define V4L2_PIX_FMT_YVU411P v4l2_fourcc('4','1','1','P') /* 16  YVU411 planar */
112 #endif
113 #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16  YVU422 planar */
114 #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16  YVU411 planar */
115 #define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y','4','1','P') /* 12  YUV 4:1:1     */
116 
117 /* two planes -- one Y, one Cr + Cb interleaved  */
118 #define V4L2_PIX_FMT_NV12    v4l2_fourcc('N','V','1','2') /* 12  Y/CbCr 4:2:0  */
119 #define V4L2_PIX_FMT_NV21    v4l2_fourcc('N','V','2','1') /* 12  Y/CrCb 4:2:0  */
120 
121 /*  The following formats are not defined in the V4L2 specification */
122 #define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y','U','V','9') /*  9  YUV 4:1:0     */
123 #define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y','U','1','2') /* 12  YUV 4:2:0     */
124 #define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y','Y','U','V') /* 16  YUV 4:2:2     */
125 #define V4L2_PIX_FMT_HI240   v4l2_fourcc('H','I','2','4') /*  8  8-bit color   */
126 
127 /*  Vendor-specific formats   */
128 #define V4L2_PIX_FMT_WNVA    v4l2_fourcc('W','N','V','A') /* Winnov hw compres */
129 
130 
131 /*  Flags */
132 #define V4L2_FMT_FLAG_COMPRESSED        0x0001  /* Compressed format */
133 #define V4L2_FMT_FLAG_BYTESPERLINE      0x0002  /* bytesperline field valid */
134 #define V4L2_FMT_FLAG_NOT_INTERLACED    0x0000
135 #define V4L2_FMT_FLAG_INTERLACED        0x0004  /* Image is interlaced */
136 #define V4L2_FMT_FLAG_TOPFIELD          0x0008  /* is a top field only */
137 #define V4L2_FMT_FLAG_BOTFIELD          0x0010  /* is a bottom field only */
138 #define V4L2_FMT_FLAG_ODDFIELD          V4L2_FMT_FLAG_TOPFIELD
139 #define V4L2_FMT_FLAG_EVENFIELD         V4L2_FMT_FLAG_BOTFIELD
140 #define V4L2_FMT_FLAG_COMBINED          V4L2_FMT_FLAG_INTERLACED
141 #define V4L2_FMT_FLAG_FIELD_field       0x001C
142 #define V4L2_FMT_CS_field               0xF000  /* Color space field mask */
143 #define V4L2_FMT_CS_601YUV              0x1000  /* ITU YCrCb color space */
144 #define V4L2_FMT_FLAG_SWCONVERSION      0x0800  /* used only in format enum. */
145 /*  SWCONVERSION indicates the format is not natively supported by the  */
146 /*  driver and the driver uses software conversion to support it  */
147 
148 
149 /*
150  *      F O R M A T   E N U M E R A T I O N
151  */
152 struct v4l2_fmtdesc
153 {
154         int     index;                  /* Format number */
155         char    description[32];        /* Description string */
156         __u32   pixelformat;            /* Format fourcc */
157         __u32   flags;                  /* Format flags */
158         __u32   depth;                  /* Bits per pixel */
159         __u32   reserved[2];
160 };
161 
162 struct v4l2_cvtdesc
163 {
164         int     index;
165         struct
166         {
167                 __u32   pixelformat;
168                 __u32   flags;
169                 __u32   depth;
170                 __u32   reserved[2];
171         }       in, out;
172 };
173 
174 struct v4l2_fxdesc
175 {
176         int     index;
177         char    name[32];
178         __u32   flags;
179         __u32   inputs;
180         __u32   controls;
181         __u32   reserved[2];
182 };
183 
184 
185 /*
186  *      T I M E C O D E
187  */
188 struct v4l2_timecode
189 {
190         __u8    frames;
191         __u8    seconds;
192         __u8    minutes;
193         __u8    hours;
194         __u8    userbits[4];
195         __u32   flags;
196         __u32   type;
197 };
198 /*  Type  */
199 #define V4L2_TC_TYPE_24FPS              1
200 #define V4L2_TC_TYPE_25FPS              2
201 #define V4L2_TC_TYPE_30FPS              3
202 #define V4L2_TC_TYPE_50FPS              4
203 #define V4L2_TC_TYPE_60FPS              5
204 
205 
206 /*  Flags  */
207 #define V4L2_TC_FLAG_DROPFRAME          0x0001 /* "drop-frame" mode */
208 #define V4L2_TC_FLAG_COLORFRAME         0x0002
209 #define V4L2_TC_USERBITS_field          0x000C
210 #define V4L2_TC_USERBITS_USERDEFINED    0x0000
211 #define V4L2_TC_USERBITS_8BITCHARS      0x0008
212 /* The above is based on SMPTE timecodes */
213 
214 
215 /*
216  *      C O M P R E S S I O N   P A R A M E T E R S
217  */
218 struct v4l2_compression
219 {
220         int     quality;
221         int     keyframerate;
222         int     pframerate;
223         __u32   reserved[5];
224 };
225 
226 
227 /*
228  *      M E M O R Y - M A P P I N G   B U F F E R S
229  */
230 struct v4l2_requestbuffers
231 {
232         int     count;
233         __u32   type;
234         __u32   reserved[2];
235 };
236 struct v4l2_buffer
237 {
238         int                     index;
239         __u32                   type;
240         __u32                   offset;
241         __u32                   length;
242         __u32                   bytesused;
243         __u32                   flags;
244         stamp_t                 timestamp;
245         struct v4l2_timecode    timecode;
246         __u32                   sequence;
247         __u32                   reserved[3];
248 };
249 /*  Buffer type codes and flags for 'type' field */
250 #define V4L2_BUF_TYPE_field             0x00001FFF  /* Type field mask  */
251 #define V4L2_BUF_TYPE_CAPTURE           0x00000001
252 #define V4L2_BUF_TYPE_CODECIN           0x00000002
253 #define V4L2_BUF_TYPE_CODECOUT          0x00000003
254 #define V4L2_BUF_TYPE_EFFECTSIN         0x00000004
255 #define V4L2_BUF_TYPE_EFFECTSIN2        0x00000005
256 #define V4L2_BUF_TYPE_EFFECTSOUT        0x00000006
257 #define V4L2_BUF_TYPE_VIDEOOUT          0x00000007
258 #define V4L2_BUF_TYPE_FXCONTROL         0x00000008
259 #define V4L2_BUF_TYPE_VBI               0x00000009
260 
261 /*  Starting value of driver private buffer types  */
262 #define V4L2_BUF_TYPE_PRIVATE           0x00001000
263 
264 #define V4L2_BUF_ATTR_DEVICEMEM 0x00010000  /* Buffer is on device (flag) */
265 
266 /*  Flags used only in VIDIOC_REQBUFS  */
267 #define V4L2_BUF_REQ_field      0xF0000000
268 #define V4L2_BUF_REQ_CONTIG     0x10000000  /* Map all buffers in one
269                                                contiguous mmap(). This flag
270                                                only used in VIDIOC_REQBUFS */
271 
272 /*  Flags for 'flags' field */
273 #define V4L2_BUF_FLAG_MAPPED    0x0001  /* Buffer is mapped (flag) */
274 #define V4L2_BUF_FLAG_QUEUED    0x0002  /* Buffer is queued for processing */
275 #define V4L2_BUF_FLAG_DONE      0x0004  /* Buffer is ready */
276 #define V4L2_BUF_FLAG_KEYFRAME  0x0008  /* Image is a keyframe (I-frame) */
277 #define V4L2_BUF_FLAG_PFRAME    0x0010  /* Image is a P-frame */
278 #define V4L2_BUF_FLAG_BFRAME    0x0020  /* Image is a B-frame */
279 #define V4L2_BUF_FLAG_TOPFIELD  0x0040  /* Image is a top field only */
280 #define V4L2_BUF_FLAG_BOTFIELD  0x0080  /* Image is a bottom field only */
281 #define V4L2_BUF_FLAG_ODDFIELD  V4L2_BUF_FLAG_TOPFIELD
282 #define V4L2_BUF_FLAG_EVENFIELD V4L2_BUF_FLAG_BOTFIELD
283 #define V4L2_BUF_FLAG_TIMECODE  0x0100  /* timecode field is valid */
284 
285 /*
286  *      O V E R L A Y   P R E V I E W
287  */
288 struct v4l2_framebuffer
289 {
290         __u32                   capability;
291         __u32                   flags;
292         void                    *base[3];
293         struct v4l2_pix_format  fmt;
294 };
295 /*  Flags for the 'capability' field. Read only */
296 #define V4L2_FBUF_CAP_EXTERNOVERLAY     0x0001
297 #define V4L2_FBUF_CAP_CHROMAKEY         0x0002
298 #define V4L2_FBUF_CAP_CLIPPING          0x0004
299 #define V4L2_FBUF_CAP_SCALEUP           0x0008
300 #define V4L2_FBUF_CAP_SCALEDOWN         0x0010
301 #define V4L2_FBUF_CAP_BITMAP_CLIPPING   0x0020
302 /*  Flags for the 'flags' field. */
303 #define V4L2_FBUF_FLAG_PRIMARY          0x0001
304 #define V4L2_FBUF_FLAG_OVERLAY          0x0002
305 #define V4L2_FBUF_FLAG_CHROMAKEY        0x0004
306 
307 struct v4l2_clip
308 {
309         int                     x;
310         int                     y;
311         int                     width;
312         int                     height;
313         struct v4l2_clip        *next;
314 };
315 struct v4l2_window
316 {
317         int                     x;
318         int                     y;
319         unsigned int            width;
320         unsigned int            height;
321         __u32                   chromakey;
322         struct v4l2_clip        *clips;
323         int                     clipcount;
324         void                    *bitmap;
325 };
326 
327 
328 /*
329  *      D E V I C E   P E R F O R M A N C E
330  */
331 struct v4l2_performance
332 {
333         int     frames;
334         int     framesdropped;
335         __u64   bytesin;
336         __u64   bytesout;
337         __u32   reserved[4];
338 };
339 
340 /*
341  *      C A P T U R E   P A R A M E T E R S
342  */
343 struct v4l2_captureparm
344 {
345         __u32           capability;     /*  Supported modes */
346         __u32           capturemode;    /*  Current mode */
347         unsigned long   timeperframe;   /*  Time per frame in .1us units */
348         __u32           extendedmode;   /*  Driver-specific extensions */
349         __u32           reserved[4];
350 };
351 /*  Flags for 'capability' and 'capturemode' fields */
352 #define V4L2_MODE_HIGHQUALITY   0x0001  /*  High quality imaging mode */
353 //#define V4L2_MODE_VFLIP               0x0002  /*  Flip image vertically */
354 //#define V4L2_MODE_HFLIP               0x0004  /*  Flip image horizontally */
355 #define V4L2_CAP_TIMEPERFRAME   0x1000  /*  timeperframe field is supported */
356 
357 struct v4l2_outputparm
358 {
359         __u32           capability;     /*  Supported modes */
360         __u32           outputmode;     /*  Current mode */
361         unsigned long   timeperframe;   /*  Time per frame in .1us units */
362         __u32           extendedmode;   /*  Driver-specific extensions */
363         __u32           reserved[4];
364 };
365 
366 /*
367  *      I N P U T   I M A G E   C R O P P I N G
368  */
369 struct v4l2_cropcap
370 {
371         __u32   capability;
372         int     min_x;
373         int     min_y;
374         int     max_x;
375         int     max_y;
376         int     default_left;
377         int     default_top;
378         int     default_right;
379         int     default_bottom;
380         __u32   reserved[2];
381 };
382 struct v4l2_crop
383 {
384         int     left;
385         int     top;
386         int     right;
387         int     bottom;
388         __u32   reserved;
389 };
390 
391 /*
392  *      D I G I T A L   Z O O M
393  */
394 struct v4l2_zoomcap
395 {
396         __u32   capability;
397         __u32   maxwidth;
398         __u32   maxheight;
399         __u32   minwidth;
400         __u32   minheight;
401         __u32   reserved[2];
402 };
403 /*  Flags for the capability field  */
404 #define V4L2_ZOOM_NONCAP                0x0001
405 #define V4L2_ZOOM_WHILESTREAMING        0x0002
406 
407 struct v4l2_zoom
408 {
409         __u32   x;
410         __u32   y;
411         __u32   width;
412         __u32   height;
413         __u32   reserved;
414 };
415 
416 
417 /*
418  *      A N A L O G   V I D E O   S T A N D A R D
419  */
420 struct v4l2_standard
421 {
422         __u8            name[24];
423         struct {
424                 __u32   numerator;
425                 __u32   denominator;    /* >= 1 */
426         } framerate;                    /* Frames, not fields */
427         __u32           framelines;
428         __u32           reserved1;
429         __u32           colorstandard;
430         union {                         
431                 struct {
432                         __u32           colorsubcarrier; /* Hz */
433                 }               pal;
434                 struct {                                        
435                         __u32           colorsubcarrier; /* Hz */
436                 }               ntsc;
437                 struct {
438                         __u32           f0b;    /* Hz (blue) */
439                         __u32           f0r;    /* Hz (red)  */
440                 }               secam;
441                 __u8            reserved[12];
442         } colorstandard_data;
443         __u32           transmission;   /* Bit field. Must be zero for
444                                            non-modulators/demodulators. */
445         __u32           reserved2;      /* Must be set to zero */
446 };
447 
448 /*  Values for the 'colorstandard' field  */
449 #define V4L2_COLOR_STD_PAL              1
450 #define V4L2_COLOR_STD_NTSC             2
451 #define V4L2_COLOR_STD_SECAM            3
452 
453 /*  Values for the color subcarrier fields  */
454 #define V4L2_COLOR_SUBC_PAL     4433619         /* PAL BGHI, NTSC-44 */
455 #define V4L2_COLOR_SUBC_PAL_M   3575611         /* PAL M (Brazil) */
456 #define V4L2_COLOR_SUBC_PAL_N   3582056         /* PAL N */
457 #define V4L2_COLOR_SUBC_NTSC    3579545         /* NTSC M, NTSC-Japan */
458 #define V4L2_COLOR_SUBC_SECAMB  4250000         /* SECAM B - Y carrier */
459 #define V4L2_COLOR_SUBC_SECAMR  4406250         /* SECAM R - Y carrier */
460 
461 /*  Flags for the 'transmission' field  */
462 #define V4L2_TRANSM_STD_B               (1<<1)
463 #define V4L2_TRANSM_STD_D               (1<<3)
464 #define V4L2_TRANSM_STD_G               (1<<6)
465 #define V4L2_TRANSM_STD_H               (1<<7)
466 #define V4L2_TRANSM_STD_I               (1<<8)
467 #define V4L2_TRANSM_STD_K               (1<<10)
468 #define V4L2_TRANSM_STD_K1              (1<<11)
469 #define V4L2_TRANSM_STD_L               (1<<12)
470 #define V4L2_TRANSM_STD_M               (1<<13)
471 #define V4L2_TRANSM_STD_N               (1<<14)
472 
473 
474 /*  Used in the VIDIOC_ENUMSTD ioctl for querying supported standards  */
475 struct v4l2_enumstd
476 {
477         int                     index;
478         struct v4l2_standard    std;
479         __u32                   inputs;  /* set of inputs that */
480                                          /* support this standard */
481         __u32                   outputs; /* set of outputs that */
482                                          /* support this standard */
483         __u32                   reserved[2];
484 };
485 
486 
487 /*
488  *      V I D E O   I N P U T S
489  */
490 struct v4l2_input
491 {
492         int     index;          /*  Which input */
493         char    name[32];       /*  Label */
494         int     type;           /*  Type of input */
495         __u32   capability;     /*  Capability flags */
496         int     assoc_audio;    /*  Associated audio input */
497         __u32   reserved[4];
498 };
499 /*  Values for the 'type' field */
500 #define V4L2_INPUT_TYPE_TUNER           1
501 #define V4L2_INPUT_TYPE_CAMERA          2
502 
503 /*  Flags for the 'capability' field */
504 #define V4L2_INPUT_CAP_AUDIO            0x0001  /* assoc_audio */
505 
506 
507 /*
508  *      V I D E O   O U T P U T S
509  */
510 struct v4l2_output
511 {
512         int     index;          /*  Which output */
513         char    name[32];       /*  Label */
514         int     type;           /*  Type of output */
515         __u32   capability;     /*  Capability flags */
516         int     assoc_audio;    /*  Associated audio */
517         __u32   reserved[4];
518 };
519 /*  Values for the 'type' field */
520 #define V4L2_OUTPUT_TYPE_MODULATOR              1
521 #define V4L2_OUTPUT_TYPE_ANALOG                 2
522 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY       3
523 
524 /*  Flags for the 'capability' field */
525 #define V4L2_OUTPUT_CAP_AUDIO           0x0001  /* assoc_audio */
526 
527 
528 /*
529  *      C O N T R O L S
530  */
531 struct v4l2_control
532 {
533         __u32           id;
534         int             value;
535 };
536 
537 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
538 struct v4l2_queryctrl
539 {
540         __u32           id;
541         __u8            name[32];       /* Whatever */
542         int             minimum;        /* Note signedness */
543         int             maximum;
544         unsigned int    step;
545         int             default_value;
546         __u32           type;
547         __u32           flags;
548         __u32           category;       /* Automatically filled in by V4L2 */
549         __u8            group[32];      /*   for pre-defined controls      */
550         __u32           reserved[2];
551 };
552 
553 /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
554 struct v4l2_querymenu
555 {
556         __u32           id;
557         int             index;
558         __u8            name[32];       /* Whatever */
559         int             reserved;
560 };
561 
562 /*  Used in V4L2_BUF_TYPE_FXCONTROL buffers  */
563 struct v4l2_fxcontrol
564 {
565         __u32   id;
566         __u32   value;
567 };
568 
569 /*  Control types  */
570 #define V4L2_CTRL_TYPE_INTEGER          0
571 #define V4L2_CTRL_TYPE_BOOLEAN          1
572 #define V4L2_CTRL_TYPE_MENU             2
573 #define V4L2_CTRL_TYPE_BUTTON           3
574 
575 /*  Control flags  */
576 #define V4L2_CTRL_FLAG_DISABLED         0x0001
577 #define V4L2_CTRL_FLAG_GRABBED          0x0002
578 
579 /*  Control categories  */
580 #define V4L2_CTRL_CAT_VIDEO             1  /*  "Video"   */
581 #define V4L2_CTRL_CAT_AUDIO             2  /*  "Audio"   */
582 #define V4L2_CTRL_CAT_EFFECT            3  /*  "Effect"  */
583 
584 /*  Control IDs defined by V4L2 */
585 #define V4L2_CID_BASE                   0x00980900
586 /*  IDs reserved for driver specific controls */
587 #define V4L2_CID_PRIVATE_BASE           0x08000000
588 /*  IDs reserved for effect-specific controls on effects devices  */
589 #define V4L2_CID_EFFECT_BASE            0x0A00B000
590 
591 #define V4L2_CID_BRIGHTNESS             (V4L2_CID_BASE+0)
592 #define V4L2_CID_CONTRAST               (V4L2_CID_BASE+1)
593 #define V4L2_CID_SATURATION             (V4L2_CID_BASE+2)
594 #define V4L2_CID_HUE                    (V4L2_CID_BASE+3)
595 #define V4L2_CID_AUDIO_VOLUME           (V4L2_CID_BASE+5)
596 #define V4L2_CID_AUDIO_BALANCE          (V4L2_CID_BASE+6)
597 #define V4L2_CID_AUDIO_BASS             (V4L2_CID_BASE+7)
598 #define V4L2_CID_AUDIO_TREBLE           (V4L2_CID_BASE+8)
599 #define V4L2_CID_AUDIO_MUTE             (V4L2_CID_BASE+9)
600 #define V4L2_CID_AUDIO_LOUDNESS         (V4L2_CID_BASE+10)
601 #define V4L2_CID_BLACK_LEVEL            (V4L2_CID_BASE+11)
602 #define V4L2_CID_AUTO_WHITE_BALANCE     (V4L2_CID_BASE+12)
603 #define V4L2_CID_DO_WHITE_BALANCE       (V4L2_CID_BASE+13)
604 #define V4L2_CID_RED_BALANCE            (V4L2_CID_BASE+14)
605 #define V4L2_CID_BLUE_BALANCE           (V4L2_CID_BASE+15)
606 #define V4L2_CID_GAMMA                  (V4L2_CID_BASE+16)
607 #define V4L2_CID_WHITENESS              (V4L2_CID_GAMMA) /* ? Not sure */
608 #define V4L2_CID_EXPOSURE               (V4L2_CID_BASE+17)
609 #define V4L2_CID_AUTOGAIN               (V4L2_CID_BASE+18)
610 #define V4L2_CID_GAIN                   (V4L2_CID_BASE+19)
611 #define V4L2_CID_HFLIP                  (V4L2_CID_BASE+20)
612 #define V4L2_CID_VFLIP                  (V4L2_CID_BASE+21)
613 #define V4L2_CID_HCENTER                (V4L2_CID_BASE+22)
614 #define V4L2_CID_VCENTER                (V4L2_CID_BASE+23)
615 #define V4L2_CID_LASTP1                 (V4L2_CID_BASE+24) /* last CID + 1 */
616 /*  Remember to change fill_ctrl_category() in videodev.c  */
617 
618 /*
619  *      T U N I N G
620  */
621 struct v4l2_tuner
622 {
623         int                     input;
624         char                    name[32];
625         struct v4l2_standard    std;
626         __u32                   capability;
627         __u32                   rangelow;
628         __u32                   rangehigh;
629         __u32                   rxsubchans;
630         __u32                   audmode;
631         int                     signal;
632         int                     afc;
633         __u32                   reserved[4];
634 };
635 struct v4l2_modulator
636 {
637         int                     output;
638         char                    name[32];
639         struct v4l2_standard    std;
640         __u32                   capability;
641         __u32                   rangelow;
642         __u32                   rangehigh;
643         __u32                   txsubchans;
644         __u32                   reserved[4];
645 };
646 /*  Flags for the 'capability' field */
647 #define V4L2_TUNER_CAP_LOW              0x0001
648 #define V4L2_TUNER_CAP_NORM             0x0002
649 #define V4L2_TUNER_CAP_STEREO           0x0010
650 #define V4L2_TUNER_CAP_LANG2            0x0020
651 #define V4L2_TUNER_CAP_SAP              0x0020
652 #define V4L2_TUNER_CAP_LANG1            0x0040
653 
654 /*  Flags for the 'rxsubchans' field */
655 #define V4L2_TUNER_SUB_MONO             0x0001
656 #define V4L2_TUNER_SUB_STEREO           0x0002
657 #define V4L2_TUNER_SUB_LANG2            0x0004
658 #define V4L2_TUNER_SUB_SAP              0x0004
659 #define V4L2_TUNER_SUB_LANG1            0x0008
660 
661 /*  Values for the 'audmode' field */
662 #define V4L2_TUNER_MODE_MONO            0x0000
663 #define V4L2_TUNER_MODE_STEREO          0x0001
664 #define V4L2_TUNER_MODE_LANG2           0x0002
665 #define V4L2_TUNER_MODE_SAP             0x0002
666 #define V4L2_TUNER_MODE_LANG1           0x0003
667 
668 struct v4l2_frequency
669 {
670         int     input;
671         __u32   frequency;
672         __u32   reserved[2];
673 };
674 
675 /*
676  *      A U D I O
677  */
678 struct v4l2_audio
679 {
680         int     audio;
681         char    name[32];
682         __u32   capability;
683         __u32   mode;
684         __u32   reserved[2];
685 };
686 /*  Flags for the 'capability' field */
687 #define V4L2_AUDCAP_EFFECTS             0x0020
688 #define V4L2_AUDCAP_LOUDNESS            0x0040
689 #define V4L2_AUDCAP_AVL                 0x0080
690 
691 /*  Flags for the 'mode' field */
692 #define V4L2_AUDMODE_LOUDNESS           0x00002
693 #define V4L2_AUDMODE_AVL                0x00004
694 #define V4L2_AUDMODE_STEREO_field       0x0FF00
695 #define V4L2_AUDMODE_STEREO_LINEAR      0x00100
696 #define V4L2_AUDMODE_STEREO_PSEUDO      0x00200
697 #define V4L2_AUDMODE_STEREO_SPATIAL30   0x00300
698 #define V4L2_AUDMODE_STEREO_SPATIAL50   0x00400
699 
700 struct v4l2_audioout
701 {
702         int     audio;
703         char    name[32];
704         __u32   capability;
705         __u32   mode;
706         __u32   reserved[2];
707 };
708 
709 /*
710  *      D A T A   S E R V I C E S   ( V B I )
711  *
712  *      Data services API by Michael Schimek
713  */
714 
715 struct v4l2_vbi_format
716 {
717         __u32   sampling_rate;          /* in 1 Hz */
718         __u32   offset;
719         __u32   samples_per_line;
720         __u32   sample_format;          /* V4L2_VBI_SF_* */
721         __s32   start[2];
722         __u32   count[2];
723         __u32   flags;                  /* V4L2_VBI_* */
724         __u32   reserved2;              /* must be zero */
725 };
726 
727 /*  VBI sampling formats */
728 #define V4L2_VBI_SF_UBYTE       1
729 
730 /*  VBI flags  */
731 #define V4L2_VBI_UNSYNC         (1<< 0)
732 #define V4L2_VBI_INTERLACED     (1<< 1)
733 
734 
735 /*
736  *      A G G R E G A T E   S T R U C T U R E S
737  */
738 
739 /*      Stream data format
740  */
741 struct v4l2_format
742 {
743         __u32   type;
744         union
745         {
746                 struct v4l2_pix_format  pix;    /*  image format  */
747                 struct v4l2_vbi_format  vbi;    /*  VBI data  */
748                 /*  add more  */
749                 __u8    raw_data[200];  /* user-defined */
750         } fmt;
751 };
752 
753 
754 /*      Stream type-dependent parameters
755  */
756 struct v4l2_streamparm
757 {
758         __u32   type;
759         union
760         {
761                 struct v4l2_captureparm capture;
762                 struct v4l2_outputparm  output;
763                 /*  add more  */
764                 __u8    raw_data[200];  /* user-defined */
765         } parm;
766 };
767 
768 
769 
770 /*
771  *      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
772  *
773  */
774 #define VIDIOC_QUERYCAP         _IOR  ('V',  0, struct v4l2_capability)
775 #define VIDIOC_RESERVED         _IO   ('V',  1)
776 #define VIDIOC_ENUM_PIXFMT      _IOWR ('V',  2, struct v4l2_fmtdesc)
777 #define VIDIOC_ENUM_FBUFFMT     _IOWR ('V',  3, struct v4l2_fmtdesc)
778 #define VIDIOC_G_FMT            _IOWR ('V',  4, struct v4l2_format)
779 #define VIDIOC_S_FMT            _IOWR ('V',  5, struct v4l2_format)
780 #define VIDIOC_G_COMP           _IOR  ('V',  6, struct v4l2_compression)
781 #define VIDIOC_S_COMP           _IOW  ('V',  7, struct v4l2_compression)
782 #define VIDIOC_REQBUFS          _IOWR ('V',  8, struct v4l2_requestbuffers)
783 #define VIDIOC_QUERYBUF         _IOWR ('V',  9, struct v4l2_buffer)
784 #define VIDIOC_G_FBUF           _IOR  ('V', 10, struct v4l2_framebuffer)
785 #define VIDIOC_S_FBUF           _IOW  ('V', 11, struct v4l2_framebuffer)
786 #define VIDIOC_G_WIN            _IOR  ('V', 12, struct v4l2_window)
787 #define VIDIOC_S_WIN            _IOW  ('V', 13, struct v4l2_window)
788 #define VIDIOC_PREVIEW          _IOWR ('V', 14, int)
789 #define VIDIOC_QBUF             _IOWR ('V', 15, struct v4l2_buffer)
790 #define VIDIOC_DQBUF            _IOWR ('V', 17, struct v4l2_buffer)
791 #define VIDIOC_STREAMON         _IOW  ('V', 18, int)
792 #define VIDIOC_STREAMOFF        _IOW  ('V', 19, int)
793 #define VIDIOC_G_PERF           _IOR  ('V', 20, struct v4l2_performance)
794 #define VIDIOC_G_PARM           _IOWR ('V', 21, struct v4l2_streamparm)
795 #define VIDIOC_S_PARM           _IOW  ('V', 22, struct v4l2_streamparm)
796 #define VIDIOC_G_STD            _IOR  ('V', 23, struct v4l2_standard)
797 #define VIDIOC_S_STD            _IOW  ('V', 24, struct v4l2_standard)
798 #define VIDIOC_ENUMSTD          _IOWR ('V', 25, struct v4l2_enumstd)
799 #define VIDIOC_ENUMINPUT        _IOWR ('V', 26, struct v4l2_input)
800 #define VIDIOC_G_CTRL           _IOWR ('V', 27, struct v4l2_control)
801 #define VIDIOC_S_CTRL           _IOW  ('V', 28, struct v4l2_control)
802 #define VIDIOC_G_TUNER          _IOWR ('V', 29, struct v4l2_tuner)
803 #define VIDIOC_S_TUNER          _IOW  ('V', 30, struct v4l2_tuner)
804 #define VIDIOC_G_FREQ           _IOR  ('V', 31, int)
805 #define VIDIOC_S_FREQ           _IOWR ('V', 32, int)
806 #define VIDIOC_G_AUDIO          _IOWR ('V', 33, struct v4l2_audio)
807 #define VIDIOC_S_AUDIO          _IOW  ('V', 34, struct v4l2_audio)
808 #define VIDIOC_QUERYCTRL        _IOWR ('V', 36, struct v4l2_queryctrl)
809 #define VIDIOC_QUERYMENU        _IOWR ('V', 37, struct v4l2_querymenu)
810 #define VIDIOC_G_INPUT          _IOR  ('V', 38, int)
811 #define VIDIOC_S_INPUT          _IOWR ('V', 39, int)
812 #define VIDIOC_ENUMCVT          _IOWR ('V', 40, struct v4l2_cvtdesc)
813 #define VIDIOC_G_OUTPUT         _IOR  ('V', 46, int)
814 #define VIDIOC_S_OUTPUT         _IOWR ('V', 47, int)
815 #define VIDIOC_ENUMOUTPUT       _IOWR ('V', 48, struct v4l2_output)
816 #define VIDIOC_G_AUDOUT         _IOWR ('V', 49, struct v4l2_audioout)
817 #define VIDIOC_S_AUDOUT         _IOW  ('V', 50, struct v4l2_audioout)
818 #define VIDIOC_ENUMFX           _IOWR ('V', 51, struct v4l2_fxdesc)
819 #define VIDIOC_G_EFFECT         _IOR  ('V', 52, int)
820 #define VIDIOC_S_EFFECT         _IOWR ('V', 53, int)
821 #define VIDIOC_G_MODULATOR      _IOWR ('V', 54, struct v4l2_modulator)
822 #define VIDIOC_S_MODULATOR      _IOW  ('V', 55, struct v4l2_modulator)
823 #define VIDIOC_G_FREQUENCY      _IOWR ('V', 56, struct v4l2_frequency)
824 #define VIDIOC_S_FREQUENCY      _IOW  ('V', 57, struct v4l2_frequency)
825 
826 #define VIDIOC_ENUM_CAPFMT      VIDIOC_ENUM_PIXFMT
827 #define VIDIOC_ENUM_OUTFMT      VIDIOC_ENUM_PIXFMT
828 #define VIDIOC_ENUM_SRCFMT      VIDIOC_ENUM_PIXFMT
829 #define VIDIOC_ENUMFMT          VIDIOC_ENUM_PIXFMT
830 
831 #define BASE_VIDIOC_PRIVATE     192             /* 192-255 are private */
832 
833 
834 #ifdef __KERNEL__
835 /*
836  *
837  *      V 4 L 2   D R I V E R   H E L P E R   A P I
838  *
839  *      Some commonly needed functions for drivers.
840  */
841 
842 extern void v4l2_version(int *major, int *minor);
843 extern int v4l2_major_number(void);
844 extern void v4l2_fill_ctrl_category(struct v4l2_queryctrl *qc);
845 
846 /*  Memory management  */
847 extern unsigned long v4l2_vmalloc_to_bus(void *virt);
848 extern struct page *v4l2_vmalloc_to_page(void *virt);
849 
850 /*  Simple queue management  */
851 struct v4l2_q_node
852 {
853         struct v4l2_q_node      *forw, *back;
854 };
855 struct v4l2_queue
856 {
857         struct v4l2_q_node      *forw, *back;
858         rwlock_t                qlock;
859 };
860 extern void  v4l2_q_init(struct v4l2_queue *q);
861 extern void  v4l2_q_add_head(struct v4l2_queue *q, struct v4l2_q_node *node);
862 extern void  v4l2_q_add_tail(struct v4l2_queue *q, struct v4l2_q_node *node);
863 extern void *v4l2_q_del_head(struct v4l2_queue *q);
864 extern void *v4l2_q_del_tail(struct v4l2_queue *q);
865 extern void *v4l2_q_peek_head(struct v4l2_queue *q);
866 extern void *v4l2_q_peek_tail(struct v4l2_queue *q);
867 extern void *v4l2_q_yank_node(struct v4l2_queue *q, struct v4l2_q_node *node);
868 extern int   v4l2_q_last(struct v4l2_queue *q);
869 
870 /*  Math functions  */
871 extern u32 v4l2_math_div6432(u64 a, u32 d, u32 *r);
872 
873 /*  Time functions  */
874 extern unsigned long v4l2_timestamp_divide(stamp_t t,
875                                            unsigned long p_100ns);
876 extern unsigned long v4l2_timestamp_correct(stamp_t *t,
877                                             unsigned long p_100ns);
878 
879 /*  Master Clock functions  */
880 struct v4l2_clock
881 {
882         void    (*gettime)(stamp_t *);
883 };
884 extern int  v4l2_masterclock_register(struct v4l2_clock *clock);
885 extern void v4l2_masterclock_unregister(struct v4l2_clock *clock);
886 extern void v4l2_masterclock_gettime(stamp_t *curr);
887 
888 /*  Video standard functions  */
889 extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
890 extern unsigned long v4l2_video_std_tpf(struct v4l2_standard *vs);
891 extern int v4l2_video_std_confirm(struct v4l2_standard *vs);
892 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
893                                     int id, __u32 transmission);
894 
895 #define V4L2_STD_PAL            1       /* PAL B, G, H, I (...) */
896 #define V4L2_STD_PAL_M          5       /* (Brazil) */
897 #define V4L2_STD_PAL_N          6       /* (Argentina, Paraguay, Uruguay) */
898 #define V4L2_STD_PAL_60         10      /* PAL/NTSC hybrid */
899 #define V4L2_STD_NTSC           11      /* NTSC M (USA, ...) */
900 #define V4L2_STD_NTSC_N         12      /* (Barbados, Bolivia, Colombia, 
901                                            S. Korea) */
902 #define V4L2_STD_NTSC_44        15      /* PAL/NTSC hybrid */
903 #define V4L2_STD_SECAM          21      /* SECAM B, D, G, K, K1 (...) */
904 //#define V4L2_STD_SECAM_H      27      /* (Greece, Iran, Morocco) */ 
905 //#define V4L2_STD_SECAM_L      28      /* (France, Luxembourg, Monaco) */
906 //#define V4L2_STD_SECAM_M      29      /* (Jamaica) */
907 
908 /*  Size of kernel ioctl arg buffer used in ioctl handler  */
909 #define V4L2_MAX_IOCTL_SIZE             256
910 
911 /*  Compatibility layer interface  */
912 typedef int (*v4l2_ioctl_compat)(struct inode *inode, struct file *file,
913                                  int cmd, void *arg);
914 int v4l2_compat_register(v4l2_ioctl_compat hook);
915 void v4l2_compat_unregister(v4l2_ioctl_compat hook);
916 
917 #endif /* __KERNEL__ */
918 #endif /* __LINUX_VIDEODEV2_H */
919 
  This page was automatically generated by the LXR engine.