Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

videodev2.h

00001 #ifndef __LINUX_VIDEODEV2_H
00002 #define __LINUX_VIDEODEV2_H
00003 /*
00004  *      Video for Linux Two
00005  *
00006  *      Header file for v4l or V4L2 drivers and applications, for
00007  *      Linux kernels 2.2.x or 2.4.x.
00008  *
00009  *      See http://bytesex.org/v4l/ for API specs and other
00010  *      v4l2 documentation.
00011  *
00012  *      Author: Bill Dirks <[email protected]>
00013  *              Justin Schoeman
00014  *              et al.
00015  */
00016 
00017 /*
00018  *      M I S C E L L A N E O U S
00019  */
00020 
00021 /*  Four-character-code (FOURCC) */
00022 #define v4l2_fourcc(a,b,c,d)\
00023         (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
00024 
00025 /*
00026  *      E N U M S
00027  */
00028 enum v4l2_field {
00029         V4L2_FIELD_ANY        = 0, /* driver can choose from none,
00030                                       top, bottom, interlaced
00031                                       depending on whatever it thinks
00032                                       is approximate ... */
00033         V4L2_FIELD_NONE       = 1, /* this device has no fields ... */
00034         V4L2_FIELD_TOP        = 2, /* top field only */
00035         V4L2_FIELD_BOTTOM     = 3, /* bottom field only */
00036         V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
00037         V4L2_FIELD_SEQ_TB     = 5, /* both fields sequential into one
00038                                       buffer, top-bottom order */
00039         V4L2_FIELD_SEQ_BT     = 6, /* same as above + bottom-top order */
00040         V4L2_FIELD_ALTERNATE  = 7, /* both fields alternating into
00041                                       separate buffers */
00042 };
00043 #define V4L2_FIELD_HAS_TOP(field)       \
00044         ((field) == V4L2_FIELD_TOP      ||\
00045          (field) == V4L2_FIELD_INTERLACED ||\
00046          (field) == V4L2_FIELD_SEQ_TB   ||\
00047          (field) == V4L2_FIELD_SEQ_BT)
00048 #define V4L2_FIELD_HAS_BOTTOM(field)    \
00049         ((field) == V4L2_FIELD_BOTTOM   ||\
00050          (field) == V4L2_FIELD_INTERLACED ||\
00051          (field) == V4L2_FIELD_SEQ_TB   ||\
00052          (field) == V4L2_FIELD_SEQ_BT)
00053 #define V4L2_FIELD_HAS_BOTH(field)      \
00054         ((field) == V4L2_FIELD_INTERLACED ||\
00055          (field) == V4L2_FIELD_SEQ_TB   ||\
00056          (field) == V4L2_FIELD_SEQ_BT)
00057 
00058 enum v4l2_buf_type {
00059         V4L2_BUF_TYPE_VIDEO_CAPTURE  = 1,
00060         V4L2_BUF_TYPE_VIDEO_OUTPUT   = 2,
00061         V4L2_BUF_TYPE_VIDEO_OVERLAY  = 3,
00062         V4L2_BUF_TYPE_VBI_CAPTURE    = 4,
00063         V4L2_BUF_TYPE_VBI_OUTPUT     = 5,
00064         V4L2_BUF_TYPE_PRIVATE        = 0x80,
00065 };
00066 
00067 enum v4l2_ctrl_type {
00068         V4L2_CTRL_TYPE_INTEGER       = 1,
00069         V4L2_CTRL_TYPE_BOOLEAN       = 2,
00070         V4L2_CTRL_TYPE_MENU          = 3,
00071         V4L2_CTRL_TYPE_BUTTON        = 4,
00072 };
00073 
00074 enum v4l2_tuner_type {
00075         V4L2_TUNER_RADIO             = 1,
00076         V4L2_TUNER_ANALOG_TV         = 2,
00077 };
00078 
00079 enum v4l2_memory {
00080         V4L2_MEMORY_MMAP             = 1,
00081         V4L2_MEMORY_USERPTR          = 2,
00082         V4L2_MEMORY_OVERLAY          = 3,
00083 };
00084 
00085 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
00086 enum v4l2_colorspace {
00087         /* ITU-R 601 -- broadcast NTSC/PAL */
00088         V4L2_COLORSPACE_SMPTE170M     = 1,
00089 
00090         /* 1125-Line (US) HDTV */
00091         V4L2_COLORSPACE_SMPTE240M     = 2,
00092 
00093         /* HD and modern captures. */
00094         V4L2_COLORSPACE_REC709        = 3,
00095         
00096         /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
00097         V4L2_COLORSPACE_BT878         = 4,
00098         
00099         /* These should be useful.  Assume 601 extents. */
00100         V4L2_COLORSPACE_470_SYSTEM_M  = 5,
00101         V4L2_COLORSPACE_470_SYSTEM_BG = 6,
00102         
00103         /* I know there will be cameras that send this.  So, this is
00104          * unspecified chromaticities and full 0-255 on each of the
00105          * Y'CbCr components
00106          */
00107         V4L2_COLORSPACE_JPEG          = 7,
00108         
00109         /* For RGB colourspaces, this is probably a good start. */
00110         V4L2_COLORSPACE_SRGB          = 8,
00111 };
00112 
00113 struct v4l2_rect {
00114         __s32   left;
00115         __s32   top;
00116         __s32   width;
00117         __s32   height;
00118 };
00119 
00120 struct v4l2_fract {
00121         __u32   numerator;
00122         __u32   denominator;
00123 };
00124 
00125 /*
00126  *      D R I V E R   C A P A B I L I T I E S
00127  */
00128 struct v4l2_capability
00129 {
00130         __u8    driver[16];     /* i.e. "bttv" */
00131         __u8    card[32];       /* i.e. "Hauppauge WinTV" */
00132         __u8    bus_info[32];   /* "PCI:" + pci_dev->slot_name */
00133         __u32   version;        /* should use KERNEL_VERSION() */
00134         __u32   capabilities;   /* Device capabilities */
00135         __u32   reserved[4];
00136 };
00137 
00138 /* Values for 'capabilities' field */
00139 #define V4L2_CAP_VIDEO_CAPTURE  0x00000001  /* Is a video capture device */
00140 #define V4L2_CAP_VIDEO_OUTPUT   0x00000002  /* Is a video output device */
00141 #define V4L2_CAP_VIDEO_OVERLAY  0x00000004  /* Can do video overlay */
00142 #define V4L2_CAP_VBI_CAPTURE    0x00000010  /* Is a VBI capture device */
00143 #define V4L2_CAP_VBI_OUTPUT     0x00000020  /* Is a VBI output device */
00144 #define V4L2_CAP_RDS_CAPTURE    0x00000100  /* RDS data capture */
00145 
00146 #define V4L2_CAP_TUNER          0x00010000  /* Has a tuner */
00147 #define V4L2_CAP_AUDIO          0x00020000  /* has audio support */
00148 
00149 #define V4L2_CAP_READWRITE      0x01000000  /* read/write systemcalls */
00150 #define V4L2_CAP_ASYNCIO        0x02000000  /* async I/O */
00151 #define V4L2_CAP_STREAMING      0x04000000  /* streaming I/O ioctls */
00152 
00153 /*
00154  *      V I D E O   I M A G E   F O R M A T
00155  */
00156 
00157 struct v4l2_pix_format
00158 {
00159         __u32                   width;
00160         __u32                   height;
00161         __u32                   pixelformat;
00162         enum v4l2_field         field;
00163         __u32                   bytesperline;   /* for padding, zero if unused */
00164         __u32                   sizeimage;
00165         enum v4l2_colorspace    colorspace;
00166         __u32                   priv;           /* private data, depends on pixelformat */
00167 };
00168 
00169 /*           Pixel format    FOURCC                  depth  Description   */
00170 #define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R','G','B','1') /*  8  RGB-3-3-2     */
00171 #define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R','G','B','O') /* 16  RGB-5-5-5     */
00172 #define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R','G','B','P') /* 16  RGB-5-6-5     */
00173 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16  RGB-5-5-5 BE  */
00174 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16  RGB-5-6-5 BE  */
00175 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B','G','R','3') /* 24  BGR-8-8-8     */
00176 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R','G','B','3') /* 24  RGB-8-8-8     */
00177 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B','G','R','4') /* 32  BGR-8-8-8-8   */
00178 #define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R','G','B','4') /* 32  RGB-8-8-8-8   */
00179 #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G','R','E','Y') /*  8  Greyscale     */
00180 #define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y','V','U','9') /*  9  YVU 4:1:0     */
00181 #define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y','V','1','2') /* 12  YVU 4:2:0     */
00182 #define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y','U','Y','V') /* 16  YUV 4:2:2     */
00183 #define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U','Y','V','Y') /* 16  YUV 4:2:2     */
00184 #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16  YVU422 planar */
00185 #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16  YVU411 planar */
00186 #define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y','4','1','P') /* 12  YUV 4:1:1     */
00187 
00188 /* two planes -- one Y, one Cr + Cb interleaved  */
00189 #define V4L2_PIX_FMT_NV12    v4l2_fourcc('N','V','1','2') /* 12  Y/CbCr 4:2:0  */
00190 #define V4L2_PIX_FMT_NV21    v4l2_fourcc('N','V','2','1') /* 12  Y/CrCb 4:2:0  */
00191 
00192 /*  The following formats are not defined in the V4L2 specification */
00193 #define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y','U','V','9') /*  9  YUV 4:1:0     */
00194 #define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y','U','1','2') /* 12  YUV 4:2:0     */
00195 #define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y','Y','U','V') /* 16  YUV 4:2:2     */
00196 #define V4L2_PIX_FMT_HI240   v4l2_fourcc('H','I','2','4') /*  8  8-bit color   */
00197 
00198 /* compressed formats */
00199 #define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M','J','P','G') /* Motion-JPEG   */
00200 #define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J','P','E','G') /* JFIF JPEG     */
00201 #define V4L2_PIX_FMT_DV       v4l2_fourcc('d','v','s','d') /* 1394          */
00202 #define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M','P','E','G') /* MPEG          */
00203 
00204 /*  Vendor-specific formats   */
00205 #define V4L2_PIX_FMT_WNVA    v4l2_fourcc('W','N','V','A') /* Winnov hw compres */
00206 
00207 /*
00208  *      F O R M A T   E N U M E R A T I O N
00209  */
00210 struct v4l2_fmtdesc
00211 {
00212         __u32               index;             /* Format number      */
00213         enum v4l2_buf_type  type;              /* buffer type        */
00214         __u32               flags;
00215         __u8                description[32];   /* Description string */
00216         __u32               pixelformat;       /* Format fourcc      */
00217         __u32               reserved[4];
00218 };
00219 
00220 #define V4L2_FMT_FLAG_COMPRESSED 0x0001
00221 
00222 
00223 /*
00224  *      T I M E C O D E
00225  */
00226 struct v4l2_timecode
00227 {
00228         __u32   type;
00229         __u32   flags;
00230         __u8    frames;
00231         __u8    seconds;
00232         __u8    minutes;
00233         __u8    hours;
00234         __u8    userbits[4];
00235 };
00236 
00237 /*  Type  */
00238 #define V4L2_TC_TYPE_24FPS              1
00239 #define V4L2_TC_TYPE_25FPS              2
00240 #define V4L2_TC_TYPE_30FPS              3
00241 #define V4L2_TC_TYPE_50FPS              4
00242 #define V4L2_TC_TYPE_60FPS              5
00243 
00244 /*  Flags  */
00245 #define V4L2_TC_FLAG_DROPFRAME          0x0001 /* "drop-frame" mode */
00246 #define V4L2_TC_FLAG_COLORFRAME         0x0002
00247 #define V4L2_TC_USERBITS_field          0x000C
00248 #define V4L2_TC_USERBITS_USERDEFINED    0x0000
00249 #define V4L2_TC_USERBITS_8BITCHARS      0x0008
00250 /* The above is based on SMPTE timecodes */
00251 
00252 
00253 /*
00254  *      C O M P R E S S I O N   P A R A M E T E R S
00255  */
00256 #if 0
00257 /* ### generic compression settings don't work, there is too much
00258  * ### codec-specific stuff.  Maybe reuse that for MPEG codec settings
00259  * ### later ... */
00260 struct v4l2_compression
00261 {
00262         __u32   quality;
00263         __u32   keyframerate;
00264         __u32   pframerate;
00265         __u32   reserved[5];
00266 };
00267 #endif
00268 
00269 struct v4l2_jpegcompression
00270 {
00271         int quality;
00272 
00273         int  APPn;              /* Number of APP segment to be written,
00274                                  * must be 0..15 */
00275         int  APP_len;           /* Length of data in JPEG APPn segment */
00276         char APP_data[60];      /* Data in the JPEG APPn segment. */
00277         
00278         int  COM_len;           /* Length of data in JPEG COM segment */
00279         char COM_data[60];      /* Data in JPEG COM segment */
00280         
00281         __u32 jpeg_markers;     /* Which markers should go into the JPEG
00282                                  * output. Unless you exactly know what
00283                                  * you do, leave them untouched.
00284                                  * Inluding less markers will make the
00285                                  * resulting code smaller, but there will
00286                                  * be fewer aplications which can read it.
00287                                  * The presence of the APP and COM marker
00288                                  * is influenced by APP_len and COM_len
00289                                  * ONLY, not by this property! */
00290         
00291 #define V4L2_JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
00292 #define V4L2_JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
00293 #define V4L2_JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
00294 #define V4L2_JPEG_MARKER_COM (1<<6)    /* Comment segment */
00295 #define V4L2_JPEG_MARKER_APP (1<<7)    /* App segment, driver will
00296                                         * allways use APP0 */
00297 };
00298 
00299 
00300 /*
00301  *      M E M O R Y - M A P P I N G   B U F F E R S
00302  */
00303 struct v4l2_requestbuffers
00304 {
00305         __u32                   count;
00306         enum v4l2_buf_type      type;
00307         enum v4l2_memory        memory;
00308         __u32                   reserved[2];
00309 };
00310 
00311 struct v4l2_buffer
00312 {
00313         __u32                   index;
00314         enum v4l2_buf_type      type;
00315         __u32                   bytesused;
00316         __u32                   flags;
00317         enum v4l2_field         field;
00318         struct timeval          timestamp;
00319         struct v4l2_timecode    timecode;
00320         __u32                   sequence;
00321 
00322         /* memory location */
00323         enum v4l2_memory        memory;
00324         union {
00325                 __u32           offset;
00326                 unsigned long   userptr;
00327         } m;
00328         __u32                   length;
00329 
00330         __u32                   reserved[2];
00331 };
00332 
00333 /*  Flags for 'flags' field */
00334 #define V4L2_BUF_FLAG_MAPPED    0x0001  /* Buffer is mapped (flag) */
00335 #define V4L2_BUF_FLAG_QUEUED    0x0002  /* Buffer is queued for processing */
00336 #define V4L2_BUF_FLAG_DONE      0x0004  /* Buffer is ready */
00337 #define V4L2_BUF_FLAG_KEYFRAME  0x0008  /* Image is a keyframe (I-frame) */
00338 #define V4L2_BUF_FLAG_PFRAME    0x0010  /* Image is a P-frame */
00339 #define V4L2_BUF_FLAG_BFRAME    0x0020  /* Image is a B-frame */
00340 #define V4L2_BUF_FLAG_TIMECODE  0x0100  /* timecode field is valid */
00341 
00342 /*
00343  *      O V E R L A Y   P R E V I E W
00344  */
00345 struct v4l2_framebuffer
00346 {
00347         __u32                   capability;
00348         __u32                   flags;
00349 /* FIXME: in theory we should pass something like PCI device + memory
00350  * region + offset instead of some physical address */
00351         void*                   base;
00352         struct v4l2_pix_format  fmt;
00353 };
00354 /*  Flags for the 'capability' field. Read only */
00355 #define V4L2_FBUF_CAP_EXTERNOVERLAY     0x0001
00356 #define V4L2_FBUF_CAP_CHROMAKEY         0x0002
00357 #define V4L2_FBUF_CAP_LIST_CLIPPING     0x0004
00358 #define V4L2_FBUF_CAP_BITMAP_CLIPPING   0x0008
00359 /*  Flags for the 'flags' field. */
00360 #define V4L2_FBUF_FLAG_PRIMARY          0x0001
00361 #define V4L2_FBUF_FLAG_OVERLAY          0x0002
00362 #define V4L2_FBUF_FLAG_CHROMAKEY        0x0004
00363 
00364 struct v4l2_clip
00365 {
00366         struct v4l2_rect        c;
00367         struct v4l2_clip        *next;
00368 };
00369 
00370 struct v4l2_window
00371 {
00372         struct v4l2_rect        w;
00373         enum v4l2_field         field;
00374         __u32                   chromakey;
00375         struct v4l2_clip        *clips;
00376         __u32                   clipcount;
00377         void                    *bitmap;
00378 };
00379 
00380 
00381 /*
00382  *      C A P T U R E   P A R A M E T E R S
00383  */
00384 struct v4l2_captureparm
00385 {
00386         __u32              capability;    /*  Supported modes */
00387         __u32              capturemode;   /*  Current mode */
00388         struct v4l2_fract  timeperframe;  /*  Time per frame in .1us units */
00389         __u32              extendedmode;  /*  Driver-specific extensions */
00390         __u32              readbuffers;   /*  # of buffers for read */
00391         __u32              reserved[4];
00392 };
00393 /*  Flags for 'capability' and 'capturemode' fields */
00394 #define V4L2_MODE_HIGHQUALITY   0x0001  /*  High quality imaging mode */
00395 #define V4L2_CAP_TIMEPERFRAME   0x1000  /*  timeperframe field is supported */
00396 
00397 struct v4l2_outputparm
00398 {
00399         __u32              capability;   /*  Supported modes */
00400         __u32              outputmode;   /*  Current mode */
00401         struct v4l2_fract  timeperframe; /*  Time per frame in seconds */
00402         __u32              extendedmode; /*  Driver-specific extensions */
00403         __u32              writebuffers; /*  # of buffers for write */
00404         __u32              reserved[4];
00405 };
00406 
00407 /*
00408  *      I N P U T   I M A G E   C R O P P I N G
00409  */
00410 
00411 struct v4l2_cropcap {
00412         enum v4l2_buf_type      type;   
00413         struct v4l2_rect        bounds;
00414         struct v4l2_rect        defrect;
00415         struct v4l2_fract       pixelaspect;
00416 };
00417 
00418 struct v4l2_crop {
00419         enum v4l2_buf_type      type;
00420         struct v4l2_rect        c;
00421 };
00422 
00423 /*
00424  *      A N A L O G   V I D E O   S T A N D A R D
00425  */
00426 
00427 typedef __u64 v4l2_std_id;
00428 
00429 /* one bit for each */
00430 #define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
00431 #define V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
00432 #define V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
00433 #define V4L2_STD_PAL_H          ((v4l2_std_id)0x00000008)
00434 #define V4L2_STD_PAL_I          ((v4l2_std_id)0x00000010)
00435 #define V4L2_STD_PAL_D          ((v4l2_std_id)0x00000020)
00436 #define V4L2_STD_PAL_D1         ((v4l2_std_id)0x00000040)
00437 #define V4L2_STD_PAL_K          ((v4l2_std_id)0x00000080)
00438 
00439 #define V4L2_STD_PAL_M          ((v4l2_std_id)0x00000100)
00440 #define V4L2_STD_PAL_N          ((v4l2_std_id)0x00000200)
00441 #define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
00442 #define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
00443 
00444 #define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
00445 #define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
00446 
00447 #define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
00448 #define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
00449 #define V4L2_STD_SECAM_G        ((v4l2_std_id)0x00040000)
00450 #define V4L2_STD_SECAM_H        ((v4l2_std_id)0x00080000)
00451 #define V4L2_STD_SECAM_K        ((v4l2_std_id)0x00100000)
00452 #define V4L2_STD_SECAM_K1       ((v4l2_std_id)0x00200000)
00453 #define V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
00454 
00455 /* ATSC/HDTV */
00456 #define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
00457 #define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
00458 
00459 /* some common needed stuff */
00460 #define V4L2_STD_PAL_BG         (V4L2_STD_PAL_B         |\
00461                                  V4L2_STD_PAL_B1        |\
00462                                  V4L2_STD_PAL_G)
00463 #define V4L2_STD_PAL_DK         (V4L2_STD_PAL_D         |\
00464                                  V4L2_STD_PAL_D1        |\
00465                                  V4L2_STD_PAL_K)
00466 #define V4L2_STD_PAL            (V4L2_STD_PAL_BG        |\
00467                                  V4L2_STD_PAL_DK        |\
00468                                  V4L2_STD_PAL_H         |\
00469                                  V4L2_STD_PAL_I)
00470 #define V4L2_STD_NTSC           (V4L2_STD_NTSC_M        |\
00471                                  V4L2_STD_NTSC_M_JP)
00472 #define V4L2_STD_SECAM          (V4L2_STD_SECAM_B       |\
00473                                  V4L2_STD_SECAM_D       |\
00474                                  V4L2_STD_SECAM_G       |\
00475                                  V4L2_STD_SECAM_H       |\
00476                                  V4L2_STD_SECAM_K       |\
00477                                  V4L2_STD_SECAM_K1      |\
00478                                  V4L2_STD_SECAM_L)
00479 
00480 #define V4L2_STD_525_60         (V4L2_STD_PAL_M         |\
00481                                  V4L2_STD_PAL_60        |\
00482                                  V4L2_STD_NTSC)
00483 #define V4L2_STD_625_50         (V4L2_STD_PAL           |\
00484                                  V4L2_STD_PAL_N         |\
00485                                  V4L2_STD_PAL_Nc        |\
00486                                  V4L2_STD_SECAM)
00487 
00488 #define V4L2_STD_UNKNOWN        0
00489 #define V4L2_STD_ALL            (V4L2_STD_525_60        |\
00490                                  V4L2_STD_625_50)
00491 
00492 struct v4l2_standard
00493 {
00494         __u32                index;
00495         v4l2_std_id          id;
00496         __u8                 name[24];
00497         struct v4l2_fract    frameperiod; /* Frames, not fields */
00498         __u32                framelines;
00499         __u32                reserved[4];
00500 };
00501 
00502 
00503 /*
00504  *      V I D E O   I N P U T S
00505  */
00506 struct v4l2_input
00507 {
00508         __u32        index;             /*  Which input */
00509         __u8         name[32];          /*  Label */
00510         __u32        type;              /*  Type of input */
00511         __u32        audioset;          /*  Associated audios (bitfield) */
00512         __u32        tuner;             /*  Associated tuner */
00513         v4l2_std_id  std;
00514         __u32        status;
00515         __u32        reserved[4];
00516 };
00517 /*  Values for the 'type' field */
00518 #define V4L2_INPUT_TYPE_TUNER           1
00519 #define V4L2_INPUT_TYPE_CAMERA          2
00520 
00521 /* field 'status' - general */
00522 #define V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
00523 #define V4L2_IN_ST_NO_SIGNAL   0x00000002
00524 #define V4L2_IN_ST_NO_COLOR    0x00000004
00525 
00526 /* field 'status' - analog */
00527 #define V4L2_IN_ST_NO_H_LOCK   0x00000100  /* No horizontal sync lock */
00528 #define V4L2_IN_ST_COLOR_KILL  0x00000200  /* Color killer is active */
00529 
00530 /* field 'status' - digital */
00531 #define V4L2_IN_ST_NO_SYNC     0x00010000  /* No synchronization lock */
00532 #define V4L2_IN_ST_NO_EQU      0x00020000  /* No equalizer lock */
00533 #define V4L2_IN_ST_NO_CARRIER  0x00040000  /* Carrier recovery failed */
00534 
00535 /* field 'status' - VCR and set-top box */
00536 #define V4L2_IN_ST_MACROVISION 0x01000000  /* Macrovision detected */
00537 #define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
00538 #define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
00539 
00540 /*
00541  *      V I D E O   O U T P U T S
00542  */
00543 struct v4l2_output
00544 {
00545         __u32        index;             /*  Which output */
00546         __u8         name[32];          /*  Label */
00547         __u32        type;              /*  Type of output */
00548         __u32        audioset;          /*  Associated audios (bitfield) */
00549         __u32        modulator;         /*  Associated modulator */
00550         v4l2_std_id  std;
00551         __u32        reserved[4];
00552 };
00553 /*  Values for the 'type' field */
00554 #define V4L2_OUTPUT_TYPE_MODULATOR              1
00555 #define V4L2_OUTPUT_TYPE_ANALOG                 2
00556 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY       3
00557 
00558 /*
00559  *      C O N T R O L S
00560  */
00561 struct v4l2_control
00562 {
00563         __u32                id;
00564         __s32                value;
00565 };
00566 
00567 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
00568 struct v4l2_queryctrl
00569 {
00570         __u32                id;
00571         enum v4l2_ctrl_type  type;
00572         __u8                 name[32];  /* Whatever */
00573         __s32                minimum;   /* Note signedness */
00574         __s32                maximum;
00575         __s32                step;
00576         __s32                default_value;
00577         __u32                flags;
00578         __u32                reserved[2];
00579 };
00580 
00581 /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
00582 struct v4l2_querymenu
00583 {
00584         __u32           id;
00585         __u32           index;
00586         __u8            name[32];       /* Whatever */
00587         __u32           reserved;
00588 };
00589 
00590 /*  Control flags  */
00591 #define V4L2_CTRL_FLAG_DISABLED         0x0001
00592 #define V4L2_CTRL_FLAG_GRABBED          0x0002
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 
00599 #define V4L2_CID_BRIGHTNESS             (V4L2_CID_BASE+0)
00600 #define V4L2_CID_CONTRAST               (V4L2_CID_BASE+1)
00601 #define V4L2_CID_SATURATION             (V4L2_CID_BASE+2)
00602 #define V4L2_CID_HUE                    (V4L2_CID_BASE+3)
00603 #define V4L2_CID_AUDIO_VOLUME           (V4L2_CID_BASE+5)
00604 #define V4L2_CID_AUDIO_BALANCE          (V4L2_CID_BASE+6)
00605 #define V4L2_CID_AUDIO_BASS             (V4L2_CID_BASE+7)
00606 #define V4L2_CID_AUDIO_TREBLE           (V4L2_CID_BASE+8)
00607 #define V4L2_CID_AUDIO_MUTE             (V4L2_CID_BASE+9)
00608 #define V4L2_CID_AUDIO_LOUDNESS         (V4L2_CID_BASE+10)
00609 #define V4L2_CID_BLACK_LEVEL            (V4L2_CID_BASE+11)
00610 #define V4L2_CID_AUTO_WHITE_BALANCE     (V4L2_CID_BASE+12)
00611 #define V4L2_CID_DO_WHITE_BALANCE       (V4L2_CID_BASE+13)
00612 #define V4L2_CID_RED_BALANCE            (V4L2_CID_BASE+14)
00613 #define V4L2_CID_BLUE_BALANCE           (V4L2_CID_BASE+15)
00614 #define V4L2_CID_GAMMA                  (V4L2_CID_BASE+16)
00615 #define V4L2_CID_WHITENESS              (V4L2_CID_GAMMA) /* ? Not sure */
00616 #define V4L2_CID_EXPOSURE               (V4L2_CID_BASE+17)
00617 #define V4L2_CID_AUTOGAIN               (V4L2_CID_BASE+18)
00618 #define V4L2_CID_GAIN                   (V4L2_CID_BASE+19)
00619 #define V4L2_CID_HFLIP                  (V4L2_CID_BASE+20)
00620 #define V4L2_CID_VFLIP                  (V4L2_CID_BASE+21)
00621 #define V4L2_CID_HCENTER                (V4L2_CID_BASE+22)
00622 #define V4L2_CID_VCENTER                (V4L2_CID_BASE+23)
00623 #define V4L2_CID_LASTP1                 (V4L2_CID_BASE+24) /* last CID + 1 */
00624 
00625 /*
00626  *      T U N I N G
00627  */
00628 struct v4l2_tuner
00629 {
00630         __u32                   index;
00631         __u8                    name[32];
00632         enum v4l2_tuner_type    type;
00633         __u32                   capability;
00634         __u32                   rangelow;
00635         __u32                   rangehigh;
00636         __u32                   rxsubchans;
00637         __u32                   audmode;
00638         __s32                   signal;
00639         __s32                   afc;
00640         __u32                   reserved[4];
00641 };
00642 
00643 struct v4l2_modulator
00644 {
00645         __u32                   index;
00646         __u8                    name[32];
00647         __u32                   capability;
00648         __u32                   rangelow;
00649         __u32                   rangehigh;
00650         __u32                   txsubchans;
00651         __u32                   reserved[4];
00652 };
00653 
00654 /*  Flags for the 'capability' field */
00655 #define V4L2_TUNER_CAP_LOW              0x0001
00656 #define V4L2_TUNER_CAP_NORM             0x0002
00657 #define V4L2_TUNER_CAP_STEREO           0x0010
00658 #define V4L2_TUNER_CAP_LANG2            0x0020
00659 #define V4L2_TUNER_CAP_SAP              0x0020
00660 #define V4L2_TUNER_CAP_LANG1            0x0040
00661 
00662 /*  Flags for the 'rxsubchans' field */
00663 #define V4L2_TUNER_SUB_MONO             0x0001
00664 #define V4L2_TUNER_SUB_STEREO           0x0002
00665 #define V4L2_TUNER_SUB_LANG2            0x0004
00666 #define V4L2_TUNER_SUB_SAP              0x0004
00667 #define V4L2_TUNER_SUB_LANG1            0x0008
00668 
00669 /*  Values for the 'audmode' field */
00670 #define V4L2_TUNER_MODE_MONO            0x0000
00671 #define V4L2_TUNER_MODE_STEREO          0x0001
00672 #define V4L2_TUNER_MODE_LANG2           0x0002
00673 #define V4L2_TUNER_MODE_SAP             0x0002
00674 #define V4L2_TUNER_MODE_LANG1           0x0003
00675 
00676 struct v4l2_frequency
00677 {
00678         __u32                 tuner;
00679         enum v4l2_tuner_type  type;
00680         __u32                 frequency;
00681         __u32                 reserved[8];
00682 };
00683 
00684 /*
00685  *      A U D I O
00686  */
00687 struct v4l2_audio
00688 {
00689         __u32   index;
00690         __u8    name[32];
00691         __u32   capability;
00692         __u32   mode;
00693         __u32   reserved[2];
00694 };
00695 /*  Flags for the 'capability' field */
00696 #define V4L2_AUDCAP_STEREO              0x00001
00697 #define V4L2_AUDCAP_AVL                 0x00002
00698 
00699 /*  Flags for the 'mode' field */
00700 #define V4L2_AUDMODE_AVL                0x00001
00701 
00702 struct v4l2_audioout
00703 {
00704         __u32   index;
00705         __u8    name[32];
00706         __u32   capability;
00707         __u32   mode;
00708         __u32   reserved[2];
00709 };
00710 
00711 /*
00712  *      D A T A   S E R V I C E S   ( V B I )
00713  *
00714  *      Data services API by Michael Schimek
00715  */
00716 
00717 struct v4l2_vbi_format
00718 {
00719         __u32   sampling_rate;          /* in 1 Hz */
00720         __u32   offset;
00721         __u32   samples_per_line;
00722         __u32   sample_format;          /* V4L2_PIX_FMT_* */
00723         __s32   start[2];
00724         __u32   count[2];
00725         __u32   flags;                  /* V4L2_VBI_* */
00726         __u32   reserved[2];            /* must be zero */
00727 };
00728 
00729 /*  VBI flags  */
00730 #define V4L2_VBI_UNSYNC         (1<< 0)
00731 #define V4L2_VBI_INTERLACED     (1<< 1)
00732 
00733 
00734 /*
00735  *      A G G R E G A T E   S T R U C T U R E S
00736  */
00737 
00738 /*      Stream data format
00739  */
00740 struct v4l2_format
00741 {
00742         enum v4l2_buf_type type;
00743         union
00744         {
00745                 struct v4l2_pix_format  pix;  // V4L2_BUF_TYPE_VIDEO_CAPTURE
00746                 struct v4l2_window      win;  // V4L2_BUF_TYPE_VIDEO_OVERLAY
00747                 struct v4l2_vbi_format  vbi;  // V4L2_BUF_TYPE_VBI_CAPTURE
00748                 __u8    raw_data[200];        // user-defined
00749         } fmt;
00750 };
00751 
00752 
00753 /*      Stream type-dependent parameters
00754  */
00755 struct v4l2_streamparm
00756 {
00757         enum v4l2_buf_type type;
00758         union
00759         {
00760                 struct v4l2_captureparm capture;
00761                 struct v4l2_outputparm  output;
00762                 __u8    raw_data[200];  /* user-defined */
00763         } parm;
00764 };
00765 
00766 
00767 
00768 /*
00769  *      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
00770  *
00771  */
00772 #define VIDIOC_QUERYCAP         _IOR  ('V',  0, struct v4l2_capability)
00773 #define VIDIOC_RESERVED         _IO   ('V',  1)
00774 #define VIDIOC_ENUM_FMT         _IOWR ('V',  2, struct v4l2_fmtdesc)
00775 #define VIDIOC_G_FMT            _IOWR ('V',  4, struct v4l2_format)
00776 #define VIDIOC_S_FMT            _IOWR ('V',  5, struct v4l2_format)
00777 #if 0
00778 #define VIDIOC_G_COMP           _IOR  ('V',  6, struct v4l2_compression)
00779 #define VIDIOC_S_COMP           _IOW  ('V',  7, struct v4l2_compression)
00780 #endif
00781 #define VIDIOC_REQBUFS          _IOWR ('V',  8, struct v4l2_requestbuffers)
00782 #define VIDIOC_QUERYBUF         _IOWR ('V',  9, struct v4l2_buffer)
00783 #define VIDIOC_G_FBUF           _IOR  ('V', 10, struct v4l2_framebuffer)
00784 #define VIDIOC_S_FBUF           _IOW  ('V', 11, struct v4l2_framebuffer)
00785 #define VIDIOC_OVERLAY          _IOWR ('V', 14, int)
00786 #define VIDIOC_QBUF             _IOWR ('V', 15, struct v4l2_buffer)
00787 #define VIDIOC_DQBUF            _IOWR ('V', 17, struct v4l2_buffer)
00788 #define VIDIOC_STREAMON         _IOW  ('V', 18, int)
00789 #define VIDIOC_STREAMOFF        _IOW  ('V', 19, int)
00790 #define VIDIOC_G_PARM           _IOWR ('V', 21, struct v4l2_streamparm)
00791 #define VIDIOC_S_PARM           _IOW  ('V', 22, struct v4l2_streamparm)
00792 #define VIDIOC_G_STD            _IOR  ('V', 23, v4l2_std_id)
00793 #define VIDIOC_S_STD            _IOW  ('V', 24, v4l2_std_id)
00794 #define VIDIOC_ENUMSTD          _IOWR ('V', 25, struct v4l2_standard)
00795 #define VIDIOC_ENUMINPUT        _IOWR ('V', 26, struct v4l2_input)
00796 #define VIDIOC_G_CTRL           _IOWR ('V', 27, struct v4l2_control)
00797 #define VIDIOC_S_CTRL           _IOW  ('V', 28, struct v4l2_control)
00798 #define VIDIOC_G_TUNER          _IOWR ('V', 29, struct v4l2_tuner)
00799 #define VIDIOC_S_TUNER          _IOW  ('V', 30, struct v4l2_tuner)
00800 #define VIDIOC_G_AUDIO          _IOWR ('V', 33, struct v4l2_audio)
00801 #define VIDIOC_S_AUDIO          _IOW  ('V', 34, struct v4l2_audio)
00802 #define VIDIOC_QUERYCTRL        _IOWR ('V', 36, struct v4l2_queryctrl)
00803 #define VIDIOC_QUERYMENU        _IOWR ('V', 37, struct v4l2_querymenu)
00804 #define VIDIOC_G_INPUT          _IOR  ('V', 38, int)
00805 #define VIDIOC_S_INPUT          _IOWR ('V', 39, int)
00806 #define VIDIOC_G_OUTPUT         _IOR  ('V', 46, int)
00807 #define VIDIOC_S_OUTPUT         _IOWR ('V', 47, int)
00808 #define VIDIOC_ENUMOUTPUT       _IOWR ('V', 48, struct v4l2_output)
00809 #define VIDIOC_G_AUDOUT         _IOWR ('V', 49, struct v4l2_audioout)
00810 #define VIDIOC_S_AUDOUT         _IOW  ('V', 50, struct v4l2_audioout)
00811 #define VIDIOC_G_MODULATOR      _IOWR ('V', 54, struct v4l2_modulator)
00812 #define VIDIOC_S_MODULATOR      _IOW  ('V', 55, struct v4l2_modulator)
00813 #define VIDIOC_G_FREQUENCY      _IOWR ('V', 56, struct v4l2_frequency)
00814 #define VIDIOC_S_FREQUENCY      _IOW  ('V', 57, struct v4l2_frequency)
00815 #define VIDIOC_CROPCAP          _IOR  ('V', 58, struct v4l2_cropcap)
00816 #define VIDIOC_G_CROP           _IOWR ('V', 59, struct v4l2_crop)
00817 #define VIDIOC_S_CROP           _IOW  ('V', 60, struct v4l2_crop)
00818 #define VIDIOC_G_JPEGCOMP       _IOR  ('V', 61, struct v4l2_jpegcompression)
00819 #define VIDIOC_S_JPEGCOMP       _IOW  ('V', 62, struct v4l2_jpegcompression)
00820 #define VIDIOC_QUERYSTD         _IOR  ('V', 63, v4l2_std_id)
00821 #define VIDIOC_TRY_FMT          _IOWR ('V', 64, struct v4l2_format)
00822 
00823 #define BASE_VIDIOC_PRIVATE     192             /* 192-255 are private */
00824 
00825 
00826 #ifdef __KERNEL__
00827 /*
00828  *
00829  *      V 4 L 2   D R I V E R   H E L P E R   A P I
00830  *
00831  *      Some commonly needed functions for drivers (v4l2-common.o module)
00832  */
00833 #include <linux/fs.h>
00834 
00835 /*  Video standard functions  */
00836 extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
00837 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
00838                                     int id, char *name);
00839 
00840 /*  Compatibility layer interface  */
00841 typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
00842                            unsigned int cmd, void *arg);
00843 int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
00844                                int cmd, void *arg, v4l2_kioctl driver_ioctl);
00845 
00846 /* names for fancy debug output */
00847 extern char *v4l2_field_names[];
00848 extern char *v4l2_type_names[];
00849 extern char *v4l2_ioctl_names[];
00850 
00851 #endif /* __KERNEL__ */
00852 #endif /* __LINUX_VIDEODEV2_H */
00853 
00854 /*
00855  * Local variables:
00856  * c-basic-offset: 8
00857  * End:
00858  */

Generated on Tue Dec 20 10:14:26 2005 for vlc-0.8.4a by  doxygen 1.4.2