videodev2.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. #ifndef __LINUX_VIDEODEV2_H
  2. #define __LINUX_VIDEODEV2_H
  3. /*
  4. * Video for Linux Two
  5. *
  6. * Header file for v4l or V4L2 drivers and applications, for
  7. * Linux kernels 2.2.x or 2.4.x.
  8. *
  9. * See http://bytesex.org/v4l/ for API specs and other
  10. * v4l2 documentation.
  11. *
  12. * Author: Bill Dirks <bdirks@pacbell.net>
  13. * Justin Schoeman
  14. * et al.
  15. */
  16. #ifdef __KERNEL__
  17. #include <linux/time.h> /* need struct timeval */
  18. #include <linux/poll.h>
  19. #include <linux/device.h>
  20. #endif
  21. #include <linux/compiler.h> /* need __user */
  22. #define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */
  23. #define HAVE_V4L2 1
  24. /*
  25. * Common stuff for both V4L1 and V4L2
  26. * Moved from videodev.h
  27. */
  28. #define VIDEO_MAX_FRAME 32
  29. #define VID_TYPE_CAPTURE 1 /* Can capture */
  30. #define VID_TYPE_TUNER 2 /* Can tune */
  31. #define VID_TYPE_TELETEXT 4 /* Does teletext */
  32. #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
  33. #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
  34. #define VID_TYPE_CLIPPING 32 /* Can clip */
  35. #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
  36. #define VID_TYPE_SCALES 128 /* Scalable */
  37. #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
  38. #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
  39. #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
  40. #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
  41. #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
  42. #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
  43. #ifdef __KERNEL__
  44. #define VFL_TYPE_GRABBER 0
  45. #define VFL_TYPE_VBI 1
  46. #define VFL_TYPE_RADIO 2
  47. #define VFL_TYPE_VTX 3
  48. struct video_device
  49. {
  50. /* device info */
  51. struct device *dev;
  52. char name[32];
  53. int type; /* v4l1 */
  54. int type2; /* v4l2 */
  55. int hardware;
  56. int minor;
  57. /* device ops + callbacks */
  58. struct file_operations *fops;
  59. void (*release)(struct video_device *vfd);
  60. #if OBSOLETE_OWNER /* to be removed in 2.6.15 */
  61. /* obsolete -- fops->owner is used instead */
  62. struct module *owner;
  63. /* dev->driver_data will be used instead some day.
  64. * Use the video_{get|set}_drvdata() helper functions,
  65. * so the switch over will be transparent for you.
  66. * Or use {pci|usb}_{get|set}_drvdata() directly. */
  67. void *priv;
  68. #endif
  69. /* for videodev.c intenal usage -- please don't touch */
  70. int users; /* video_exclusive_{open|close} ... */
  71. struct semaphore lock; /* ... helper function uses these */
  72. char devfs_name[64]; /* devfs */
  73. struct class_device class_dev; /* sysfs */
  74. };
  75. #define VIDEO_MAJOR 81
  76. extern int video_register_device(struct video_device *, int type, int nr);
  77. extern void video_unregister_device(struct video_device *);
  78. extern int video_usercopy(struct inode *inode, struct file *file,
  79. unsigned int cmd, unsigned long arg,
  80. int (*func)(struct inode *inode, struct file *file,
  81. unsigned int cmd, void *arg));
  82. /* helper functions to alloc / release struct video_device, the
  83. later can be used for video_device->release() */
  84. struct video_device *video_device_alloc(void);
  85. void video_device_release(struct video_device *vfd);
  86. #endif
  87. /*
  88. * M I S C E L L A N E O U S
  89. */
  90. /* Four-character-code (FOURCC) */
  91. #define v4l2_fourcc(a,b,c,d)\
  92. (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
  93. /*
  94. * E N U M S
  95. */
  96. enum v4l2_field {
  97. V4L2_FIELD_ANY = 0, /* driver can choose from none,
  98. top, bottom, interlaced
  99. depending on whatever it thinks
  100. is approximate ... */
  101. V4L2_FIELD_NONE = 1, /* this device has no fields ... */
  102. V4L2_FIELD_TOP = 2, /* top field only */
  103. V4L2_FIELD_BOTTOM = 3, /* bottom field only */
  104. V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
  105. V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
  106. buffer, top-bottom order */
  107. V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
  108. V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
  109. separate buffers */
  110. };
  111. #define V4L2_FIELD_HAS_TOP(field) \
  112. ((field) == V4L2_FIELD_TOP ||\
  113. (field) == V4L2_FIELD_INTERLACED ||\
  114. (field) == V4L2_FIELD_SEQ_TB ||\
  115. (field) == V4L2_FIELD_SEQ_BT)
  116. #define V4L2_FIELD_HAS_BOTTOM(field) \
  117. ((field) == V4L2_FIELD_BOTTOM ||\
  118. (field) == V4L2_FIELD_INTERLACED ||\
  119. (field) == V4L2_FIELD_SEQ_TB ||\
  120. (field) == V4L2_FIELD_SEQ_BT)
  121. #define V4L2_FIELD_HAS_BOTH(field) \
  122. ((field) == V4L2_FIELD_INTERLACED ||\
  123. (field) == V4L2_FIELD_SEQ_TB ||\
  124. (field) == V4L2_FIELD_SEQ_BT)
  125. enum v4l2_buf_type {
  126. V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
  127. V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
  128. V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
  129. V4L2_BUF_TYPE_VBI_CAPTURE = 4,
  130. V4L2_BUF_TYPE_VBI_OUTPUT = 5,
  131. #if 1
  132. /* Experimental Sliced VBI */
  133. V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
  134. V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
  135. #endif
  136. V4L2_BUF_TYPE_PRIVATE = 0x80,
  137. };
  138. enum v4l2_ctrl_type {
  139. V4L2_CTRL_TYPE_INTEGER = 1,
  140. V4L2_CTRL_TYPE_BOOLEAN = 2,
  141. V4L2_CTRL_TYPE_MENU = 3,
  142. V4L2_CTRL_TYPE_BUTTON = 4,
  143. };
  144. enum v4l2_tuner_type {
  145. V4L2_TUNER_RADIO = 1,
  146. V4L2_TUNER_ANALOG_TV = 2,
  147. V4L2_TUNER_DIGITAL_TV = 3,
  148. };
  149. enum v4l2_memory {
  150. V4L2_MEMORY_MMAP = 1,
  151. V4L2_MEMORY_USERPTR = 2,
  152. V4L2_MEMORY_OVERLAY = 3,
  153. };
  154. /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
  155. enum v4l2_colorspace {
  156. /* ITU-R 601 -- broadcast NTSC/PAL */
  157. V4L2_COLORSPACE_SMPTE170M = 1,
  158. /* 1125-Line (US) HDTV */
  159. V4L2_COLORSPACE_SMPTE240M = 2,
  160. /* HD and modern captures. */
  161. V4L2_COLORSPACE_REC709 = 3,
  162. /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
  163. V4L2_COLORSPACE_BT878 = 4,
  164. /* These should be useful. Assume 601 extents. */
  165. V4L2_COLORSPACE_470_SYSTEM_M = 5,
  166. V4L2_COLORSPACE_470_SYSTEM_BG = 6,
  167. /* I know there will be cameras that send this. So, this is
  168. * unspecified chromaticities and full 0-255 on each of the
  169. * Y'CbCr components
  170. */
  171. V4L2_COLORSPACE_JPEG = 7,
  172. /* For RGB colourspaces, this is probably a good start. */
  173. V4L2_COLORSPACE_SRGB = 8,
  174. };
  175. enum v4l2_priority {
  176. V4L2_PRIORITY_UNSET = 0, /* not initialized */
  177. V4L2_PRIORITY_BACKGROUND = 1,
  178. V4L2_PRIORITY_INTERACTIVE = 2,
  179. V4L2_PRIORITY_RECORD = 3,
  180. V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
  181. };
  182. struct v4l2_rect {
  183. __s32 left;
  184. __s32 top;
  185. __s32 width;
  186. __s32 height;
  187. };
  188. struct v4l2_fract {
  189. __u32 numerator;
  190. __u32 denominator;
  191. };
  192. /*
  193. * D R I V E R C A P A B I L I T I E S
  194. */
  195. struct v4l2_capability
  196. {
  197. __u8 driver[16]; /* i.e. "bttv" */
  198. __u8 card[32]; /* i.e. "Hauppauge WinTV" */
  199. __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
  200. __u32 version; /* should use KERNEL_VERSION() */
  201. __u32 capabilities; /* Device capabilities */
  202. __u32 reserved[4];
  203. };
  204. /* Values for 'capabilities' field */
  205. #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
  206. #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
  207. #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
  208. #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
  209. #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
  210. #if 1
  211. #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
  212. #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
  213. #endif
  214. #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
  215. #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
  216. #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
  217. #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
  218. #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
  219. #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
  220. #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
  221. /*
  222. * V I D E O I M A G E F O R M A T
  223. */
  224. struct v4l2_pix_format
  225. {
  226. __u32 width;
  227. __u32 height;
  228. __u32 pixelformat;
  229. enum v4l2_field field;
  230. __u32 bytesperline; /* for padding, zero if unused */
  231. __u32 sizeimage;
  232. enum v4l2_colorspace colorspace;
  233. __u32 priv; /* private data, depends on pixelformat */
  234. };
  235. /* Pixel format FOURCC depth Description */
  236. #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */
  237. #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */
  238. #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */
  239. #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */
  240. #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */
  241. #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */
  242. #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */
  243. #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */
  244. #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */
  245. #define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */
  246. #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */
  247. #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
  248. #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */
  249. #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */
  250. #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */
  251. #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */
  252. #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */
  253. /* two planes -- one Y, one Cr + Cb interleaved */
  254. #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */
  255. #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */
  256. /* The following formats are not defined in the V4L2 specification */
  257. #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */
  258. #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */
  259. #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
  260. #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
  261. /* see http://www.siliconimaging.com/RGB%20Bayer.htm */
  262. #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
  263. /* compressed formats */
  264. #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */
  265. #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */
  266. #define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */
  267. #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */
  268. /* Vendor-specific formats */
  269. #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
  270. #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */
  271. #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */
  272. #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */
  273. #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */
  274. /*
  275. * F O R M A T E N U M E R A T I O N
  276. */
  277. struct v4l2_fmtdesc
  278. {
  279. __u32 index; /* Format number */
  280. enum v4l2_buf_type type; /* buffer type */
  281. __u32 flags;
  282. __u8 description[32]; /* Description string */
  283. __u32 pixelformat; /* Format fourcc */
  284. __u32 reserved[4];
  285. };
  286. #define V4L2_FMT_FLAG_COMPRESSED 0x0001
  287. /*
  288. * T I M E C O D E
  289. */
  290. struct v4l2_timecode
  291. {
  292. __u32 type;
  293. __u32 flags;
  294. __u8 frames;
  295. __u8 seconds;
  296. __u8 minutes;
  297. __u8 hours;
  298. __u8 userbits[4];
  299. };
  300. /* Type */
  301. #define V4L2_TC_TYPE_24FPS 1
  302. #define V4L2_TC_TYPE_25FPS 2
  303. #define V4L2_TC_TYPE_30FPS 3
  304. #define V4L2_TC_TYPE_50FPS 4
  305. #define V4L2_TC_TYPE_60FPS 5
  306. /* Flags */
  307. #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
  308. #define V4L2_TC_FLAG_COLORFRAME 0x0002
  309. #define V4L2_TC_USERBITS_field 0x000C
  310. #define V4L2_TC_USERBITS_USERDEFINED 0x0000
  311. #define V4L2_TC_USERBITS_8BITCHARS 0x0008
  312. /* The above is based on SMPTE timecodes */
  313. /*
  314. * 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
  315. *
  316. * ### WARNING: this is still work-in-progress right now, most likely
  317. * ### there will be some incompatible changes.
  318. *
  319. */
  320. enum v4l2_bitrate_mode {
  321. V4L2_BITRATE_NONE = 0, /* not specified */
  322. V4L2_BITRATE_CBR, /* constant bitrate */
  323. V4L2_BITRATE_VBR, /* variable bitrate */
  324. };
  325. struct v4l2_bitrate {
  326. /* rates are specified in kbit/sec */
  327. enum v4l2_bitrate_mode mode;
  328. __u32 min;
  329. __u32 target; /* use this one for CBR */
  330. __u32 max;
  331. };
  332. enum v4l2_mpeg_streamtype {
  333. V4L2_MPEG_SS_1, /* MPEG-1 system stream */
  334. V4L2_MPEG_PS_2, /* MPEG-2 program stream */
  335. V4L2_MPEG_TS_2, /* MPEG-2 transport stream */
  336. V4L2_MPEG_PS_DVD, /* MPEG-2 program stream with DVD header fixups */
  337. };
  338. enum v4l2_mpeg_audiotype {
  339. V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */
  340. V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */
  341. V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */
  342. V4L2_MPEG_AC3, /* AC3 */
  343. V4L2_MPEG_LPCM, /* LPCM */
  344. };
  345. enum v4l2_mpeg_videotype {
  346. V4L2_MPEG_VI_1, /* MPEG-1 */
  347. V4L2_MPEG_VI_2, /* MPEG-2 */
  348. };
  349. enum v4l2_mpeg_aspectratio {
  350. V4L2_MPEG_ASPECT_SQUARE = 1, /* square pixel */
  351. V4L2_MPEG_ASPECT_4_3 = 2, /* 4 : 3 */
  352. V4L2_MPEG_ASPECT_16_9 = 3, /* 16 : 9 */
  353. V4L2_MPEG_ASPECT_1_221 = 4, /* 1 : 2,21 */
  354. };
  355. struct v4l2_mpeg_compression {
  356. /* general */
  357. enum v4l2_mpeg_streamtype st_type;
  358. struct v4l2_bitrate st_bitrate;
  359. /* transport streams */
  360. __u16 ts_pid_pmt;
  361. __u16 ts_pid_audio;
  362. __u16 ts_pid_video;
  363. __u16 ts_pid_pcr;
  364. /* program stream */
  365. __u16 ps_size;
  366. __u16 reserved_1; /* align */
  367. /* audio */
  368. enum v4l2_mpeg_audiotype au_type;
  369. struct v4l2_bitrate au_bitrate;
  370. __u32 au_sample_rate;
  371. __u8 au_pesid;
  372. __u8 reserved_2[3]; /* align */
  373. /* video */
  374. enum v4l2_mpeg_videotype vi_type;
  375. enum v4l2_mpeg_aspectratio vi_aspect_ratio;
  376. struct v4l2_bitrate vi_bitrate;
  377. __u32 vi_frame_rate;
  378. __u16 vi_frames_per_gop;
  379. __u16 vi_bframes_count;
  380. __u8 vi_pesid;
  381. __u8 reserved_3[3]; /* align */
  382. /* misc flags */
  383. __u32 closed_gops:1;
  384. __u32 pulldown:1;
  385. __u32 reserved_4:30; /* align */
  386. /* I don't expect the above being perfect yet ;) */
  387. __u32 reserved_5[8];
  388. };
  389. struct v4l2_jpegcompression
  390. {
  391. int quality;
  392. int APPn; /* Number of APP segment to be written,
  393. * must be 0..15 */
  394. int APP_len; /* Length of data in JPEG APPn segment */
  395. char APP_data[60]; /* Data in the JPEG APPn segment. */
  396. int COM_len; /* Length of data in JPEG COM segment */
  397. char COM_data[60]; /* Data in JPEG COM segment */
  398. __u32 jpeg_markers; /* Which markers should go into the JPEG
  399. * output. Unless you exactly know what
  400. * you do, leave them untouched.
  401. * Inluding less markers will make the
  402. * resulting code smaller, but there will
  403. * be fewer aplications which can read it.
  404. * The presence of the APP and COM marker
  405. * is influenced by APP_len and COM_len
  406. * ONLY, not by this property! */
  407. #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
  408. #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
  409. #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
  410. #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
  411. #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
  412. * allways use APP0 */
  413. };
  414. /*
  415. * M E M O R Y - M A P P I N G B U F F E R S
  416. */
  417. struct v4l2_requestbuffers
  418. {
  419. __u32 count;
  420. enum v4l2_buf_type type;
  421. enum v4l2_memory memory;
  422. __u32 reserved[2];
  423. };
  424. struct v4l2_buffer
  425. {
  426. __u32 index;
  427. enum v4l2_buf_type type;
  428. __u32 bytesused;
  429. __u32 flags;
  430. enum v4l2_field field;
  431. struct timeval timestamp;
  432. struct v4l2_timecode timecode;
  433. __u32 sequence;
  434. /* memory location */
  435. enum v4l2_memory memory;
  436. union {
  437. __u32 offset;
  438. unsigned long userptr;
  439. } m;
  440. __u32 length;
  441. __u32 input;
  442. __u32 reserved;
  443. };
  444. /* Flags for 'flags' field */
  445. #define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
  446. #define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
  447. #define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
  448. #define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
  449. #define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
  450. #define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
  451. #define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
  452. #define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
  453. /*
  454. * O V E R L A Y P R E V I E W
  455. */
  456. struct v4l2_framebuffer
  457. {
  458. __u32 capability;
  459. __u32 flags;
  460. /* FIXME: in theory we should pass something like PCI device + memory
  461. * region + offset instead of some physical address */
  462. void* base;
  463. struct v4l2_pix_format fmt;
  464. };
  465. /* Flags for the 'capability' field. Read only */
  466. #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
  467. #define V4L2_FBUF_CAP_CHROMAKEY 0x0002
  468. #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
  469. #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
  470. /* Flags for the 'flags' field. */
  471. #define V4L2_FBUF_FLAG_PRIMARY 0x0001
  472. #define V4L2_FBUF_FLAG_OVERLAY 0x0002
  473. #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
  474. struct v4l2_clip
  475. {
  476. struct v4l2_rect c;
  477. struct v4l2_clip __user *next;
  478. };
  479. struct v4l2_window
  480. {
  481. struct v4l2_rect w;
  482. enum v4l2_field field;
  483. __u32 chromakey;
  484. struct v4l2_clip __user *clips;
  485. __u32 clipcount;
  486. void __user *bitmap;
  487. };
  488. /*
  489. * C A P T U R E P A R A M E T E R S
  490. */
  491. struct v4l2_captureparm
  492. {
  493. __u32 capability; /* Supported modes */
  494. __u32 capturemode; /* Current mode */
  495. struct v4l2_fract timeperframe; /* Time per frame in .1us units */
  496. __u32 extendedmode; /* Driver-specific extensions */
  497. __u32 readbuffers; /* # of buffers for read */
  498. __u32 reserved[4];
  499. };
  500. /* Flags for 'capability' and 'capturemode' fields */
  501. #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
  502. #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
  503. struct v4l2_outputparm
  504. {
  505. __u32 capability; /* Supported modes */
  506. __u32 outputmode; /* Current mode */
  507. struct v4l2_fract timeperframe; /* Time per frame in seconds */
  508. __u32 extendedmode; /* Driver-specific extensions */
  509. __u32 writebuffers; /* # of buffers for write */
  510. __u32 reserved[4];
  511. };
  512. /*
  513. * I N P U T I M A G E C R O P P I N G
  514. */
  515. struct v4l2_cropcap {
  516. enum v4l2_buf_type type;
  517. struct v4l2_rect bounds;
  518. struct v4l2_rect defrect;
  519. struct v4l2_fract pixelaspect;
  520. };
  521. struct v4l2_crop {
  522. enum v4l2_buf_type type;
  523. struct v4l2_rect c;
  524. };
  525. /*
  526. * A N A L O G V I D E O S T A N D A R D
  527. */
  528. typedef __u64 v4l2_std_id;
  529. /* one bit for each */
  530. #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
  531. #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
  532. #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
  533. #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
  534. #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
  535. #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
  536. #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
  537. #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
  538. #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
  539. #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
  540. #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
  541. #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
  542. #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
  543. #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
  544. #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
  545. #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
  546. #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
  547. #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
  548. #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
  549. #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
  550. #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
  551. #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
  552. #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
  553. #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
  554. /* ATSC/HDTV */
  555. #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
  556. #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
  557. /* some merged standards */
  558. #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
  559. #define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
  560. #define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
  561. #define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
  562. /* some common needed stuff */
  563. #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
  564. V4L2_STD_PAL_B1 |\
  565. V4L2_STD_PAL_G)
  566. #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
  567. V4L2_STD_PAL_D1 |\
  568. V4L2_STD_PAL_K)
  569. #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
  570. V4L2_STD_PAL_DK |\
  571. V4L2_STD_PAL_H |\
  572. V4L2_STD_PAL_I)
  573. #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
  574. V4L2_STD_NTSC_M_JP |\
  575. V4L2_STD_NTSC_M_KR)
  576. #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
  577. V4L2_STD_SECAM_K |\
  578. V4L2_STD_SECAM_K1)
  579. #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
  580. V4L2_STD_SECAM_G |\
  581. V4L2_STD_SECAM_H |\
  582. V4L2_STD_SECAM_DK |\
  583. V4L2_STD_SECAM_L |\
  584. V4L2_STD_SECAM_LC)
  585. #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
  586. V4L2_STD_PAL_60 |\
  587. V4L2_STD_NTSC |\
  588. V4L2_STD_NTSC_443)
  589. #define V4L2_STD_625_50 (V4L2_STD_PAL |\
  590. V4L2_STD_PAL_N |\
  591. V4L2_STD_PAL_Nc |\
  592. V4L2_STD_SECAM)
  593. #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
  594. V4L2_STD_ATSC_16_VSB)
  595. #define V4L2_STD_UNKNOWN 0
  596. #define V4L2_STD_ALL (V4L2_STD_525_60 |\
  597. V4L2_STD_625_50)
  598. struct v4l2_standard
  599. {
  600. __u32 index;
  601. v4l2_std_id id;
  602. __u8 name[24];
  603. struct v4l2_fract frameperiod; /* Frames, not fields */
  604. __u32 framelines;
  605. __u32 reserved[4];
  606. };
  607. /*
  608. * V I D E O I N P U T S
  609. */
  610. struct v4l2_input
  611. {
  612. __u32 index; /* Which input */
  613. __u8 name[32]; /* Label */
  614. __u32 type; /* Type of input */
  615. __u32 audioset; /* Associated audios (bitfield) */
  616. __u32 tuner; /* Associated tuner */
  617. v4l2_std_id std;
  618. __u32 status;
  619. __u32 reserved[4];
  620. };
  621. /* Values for the 'type' field */
  622. #define V4L2_INPUT_TYPE_TUNER 1
  623. #define V4L2_INPUT_TYPE_CAMERA 2
  624. /* field 'status' - general */
  625. #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
  626. #define V4L2_IN_ST_NO_SIGNAL 0x00000002
  627. #define V4L2_IN_ST_NO_COLOR 0x00000004
  628. /* field 'status' - analog */
  629. #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
  630. #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
  631. /* field 'status' - digital */
  632. #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
  633. #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
  634. #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
  635. /* field 'status' - VCR and set-top box */
  636. #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
  637. #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
  638. #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
  639. /*
  640. * V I D E O O U T P U T S
  641. */
  642. struct v4l2_output
  643. {
  644. __u32 index; /* Which output */
  645. __u8 name[32]; /* Label */
  646. __u32 type; /* Type of output */
  647. __u32 audioset; /* Associated audios (bitfield) */
  648. __u32 modulator; /* Associated modulator */
  649. v4l2_std_id std;
  650. __u32 reserved[4];
  651. };
  652. /* Values for the 'type' field */
  653. #define V4L2_OUTPUT_TYPE_MODULATOR 1
  654. #define V4L2_OUTPUT_TYPE_ANALOG 2
  655. #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
  656. /*
  657. * C O N T R O L S
  658. */
  659. struct v4l2_control
  660. {
  661. __u32 id;
  662. __s32 value;
  663. };
  664. /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
  665. struct v4l2_queryctrl
  666. {
  667. __u32 id;
  668. enum v4l2_ctrl_type type;
  669. __u8 name[32]; /* Whatever */
  670. __s32 minimum; /* Note signedness */
  671. __s32 maximum;
  672. __s32 step;
  673. __s32 default_value;
  674. __u32 flags;
  675. __u32 reserved[2];
  676. };
  677. /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
  678. struct v4l2_querymenu
  679. {
  680. __u32 id;
  681. __u32 index;
  682. __u8 name[32]; /* Whatever */
  683. __u32 reserved;
  684. };
  685. /* Control flags */
  686. #define V4L2_CTRL_FLAG_DISABLED 0x0001
  687. #define V4L2_CTRL_FLAG_GRABBED 0x0002
  688. /* Control IDs defined by V4L2 */
  689. #define V4L2_CID_BASE 0x00980900
  690. /* IDs reserved for driver specific controls */
  691. #define V4L2_CID_PRIVATE_BASE 0x08000000
  692. #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
  693. #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
  694. #define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
  695. #define V4L2_CID_HUE (V4L2_CID_BASE+3)
  696. #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
  697. #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
  698. #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
  699. #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
  700. #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
  701. #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
  702. #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11)
  703. #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
  704. #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
  705. #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
  706. #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
  707. #define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
  708. #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */
  709. #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
  710. #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
  711. #define V4L2_CID_GAIN (V4L2_CID_BASE+19)
  712. #define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
  713. #define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
  714. #define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
  715. #define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
  716. #define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */
  717. /*
  718. * T U N I N G
  719. */
  720. struct v4l2_tuner
  721. {
  722. __u32 index;
  723. __u8 name[32];
  724. enum v4l2_tuner_type type;
  725. __u32 capability;
  726. __u32 rangelow;
  727. __u32 rangehigh;
  728. __u32 rxsubchans;
  729. __u32 audmode;
  730. __s32 signal;
  731. __s32 afc;
  732. __u32 reserved[4];
  733. };
  734. struct v4l2_modulator
  735. {
  736. __u32 index;
  737. __u8 name[32];
  738. __u32 capability;
  739. __u32 rangelow;
  740. __u32 rangehigh;
  741. __u32 txsubchans;
  742. __u32 reserved[4];
  743. };
  744. /* Flags for the 'capability' field */
  745. #define V4L2_TUNER_CAP_LOW 0x0001
  746. #define V4L2_TUNER_CAP_NORM 0x0002
  747. #define V4L2_TUNER_CAP_STEREO 0x0010
  748. #define V4L2_TUNER_CAP_LANG2 0x0020
  749. #define V4L2_TUNER_CAP_SAP 0x0020
  750. #define V4L2_TUNER_CAP_LANG1 0x0040
  751. /* Flags for the 'rxsubchans' field */
  752. #define V4L2_TUNER_SUB_MONO 0x0001
  753. #define V4L2_TUNER_SUB_STEREO 0x0002
  754. #define V4L2_TUNER_SUB_LANG2 0x0004
  755. #define V4L2_TUNER_SUB_SAP 0x0004
  756. #define V4L2_TUNER_SUB_LANG1 0x0008
  757. /* Values for the 'audmode' field */
  758. #define V4L2_TUNER_MODE_MONO 0x0000
  759. #define V4L2_TUNER_MODE_STEREO 0x0001
  760. #define V4L2_TUNER_MODE_LANG2 0x0002
  761. #define V4L2_TUNER_MODE_SAP 0x0002
  762. #define V4L2_TUNER_MODE_LANG1 0x0003
  763. struct v4l2_frequency
  764. {
  765. __u32 tuner;
  766. enum v4l2_tuner_type type;
  767. __u32 frequency;
  768. __u32 reserved[8];
  769. };
  770. /*
  771. * A U D I O
  772. */
  773. struct v4l2_audio
  774. {
  775. __u32 index;
  776. __u8 name[32];
  777. __u32 capability;
  778. __u32 mode;
  779. __u32 reserved[2];
  780. };
  781. /* Flags for the 'capability' field */
  782. #define V4L2_AUDCAP_STEREO 0x00001
  783. #define V4L2_AUDCAP_AVL 0x00002
  784. /* Flags for the 'mode' field */
  785. #define V4L2_AUDMODE_AVL 0x00001
  786. struct v4l2_audioout
  787. {
  788. __u32 index;
  789. __u8 name[32];
  790. __u32 capability;
  791. __u32 mode;
  792. __u32 reserved[2];
  793. };
  794. /*
  795. * D A T A S E R V I C E S ( V B I )
  796. *
  797. * Data services API by Michael Schimek
  798. */
  799. /* Raw VBI */
  800. struct v4l2_vbi_format
  801. {
  802. __u32 sampling_rate; /* in 1 Hz */
  803. __u32 offset;
  804. __u32 samples_per_line;
  805. __u32 sample_format; /* V4L2_PIX_FMT_* */
  806. __s32 start[2];
  807. __u32 count[2];
  808. __u32 flags; /* V4L2_VBI_* */
  809. __u32 reserved[2]; /* must be zero */
  810. };
  811. /* VBI flags */
  812. #define V4L2_VBI_UNSYNC (1<< 0)
  813. #define V4L2_VBI_INTERLACED (1<< 1)
  814. #if 1
  815. /* Sliced VBI
  816. *
  817. * This implements is a proposal V4L2 API to allow SLICED VBI
  818. * required for some hardware encoders. It should change without
  819. * notice in the definitive implementation.
  820. */
  821. struct v4l2_sliced_vbi_format
  822. {
  823. __u16 service_set;
  824. /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
  825. service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
  826. (equals frame lines 313-336 for 625 line video
  827. standards, 263-286 for 525 line standards) */
  828. __u16 service_lines[2][24];
  829. __u32 io_size;
  830. __u32 reserved[2]; /* must be zero */
  831. };
  832. #define V4L2_SLICED_TELETEXT_B (0x0001)
  833. #define V4L2_SLICED_VPS (0x0400)
  834. #define V4L2_SLICED_CAPTION_525 (0x1000)
  835. #define V4L2_SLICED_WSS_625 (0x4000)
  836. #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
  837. #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
  838. struct v4l2_sliced_vbi_cap
  839. {
  840. __u16 service_set;
  841. /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
  842. service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
  843. (equals frame lines 313-336 for 625 line video
  844. standards, 263-286 for 525 line standards) */
  845. __u16 service_lines[2][24];
  846. __u32 reserved[4]; /* must be 0 */
  847. };
  848. struct v4l2_sliced_vbi_data
  849. {
  850. __u32 id;
  851. __u32 field; /* 0: first field, 1: second field */
  852. __u32 line; /* 1-23 */
  853. __u32 reserved; /* must be 0 */
  854. __u8 data[48];
  855. };
  856. #endif
  857. /*
  858. * A G G R E G A T E S T R U C T U R E S
  859. */
  860. /* Stream data format
  861. */
  862. struct v4l2_format
  863. {
  864. enum v4l2_buf_type type;
  865. union
  866. {
  867. struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
  868. struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
  869. struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
  870. #if 1
  871. struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
  872. #endif
  873. __u8 raw_data[200]; // user-defined
  874. } fmt;
  875. };
  876. /* Stream type-dependent parameters
  877. */
  878. struct v4l2_streamparm
  879. {
  880. enum v4l2_buf_type type;
  881. union
  882. {
  883. struct v4l2_captureparm capture;
  884. struct v4l2_outputparm output;
  885. __u8 raw_data[200]; /* user-defined */
  886. } parm;
  887. };
  888. /*
  889. * 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
  890. *
  891. */
  892. #define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability)
  893. #define VIDIOC_RESERVED _IO ('V', 1)
  894. #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
  895. #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
  896. #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
  897. #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
  898. #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
  899. #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
  900. #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
  901. #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
  902. #define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer)
  903. #define VIDIOC_OVERLAY _IOW ('V', 14, int)
  904. #define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer)
  905. #define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer)
  906. #define VIDIOC_STREAMON _IOW ('V', 18, int)
  907. #define VIDIOC_STREAMOFF _IOW ('V', 19, int)
  908. #define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm)
  909. #define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm)
  910. #define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id)
  911. #define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id)
  912. #define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard)
  913. #define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input)
  914. #define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control)
  915. #define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control)
  916. #define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner)
  917. #define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner)
  918. #define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio)
  919. #define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio)
  920. #define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl)
  921. #define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu)
  922. #define VIDIOC_G_INPUT _IOR ('V', 38, int)
  923. #define VIDIOC_S_INPUT _IOWR ('V', 39, int)
  924. #define VIDIOC_G_OUTPUT _IOR ('V', 46, int)
  925. #define VIDIOC_S_OUTPUT _IOWR ('V', 47, int)
  926. #define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output)
  927. #define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout)
  928. #define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout)
  929. #define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator)
  930. #define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator)
  931. #define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency)
  932. #define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency)
  933. #define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap)
  934. #define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop)
  935. #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop)
  936. #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression)
  937. #define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression)
  938. #define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id)
  939. #define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format)
  940. #define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio)
  941. #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout)
  942. #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority)
  943. #define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority)
  944. #if 1
  945. #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
  946. #endif
  947. #define VIDIOC_LOG_STATUS _IO ('V', 70)
  948. /* for compatibility, will go away some day */
  949. #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
  950. #define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
  951. #define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control)
  952. #define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
  953. #define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
  954. #define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
  955. #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
  956. #ifdef __KERNEL__
  957. /*
  958. *
  959. * V 4 L 2 D R I V E R H E L P E R A P I
  960. *
  961. * Some commonly needed functions for drivers (v4l2-common.o module)
  962. */
  963. #include <linux/fs.h>
  964. /* Video standard functions */
  965. extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
  966. extern int v4l2_video_std_construct(struct v4l2_standard *vs,
  967. int id, char *name);
  968. /* prority handling */
  969. struct v4l2_prio_state {
  970. atomic_t prios[4];
  971. };
  972. int v4l2_prio_init(struct v4l2_prio_state *global);
  973. int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
  974. enum v4l2_priority new);
  975. int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
  976. int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
  977. enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
  978. int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
  979. /* names for fancy debug output */
  980. extern char *v4l2_field_names[];
  981. extern char *v4l2_type_names[];
  982. /* Compatibility layer interface -- v4l1-compat module */
  983. typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
  984. unsigned int cmd, void *arg);
  985. int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
  986. int cmd, void *arg, v4l2_kioctl driver_ioctl);
  987. /* 32 Bits compatibility layer for 64 bits processors */
  988. extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
  989. unsigned long arg);
  990. #endif /* __KERNEL__ */
  991. #endif /* __LINUX_VIDEODEV2_H */
  992. /*
  993. * Local variables:
  994. * c-basic-offset: 8
  995. * End:
  996. */