videodev2.h 50 KB

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