videodev2.h 34 KB

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