videodev2.h 41 KB

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