1221424Snetchild/* 2221424Snetchild * This header comes from linux, but it has no license. The author 3221424Snetchild * (Bill Dirks) gave explicit permissions to use it in FreeBSD. 4221424Snetchild * The FreeBSD vendor branch for v4l gives a more detailed description 5221424Snetchild * about this in the README. 6221424Snetchild * 7221424Snetchild * $FreeBSD$ 8221424Snetchild */ 9221424Snetchild 10221421Snetchild#ifndef __LINUX_VIDEODEV2_H 11221421Snetchild#define __LINUX_VIDEODEV2_H 12221421Snetchild/* 13221421Snetchild * Video for Linux Two 14221421Snetchild * 15221421Snetchild * Header file for v4l or V4L2 drivers and applications, for 16221421Snetchild * Linux kernels 2.2.x or 2.4.x. 17221421Snetchild * 18221421Snetchild * See http://bytesex.org/v4l/ for API specs and other 19221421Snetchild * v4l2 documentation. 20221421Snetchild * 21221421Snetchild * Author: Bill Dirks <bdirks@pacbell.net> 22221421Snetchild * Justin Schoeman 23221421Snetchild * et al. 24221421Snetchild */ 25221424Snetchild#ifdef __FreeBSD__ 26221424Snetchild#define __user 27221424Snetchildtypedef uint64_t __u64; 28221424Snetchildtypedef int64_t __s64; 29221424Snetchild#else 30221421Snetchild#ifdef __KERNEL__ 31221421Snetchild#include <linux/time.h> /* need struct timeval */ 32221421Snetchild#include <linux/poll.h> 33221421Snetchild#include <linux/device.h> 34221421Snetchild#include <linux/mutex.h> 35221421Snetchild#endif 36221421Snetchild#include <linux/compiler.h> /* need __user */ 37221424Snetchild#endif 38221421Snetchild 39221421Snetchild 40221421Snetchild#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */ 41221421Snetchild#define HAVE_V4L2 1 42221421Snetchild 43221421Snetchild/* 44221421Snetchild * Common stuff for both V4L1 and V4L2 45221421Snetchild * Moved from videodev.h 46221421Snetchild */ 47221421Snetchild 48221421Snetchild#define VIDEO_MAX_FRAME 32 49221421Snetchild 50221421Snetchild#define VID_TYPE_CAPTURE 1 /* Can capture */ 51221421Snetchild#define VID_TYPE_TUNER 2 /* Can tune */ 52221421Snetchild#define VID_TYPE_TELETEXT 4 /* Does teletext */ 53221421Snetchild#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ 54221421Snetchild#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ 55221421Snetchild#define VID_TYPE_CLIPPING 32 /* Can clip */ 56221421Snetchild#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ 57221421Snetchild#define VID_TYPE_SCALES 128 /* Scalable */ 58221421Snetchild#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ 59221421Snetchild#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ 60221421Snetchild#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ 61221421Snetchild#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ 62221421Snetchild#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 63221421Snetchild#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 64221421Snetchild 65221421Snetchild#ifdef __KERNEL__ 66221421Snetchild 67221421Snetchild/* Minor device allocation */ 68221421Snetchild#define MINOR_VFL_TYPE_GRABBER_MIN 0 69221421Snetchild#define MINOR_VFL_TYPE_GRABBER_MAX 63 70221421Snetchild#define MINOR_VFL_TYPE_RADIO_MIN 64 71221421Snetchild#define MINOR_VFL_TYPE_RADIO_MAX 127 72221421Snetchild#define MINOR_VFL_TYPE_VTX_MIN 192 73221421Snetchild#define MINOR_VFL_TYPE_VTX_MAX 223 74221421Snetchild#define MINOR_VFL_TYPE_VBI_MIN 224 75221421Snetchild#define MINOR_VFL_TYPE_VBI_MAX 255 76221421Snetchild 77221421Snetchild#define VFL_TYPE_GRABBER 0 78221421Snetchild#define VFL_TYPE_VBI 1 79221421Snetchild#define VFL_TYPE_RADIO 2 80221421Snetchild#define VFL_TYPE_VTX 3 81221421Snetchild 82221421Snetchildstruct video_device 83221421Snetchild{ 84221421Snetchild /* device info */ 85221421Snetchild struct device *dev; 86221421Snetchild char name[32]; 87221421Snetchild int type; /* v4l1 */ 88221421Snetchild int type2; /* v4l2 */ 89221421Snetchild int hardware; 90221421Snetchild int minor; 91221421Snetchild 92221421Snetchild /* device ops + callbacks */ 93221421Snetchild const struct file_operations *fops; 94221421Snetchild void (*release)(struct video_device *vfd); 95221421Snetchild 96221421Snetchild 97221421Snetchild#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ 98221421Snetchild /* obsolete -- fops->owner is used instead */ 99221421Snetchild struct module *owner; 100221421Snetchild /* dev->driver_data will be used instead some day. 101221421Snetchild * Use the video_{get|set}_drvdata() helper functions, 102221421Snetchild * so the switch over will be transparent for you. 103221421Snetchild * Or use {pci|usb}_{get|set}_drvdata() directly. */ 104221421Snetchild void *priv; 105221421Snetchild#endif 106221421Snetchild 107221421Snetchild /* for videodev.c intenal usage -- please don't touch */ 108221421Snetchild int users; /* video_exclusive_{open|close} ... */ 109221421Snetchild struct mutex lock; /* ... helper function uses these */ 110221421Snetchild char devfs_name[64]; /* devfs */ 111221421Snetchild struct class_device class_dev; /* sysfs */ 112221421Snetchild}; 113221421Snetchild 114221421Snetchild#define VIDEO_MAJOR 81 115221421Snetchild 116221421Snetchildextern int video_register_device(struct video_device *, int type, int nr); 117221421Snetchildextern void video_unregister_device(struct video_device *); 118221421Snetchildextern int video_usercopy(struct inode *inode, struct file *file, 119221421Snetchild unsigned int cmd, unsigned long arg, 120221421Snetchild int (*func)(struct inode *inode, struct file *file, 121221421Snetchild unsigned int cmd, void *arg)); 122221421Snetchild 123221421Snetchild/* helper functions to alloc / release struct video_device, the 124221421Snetchild later can be used for video_device->release() */ 125221421Snetchildstruct video_device *video_device_alloc(void); 126221421Snetchildvoid video_device_release(struct video_device *vfd); 127221421Snetchild 128221421Snetchild#endif 129221421Snetchild 130221421Snetchild/* 131221421Snetchild * M I S C E L L A N E O U S 132221421Snetchild */ 133221421Snetchild 134221421Snetchild/* Four-character-code (FOURCC) */ 135221421Snetchild#define v4l2_fourcc(a,b,c,d)\ 136221421Snetchild (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) 137221421Snetchild 138221421Snetchild/* 139221421Snetchild * E N U M S 140221421Snetchild */ 141221421Snetchildenum v4l2_field { 142221421Snetchild V4L2_FIELD_ANY = 0, /* driver can choose from none, 143221421Snetchild top, bottom, interlaced 144221421Snetchild depending on whatever it thinks 145221421Snetchild is approximate ... */ 146221421Snetchild V4L2_FIELD_NONE = 1, /* this device has no fields ... */ 147221421Snetchild V4L2_FIELD_TOP = 2, /* top field only */ 148221421Snetchild V4L2_FIELD_BOTTOM = 3, /* bottom field only */ 149221421Snetchild V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ 150221421Snetchild V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one 151221421Snetchild buffer, top-bottom order */ 152221421Snetchild V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ 153221421Snetchild V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into 154221421Snetchild separate buffers */ 155221421Snetchild}; 156221421Snetchild#define V4L2_FIELD_HAS_TOP(field) \ 157221421Snetchild ((field) == V4L2_FIELD_TOP ||\ 158221421Snetchild (field) == V4L2_FIELD_INTERLACED ||\ 159221421Snetchild (field) == V4L2_FIELD_SEQ_TB ||\ 160221421Snetchild (field) == V4L2_FIELD_SEQ_BT) 161221421Snetchild#define V4L2_FIELD_HAS_BOTTOM(field) \ 162221421Snetchild ((field) == V4L2_FIELD_BOTTOM ||\ 163221421Snetchild (field) == V4L2_FIELD_INTERLACED ||\ 164221421Snetchild (field) == V4L2_FIELD_SEQ_TB ||\ 165221421Snetchild (field) == V4L2_FIELD_SEQ_BT) 166221421Snetchild#define V4L2_FIELD_HAS_BOTH(field) \ 167221421Snetchild ((field) == V4L2_FIELD_INTERLACED ||\ 168221421Snetchild (field) == V4L2_FIELD_SEQ_TB ||\ 169221421Snetchild (field) == V4L2_FIELD_SEQ_BT) 170221421Snetchild 171221421Snetchildenum v4l2_buf_type { 172221421Snetchild V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, 173221421Snetchild V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, 174221421Snetchild V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, 175221421Snetchild V4L2_BUF_TYPE_VBI_CAPTURE = 4, 176221421Snetchild V4L2_BUF_TYPE_VBI_OUTPUT = 5, 177221421Snetchild#if 1 178221421Snetchild /* Experimental Sliced VBI */ 179221421Snetchild V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, 180221421Snetchild V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, 181221421Snetchild#endif 182221421Snetchild V4L2_BUF_TYPE_PRIVATE = 0x80, 183221421Snetchild}; 184221421Snetchild 185221421Snetchildenum v4l2_ctrl_type { 186221421Snetchild V4L2_CTRL_TYPE_INTEGER = 1, 187221421Snetchild V4L2_CTRL_TYPE_BOOLEAN = 2, 188221421Snetchild V4L2_CTRL_TYPE_MENU = 3, 189221421Snetchild V4L2_CTRL_TYPE_BUTTON = 4, 190221421Snetchild}; 191221421Snetchild 192221421Snetchildenum v4l2_tuner_type { 193221421Snetchild V4L2_TUNER_RADIO = 1, 194221421Snetchild V4L2_TUNER_ANALOG_TV = 2, 195221421Snetchild V4L2_TUNER_DIGITAL_TV = 3, 196221421Snetchild}; 197221421Snetchild 198221421Snetchildenum v4l2_memory { 199221421Snetchild V4L2_MEMORY_MMAP = 1, 200221421Snetchild V4L2_MEMORY_USERPTR = 2, 201221421Snetchild V4L2_MEMORY_OVERLAY = 3, 202221421Snetchild}; 203221421Snetchild 204221421Snetchild/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ 205221421Snetchildenum v4l2_colorspace { 206221421Snetchild /* ITU-R 601 -- broadcast NTSC/PAL */ 207221421Snetchild V4L2_COLORSPACE_SMPTE170M = 1, 208221421Snetchild 209221421Snetchild /* 1125-Line (US) HDTV */ 210221421Snetchild V4L2_COLORSPACE_SMPTE240M = 2, 211221421Snetchild 212221421Snetchild /* HD and modern captures. */ 213221421Snetchild V4L2_COLORSPACE_REC709 = 3, 214221421Snetchild 215221421Snetchild /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ 216221421Snetchild V4L2_COLORSPACE_BT878 = 4, 217221421Snetchild 218221421Snetchild /* These should be useful. Assume 601 extents. */ 219221421Snetchild V4L2_COLORSPACE_470_SYSTEM_M = 5, 220221421Snetchild V4L2_COLORSPACE_470_SYSTEM_BG = 6, 221221421Snetchild 222221421Snetchild /* I know there will be cameras that send this. So, this is 223221421Snetchild * unspecified chromaticities and full 0-255 on each of the 224221421Snetchild * Y'CbCr components 225221421Snetchild */ 226221421Snetchild V4L2_COLORSPACE_JPEG = 7, 227221421Snetchild 228221421Snetchild /* For RGB colourspaces, this is probably a good start. */ 229221421Snetchild V4L2_COLORSPACE_SRGB = 8, 230221421Snetchild}; 231221421Snetchild 232221421Snetchildenum v4l2_priority { 233221421Snetchild V4L2_PRIORITY_UNSET = 0, /* not initialized */ 234221421Snetchild V4L2_PRIORITY_BACKGROUND = 1, 235221421Snetchild V4L2_PRIORITY_INTERACTIVE = 2, 236221421Snetchild V4L2_PRIORITY_RECORD = 3, 237221421Snetchild V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, 238221421Snetchild}; 239221421Snetchild 240221421Snetchildstruct v4l2_rect { 241221421Snetchild __s32 left; 242221421Snetchild __s32 top; 243221421Snetchild __s32 width; 244221421Snetchild __s32 height; 245221421Snetchild}; 246221421Snetchild 247221421Snetchildstruct v4l2_fract { 248221421Snetchild __u32 numerator; 249221421Snetchild __u32 denominator; 250221421Snetchild}; 251221421Snetchild 252221421Snetchild/* 253221421Snetchild * D R I V E R C A P A B I L I T I E S 254221421Snetchild */ 255221421Snetchildstruct v4l2_capability 256221421Snetchild{ 257221421Snetchild __u8 driver[16]; /* i.e. "bttv" */ 258221421Snetchild __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 259221421Snetchild __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 260221421Snetchild __u32 version; /* should use KERNEL_VERSION() */ 261221421Snetchild __u32 capabilities; /* Device capabilities */ 262221421Snetchild __u32 reserved[4]; 263221421Snetchild}; 264221421Snetchild 265221421Snetchild/* Values for 'capabilities' field */ 266221421Snetchild#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ 267221421Snetchild#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ 268221421Snetchild#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ 269221421Snetchild#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ 270221421Snetchild#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ 271221421Snetchild#if 1 272221421Snetchild#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ 273221421Snetchild#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 274221421Snetchild#endif 275221421Snetchild#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 276221421Snetchild 277221421Snetchild#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 278221421Snetchild#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 279221421Snetchild#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 280221421Snetchild 281221421Snetchild#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 282221421Snetchild#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 283221421Snetchild#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ 284221421Snetchild 285221421Snetchild/* 286221421Snetchild * V I D E O I M A G E F O R M A T 287221421Snetchild */ 288221421Snetchild 289221421Snetchildstruct v4l2_pix_format 290221421Snetchild{ 291221421Snetchild __u32 width; 292221421Snetchild __u32 height; 293221421Snetchild __u32 pixelformat; 294221421Snetchild enum v4l2_field field; 295221421Snetchild __u32 bytesperline; /* for padding, zero if unused */ 296221421Snetchild __u32 sizeimage; 297221421Snetchild enum v4l2_colorspace colorspace; 298221421Snetchild __u32 priv; /* private data, depends on pixelformat */ 299221421Snetchild}; 300221421Snetchild 301221421Snetchild/* Pixel format FOURCC depth Description */ 302221421Snetchild#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 303221421Snetchild#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 304221421Snetchild#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 305221421Snetchild#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ 306221421Snetchild#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ 307221421Snetchild#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ 308221421Snetchild#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ 309221421Snetchild#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ 310221421Snetchild#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 311221421Snetchild#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 312221421Snetchild#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 313221421Snetchild#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ 314221421Snetchild#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ 315221421Snetchild#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ 316221421Snetchild#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ 317221421Snetchild#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ 318221421Snetchild#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ 319221421Snetchild 320221421Snetchild/* two planes -- one Y, one Cr + Cb interleaved */ 321221421Snetchild#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ 322221421Snetchild#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ 323221421Snetchild 324221421Snetchild/* The following formats are not defined in the V4L2 specification */ 325221421Snetchild#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ 326221421Snetchild#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 327221421Snetchild#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 328221421Snetchild#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 329221421Snetchild 330221421Snetchild/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 331221421Snetchild#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 332221421Snetchild 333221421Snetchild/* compressed formats */ 334221421Snetchild#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 335221421Snetchild#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 336221421Snetchild#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 337221421Snetchild#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */ 338221421Snetchild 339221421Snetchild/* Vendor-specific formats */ 340221421Snetchild#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 341221421Snetchild#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ 342221421Snetchild#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ 343221421Snetchild#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ 344221421Snetchild#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ 345221421Snetchild 346221421Snetchild/* 347221421Snetchild * F O R M A T E N U M E R A T I O N 348221421Snetchild */ 349221421Snetchildstruct v4l2_fmtdesc 350221421Snetchild{ 351221421Snetchild __u32 index; /* Format number */ 352221421Snetchild enum v4l2_buf_type type; /* buffer type */ 353221421Snetchild __u32 flags; 354221421Snetchild __u8 description[32]; /* Description string */ 355221421Snetchild __u32 pixelformat; /* Format fourcc */ 356221421Snetchild __u32 reserved[4]; 357221421Snetchild}; 358221421Snetchild 359221421Snetchild#define V4L2_FMT_FLAG_COMPRESSED 0x0001 360221421Snetchild 361221421Snetchild 362221421Snetchild/* 363221421Snetchild * T I M E C O D E 364221421Snetchild */ 365221421Snetchildstruct v4l2_timecode 366221421Snetchild{ 367221421Snetchild __u32 type; 368221421Snetchild __u32 flags; 369221421Snetchild __u8 frames; 370221421Snetchild __u8 seconds; 371221421Snetchild __u8 minutes; 372221421Snetchild __u8 hours; 373221421Snetchild __u8 userbits[4]; 374221421Snetchild}; 375221421Snetchild 376221421Snetchild/* Type */ 377221421Snetchild#define V4L2_TC_TYPE_24FPS 1 378221421Snetchild#define V4L2_TC_TYPE_25FPS 2 379221421Snetchild#define V4L2_TC_TYPE_30FPS 3 380221421Snetchild#define V4L2_TC_TYPE_50FPS 4 381221421Snetchild#define V4L2_TC_TYPE_60FPS 5 382221421Snetchild 383221421Snetchild/* Flags */ 384221421Snetchild#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ 385221421Snetchild#define V4L2_TC_FLAG_COLORFRAME 0x0002 386221421Snetchild#define V4L2_TC_USERBITS_field 0x000C 387221421Snetchild#define V4L2_TC_USERBITS_USERDEFINED 0x0000 388221421Snetchild#define V4L2_TC_USERBITS_8BITCHARS 0x0008 389221421Snetchild/* The above is based on SMPTE timecodes */ 390221421Snetchild 391221421Snetchild 392221421Snetchild/* 393221421Snetchild * M P E G C O M P R E S S I O N P A R A M E T E R S 394221421Snetchild * 395221421Snetchild * ### WARNING: this is still work-in-progress right now, most likely 396221421Snetchild * ### there will be some incompatible changes. 397221421Snetchild * 398221421Snetchild */ 399221421Snetchild 400221421Snetchild 401221421Snetchildenum v4l2_bitrate_mode { 402221421Snetchild V4L2_BITRATE_NONE = 0, /* not specified */ 403221421Snetchild V4L2_BITRATE_CBR, /* constant bitrate */ 404221421Snetchild V4L2_BITRATE_VBR, /* variable bitrate */ 405221421Snetchild}; 406221421Snetchildstruct v4l2_bitrate { 407221421Snetchild /* rates are specified in kbit/sec */ 408221421Snetchild enum v4l2_bitrate_mode mode; 409221421Snetchild __u32 min; 410221421Snetchild __u32 target; /* use this one for CBR */ 411221421Snetchild __u32 max; 412221421Snetchild}; 413221421Snetchild 414221421Snetchildenum v4l2_mpeg_streamtype { 415221421Snetchild V4L2_MPEG_SS_1, /* MPEG-1 system stream */ 416221421Snetchild V4L2_MPEG_PS_2, /* MPEG-2 program stream */ 417221421Snetchild V4L2_MPEG_TS_2, /* MPEG-2 transport stream */ 418221421Snetchild V4L2_MPEG_PS_DVD, /* MPEG-2 program stream with DVD header fixups */ 419221421Snetchild}; 420221421Snetchildenum v4l2_mpeg_audiotype { 421221421Snetchild V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */ 422221421Snetchild V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */ 423221421Snetchild V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */ 424221421Snetchild V4L2_MPEG_AC3, /* AC3 */ 425221421Snetchild V4L2_MPEG_LPCM, /* LPCM */ 426221421Snetchild}; 427221421Snetchildenum v4l2_mpeg_videotype { 428221421Snetchild V4L2_MPEG_VI_1, /* MPEG-1 */ 429221421Snetchild V4L2_MPEG_VI_2, /* MPEG-2 */ 430221421Snetchild}; 431221421Snetchildenum v4l2_mpeg_aspectratio { 432221421Snetchild V4L2_MPEG_ASPECT_SQUARE = 1, /* square pixel */ 433221421Snetchild V4L2_MPEG_ASPECT_4_3 = 2, /* 4 : 3 */ 434221421Snetchild V4L2_MPEG_ASPECT_16_9 = 3, /* 16 : 9 */ 435221421Snetchild V4L2_MPEG_ASPECT_1_221 = 4, /* 1 : 2,21 */ 436221421Snetchild}; 437221421Snetchild 438221421Snetchildstruct v4l2_mpeg_compression { 439221421Snetchild /* general */ 440221421Snetchild enum v4l2_mpeg_streamtype st_type; 441221421Snetchild struct v4l2_bitrate st_bitrate; 442221421Snetchild 443221421Snetchild /* transport streams */ 444221421Snetchild __u16 ts_pid_pmt; 445221421Snetchild __u16 ts_pid_audio; 446221421Snetchild __u16 ts_pid_video; 447221421Snetchild __u16 ts_pid_pcr; 448221421Snetchild 449221421Snetchild /* program stream */ 450221421Snetchild __u16 ps_size; 451221421Snetchild __u16 reserved_1; /* align */ 452221421Snetchild 453221421Snetchild /* audio */ 454221421Snetchild enum v4l2_mpeg_audiotype au_type; 455221421Snetchild struct v4l2_bitrate au_bitrate; 456221421Snetchild __u32 au_sample_rate; 457221421Snetchild __u8 au_pesid; 458221421Snetchild __u8 reserved_2[3]; /* align */ 459221421Snetchild 460221421Snetchild /* video */ 461221421Snetchild enum v4l2_mpeg_videotype vi_type; 462221421Snetchild enum v4l2_mpeg_aspectratio vi_aspect_ratio; 463221421Snetchild struct v4l2_bitrate vi_bitrate; 464221421Snetchild __u32 vi_frame_rate; 465221421Snetchild __u16 vi_frames_per_gop; 466221421Snetchild __u16 vi_bframes_count; 467221421Snetchild __u8 vi_pesid; 468221421Snetchild __u8 reserved_3[3]; /* align */ 469221421Snetchild 470221421Snetchild /* misc flags */ 471221421Snetchild __u32 closed_gops:1; 472221421Snetchild __u32 pulldown:1; 473221421Snetchild __u32 reserved_4:30; /* align */ 474221421Snetchild 475221421Snetchild /* I don't expect the above being perfect yet ;) */ 476221421Snetchild __u32 reserved_5[8]; 477221421Snetchild}; 478221421Snetchild 479221421Snetchildstruct v4l2_jpegcompression 480221421Snetchild{ 481221421Snetchild int quality; 482221421Snetchild 483221421Snetchild int APPn; /* Number of APP segment to be written, 484221421Snetchild * must be 0..15 */ 485221421Snetchild int APP_len; /* Length of data in JPEG APPn segment */ 486221421Snetchild char APP_data[60]; /* Data in the JPEG APPn segment. */ 487221421Snetchild 488221421Snetchild int COM_len; /* Length of data in JPEG COM segment */ 489221421Snetchild char COM_data[60]; /* Data in JPEG COM segment */ 490221421Snetchild 491221421Snetchild __u32 jpeg_markers; /* Which markers should go into the JPEG 492221421Snetchild * output. Unless you exactly know what 493221421Snetchild * you do, leave them untouched. 494221421Snetchild * Inluding less markers will make the 495221421Snetchild * resulting code smaller, but there will 496221421Snetchild * be fewer aplications which can read it. 497221421Snetchild * The presence of the APP and COM marker 498221421Snetchild * is influenced by APP_len and COM_len 499221421Snetchild * ONLY, not by this property! */ 500221421Snetchild 501221421Snetchild#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ 502221421Snetchild#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ 503221421Snetchild#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ 504221421Snetchild#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ 505221421Snetchild#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will 506221421Snetchild * allways use APP0 */ 507221421Snetchild}; 508221421Snetchild 509221421Snetchild 510221421Snetchild/* 511221421Snetchild * M E M O R Y - M A P P I N G B U F F E R S 512221421Snetchild */ 513221421Snetchildstruct v4l2_requestbuffers 514221421Snetchild{ 515221421Snetchild __u32 count; 516221421Snetchild enum v4l2_buf_type type; 517221421Snetchild enum v4l2_memory memory; 518221421Snetchild __u32 reserved[2]; 519221421Snetchild}; 520221421Snetchild 521221421Snetchildstruct v4l2_buffer 522221421Snetchild{ 523221421Snetchild __u32 index; 524221421Snetchild enum v4l2_buf_type type; 525221421Snetchild __u32 bytesused; 526221421Snetchild __u32 flags; 527221421Snetchild enum v4l2_field field; 528221421Snetchild struct timeval timestamp; 529221421Snetchild struct v4l2_timecode timecode; 530221421Snetchild __u32 sequence; 531221421Snetchild 532221421Snetchild /* memory location */ 533221421Snetchild enum v4l2_memory memory; 534221421Snetchild union { 535221421Snetchild __u32 offset; 536221421Snetchild unsigned long userptr; 537221421Snetchild } m; 538221421Snetchild __u32 length; 539221421Snetchild __u32 input; 540221421Snetchild __u32 reserved; 541221421Snetchild}; 542221421Snetchild 543221421Snetchild/* Flags for 'flags' field */ 544221421Snetchild#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ 545221421Snetchild#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ 546221421Snetchild#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ 547221421Snetchild#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 548221421Snetchild#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 549221421Snetchild#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 550221421Snetchild#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 551221421Snetchild#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 552221421Snetchild 553221421Snetchild/* 554221421Snetchild * O V E R L A Y P R E V I E W 555221421Snetchild */ 556221421Snetchildstruct v4l2_framebuffer 557221421Snetchild{ 558221421Snetchild __u32 capability; 559221421Snetchild __u32 flags; 560221421Snetchild/* FIXME: in theory we should pass something like PCI device + memory 561221421Snetchild * region + offset instead of some physical address */ 562221421Snetchild void* base; 563221421Snetchild struct v4l2_pix_format fmt; 564221421Snetchild}; 565221421Snetchild/* Flags for the 'capability' field. Read only */ 566221421Snetchild#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 567221421Snetchild#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 568221421Snetchild#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 569221421Snetchild#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 570221421Snetchild/* Flags for the 'flags' field. */ 571221421Snetchild#define V4L2_FBUF_FLAG_PRIMARY 0x0001 572221421Snetchild#define V4L2_FBUF_FLAG_OVERLAY 0x0002 573221421Snetchild#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 574221421Snetchild 575221421Snetchildstruct v4l2_clip 576221421Snetchild{ 577221421Snetchild struct v4l2_rect c; 578221421Snetchild struct v4l2_clip __user *next; 579221421Snetchild}; 580221421Snetchild 581221421Snetchildstruct v4l2_window 582221421Snetchild{ 583221421Snetchild struct v4l2_rect w; 584221421Snetchild enum v4l2_field field; 585221421Snetchild __u32 chromakey; 586221421Snetchild struct v4l2_clip __user *clips; 587221421Snetchild __u32 clipcount; 588221421Snetchild void __user *bitmap; 589221421Snetchild}; 590221421Snetchild 591221421Snetchild 592221421Snetchild/* 593221421Snetchild * C A P T U R E P A R A M E T E R S 594221421Snetchild */ 595221421Snetchildstruct v4l2_captureparm 596221421Snetchild{ 597221421Snetchild __u32 capability; /* Supported modes */ 598221421Snetchild __u32 capturemode; /* Current mode */ 599221421Snetchild struct v4l2_fract timeperframe; /* Time per frame in .1us units */ 600221421Snetchild __u32 extendedmode; /* Driver-specific extensions */ 601221421Snetchild __u32 readbuffers; /* # of buffers for read */ 602221421Snetchild __u32 reserved[4]; 603221421Snetchild}; 604221421Snetchild/* Flags for 'capability' and 'capturemode' fields */ 605221421Snetchild#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 606221421Snetchild#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 607221421Snetchild 608221421Snetchildstruct v4l2_outputparm 609221421Snetchild{ 610221421Snetchild __u32 capability; /* Supported modes */ 611221421Snetchild __u32 outputmode; /* Current mode */ 612221421Snetchild struct v4l2_fract timeperframe; /* Time per frame in seconds */ 613221421Snetchild __u32 extendedmode; /* Driver-specific extensions */ 614221421Snetchild __u32 writebuffers; /* # of buffers for write */ 615221421Snetchild __u32 reserved[4]; 616221421Snetchild}; 617221421Snetchild 618221421Snetchild/* 619221421Snetchild * I N P U T I M A G E C R O P P I N G 620221421Snetchild */ 621221421Snetchild 622221421Snetchildstruct v4l2_cropcap { 623221421Snetchild enum v4l2_buf_type type; 624221421Snetchild struct v4l2_rect bounds; 625221421Snetchild struct v4l2_rect defrect; 626221421Snetchild struct v4l2_fract pixelaspect; 627221421Snetchild}; 628221421Snetchild 629221421Snetchildstruct v4l2_crop { 630221421Snetchild enum v4l2_buf_type type; 631221421Snetchild struct v4l2_rect c; 632221421Snetchild}; 633221421Snetchild 634221421Snetchild/* 635221421Snetchild * A N A L O G V I D E O S T A N D A R D 636221421Snetchild */ 637221421Snetchild 638221421Snetchildtypedef __u64 v4l2_std_id; 639221421Snetchild 640221421Snetchild/* one bit for each */ 641221421Snetchild#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) 642221421Snetchild#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) 643221421Snetchild#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) 644221421Snetchild#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) 645221421Snetchild#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) 646221421Snetchild#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) 647221421Snetchild#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) 648221421Snetchild#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) 649221421Snetchild 650221421Snetchild#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) 651221421Snetchild#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) 652221421Snetchild#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) 653221421Snetchild#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) 654221421Snetchild 655221421Snetchild#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 656221421Snetchild#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 657221421Snetchild#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) 658221421Snetchild#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) 659221421Snetchild 660221421Snetchild#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 661221421Snetchild#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) 662221421Snetchild#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) 663221421Snetchild#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) 664221421Snetchild#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) 665221421Snetchild#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) 666221421Snetchild#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) 667221421Snetchild#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) 668221421Snetchild 669221421Snetchild/* ATSC/HDTV */ 670221421Snetchild#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 671221421Snetchild#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 672221421Snetchild 673221421Snetchild/* some merged standards */ 674221421Snetchild#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) 675221421Snetchild#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) 676221421Snetchild#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) 677221421Snetchild#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) 678221421Snetchild 679221421Snetchild/* some common needed stuff */ 680221421Snetchild#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ 681221421Snetchild V4L2_STD_PAL_B1 |\ 682221421Snetchild V4L2_STD_PAL_G) 683221421Snetchild#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ 684221421Snetchild V4L2_STD_PAL_D1 |\ 685221421Snetchild V4L2_STD_PAL_K) 686221421Snetchild#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ 687221421Snetchild V4L2_STD_PAL_DK |\ 688221421Snetchild V4L2_STD_PAL_H |\ 689221421Snetchild V4L2_STD_PAL_I) 690221421Snetchild#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ 691221421Snetchild V4L2_STD_NTSC_M_JP |\ 692221421Snetchild V4L2_STD_NTSC_M_KR) 693221421Snetchild#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ 694221421Snetchild V4L2_STD_SECAM_K |\ 695221421Snetchild V4L2_STD_SECAM_K1) 696221421Snetchild#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ 697221421Snetchild V4L2_STD_SECAM_G |\ 698221421Snetchild V4L2_STD_SECAM_H |\ 699221421Snetchild V4L2_STD_SECAM_DK |\ 700221421Snetchild V4L2_STD_SECAM_L |\ 701221421Snetchild V4L2_STD_SECAM_LC) 702221421Snetchild 703221421Snetchild#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ 704221421Snetchild V4L2_STD_PAL_60 |\ 705221421Snetchild V4L2_STD_NTSC |\ 706221421Snetchild V4L2_STD_NTSC_443) 707221421Snetchild#define V4L2_STD_625_50 (V4L2_STD_PAL |\ 708221421Snetchild V4L2_STD_PAL_N |\ 709221421Snetchild V4L2_STD_PAL_Nc |\ 710221421Snetchild V4L2_STD_SECAM) 711221421Snetchild#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ 712221421Snetchild V4L2_STD_ATSC_16_VSB) 713221421Snetchild 714221421Snetchild#define V4L2_STD_UNKNOWN 0 715221421Snetchild#define V4L2_STD_ALL (V4L2_STD_525_60 |\ 716221421Snetchild V4L2_STD_625_50) 717221421Snetchild 718221421Snetchildstruct v4l2_standard 719221421Snetchild{ 720221421Snetchild __u32 index; 721221421Snetchild v4l2_std_id id; 722221421Snetchild __u8 name[24]; 723221421Snetchild struct v4l2_fract frameperiod; /* Frames, not fields */ 724221421Snetchild __u32 framelines; 725221421Snetchild __u32 reserved[4]; 726221421Snetchild}; 727221421Snetchild 728221421Snetchild 729221421Snetchild/* 730221421Snetchild * V I D E O I N P U T S 731221421Snetchild */ 732221421Snetchildstruct v4l2_input 733221421Snetchild{ 734221421Snetchild __u32 index; /* Which input */ 735221421Snetchild __u8 name[32]; /* Label */ 736221421Snetchild __u32 type; /* Type of input */ 737221421Snetchild __u32 audioset; /* Associated audios (bitfield) */ 738221421Snetchild __u32 tuner; /* Associated tuner */ 739221421Snetchild v4l2_std_id std; 740221421Snetchild __u32 status; 741221421Snetchild __u32 reserved[4]; 742221421Snetchild}; 743221421Snetchild/* Values for the 'type' field */ 744221421Snetchild#define V4L2_INPUT_TYPE_TUNER 1 745221421Snetchild#define V4L2_INPUT_TYPE_CAMERA 2 746221421Snetchild 747221421Snetchild/* field 'status' - general */ 748221421Snetchild#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ 749221421Snetchild#define V4L2_IN_ST_NO_SIGNAL 0x00000002 750221421Snetchild#define V4L2_IN_ST_NO_COLOR 0x00000004 751221421Snetchild 752221421Snetchild/* field 'status' - analog */ 753221421Snetchild#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ 754221421Snetchild#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ 755221421Snetchild 756221421Snetchild/* field 'status' - digital */ 757221421Snetchild#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ 758221421Snetchild#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ 759221421Snetchild#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ 760221421Snetchild 761221421Snetchild/* field 'status' - VCR and set-top box */ 762221421Snetchild#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ 763221421Snetchild#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ 764221421Snetchild#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ 765221421Snetchild 766221421Snetchild/* 767221421Snetchild * V I D E O O U T P U T S 768221421Snetchild */ 769221421Snetchildstruct v4l2_output 770221421Snetchild{ 771221421Snetchild __u32 index; /* Which output */ 772221421Snetchild __u8 name[32]; /* Label */ 773221421Snetchild __u32 type; /* Type of output */ 774221421Snetchild __u32 audioset; /* Associated audios (bitfield) */ 775221421Snetchild __u32 modulator; /* Associated modulator */ 776221421Snetchild v4l2_std_id std; 777221421Snetchild __u32 reserved[4]; 778221421Snetchild}; 779221421Snetchild/* Values for the 'type' field */ 780221421Snetchild#define V4L2_OUTPUT_TYPE_MODULATOR 1 781221421Snetchild#define V4L2_OUTPUT_TYPE_ANALOG 2 782221421Snetchild#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 783221421Snetchild 784221421Snetchild/* 785221421Snetchild * C O N T R O L S 786221421Snetchild */ 787221421Snetchildstruct v4l2_control 788221421Snetchild{ 789221421Snetchild __u32 id; 790221421Snetchild __s32 value; 791221421Snetchild}; 792221421Snetchild 793221421Snetchild/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 794221421Snetchildstruct v4l2_queryctrl 795221421Snetchild{ 796221421Snetchild __u32 id; 797221421Snetchild enum v4l2_ctrl_type type; 798221421Snetchild __u8 name[32]; /* Whatever */ 799221421Snetchild __s32 minimum; /* Note signedness */ 800221421Snetchild __s32 maximum; 801221421Snetchild __s32 step; 802221421Snetchild __s32 default_value; 803221421Snetchild __u32 flags; 804221421Snetchild __u32 reserved[2]; 805221421Snetchild}; 806221421Snetchild 807221421Snetchild/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ 808221421Snetchildstruct v4l2_querymenu 809221421Snetchild{ 810221421Snetchild __u32 id; 811221421Snetchild __u32 index; 812221421Snetchild __u8 name[32]; /* Whatever */ 813221421Snetchild __u32 reserved; 814221421Snetchild}; 815221421Snetchild 816221421Snetchild/* Control flags */ 817221421Snetchild#define V4L2_CTRL_FLAG_DISABLED 0x0001 818221421Snetchild#define V4L2_CTRL_FLAG_GRABBED 0x0002 819221421Snetchild 820221421Snetchild/* Control IDs defined by V4L2 */ 821221421Snetchild#define V4L2_CID_BASE 0x00980900 822221421Snetchild/* IDs reserved for driver specific controls */ 823221421Snetchild#define V4L2_CID_PRIVATE_BASE 0x08000000 824221421Snetchild 825221421Snetchild#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) 826221421Snetchild#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) 827221421Snetchild#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) 828221421Snetchild#define V4L2_CID_HUE (V4L2_CID_BASE+3) 829221421Snetchild#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) 830221421Snetchild#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) 831221421Snetchild#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) 832221421Snetchild#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) 833221421Snetchild#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) 834221421Snetchild#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) 835221421Snetchild#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) 836221421Snetchild#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) 837221421Snetchild#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) 838221421Snetchild#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) 839221421Snetchild#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) 840221421Snetchild#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) 841221421Snetchild#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */ 842221421Snetchild#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) 843221421Snetchild#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) 844221421Snetchild#define V4L2_CID_GAIN (V4L2_CID_BASE+19) 845221421Snetchild#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) 846221421Snetchild#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) 847221421Snetchild#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) 848221421Snetchild#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) 849221421Snetchild#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ 850221421Snetchild 851221421Snetchild/* 852221421Snetchild * T U N I N G 853221421Snetchild */ 854221421Snetchildstruct v4l2_tuner 855221421Snetchild{ 856221421Snetchild __u32 index; 857221421Snetchild __u8 name[32]; 858221421Snetchild enum v4l2_tuner_type type; 859221421Snetchild __u32 capability; 860221421Snetchild __u32 rangelow; 861221421Snetchild __u32 rangehigh; 862221421Snetchild __u32 rxsubchans; 863221421Snetchild __u32 audmode; 864221421Snetchild __s32 signal; 865221421Snetchild __s32 afc; 866221421Snetchild __u32 reserved[4]; 867221421Snetchild}; 868221421Snetchild 869221421Snetchildstruct v4l2_modulator 870221421Snetchild{ 871221421Snetchild __u32 index; 872221421Snetchild __u8 name[32]; 873221421Snetchild __u32 capability; 874221421Snetchild __u32 rangelow; 875221421Snetchild __u32 rangehigh; 876221421Snetchild __u32 txsubchans; 877221421Snetchild __u32 reserved[4]; 878221421Snetchild}; 879221421Snetchild 880221421Snetchild/* Flags for the 'capability' field */ 881221421Snetchild#define V4L2_TUNER_CAP_LOW 0x0001 882221421Snetchild#define V4L2_TUNER_CAP_NORM 0x0002 883221421Snetchild#define V4L2_TUNER_CAP_STEREO 0x0010 884221421Snetchild#define V4L2_TUNER_CAP_LANG2 0x0020 885221421Snetchild#define V4L2_TUNER_CAP_SAP 0x0020 886221421Snetchild#define V4L2_TUNER_CAP_LANG1 0x0040 887221421Snetchild 888221421Snetchild/* Flags for the 'rxsubchans' field */ 889221421Snetchild#define V4L2_TUNER_SUB_MONO 0x0001 890221421Snetchild#define V4L2_TUNER_SUB_STEREO 0x0002 891221421Snetchild#define V4L2_TUNER_SUB_LANG2 0x0004 892221421Snetchild#define V4L2_TUNER_SUB_SAP 0x0004 893221421Snetchild#define V4L2_TUNER_SUB_LANG1 0x0008 894221421Snetchild 895221421Snetchild/* Values for the 'audmode' field */ 896221421Snetchild#define V4L2_TUNER_MODE_MONO 0x0000 897221421Snetchild#define V4L2_TUNER_MODE_STEREO 0x0001 898221421Snetchild#define V4L2_TUNER_MODE_LANG2 0x0002 899221421Snetchild#define V4L2_TUNER_MODE_SAP 0x0002 900221421Snetchild#define V4L2_TUNER_MODE_LANG1 0x0003 901221421Snetchild#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 902221421Snetchild 903221421Snetchildstruct v4l2_frequency 904221421Snetchild{ 905221421Snetchild __u32 tuner; 906221421Snetchild enum v4l2_tuner_type type; 907221421Snetchild __u32 frequency; 908221421Snetchild __u32 reserved[8]; 909221421Snetchild}; 910221421Snetchild 911221421Snetchild/* 912221421Snetchild * A U D I O 913221421Snetchild */ 914221421Snetchildstruct v4l2_audio 915221421Snetchild{ 916221421Snetchild __u32 index; 917221421Snetchild __u8 name[32]; 918221421Snetchild __u32 capability; 919221421Snetchild __u32 mode; 920221421Snetchild __u32 reserved[2]; 921221421Snetchild}; 922221421Snetchild/* Flags for the 'capability' field */ 923221421Snetchild#define V4L2_AUDCAP_STEREO 0x00001 924221421Snetchild#define V4L2_AUDCAP_AVL 0x00002 925221421Snetchild 926221421Snetchild/* Flags for the 'mode' field */ 927221421Snetchild#define V4L2_AUDMODE_AVL 0x00001 928221421Snetchild 929221421Snetchildstruct v4l2_audioout 930221421Snetchild{ 931221421Snetchild __u32 index; 932221421Snetchild __u8 name[32]; 933221421Snetchild __u32 capability; 934221421Snetchild __u32 mode; 935221421Snetchild __u32 reserved[2]; 936221421Snetchild}; 937221421Snetchild 938221421Snetchild/* 939221421Snetchild * D A T A S E R V I C E S ( V B I ) 940221421Snetchild * 941221421Snetchild * Data services API by Michael Schimek 942221421Snetchild */ 943221421Snetchild 944221421Snetchild/* Raw VBI */ 945221421Snetchild 946221421Snetchildstruct v4l2_vbi_format 947221421Snetchild{ 948221421Snetchild __u32 sampling_rate; /* in 1 Hz */ 949221421Snetchild __u32 offset; 950221421Snetchild __u32 samples_per_line; 951221421Snetchild __u32 sample_format; /* V4L2_PIX_FMT_* */ 952221421Snetchild __s32 start[2]; 953221421Snetchild __u32 count[2]; 954221421Snetchild __u32 flags; /* V4L2_VBI_* */ 955221421Snetchild __u32 reserved[2]; /* must be zero */ 956221421Snetchild}; 957221421Snetchild 958221421Snetchild/* VBI flags */ 959221421Snetchild#define V4L2_VBI_UNSYNC (1<< 0) 960221421Snetchild#define V4L2_VBI_INTERLACED (1<< 1) 961221421Snetchild 962221421Snetchild#if 1 963221421Snetchild/* Sliced VBI 964221421Snetchild * 965221421Snetchild * This implements is a proposal V4L2 API to allow SLICED VBI 966221421Snetchild * required for some hardware encoders. It should change without 967221421Snetchild * notice in the definitive implementation. 968221421Snetchild */ 969221421Snetchild 970221421Snetchildstruct v4l2_sliced_vbi_format 971221421Snetchild{ 972221421Snetchild __u16 service_set; 973221421Snetchild /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 974221421Snetchild service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 975221421Snetchild (equals frame lines 313-336 for 625 line video 976221421Snetchild standards, 263-286 for 525 line standards) */ 977221421Snetchild __u16 service_lines[2][24]; 978221421Snetchild __u32 io_size; 979221421Snetchild __u32 reserved[2]; /* must be zero */ 980221421Snetchild}; 981221421Snetchild 982221421Snetchild/* Teletext World System Teletext 983221421Snetchild (WST), defined on ITU-R BT.653-2 */ 984221421Snetchild#define V4L2_SLICED_TELETEXT_B (0x0001) 985221421Snetchild/* Video Program System, defined on ETS 300 231*/ 986221421Snetchild#define V4L2_SLICED_VPS (0x0400) 987221421Snetchild/* Closed Caption, defined on EIA-608 */ 988221421Snetchild#define V4L2_SLICED_CAPTION_525 (0x1000) 989221421Snetchild/* Wide Screen System, defined on ITU-R BT1119.1 */ 990221421Snetchild#define V4L2_SLICED_WSS_625 (0x4000) 991221421Snetchild 992221421Snetchild#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 993221421Snetchild#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 994221421Snetchild 995221421Snetchild 996221421Snetchildstruct v4l2_sliced_vbi_cap 997221421Snetchild{ 998221421Snetchild __u16 service_set; 999221421Snetchild /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1000221421Snetchild service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1001221421Snetchild (equals frame lines 313-336 for 625 line video 1002221421Snetchild standards, 263-286 for 525 line standards) */ 1003221421Snetchild __u16 service_lines[2][24]; 1004221421Snetchild __u32 reserved[4]; /* must be 0 */ 1005221421Snetchild}; 1006221421Snetchild 1007221421Snetchildstruct v4l2_sliced_vbi_data 1008221421Snetchild{ 1009221421Snetchild __u32 id; 1010221421Snetchild __u32 field; /* 0: first field, 1: second field */ 1011221421Snetchild __u32 line; /* 1-23 */ 1012221421Snetchild __u32 reserved; /* must be 0 */ 1013221421Snetchild __u8 data[48]; 1014221421Snetchild}; 1015221421Snetchild#endif 1016221421Snetchild 1017221421Snetchild/* 1018221421Snetchild * A G G R E G A T E S T R U C T U R E S 1019221421Snetchild */ 1020221421Snetchild 1021221421Snetchild/* Stream data format 1022221421Snetchild */ 1023221421Snetchildstruct v4l2_format 1024221421Snetchild{ 1025221421Snetchild enum v4l2_buf_type type; 1026221421Snetchild union 1027221421Snetchild { 1028221421Snetchild struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 1029221421Snetchild struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 1030221421Snetchild struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 1031221421Snetchild#if 1 1032221421Snetchild struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 1033221421Snetchild#endif 1034221421Snetchild __u8 raw_data[200]; // user-defined 1035221421Snetchild } fmt; 1036221421Snetchild}; 1037221421Snetchild 1038221421Snetchild 1039221421Snetchild/* Stream type-dependent parameters 1040221421Snetchild */ 1041221421Snetchildstruct v4l2_streamparm 1042221421Snetchild{ 1043221421Snetchild enum v4l2_buf_type type; 1044221421Snetchild union 1045221421Snetchild { 1046221421Snetchild struct v4l2_captureparm capture; 1047221421Snetchild struct v4l2_outputparm output; 1048221421Snetchild __u8 raw_data[200]; /* user-defined */ 1049221421Snetchild } parm; 1050221421Snetchild}; 1051221421Snetchild 1052221421Snetchild 1053221421Snetchild 1054221421Snetchild/* 1055221421Snetchild * 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 1056221421Snetchild * 1057221421Snetchild */ 1058221421Snetchild#define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) 1059221421Snetchild#define VIDIOC_RESERVED _IO ('V', 1) 1060221421Snetchild#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1061221421Snetchild#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1062221421Snetchild#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1063221421Snetchild#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) 1064221421Snetchild#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) 1065221421Snetchild#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1066221421Snetchild#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1067221421Snetchild#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1068221421Snetchild#define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) 1069221421Snetchild#define VIDIOC_OVERLAY _IOW ('V', 14, int) 1070221421Snetchild#define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) 1071221421Snetchild#define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) 1072221421Snetchild#define VIDIOC_STREAMON _IOW ('V', 18, int) 1073221421Snetchild#define VIDIOC_STREAMOFF _IOW ('V', 19, int) 1074221421Snetchild#define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) 1075221421Snetchild#define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) 1076221421Snetchild#define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) 1077221421Snetchild#define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) 1078221421Snetchild#define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) 1079221421Snetchild#define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) 1080221421Snetchild#define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) 1081221421Snetchild#define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) 1082221421Snetchild#define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) 1083221421Snetchild#define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) 1084221421Snetchild#define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) 1085221421Snetchild#define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) 1086221421Snetchild#define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) 1087221421Snetchild#define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) 1088221421Snetchild#define VIDIOC_G_INPUT _IOR ('V', 38, int) 1089221421Snetchild#define VIDIOC_S_INPUT _IOWR ('V', 39, int) 1090221421Snetchild#define VIDIOC_G_OUTPUT _IOR ('V', 46, int) 1091221421Snetchild#define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) 1092221421Snetchild#define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) 1093221421Snetchild#define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) 1094221421Snetchild#define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) 1095221421Snetchild#define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) 1096221421Snetchild#define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) 1097221421Snetchild#define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) 1098221421Snetchild#define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) 1099221421Snetchild#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) 1100221421Snetchild#define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) 1101221421Snetchild#define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) 1102221421Snetchild#define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) 1103221421Snetchild#define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) 1104221421Snetchild#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) 1105221421Snetchild#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) 1106221421Snetchild#define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) 1107221421Snetchild#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) 1108221421Snetchild#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1109221421Snetchild#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1110221421Snetchild#if 1 1111221421Snetchild#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1112221421Snetchild#endif 1113221421Snetchild#define VIDIOC_LOG_STATUS _IO ('V', 70) 1114221421Snetchild 1115221421Snetchild/* for compatibility, will go away some day */ 1116221421Snetchild#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1117221421Snetchild#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1118221421Snetchild#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) 1119221421Snetchild#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1120221421Snetchild#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1121221421Snetchild#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1122221421Snetchild 1123221421Snetchild#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1124221421Snetchild 1125221421Snetchild 1126221421Snetchild#ifdef __KERNEL__ 1127221421Snetchild/* 1128221421Snetchild * 1129221421Snetchild * V 4 L 2 D R I V E R H E L P E R A P I 1130221421Snetchild * 1131221421Snetchild * Some commonly needed functions for drivers (v4l2-common.o module) 1132221421Snetchild */ 1133221421Snetchild#include <linux/fs.h> 1134221421Snetchild 1135221421Snetchild/* Video standard functions */ 1136221421Snetchildextern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs); 1137221421Snetchildextern int v4l2_video_std_construct(struct v4l2_standard *vs, 1138221421Snetchild int id, char *name); 1139221421Snetchild 1140221421Snetchild/* prority handling */ 1141221421Snetchildstruct v4l2_prio_state { 1142221421Snetchild atomic_t prios[4]; 1143221421Snetchild}; 1144221421Snetchildint v4l2_prio_init(struct v4l2_prio_state *global); 1145221421Snetchildint v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 1146221421Snetchild enum v4l2_priority new); 1147221421Snetchildint v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); 1148221421Snetchildint v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); 1149221421Snetchildenum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); 1150221421Snetchildint v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); 1151221421Snetchild 1152221421Snetchild/* names for fancy debug output */ 1153221421Snetchildextern char *v4l2_field_names[]; 1154221421Snetchildextern char *v4l2_type_names[]; 1155221421Snetchild 1156221421Snetchild/* Compatibility layer interface -- v4l1-compat module */ 1157221421Snetchildtypedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 1158221421Snetchild unsigned int cmd, void *arg); 1159221421Snetchild 1160221421Snetchild#ifdef CONFIG_VIDEO_V4L1_COMPAT 1161221421Snetchildint v4l_compat_translate_ioctl(struct inode *inode, struct file *file, 1162221421Snetchild int cmd, void *arg, v4l2_kioctl driver_ioctl); 1163221421Snetchild#else 1164221421Snetchild#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL 1165221421Snetchild#endif 1166221421Snetchild 1167221421Snetchild/* 32 Bits compatibility layer for 64 bits processors */ 1168221421Snetchildextern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, 1169221421Snetchild unsigned long arg); 1170221421Snetchild 1171221421Snetchild 1172221421Snetchild#endif /* __KERNEL__ */ 1173221421Snetchild#endif /* __LINUX_VIDEODEV2_H */ 1174221421Snetchild 1175221421Snetchild/* 1176221421Snetchild * Local variables: 1177221421Snetchild * c-basic-offset: 8 1178221421Snetchild * End: 1179221421Snetchild */ 1180