videodev2.h 34 KB

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