Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

videodev.h

Go to the documentation of this file.
00001 /*
00002  *      Video for Linux Two
00003  *
00004  *      Header file for v4l or V4L2 drivers and applications, for
00005  *      Linux kernels 2.2.x or 2.4.x.
00006  *
00007  *      Author: Bill Dirks <bdirks@pacbell.net>
00008  *              Justin Schoeman
00009  *              et al.
00010  */
00011 
00012 #ifndef __LINUX_VIDEODEV_H
00013 #define __LINUX_VIDEODEV_H
00014 
00015 #if (LINUX_VERSION_CODE >= 0x020300) && (LINUX_VERSION_CODE < 0x020400)
00016 #warning Due to the changes in the 2.3.x kernel series, this version of videodev.h \
00017          may not work correctly for your kernel.
00018 #endif
00019 
00020 #include <linux/types.h>
00021 #include <linux/version.h>
00022 
00023 #ifdef __KERNEL__
00024 #include <linux/poll.h>
00025 #if (LINUX_VERSION_CODE >= 0x020300) || defined(CONFIG_FS_DEVFS)
00026 #include <linux/devfs_fs_kernel.h>
00027 #endif
00028 #endif
00029 
00030 #define V4L2_MAJOR_VERSION      0
00031 #define V4L2_MINOR_VERSION      20
00032 
00033 
00034 /*
00035  *      M I S C E L L A N E O U S
00036  */
00037 
00038 /*  Four-character-code (FOURCC) */
00039 #define v4l2_fourcc(a,b,c,d)\
00040         (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
00041 
00042 /*  Open flag for non-capturing opens on capture devices  */
00043 #define O_NONCAP        O_TRUNC
00044 #define O_NOIO          O_TRUNC
00045 
00046 /*  Timestamp data type, 64-bit signed integer, in nanoseconds  */
00047 #ifndef STAMP_T
00048 #define STAMP_T
00049 typedef __s64 stamp_t;
00050 #endif
00051 
00052 /*
00053  *      D R I V E R   C A P A B I L I T I E S
00054  */
00055 struct v4l2_capability
00056 {
00057         char    name[32];       /* Descriptive, and unique */
00058         int     type;           /* Device type, see below */
00059         int     inputs;         /* Num video inputs */
00060         int     outputs;        /* Num video outputs */
00061         int     audios;         /* Num audio devices */
00062         int     maxwidth;
00063         int     maxheight;
00064         int     minwidth;
00065         int     minheight;
00066         int     maxframerate;
00067         __u32   flags;          /* Feature flags, see below */
00068         __u32   reserved[4];
00069 };
00070 /* Values for 'type' field */
00071 #define V4L2_TYPE_CAPTURE       0       /* Is a video capture device */
00072 #define V4L2_TYPE_CODEC         1       /* Is a CODEC device */
00073 #define V4L2_TYPE_OUTPUT        2       /* Is a video output device */
00074 #define V4L2_TYPE_FX            3       /* Is a video effects device */
00075 #define V4L2_TYPE_VBI           4       /* Is a VBI capture device */
00076 #define V4L2_TYPE_VTR           5       /* Is a tape recorder controller */
00077 #define V4L2_TYPE_VTX           6       /* Is a teletext device */
00078 #define V4L2_TYPE_RADIO         7       /* Is a radio device */
00079 #define V4L2_TYPE_VBI_INPUT     4       /* Is a VBI capture device */
00080 #define V4L2_TYPE_VBI_OUTPUT    9       /* Is a VBI output device */
00081 #define V4L2_TYPE_PRIVATE       1000    /* Start of driver private types */
00082 /* Flags for 'flags' field */
00083 #define V4L2_FLAG_READ          0x00001 /* Can capture via read() call */
00084 #define V4L2_FLAG_WRITE         0x00002 /* Can accept data via write() */
00085 #define V4L2_FLAG_STREAMING     0x00004 /* Can capture streaming video */
00086 #define V4L2_FLAG_PREVIEW       0x00008 /* Can do automatic preview */
00087 #define V4L2_FLAG_SELECT        0x00010 /* Supports the select() call */
00088 #define V4L2_FLAG_TUNER         0x00020 /* Can tune */
00089 #define V4L2_FLAG_MONOCHROME    0x00040 /* Monochrome only */
00090 #define V4L2_FLAG_DATA_SERVICE  0x00080 /* Has a related data service dev. */
00091 
00092 
00093 /*
00094  *      V I D E O   I M A G E   F O R M A T
00095  */
00096 struct v4l2_pix_format
00097 {
00098         __u32   width;
00099         __u32   height;
00100         __u32   depth;
00101         __u32   pixelformat;
00102         __u32   flags;
00103         __u32   bytesperline;   /* only used when there are pad bytes */
00104         __u32   sizeimage;
00105         __u32   priv;           /* private data, depends on pixelformat */
00106 };
00107 /*           Pixel format    FOURCC                  depth  Description   */
00108 #define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R','G','B','1') /*  8  RGB-3-3-2     */
00109 #define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R','G','B','O') /* 16  RGB-5-5-5     */
00110 #define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R','G','B','P') /* 16  RGB-5-6-5     */
00111 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16  RGB-5-5-5 BE  */
00112 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16  RGB-5-6-5 BE  */
00113 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B','G','R','3') /* 24  BGR-8-8-8     */
00114 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R','G','B','3') /* 24  RGB-8-8-8     */
00115 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B','G','R','4') /* 32  BGR-8-8-8-8   */
00116 #define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R','G','B','4') /* 32  RGB-8-8-8-8   */
00117 #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G','R','E','Y') /*  8  Greyscale     */
00118 #define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y','V','U','9') /*  9  YVU 4:1:0     */
00119 #define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y','V','1','2') /* 12  YVU 4:2:0     */
00120 #define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y','U','Y','V') /* 16  YUV 4:2:2     */
00121 #define V4L2_PIX_FMT_YUY2    v4l2_fourcc('Y','U','Y','2') /* 16  YUV 4:2:2     */
00122 #define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U','Y','V','Y') /* 16  YUV 4:2:2     */
00123 #define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y','4','1','P') /* 12  YUV 4:1:1     */
00124 #define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y','U','V','9') /*  9  YUV 4:1:0     */
00125 #define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y','U','1','2') /* 12  YUV 4:2:0     */
00126 #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('P','4','2','2') /* 16  YUV422 planar */
00127 #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('P','4','1','1') /* 16  YUV411 planar */
00128 #define V4L2_PIX_FMT_NV12    v4l2_fourcc('N','V','1','2') /* 12  Y/UV 4:2:0    */
00129 
00130 /*  The following formats are not defined in the V4L2 specification */
00131 #define V4L2_PIX_FMT_YVU422P v4l2_fourcc('4','2','2','P') /* 16  YVU422 planar */
00132 #define V4L2_PIX_FMT_YVU411P v4l2_fourcc('4','1','1','P') /* 16  YVU411 planar */
00133 #define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y','Y','U','V') /* 16  YUV 4:2:2     */
00134 #define V4L2_PIX_FMT_HI240   v4l2_fourcc('H','I','2','4') /*  8  8-bit color   */
00135 #define V4L2_PIX_FMT_NV21    v4l2_fourcc('N','V','2','1') /* 12  Y/UV 4:2:0    */
00136 
00137 /*  Vendor-specific formats   */
00138 #define V4L2_PIX_FMT_WNVA    v4l2_fourcc('W','N','V','A') /* Winnov hw compres */
00139 
00140 
00141 /*  Flags */
00142 #define V4L2_FMT_FLAG_COMPRESSED        0x0001  /* Compressed format */
00143 #define V4L2_FMT_FLAG_BYTESPERLINE      0x0002  /* bytesperline field valid */
00144 #define V4L2_FMT_FLAG_NOT_INTERLACED    0x0000
00145 #define V4L2_FMT_FLAG_INTERLACED        0x0004  /* Image is interlaced */
00146 #define V4L2_FMT_FLAG_TOPFIELD          0x0008  /* is a top field only */
00147 #define V4L2_FMT_FLAG_BOTFIELD          0x0010  /* is a bottom field only */
00148 #define V4L2_FMT_FLAG_ODDFIELD          V4L2_FMT_FLAG_TOPFIELD
00149 #define V4L2_FMT_FLAG_EVENFIELD         V4L2_FMT_FLAG_BOTFIELD
00150 #define V4L2_FMT_FLAG_COMBINED          V4L2_FMT_FLAG_INTERLACED
00151 #define V4L2_FMT_FLAG_FIELD_field       0x001C
00152 #define V4L2_FMT_CS_field               0xF000  /* Color space field mask */
00153 #define V4L2_FMT_CS_601YUV              0x1000  /* ITU YCrCb color space */
00154 #define V4L2_FMT_FLAG_SWCONVERSION      0x0800  /* used only in format enum. */
00155 /*  SWCONVERSION indicates the format is not natively supported by the  */
00156 /*  driver and the driver uses software conversion to support it  */
00157 
00158 
00159 /*
00160  *      F O R M A T   E N U M E R A T I O N
00161  */
00162 struct v4l2_fmtdesc
00163 {
00164         int     index;                  /* Format number */
00165         char    description[32];        /* Description string */
00166         __u32   pixelformat;            /* Format fourcc */
00167         __u32   flags;                  /* Format flags */
00168         __u32   depth;                  /* Bits per pixel */
00169         __u32   reserved[2];
00170 };
00171 
00172 struct v4l2_cvtdesc
00173 {
00174         int     index;
00175         struct
00176         {
00177                 __u32   pixelformat;
00178                 __u32   flags;
00179                 __u32   depth;
00180                 __u32   reserved[2];
00181         }       in, out;
00182 };
00183 
00184 struct v4l2_fxdesc
00185 {
00186         int     index;
00187         char    name[32];
00188         __u32   flags;
00189         __u32   inputs;
00190         __u32   controls;
00191         __u32   reserved[2];
00192 };
00193 
00194 
00195 /*
00196  *      T I M E C O D E
00197  */
00198 struct v4l2_timecode
00199 {
00200         __u8    frames;
00201         __u8    seconds;
00202         __u8    minutes;
00203         __u8    hours;
00204         __u8    userbits[4];
00205         __u32   flags;
00206         __u32   type;
00207 };
00208 /*  Type  */
00209 #define V4L2_TC_TYPE_24FPS              1
00210 #define V4L2_TC_TYPE_25FPS              2
00211 #define V4L2_TC_TYPE_30FPS              3
00212 #define V4L2_TC_TYPE_50FPS              4
00213 #define V4L2_TC_TYPE_60FPS              5
00214 
00215 
00216 /*  Flags  */
00217 #define V4L2_TC_FLAG_DROPFRAME          0x0001 /* "drop-frame" mode */
00218 #define V4L2_TC_FLAG_COLORFRAME         0x0002
00219 #define V4L2_TC_USERBITS_field          0x000C
00220 #define V4L2_TC_USERBITS_USERDEFINED    0x0000
00221 #define V4L2_TC_USERBITS_8BITCHARS      0x0008
00222 /* The above is based on SMPTE timecodes */
00223 
00224 
00225 /*
00226  *      C O M P R E S S I O N   P A R A M E T E R S
00227  */
00228 struct v4l2_compression
00229 {
00230         int     quality;
00231         int     keyframerate;
00232         int     pframerate;
00233         __u32   reserved[5];
00234 };
00235 
00236 
00237 /*
00238  *      M E M O R Y - M A P P I N G   B U F F E R S
00239  */
00240 struct v4l2_requestbuffers
00241 {
00242         int     count;
00243         __u32   type;
00244         __u32   reserved[2];
00245 };
00246 struct v4l2_buffer
00247 {
00248         int                     index;
00249         __u32                   type;
00250         __u32                   offset;
00251         __u32                   length;
00252         __u32                   bytesused;
00253         __u32                   flags;
00254         stamp_t                 timestamp;
00255         struct v4l2_timecode    timecode;
00256         __u32                   sequence;
00257         __u32                   reserved[3];
00258 };
00259 /*  Buffer type codes and flags for 'type' field */
00260 #define V4L2_BUF_TYPE_field             0x00001FFF  /* Type field mask  */
00261 #define V4L2_BUF_TYPE_CAPTURE           0x00000001
00262 #define V4L2_BUF_TYPE_CODECIN           0x00000002
00263 #define V4L2_BUF_TYPE_CODECOUT          0x00000003
00264 #define V4L2_BUF_TYPE_EFFECTSIN         0x00000004
00265 #define V4L2_BUF_TYPE_EFFECTSIN2        0x00000005
00266 #define V4L2_BUF_TYPE_EFFECTSOUT        0x00000006
00267 #define V4L2_BUF_TYPE_VIDEOOUT          0x00000007
00268 #define V4L2_BUF_TYPE_FXCONTROL         0x00000008
00269 #define V4L2_BUF_TYPE_VBI               0x00000009
00270 
00271 /*  Starting value of driver private buffer types  */
00272 #define V4L2_BUF_TYPE_PRIVATE           0x00001000
00273 
00274 #define V4L2_BUF_ATTR_DEVICEMEM 0x00010000  /* Buffer is on device (flag) */
00275 
00276 /*  Flags used only in VIDIOC_REQBUFS  */
00277 #define V4L2_BUF_REQ_field      0xF0000000
00278 #define V4L2_BUF_REQ_CONTIG     0x10000000  /* Map all buffers in one
00279                                                contiguous mmap(). This flag
00280                                                only used in VIDIOC_REQBUFS */
00281 
00282 /*  Flags for 'flags' field */
00283 #define V4L2_BUF_FLAG_MAPPED    0x0001  /* Buffer is mapped (flag) */
00284 #define V4L2_BUF_FLAG_QUEUED    0x0002  /* Buffer is queued for processing */
00285 #define V4L2_BUF_FLAG_DONE      0x0004  /* Buffer is ready */
00286 #define V4L2_BUF_FLAG_KEYFRAME  0x0008  /* Image is a keyframe (I-frame) */
00287 #define V4L2_BUF_FLAG_PFRAME    0x0010  /* Image is a P-frame */
00288 #define V4L2_BUF_FLAG_BFRAME    0x0020  /* Image is a B-frame */
00289 #define V4L2_BUF_FLAG_TOPFIELD  0x0040  /* Image is a top field only */
00290 #define V4L2_BUF_FLAG_BOTFIELD  0x0080  /* Image is a bottom field only */
00291 #define V4L2_BUF_FLAG_ODDFIELD  V4L2_BUF_FLAG_TOPFIELD
00292 #define V4L2_BUF_FLAG_EVENFIELD V4L2_BUF_FLAG_BOTFIELD
00293 #define V4L2_BUF_FLAG_TIMECODE  0x0100  /* timecode field is valid */
00294 
00295 /*
00296  *      O V E R L A Y   P R E V I E W
00297  */
00298 struct v4l2_framebuffer
00299 {
00300         __u32                   capability;
00301         __u32                   flags;
00302         void                    *base[3];
00303         struct v4l2_pix_format  fmt;
00304 };
00305 /*  Flags for the 'capability' field. Read only */
00306 #define V4L2_FBUF_CAP_EXTERNOVERLAY     0x0001
00307 #define V4L2_FBUF_CAP_CHROMAKEY         0x0002
00308 #define V4L2_FBUF_CAP_CLIPPING          0x0004
00309 #define V4L2_FBUF_CAP_SCALEUP           0x0008
00310 #define V4L2_FBUF_CAP_SCALEDOWN         0x0010
00311 #define V4L2_FBUF_CAP_BITMAP_CLIPPING   0x0020
00312 /*  Flags for the 'flags' field. */
00313 #define V4L2_FBUF_FLAG_PRIMARY          0x0001
00314 #define V4L2_FBUF_FLAG_OVERLAY          0x0002
00315 #define V4L2_FBUF_FLAG_CHROMAKEY        0x0004
00316 
00317 struct v4l2_clip
00318 {
00319         int                     x;
00320         int                     y;
00321         int                     width;
00322         int                     height;
00323         struct v4l2_clip        *next;
00324 };
00325 struct v4l2_window
00326 {
00327         int                     x;
00328         int                     y;
00329         int                     width;
00330         int                     height;
00331         __u32                   chromakey;
00332         struct v4l2_clip        *clips;
00333         int                     clipcount;
00334         void                    *bitmap;
00335 };
00336 
00337 
00338 /*
00339  *      D E V I C E   P E R F O R M A N C E
00340  */
00341 struct v4l2_performance
00342 {
00343         int     frames;
00344         int     framesdropped;
00345         __u64   bytesin;
00346         __u64   bytesout;
00347         __u32   reserved[4];
00348 };
00349 
00350 /*
00351  *      C A P T U R E   P A R A M E T E R S
00352  */
00353 struct v4l2_captureparm
00354 {
00355         __u32           capability;     /*  Supported modes */
00356         __u32           capturemode;    /*  Current mode */
00357         unsigned long   timeperframe;   /*  Time per frame in .1us units */
00358         __u32           extendedmode;   /*  Driver-specific extensions */
00359         __u32           reserved[4];
00360 };
00361 /*  Flags for 'capability' and 'capturemode' fields */
00362 #define V4L2_MODE_HIGHQUALITY   0x0001  /*  High quality imaging mode */
00363 //#define V4L2_MODE_VFLIP               0x0002  /*  Flip image vertically */
00364 //#define V4L2_MODE_HFLIP               0x0004  /*  Flip image horizontally */
00365 #define V4L2_CAP_TIMEPERFRAME   0x1000  /*  timeperframe field is supported */
00366 
00367 struct v4l2_outputparm
00368 {
00369         __u32           capability;     /*  Supported modes */
00370         __u32           outputmode;     /*  Current mode */
00371         unsigned long   timeperframe;   /*  Time per frame in .1us units */
00372         __u32           extendedmode;   /*  Driver-specific extensions */
00373         __u32           reserved[4];
00374 };
00375 
00376 /*
00377  *      I N P U T   I M A G E   C R O P P I N G
00378  */
00379 struct v4l2_cropcap
00380 {
00381         __u32   capability;
00382         int     min_x;
00383         int     min_y;
00384         int     max_x;
00385         int     max_y;
00386         int     default_left;
00387         int     default_top;
00388         int     default_right;
00389         int     default_bottom;
00390         __u32   reserved[2];
00391 };
00392 struct v4l2_crop
00393 {
00394         int     left;
00395         int     top;
00396         int     right;
00397         int     bottom;
00398         __u32   reserved;
00399 };
00400 
00401 /*
00402  *      D I G I T A L   Z O O M
00403  */
00404 struct v4l2_zoomcap
00405 {
00406         __u32   capability;
00407         __u32   maxwidth;
00408         __u32   maxheight;
00409         __u32   minwidth;
00410         __u32   minheight;
00411         __u32   reserved[2];
00412 };
00413 /*  Flags for the capability field  */
00414 #define V4L2_ZOOM_NONCAP                0x0001
00415 #define V4L2_ZOOM_WHILESTREAMING        0x0002
00416 
00417 struct v4l2_zoom
00418 {
00419         __u32   x;
00420         __u32   y;
00421         __u32   width;
00422         __u32   height;
00423         __u32   reserved;
00424 };
00425 
00426 
00427 /*
00428  *      A N A L O G   V I D E O   S T A N D A R D
00429  */
00430 struct v4l2_standard
00431 {
00432         __u8            name[24];
00433         struct {
00434                 __u32   numerator;
00435                 __u32   denominator;    /* >= 1 */
00436         } framerate;                    /* Frames, not fields */
00437         __u32           framelines;
00438         __u32           reserved1;
00439         __u32           colorstandard;
00440         union {                         
00441                 struct {
00442                         __u32           colorsubcarrier; /* Hz */
00443                 }               pal;
00444                 struct {                                        
00445                         __u32           colorsubcarrier; /* Hz */
00446                 }               ntsc;
00447                 struct {
00448                         __u32           f0b;    /* Hz (blue) */
00449                         __u32           f0r;    /* Hz (red)  */
00450                 }               secam;
00451                 __u8            reserved[12];
00452         } colorstandard_data;
00453         __u32           transmission;   /* Bit field. Must be zero for
00454                                            non-modulators/demodulators. */
00455         __u32           reserved2;      /* Must be set to zero */
00456 };
00457 
00458 /*  Values for the 'colorstandard' field  */
00459 #define V4L2_COLOR_STD_PAL              1
00460 #define V4L2_COLOR_STD_NTSC             2
00461 #define V4L2_COLOR_STD_SECAM            3
00462 
00463 /*  Values for the color subcarrier fields  */
00464 #define V4L2_COLOR_SUBC_PAL     4433619         /* PAL BGHI, NTSC-44 */
00465 #define V4L2_COLOR_SUBC_PAL_M   3575611         /* PAL M (Brazil) */
00466 #define V4L2_COLOR_SUBC_PAL_N   3582056         /* PAL N */
00467 #define V4L2_COLOR_SUBC_NTSC    3579545         /* NTSC M, NTSC-Japan */
00468 #define V4L2_COLOR_SUBC_SECAMB  4250000         /* SECAM B - Y carrier */
00469 #define V4L2_COLOR_SUBC_SECAMR  4406250         /* SECAM R - Y carrier */
00470 
00471 /*  Flags for the 'transmission' field  */
00472 #define V4L2_TRANSM_STD_B               (1<<1)
00473 #define V4L2_TRANSM_STD_D               (1<<3)
00474 #define V4L2_TRANSM_STD_G               (1<<6)
00475 #define V4L2_TRANSM_STD_H               (1<<7)
00476 #define V4L2_TRANSM_STD_I               (1<<8)
00477 #define V4L2_TRANSM_STD_K               (1<<10)
00478 #define V4L2_TRANSM_STD_K1              (1<<11)
00479 #define V4L2_TRANSM_STD_L               (1<<12)
00480 #define V4L2_TRANSM_STD_M               (1<<13)
00481 #define V4L2_TRANSM_STD_N               (1<<14)
00482 
00483 
00484 /*  Used in the VIDIOC_ENUMSTD ioctl for querying supported standards  */
00485 struct v4l2_enumstd
00486 {
00487         int                     index;
00488         struct v4l2_standard    std;
00489         __u32                   inputs;  /* set of inputs that */
00490                                          /* support this standard */
00491         __u32                   outputs; /* set of outputs that */
00492                                          /* support this standard */
00493         __u32                   reserved[2];
00494 };
00495 
00496 
00497 /*
00498  *      V I D E O   I N P U T S
00499  */
00500 struct v4l2_input
00501 {
00502         int     index;          /*  Which input */
00503         char    name[32];       /*  Label */
00504         int     type;           /*  Type of input */
00505         __u32   capability;     /*  Capability flags */
00506         int     assoc_audio;    /*  Associated audio input */
00507         __u32   reserved[4];
00508 };
00509 /*  Values for the 'type' field */
00510 #define V4L2_INPUT_TYPE_TUNER           1
00511 #define V4L2_INPUT_TYPE_CAMERA          2
00512 
00513 /*  Flags for the 'capability' field */
00514 #define V4L2_INPUT_CAP_AUDIO            0x0001  /* assoc_audio */
00515 
00516 
00517 /*
00518  *      V I D E O   O U T P U T S
00519  */
00520 struct v4l2_output
00521 {
00522         int     index;          /*  Which output */
00523         char    name[32];       /*  Label */
00524         int     type;           /*  Type of output */
00525         __u32   capability;     /*  Capability flags */
00526         int     assoc_audio;    /*  Associated audio */
00527         __u32   reserved[4];
00528 };
00529 /*  Values for the 'type' field */
00530 #define V4L2_OUTPUT_TYPE_MODULATOR              1
00531 #define V4L2_OUTPUT_TYPE_ANALOG                 2
00532 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY       3
00533 
00534 /*  Flags for the 'capability' field */
00535 #define V4L2_OUTPUT_CAP_AUDIO           0x0001  /* assoc_audio */
00536 
00537 
00538 /*
00539  *      C O N T R O L S
00540  */
00541 struct v4l2_control
00542 {
00543         __u32           id;
00544         int             value;
00545 };
00546 
00547 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
00548 struct v4l2_queryctrl
00549 {
00550         __u32           id;
00551         __u8            name[32];       /* Whatever */
00552         int             minimum;        /* Note signedness */
00553         int             maximum;
00554         unsigned int    step;
00555         int             default_value;
00556         __u32           type;
00557         __u32           flags;
00558         __u32           category;       /* Automatically filled in by V4L2 */
00559         __u8            group[32];      /*   for pre-defined controls      */
00560         __u32           reserved[2];
00561 };
00562 
00563 /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
00564 struct v4l2_querymenu
00565 {
00566         __u32           id;
00567         int             index;
00568         __u8            name[32];       /* Whatever */
00569         int             reserved;
00570 };
00571 
00572 /*  Used in V4L2_BUF_TYPE_FXCONTROL buffers  */
00573 struct v4l2_fxcontrol
00574 {
00575         __u32   id;
00576         __u32   value;
00577 };
00578 
00579 /*  Control types  */
00580 #define V4L2_CTRL_TYPE_INTEGER          0
00581 #define V4L2_CTRL_TYPE_BOOLEAN          1
00582 #define V4L2_CTRL_TYPE_MENU             2
00583 #define V4L2_CTRL_TYPE_BUTTON           3
00584 
00585 /*  Control flags  */
00586 #define V4L2_CTRL_FLAG_DISABLED         0x0001
00587 #define V4L2_CTRL_FLAG_GRABBED          0x0002
00588 
00589 /*  Control categories  */
00590 #define V4L2_CTRL_CAT_VIDEO             1  /*  "Video"   */
00591 #define V4L2_CTRL_CAT_AUDIO             2  /*  "Audio"   */
00592 #define V4L2_CTRL_CAT_EFFECT            3  /*  "Effect"  */
00593 
00594 /*  Control IDs defined by V4L2 */
00595 #define V4L2_CID_BASE                   0x00980900
00596 /*  IDs reserved for driver specific controls */
00597 #define V4L2_CID_PRIVATE_BASE           0x08000000
00598 /*  IDs reserved for effect-specific controls on effects devices  */
00599 #define V4L2_CID_EFFECT_BASE            0x0A00B000
00600 
00601 #define V4L2_CID_BRIGHTNESS             (V4L2_CID_BASE+0)
00602 #define V4L2_CID_CONTRAST               (V4L2_CID_BASE+1)
00603 #define V4L2_CID_SATURATION             (V4L2_CID_BASE+2)
00604 #define V4L2_CID_HUE                    (V4L2_CID_BASE+3)
00605 #define V4L2_CID_AUDIO_VOLUME           (V4L2_CID_BASE+5)
00606 #define V4L2_CID_AUDIO_BALANCE          (V4L2_CID_BASE+6)
00607 #define V4L2_CID_AUDIO_BASS             (V4L2_CID_BASE+7)
00608 #define V4L2_CID_AUDIO_TREBLE           (V4L2_CID_BASE+8)
00609 #define V4L2_CID_AUDIO_MUTE             (V4L2_CID_BASE+9)
00610 #define V4L2_CID_AUDIO_LOUDNESS         (V4L2_CID_BASE+10)
00611 #define V4L2_CID_BLACK_LEVEL            (V4L2_CID_BASE+11)
00612 #define V4L2_CID_AUTO_WHITE_BALANCE     (V4L2_CID_BASE+12)
00613 #define V4L2_CID_DO_WHITE_BALANCE       (V4L2_CID_BASE+13)
00614 #define V4L2_CID_RED_BALANCE            (V4L2_CID_BASE+14)
00615 #define V4L2_CID_BLUE_BALANCE           (V4L2_CID_BASE+15)
00616 #define V4L2_CID_GAMMA                  (V4L2_CID_BASE+16)
00617 #define V4L2_CID_WHITENESS              (V4L2_CID_GAMMA) /* ? Not sure */
00618 #define V4L2_CID_EXPOSURE               (V4L2_CID_BASE+17)
00619 #define V4L2_CID_AUTOGAIN               (V4L2_CID_BASE+18)
00620 #define V4L2_CID_GAIN                   (V4L2_CID_BASE+19)
00621 #define V4L2_CID_HFLIP                  (V4L2_CID_BASE+20)
00622 #define V4L2_CID_VFLIP                  (V4L2_CID_BASE+21)
00623 #define V4L2_CID_HCENTER                (V4L2_CID_BASE+22)
00624 #define V4L2_CID_VCENTER                (V4L2_CID_BASE+23)
00625 #define V4L2_CID_LASTP1                 (V4L2_CID_BASE+24) /* last CID + 1 */
00626 /*  Remember to change fill_ctrl_category() in videodev.c  */
00627 
00628 /*
00629  *      T U N I N G
00630  */
00631 struct v4l2_tuner
00632 {
00633         int                     input;
00634         char                    name[32];
00635         struct v4l2_standard    std;
00636         __u32                   capability;
00637         __u32                   rangelow;
00638         __u32                   rangehigh;
00639         __u32                   rxsubchans;
00640         __u32                   audmode;
00641         int                     signal;
00642         int                     afc;
00643         __u32                   reserved[4];
00644 };
00645 struct v4l2_modulator
00646 {
00647         int                     output;
00648         char                    name[32];
00649         struct v4l2_standard    std;
00650         __u32                   capability;
00651         __u32                   rangelow;
00652         __u32                   rangehigh;
00653         __u32                   txsubchans;
00654         __u32                   reserved[4];
00655 };
00656 /*  Flags for the 'capability' field */
00657 #define V4L2_TUNER_CAP_LOW              0x0001
00658 #define V4L2_TUNER_CAP_NORM             0x0002
00659 #define V4L2_TUNER_CAP_STEREO           0x0010
00660 #define V4L2_TUNER_CAP_LANG2            0x0020
00661 #define V4L2_TUNER_CAP_SAP              0x0020
00662 #define V4L2_TUNER_CAP_LANG1            0x0040
00663 
00664 /*  Flags for the 'rxsubchans' field */
00665 #define V4L2_TUNER_SUB_MONO             0x0001
00666 #define V4L2_TUNER_SUB_STEREO           0x0002
00667 #define V4L2_TUNER_SUB_LANG2            0x0004
00668 #define V4L2_TUNER_SUB_SAP              0x0004
00669 #define V4L2_TUNER_SUB_LANG1            0x0008
00670 
00671 /*  Values for the 'audmode' field */
00672 #define V4L2_TUNER_MODE_MONO            0x0000
00673 #define V4L2_TUNER_MODE_STEREO          0x0001
00674 #define V4L2_TUNER_MODE_LANG2           0x0002
00675 #define V4L2_TUNER_MODE_SAP             0x0002
00676 #define V4L2_TUNER_MODE_LANG1           0x0003
00677 
00678 struct v4l2_frequency
00679 {
00680         int     input;
00681         __u32   frequency;
00682         __u32   reserved[2];
00683 };
00684 
00685 /*
00686  *      A U D I O
00687  */
00688 struct v4l2_audio
00689 {
00690         int     audio;
00691         char    name[32];
00692         __u32   capability;
00693         __u32   mode;
00694         __u32   reserved[2];
00695 };
00696 /*  Flags for the 'capability' field */
00697 #define V4L2_AUDCAP_EFFECTS             0x0020
00698 #define V4L2_AUDCAP_LOUDNESS            0x0040
00699 #define V4L2_AUDCAP_AVL                 0x0080
00700 
00701 /*  Flags for the 'mode' field */
00702 #define V4L2_AUDMODE_LOUDNESS           0x00002
00703 #define V4L2_AUDMODE_AVL                0x00004
00704 #define V4L2_AUDMODE_STEREO_field       0x0FF00
00705 #define V4L2_AUDMODE_STEREO_LINEAR      0x00100
00706 #define V4L2_AUDMODE_STEREO_PSEUDO      0x00200
00707 #define V4L2_AUDMODE_STEREO_SPATIAL30   0x00300
00708 #define V4L2_AUDMODE_STEREO_SPATIAL50   0x00400
00709 
00710 struct v4l2_audioout
00711 {
00712         int     audio;
00713         char    name[32];
00714         __u32   capability;
00715         __u32   mode;
00716         __u32   reserved[2];
00717 };
00718 
00719 /*
00720  *      D A T A   S E R V I C E S   ( V B I )
00721  *
00722  *      Data services API by Michael Schimek
00723  */
00724 
00725 struct v4l2_vbi_format
00726 {
00727         __u32   sampling_rate;          /* in 1 Hz */
00728         __u32   offset;
00729         __u32   samples_per_line;
00730         __u32   sample_format;          /* V4L2_VBI_SF_* */
00731         __s32   start[2];
00732         __u32   count[2];
00733         __u32   flags;                  /* V4L2_VBI_* */
00734         __u32   reserved2;              /* must be zero */
00735 };
00736 
00737 /*  VBI sampling formats */
00738 #define V4L2_VBI_SF_UBYTE       1
00739 
00740 /*  VBI flags  */
00741 #define V4L2_VBI_UNSYNC         (1<< 0)
00742 #define V4L2_VBI_INTERLACED     (1<< 1)
00743 
00744 
00745 /*
00746  *      A G G R E G A T E   S T R U C T U R E S
00747  */
00748 
00749 /*      Stream data format
00750  */
00751 struct v4l2_format
00752 {
00753         __u32   type;
00754         union
00755         {
00756                 struct v4l2_pix_format  pix;    /*  image format  */
00757                 struct v4l2_vbi_format  vbi;    /*  VBI data  */
00758                 /*  add more  */
00759                 __u8    raw_data[200];  /* user-defined */
00760         } fmt;
00761 };
00762 
00763 
00764 /*      Stream type-dependent parameters
00765  */
00766 struct v4l2_streamparm
00767 {
00768         __u32   type;
00769         union
00770         {
00771                 struct v4l2_captureparm capture;
00772                 struct v4l2_outputparm  output;
00773                 /*  add more  */
00774                 __u8    raw_data[200];  /* user-defined */
00775         } parm;
00776 };
00777 
00778 
00779 
00780 /*
00781  *      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
00782  *
00783  */
00784 #define VIDIOC_QUERYCAP         _IOR  ('V',  0, struct v4l2_capability)
00785 #define VIDIOC_RESERVED         _IO   ('V',  1)
00786 #define VIDIOC_ENUM_PIXFMT      _IOWR ('V',  2, struct v4l2_fmtdesc)
00787 #define VIDIOC_ENUM_FBUFFMT     _IOWR ('V',  3, struct v4l2_fmtdesc)
00788 #define VIDIOC_G_FMT            _IOWR ('V',  4, struct v4l2_format)
00789 #define VIDIOC_S_FMT            _IOWR ('V',  5, struct v4l2_format)
00790 #define VIDIOC_G_COMP           _IOR  ('V',  6, struct v4l2_compression)
00791 #define VIDIOC_S_COMP           _IOW  ('V',  7, struct v4l2_compression)
00792 #define VIDIOC_REQBUFS          _IOWR ('V',  8, struct v4l2_requestbuffers)
00793 #define VIDIOC_QUERYBUF         _IOWR ('V',  9, struct v4l2_buffer)
00794 #define VIDIOC_G_FBUF           _IOR  ('V', 10, struct v4l2_framebuffer)
00795 #define VIDIOC_S_FBUF           _IOW  ('V', 11, struct v4l2_framebuffer)
00796 #define VIDIOC_G_WIN            _IOR  ('V', 12, struct v4l2_window)
00797 #define VIDIOC_S_WIN            _IOW  ('V', 13, struct v4l2_window)
00798 #define VIDIOC_PREVIEW          _IOWR ('V', 14, int)
00799 #define VIDIOC_QBUF             _IOWR ('V', 15, struct v4l2_buffer)
00800 #define VIDIOC_DQBUF            _IOWR ('V', 17, struct v4l2_buffer)
00801 #define VIDIOC_STREAMON         _IOW  ('V', 18, int)
00802 #define VIDIOC_STREAMOFF        _IOW  ('V', 19, int)
00803 #define VIDIOC_G_PERF           _IOR  ('V', 20, struct v4l2_performance)
00804 #define VIDIOC_G_PARM           _IOWR ('V', 21, struct v4l2_streamparm)
00805 #define VIDIOC_S_PARM           _IOW  ('V', 22, struct v4l2_streamparm)
00806 #define VIDIOC_G_STD            _IOR  ('V', 23, struct v4l2_standard)
00807 #define VIDIOC_S_STD            _IOW  ('V', 24, struct v4l2_standard)
00808 #define VIDIOC_ENUMSTD          _IOWR ('V', 25, struct v4l2_enumstd)
00809 #define VIDIOC_ENUMINPUT        _IOWR ('V', 26, struct v4l2_input)
00810 #define VIDIOC_G_CTRL           _IOWR ('V', 27, struct v4l2_control)
00811 #define VIDIOC_S_CTRL           _IOW  ('V', 28, struct v4l2_control)
00812 #define VIDIOC_G_TUNER          _IOWR ('V', 29, struct v4l2_tuner)
00813 #define VIDIOC_S_TUNER          _IOW  ('V', 30, struct v4l2_tuner)
00814 #define VIDIOC_G_FREQ           _IOR  ('V', 31, int) /* depricated */
00815 #define VIDIOC_S_FREQ           _IOWR ('V', 32, int) /* depricated */
00816 #define VIDIOC_G_AUDIO          _IOWR ('V', 33, struct v4l2_audio)
00817 #define VIDIOC_S_AUDIO          _IOW  ('V', 34, struct v4l2_audio)
00818 #define VIDIOC_QUERYCTRL        _IOWR ('V', 36, struct v4l2_queryctrl)
00819 #define VIDIOC_QUERYMENU        _IOWR ('V', 37, struct v4l2_querymenu)
00820 #define VIDIOC_G_INPUT          _IOR  ('V', 38, int)
00821 #define VIDIOC_S_INPUT          _IOWR ('V', 39, int)
00822 #define VIDIOC_ENUMCVT          _IOWR ('V', 40, struct v4l2_cvtdesc)
00823 #define VIDIOC_G_OUTPUT         _IOR  ('V', 46, int)
00824 #define VIDIOC_S_OUTPUT         _IOWR ('V', 47, int)
00825 #define VIDIOC_ENUMOUTPUT       _IOWR ('V', 48, struct v4l2_output)
00826 #define VIDIOC_G_AUDOUT         _IOWR ('V', 49, struct v4l2_audioout)
00827 #define VIDIOC_S_AUDOUT         _IOW  ('V', 50, struct v4l2_audioout)
00828 #define VIDIOC_ENUMFX           _IOWR ('V', 51, struct v4l2_fxdesc)
00829 #define VIDIOC_G_EFFECT         _IOR  ('V', 52, int)
00830 #define VIDIOC_S_EFFECT         _IOWR ('V', 53, int)
00831 #define VIDIOC_G_MODULATOR      _IOWR ('V', 54, struct v4l2_modulator)
00832 #define VIDIOC_S_MODULATOR      _IOW  ('V', 55, struct v4l2_modulator)
00833 #define VIDIOC_G_FREQUENCY      _IOWR ('V', 56, struct v4l2_frequency)
00834 #define VIDIOC_S_FREQUENCY      _IOW  ('V', 57, struct v4l2_frequency)
00835 
00836 #define VIDIOC_ENUM_CAPFMT      VIDIOC_ENUM_PIXFMT
00837 #define VIDIOC_ENUM_OUTFMT      VIDIOC_ENUM_PIXFMT
00838 #define VIDIOC_ENUM_SRCFMT      VIDIOC_ENUM_PIXFMT
00839 #define VIDIOC_ENUMFMT          VIDIOC_ENUM_PIXFMT
00840 
00841 #define BASE_VIDIOC_PRIVATE     192             /* 192-255 are private */
00842 
00843 
00844 #ifdef __KERNEL__
00845 /*
00846  *      These things are used only by drivers.
00847  */
00848 
00849 extern int videodev_init(void);
00850 
00851 /*
00852  *
00853  *      V 4 L 2   D R I V E R   H E L P E R   A P I
00854  *
00855  *      Some commonly needed functions for drivers.
00856  */
00857 
00858 extern void v4l2_version(int *major, int *minor);
00859 extern int v4l2_major_number(void);
00860 
00861 /*  Memory management  */
00862 extern unsigned long v4l2_vmalloc_to_bus(void *virt);
00863 #if  LINUX_VERSION_CODE >= 0x020300
00864 extern struct page *v4l2_vmalloc_to_page(void *virt);
00865 #else
00866 extern unsigned long v4l2_vmalloc_to_page(void *virt);
00867 #endif
00868 
00869 /*  Simple queue management  */
00870 struct v4l2_q_node
00871 {
00872         struct v4l2_q_node      *forw, *back;
00873 };
00874 struct v4l2_queue
00875 {
00876         struct v4l2_q_node      *forw, *back;
00877         rwlock_t                qlock;
00878 };
00879 extern void  v4l2_q_init(struct v4l2_queue *q);
00880 extern void  v4l2_q_add_head(struct v4l2_queue *q, struct v4l2_q_node *node);
00881 extern void  v4l2_q_add_tail(struct v4l2_queue *q, struct v4l2_q_node *node);
00882 extern void *v4l2_q_del_head(struct v4l2_queue *q);
00883 extern void *v4l2_q_del_tail(struct v4l2_queue *q);
00884 extern void *v4l2_q_peek_head(struct v4l2_queue *q);
00885 extern void *v4l2_q_peek_tail(struct v4l2_queue *q);
00886 extern void *v4l2_q_yank_node(struct v4l2_queue *q, struct v4l2_q_node *node);
00887 extern int   v4l2_q_last(struct v4l2_queue *q);
00888 
00889 /*  Math functions  */
00890 extern u32 v4l2_math_div6432(u64 a, u32 d, u32 *r);
00891 
00892 /*  Time functions  */
00893 extern unsigned long v4l2_timestamp_divide(stamp_t t,
00894                                            unsigned long p_100ns);
00895 extern unsigned long v4l2_timestamp_correct(stamp_t *t,
00896                                             unsigned long p_100ns);
00897 
00898 /*  Master Clock functions  */
00899 struct v4l2_clock
00900 {
00901         void    (*gettime)(stamp_t *);
00902 };
00903 extern int  v4l2_masterclock_register(struct v4l2_clock *clock);
00904 extern void v4l2_masterclock_unregister(struct v4l2_clock *clock);
00905 extern void v4l2_masterclock_gettime(stamp_t *curr);
00906 
00907 /*  Video standard functions  */
00908 extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
00909 extern unsigned long v4l2_video_std_tpf(struct v4l2_standard *vs);
00910 extern int v4l2_video_std_confirm(struct v4l2_standard *vs);
00911 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
00912                                     int id, __u32 transmission);
00913 
00914 #define V4L2_STD_PAL            1       /* PAL B, G, H, I (...) */
00915 #define V4L2_STD_PAL_M          5       /* (Brazil) */
00916 #define V4L2_STD_PAL_N          6       /* (Argentina, Paraguay, Uruguay) */
00917 #define V4L2_STD_PAL_60         10      /* PAL/NTSC hybrid */
00918 #define V4L2_STD_NTSC           11      /* NTSC M (USA, ...) */
00919 #define V4L2_STD_NTSC_N         12      /* (Barbados, Bolivia, Colombia, 
00920                                            S. Korea) */
00921 #define V4L2_STD_NTSC_44        15      /* PAL/NTSC hybrid */
00922 #define V4L2_STD_SECAM          21      /* SECAM B, D, G, K, K1 (...) */
00923 //#define V4L2_STD_SECAM_H      27      /* (Greece, Iran, Morocco) */ 
00924 //#define V4L2_STD_SECAM_L      28      /* (France, Luxembourg, Monaco) */
00925 //#define V4L2_STD_SECAM_M      29      /* (Jamaica) */
00926 
00927 /*
00928  *      D E V I C E   D R I V E R   R E G I S T R A T I O N
00929  *
00930  */
00931 struct v4l2_device
00932 {
00933         char    name[32];
00934         int     type;
00935         int     minor;
00936 
00937         int     (*open)(struct v4l2_device *v,
00938                         int flags, void **idptr);
00939         void    (*close)(void *id);
00940         long    (*read)(void *id,
00941                         char *buf, unsigned long count, int noblock);
00942         long    (*write)(void *id,
00943                          const char *buf, unsigned long count, int noblock);
00944         int     (*ioctl)(void *id,
00945                          unsigned int cmd, void *arg);
00946         int     (*mmap)(void *id,
00947                         struct vm_area_struct *vma);
00948         int     (*poll)(void *id,
00949                         struct file *file, poll_table *table);
00950 
00951         int     (*initialize)(struct v4l2_device *v);
00952         void    *priv;  /*  may be used by the driver  */
00953 
00954         int     busy;           /*  open count maintained by videodev.c  */
00955         void    *v4l2_priv;             /*  for V4L2 use  */
00956         int     v4l2_reserved[4];       /*  for V4L2 use  */
00957 #if (LINUX_VERSION_CODE >= 0x020300) || defined(CONFIG_FS_DEVFS)
00958         devfs_handle_t devfs_handle;
00959         char    devfs_devname[16];
00960 #endif
00961 };
00962 
00963 /*  Size of kernel ioctl arg buffer used in ioctl handler  */
00964 #define V4L2_MAX_IOCTL_SIZE             256
00965 
00966 extern int v4l2_register_device(struct v4l2_device *);
00967 extern void v4l2_unregister_device(struct v4l2_device *);
00968 
00969 /*  V4L2 structures  */
00970 extern struct v4l2_device *v4l2_device_from_file(struct file *file);
00971 extern void *v4l2_openid_from_file(struct file *file);
00972 
00973 #endif/*ifdef __KERNEL__ */
00974 
00975 
00976 /*----------------------------------------------------------------------
00977        Old Video for Linux backward compatibility below this line. 
00978   ----------------------------------------------------------------------
00979 
00980   All new applications should use the new API calls.
00981 
00982   (These definitions taken from 2.4.0-test9.)
00983 
00984  */
00985 
00986 #ifdef __KERNEL__
00987 /*  Compatibility layer interface  */
00988 struct v4l2_v4l_compat
00989 {
00990         int     (*translate_ioctl)(struct file          *file,
00991                                    struct v4l2_device   *vfl,
00992                                    void                 *per_open_data,
00993                                    int                  cmd,
00994                                    void                 *arg);
00995         void    (*fix_offset)(struct file *file,
00996                               struct v4l2_device *vfl,
00997                               struct vm_area_struct *vma);
00998 };
00999 extern int v4l2_v4l_compat_register(struct v4l2_v4l_compat *);
01000 extern void v4l2_v4l_compat_unregister(struct v4l2_v4l_compat *);
01001 #endif
01002 
01003 
01004 #define VID_TYPE_CAPTURE        1       /* Can capture */
01005 #define VID_TYPE_TUNER          2       /* Can tune */
01006 #define VID_TYPE_TELETEXT       4       /* Does teletext */
01007 #define VID_TYPE_OVERLAY        8       /* Overlay onto frame buffer */
01008 #define VID_TYPE_CHROMAKEY      16      /* Overlay by chromakey */
01009 #define VID_TYPE_CLIPPING       32      /* Can clip */
01010 #define VID_TYPE_FRAMERAM       64      /* Uses the frame buffer memory */
01011 #define VID_TYPE_SCALES         128     /* Scalable */
01012 #define VID_TYPE_MONOCHROME     256     /* Monochrome only */
01013 #define VID_TYPE_SUBCAPTURE     512     /* Can capture subareas of the image */
01014 #define VID_TYPE_MPEG_DECODER   1024    /* Can decode MPEG streams */
01015 #define VID_TYPE_MPEG_ENCODER   2048    /* Can encode MPEG streams */
01016 #define VID_TYPE_MJPEG_DECODER  4096    /* Can decode MJPEG streams */
01017 #define VID_TYPE_MJPEG_ENCODER  8192    /* Can encode MJPEG streams */
01018 
01019 struct video_capability
01020 {
01021         char name[32];
01022         int type;
01023         int channels;   /* Num channels */
01024         int audios;     /* Num audio devices */
01025         int maxwidth;   /* Supported width */
01026         int maxheight;  /* And height */
01027         int minwidth;   /* Supported width */
01028         int minheight;  /* And height */
01029 };
01030 
01031 
01032 struct video_channel
01033 {
01034         int channel;
01035         char name[32];
01036         int tuners;
01037         __u32  flags;
01038 #define VIDEO_VC_TUNER          1       /* Channel has a tuner */
01039 #define VIDEO_VC_AUDIO          2       /* Channel has audio */
01040         __u16  type;
01041 #define VIDEO_TYPE_TV           1
01042 #define VIDEO_TYPE_CAMERA       2       
01043         __u16 norm;                     /* Norm set by channel */
01044 };
01045 
01046 struct video_tuner
01047 {
01048         int tuner;
01049         char name[32];
01050         ulong rangelow, rangehigh;      /* Tuner range */
01051         __u32 flags;
01052 #define VIDEO_TUNER_PAL         1
01053 #define VIDEO_TUNER_NTSC        2
01054 #define VIDEO_TUNER_SECAM       4
01055 #define VIDEO_TUNER_LOW         8       /* Uses KHz not MHz */
01056 #define VIDEO_TUNER_NORM        16      /* Tuner can set norm */
01057 #define VIDEO_TUNER_STEREO_ON   128     /* Tuner is seeing stereo */
01058 #define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
01059 #define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
01060         __u16 mode;                     /* PAL/NTSC/SECAM/OTHER */
01061 #define VIDEO_MODE_PAL          0
01062 #define VIDEO_MODE_NTSC         1
01063 #define VIDEO_MODE_SECAM        2
01064 #define VIDEO_MODE_AUTO         3
01065         __u16 signal;                   /* Signal strength 16bit scale */
01066 };
01067 
01068 struct video_picture
01069 {
01070         __u16   brightness;
01071         __u16   hue;
01072         __u16   colour;
01073         __u16   contrast;
01074         __u16   whiteness;      /* Black and white only */
01075         __u16   depth;          /* Capture depth */
01076         __u16   palette;        /* Palette in use */
01077 #define VIDEO_PALETTE_GREY      1       /* Linear greyscale */
01078 #define VIDEO_PALETTE_HI240     2       /* High 240 cube (BT848) */
01079 #define VIDEO_PALETTE_RGB565    3       /* 565 16 bit RGB */
01080 #define VIDEO_PALETTE_RGB24     4       /* 24bit RGB */
01081 #define VIDEO_PALETTE_RGB32     5       /* 32bit RGB */ 
01082 #define VIDEO_PALETTE_RGB555    6       /* 555 15bit RGB */
01083 #define VIDEO_PALETTE_YUV422    7       /* YUV422 capture */
01084 #define VIDEO_PALETTE_YUYV      8
01085 #define VIDEO_PALETTE_UYVY      9       /* The great thing about standards is ... */
01086 #define VIDEO_PALETTE_YUV420    10
01087 #define VIDEO_PALETTE_YUV411    11      /* YUV411 capture */
01088 #define VIDEO_PALETTE_RAW       12      /* RAW capture (BT848) */
01089 #define VIDEO_PALETTE_YUV422P   13      /* YUV 4:2:2 Planar */
01090 #define VIDEO_PALETTE_YUV411P   14      /* YUV 4:1:1 Planar */
01091 #define VIDEO_PALETTE_YUV420P   15      /* YUV 4:2:0 Planar */
01092 #define VIDEO_PALETTE_YUV410P   16      /* YUV 4:1:0 Planar */
01093 #define VIDEO_PALETTE_PLANAR    13      /* start of planar entries */
01094 #define VIDEO_PALETTE_COMPONENT 7       /* start of component entries */
01095 };
01096 
01097 struct video_audio
01098 {
01099         int     audio;          /* Audio channel */
01100         __u16   volume;         /* If settable */
01101         __u16   bass, treble;
01102         __u32   flags;
01103 #define VIDEO_AUDIO_MUTE        1
01104 #define VIDEO_AUDIO_MUTABLE     2
01105 #define VIDEO_AUDIO_VOLUME      4
01106 #define VIDEO_AUDIO_BASS        8
01107 #define VIDEO_AUDIO_TREBLE      16
01108 #define VIDEO_AUDIO_BALANCE     32
01109         char    name[16];
01110 #define VIDEO_SOUND_MONO        1
01111 #define VIDEO_SOUND_STEREO      2
01112 #define VIDEO_SOUND_LANG1       4
01113 #define VIDEO_SOUND_LANG2       8
01114         __u16   mode;
01115         __u16   balance;        /* Stereo balance */
01116         __u16   step;           /* Step actual volume uses */
01117 };
01118 
01119 struct video_clip
01120 {
01121         __s32   x,y;
01122         __s32   width, height;
01123         struct  video_clip *next;       /* For user use/driver use only */
01124 };
01125 
01126 struct video_window
01127 {
01128         __u32   x,y;                    /* Position of window */
01129         __u32   width,height;           /* Its size */
01130         __u32   chromakey;
01131         __u32   flags;
01132         struct  video_clip *clips;      /* Set only */
01133         int     clipcount;
01134 #define VIDEO_WINDOW_INTERLACE  1
01135 #define VIDEO_WINDOW_CHROMAKEY  16      /* Overlay by chromakey */
01136 #define VIDEO_CLIP_BITMAP       -1
01137 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
01138 #define VIDEO_CLIPMAP_SIZE      (128 * 625)
01139 };
01140 
01141 struct video_capture
01142 {
01143         __u32   x,y;                    /* Offsets into image */
01144         __u32   width, height;          /* Area to capture */
01145         __u16   decimation;             /* Decimation divder */
01146         __u16   flags;                  /* Flags for capture */
01147 #define VIDEO_CAPTURE_ODD               0       /* Temporal */
01148 #define VIDEO_CAPTURE_EVEN              1
01149 };
01150 
01151 struct video_buffer
01152 {
01153         void    *base;
01154         int     height,width;
01155         int     depth;
01156         int     bytesperline;
01157 };
01158 
01159 struct video_mmap
01160 {
01161         unsigned        int frame;              /* Frame (0 - n) for double buffer */
01162         int             height,width;
01163         unsigned        int format;             /* should be VIDEO_PALETTE_* */
01164 };
01165 
01166 struct video_key
01167 {
01168         __u8    key[8];
01169         __u32   flags;
01170 };
01171 
01172 
01173 #define VIDEO_MAX_FRAME         32
01174 
01175 struct video_mbuf
01176 {
01177         int     size;           /* Total memory to map */
01178         int     frames;         /* Frames */
01179         int     offsets[VIDEO_MAX_FRAME];
01180 };
01181         
01182 
01183 #define         VIDEO_NO_UNIT   (-1)
01184 
01185         
01186 struct video_unit
01187 {
01188         int     video;          /* Video minor */
01189         int     vbi;            /* VBI minor */
01190         int     radio;          /* Radio minor */
01191         int     audio;          /* Audio minor */
01192         int     teletext;       /* Teletext minor */
01193 };
01194 
01195 struct vbi_format {
01196         __u32   sampling_rate;  /* in Hz */
01197         __u32   samples_per_line;
01198         __u32   sample_format;  /* VIDEO_PALETTE_RAW only (1 byte) */
01199         __s32   start[2];       /* starting line for each frame */
01200         __u32   count[2];       /* count of lines for each frame */
01201         __u32   flags;
01202 #define VBI_UNSYNC      1       /* can distingues between top/bottom field */
01203 #define VBI_INTERLACED  2       /* lines are interlaced */
01204 };
01205 
01206 /* video_info is biased towards hardware mpeg encode/decode */
01207 /* but it could apply generically to any hardware compressor/decompressor */
01208 struct video_info
01209 {
01210         __u32   frame_count;    /* frames output since decode/encode began */
01211         __u32   h_size;         /* current unscaled horizontal size */
01212         __u32   v_size;         /* current unscaled veritcal size */
01213         __u32   smpte_timecode; /* current SMPTE timecode (for current GOP) */
01214         __u32   picture_type;   /* current picture type */
01215         __u32   temporal_reference;     /* current temporal reference */
01216         __u8    user_data[256]; /* user data last found in compressed stream */
01217         /* user_data[0] contains user data flags, user_data[1] has count */
01218 };
01219 
01220 /* generic structure for setting playback modes */
01221 struct video_play_mode
01222 {
01223         int     mode;
01224         int     p1;
01225         int     p2;
01226 };
01227 
01228 /* for loading microcode / fpga programming */
01229 struct video_code
01230 {
01231         char    loadwhat[16];   /* name or tag of file being passed */
01232         int     datasize;
01233         __u8    *data;
01234 };
01235 
01236 #define VIDIOCGCAP              _IOR('v',1,struct video_capability)     /* Get capabilities */
01237 #define VIDIOCGCHAN             _IOWR('v',2,struct video_channel)       /* Get channel info (sources) */
01238 #define VIDIOCSCHAN             _IOW('v',3,struct video_channel)        /* Set channel  */
01239 #define VIDIOCGTUNER            _IOWR('v',4,struct video_tuner)         /* Get tuner abilities */
01240 #define VIDIOCSTUNER            _IOW('v',5,struct video_tuner)          /* Tune the tuner for the current channel */
01241 #define VIDIOCGPICT             _IOR('v',6,struct video_picture)        /* Get picture properties */
01242 #define VIDIOCSPICT             _IOW('v',7,struct video_picture)        /* Set picture properties */
01243 #define VIDIOCCAPTURE           _IOW('v',8,int)                         /* Start, end capture */
01244 #define VIDIOCGWIN              _IOR('v',9, struct video_window)        /* Set the video overlay window */
01245 #define VIDIOCSWIN              _IOW('v',10, struct video_window)       /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
01246 #define VIDIOCGFBUF             _IOR('v',11, struct video_buffer)       /* Get frame buffer */
01247 #define VIDIOCSFBUF             _IOW('v',12, struct video_buffer)       /* Set frame buffer - root only */
01248 #define VIDIOCKEY               _IOR('v',13, struct video_key)          /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
01249 #define VIDIOCGFREQ             _IOR('v',14, unsigned long)             /* Set tuner */
01250 #define VIDIOCSFREQ             _IOW('v',15, unsigned long)             /* Set tuner */
01251 #define VIDIOCGAUDIO            _IOR('v',16, struct video_audio)        /* Get audio info */
01252 #define VIDIOCSAUDIO            _IOW('v',17, struct video_audio)        /* Audio source, mute etc */
01253 #define VIDIOCSYNC              _IOW('v',18, int)                       /* Sync with mmap grabbing */
01254 #define VIDIOCMCAPTURE          _IOW('v',19, struct video_mmap)         /* Grab frames */
01255 #define VIDIOCGMBUF             _IOR('v', 20, struct video_mbuf)        /* Memory map buffer info */
01256 #define VIDIOCGUNIT             _IOR('v', 21, struct video_unit)        /* Get attached units */
01257 #define VIDIOCGCAPTURE          _IOR('v',22, struct video_capture)      /* Get frame buffer */
01258 #define VIDIOCSCAPTURE          _IOW('v',23, struct video_capture)      /* Set frame buffer - root only */
01259 #define VIDIOCSPLAYMODE         _IOW('v',24, struct video_play_mode)    /* Set output video mode/feature */
01260 #define VIDIOCSWRITEMODE        _IOW('v',25, int)                       /* Set write mode */
01261 #define VIDIOCGPLAYINFO         _IOR('v',26, struct video_info)         /* Get current playback info from hardware */
01262 #define VIDIOCSMICROCODE        _IOW('v',27, struct video_code)         /* Load microcode into hardware */
01263 #define VIDIOCGVBIFMT           _IOR('v',28, struct vbi_format)         /* Get VBI information */
01264 #define VIDIOCSVBIFMT           _IOW('v',29, struct vbi_format)         /* Set VBI information */
01265 
01266 #define BASE_VIDIOCPRIVATE      192             /* 192-255 are private */
01267 
01268 /* VIDIOCSWRITEMODE */
01269 #define VID_WRITE_MPEG_AUD              0
01270 #define VID_WRITE_MPEG_VID              1
01271 #define VID_WRITE_OSD                   2
01272 #define VID_WRITE_TTX                   3
01273 #define VID_WRITE_CC                    4
01274 #define VID_WRITE_MJPEG                 5
01275 
01276 /* VIDIOCSPLAYMODE */
01277 #define VID_PLAY_VID_OUT_MODE           0
01278         /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
01279 #define VID_PLAY_GENLOCK                1
01280         /* p1: 0 = OFF, 1 = ON */
01281         /* p2: GENLOCK FINE DELAY value */ 
01282 #define VID_PLAY_NORMAL                 2
01283 #define VID_PLAY_PAUSE                  3
01284 #define VID_PLAY_SINGLE_FRAME           4
01285 #define VID_PLAY_FAST_FORWARD           5
01286 #define VID_PLAY_SLOW_MOTION            6
01287 #define VID_PLAY_IMMEDIATE_NORMAL       7
01288 #define VID_PLAY_SWITCH_CHANNELS        8
01289 #define VID_PLAY_FREEZE_FRAME           9
01290 #define VID_PLAY_STILL_MODE             10
01291 #define VID_PLAY_MASTER_MODE            11
01292         /* p1: see below */
01293 #define         VID_PLAY_MASTER_NONE    1
01294 #define         VID_PLAY_MASTER_VIDEO   2
01295 #define         VID_PLAY_MASTER_AUDIO   3
01296 #define VID_PLAY_ACTIVE_SCANLINES       12
01297         /* p1 = first active; p2 = last active */
01298 #define VID_PLAY_RESET                  13
01299 #define VID_PLAY_END_MARK               14
01300 
01301 /* v4l1 stuff */
01302 
01303 #ifdef __KERNEL__
01304 
01305 struct video_device
01306 {
01307 #if LINUX_VERSION_CODE >= 0x020403
01308         struct module *owner;
01309 #endif
01310         char name[32];
01311         int type;
01312         int hardware;
01313         int (*open)(struct video_device *, int mode);
01314         void (*close)(struct video_device *);
01315         long (*read)(struct video_device *, char *, unsigned long, int noblock);
01316         /* Do we need a write method ? */
01317         long (*write)(struct video_device *, const char *, unsigned long, int noblock);
01318         unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
01319         int (*ioctl)(struct video_device *, unsigned int , void *);
01320         int (*mmap)(struct video_device *, const char *, unsigned long);
01321         int (*initialize)(struct video_device *);       
01322         void *priv;             /* Used to be 'private' but that upsets C++ */
01323         int busy;
01324         int minor;
01325 #if (LINUX_VERSION_CODE >= 0x020300) || defined(CONFIG_FS_DEVFS)
01326         devfs_handle_t devfs_handle;
01327 #endif
01328 #if LINUX_VERSION_CODE >= 0x020300
01329         struct file_operations *fops;
01330 #endif
01331 };
01332 
01333 #define VIDEO_MAJOR     81
01334 #if LINUX_VERSION_CODE >= 0x020405
01335 extern int video_register_device(struct video_device *vfd, int type, int nr);
01336 #else
01337 extern int video_register_device(struct video_device *vfd, int type);
01338 #endif
01339 
01340 #define VFL_TYPE_GRABBER        0
01341 #define VFL_TYPE_VBI            1
01342 #define VFL_TYPE_RADIO          2
01343 #define VFL_TYPE_VTX            3
01344 
01345 extern void video_unregister_device(struct video_device *);
01346 
01347 /*
01348  *      Initialiser list
01349  */
01350 
01351 struct video_init
01352 {
01353         char *name;
01354         int (*init)(struct video_init *);
01355 };
01356 #endif
01357 
01358 
01359 #define VID_HARDWARE_BT848      1
01360 #define VID_HARDWARE_QCAM_BW    2
01361 #define VID_HARDWARE_PMS        3
01362 #define VID_HARDWARE_QCAM_C     4
01363 #define VID_HARDWARE_PSEUDO     5
01364 #define VID_HARDWARE_SAA5249    6
01365 #define VID_HARDWARE_AZTECH     7
01366 #define VID_HARDWARE_SF16MI     8
01367 #define VID_HARDWARE_RTRACK     9
01368 #define VID_HARDWARE_ZOLTRIX    10
01369 #define VID_HARDWARE_SAA7146    11
01370 #define VID_HARDWARE_VIDEUM     12      /* Reserved for Winnov videum */
01371 #define VID_HARDWARE_RTRACK2    13
01372 #define VID_HARDWARE_PERMEDIA2  14      /* Reserved for Permedia2 */
01373 #define VID_HARDWARE_RIVA128    15      /* Reserved for RIVA 128 */
01374 #define VID_HARDWARE_PLANB      16      /* PowerMac motherboard video-in */
01375 #define VID_HARDWARE_BROADWAY   17      /* Broadway project */
01376 #define VID_HARDWARE_GEMTEK     18
01377 #define VID_HARDWARE_TYPHOON    19
01378 #define VID_HARDWARE_VINO       20      /* Reserved for SGI Indy Vino */
01379 #define VID_HARDWARE_CADET      21      /* Cadet radio */
01380 #define VID_HARDWARE_TRUST      22      /* Trust FM Radio */
01381 #define VID_HARDWARE_TERRATEC   23      /* TerraTec ActiveRadio */
01382 #define VID_HARDWARE_CPIA       24
01383 #define VID_HARDWARE_ZR36120    25      /* Zoran ZR36120/ZR36125 */
01384 #define VID_HARDWARE_ZR36067    26      /* Zoran ZR36067/36060 */
01385 #define VID_HARDWARE_OV511      27      
01386 #define VID_HARDWARE_ZR356700   28      /* Zoran 36700 series */
01387 #define VID_HARDWARE_W9966      29
01388 #define VID_HARDWARE_SE401      30      /* SE401 USB webcams */
01389 #define VID_HARDWARE_PWC        31      /* Philips webcams */
01390 #define VID_HARDWARE_MEYE       32      /* Sony Vaio MotionEye cameras */
01391 #define VID_HARDWARE_CPIA2      33
01392 
01393 #endif/*ifndef __LINUX_VIDEODEV_H*/

Generated on Wed Oct 5 14:36:12 2005 for RobotFlow by  doxygen 1.4.4