forked from sgs3/GT-I9300_Kernel
-
Notifications
You must be signed in to change notification settings - Fork 24
/
compat.xml
2500 lines (2275 loc) · 95.3 KB
/
compat.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<title>Changes</title>
<para>The following chapters document the evolution of the V4L2 API,
errata or extensions. They are also intended to help application and
driver writers to port or update their code.</para>
<section id="diff-v4l">
<title>Differences between V4L and V4L2</title>
<para>The Video For Linux API was first introduced in Linux 2.1 to
unify and replace various TV and radio device related interfaces,
developed independently by driver writers in prior years. Starting
with Linux 2.5 the much improved V4L2 API replaces the V4L API,
although existing drivers will continue to support V4L applications in
the future, either directly or through the V4L2 compatibility layer in
the <filename>videodev</filename> kernel module translating ioctls on
the fly. For a transition period not all drivers will support the V4L2
API.</para>
<section>
<title>Opening and Closing Devices</title>
<para>For compatibility reasons the character device file names
recommended for V4L2 video capture, overlay, radio and raw
vbi capture devices did not change from those used by V4L. They are
listed in <xref linkend="devices" /> and below in <xref
linkend="v4l-dev" />.</para>
<para>The teletext devices (minor range 192-223) have been removed in
V4L2 and no longer exist. There is no hardware available anymore for handling
pure teletext. Instead raw or sliced VBI is used.</para>
<para>The V4L <filename>videodev</filename> module automatically
assigns minor numbers to drivers in load order, depending on the
registered device type. We recommend that V4L2 drivers by default
register devices with the same numbers, but the system administrator
can assign arbitrary minor numbers using driver module options. The
major device number remains 81.</para>
<table id="v4l-dev">
<title>V4L Device Types, Names and Numbers</title>
<tgroup cols="3">
<thead>
<row>
<entry>Device Type</entry>
<entry>File Name</entry>
<entry>Minor Numbers</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>Video capture and overlay</entry>
<entry><para><filename>/dev/video</filename> and
<filename>/dev/bttv0</filename><footnote> <para>According to
Documentation/devices.txt these should be symbolic links to
<filename>/dev/video0</filename>. Note the original bttv interface is
not compatible with V4L or V4L2.</para> </footnote>,
<filename>/dev/video0</filename> to
<filename>/dev/video63</filename></para></entry>
<entry>0-63</entry>
</row>
<row>
<entry>Radio receiver</entry>
<entry><para><filename>/dev/radio</filename><footnote>
<para>According to
<filename>Documentation/devices.txt</filename> a symbolic link to
<filename>/dev/radio0</filename>.</para>
</footnote>, <filename>/dev/radio0</filename> to
<filename>/dev/radio63</filename></para></entry>
<entry>64-127</entry>
</row>
<row>
<entry>Raw VBI capture</entry>
<entry><para><filename>/dev/vbi</filename>,
<filename>/dev/vbi0</filename> to
<filename>/dev/vbi31</filename></para></entry>
<entry>224-255</entry>
</row>
</tbody>
</tgroup>
</table>
<para>V4L prohibits (or used to prohibit) multiple opens of a
device file. V4L2 drivers <emphasis>may</emphasis> support multiple
opens, see <xref linkend="open" /> for details and consequences.</para>
<para>V4L drivers respond to V4L2 ioctls with an &EINVAL;. The
compatibility layer in the V4L2 <filename>videodev</filename> module
can translate V4L ioctl requests to their V4L2 counterpart, however a
V4L2 driver usually needs more preparation to become fully V4L
compatible. This is covered in more detail in <xref
linkend="driver" />.</para>
</section>
<section>
<title>Querying Capabilities</title>
<para>The V4L <constant>VIDIOCGCAP</constant> ioctl is
equivalent to V4L2's &VIDIOC-QUERYCAP;.</para>
<para>The <structfield>name</structfield> field in struct
<structname>video_capability</structname> became
<structfield>card</structfield> in &v4l2-capability;,
<structfield>type</structfield> was replaced by
<structfield>capabilities</structfield>. Note V4L2 does not
distinguish between device types like this, better think of basic
video input, video output and radio devices supporting a set of
related functions like video capturing, video overlay and VBI
capturing. See <xref linkend="open" /> for an
introduction.<informaltable>
<tgroup cols="3">
<thead>
<row>
<entry>struct
<structname>video_capability</structname>
<structfield>type</structfield></entry>
<entry>&v4l2-capability;
<structfield>capabilities</structfield> flags</entry>
<entry>Purpose</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><constant>VID_TYPE_CAPTURE</constant></entry>
<entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
<entry>The <link linkend="capture">video
capture</link> interface is supported.</entry>
</row>
<row>
<entry><constant>VID_TYPE_TUNER</constant></entry>
<entry><constant>V4L2_CAP_TUNER</constant></entry>
<entry>The device has a <link linkend="tuner">tuner or
modulator</link>.</entry>
</row>
<row>
<entry><constant>VID_TYPE_TELETEXT</constant></entry>
<entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
<entry>The <link linkend="raw-vbi">raw VBI
capture</link> interface is supported.</entry>
</row>
<row>
<entry><constant>VID_TYPE_OVERLAY</constant></entry>
<entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
<entry>The <link linkend="overlay">video
overlay</link> interface is supported.</entry>
</row>
<row>
<entry><constant>VID_TYPE_CHROMAKEY</constant></entry>
<entry><constant>V4L2_FBUF_CAP_CHROMAKEY</constant> in
field <structfield>capability</structfield> of
&v4l2-framebuffer;</entry>
<entry>Whether chromakey overlay is supported. For
more information on overlay see
<xref linkend="overlay" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_CLIPPING</constant></entry>
<entry><constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant>
and <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant> in field
<structfield>capability</structfield> of &v4l2-framebuffer;</entry>
<entry>Whether clipping the overlaid image is
supported, see <xref linkend="overlay" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_FRAMERAM</constant></entry>
<entry><constant>V4L2_FBUF_CAP_EXTERNOVERLAY</constant>
<emphasis>not set</emphasis> in field
<structfield>capability</structfield> of &v4l2-framebuffer;</entry>
<entry>Whether overlay overwrites frame buffer memory,
see <xref linkend="overlay" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_SCALES</constant></entry>
<entry><constant>-</constant></entry>
<entry>This flag indicates if the hardware can scale
images. The V4L2 API implies the scale factor by setting the cropping
dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT;
ioctl, respectively. The driver returns the closest sizes possible.
For more information on cropping and scaling see <xref
linkend="crop" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_MONOCHROME</constant></entry>
<entry><constant>-</constant></entry>
<entry>Applications can enumerate the supported image
formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device
supports grey scale capturing only. For more information on image
formats see <xref linkend="pixfmt" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_SUBCAPTURE</constant></entry>
<entry><constant>-</constant></entry>
<entry>Applications can call the &VIDIOC-G-CROP; ioctl
to determine if the device supports capturing a subsection of the full
picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;.
For more information on cropping and scaling see <xref
linkend="crop" />.</entry>
</row>
<row>
<entry><constant>VID_TYPE_MPEG_DECODER</constant></entry>
<entry><constant>-</constant></entry>
<entry>Applications can enumerate the supported image
formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device
supports MPEG streams.</entry>
</row>
<row>
<entry><constant>VID_TYPE_MPEG_ENCODER</constant></entry>
<entry><constant>-</constant></entry>
<entry>See above.</entry>
</row>
<row>
<entry><constant>VID_TYPE_MJPEG_DECODER</constant></entry>
<entry><constant>-</constant></entry>
<entry>See above.</entry>
</row>
<row>
<entry><constant>VID_TYPE_MJPEG_ENCODER</constant></entry>
<entry><constant>-</constant></entry>
<entry>See above.</entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>The <structfield>audios</structfield> field was replaced
by <structfield>capabilities</structfield> flag
<constant>V4L2_CAP_AUDIO</constant>, indicating
<emphasis>if</emphasis> the device has any audio inputs or outputs. To
determine their number applications can enumerate audio inputs with
the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in <xref
linkend="audio" />.</para>
<para>The <structfield>maxwidth</structfield>,
<structfield>maxheight</structfield>,
<structfield>minwidth</structfield> and
<structfield>minheight</structfield> fields were removed. Calling the
&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions
returns the closest size possible, taking into account the current
video standard, cropping and scaling limitations.</para>
</section>
<section>
<title>Video Sources</title>
<para>V4L provides the <constant>VIDIOCGCHAN</constant> and
<constant>VIDIOCSCHAN</constant> ioctl using struct
<structname>video_channel</structname> to enumerate
the video inputs of a V4L device. The equivalent V4L2 ioctls
are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT;
using &v4l2-input; as discussed in <xref linkend="video" />.</para>
<para>The <structfield>channel</structfield> field counting
inputs was renamed to <structfield>index</structfield>, the video
input types were renamed as follows: <informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>struct <structname>video_channel</structname>
<structfield>type</structfield></entry>
<entry>&v4l2-input;
<structfield>type</structfield></entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><constant>VIDEO_TYPE_TV</constant></entry>
<entry><constant>V4L2_INPUT_TYPE_TUNER</constant></entry>
</row>
<row>
<entry><constant>VIDEO_TYPE_CAMERA</constant></entry>
<entry><constant>V4L2_INPUT_TYPE_CAMERA</constant></entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>Unlike the <structfield>tuners</structfield> field
expressing the number of tuners of this input, V4L2 assumes each video
input is connected to at most one tuner. However a tuner can have more
than one input, &ie; RF connectors, and a device can have multiple
tuners. The index number of the tuner associated with the input, if
any, is stored in field <structfield>tuner</structfield> of
&v4l2-input;. Enumeration of tuners is discussed in <xref
linkend="tuner" />.</para>
<para>The redundant <constant>VIDEO_VC_TUNER</constant> flag was
dropped. Video inputs associated with a tuner are of type
<constant>V4L2_INPUT_TYPE_TUNER</constant>. The
<constant>VIDEO_VC_AUDIO</constant> flag was replaced by the
<structfield>audioset</structfield> field. V4L2 considers devices with
up to 32 audio inputs. Each set bit in the
<structfield>audioset</structfield> field represents one audio input
this video input combines with. For information about audio inputs and
how to switch between them see <xref linkend="audio" />.</para>
<para>The <structfield>norm</structfield> field describing the
supported video standards was replaced by
<structfield>std</structfield>. The V4L specification mentions a flag
<constant>VIDEO_VC_NORM</constant> indicating whether the standard can
be changed. This flag was a later addition together with the
<structfield>norm</structfield> field and has been removed in the
meantime. V4L2 has a similar, albeit more comprehensive approach
to video standards, see <xref linkend="standard" /> for more
information.</para>
</section>
<section>
<title>Tuning</title>
<para>The V4L <constant>VIDIOCGTUNER</constant> and
<constant>VIDIOCSTUNER</constant> ioctl and struct
<structname>video_tuner</structname> can be used to enumerate the
tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are
&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are
covered in <xref linkend="tuner" />.</para>
<para>The <structfield>tuner</structfield> field counting tuners
was renamed to <structfield>index</structfield>. The fields
<structfield>name</structfield>, <structfield>rangelow</structfield>
and <structfield>rangehigh</structfield> remained unchanged.</para>
<para>The <constant>VIDEO_TUNER_PAL</constant>,
<constant>VIDEO_TUNER_NTSC</constant> and
<constant>VIDEO_TUNER_SECAM</constant> flags indicating the supported
video standards were dropped. This information is now contained in the
associated &v4l2-input;. No replacement exists for the
<constant>VIDEO_TUNER_NORM</constant> flag indicating whether the
video standard can be switched. The <structfield>mode</structfield>
field to select a different video standard was replaced by a whole new
set of ioctls and structures described in <xref linkend="standard" />.
Due to its ubiquity it should be mentioned the BTTV driver supports
several standards in addition to the regular
<constant>VIDEO_MODE_PAL</constant> (0),
<constant>VIDEO_MODE_NTSC</constant>,
<constant>VIDEO_MODE_SECAM</constant> and
<constant>VIDEO_MODE_AUTO</constant> (3). Namely N/PAL Argentina,
M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic).</para>
<para>The <constant>VIDEO_TUNER_STEREO_ON</constant> flag
indicating stereo reception became
<constant>V4L2_TUNER_SUB_STEREO</constant> in field
<structfield>rxsubchans</structfield>. This field also permits the
detection of monaural and bilingual audio, see the definition of
&v4l2-tuner; for details. Presently no replacement exists for the
<constant>VIDEO_TUNER_RDS_ON</constant> and
<constant>VIDEO_TUNER_MBS_ON</constant> flags.</para>
<para> The <constant>VIDEO_TUNER_LOW</constant> flag was renamed
to <constant>V4L2_TUNER_CAP_LOW</constant> in the &v4l2-tuner;
<structfield>capability</structfield> field.</para>
<para>The <constant>VIDIOCGFREQ</constant> and
<constant>VIDIOCSFREQ</constant> ioctl to change the tuner frequency
where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They
take a pointer to a &v4l2-frequency; instead of an unsigned long
integer.</para>
</section>
<section id="v4l-image-properties">
<title>Image Properties</title>
<para>V4L2 has no equivalent of the
<constant>VIDIOCGPICT</constant> and <constant>VIDIOCSPICT</constant>
ioctl and struct <structname>video_picture</structname>. The following
fields where replaced by V4L2 controls accessible with the
&VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls:<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>struct <structname>video_picture</structname></entry>
<entry>V4L2 Control ID</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><structfield>brightness</structfield></entry>
<entry><constant>V4L2_CID_BRIGHTNESS</constant></entry>
</row>
<row>
<entry><structfield>hue</structfield></entry>
<entry><constant>V4L2_CID_HUE</constant></entry>
</row>
<row>
<entry><structfield>colour</structfield></entry>
<entry><constant>V4L2_CID_SATURATION</constant></entry>
</row>
<row>
<entry><structfield>contrast</structfield></entry>
<entry><constant>V4L2_CID_CONTRAST</constant></entry>
</row>
<row>
<entry><structfield>whiteness</structfield></entry>
<entry><constant>V4L2_CID_WHITENESS</constant></entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>The V4L picture controls are assumed to range from 0 to
65535 with no particular reset value. The V4L2 API permits arbitrary
limits and defaults which can be queried with the &VIDIOC-QUERYCTRL;
ioctl. For general information about controls see <xref
linkend="control" />.</para>
<para>The <structfield>depth</structfield> (average number of
bits per pixel) of a video image is implied by the selected image
format. V4L2 does not explicitely provide such information assuming
applications recognizing the format are aware of the image depth and
others need not know. The <structfield>palette</structfield> field
moved into the &v4l2-pix-format;:<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>struct <structname>video_picture</structname>
<structfield>palette</structfield></entry>
<entry>&v4l2-pix-format;
<structfield>pixfmt</structfield></entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><constant>VIDEO_PALETTE_GREY</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-GREY"><constant>V4L2_PIX_FMT_GREY</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_HI240</constant></entry>
<entry><para><link
linkend="pixfmt-reserved"><constant>V4L2_PIX_FMT_HI240</constant></link><footnote>
<para>This is a custom format used by the BTTV
driver, not one of the V4L2 standard formats.</para>
</footnote></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_RGB565</constant></entry>
<entry><para><link
linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB565</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_RGB555</constant></entry>
<entry><para><link
linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB555</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_RGB24</constant></entry>
<entry><para><link
linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR24</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_RGB32</constant></entry>
<entry><para><link
linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR32</constant></link><footnote>
<para>Presumably all V4L RGB formats are
little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue
swapped variants. For details see <xref linkend="pixfmt-rgb" />.</para>
</footnote></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV422</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>
</row>
<row>
<entry><para><constant>VIDEO_PALETTE_YUYV</constant><footnote>
<para><constant>VIDEO_PALETTE_YUV422</constant>
and <constant>VIDEO_PALETTE_YUYV</constant> are the same formats. Some
V4L drivers respond to one, some to the other.</para>
</footnote></para></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_UYVY</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-UYVY"><constant>V4L2_PIX_FMT_UYVY</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV420</constant></entry>
<entry>None</entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV411</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-Y41P"><constant>V4L2_PIX_FMT_Y41P</constant></link><footnote>
<para>Not to be confused with
<constant>V4L2_PIX_FMT_YUV411P</constant>, which is a planar
format.</para> </footnote></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_RAW</constant></entry>
<entry><para>None<footnote> <para>V4L explains this
as: "RAW capture (BT848)"</para> </footnote></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV422P</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YUV422P"><constant>V4L2_PIX_FMT_YUV422P</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV411P</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YUV411P"><constant>V4L2_PIX_FMT_YUV411P</constant></link><footnote>
<para>Not to be confused with
<constant>V4L2_PIX_FMT_Y41P</constant>, which is a packed
format.</para> </footnote></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV420P</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YVU420"><constant>V4L2_PIX_FMT_YVU420</constant></link></para></entry>
</row>
<row>
<entry><constant>VIDEO_PALETTE_YUV410P</constant></entry>
<entry><para><link
linkend="V4L2-PIX-FMT-YVU410"><constant>V4L2_PIX_FMT_YVU410</constant></link></para></entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>V4L2 image formats are defined in <xref
linkend="pixfmt" />. The image format can be selected with the
&VIDIOC-S-FMT; ioctl.</para>
</section>
<section>
<title>Audio</title>
<para>The <constant>VIDIOCGAUDIO</constant> and
<constant>VIDIOCSAUDIO</constant> ioctl and struct
<structname>video_audio</structname> are used to enumerate the
audio inputs of a V4L device. The equivalent V4L2 ioctls are
&VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as
discussed in <xref linkend="audio" />.</para>
<para>The <structfield>audio</structfield> "channel number"
field counting audio inputs was renamed to
<structfield>index</structfield>.</para>
<para>On <constant>VIDIOCSAUDIO</constant> the
<structfield>mode</structfield> field selects <emphasis>one</emphasis>
of the <constant>VIDEO_SOUND_MONO</constant>,
<constant>VIDEO_SOUND_STEREO</constant>,
<constant>VIDEO_SOUND_LANG1</constant> or
<constant>VIDEO_SOUND_LANG2</constant> audio demodulation modes. When
the current audio standard is BTSC
<constant>VIDEO_SOUND_LANG2</constant> refers to SAP and
<constant>VIDEO_SOUND_LANG1</constant> is meaningless. Also
undocumented in the V4L specification, there is no way to query the
selected mode. On <constant>VIDIOCGAUDIO</constant> the driver returns
the <emphasis>actually received</emphasis> audio programmes in this
field. In the V4L2 API this information is stored in the &v4l2-tuner;
<structfield>rxsubchans</structfield> and
<structfield>audmode</structfield> fields, respectively. See <xref
linkend="tuner" /> for more information on tuners. Related to audio
modes &v4l2-audio; also reports if this is a mono or stereo
input, regardless if the source is a tuner.</para>
<para>The following fields where replaced by V4L2 controls
accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and
&VIDIOC-S-CTRL; ioctls:<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>struct
<structname>video_audio</structname></entry>
<entry>V4L2 Control ID</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><structfield>volume</structfield></entry>
<entry><constant>V4L2_CID_AUDIO_VOLUME</constant></entry>
</row>
<row>
<entry><structfield>bass</structfield></entry>
<entry><constant>V4L2_CID_AUDIO_BASS</constant></entry>
</row>
<row>
<entry><structfield>treble</structfield></entry>
<entry><constant>V4L2_CID_AUDIO_TREBLE</constant></entry>
</row>
<row>
<entry><structfield>balance</structfield></entry>
<entry><constant>V4L2_CID_AUDIO_BALANCE</constant></entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>To determine which of these controls are supported by a
driver V4L provides the <structfield>flags</structfield>
<constant>VIDEO_AUDIO_VOLUME</constant>,
<constant>VIDEO_AUDIO_BASS</constant>,
<constant>VIDEO_AUDIO_TREBLE</constant> and
<constant>VIDEO_AUDIO_BALANCE</constant>. In the V4L2 API the
&VIDIOC-QUERYCTRL; ioctl reports if the respective control is
supported. Accordingly the <constant>VIDEO_AUDIO_MUTABLE</constant>
and <constant>VIDEO_AUDIO_MUTE</constant> flags where replaced by the
boolean <constant>V4L2_CID_AUDIO_MUTE</constant> control.</para>
<para>All V4L2 controls have a <structfield>step</structfield>
attribute replacing the struct <structname>video_audio</structname>
<structfield>step</structfield> field. The V4L audio controls are
assumed to range from 0 to 65535 with no particular reset value. The
V4L2 API permits arbitrary limits and defaults which can be queried
with the &VIDIOC-QUERYCTRL; ioctl. For general information about
controls see <xref linkend="control" />.</para>
</section>
<section>
<title>Frame Buffer Overlay</title>
<para>The V4L2 ioctls equivalent to
<constant>VIDIOCGFBUF</constant> and <constant>VIDIOCSFBUF</constant>
are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The
<structfield>base</structfield> field of struct
<structname>video_buffer</structname> remained unchanged, except V4L2
defines a flag to indicate non-destructive overlays instead of a
<constant>NULL</constant> pointer. All other fields moved into the
&v4l2-pix-format; <structfield>fmt</structfield> substructure of
&v4l2-framebuffer;. The <structfield>depth</structfield> field was
replaced by <structfield>pixelformat</structfield>. See <xref
linkend="pixfmt-rgb" /> for a list of RGB formats and their
respective color depths.</para>
<para>Instead of the special ioctls
<constant>VIDIOCGWIN</constant> and <constant>VIDIOCSWIN</constant>
V4L2 uses the general-purpose data format negotiation ioctls
&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a
&v4l2-format; as argument. Here the <structfield>win</structfield>
member of the <structfield>fmt</structfield> union is used, a
&v4l2-window;.</para>
<para>The <structfield>x</structfield>,
<structfield>y</structfield>, <structfield>width</structfield> and
<structfield>height</structfield> fields of struct
<structname>video_window</structname> moved into &v4l2-rect;
substructure <structfield>w</structfield> of struct
<structname>v4l2_window</structname>. The
<structfield>chromakey</structfield>,
<structfield>clips</structfield>, and
<structfield>clipcount</structfield> fields remained unchanged. Struct
<structname>video_clip</structname> was renamed to &v4l2-clip;, also
containing a struct <structname>v4l2_rect</structname>, but the
semantics are still the same.</para>
<para>The <constant>VIDEO_WINDOW_INTERLACE</constant> flag was
dropped. Instead applications must set the
<structfield>field</structfield> field to
<constant>V4L2_FIELD_ANY</constant> or
<constant>V4L2_FIELD_INTERLACED</constant>. The
<constant>VIDEO_WINDOW_CHROMAKEY</constant> flag moved into
&v4l2-framebuffer;, under the new name
<constant>V4L2_FBUF_FLAG_CHROMAKEY</constant>.</para>
<para>In V4L, storing a bitmap pointer in
<structfield>clips</structfield> and setting
<structfield>clipcount</structfield> to
<constant>VIDEO_CLIP_BITMAP</constant> (-1) requests bitmap
clipping, using a fixed size bitmap of 1024 × 625 bits. Struct
<structname>v4l2_window</structname> has a separate
<structfield>bitmap</structfield> pointer field for this purpose and
the bitmap size is determined by <structfield>w.width</structfield> and
<structfield>w.height</structfield>.</para>
<para>The <constant>VIDIOCCAPTURE</constant> ioctl to enable or
disable overlay was renamed to &VIDIOC-OVERLAY;.</para>
</section>
<section>
<title>Cropping</title>
<para>To capture only a subsection of the full picture V4L
defines the <constant>VIDIOCGCAPTURE</constant> and
<constant>VIDIOCSCAPTURE</constant> ioctls using struct
<structname>video_capture</structname>. The equivalent V4L2 ioctls are
&VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related
&VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see
<xref linkend="crop" /> for details.</para>
<para>The <structfield>x</structfield>,
<structfield>y</structfield>, <structfield>width</structfield> and
<structfield>height</structfield> fields moved into &v4l2-rect;
substructure <structfield>c</structfield> of struct
<structname>v4l2_crop</structname>. The
<structfield>decimation</structfield> field was dropped. In the V4L2
API the scaling factor is implied by the size of the cropping
rectangle and the size of the captured or overlaid image.</para>
<para>The <constant>VIDEO_CAPTURE_ODD</constant>
and <constant>VIDEO_CAPTURE_EVEN</constant> flags to capture only the
odd or even field, respectively, were replaced by
<constant>V4L2_FIELD_TOP</constant> and
<constant>V4L2_FIELD_BOTTOM</constant> in the field named
<structfield>field</structfield> of &v4l2-pix-format; and
&v4l2-window;. These structures are used to select a capture or
overlay format with the &VIDIOC-S-FMT; ioctl.</para>
</section>
<section>
<title>Reading Images, Memory Mapping</title>
<section>
<title>Capturing using the read method</title>
<para>There is no essential difference between reading images
from a V4L or V4L2 device using the &func-read; function, however V4L2
drivers are not required to support this I/O method. Applications can
determine if the function is available with the &VIDIOC-QUERYCAP;
ioctl. All V4L2 devices exchanging data with applications must support
the &func-select; and &func-poll; functions.</para>
<para>To select an image format and size, V4L provides the
<constant>VIDIOCSPICT</constant> and <constant>VIDIOCSWIN</constant>
ioctls. V4L2 uses the general-purpose data format negotiation ioctls
&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a
&v4l2-format; as argument, here the &v4l2-pix-format; named
<structfield>pix</structfield> of its <structfield>fmt</structfield>
union is used.</para>
<para>For more information about the V4L2 read interface see
<xref linkend="rw" />.</para>
</section>
<section>
<title>Capturing using memory mapping</title>
<para>Applications can read from V4L devices by mapping
buffers in device memory, or more often just buffers allocated in
DMA-able system memory, into their address space. This avoids the data
copying overhead of the read method. V4L2 supports memory mapping as
well, with a few differences.</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>V4L</entry>
<entry>V4L2</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry></entry>
<entry>The image format must be selected before
buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format
is selected the driver may use the last, possibly by another
application requested format.</entry>
</row>
<row>
<entry><para>Applications cannot change the number of
buffers. The it is built into the driver, unless it has a module
option to change the number when the driver module is
loaded.</para></entry>
<entry><para>The &VIDIOC-REQBUFS; ioctl allocates the
desired number of buffers, this is a required step in the initialization
sequence.</para></entry>
</row>
<row>
<entry><para>Drivers map all buffers as one contiguous
range of memory. The <constant>VIDIOCGMBUF</constant> ioctl is
available to query the number of buffers, the offset of each buffer
from the start of the virtual file, and the overall amount of memory
used, which can be used as arguments for the &func-mmap;
function.</para></entry>
<entry><para>Buffers are individually mapped. The
offset and size of each buffer can be determined with the
&VIDIOC-QUERYBUF; ioctl.</para></entry>
</row>
<row>
<entry><para>The <constant>VIDIOCMCAPTURE</constant>
ioctl prepares a buffer for capturing. It also determines the image
format for this buffer. The ioctl returns immediately, eventually with
an &EAGAIN; if no video signal had been detected. When the driver
supports more than one buffer applications can call the ioctl multiple
times and thus have multiple outstanding capture
requests.</para><para>The <constant>VIDIOCSYNC</constant> ioctl
suspends execution until a particular buffer has been
filled.</para></entry>
<entry><para>Drivers maintain an incoming and outgoing
queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming
queue. Filled buffers are dequeued from the outgoing queue with the
&VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this
function, &func-select; or &func-poll; can be used. The
&VIDIOC-STREAMON; ioctl must be called once after enqueuing one or
more buffers to start capturing. Its counterpart
&VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both
queues. Applications can query the signal status, if known, with the
&VIDIOC-ENUMINPUT; ioctl.</para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>For a more in-depth discussion of memory mapping and
examples, see <xref linkend="mmap" />.</para>
</section>
</section>
<section>
<title>Reading Raw VBI Data</title>
<para>Originally the V4L API did not specify a raw VBI capture
interface, only the device file <filename>/dev/vbi</filename> was
reserved for this purpose. The only driver supporting this interface
was the BTTV driver, de-facto defining the V4L VBI interface. Reading
from the device yields a raw VBI image with the following
parameters:<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&v4l2-vbi-format;</entry>
<entry>V4L, BTTV driver</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>sampling_rate</entry>
<entry>28636363 Hz NTSC (or any other 525-line
standard); 35468950 Hz PAL and SECAM (625-line standards)</entry>
</row>
<row>
<entry>offset</entry>
<entry>?</entry>
</row>
<row>
<entry>samples_per_line</entry>
<entry>2048</entry>
</row>
<row>
<entry>sample_format</entry>
<entry>V4L2_PIX_FMT_GREY. The last four bytes (a
machine endianess integer) contain a frame counter.</entry>
</row>
<row>
<entry>start[]</entry>
<entry>10, 273 NTSC; 22, 335 PAL and SECAM</entry>
</row>
<row>
<entry>count[]</entry>
<entry><para>16, 16<footnote><para>Old driver
versions used different values, eventually the custom
<constant>BTTV_VBISIZE</constant> ioctl was added to query the
correct values.</para></footnote></para></entry>
</row>
<row>
<entry>flags</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>Undocumented in the V4L specification, in Linux 2.3 the
<constant>VIDIOCGVBIFMT</constant> and
<constant>VIDIOCSVBIFMT</constant> ioctls using struct
<structname>vbi_format</structname> were added to determine the VBI
image parameters. These ioctls are only partially compatible with the
V4L2 VBI interface specified in <xref linkend="raw-vbi" />.</para>
<para>An <structfield>offset</structfield> field does not
exist, <structfield>sample_format</structfield> is supposed to be
<constant>VIDEO_PALETTE_RAW</constant>, equivalent to
<constant>V4L2_PIX_FMT_GREY</constant>. The remaining fields are
probably equivalent to &v4l2-vbi-format;.</para>
<para>Apparently only the Zoran (ZR 36120) driver implements
these ioctls. The semantics differ from those specified for V4L2 in two
ways. The parameters are reset on &func-open; and
<constant>VIDIOCSVBIFMT</constant> always returns an &EINVAL; if the
parameters are invalid.</para>
</section>
<section>
<title>Miscellaneous</title>
<para>V4L2 has no equivalent of the
<constant>VIDIOCGUNIT</constant> ioctl. Applications can find the VBI
device associated with a video capture device (or vice versa) by
reopening the device and requesting VBI data. For details see
<xref linkend="open" />.</para>
<para>No replacement exists for <constant>VIDIOCKEY</constant>,
and the V4L functions for microcode programming. A new interface for
MPEG compression and playback devices is documented in <xref
linkend="extended-controls" />.</para>
</section>
</section>
<section id="hist-v4l2">
<title>Changes of the V4L2 API</title>
<para>Soon after the V4L API was added to the kernel it was
criticised as too inflexible. In August 1998 Bill Dirks proposed a
number of improvements and began to work on documentation, example
drivers and applications. With the help of other volunteers this
eventually became the V4L2 API, not just an extension but a
replacement for the V4L API. However it took another four years and
two stable kernel releases until the new API was finally accepted for
inclusion into the kernel in its present form.</para>
<section>
<title>Early Versions</title>
<para>1998-08-20: First version.</para>
<para>1998-08-27: The &func-select; function was introduced.</para>
<para>1998-09-10: New video standard interface.</para>
<para>1998-09-18: The <constant>VIDIOC_NONCAP</constant> ioctl
was replaced by the otherwise meaningless <constant>O_TRUNC</constant>
&func-open; flag, and the aliases <constant>O_NONCAP</constant> and
<constant>O_NOIO</constant> were defined. Applications can set this
flag if they intend to access controls only, as opposed to capture
applications which need exclusive access. The
<constant>VIDEO_STD_XXX</constant> identifiers are now ordinals
instead of flags, and the <function>video_std_construct()</function>
helper function takes id and transmission arguments.</para>
<para>1998-09-28: Revamped video standard. Made video controls
individually enumerable.</para>
<para>1998-10-02: The <structfield>id</structfield> field was
removed from struct <structname>video_standard</structname> and the
color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was
renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A
first draft of the Codec API was released.</para>
<para>1998-11-08: Many minor changes. Most symbols have been
renamed. Some material changes to &v4l2-capability;.</para>
<para>1998-11-12: The read/write directon of some ioctls was misdefined.</para>
<para>1998-11-14: <constant>V4L2_PIX_FMT_RGB24</constant>
changed to <constant>V4L2_PIX_FMT_BGR24</constant>, and
<constant>V4L2_PIX_FMT_RGB32</constant> changed to
<constant>V4L2_PIX_FMT_BGR32</constant>. Audio controls are now
accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under
names starting with <constant>V4L2_CID_AUDIO</constant>. The
<constant>V4L2_MAJOR</constant> define was removed from
<filename>videodev.h</filename> since it was only used once in the
<filename>videodev</filename> kernel module. The
<constant>YUV422</constant> and <constant>YUV411</constant> planar
image formats were added.</para>
<para>1998-11-28: A few ioctl symbols changed. Interfaces for codecs and
video output devices were added.</para>
<para>1999-01-14: A raw VBI capture interface was added.</para>
<para>1999-01-19: The <constant>VIDIOC_NEXTBUF</constant> ioctl
was removed.</para>
</section>
<section>
<title>V4L2 Version 0.16 1999-01-31</title>
<para>1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF
are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added
digital zoom (cropping) controls.</para>
</section>
<!-- Where's 0.17? mhs couldn't find that videodev.h, perhaps Bill
forgot to bump the version number or never released it. -->
<section>
<title>V4L2 Version 0.18 1999-03-16</title>
<para>Added a v4l to V4L2 ioctl compatibility layer to
videodev.c. Driver writers, this changes how you implement your ioctl
handler. See the Driver Writer's Guide. Added some more control id
codes.</para>
</section>
<section>
<title>V4L2 Version 0.19 1999-06-05</title>
<para>1999-03-18: Fill in the category and catname fields of
v4l2_queryctrl objects before passing them to the driver. Required a
minor change to the VIDIOC_QUERYCTRL handlers in the sample
drivers.</para>
<para>1999-03-31: Better compatibility for v4l memory capture
ioctls. Requires changes to drivers to fully support new compatibility
features, see Driver Writer's Guide and v4l2cap.c. Added new control
IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P,
and _YUV411P to _YUV411P.</para>
<para>1999-04-04: Added a few more control IDs.</para>
<para>1999-04-07: Added the button control type.</para>
<para>1999-05-02: Fixed a typo in videodev.h, and added the
V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag.</para>
<para>1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing
a malfunction of this ioctl.</para>
<para>1999-06-05: Changed the value of
V4L2_CID_WHITENESS.</para>
</section>
<section>
<title>V4L2 Version 0.20 (1999-09-10)</title>
<para>Version 0.20 introduced a number of changes which were
<emphasis>not backward compatible</emphasis> with 0.19 and earlier
versions. Purpose of these changes was to simplify the API, while