videodev2.h 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  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. #ifdef __KERNEL__
  30. #define VFL_TYPE_GRABBER 0
  31. #define VFL_TYPE_VBI 1
  32. #define VFL_TYPE_RADIO 2
  33. #define VFL_TYPE_VTX 3
  34. struct video_device
  35. {
  36. /* device info */
  37. struct device *dev;
  38. char name[32];
  39. int type; /* v4l1 */
  40. int type2; /* v4l2 */
  41. int hardware;
  42. int minor;
  43. /* device ops + callbacks */
  44. struct file_operations *fops;
  45. void (*release)(struct video_device *vfd);
  46. #if OBSOLETE_OWNER /* to be removed in 2.6.15 */
  47. /* obsolete -- fops->owner is used instead */
  48. struct module *owner;
  49. /* dev->driver_data will be used instead some day.
  50. * Use the video_{get|set}_drvdata() helper functions,
  51. * so the switch over will be transparent for you.
  52. * Or use {pci|usb}_{get|set}_drvdata() directly. */
  53. void *priv;
  54. #endif
  55. /* for videodev.c intenal usage -- please don't touch */
  56. int users; /* video_exclusive_{open|close} ... */
  57. struct semaphore lock; /* ... helper function uses these */
  58. char devfs_name[64]; /* devfs */
  59. struct class_device class_dev; /* sysfs */
  60. };
  61. #define VIDEO_MAJOR 81
  62. #define VID_TYPE_CAPTURE 1 /* Can capture */
  63. #define VID_TYPE_TUNER 2 /* Can tune */
  64. #define VID_TYPE_TELETEXT 4 /* Does teletext */
  65. #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
  66. #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
  67. #define VID_TYPE_CLIPPING 32 /* Can clip */
  68. #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
  69. #define VID_TYPE_SCALES 128 /* Scalable */
  70. #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
  71. #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
  72. #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
  73. #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
  74. #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
  75. #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
  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. /*
  274. * F O R M A T E N U M E R A T I O N
  275. */
  276. struct v4l2_fmtdesc
  277. {
  278. __u32 index; /* Format number */
  279. enum v4l2_buf_type type; /* buffer type */
  280. __u32 flags;
  281. __u8 description[32]; /* Description string */
  282. __u32 pixelformat; /* Format fourcc */
  283. __u32 reserved[4];
  284. };
  285. #define V4L2_FMT_FLAG_COMPRESSED 0x0001
  286. /*
  287. * T I M E C O D E
  288. */
  289. struct v4l2_timecode
  290. {
  291. __u32 type;
  292. __u32 flags;
  293. __u8 frames;
  294. __u8 seconds;
  295. __u8 minutes;
  296. __u8 hours;
  297. __u8 userbits[4];
  298. };
  299. /* Type */
  300. #define V4L2_TC_TYPE_24FPS 1
  301. #define V4L2_TC_TYPE_25FPS 2
  302. #define V4L2_TC_TYPE_30FPS 3
  303. #define V4L2_TC_TYPE_50FPS 4
  304. #define V4L2_TC_TYPE_60FPS 5
  305. /* Flags */
  306. #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
  307. #define V4L2_TC_FLAG_COLORFRAME 0x0002
  308. #define V4L2_TC_USERBITS_field 0x000C
  309. #define V4L2_TC_USERBITS_USERDEFINED 0x0000
  310. #define V4L2_TC_USERBITS_8BITCHARS 0x0008
  311. /* The above is based on SMPTE timecodes */
  312. /*
  313. * 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
  314. *
  315. * ### WARNING: this is still work-in-progress right now, most likely
  316. * ### there will be some incompatible changes.
  317. *
  318. */
  319. enum v4l2_bitrate_mode {
  320. V4L2_BITRATE_NONE = 0, /* not specified */
  321. V4L2_BITRATE_CBR, /* constant bitrate */
  322. V4L2_BITRATE_VBR, /* variable bitrate */
  323. };
  324. struct v4l2_bitrate {
  325. /* rates are specified in kbit/sec */
  326. enum v4l2_bitrate_mode mode;
  327. __u32 min;
  328. __u32 target; /* use this one for CBR */
  329. __u32 max;
  330. };
  331. enum v4l2_mpeg_streamtype {
  332. V4L2_MPEG_SS_1, /* MPEG-1 system stream */
  333. V4L2_MPEG_PS_2, /* MPEG-2 program stream */
  334. V4L2_MPEG_TS_2, /* MPEG-2 transport stream */
  335. V4L2_MPEG_PS_DVD, /* MPEG-2 program stream with DVD header fixups */
  336. };
  337. enum v4l2_mpeg_audiotype {
  338. V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */
  339. V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */
  340. V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */
  341. V4L2_MPEG_AC3, /* AC3 */
  342. V4L2_MPEG_LPCM, /* LPCM */
  343. };
  344. enum v4l2_mpeg_videotype {
  345. V4L2_MPEG_VI_1, /* MPEG-1 */
  346. V4L2_MPEG_VI_2, /* MPEG-2 */
  347. };
  348. enum v4l2_mpeg_aspectratio {
  349. V4L2_MPEG_ASPECT_SQUARE = 1, /* square pixel */
  350. V4L2_MPEG_ASPECT_4_3 = 2, /* 4 : 3 */
  351. V4L2_MPEG_ASPECT_16_9 = 3, /* 16 : 9 */
  352. V4L2_MPEG_ASPECT_1_221 = 4, /* 1 : 2,21 */
  353. };
  354. struct v4l2_mpeg_compression {
  355. /* general */
  356. enum v4l2_mpeg_streamtype st_type;
  357. struct v4l2_bitrate st_bitrate;
  358. /* transport streams */
  359. __u16 ts_pid_pmt;
  360. __u16 ts_pid_audio;
  361. __u16 ts_pid_video;
  362. __u16 ts_pid_pcr;
  363. /* program stream */
  364. __u16 ps_size;
  365. __u16 reserved_1; /* align */
  366. /* audio */
  367. enum v4l2_mpeg_audiotype au_type;
  368. struct v4l2_bitrate au_bitrate;
  369. __u32 au_sample_rate;
  370. __u8 au_pesid;
  371. __u8 reserved_2[3]; /* align */
  372. /* video */
  373. enum v4l2_mpeg_videotype vi_type;
  374. enum v4l2_mpeg_aspectratio vi_aspect_ratio;
  375. struct v4l2_bitrate vi_bitrate;
  376. __u32 vi_frame_rate;
  377. __u16 vi_frames_per_gop;
  378. __u16 vi_bframes_count;
  379. __u8 vi_pesid;
  380. __u8 reserved_3[3]; /* align */
  381. /* misc flags */
  382. __u32 closed_gops:1;
  383. __u32 pulldown:1;
  384. __u32 reserved_4:30; /* align */
  385. /* I don't expect the above being perfect yet ;) */
  386. __u32 reserved_5[8];
  387. };
  388. struct v4l2_jpegcompression
  389. {
  390. int quality;
  391. int APPn; /* Number of APP segment to be written,
  392. * must be 0..15 */
  393. int APP_len; /* Length of data in JPEG APPn segment */
  394. char APP_data[60]; /* Data in the JPEG APPn segment. */
  395. int COM_len; /* Length of data in JPEG COM segment */
  396. char COM_data[60]; /* Data in JPEG COM segment */
  397. __u32 jpeg_markers; /* Which markers should go into the JPEG
  398. * output. Unless you exactly know what
  399. * you do, leave them untouched.
  400. * Inluding less markers will make the
  401. * resulting code smaller, but there will
  402. * be fewer aplications which can read it.
  403. * The presence of the APP and COM marker
  404. * is influenced by APP_len and COM_len
  405. * ONLY, not by this property! */
  406. #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
  407. #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
  408. #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
  409. #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
  410. #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
  411. * allways use APP0 */
  412. };
  413. /*
  414. * M E M O R Y - M A P P I N G B U F F E R S
  415. */
  416. struct v4l2_requestbuffers
  417. {
  418. __u32 count;
  419. enum v4l2_buf_type type;
  420. enum v4l2_memory memory;
  421. __u32 reserved[2];
  422. };
  423. struct v4l2_buffer
  424. {
  425. __u32 index;
  426. enum v4l2_buf_type type;
  427. __u32 bytesused;
  428. __u32 flags;
  429. enum v4l2_field field;
  430. struct timeval timestamp;
  431. struct v4l2_timecode timecode;
  432. __u32 sequence;
  433. /* memory location */
  434. enum v4l2_memory memory;
  435. union {
  436. __u32 offset;
  437. unsigned long userptr;
  438. } m;
  439. __u32 length;
  440. __u32 input;
  441. __u32 reserved;
  442. };
  443. /* Flags for 'flags' field */
  444. #define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
  445. #define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
  446. #define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
  447. #define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
  448. #define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
  449. #define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
  450. #define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
  451. #define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
  452. /*
  453. * O V E R L A Y P R E V I E W
  454. */
  455. struct v4l2_framebuffer
  456. {
  457. __u32 capability;
  458. __u32 flags;
  459. /* FIXME: in theory we should pass something like PCI device + memory
  460. * region + offset instead of some physical address */
  461. void* base;
  462. struct v4l2_pix_format fmt;
  463. };
  464. /* Flags for the 'capability' field. Read only */
  465. #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
  466. #define V4L2_FBUF_CAP_CHROMAKEY 0x0002
  467. #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
  468. #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
  469. /* Flags for the 'flags' field. */
  470. #define V4L2_FBUF_FLAG_PRIMARY 0x0001
  471. #define V4L2_FBUF_FLAG_OVERLAY 0x0002
  472. #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
  473. struct v4l2_clip
  474. {
  475. struct v4l2_rect c;
  476. struct v4l2_clip *next;
  477. };
  478. struct v4l2_window
  479. {
  480. struct v4l2_rect w;
  481. enum v4l2_field field;
  482. __u32 chromakey;
  483. struct v4l2_clip __user *clips;
  484. __u32 clipcount;
  485. void __user *bitmap;
  486. };
  487. /*
  488. * C A P T U R E P A R A M E T E R S
  489. */
  490. struct v4l2_captureparm
  491. {
  492. __u32 capability; /* Supported modes */
  493. __u32 capturemode; /* Current mode */
  494. struct v4l2_fract timeperframe; /* Time per frame in .1us units */
  495. __u32 extendedmode; /* Driver-specific extensions */
  496. __u32 readbuffers; /* # of buffers for read */
  497. __u32 reserved[4];
  498. };
  499. /* Flags for 'capability' and 'capturemode' fields */
  500. #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
  501. #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
  502. struct v4l2_outputparm
  503. {
  504. __u32 capability; /* Supported modes */
  505. __u32 outputmode; /* Current mode */
  506. struct v4l2_fract timeperframe; /* Time per frame in seconds */
  507. __u32 extendedmode; /* Driver-specific extensions */
  508. __u32 writebuffers; /* # of buffers for write */
  509. __u32 reserved[4];
  510. };
  511. /*
  512. * I N P U T I M A G E C R O P P I N G
  513. */
  514. struct v4l2_cropcap {
  515. enum v4l2_buf_type type;
  516. struct v4l2_rect bounds;
  517. struct v4l2_rect defrect;
  518. struct v4l2_fract pixelaspect;
  519. };
  520. struct v4l2_crop {
  521. enum v4l2_buf_type type;
  522. struct v4l2_rect c;
  523. };
  524. /*
  525. * A N A L O G V I D E O S T A N D A R D
  526. */
  527. typedef __u64 v4l2_std_id;
  528. /* one bit for each */
  529. #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
  530. #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
  531. #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
  532. #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
  533. #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
  534. #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
  535. #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
  536. #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
  537. #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
  538. #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
  539. #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
  540. #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
  541. #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
  542. #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
  543. #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
  544. #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
  545. #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
  546. #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
  547. #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
  548. #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
  549. #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
  550. /* ATSC/HDTV */
  551. #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
  552. #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
  553. /* some common needed stuff */
  554. #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
  555. V4L2_STD_PAL_B1 |\
  556. V4L2_STD_PAL_G)
  557. #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
  558. V4L2_STD_PAL_D1 |\
  559. V4L2_STD_PAL_K)
  560. #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
  561. V4L2_STD_PAL_DK |\
  562. V4L2_STD_PAL_H |\
  563. V4L2_STD_PAL_I)
  564. #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
  565. V4L2_STD_NTSC_M_JP)
  566. #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
  567. V4L2_STD_SECAM_K |\
  568. V4L2_STD_SECAM_K1)
  569. #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
  570. V4L2_STD_SECAM_G |\
  571. V4L2_STD_SECAM_H |\
  572. V4L2_STD_SECAM_DK |\
  573. V4L2_STD_SECAM_L)
  574. #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
  575. V4L2_STD_PAL_60 |\
  576. V4L2_STD_NTSC)
  577. #define V4L2_STD_625_50 (V4L2_STD_PAL |\
  578. V4L2_STD_PAL_N |\
  579. V4L2_STD_PAL_Nc |\
  580. V4L2_STD_SECAM)
  581. #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
  582. V4L2_STD_ATSC_16_VSB)
  583. #define V4L2_STD_UNKNOWN 0
  584. #define V4L2_STD_ALL (V4L2_STD_525_60 |\
  585. V4L2_STD_625_50)
  586. struct v4l2_standard
  587. {
  588. __u32 index;
  589. v4l2_std_id id;
  590. __u8 name[24];
  591. struct v4l2_fract frameperiod; /* Frames, not fields */
  592. __u32 framelines;
  593. __u32 reserved[4];
  594. };
  595. /*
  596. * V I D E O I N P U T S
  597. */
  598. struct v4l2_input
  599. {
  600. __u32 index; /* Which input */
  601. __u8 name[32]; /* Label */
  602. __u32 type; /* Type of input */
  603. __u32 audioset; /* Associated audios (bitfield) */
  604. __u32 tuner; /* Associated tuner */
  605. v4l2_std_id std;
  606. __u32 status;
  607. __u32 reserved[4];
  608. };
  609. /* Values for the 'type' field */
  610. #define V4L2_INPUT_TYPE_TUNER 1
  611. #define V4L2_INPUT_TYPE_CAMERA 2
  612. /* field 'status' - general */
  613. #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
  614. #define V4L2_IN_ST_NO_SIGNAL 0x00000002
  615. #define V4L2_IN_ST_NO_COLOR 0x00000004
  616. /* field 'status' - analog */
  617. #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
  618. #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
  619. /* field 'status' - digital */
  620. #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
  621. #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
  622. #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
  623. /* field 'status' - VCR and set-top box */
  624. #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
  625. #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
  626. #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
  627. /*
  628. * V I D E O O U T P U T S
  629. */
  630. struct v4l2_output
  631. {
  632. __u32 index; /* Which output */
  633. __u8 name[32]; /* Label */
  634. __u32 type; /* Type of output */
  635. __u32 audioset; /* Associated audios (bitfield) */
  636. __u32 modulator; /* Associated modulator */
  637. v4l2_std_id std;
  638. __u32 reserved[4];
  639. };
  640. /* Values for the 'type' field */
  641. #define V4L2_OUTPUT_TYPE_MODULATOR 1
  642. #define V4L2_OUTPUT_TYPE_ANALOG 2
  643. #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
  644. /*
  645. * C O N T R O L S
  646. */
  647. struct v4l2_control
  648. {
  649. __u32 id;
  650. __s32 value;
  651. };
  652. /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
  653. struct v4l2_queryctrl
  654. {
  655. __u32 id;
  656. enum v4l2_ctrl_type type;
  657. __u8 name[32]; /* Whatever */
  658. __s32 minimum; /* Note signedness */
  659. __s32 maximum;
  660. __s32 step;
  661. __s32 default_value;
  662. __u32 flags;
  663. __u32 reserved[2];
  664. };
  665. /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
  666. struct v4l2_querymenu
  667. {
  668. __u32 id;
  669. __u32 index;
  670. __u8 name[32]; /* Whatever */
  671. __u32 reserved;
  672. };
  673. /* Control flags */
  674. #define V4L2_CTRL_FLAG_DISABLED 0x0001
  675. #define V4L2_CTRL_FLAG_GRABBED 0x0002
  676. /* Control IDs defined by V4L2 */
  677. #define V4L2_CID_BASE 0x00980900
  678. /* IDs reserved for driver specific controls */
  679. #define V4L2_CID_PRIVATE_BASE 0x08000000
  680. #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
  681. #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
  682. #define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
  683. #define V4L2_CID_HUE (V4L2_CID_BASE+3)
  684. #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
  685. #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
  686. #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
  687. #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
  688. #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
  689. #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
  690. #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11)
  691. #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
  692. #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
  693. #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
  694. #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
  695. #define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
  696. #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */
  697. #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
  698. #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
  699. #define V4L2_CID_GAIN (V4L2_CID_BASE+19)
  700. #define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
  701. #define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
  702. #define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
  703. #define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
  704. #define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */
  705. /*
  706. * T U N I N G
  707. */
  708. struct v4l2_tuner
  709. {
  710. __u32 index;
  711. __u8 name[32];
  712. enum v4l2_tuner_type type;
  713. __u32 capability;
  714. __u32 rangelow;
  715. __u32 rangehigh;
  716. __u32 rxsubchans;
  717. __u32 audmode;
  718. __s32 signal;
  719. __s32 afc;
  720. __u32 reserved[4];
  721. };
  722. struct v4l2_modulator
  723. {
  724. __u32 index;
  725. __u8 name[32];
  726. __u32 capability;
  727. __u32 rangelow;
  728. __u32 rangehigh;
  729. __u32 txsubchans;
  730. __u32 reserved[4];
  731. };
  732. /* Flags for the 'capability' field */
  733. #define V4L2_TUNER_CAP_LOW 0x0001
  734. #define V4L2_TUNER_CAP_NORM 0x0002
  735. #define V4L2_TUNER_CAP_STEREO 0x0010
  736. #define V4L2_TUNER_CAP_LANG2 0x0020
  737. #define V4L2_TUNER_CAP_SAP 0x0020
  738. #define V4L2_TUNER_CAP_LANG1 0x0040
  739. /* Flags for the 'rxsubchans' field */
  740. #define V4L2_TUNER_SUB_MONO 0x0001
  741. #define V4L2_TUNER_SUB_STEREO 0x0002
  742. #define V4L2_TUNER_SUB_LANG2 0x0004
  743. #define V4L2_TUNER_SUB_SAP 0x0004
  744. #define V4L2_TUNER_SUB_LANG1 0x0008
  745. /* Values for the 'audmode' field */
  746. #define V4L2_TUNER_MODE_MONO 0x0000
  747. #define V4L2_TUNER_MODE_STEREO 0x0001
  748. #define V4L2_TUNER_MODE_LANG2 0x0002
  749. #define V4L2_TUNER_MODE_SAP 0x0002
  750. #define V4L2_TUNER_MODE_LANG1 0x0003
  751. struct v4l2_frequency
  752. {
  753. __u32 tuner;
  754. enum v4l2_tuner_type type;
  755. __u32 frequency;
  756. __u32 reserved[8];
  757. };
  758. /*
  759. * A U D I O
  760. */
  761. struct v4l2_audio
  762. {
  763. __u32 index;
  764. __u8 name[32];
  765. __u32 capability;
  766. __u32 mode;
  767. __u32 reserved[2];
  768. };
  769. /* Flags for the 'capability' field */
  770. #define V4L2_AUDCAP_STEREO 0x00001
  771. #define V4L2_AUDCAP_AVL 0x00002
  772. /* Flags for the 'mode' field */
  773. #define V4L2_AUDMODE_AVL 0x00001
  774. struct v4l2_audioout
  775. {
  776. __u32 index;
  777. __u8 name[32];
  778. __u32 capability;
  779. __u32 mode;
  780. __u32 reserved[2];
  781. };
  782. /*
  783. * D A T A S E R V I C E S ( V B I )
  784. *
  785. * Data services API by Michael Schimek
  786. */
  787. /* Raw VBI */
  788. struct v4l2_vbi_format
  789. {
  790. __u32 sampling_rate; /* in 1 Hz */
  791. __u32 offset;
  792. __u32 samples_per_line;
  793. __u32 sample_format; /* V4L2_PIX_FMT_* */
  794. __s32 start[2];
  795. __u32 count[2];
  796. __u32 flags; /* V4L2_VBI_* */
  797. __u32 reserved[2]; /* must be zero */
  798. };
  799. /* VBI flags */
  800. #define V4L2_VBI_UNSYNC (1<< 0)
  801. #define V4L2_VBI_INTERLACED (1<< 1)
  802. #if 1
  803. /* Sliced VBI
  804. *
  805. * This implements is a proposal V4L2 API to allow SLICED VBI
  806. * required for some hardware encoders. It should change without
  807. * notice in the definitive implementation.
  808. */
  809. struct v4l2_sliced_vbi_format
  810. {
  811. __u16 service_set;
  812. /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
  813. service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
  814. (equals frame lines 313-336 for 625 line video
  815. standards, 263-286 for 525 line standards) */
  816. __u16 service_lines[2][24];
  817. __u32 io_size;
  818. __u32 reserved[2]; /* must be zero */
  819. };
  820. #define V4L2_SLICED_TELETEXT_B (0x0001)
  821. #define V4L2_SLICED_VPS (0x0400)
  822. #define V4L2_SLICED_CAPTION_525 (0x1000)
  823. #define V4L2_SLICED_WSS_625 (0x4000)
  824. #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
  825. #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
  826. struct v4l2_sliced_vbi_cap
  827. {
  828. __u16 service_set;
  829. /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
  830. service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
  831. (equals frame lines 313-336 for 625 line video
  832. standards, 263-286 for 525 line standards) */
  833. __u16 service_lines[2][24];
  834. __u32 reserved[4]; /* must be 0 */
  835. };
  836. struct v4l2_sliced_vbi_data
  837. {
  838. __u32 id;
  839. __u32 field; /* 0: first field, 1: second field */
  840. __u32 line; /* 1-23 */
  841. __u32 reserved; /* must be 0 */
  842. __u8 data[48];
  843. };
  844. #endif
  845. /*
  846. * A G G R E G A T E S T R U C T U R E S
  847. */
  848. /* Stream data format
  849. */
  850. struct v4l2_format
  851. {
  852. enum v4l2_buf_type type;
  853. union
  854. {
  855. struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
  856. struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
  857. struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
  858. #if 1
  859. struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
  860. #endif
  861. __u8 raw_data[200]; // user-defined
  862. } fmt;
  863. };
  864. /* Stream type-dependent parameters
  865. */
  866. struct v4l2_streamparm
  867. {
  868. enum v4l2_buf_type type;
  869. union
  870. {
  871. struct v4l2_captureparm capture;
  872. struct v4l2_outputparm output;
  873. __u8 raw_data[200]; /* user-defined */
  874. } parm;
  875. };
  876. /*
  877. * 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
  878. *
  879. */
  880. #define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability)
  881. #define VIDIOC_RESERVED _IO ('V', 1)
  882. #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
  883. #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
  884. #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
  885. #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
  886. #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
  887. #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
  888. #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
  889. #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
  890. #define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer)
  891. #define VIDIOC_OVERLAY _IOW ('V', 14, int)
  892. #define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer)
  893. #define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer)
  894. #define VIDIOC_STREAMON _IOW ('V', 18, int)
  895. #define VIDIOC_STREAMOFF _IOW ('V', 19, int)
  896. #define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm)
  897. #define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm)
  898. #define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id)
  899. #define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id)
  900. #define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard)
  901. #define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input)
  902. #define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control)
  903. #define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control)
  904. #define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner)
  905. #define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner)
  906. #define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio)
  907. #define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio)
  908. #define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl)
  909. #define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu)
  910. #define VIDIOC_G_INPUT _IOR ('V', 38, int)
  911. #define VIDIOC_S_INPUT _IOWR ('V', 39, int)
  912. #define VIDIOC_G_OUTPUT _IOR ('V', 46, int)
  913. #define VIDIOC_S_OUTPUT _IOWR ('V', 47, int)
  914. #define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output)
  915. #define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout)
  916. #define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout)
  917. #define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator)
  918. #define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator)
  919. #define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency)
  920. #define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency)
  921. #define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap)
  922. #define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop)
  923. #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop)
  924. #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression)
  925. #define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression)
  926. #define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id)
  927. #define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format)
  928. #define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio)
  929. #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout)
  930. #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority)
  931. #define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority)
  932. #if 1
  933. #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
  934. #endif
  935. #define VIDIOC_LOG_STATUS _IO ('V', 70)
  936. /* for compatibility, will go away some day */
  937. #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
  938. #define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
  939. #define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control)
  940. #define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
  941. #define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
  942. #define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
  943. #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
  944. #ifdef __KERNEL__
  945. /*
  946. *
  947. * V 4 L 2 D R I V E R H E L P E R A P I
  948. *
  949. * Some commonly needed functions for drivers (v4l2-common.o module)
  950. */
  951. #include <linux/fs.h>
  952. /* Video standard functions */
  953. extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
  954. extern int v4l2_video_std_construct(struct v4l2_standard *vs,
  955. int id, char *name);
  956. /* prority handling */
  957. struct v4l2_prio_state {
  958. atomic_t prios[4];
  959. };
  960. int v4l2_prio_init(struct v4l2_prio_state *global);
  961. int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
  962. enum v4l2_priority new);
  963. int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
  964. int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
  965. enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
  966. int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
  967. /* names for fancy debug output */
  968. extern char *v4l2_field_names[];
  969. extern char *v4l2_type_names[];
  970. extern char *v4l2_ioctl_names[];
  971. /* Compatibility layer interface -- v4l1-compat module */
  972. typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
  973. unsigned int cmd, void *arg);
  974. int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
  975. int cmd, void *arg, v4l2_kioctl driver_ioctl);
  976. #endif /* __KERNEL__ */
  977. #endif /* __LINUX_VIDEODEV2_H */
  978. /*
  979. * Local variables:
  980. * c-basic-offset: 8
  981. * End:
  982. */