Merge branch 'for-3.3/drivers' of git://git.kernel.dk/linux-block
[linux-2.6.git] / Documentation / DocBook / media / v4l / v4l2.xml
1  <partinfo>
2     <authorgroup>
3       <author>
4         <firstname>Michael</firstname>
5         <surname>Schimek</surname>
6         <othername role="mi">H</othername>
7         <affiliation>
8           <address>
9             <email>mschimek@gmx.at</email>
10           </address>
11         </affiliation>
12       </author>
13
14       <author>
15         <firstname>Bill</firstname>
16         <surname>Dirks</surname>
17         <!-- Commented until Bill opts in to be spammed.
18         <affiliation>
19           <address>
20             <email>bill@thedirks.org</email>
21           </address>
22         </affiliation> -->
23         <contrib>Original author of the V4L2 API and
24 documentation.</contrib>
25       </author>
26
27       <author>
28         <firstname>Hans</firstname>
29         <surname>Verkuil</surname>
30         <contrib>Designed and documented the VIDIOC_LOG_STATUS ioctl,
31 the extended control ioctls and major parts of the sliced VBI
32 API.</contrib>
33         <affiliation>
34           <address>
35             <email>hverkuil@xs4all.nl</email>
36           </address>
37         </affiliation>
38       </author>
39
40       <author>
41         <firstname>Martin</firstname>
42         <surname>Rubli</surname>
43         <!--
44         <affiliation>
45           <address>
46             <email>martin_rubli@logitech.com</email>
47           </address>
48         </affiliation> -->
49         <contrib>Designed and documented the VIDIOC_ENUM_FRAMESIZES
50 and VIDIOC_ENUM_FRAMEINTERVALS ioctls.</contrib>
51       </author>
52
53       <author>
54         <firstname>Andy</firstname>
55         <surname>Walls</surname>
56         <contrib>Documented the fielded V4L2_MPEG_STREAM_VBI_FMT_IVTV
57 MPEG stream embedded, sliced VBI data format in this specification.
58 </contrib>
59         <affiliation>
60           <address>
61             <email>awalls@md.metrocast.net</email>
62           </address>
63         </affiliation>
64       </author>
65
66       <author>
67         <firstname>Mauro</firstname>
68         <surname>Carvalho Chehab</surname>
69         <contrib>Documented libv4l, designed and added v4l2grab example,
70 Remote Controller chapter.</contrib>
71         <affiliation>
72           <address>
73             <email>mchehab@redhat.com</email>
74           </address>
75         </affiliation>
76       </author>
77
78       <author>
79         <firstname>Muralidharan</firstname>
80         <surname>Karicheri</surname>
81         <contrib>Documented the Digital Video timings API.</contrib>
82         <affiliation>
83           <address>
84             <email>m-karicheri2@ti.com</email>
85           </address>
86         </affiliation>
87       </author>
88
89       <author>
90         <firstname>Pawel</firstname>
91         <surname>Osciak</surname>
92         <contrib>Designed and documented the multi-planar API.</contrib>
93         <affiliation>
94           <address>
95             <email>pawel AT osciak.com</email>
96           </address>
97         </affiliation>
98       </author>
99     </authorgroup>
100
101     <copyright>
102       <year>1999</year>
103       <year>2000</year>
104       <year>2001</year>
105       <year>2002</year>
106       <year>2003</year>
107       <year>2004</year>
108       <year>2005</year>
109       <year>2006</year>
110       <year>2007</year>
111       <year>2008</year>
112       <year>2009</year>
113       <year>2010</year>
114       <year>2011</year>
115       <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin
116 Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab,
117         Pawel Osciak</holder>
118     </copyright>
119     <legalnotice>
120     <para>Except when explicitly stated as GPL, programming examples within
121             this part can be used and distributed without restrictions.</para>
122     </legalnotice>
123     <revhistory>
124       <!-- Put document revisions here, newest first. -->
125       <!-- API revisions (changes and additions of defines, enums,
126 structs, ioctls) must be noted in more detail in the history chapter
127 (compat.xml), along with the possible impact on existing drivers and
128 applications. -->
129
130       <revision>
131         <revnumber>3.2</revnumber>
132         <date>2011-08-26</date>
133         <authorinitials>hv</authorinitials>
134         <revremark>Added V4L2_CTRL_FLAG_VOLATILE.</revremark>
135       </revision>
136
137       <revision>
138         <revnumber>3.1</revnumber>
139         <date>2011-06-27</date>
140         <authorinitials>mcc, po, hv</authorinitials>
141         <revremark>Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one.
142                    Standardize an error code for invalid ioctl.
143                    Added V4L2_CTRL_TYPE_BITMASK.</revremark>
144       </revision>
145
146       <revision>
147         <revnumber>2.6.39</revnumber>
148         <date>2011-03-01</date>
149         <authorinitials>mcc, po</authorinitials>
150         <revremark>Removed VIDIOC_*_OLD from videodev2.h header and update it to reflect latest changes. Added the <link linkend="planar-apis">multi-planar API</link>.</revremark>
151       </revision>
152
153       <revision>
154         <revnumber>2.6.37</revnumber>
155         <date>2010-08-06</date>
156         <authorinitials>hv</authorinitials>
157         <revremark>Removed obsolete vtx (videotext) API.</revremark>
158       </revision>
159
160       <revision>
161         <revnumber>2.6.33</revnumber>
162         <date>2009-12-03</date>
163         <authorinitials>mk</authorinitials>
164         <revremark>Added documentation for the Digital Video timings API.</revremark>
165       </revision>
166
167       <revision>
168         <revnumber>2.6.32</revnumber>
169         <date>2009-08-31</date>
170         <authorinitials>mcc</authorinitials>
171         <revremark>Now, revisions will match the kernel version where
172 the V4L2 API changes will be used by the Linux Kernel.
173 Also added Remote Controller chapter.</revremark>
174       </revision>
175
176       <revision>
177         <revnumber>0.29</revnumber>
178         <date>2009-08-26</date>
179         <authorinitials>ev</authorinitials>
180         <revremark>Added documentation for string controls and for FM Transmitter controls.</revremark>
181       </revision>
182
183       <revision>
184         <revnumber>0.28</revnumber>
185         <date>2009-08-26</date>
186         <authorinitials>gl</authorinitials>
187         <revremark>Added V4L2_CID_BAND_STOP_FILTER documentation.</revremark>
188       </revision>
189
190       <revision>
191         <revnumber>0.27</revnumber>
192         <date>2009-08-15</date>
193         <authorinitials>mcc</authorinitials>
194         <revremark>Added libv4l and Remote Controller documentation;
195 added v4l2grab and keytable application examples.</revremark>
196       </revision>
197
198       <revision>
199         <revnumber>0.26</revnumber>
200         <date>2009-07-23</date>
201         <authorinitials>hv</authorinitials>
202         <revremark>Finalized the RDS capture API. Added modulator and RDS encoder
203 capabilities. Added support for string controls.</revremark>
204       </revision>
205
206       <revision>
207         <revnumber>0.25</revnumber>
208         <date>2009-01-18</date>
209         <authorinitials>hv</authorinitials>
210         <revremark>Added pixel formats VYUY, NV16 and NV61, and changed
211 the debug ioctls VIDIOC_DBG_G/S_REGISTER and VIDIOC_DBG_G_CHIP_IDENT.
212 Added camera controls V4L2_CID_ZOOM_ABSOLUTE, V4L2_CID_ZOOM_RELATIVE,
213 V4L2_CID_ZOOM_CONTINUOUS and V4L2_CID_PRIVACY.</revremark>
214       </revision>
215
216       <revision>
217         <revnumber>0.24</revnumber>
218         <date>2008-03-04</date>
219         <authorinitials>mhs</authorinitials>
220         <revremark>Added pixel formats Y16 and SBGGR16, new controls
221 and a camera controls class. Removed VIDIOC_G/S_MPEGCOMP.</revremark>
222       </revision>
223
224       <revision>
225         <revnumber>0.23</revnumber>
226         <date>2007-08-30</date>
227         <authorinitials>mhs</authorinitials>
228         <revremark>Fixed a typo in VIDIOC_DBG_G/S_REGISTER.
229 Clarified the byte order of packed pixel formats.</revremark>
230       </revision>
231
232       <revision>
233         <revnumber>0.22</revnumber>
234         <date>2007-08-29</date>
235         <authorinitials>mhs</authorinitials>
236         <revremark>Added the Video Output Overlay interface, new MPEG
237 controls, V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT,
238 VIDIOC_DBG_G/S_REGISTER, VIDIOC_(TRY_)ENCODER_CMD,
239 VIDIOC_G_CHIP_IDENT, VIDIOC_G_ENC_INDEX, new pixel formats.
240 Clarifications in the cropping chapter, about RGB pixel formats, the
241 mmap(), poll(), select(), read() and write() functions. Typographical
242 fixes.</revremark>
243       </revision>
244
245       <revision>
246         <revnumber>0.21</revnumber>
247         <date>2006-12-19</date>
248         <authorinitials>mhs</authorinitials>
249         <revremark>Fixed a link in the VIDIOC_G_EXT_CTRLS section.</revremark>
250       </revision>
251
252       <revision>
253         <revnumber>0.20</revnumber>
254         <date>2006-11-24</date>
255         <authorinitials>mhs</authorinitials>
256         <revremark>Clarified the purpose of the audioset field in
257 struct v4l2_input and v4l2_output.</revremark>
258       </revision>
259
260       <revision>
261         <revnumber>0.19</revnumber>
262         <date>2006-10-19</date>
263         <authorinitials>mhs</authorinitials>
264         <revremark>Documented V4L2_PIX_FMT_RGB444.</revremark>
265       </revision>
266
267       <revision>
268         <revnumber>0.18</revnumber>
269         <date>2006-10-18</date>
270         <authorinitials>mhs</authorinitials>
271         <revremark>Added the description of extended controls by Hans
272 Verkuil. Linked V4L2_PIX_FMT_MPEG to V4L2_CID_MPEG_STREAM_TYPE.</revremark>
273       </revision>
274
275       <revision>
276         <revnumber>0.17</revnumber>
277         <date>2006-10-12</date>
278         <authorinitials>mhs</authorinitials>
279         <revremark>Corrected V4L2_PIX_FMT_HM12 description.</revremark>
280       </revision>
281
282       <revision>
283         <revnumber>0.16</revnumber>
284         <date>2006-10-08</date>
285         <authorinitials>mhs</authorinitials>
286         <revremark>VIDIOC_ENUM_FRAMESIZES and
287 VIDIOC_ENUM_FRAMEINTERVALS are now part of the API.</revremark>
288       </revision>
289
290       <revision>
291         <revnumber>0.15</revnumber>
292         <date>2006-09-23</date>
293         <authorinitials>mhs</authorinitials>
294         <revremark>Cleaned up the bibliography, added BT.653 and
295 BT.1119. capture.c/start_capturing() for user pointer I/O did not
296 initialize the buffer index. Documented the V4L MPEG and MJPEG
297 VID_TYPEs and V4L2_PIX_FMT_SBGGR8. Updated the list of reserved pixel
298 formats. See the history chapter for API changes.</revremark>
299       </revision>
300
301       <revision>
302         <revnumber>0.14</revnumber>
303         <date>2006-09-14</date>
304         <authorinitials>mr</authorinitials>
305         <revremark>Added VIDIOC_ENUM_FRAMESIZES and
306 VIDIOC_ENUM_FRAMEINTERVALS proposal for frame format enumeration of
307 digital devices.</revremark>
308       </revision>
309
310       <revision>
311         <revnumber>0.13</revnumber>
312         <date>2006-04-07</date>
313         <authorinitials>mhs</authorinitials>
314         <revremark>Corrected the description of struct v4l2_window
315 clips. New V4L2_STD_ and V4L2_TUNER_MODE_LANG1_LANG2
316 defines.</revremark>
317       </revision>
318
319       <revision>
320         <revnumber>0.12</revnumber>
321         <date>2006-02-03</date>
322         <authorinitials>mhs</authorinitials>
323         <revremark>Corrected the description of struct
324 v4l2_captureparm and v4l2_outputparm.</revremark>
325       </revision>
326
327       <revision>
328         <revnumber>0.11</revnumber>
329         <date>2006-01-27</date>
330         <authorinitials>mhs</authorinitials>
331         <revremark>Improved the description of struct
332 v4l2_tuner.</revremark>
333       </revision>
334
335       <revision>
336         <revnumber>0.10</revnumber>
337         <date>2006-01-10</date>
338         <authorinitials>mhs</authorinitials>
339         <revremark>VIDIOC_G_INPUT and VIDIOC_S_PARM
340 clarifications.</revremark>
341       </revision>
342
343       <revision>
344         <revnumber>0.9</revnumber>
345         <date>2005-11-27</date>
346         <authorinitials>mhs</authorinitials>
347         <revremark>Improved the 525 line numbering diagram. Hans
348 Verkuil and I rewrote the sliced VBI section. He also contributed a
349 VIDIOC_LOG_STATUS page. Fixed VIDIOC_S_STD call in the video standard
350 selection example. Various updates.</revremark>
351       </revision>
352
353       <revision>
354         <revnumber>0.8</revnumber>
355         <date>2004-10-04</date>
356         <authorinitials>mhs</authorinitials>
357         <revremark>Somehow a piece of junk slipped into the capture
358 example, removed.</revremark>
359       </revision>
360
361       <revision>
362         <revnumber>0.7</revnumber>
363         <date>2004-09-19</date>
364         <authorinitials>mhs</authorinitials>
365         <revremark>Fixed video standard selection, control
366 enumeration, downscaling and aspect example. Added read and user
367 pointer i/o to video capture example.</revremark>
368       </revision>
369
370       <revision>
371         <revnumber>0.6</revnumber>
372         <date>2004-08-01</date>
373         <authorinitials>mhs</authorinitials>
374         <revremark>v4l2_buffer changes, added video capture example,
375 various corrections.</revremark>
376       </revision>
377
378       <revision>
379         <revnumber>0.5</revnumber>
380         <date>2003-11-05</date>
381         <authorinitials>mhs</authorinitials>
382         <revremark>Pixel format erratum.</revremark>
383       </revision>
384
385       <revision>
386         <revnumber>0.4</revnumber>
387         <date>2003-09-17</date>
388         <authorinitials>mhs</authorinitials>
389         <revremark>Corrected source and Makefile to generate a PDF.
390 SGML fixes. Added latest API changes. Closed gaps in the history
391 chapter.</revremark>
392       </revision>
393
394       <revision>
395         <revnumber>0.3</revnumber>
396         <date>2003-02-05</date>
397         <authorinitials>mhs</authorinitials>
398         <revremark>Another draft, more corrections.</revremark>
399       </revision>
400
401       <revision>
402         <revnumber>0.2</revnumber>
403         <date>2003-01-15</date>
404         <authorinitials>mhs</authorinitials>
405         <revremark>Second draft, with corrections pointed out by Gerd
406 Knorr.</revremark>
407       </revision>
408
409       <revision>
410         <revnumber>0.1</revnumber>
411         <date>2002-12-01</date>
412         <authorinitials>mhs</authorinitials>
413         <revremark>First draft, based on documentation by Bill Dirks
414 and discussions on the V4L mailing list.</revremark>
415       </revision>
416     </revhistory>
417 </partinfo>
418
419 <title>Video for Linux Two API Specification</title>
420  <subtitle>Revision 3.2</subtitle>
421
422   <chapter id="common">
423     &sub-common;
424   </chapter>
425
426   <chapter id="pixfmt">
427     &sub-pixfmt;
428   </chapter>
429
430   <chapter id="io">
431     &sub-io;
432   </chapter>
433
434   <chapter id="devices">
435     <title>Interfaces</title>
436
437     <section id="capture"> &sub-dev-capture; </section>
438     <section id="overlay"> &sub-dev-overlay; </section>
439     <section id="output"> &sub-dev-output; </section>
440     <section id="osd"> &sub-dev-osd; </section>
441     <section id="codec"> &sub-dev-codec; </section>
442     <section id="effect"> &sub-dev-effect; </section>
443     <section id="raw-vbi"> &sub-dev-raw-vbi; </section>
444     <section id="sliced"> &sub-dev-sliced-vbi; </section>
445     <section id="ttx"> &sub-dev-teletext; </section>
446     <section id="radio"> &sub-dev-radio; </section>
447     <section id="rds"> &sub-dev-rds; </section>
448     <section id="event"> &sub-dev-event; </section>
449     <section id="subdev"> &sub-dev-subdev; </section>
450   </chapter>
451
452   <chapter id="driver">
453           &sub-driver;
454   </chapter>
455
456   <chapter id="libv4l">
457           &sub-libv4l;
458   </chapter>
459
460   <chapter id="compat">
461           &sub-compat;
462   </chapter>
463
464   <appendix id="user-func">
465   <title>Function Reference</title>
466
467     <!-- Keep this alphabetically sorted. -->
468
469     &sub-close;
470     &sub-ioctl;
471     <!-- All ioctls go here. -->
472     &sub-create-bufs;
473     &sub-cropcap;
474     &sub-dbg-g-chip-ident;
475     &sub-dbg-g-register;
476     &sub-dqevent;
477     &sub-encoder-cmd;
478     &sub-enumaudio;
479     &sub-enumaudioout;
480     &sub-enum-dv-presets;
481     &sub-enum-fmt;
482     &sub-enum-framesizes;
483     &sub-enum-frameintervals;
484     &sub-enuminput;
485     &sub-enumoutput;
486     &sub-enumstd;
487     &sub-g-audio;
488     &sub-g-audioout;
489     &sub-g-crop;
490     &sub-g-ctrl;
491     &sub-g-dv-preset;
492     &sub-g-dv-timings;
493     &sub-g-enc-index;
494     &sub-g-ext-ctrls;
495     &sub-g-fbuf;
496     &sub-g-fmt;
497     &sub-g-frequency;
498     &sub-g-input;
499     &sub-g-jpegcomp;
500     &sub-g-modulator;
501     &sub-g-output;
502     &sub-g-parm;
503     &sub-g-priority;
504     &sub-g-sliced-vbi-cap;
505     &sub-g-std;
506     &sub-g-tuner;
507     &sub-log-status;
508     &sub-overlay;
509     &sub-qbuf;
510     &sub-querybuf;
511     &sub-querycap;
512     &sub-queryctrl;
513     &sub-query-dv-preset;
514     &sub-querystd;
515     &sub-prepare-buf;
516     &sub-reqbufs;
517     &sub-s-hw-freq-seek;
518     &sub-streamon;
519     &sub-subdev-enum-frame-interval;
520     &sub-subdev-enum-frame-size;
521     &sub-subdev-enum-mbus-code;
522     &sub-subdev-g-crop;
523     &sub-subdev-g-fmt;
524     &sub-subdev-g-frame-interval;
525     &sub-subscribe-event;
526     <!-- End of ioctls. -->
527     &sub-mmap;
528     &sub-munmap;
529     &sub-open;
530     &sub-poll;
531     &sub-read;
532     &sub-select;
533     &sub-write;
534   </appendix>
535
536   <appendix id="videodev">
537     <title>Video For Linux Two Header File</title>
538     &sub-videodev2-h;
539   </appendix>
540
541   <appendix id="capture-example">
542     <title>Video Capture Example</title>
543     &sub-capture-c;
544   </appendix>
545
546   <appendix id="v4l2grab-example">
547     <title>Video Grabber example using libv4l</title>
548     <para>This program demonstrates how to grab V4L2 images in ppm format by
549 using libv4l handlers. The advantage is that this grabber can potentially work
550 with any V4L2 driver.</para>
551     &sub-v4l2grab-c;
552   </appendix>
553
554   &sub-media-indices;
555
556   &sub-biblio;
557