Commit 53b5d5749b6fcca37c7ad60cd40feafadd390b70

Authored by Pawel Osciak
Committed by Mauro Carvalho Chehab
1 parent c4c0a78d45

[media] Add multi-planar API documentation

Add DocBook documentation for the new multi-planar API extensions to the
Video for Linux 2 API DocBook.

Signed-off-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 16 changed files with 530 additions and 70 deletions Inline Diff

Documentation/DocBook/media-entities.tmpl
1 <!-- Generated file! Do not edit. --> 1 <!-- Generated file! Do not edit. -->
2 2
3 <!-- Functions --> 3 <!-- Functions -->
4 <!ENTITY func-close "<link linkend='func-close'><function>close()</function></link>"> 4 <!ENTITY func-close "<link linkend='func-close'><function>close()</function></link>">
5 <!ENTITY func-ioctl "<link linkend='func-ioctl'><function>ioctl()</function></link>"> 5 <!ENTITY func-ioctl "<link linkend='func-ioctl'><function>ioctl()</function></link>">
6 <!ENTITY func-mmap "<link linkend='func-mmap'><function>mmap()</function></link>"> 6 <!ENTITY func-mmap "<link linkend='func-mmap'><function>mmap()</function></link>">
7 <!ENTITY func-munmap "<link linkend='func-munmap'><function>munmap()</function></link>"> 7 <!ENTITY func-munmap "<link linkend='func-munmap'><function>munmap()</function></link>">
8 <!ENTITY func-open "<link linkend='func-open'><function>open()</function></link>"> 8 <!ENTITY func-open "<link linkend='func-open'><function>open()</function></link>">
9 <!ENTITY func-poll "<link linkend='func-poll'><function>poll()</function></link>"> 9 <!ENTITY func-poll "<link linkend='func-poll'><function>poll()</function></link>">
10 <!ENTITY func-read "<link linkend='func-read'><function>read()</function></link>"> 10 <!ENTITY func-read "<link linkend='func-read'><function>read()</function></link>">
11 <!ENTITY func-select "<link linkend='func-select'><function>select()</function></link>"> 11 <!ENTITY func-select "<link linkend='func-select'><function>select()</function></link>">
12 <!ENTITY func-write "<link linkend='func-write'><function>write()</function></link>"> 12 <!ENTITY func-write "<link linkend='func-write'><function>write()</function></link>">
13 13
14 <!-- Ioctls --> 14 <!-- Ioctls -->
15 <!ENTITY VIDIOC-CROPCAP "<link linkend='vidioc-cropcap'><constant>VIDIOC_CROPCAP</constant></link>"> 15 <!ENTITY VIDIOC-CROPCAP "<link linkend='vidioc-cropcap'><constant>VIDIOC_CROPCAP</constant></link>">
16 <!ENTITY VIDIOC-DBG-G-CHIP-IDENT "<link linkend='vidioc-dbg-g-chip-ident'><constant>VIDIOC_DBG_G_CHIP_IDENT</constant></link>"> 16 <!ENTITY VIDIOC-DBG-G-CHIP-IDENT "<link linkend='vidioc-dbg-g-chip-ident'><constant>VIDIOC_DBG_G_CHIP_IDENT</constant></link>">
17 <!ENTITY VIDIOC-DBG-G-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_G_REGISTER</constant></link>"> 17 <!ENTITY VIDIOC-DBG-G-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_G_REGISTER</constant></link>">
18 <!ENTITY VIDIOC-DBG-S-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_S_REGISTER</constant></link>"> 18 <!ENTITY VIDIOC-DBG-S-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_S_REGISTER</constant></link>">
19 <!ENTITY VIDIOC-DQBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_DQBUF</constant></link>"> 19 <!ENTITY VIDIOC-DQBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_DQBUF</constant></link>">
20 <!ENTITY VIDIOC-DQEVENT "<link linkend='vidioc-dqevent'><constant>VIDIOC_DQEVENT</constant></link>"> 20 <!ENTITY VIDIOC-DQEVENT "<link linkend='vidioc-dqevent'><constant>VIDIOC_DQEVENT</constant></link>">
21 <!ENTITY VIDIOC-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_ENCODER_CMD</constant></link>"> 21 <!ENTITY VIDIOC-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_ENCODER_CMD</constant></link>">
22 <!ENTITY VIDIOC-ENUMAUDIO "<link linkend='vidioc-enumaudio'><constant>VIDIOC_ENUMAUDIO</constant></link>"> 22 <!ENTITY VIDIOC-ENUMAUDIO "<link linkend='vidioc-enumaudio'><constant>VIDIOC_ENUMAUDIO</constant></link>">
23 <!ENTITY VIDIOC-ENUMAUDOUT "<link linkend='vidioc-enumaudioout'><constant>VIDIOC_ENUMAUDOUT</constant></link>"> 23 <!ENTITY VIDIOC-ENUMAUDOUT "<link linkend='vidioc-enumaudioout'><constant>VIDIOC_ENUMAUDOUT</constant></link>">
24 <!ENTITY VIDIOC-ENUMINPUT "<link linkend='vidioc-enuminput'><constant>VIDIOC_ENUMINPUT</constant></link>"> 24 <!ENTITY VIDIOC-ENUMINPUT "<link linkend='vidioc-enuminput'><constant>VIDIOC_ENUMINPUT</constant></link>">
25 <!ENTITY VIDIOC-ENUMOUTPUT "<link linkend='vidioc-enumoutput'><constant>VIDIOC_ENUMOUTPUT</constant></link>"> 25 <!ENTITY VIDIOC-ENUMOUTPUT "<link linkend='vidioc-enumoutput'><constant>VIDIOC_ENUMOUTPUT</constant></link>">
26 <!ENTITY VIDIOC-ENUMSTD "<link linkend='vidioc-enumstd'><constant>VIDIOC_ENUMSTD</constant></link>"> 26 <!ENTITY VIDIOC-ENUMSTD "<link linkend='vidioc-enumstd'><constant>VIDIOC_ENUMSTD</constant></link>">
27 <!ENTITY VIDIOC-ENUM-DV-PRESETS "<link linkend='vidioc-enum-dv-presets'><constant>VIDIOC_ENUM_DV_PRESETS</constant></link>"> 27 <!ENTITY VIDIOC-ENUM-DV-PRESETS "<link linkend='vidioc-enum-dv-presets'><constant>VIDIOC_ENUM_DV_PRESETS</constant></link>">
28 <!ENTITY VIDIOC-ENUM-FMT "<link linkend='vidioc-enum-fmt'><constant>VIDIOC_ENUM_FMT</constant></link>"> 28 <!ENTITY VIDIOC-ENUM-FMT "<link linkend='vidioc-enum-fmt'><constant>VIDIOC_ENUM_FMT</constant></link>">
29 <!ENTITY VIDIOC-ENUM-FRAMEINTERVALS "<link linkend='vidioc-enum-frameintervals'><constant>VIDIOC_ENUM_FRAMEINTERVALS</constant></link>"> 29 <!ENTITY VIDIOC-ENUM-FRAMEINTERVALS "<link linkend='vidioc-enum-frameintervals'><constant>VIDIOC_ENUM_FRAMEINTERVALS</constant></link>">
30 <!ENTITY VIDIOC-ENUM-FRAMESIZES "<link linkend='vidioc-enum-framesizes'><constant>VIDIOC_ENUM_FRAMESIZES</constant></link>"> 30 <!ENTITY VIDIOC-ENUM-FRAMESIZES "<link linkend='vidioc-enum-framesizes'><constant>VIDIOC_ENUM_FRAMESIZES</constant></link>">
31 <!ENTITY VIDIOC-G-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_G_AUDIO</constant></link>"> 31 <!ENTITY VIDIOC-G-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_G_AUDIO</constant></link>">
32 <!ENTITY VIDIOC-G-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_G_AUDOUT</constant></link>"> 32 <!ENTITY VIDIOC-G-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_G_AUDOUT</constant></link>">
33 <!ENTITY VIDIOC-G-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_G_CROP</constant></link>"> 33 <!ENTITY VIDIOC-G-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_G_CROP</constant></link>">
34 <!ENTITY VIDIOC-G-CTRL "<link linkend='vidioc-g-ctrl'><constant>VIDIOC_G_CTRL</constant></link>"> 34 <!ENTITY VIDIOC-G-CTRL "<link linkend='vidioc-g-ctrl'><constant>VIDIOC_G_CTRL</constant></link>">
35 <!ENTITY VIDIOC-G-DV-PRESET "<link linkend='vidioc-g-dv-preset'><constant>VIDIOC_G_DV_PRESET</constant></link>"> 35 <!ENTITY VIDIOC-G-DV-PRESET "<link linkend='vidioc-g-dv-preset'><constant>VIDIOC_G_DV_PRESET</constant></link>">
36 <!ENTITY VIDIOC-G-DV-TIMINGS "<link linkend='vidioc-g-dv-timings'><constant>VIDIOC_G_DV_TIMINGS</constant></link>"> 36 <!ENTITY VIDIOC-G-DV-TIMINGS "<link linkend='vidioc-g-dv-timings'><constant>VIDIOC_G_DV_TIMINGS</constant></link>">
37 <!ENTITY VIDIOC-G-ENC-INDEX "<link linkend='vidioc-g-enc-index'><constant>VIDIOC_G_ENC_INDEX</constant></link>"> 37 <!ENTITY VIDIOC-G-ENC-INDEX "<link linkend='vidioc-g-enc-index'><constant>VIDIOC_G_ENC_INDEX</constant></link>">
38 <!ENTITY VIDIOC-G-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_G_EXT_CTRLS</constant></link>"> 38 <!ENTITY VIDIOC-G-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_G_EXT_CTRLS</constant></link>">
39 <!ENTITY VIDIOC-G-FBUF "<link linkend='vidioc-g-fbuf'><constant>VIDIOC_G_FBUF</constant></link>"> 39 <!ENTITY VIDIOC-G-FBUF "<link linkend='vidioc-g-fbuf'><constant>VIDIOC_G_FBUF</constant></link>">
40 <!ENTITY VIDIOC-G-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_G_FMT</constant></link>"> 40 <!ENTITY VIDIOC-G-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_G_FMT</constant></link>">
41 <!ENTITY VIDIOC-G-FREQUENCY "<link linkend='vidioc-g-frequency'><constant>VIDIOC_G_FREQUENCY</constant></link>"> 41 <!ENTITY VIDIOC-G-FREQUENCY "<link linkend='vidioc-g-frequency'><constant>VIDIOC_G_FREQUENCY</constant></link>">
42 <!ENTITY VIDIOC-G-INPUT "<link linkend='vidioc-g-input'><constant>VIDIOC_G_INPUT</constant></link>"> 42 <!ENTITY VIDIOC-G-INPUT "<link linkend='vidioc-g-input'><constant>VIDIOC_G_INPUT</constant></link>">
43 <!ENTITY VIDIOC-G-JPEGCOMP "<link linkend='vidioc-g-jpegcomp'><constant>VIDIOC_G_JPEGCOMP</constant></link>"> 43 <!ENTITY VIDIOC-G-JPEGCOMP "<link linkend='vidioc-g-jpegcomp'><constant>VIDIOC_G_JPEGCOMP</constant></link>">
44 <!ENTITY VIDIOC-G-MPEGCOMP "<link linkend=''><constant>VIDIOC_G_MPEGCOMP</constant></link>"> 44 <!ENTITY VIDIOC-G-MPEGCOMP "<link linkend=''><constant>VIDIOC_G_MPEGCOMP</constant></link>">
45 <!ENTITY VIDIOC-G-MODULATOR "<link linkend='vidioc-g-modulator'><constant>VIDIOC_G_MODULATOR</constant></link>"> 45 <!ENTITY VIDIOC-G-MODULATOR "<link linkend='vidioc-g-modulator'><constant>VIDIOC_G_MODULATOR</constant></link>">
46 <!ENTITY VIDIOC-G-OUTPUT "<link linkend='vidioc-g-output'><constant>VIDIOC_G_OUTPUT</constant></link>"> 46 <!ENTITY VIDIOC-G-OUTPUT "<link linkend='vidioc-g-output'><constant>VIDIOC_G_OUTPUT</constant></link>">
47 <!ENTITY VIDIOC-G-PARM "<link linkend='vidioc-g-parm'><constant>VIDIOC_G_PARM</constant></link>"> 47 <!ENTITY VIDIOC-G-PARM "<link linkend='vidioc-g-parm'><constant>VIDIOC_G_PARM</constant></link>">
48 <!ENTITY VIDIOC-G-PRIORITY "<link linkend='vidioc-g-priority'><constant>VIDIOC_G_PRIORITY</constant></link>"> 48 <!ENTITY VIDIOC-G-PRIORITY "<link linkend='vidioc-g-priority'><constant>VIDIOC_G_PRIORITY</constant></link>">
49 <!ENTITY VIDIOC-G-SLICED-VBI-CAP "<link linkend='vidioc-g-sliced-vbi-cap'><constant>VIDIOC_G_SLICED_VBI_CAP</constant></link>"> 49 <!ENTITY VIDIOC-G-SLICED-VBI-CAP "<link linkend='vidioc-g-sliced-vbi-cap'><constant>VIDIOC_G_SLICED_VBI_CAP</constant></link>">
50 <!ENTITY VIDIOC-G-STD "<link linkend='vidioc-g-std'><constant>VIDIOC_G_STD</constant></link>"> 50 <!ENTITY VIDIOC-G-STD "<link linkend='vidioc-g-std'><constant>VIDIOC_G_STD</constant></link>">
51 <!ENTITY VIDIOC-G-TUNER "<link linkend='vidioc-g-tuner'><constant>VIDIOC_G_TUNER</constant></link>"> 51 <!ENTITY VIDIOC-G-TUNER "<link linkend='vidioc-g-tuner'><constant>VIDIOC_G_TUNER</constant></link>">
52 <!ENTITY VIDIOC-LOG-STATUS "<link linkend='vidioc-log-status'><constant>VIDIOC_LOG_STATUS</constant></link>"> 52 <!ENTITY VIDIOC-LOG-STATUS "<link linkend='vidioc-log-status'><constant>VIDIOC_LOG_STATUS</constant></link>">
53 <!ENTITY VIDIOC-OVERLAY "<link linkend='vidioc-overlay'><constant>VIDIOC_OVERLAY</constant></link>"> 53 <!ENTITY VIDIOC-OVERLAY "<link linkend='vidioc-overlay'><constant>VIDIOC_OVERLAY</constant></link>">
54 <!ENTITY VIDIOC-QBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_QBUF</constant></link>"> 54 <!ENTITY VIDIOC-QBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_QBUF</constant></link>">
55 <!ENTITY VIDIOC-QUERYBUF "<link linkend='vidioc-querybuf'><constant>VIDIOC_QUERYBUF</constant></link>"> 55 <!ENTITY VIDIOC-QUERYBUF "<link linkend='vidioc-querybuf'><constant>VIDIOC_QUERYBUF</constant></link>">
56 <!ENTITY VIDIOC-QUERYCAP "<link linkend='vidioc-querycap'><constant>VIDIOC_QUERYCAP</constant></link>"> 56 <!ENTITY VIDIOC-QUERYCAP "<link linkend='vidioc-querycap'><constant>VIDIOC_QUERYCAP</constant></link>">
57 <!ENTITY VIDIOC-QUERYCTRL "<link linkend='vidioc-queryctrl'><constant>VIDIOC_QUERYCTRL</constant></link>"> 57 <!ENTITY VIDIOC-QUERYCTRL "<link linkend='vidioc-queryctrl'><constant>VIDIOC_QUERYCTRL</constant></link>">
58 <!ENTITY VIDIOC-QUERYMENU "<link linkend='vidioc-queryctrl'><constant>VIDIOC_QUERYMENU</constant></link>"> 58 <!ENTITY VIDIOC-QUERYMENU "<link linkend='vidioc-queryctrl'><constant>VIDIOC_QUERYMENU</constant></link>">
59 <!ENTITY VIDIOC-QUERYSTD "<link linkend='vidioc-querystd'><constant>VIDIOC_QUERYSTD</constant></link>"> 59 <!ENTITY VIDIOC-QUERYSTD "<link linkend='vidioc-querystd'><constant>VIDIOC_QUERYSTD</constant></link>">
60 <!ENTITY VIDIOC-QUERY-DV-PRESET "<link linkend='vidioc-query-dv-preset'><constant>VIDIOC_QUERY_DV_PRESET</constant></link>"> 60 <!ENTITY VIDIOC-QUERY-DV-PRESET "<link linkend='vidioc-query-dv-preset'><constant>VIDIOC_QUERY_DV_PRESET</constant></link>">
61 <!ENTITY VIDIOC-REQBUFS "<link linkend='vidioc-reqbufs'><constant>VIDIOC_REQBUFS</constant></link>"> 61 <!ENTITY VIDIOC-REQBUFS "<link linkend='vidioc-reqbufs'><constant>VIDIOC_REQBUFS</constant></link>">
62 <!ENTITY VIDIOC-STREAMOFF "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMOFF</constant></link>"> 62 <!ENTITY VIDIOC-STREAMOFF "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMOFF</constant></link>">
63 <!ENTITY VIDIOC-STREAMON "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMON</constant></link>"> 63 <!ENTITY VIDIOC-STREAMON "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMON</constant></link>">
64 <!ENTITY VIDIOC-SUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_SUBSCRIBE_EVENT</constant></link>"> 64 <!ENTITY VIDIOC-SUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_SUBSCRIBE_EVENT</constant></link>">
65 <!ENTITY VIDIOC-S-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_S_AUDIO</constant></link>"> 65 <!ENTITY VIDIOC-S-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_S_AUDIO</constant></link>">
66 <!ENTITY VIDIOC-S-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_S_AUDOUT</constant></link>"> 66 <!ENTITY VIDIOC-S-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_S_AUDOUT</constant></link>">
67 <!ENTITY VIDIOC-S-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_S_CROP</constant></link>"> 67 <!ENTITY VIDIOC-S-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_S_CROP</constant></link>">
68 <!ENTITY VIDIOC-S-CTRL "<link linkend='vidioc-g-ctrl'><constant>VIDIOC_S_CTRL</constant></link>"> 68 <!ENTITY VIDIOC-S-CTRL "<link linkend='vidioc-g-ctrl'><constant>VIDIOC_S_CTRL</constant></link>">
69 <!ENTITY VIDIOC-S-DV-PRESET "<link linkend='vidioc-g-dv-preset'><constant>VIDIOC_S_DV_PRESET</constant></link>"> 69 <!ENTITY VIDIOC-S-DV-PRESET "<link linkend='vidioc-g-dv-preset'><constant>VIDIOC_S_DV_PRESET</constant></link>">
70 <!ENTITY VIDIOC-S-DV-TIMINGS "<link linkend='vidioc-g-dv-timings'><constant>VIDIOC_S_DV_TIMINGS</constant></link>"> 70 <!ENTITY VIDIOC-S-DV-TIMINGS "<link linkend='vidioc-g-dv-timings'><constant>VIDIOC_S_DV_TIMINGS</constant></link>">
71 <!ENTITY VIDIOC-S-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_S_EXT_CTRLS</constant></link>"> 71 <!ENTITY VIDIOC-S-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_S_EXT_CTRLS</constant></link>">
72 <!ENTITY VIDIOC-S-FBUF "<link linkend='vidioc-g-fbuf'><constant>VIDIOC_S_FBUF</constant></link>"> 72 <!ENTITY VIDIOC-S-FBUF "<link linkend='vidioc-g-fbuf'><constant>VIDIOC_S_FBUF</constant></link>">
73 <!ENTITY VIDIOC-S-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_S_FMT</constant></link>"> 73 <!ENTITY VIDIOC-S-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_S_FMT</constant></link>">
74 <!ENTITY VIDIOC-S-FREQUENCY "<link linkend='vidioc-g-frequency'><constant>VIDIOC_S_FREQUENCY</constant></link>"> 74 <!ENTITY VIDIOC-S-FREQUENCY "<link linkend='vidioc-g-frequency'><constant>VIDIOC_S_FREQUENCY</constant></link>">
75 <!ENTITY VIDIOC-S-HW-FREQ-SEEK "<link linkend='vidioc-s-hw-freq-seek'><constant>VIDIOC_S_HW_FREQ_SEEK</constant></link>"> 75 <!ENTITY VIDIOC-S-HW-FREQ-SEEK "<link linkend='vidioc-s-hw-freq-seek'><constant>VIDIOC_S_HW_FREQ_SEEK</constant></link>">
76 <!ENTITY VIDIOC-S-INPUT "<link linkend='vidioc-g-input'><constant>VIDIOC_S_INPUT</constant></link>"> 76 <!ENTITY VIDIOC-S-INPUT "<link linkend='vidioc-g-input'><constant>VIDIOC_S_INPUT</constant></link>">
77 <!ENTITY VIDIOC-S-JPEGCOMP "<link linkend='vidioc-g-jpegcomp'><constant>VIDIOC_S_JPEGCOMP</constant></link>"> 77 <!ENTITY VIDIOC-S-JPEGCOMP "<link linkend='vidioc-g-jpegcomp'><constant>VIDIOC_S_JPEGCOMP</constant></link>">
78 <!ENTITY VIDIOC-S-MPEGCOMP "<link linkend=''><constant>VIDIOC_S_MPEGCOMP</constant></link>"> 78 <!ENTITY VIDIOC-S-MPEGCOMP "<link linkend=''><constant>VIDIOC_S_MPEGCOMP</constant></link>">
79 <!ENTITY VIDIOC-S-MODULATOR "<link linkend='vidioc-g-modulator'><constant>VIDIOC_S_MODULATOR</constant></link>"> 79 <!ENTITY VIDIOC-S-MODULATOR "<link linkend='vidioc-g-modulator'><constant>VIDIOC_S_MODULATOR</constant></link>">
80 <!ENTITY VIDIOC-S-OUTPUT "<link linkend='vidioc-g-output'><constant>VIDIOC_S_OUTPUT</constant></link>"> 80 <!ENTITY VIDIOC-S-OUTPUT "<link linkend='vidioc-g-output'><constant>VIDIOC_S_OUTPUT</constant></link>">
81 <!ENTITY VIDIOC-S-PARM "<link linkend='vidioc-g-parm'><constant>VIDIOC_S_PARM</constant></link>"> 81 <!ENTITY VIDIOC-S-PARM "<link linkend='vidioc-g-parm'><constant>VIDIOC_S_PARM</constant></link>">
82 <!ENTITY VIDIOC-S-PRIORITY "<link linkend='vidioc-g-priority'><constant>VIDIOC_S_PRIORITY</constant></link>"> 82 <!ENTITY VIDIOC-S-PRIORITY "<link linkend='vidioc-g-priority'><constant>VIDIOC_S_PRIORITY</constant></link>">
83 <!ENTITY VIDIOC-S-STD "<link linkend='vidioc-g-std'><constant>VIDIOC_S_STD</constant></link>"> 83 <!ENTITY VIDIOC-S-STD "<link linkend='vidioc-g-std'><constant>VIDIOC_S_STD</constant></link>">
84 <!ENTITY VIDIOC-S-TUNER "<link linkend='vidioc-g-tuner'><constant>VIDIOC_S_TUNER</constant></link>"> 84 <!ENTITY VIDIOC-S-TUNER "<link linkend='vidioc-g-tuner'><constant>VIDIOC_S_TUNER</constant></link>">
85 <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> 85 <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>">
86 <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> 86 <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>">
87 <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> 87 <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>">
88 <!ENTITY VIDIOC-UNSUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_UNSUBSCRIBE_EVENT</constant></link>"> 88 <!ENTITY VIDIOC-UNSUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_UNSUBSCRIBE_EVENT</constant></link>">
89 89
90 <!-- Types --> 90 <!-- Types -->
91 <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> 91 <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>">
92 92
93 <!-- Enums --> 93 <!-- Enums -->
94 <!ENTITY v4l2-buf-type "enum&nbsp;<link linkend='v4l2-buf-type'>v4l2_buf_type</link>"> 94 <!ENTITY v4l2-buf-type "enum&nbsp;<link linkend='v4l2-buf-type'>v4l2_buf_type</link>">
95 <!ENTITY v4l2-colorspace "enum&nbsp;<link linkend='v4l2-colorspace'>v4l2_colorspace</link>"> 95 <!ENTITY v4l2-colorspace "enum&nbsp;<link linkend='v4l2-colorspace'>v4l2_colorspace</link>">
96 <!ENTITY v4l2-ctrl-type "enum&nbsp;<link linkend='v4l2-ctrl-type'>v4l2_ctrl_type</link>"> 96 <!ENTITY v4l2-ctrl-type "enum&nbsp;<link linkend='v4l2-ctrl-type'>v4l2_ctrl_type</link>">
97 <!ENTITY v4l2-exposure-auto-type "enum&nbsp;<link linkend='v4l2-exposure-auto-type'>v4l2_exposure_auto_type</link>"> 97 <!ENTITY v4l2-exposure-auto-type "enum&nbsp;<link linkend='v4l2-exposure-auto-type'>v4l2_exposure_auto_type</link>">
98 <!ENTITY v4l2-field "enum&nbsp;<link linkend='v4l2-field'>v4l2_field</link>"> 98 <!ENTITY v4l2-field "enum&nbsp;<link linkend='v4l2-field'>v4l2_field</link>">
99 <!ENTITY v4l2-frmivaltypes "enum&nbsp;<link linkend='v4l2-frmivaltypes'>v4l2_frmivaltypes</link>"> 99 <!ENTITY v4l2-frmivaltypes "enum&nbsp;<link linkend='v4l2-frmivaltypes'>v4l2_frmivaltypes</link>">
100 <!ENTITY v4l2-frmsizetypes "enum&nbsp;<link linkend='v4l2-frmsizetypes'>v4l2_frmsizetypes</link>"> 100 <!ENTITY v4l2-frmsizetypes "enum&nbsp;<link linkend='v4l2-frmsizetypes'>v4l2_frmsizetypes</link>">
101 <!ENTITY v4l2-memory "enum&nbsp;<link linkend='v4l2-memory'>v4l2_memory</link>"> 101 <!ENTITY v4l2-memory "enum&nbsp;<link linkend='v4l2-memory'>v4l2_memory</link>">
102 <!ENTITY v4l2-mpeg-audio-ac3-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-ac3-bitrate'>v4l2_mpeg_audio_ac3_bitrate</link>"> 102 <!ENTITY v4l2-mpeg-audio-ac3-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-ac3-bitrate'>v4l2_mpeg_audio_ac3_bitrate</link>">
103 <!ENTITY v4l2-mpeg-audio-crc "enum&nbsp;<link linkend='v4l2-mpeg-audio-crc'>v4l2_mpeg_audio_crc</link>"> 103 <!ENTITY v4l2-mpeg-audio-crc "enum&nbsp;<link linkend='v4l2-mpeg-audio-crc'>v4l2_mpeg_audio_crc</link>">
104 <!ENTITY v4l2-mpeg-audio-emphasis "enum&nbsp;<link linkend='v4l2-mpeg-audio-emphasis'>v4l2_mpeg_audio_emphasis</link>"> 104 <!ENTITY v4l2-mpeg-audio-emphasis "enum&nbsp;<link linkend='v4l2-mpeg-audio-emphasis'>v4l2_mpeg_audio_emphasis</link>">
105 <!ENTITY v4l2-mpeg-audio-encoding "enum&nbsp;<link linkend='v4l2-mpeg-audio-encoding'>v4l2_mpeg_audio_encoding</link>"> 105 <!ENTITY v4l2-mpeg-audio-encoding "enum&nbsp;<link linkend='v4l2-mpeg-audio-encoding'>v4l2_mpeg_audio_encoding</link>">
106 <!ENTITY v4l2-mpeg-audio-l1-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l1-bitrate'>v4l2_mpeg_audio_l1_bitrate</link>"> 106 <!ENTITY v4l2-mpeg-audio-l1-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l1-bitrate'>v4l2_mpeg_audio_l1_bitrate</link>">
107 <!ENTITY v4l2-mpeg-audio-l2-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l2-bitrate'>v4l2_mpeg_audio_l2_bitrate</link>"> 107 <!ENTITY v4l2-mpeg-audio-l2-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l2-bitrate'>v4l2_mpeg_audio_l2_bitrate</link>">
108 <!ENTITY v4l2-mpeg-audio-l3-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l3-bitrate'>v4l2_mpeg_audio_l3_bitrate</link>"> 108 <!ENTITY v4l2-mpeg-audio-l3-bitrate "enum&nbsp;<link linkend='v4l2-mpeg-audio-l3-bitrate'>v4l2_mpeg_audio_l3_bitrate</link>">
109 <!ENTITY v4l2-mpeg-audio-mode "enum&nbsp;<link linkend='v4l2-mpeg-audio-mode'>v4l2_mpeg_audio_mode</link>"> 109 <!ENTITY v4l2-mpeg-audio-mode "enum&nbsp;<link linkend='v4l2-mpeg-audio-mode'>v4l2_mpeg_audio_mode</link>">
110 <!ENTITY v4l2-mpeg-audio-mode-extension "enum&nbsp;<link linkend='v4l2-mpeg-audio-mode-extension'>v4l2_mpeg_audio_mode_extension</link>"> 110 <!ENTITY v4l2-mpeg-audio-mode-extension "enum&nbsp;<link linkend='v4l2-mpeg-audio-mode-extension'>v4l2_mpeg_audio_mode_extension</link>">
111 <!ENTITY v4l2-mpeg-audio-sampling-freq "enum&nbsp;<link linkend='v4l2-mpeg-audio-sampling-freq'>v4l2_mpeg_audio_sampling_freq</link>"> 111 <!ENTITY v4l2-mpeg-audio-sampling-freq "enum&nbsp;<link linkend='v4l2-mpeg-audio-sampling-freq'>v4l2_mpeg_audio_sampling_freq</link>">
112 <!ENTITY chroma-spatial-filter-type "enum&nbsp;<link linkend='chroma-spatial-filter-type'>v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type</link>"> 112 <!ENTITY chroma-spatial-filter-type "enum&nbsp;<link linkend='chroma-spatial-filter-type'>v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type</link>">
113 <!ENTITY luma-spatial-filter-type "enum&nbsp;<link linkend='luma-spatial-filter-type'>v4l2_mpeg_cx2341x_video_luma_spatial_filter_type</link>"> 113 <!ENTITY luma-spatial-filter-type "enum&nbsp;<link linkend='luma-spatial-filter-type'>v4l2_mpeg_cx2341x_video_luma_spatial_filter_type</link>">
114 <!ENTITY v4l2-mpeg-cx2341x-video-median-filter-type "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-median-filter-type'>v4l2_mpeg_cx2341x_video_median_filter_type</link>"> 114 <!ENTITY v4l2-mpeg-cx2341x-video-median-filter-type "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-median-filter-type'>v4l2_mpeg_cx2341x_video_median_filter_type</link>">
115 <!ENTITY v4l2-mpeg-cx2341x-video-spatial-filter-mode "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-spatial-filter-mode'>v4l2_mpeg_cx2341x_video_spatial_filter_mode</link>"> 115 <!ENTITY v4l2-mpeg-cx2341x-video-spatial-filter-mode "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-spatial-filter-mode'>v4l2_mpeg_cx2341x_video_spatial_filter_mode</link>">
116 <!ENTITY v4l2-mpeg-cx2341x-video-temporal-filter-mode "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-temporal-filter-mode'>v4l2_mpeg_cx2341x_video_temporal_filter_mode</link>"> 116 <!ENTITY v4l2-mpeg-cx2341x-video-temporal-filter-mode "enum&nbsp;<link linkend='v4l2-mpeg-cx2341x-video-temporal-filter-mode'>v4l2_mpeg_cx2341x_video_temporal_filter_mode</link>">
117 <!ENTITY v4l2-mpeg-stream-type "enum&nbsp;<link linkend='v4l2-mpeg-stream-type'>v4l2_mpeg_stream_type</link>"> 117 <!ENTITY v4l2-mpeg-stream-type "enum&nbsp;<link linkend='v4l2-mpeg-stream-type'>v4l2_mpeg_stream_type</link>">
118 <!ENTITY v4l2-mpeg-stream-vbi-fmt "enum&nbsp;<link linkend='v4l2-mpeg-stream-vbi-fmt'>v4l2_mpeg_stream_vbi_fmt</link>"> 118 <!ENTITY v4l2-mpeg-stream-vbi-fmt "enum&nbsp;<link linkend='v4l2-mpeg-stream-vbi-fmt'>v4l2_mpeg_stream_vbi_fmt</link>">
119 <!ENTITY v4l2-mpeg-video-aspect "enum&nbsp;<link linkend='v4l2-mpeg-video-aspect'>v4l2_mpeg_video_aspect</link>"> 119 <!ENTITY v4l2-mpeg-video-aspect "enum&nbsp;<link linkend='v4l2-mpeg-video-aspect'>v4l2_mpeg_video_aspect</link>">
120 <!ENTITY v4l2-mpeg-video-bitrate-mode "enum&nbsp;<link linkend='v4l2-mpeg-video-bitrate-mode'>v4l2_mpeg_video_bitrate_mode</link>"> 120 <!ENTITY v4l2-mpeg-video-bitrate-mode "enum&nbsp;<link linkend='v4l2-mpeg-video-bitrate-mode'>v4l2_mpeg_video_bitrate_mode</link>">
121 <!ENTITY v4l2-mpeg-video-encoding "enum&nbsp;<link linkend='v4l2-mpeg-video-encoding'>v4l2_mpeg_video_encoding</link>"> 121 <!ENTITY v4l2-mpeg-video-encoding "enum&nbsp;<link linkend='v4l2-mpeg-video-encoding'>v4l2_mpeg_video_encoding</link>">
122 <!ENTITY v4l2-power-line-frequency "enum&nbsp;<link linkend='v4l2-power-line-frequency'>v4l2_power_line_frequency</link>"> 122 <!ENTITY v4l2-power-line-frequency "enum&nbsp;<link linkend='v4l2-power-line-frequency'>v4l2_power_line_frequency</link>">
123 <!ENTITY v4l2-priority "enum&nbsp;<link linkend='v4l2-priority'>v4l2_priority</link>"> 123 <!ENTITY v4l2-priority "enum&nbsp;<link linkend='v4l2-priority'>v4l2_priority</link>">
124 <!ENTITY v4l2-tuner-type "enum&nbsp;<link linkend='v4l2-tuner-type'>v4l2_tuner_type</link>"> 124 <!ENTITY v4l2-tuner-type "enum&nbsp;<link linkend='v4l2-tuner-type'>v4l2_tuner_type</link>">
125 <!ENTITY v4l2-preemphasis "enum&nbsp;<link linkend='v4l2-preemphasis'>v4l2_preemphasis</link>"> 125 <!ENTITY v4l2-preemphasis "enum&nbsp;<link linkend='v4l2-preemphasis'>v4l2_preemphasis</link>">
126 126
127 <!-- Structures --> 127 <!-- Structures -->
128 <!ENTITY v4l2-audio "struct&nbsp;<link linkend='v4l2-audio'>v4l2_audio</link>"> 128 <!ENTITY v4l2-audio "struct&nbsp;<link linkend='v4l2-audio'>v4l2_audio</link>">
129 <!ENTITY v4l2-audioout "struct&nbsp;<link linkend='v4l2-audioout'>v4l2_audioout</link>"> 129 <!ENTITY v4l2-audioout "struct&nbsp;<link linkend='v4l2-audioout'>v4l2_audioout</link>">
130 <!ENTITY v4l2-bt-timings "struct&nbsp;<link linkend='v4l2-bt-timings'>v4l2_bt_timings</link>"> 130 <!ENTITY v4l2-bt-timings "struct&nbsp;<link linkend='v4l2-bt-timings'>v4l2_bt_timings</link>">
131 <!ENTITY v4l2-buffer "struct&nbsp;<link linkend='v4l2-buffer'>v4l2_buffer</link>"> 131 <!ENTITY v4l2-buffer "struct&nbsp;<link linkend='v4l2-buffer'>v4l2_buffer</link>">
132 <!ENTITY v4l2-plane "struct&nbsp;<link linkend='v4l2-plane'>v4l2_plane</link>">
132 <!ENTITY v4l2-capability "struct&nbsp;<link linkend='v4l2-capability'>v4l2_capability</link>"> 133 <!ENTITY v4l2-capability "struct&nbsp;<link linkend='v4l2-capability'>v4l2_capability</link>">
133 <!ENTITY v4l2-captureparm "struct&nbsp;<link linkend='v4l2-captureparm'>v4l2_captureparm</link>"> 134 <!ENTITY v4l2-captureparm "struct&nbsp;<link linkend='v4l2-captureparm'>v4l2_captureparm</link>">
134 <!ENTITY v4l2-clip "struct&nbsp;<link linkend='v4l2-clip'>v4l2_clip</link>"> 135 <!ENTITY v4l2-clip "struct&nbsp;<link linkend='v4l2-clip'>v4l2_clip</link>">
135 <!ENTITY v4l2-control "struct&nbsp;<link linkend='v4l2-control'>v4l2_control</link>"> 136 <!ENTITY v4l2-control "struct&nbsp;<link linkend='v4l2-control'>v4l2_control</link>">
136 <!ENTITY v4l2-crop "struct&nbsp;<link linkend='v4l2-crop'>v4l2_crop</link>"> 137 <!ENTITY v4l2-crop "struct&nbsp;<link linkend='v4l2-crop'>v4l2_crop</link>">
137 <!ENTITY v4l2-cropcap "struct&nbsp;<link linkend='v4l2-cropcap'>v4l2_cropcap</link>"> 138 <!ENTITY v4l2-cropcap "struct&nbsp;<link linkend='v4l2-cropcap'>v4l2_cropcap</link>">
138 <!ENTITY v4l2-dbg-chip-ident "struct&nbsp;<link linkend='v4l2-dbg-chip-ident'>v4l2_dbg_chip_ident</link>"> 139 <!ENTITY v4l2-dbg-chip-ident "struct&nbsp;<link linkend='v4l2-dbg-chip-ident'>v4l2_dbg_chip_ident</link>">
139 <!ENTITY v4l2-dbg-match "struct&nbsp;<link linkend='v4l2-dbg-match'>v4l2_dbg_match</link>"> 140 <!ENTITY v4l2-dbg-match "struct&nbsp;<link linkend='v4l2-dbg-match'>v4l2_dbg_match</link>">
140 <!ENTITY v4l2-dbg-register "struct&nbsp;<link linkend='v4l2-dbg-register'>v4l2_dbg_register</link>"> 141 <!ENTITY v4l2-dbg-register "struct&nbsp;<link linkend='v4l2-dbg-register'>v4l2_dbg_register</link>">
141 <!ENTITY v4l2-dv-enum-preset "struct&nbsp;<link linkend='v4l2-dv-enum-preset'>v4l2_dv_enum_preset</link>"> 142 <!ENTITY v4l2-dv-enum-preset "struct&nbsp;<link linkend='v4l2-dv-enum-preset'>v4l2_dv_enum_preset</link>">
142 <!ENTITY v4l2-dv-preset "struct&nbsp;<link linkend='v4l2-dv-preset'>v4l2_dv_preset</link>"> 143 <!ENTITY v4l2-dv-preset "struct&nbsp;<link linkend='v4l2-dv-preset'>v4l2_dv_preset</link>">
143 <!ENTITY v4l2-dv-timings "struct&nbsp;<link linkend='v4l2-dv-timings'>v4l2_dv_timings</link>"> 144 <!ENTITY v4l2-dv-timings "struct&nbsp;<link linkend='v4l2-dv-timings'>v4l2_dv_timings</link>">
144 <!ENTITY v4l2-enc-idx "struct&nbsp;<link linkend='v4l2-enc-idx'>v4l2_enc_idx</link>"> 145 <!ENTITY v4l2-enc-idx "struct&nbsp;<link linkend='v4l2-enc-idx'>v4l2_enc_idx</link>">
145 <!ENTITY v4l2-enc-idx-entry "struct&nbsp;<link linkend='v4l2-enc-idx-entry'>v4l2_enc_idx_entry</link>"> 146 <!ENTITY v4l2-enc-idx-entry "struct&nbsp;<link linkend='v4l2-enc-idx-entry'>v4l2_enc_idx_entry</link>">
146 <!ENTITY v4l2-encoder-cmd "struct&nbsp;<link linkend='v4l2-encoder-cmd'>v4l2_encoder_cmd</link>"> 147 <!ENTITY v4l2-encoder-cmd "struct&nbsp;<link linkend='v4l2-encoder-cmd'>v4l2_encoder_cmd</link>">
147 <!ENTITY v4l2-event "struct&nbsp;<link linkend='v4l2-event'>v4l2_event</link>"> 148 <!ENTITY v4l2-event "struct&nbsp;<link linkend='v4l2-event'>v4l2_event</link>">
148 <!ENTITY v4l2-event-subscription "struct&nbsp;<link linkend='v4l2-event-subscription'>v4l2_event_subscription</link>"> 149 <!ENTITY v4l2-event-subscription "struct&nbsp;<link linkend='v4l2-event-subscription'>v4l2_event_subscription</link>">
149 <!ENTITY v4l2-event-vsync "struct&nbsp;<link linkend='v4l2-event-vsync'>v4l2_event_vsync</link>"> 150 <!ENTITY v4l2-event-vsync "struct&nbsp;<link linkend='v4l2-event-vsync'>v4l2_event_vsync</link>">
150 <!ENTITY v4l2-ext-control "struct&nbsp;<link linkend='v4l2-ext-control'>v4l2_ext_control</link>"> 151 <!ENTITY v4l2-ext-control "struct&nbsp;<link linkend='v4l2-ext-control'>v4l2_ext_control</link>">
151 <!ENTITY v4l2-ext-controls "struct&nbsp;<link linkend='v4l2-ext-controls'>v4l2_ext_controls</link>"> 152 <!ENTITY v4l2-ext-controls "struct&nbsp;<link linkend='v4l2-ext-controls'>v4l2_ext_controls</link>">
152 <!ENTITY v4l2-fmtdesc "struct&nbsp;<link linkend='v4l2-fmtdesc'>v4l2_fmtdesc</link>"> 153 <!ENTITY v4l2-fmtdesc "struct&nbsp;<link linkend='v4l2-fmtdesc'>v4l2_fmtdesc</link>">
153 <!ENTITY v4l2-format "struct&nbsp;<link linkend='v4l2-format'>v4l2_format</link>"> 154 <!ENTITY v4l2-format "struct&nbsp;<link linkend='v4l2-format'>v4l2_format</link>">
154 <!ENTITY v4l2-fract "struct&nbsp;<link linkend='v4l2-fract'>v4l2_fract</link>"> 155 <!ENTITY v4l2-fract "struct&nbsp;<link linkend='v4l2-fract'>v4l2_fract</link>">
155 <!ENTITY v4l2-framebuffer "struct&nbsp;<link linkend='v4l2-framebuffer'>v4l2_framebuffer</link>"> 156 <!ENTITY v4l2-framebuffer "struct&nbsp;<link linkend='v4l2-framebuffer'>v4l2_framebuffer</link>">
156 <!ENTITY v4l2-frequency "struct&nbsp;<link linkend='v4l2-frequency'>v4l2_frequency</link>"> 157 <!ENTITY v4l2-frequency "struct&nbsp;<link linkend='v4l2-frequency'>v4l2_frequency</link>">
157 <!ENTITY v4l2-frmival-stepwise "struct&nbsp;<link linkend='v4l2-frmival-stepwise'>v4l2_frmival_stepwise</link>"> 158 <!ENTITY v4l2-frmival-stepwise "struct&nbsp;<link linkend='v4l2-frmival-stepwise'>v4l2_frmival_stepwise</link>">
158 <!ENTITY v4l2-frmivalenum "struct&nbsp;<link linkend='v4l2-frmivalenum'>v4l2_frmivalenum</link>"> 159 <!ENTITY v4l2-frmivalenum "struct&nbsp;<link linkend='v4l2-frmivalenum'>v4l2_frmivalenum</link>">
159 <!ENTITY v4l2-frmsize-discrete "struct&nbsp;<link linkend='v4l2-frmsize-discrete'>v4l2_frmsize_discrete</link>"> 160 <!ENTITY v4l2-frmsize-discrete "struct&nbsp;<link linkend='v4l2-frmsize-discrete'>v4l2_frmsize_discrete</link>">
160 <!ENTITY v4l2-frmsize-stepwise "struct&nbsp;<link linkend='v4l2-frmsize-stepwise'>v4l2_frmsize_stepwise</link>"> 161 <!ENTITY v4l2-frmsize-stepwise "struct&nbsp;<link linkend='v4l2-frmsize-stepwise'>v4l2_frmsize_stepwise</link>">
161 <!ENTITY v4l2-frmsizeenum "struct&nbsp;<link linkend='v4l2-frmsizeenum'>v4l2_frmsizeenum</link>"> 162 <!ENTITY v4l2-frmsizeenum "struct&nbsp;<link linkend='v4l2-frmsizeenum'>v4l2_frmsizeenum</link>">
162 <!ENTITY v4l2-hw-freq-seek "struct&nbsp;<link linkend='v4l2-hw-freq-seek'>v4l2_hw_freq_seek</link>"> 163 <!ENTITY v4l2-hw-freq-seek "struct&nbsp;<link linkend='v4l2-hw-freq-seek'>v4l2_hw_freq_seek</link>">
163 <!ENTITY v4l2-input "struct&nbsp;<link linkend='v4l2-input'>v4l2_input</link>"> 164 <!ENTITY v4l2-input "struct&nbsp;<link linkend='v4l2-input'>v4l2_input</link>">
164 <!ENTITY v4l2-jpegcompression "struct&nbsp;<link linkend='v4l2-jpegcompression'>v4l2_jpegcompression</link>"> 165 <!ENTITY v4l2-jpegcompression "struct&nbsp;<link linkend='v4l2-jpegcompression'>v4l2_jpegcompression</link>">
165 <!ENTITY v4l2-modulator "struct&nbsp;<link linkend='v4l2-modulator'>v4l2_modulator</link>"> 166 <!ENTITY v4l2-modulator "struct&nbsp;<link linkend='v4l2-modulator'>v4l2_modulator</link>">
166 <!ENTITY v4l2-mpeg-vbi-fmt-ivtv "struct&nbsp;<link linkend='v4l2-mpeg-vbi-fmt-ivtv'>v4l2_mpeg_vbi_fmt_ivtv</link>"> 167 <!ENTITY v4l2-mpeg-vbi-fmt-ivtv "struct&nbsp;<link linkend='v4l2-mpeg-vbi-fmt-ivtv'>v4l2_mpeg_vbi_fmt_ivtv</link>">
167 <!ENTITY v4l2-output "struct&nbsp;<link linkend='v4l2-output'>v4l2_output</link>"> 168 <!ENTITY v4l2-output "struct&nbsp;<link linkend='v4l2-output'>v4l2_output</link>">
168 <!ENTITY v4l2-outputparm "struct&nbsp;<link linkend='v4l2-outputparm'>v4l2_outputparm</link>"> 169 <!ENTITY v4l2-outputparm "struct&nbsp;<link linkend='v4l2-outputparm'>v4l2_outputparm</link>">
169 <!ENTITY v4l2-pix-format "struct&nbsp;<link linkend='v4l2-pix-format'>v4l2_pix_format</link>"> 170 <!ENTITY v4l2-pix-format "struct&nbsp;<link linkend='v4l2-pix-format'>v4l2_pix_format</link>">
171 <!ENTITY v4l2-pix-format-mplane "struct&nbsp;<link linkend='v4l2-pix-format-mplane'>v4l2_pix_format_mplane</link>">
172 <!ENTITY v4l2-plane-pix-format "struct&nbsp;<link linkend='v4l2-plane-pix-format'>v4l2_plane_pix_format</link>">
170 <!ENTITY v4l2-queryctrl "struct&nbsp;<link linkend='v4l2-queryctrl'>v4l2_queryctrl</link>"> 173 <!ENTITY v4l2-queryctrl "struct&nbsp;<link linkend='v4l2-queryctrl'>v4l2_queryctrl</link>">
171 <!ENTITY v4l2-querymenu "struct&nbsp;<link linkend='v4l2-querymenu'>v4l2_querymenu</link>"> 174 <!ENTITY v4l2-querymenu "struct&nbsp;<link linkend='v4l2-querymenu'>v4l2_querymenu</link>">
172 <!ENTITY v4l2-rect "struct&nbsp;<link linkend='v4l2-rect'>v4l2_rect</link>"> 175 <!ENTITY v4l2-rect "struct&nbsp;<link linkend='v4l2-rect'>v4l2_rect</link>">
173 <!ENTITY v4l2-requestbuffers "struct&nbsp;<link linkend='v4l2-requestbuffers'>v4l2_requestbuffers</link>"> 176 <!ENTITY v4l2-requestbuffers "struct&nbsp;<link linkend='v4l2-requestbuffers'>v4l2_requestbuffers</link>">
174 <!ENTITY v4l2-sliced-vbi-cap "struct&nbsp;<link linkend='v4l2-sliced-vbi-cap'>v4l2_sliced_vbi_cap</link>"> 177 <!ENTITY v4l2-sliced-vbi-cap "struct&nbsp;<link linkend='v4l2-sliced-vbi-cap'>v4l2_sliced_vbi_cap</link>">
175 <!ENTITY v4l2-sliced-vbi-data "struct&nbsp;<link linkend='v4l2-sliced-vbi-data'>v4l2_sliced_vbi_data</link>"> 178 <!ENTITY v4l2-sliced-vbi-data "struct&nbsp;<link linkend='v4l2-sliced-vbi-data'>v4l2_sliced_vbi_data</link>">
176 <!ENTITY v4l2-sliced-vbi-format "struct&nbsp;<link linkend='v4l2-sliced-vbi-format'>v4l2_sliced_vbi_format</link>"> 179 <!ENTITY v4l2-sliced-vbi-format "struct&nbsp;<link linkend='v4l2-sliced-vbi-format'>v4l2_sliced_vbi_format</link>">
177 <!ENTITY v4l2-standard "struct&nbsp;<link linkend='v4l2-standard'>v4l2_standard</link>"> 180 <!ENTITY v4l2-standard "struct&nbsp;<link linkend='v4l2-standard'>v4l2_standard</link>">
178 <!ENTITY v4l2-streamparm "struct&nbsp;<link linkend='v4l2-streamparm'>v4l2_streamparm</link>"> 181 <!ENTITY v4l2-streamparm "struct&nbsp;<link linkend='v4l2-streamparm'>v4l2_streamparm</link>">
179 <!ENTITY v4l2-timecode "struct&nbsp;<link linkend='v4l2-timecode'>v4l2_timecode</link>"> 182 <!ENTITY v4l2-timecode "struct&nbsp;<link linkend='v4l2-timecode'>v4l2_timecode</link>">
180 <!ENTITY v4l2-tuner "struct&nbsp;<link linkend='v4l2-tuner'>v4l2_tuner</link>"> 183 <!ENTITY v4l2-tuner "struct&nbsp;<link linkend='v4l2-tuner'>v4l2_tuner</link>">
181 <!ENTITY v4l2-vbi-format "struct&nbsp;<link linkend='v4l2-vbi-format'>v4l2_vbi_format</link>"> 184 <!ENTITY v4l2-vbi-format "struct&nbsp;<link linkend='v4l2-vbi-format'>v4l2_vbi_format</link>">
182 <!ENTITY v4l2-window "struct&nbsp;<link linkend='v4l2-window'>v4l2_window</link>"> 185 <!ENTITY v4l2-window "struct&nbsp;<link linkend='v4l2-window'>v4l2_window</link>">
183 186
184 <!-- Error Codes --> 187 <!-- Error Codes -->
185 <!ENTITY EACCES "<errorcode>EACCES</errorcode> error code"> 188 <!ENTITY EACCES "<errorcode>EACCES</errorcode> error code">
186 <!ENTITY EAGAIN "<errorcode>EAGAIN</errorcode> error code"> 189 <!ENTITY EAGAIN "<errorcode>EAGAIN</errorcode> error code">
187 <!ENTITY EBADF "<errorcode>EBADF</errorcode> error code"> 190 <!ENTITY EBADF "<errorcode>EBADF</errorcode> error code">
188 <!ENTITY EBUSY "<errorcode>EBUSY</errorcode> error code"> 191 <!ENTITY EBUSY "<errorcode>EBUSY</errorcode> error code">
189 <!ENTITY EFAULT "<errorcode>EFAULT</errorcode> error code"> 192 <!ENTITY EFAULT "<errorcode>EFAULT</errorcode> error code">
190 <!ENTITY EIO "<errorcode>EIO</errorcode> error code"> 193 <!ENTITY EIO "<errorcode>EIO</errorcode> error code">
191 <!ENTITY EINTR "<errorcode>EINTR</errorcode> error code"> 194 <!ENTITY EINTR "<errorcode>EINTR</errorcode> error code">
192 <!ENTITY EINVAL "<errorcode>EINVAL</errorcode> error code"> 195 <!ENTITY EINVAL "<errorcode>EINVAL</errorcode> error code">
193 <!ENTITY ENFILE "<errorcode>ENFILE</errorcode> error code"> 196 <!ENTITY ENFILE "<errorcode>ENFILE</errorcode> error code">
194 <!ENTITY ENOMEM "<errorcode>ENOMEM</errorcode> error code"> 197 <!ENTITY ENOMEM "<errorcode>ENOMEM</errorcode> error code">
195 <!ENTITY ENOSPC "<errorcode>ENOSPC</errorcode> error code"> 198 <!ENTITY ENOSPC "<errorcode>ENOSPC</errorcode> error code">
196 <!ENTITY ENOTTY "<errorcode>ENOTTY</errorcode> error code"> 199 <!ENTITY ENOTTY "<errorcode>ENOTTY</errorcode> error code">
197 <!ENTITY ENXIO "<errorcode>ENXIO</errorcode> error code"> 200 <!ENTITY ENXIO "<errorcode>ENXIO</errorcode> error code">
198 <!ENTITY EMFILE "<errorcode>EMFILE</errorcode> error code"> 201 <!ENTITY EMFILE "<errorcode>EMFILE</errorcode> error code">
199 <!ENTITY EPERM "<errorcode>EPERM</errorcode> error code"> 202 <!ENTITY EPERM "<errorcode>EPERM</errorcode> error code">
200 <!ENTITY ERANGE "<errorcode>ERANGE</errorcode> error code"> 203 <!ENTITY ERANGE "<errorcode>ERANGE</errorcode> error code">
201 204
202 <!-- Subsections --> 205 <!-- Subsections -->
203 <!ENTITY sub-biblio SYSTEM "v4l/biblio.xml"> 206 <!ENTITY sub-biblio SYSTEM "v4l/biblio.xml">
204 <!ENTITY sub-common SYSTEM "v4l/common.xml"> 207 <!ENTITY sub-common SYSTEM "v4l/common.xml">
208 <!ENTITY sub-planar-apis SYSTEM "v4l/planar-apis.xml">
205 <!ENTITY sub-compat SYSTEM "v4l/compat.xml"> 209 <!ENTITY sub-compat SYSTEM "v4l/compat.xml">
206 <!ENTITY sub-controls SYSTEM "v4l/controls.xml"> 210 <!ENTITY sub-controls SYSTEM "v4l/controls.xml">
207 <!ENTITY sub-dev-capture SYSTEM "v4l/dev-capture.xml"> 211 <!ENTITY sub-dev-capture SYSTEM "v4l/dev-capture.xml">
208 <!ENTITY sub-dev-codec SYSTEM "v4l/dev-codec.xml"> 212 <!ENTITY sub-dev-codec SYSTEM "v4l/dev-codec.xml">
209 <!ENTITY sub-dev-event SYSTEM "v4l/dev-event.xml"> 213 <!ENTITY sub-dev-event SYSTEM "v4l/dev-event.xml">
210 <!ENTITY sub-dev-effect SYSTEM "v4l/dev-effect.xml"> 214 <!ENTITY sub-dev-effect SYSTEM "v4l/dev-effect.xml">
211 <!ENTITY sub-dev-osd SYSTEM "v4l/dev-osd.xml"> 215 <!ENTITY sub-dev-osd SYSTEM "v4l/dev-osd.xml">
212 <!ENTITY sub-dev-output SYSTEM "v4l/dev-output.xml"> 216 <!ENTITY sub-dev-output SYSTEM "v4l/dev-output.xml">
213 <!ENTITY sub-dev-overlay SYSTEM "v4l/dev-overlay.xml"> 217 <!ENTITY sub-dev-overlay SYSTEM "v4l/dev-overlay.xml">
214 <!ENTITY sub-dev-radio SYSTEM "v4l/dev-radio.xml"> 218 <!ENTITY sub-dev-radio SYSTEM "v4l/dev-radio.xml">
215 <!ENTITY sub-dev-raw-vbi SYSTEM "v4l/dev-raw-vbi.xml"> 219 <!ENTITY sub-dev-raw-vbi SYSTEM "v4l/dev-raw-vbi.xml">
216 <!ENTITY sub-dev-rds SYSTEM "v4l/dev-rds.xml"> 220 <!ENTITY sub-dev-rds SYSTEM "v4l/dev-rds.xml">
217 <!ENTITY sub-dev-sliced-vbi SYSTEM "v4l/dev-sliced-vbi.xml"> 221 <!ENTITY sub-dev-sliced-vbi SYSTEM "v4l/dev-sliced-vbi.xml">
218 <!ENTITY sub-dev-teletext SYSTEM "v4l/dev-teletext.xml"> 222 <!ENTITY sub-dev-teletext SYSTEM "v4l/dev-teletext.xml">
219 <!ENTITY sub-driver SYSTEM "v4l/driver.xml"> 223 <!ENTITY sub-driver SYSTEM "v4l/driver.xml">
220 <!ENTITY sub-libv4l SYSTEM "v4l/libv4l.xml"> 224 <!ENTITY sub-libv4l SYSTEM "v4l/libv4l.xml">
221 <!ENTITY sub-lirc_device_interface SYSTEM "v4l/lirc_device_interface.xml"> 225 <!ENTITY sub-lirc_device_interface SYSTEM "v4l/lirc_device_interface.xml">
222 <!ENTITY sub-remote_controllers SYSTEM "v4l/remote_controllers.xml"> 226 <!ENTITY sub-remote_controllers SYSTEM "v4l/remote_controllers.xml">
223 <!ENTITY sub-fdl-appendix SYSTEM "v4l/fdl-appendix.xml"> 227 <!ENTITY sub-fdl-appendix SYSTEM "v4l/fdl-appendix.xml">
224 <!ENTITY sub-close SYSTEM "v4l/func-close.xml"> 228 <!ENTITY sub-close SYSTEM "v4l/func-close.xml">
225 <!ENTITY sub-ioctl SYSTEM "v4l/func-ioctl.xml"> 229 <!ENTITY sub-ioctl SYSTEM "v4l/func-ioctl.xml">
226 <!ENTITY sub-mmap SYSTEM "v4l/func-mmap.xml"> 230 <!ENTITY sub-mmap SYSTEM "v4l/func-mmap.xml">
227 <!ENTITY sub-munmap SYSTEM "v4l/func-munmap.xml"> 231 <!ENTITY sub-munmap SYSTEM "v4l/func-munmap.xml">
228 <!ENTITY sub-open SYSTEM "v4l/func-open.xml"> 232 <!ENTITY sub-open SYSTEM "v4l/func-open.xml">
229 <!ENTITY sub-poll SYSTEM "v4l/func-poll.xml"> 233 <!ENTITY sub-poll SYSTEM "v4l/func-poll.xml">
230 <!ENTITY sub-read SYSTEM "v4l/func-read.xml"> 234 <!ENTITY sub-read SYSTEM "v4l/func-read.xml">
231 <!ENTITY sub-select SYSTEM "v4l/func-select.xml"> 235 <!ENTITY sub-select SYSTEM "v4l/func-select.xml">
232 <!ENTITY sub-write SYSTEM "v4l/func-write.xml"> 236 <!ENTITY sub-write SYSTEM "v4l/func-write.xml">
233 <!ENTITY sub-io SYSTEM "v4l/io.xml"> 237 <!ENTITY sub-io SYSTEM "v4l/io.xml">
234 <!ENTITY sub-grey SYSTEM "v4l/pixfmt-grey.xml"> 238 <!ENTITY sub-grey SYSTEM "v4l/pixfmt-grey.xml">
235 <!ENTITY sub-nv12 SYSTEM "v4l/pixfmt-nv12.xml"> 239 <!ENTITY sub-nv12 SYSTEM "v4l/pixfmt-nv12.xml">
236 <!ENTITY sub-nv16 SYSTEM "v4l/pixfmt-nv16.xml"> 240 <!ENTITY sub-nv16 SYSTEM "v4l/pixfmt-nv16.xml">
237 <!ENTITY sub-packed-rgb SYSTEM "v4l/pixfmt-packed-rgb.xml"> 241 <!ENTITY sub-packed-rgb SYSTEM "v4l/pixfmt-packed-rgb.xml">
238 <!ENTITY sub-packed-yuv SYSTEM "v4l/pixfmt-packed-yuv.xml"> 242 <!ENTITY sub-packed-yuv SYSTEM "v4l/pixfmt-packed-yuv.xml">
239 <!ENTITY sub-sbggr16 SYSTEM "v4l/pixfmt-sbggr16.xml"> 243 <!ENTITY sub-sbggr16 SYSTEM "v4l/pixfmt-sbggr16.xml">
240 <!ENTITY sub-sbggr8 SYSTEM "v4l/pixfmt-sbggr8.xml"> 244 <!ENTITY sub-sbggr8 SYSTEM "v4l/pixfmt-sbggr8.xml">
241 <!ENTITY sub-sgbrg8 SYSTEM "v4l/pixfmt-sgbrg8.xml"> 245 <!ENTITY sub-sgbrg8 SYSTEM "v4l/pixfmt-sgbrg8.xml">
242 <!ENTITY sub-sgrbg8 SYSTEM "v4l/pixfmt-sgrbg8.xml"> 246 <!ENTITY sub-sgrbg8 SYSTEM "v4l/pixfmt-sgrbg8.xml">
243 <!ENTITY sub-uyvy SYSTEM "v4l/pixfmt-uyvy.xml"> 247 <!ENTITY sub-uyvy SYSTEM "v4l/pixfmt-uyvy.xml">
244 <!ENTITY sub-vyuy SYSTEM "v4l/pixfmt-vyuy.xml"> 248 <!ENTITY sub-vyuy SYSTEM "v4l/pixfmt-vyuy.xml">
245 <!ENTITY sub-y16 SYSTEM "v4l/pixfmt-y16.xml"> 249 <!ENTITY sub-y16 SYSTEM "v4l/pixfmt-y16.xml">
246 <!ENTITY sub-y41p SYSTEM "v4l/pixfmt-y41p.xml"> 250 <!ENTITY sub-y41p SYSTEM "v4l/pixfmt-y41p.xml">
247 <!ENTITY sub-yuv410 SYSTEM "v4l/pixfmt-yuv410.xml"> 251 <!ENTITY sub-yuv410 SYSTEM "v4l/pixfmt-yuv410.xml">
248 <!ENTITY sub-yuv411p SYSTEM "v4l/pixfmt-yuv411p.xml"> 252 <!ENTITY sub-yuv411p SYSTEM "v4l/pixfmt-yuv411p.xml">
249 <!ENTITY sub-yuv420 SYSTEM "v4l/pixfmt-yuv420.xml"> 253 <!ENTITY sub-yuv420 SYSTEM "v4l/pixfmt-yuv420.xml">
250 <!ENTITY sub-yuv422p SYSTEM "v4l/pixfmt-yuv422p.xml"> 254 <!ENTITY sub-yuv422p SYSTEM "v4l/pixfmt-yuv422p.xml">
251 <!ENTITY sub-yuyv SYSTEM "v4l/pixfmt-yuyv.xml"> 255 <!ENTITY sub-yuyv SYSTEM "v4l/pixfmt-yuyv.xml">
252 <!ENTITY sub-yvyu SYSTEM "v4l/pixfmt-yvyu.xml"> 256 <!ENTITY sub-yvyu SYSTEM "v4l/pixfmt-yvyu.xml">
253 <!ENTITY sub-srggb10 SYSTEM "v4l/pixfmt-srggb10.xml"> 257 <!ENTITY sub-srggb10 SYSTEM "v4l/pixfmt-srggb10.xml">
254 <!ENTITY sub-srggb8 SYSTEM "v4l/pixfmt-srggb8.xml"> 258 <!ENTITY sub-srggb8 SYSTEM "v4l/pixfmt-srggb8.xml">
255 <!ENTITY sub-y10 SYSTEM "v4l/pixfmt-y10.xml"> 259 <!ENTITY sub-y10 SYSTEM "v4l/pixfmt-y10.xml">
256 <!ENTITY sub-pixfmt SYSTEM "v4l/pixfmt.xml"> 260 <!ENTITY sub-pixfmt SYSTEM "v4l/pixfmt.xml">
257 <!ENTITY sub-cropcap SYSTEM "v4l/vidioc-cropcap.xml"> 261 <!ENTITY sub-cropcap SYSTEM "v4l/vidioc-cropcap.xml">
258 <!ENTITY sub-dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml"> 262 <!ENTITY sub-dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml">
259 <!ENTITY sub-encoder-cmd SYSTEM "v4l/vidioc-encoder-cmd.xml"> 263 <!ENTITY sub-encoder-cmd SYSTEM "v4l/vidioc-encoder-cmd.xml">
260 <!ENTITY sub-enum-fmt SYSTEM "v4l/vidioc-enum-fmt.xml"> 264 <!ENTITY sub-enum-fmt SYSTEM "v4l/vidioc-enum-fmt.xml">
261 <!ENTITY sub-enum-frameintervals SYSTEM "v4l/vidioc-enum-frameintervals.xml"> 265 <!ENTITY sub-enum-frameintervals SYSTEM "v4l/vidioc-enum-frameintervals.xml">
262 <!ENTITY sub-enum-framesizes SYSTEM "v4l/vidioc-enum-framesizes.xml"> 266 <!ENTITY sub-enum-framesizes SYSTEM "v4l/vidioc-enum-framesizes.xml">
263 <!ENTITY sub-enumaudio SYSTEM "v4l/vidioc-enumaudio.xml"> 267 <!ENTITY sub-enumaudio SYSTEM "v4l/vidioc-enumaudio.xml">
264 <!ENTITY sub-enumaudioout SYSTEM "v4l/vidioc-enumaudioout.xml"> 268 <!ENTITY sub-enumaudioout SYSTEM "v4l/vidioc-enumaudioout.xml">
265 <!ENTITY sub-enuminput SYSTEM "v4l/vidioc-enuminput.xml"> 269 <!ENTITY sub-enuminput SYSTEM "v4l/vidioc-enuminput.xml">
266 <!ENTITY sub-enumoutput SYSTEM "v4l/vidioc-enumoutput.xml"> 270 <!ENTITY sub-enumoutput SYSTEM "v4l/vidioc-enumoutput.xml">
267 <!ENTITY sub-enum-dv-presets SYSTEM "v4l/vidioc-enum-dv-presets.xml"> 271 <!ENTITY sub-enum-dv-presets SYSTEM "v4l/vidioc-enum-dv-presets.xml">
268 <!ENTITY sub-g-dv-preset SYSTEM "v4l/vidioc-g-dv-preset.xml"> 272 <!ENTITY sub-g-dv-preset SYSTEM "v4l/vidioc-g-dv-preset.xml">
269 <!ENTITY sub-query-dv-preset SYSTEM "v4l/vidioc-query-dv-preset.xml"> 273 <!ENTITY sub-query-dv-preset SYSTEM "v4l/vidioc-query-dv-preset.xml">
270 <!ENTITY sub-g-dv-timings SYSTEM "v4l/vidioc-g-dv-timings.xml"> 274 <!ENTITY sub-g-dv-timings SYSTEM "v4l/vidioc-g-dv-timings.xml">
271 <!ENTITY sub-enumstd SYSTEM "v4l/vidioc-enumstd.xml"> 275 <!ENTITY sub-enumstd SYSTEM "v4l/vidioc-enumstd.xml">
272 <!ENTITY sub-g-audio SYSTEM "v4l/vidioc-g-audio.xml"> 276 <!ENTITY sub-g-audio SYSTEM "v4l/vidioc-g-audio.xml">
273 <!ENTITY sub-g-audioout SYSTEM "v4l/vidioc-g-audioout.xml"> 277 <!ENTITY sub-g-audioout SYSTEM "v4l/vidioc-g-audioout.xml">
274 <!ENTITY sub-dbg-g-chip-ident SYSTEM "v4l/vidioc-dbg-g-chip-ident.xml"> 278 <!ENTITY sub-dbg-g-chip-ident SYSTEM "v4l/vidioc-dbg-g-chip-ident.xml">
275 <!ENTITY sub-g-crop SYSTEM "v4l/vidioc-g-crop.xml"> 279 <!ENTITY sub-g-crop SYSTEM "v4l/vidioc-g-crop.xml">
276 <!ENTITY sub-g-ctrl SYSTEM "v4l/vidioc-g-ctrl.xml"> 280 <!ENTITY sub-g-ctrl SYSTEM "v4l/vidioc-g-ctrl.xml">
277 <!ENTITY sub-g-enc-index SYSTEM "v4l/vidioc-g-enc-index.xml"> 281 <!ENTITY sub-g-enc-index SYSTEM "v4l/vidioc-g-enc-index.xml">
278 <!ENTITY sub-g-ext-ctrls SYSTEM "v4l/vidioc-g-ext-ctrls.xml"> 282 <!ENTITY sub-g-ext-ctrls SYSTEM "v4l/vidioc-g-ext-ctrls.xml">
279 <!ENTITY sub-g-fbuf SYSTEM "v4l/vidioc-g-fbuf.xml"> 283 <!ENTITY sub-g-fbuf SYSTEM "v4l/vidioc-g-fbuf.xml">
280 <!ENTITY sub-g-fmt SYSTEM "v4l/vidioc-g-fmt.xml"> 284 <!ENTITY sub-g-fmt SYSTEM "v4l/vidioc-g-fmt.xml">
281 <!ENTITY sub-g-frequency SYSTEM "v4l/vidioc-g-frequency.xml"> 285 <!ENTITY sub-g-frequency SYSTEM "v4l/vidioc-g-frequency.xml">
282 <!ENTITY sub-g-input SYSTEM "v4l/vidioc-g-input.xml"> 286 <!ENTITY sub-g-input SYSTEM "v4l/vidioc-g-input.xml">
283 <!ENTITY sub-g-jpegcomp SYSTEM "v4l/vidioc-g-jpegcomp.xml"> 287 <!ENTITY sub-g-jpegcomp SYSTEM "v4l/vidioc-g-jpegcomp.xml">
284 <!ENTITY sub-g-modulator SYSTEM "v4l/vidioc-g-modulator.xml"> 288 <!ENTITY sub-g-modulator SYSTEM "v4l/vidioc-g-modulator.xml">
285 <!ENTITY sub-g-output SYSTEM "v4l/vidioc-g-output.xml"> 289 <!ENTITY sub-g-output SYSTEM "v4l/vidioc-g-output.xml">
286 <!ENTITY sub-g-parm SYSTEM "v4l/vidioc-g-parm.xml"> 290 <!ENTITY sub-g-parm SYSTEM "v4l/vidioc-g-parm.xml">
287 <!ENTITY sub-g-priority SYSTEM "v4l/vidioc-g-priority.xml"> 291 <!ENTITY sub-g-priority SYSTEM "v4l/vidioc-g-priority.xml">
288 <!ENTITY sub-g-sliced-vbi-cap SYSTEM "v4l/vidioc-g-sliced-vbi-cap.xml"> 292 <!ENTITY sub-g-sliced-vbi-cap SYSTEM "v4l/vidioc-g-sliced-vbi-cap.xml">
289 <!ENTITY sub-g-std SYSTEM "v4l/vidioc-g-std.xml"> 293 <!ENTITY sub-g-std SYSTEM "v4l/vidioc-g-std.xml">
290 <!ENTITY sub-g-tuner SYSTEM "v4l/vidioc-g-tuner.xml"> 294 <!ENTITY sub-g-tuner SYSTEM "v4l/vidioc-g-tuner.xml">
291 <!ENTITY sub-log-status SYSTEM "v4l/vidioc-log-status.xml"> 295 <!ENTITY sub-log-status SYSTEM "v4l/vidioc-log-status.xml">
292 <!ENTITY sub-overlay SYSTEM "v4l/vidioc-overlay.xml"> 296 <!ENTITY sub-overlay SYSTEM "v4l/vidioc-overlay.xml">
293 <!ENTITY sub-qbuf SYSTEM "v4l/vidioc-qbuf.xml"> 297 <!ENTITY sub-qbuf SYSTEM "v4l/vidioc-qbuf.xml">
294 <!ENTITY sub-querybuf SYSTEM "v4l/vidioc-querybuf.xml"> 298 <!ENTITY sub-querybuf SYSTEM "v4l/vidioc-querybuf.xml">
295 <!ENTITY sub-querycap SYSTEM "v4l/vidioc-querycap.xml"> 299 <!ENTITY sub-querycap SYSTEM "v4l/vidioc-querycap.xml">
296 <!ENTITY sub-queryctrl SYSTEM "v4l/vidioc-queryctrl.xml"> 300 <!ENTITY sub-queryctrl SYSTEM "v4l/vidioc-queryctrl.xml">
297 <!ENTITY sub-querystd SYSTEM "v4l/vidioc-querystd.xml"> 301 <!ENTITY sub-querystd SYSTEM "v4l/vidioc-querystd.xml">
298 <!ENTITY sub-reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> 302 <!ENTITY sub-reqbufs SYSTEM "v4l/vidioc-reqbufs.xml">
299 <!ENTITY sub-s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> 303 <!ENTITY sub-s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml">
300 <!ENTITY sub-streamon SYSTEM "v4l/vidioc-streamon.xml"> 304 <!ENTITY sub-streamon SYSTEM "v4l/vidioc-streamon.xml">
301 <!ENTITY sub-capture-c SYSTEM "v4l/capture.c.xml"> 305 <!ENTITY sub-capture-c SYSTEM "v4l/capture.c.xml">
302 <!ENTITY sub-keytable-c SYSTEM "v4l/keytable.c.xml"> 306 <!ENTITY sub-keytable-c SYSTEM "v4l/keytable.c.xml">
303 <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> 307 <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml">
304 <!ENTITY sub-videodev2-h SYSTEM "v4l/videodev2.h.xml"> 308 <!ENTITY sub-videodev2-h SYSTEM "v4l/videodev2.h.xml">
305 <!ENTITY sub-v4l2 SYSTEM "v4l/v4l2.xml"> 309 <!ENTITY sub-v4l2 SYSTEM "v4l/v4l2.xml">
306 <!ENTITY sub-dqevent SYSTEM "v4l/vidioc-dqevent.xml"> 310 <!ENTITY sub-dqevent SYSTEM "v4l/vidioc-dqevent.xml">
307 <!ENTITY sub-subscribe-event SYSTEM "v4l/vidioc-subscribe-event.xml"> 311 <!ENTITY sub-subscribe-event SYSTEM "v4l/vidioc-subscribe-event.xml">
308 <!ENTITY sub-intro SYSTEM "dvb/intro.xml"> 312 <!ENTITY sub-intro SYSTEM "dvb/intro.xml">
309 <!ENTITY sub-frontend SYSTEM "dvb/frontend.xml"> 313 <!ENTITY sub-frontend SYSTEM "dvb/frontend.xml">
310 <!ENTITY sub-dvbproperty SYSTEM "dvb/dvbproperty.xml"> 314 <!ENTITY sub-dvbproperty SYSTEM "dvb/dvbproperty.xml">
311 <!ENTITY sub-demux SYSTEM "dvb/demux.xml"> 315 <!ENTITY sub-demux SYSTEM "dvb/demux.xml">
312 <!ENTITY sub-video SYSTEM "dvb/video.xml"> 316 <!ENTITY sub-video SYSTEM "dvb/video.xml">
313 <!ENTITY sub-audio SYSTEM "dvb/audio.xml"> 317 <!ENTITY sub-audio SYSTEM "dvb/audio.xml">
314 <!ENTITY sub-ca SYSTEM "dvb/ca.xml"> 318 <!ENTITY sub-ca SYSTEM "dvb/ca.xml">
315 <!ENTITY sub-net SYSTEM "dvb/net.xml"> 319 <!ENTITY sub-net SYSTEM "dvb/net.xml">
316 <!ENTITY sub-kdapi SYSTEM "dvb/kdapi.xml"> 320 <!ENTITY sub-kdapi SYSTEM "dvb/kdapi.xml">
317 <!ENTITY sub-examples SYSTEM "dvb/examples.xml"> 321 <!ENTITY sub-examples SYSTEM "dvb/examples.xml">
318 <!ENTITY sub-frontend-h SYSTEM "dvb/frontend.h.xml"> 322 <!ENTITY sub-frontend-h SYSTEM "dvb/frontend.h.xml">
319 <!ENTITY sub-dvbapi SYSTEM "dvb/dvbapi.xml"> 323 <!ENTITY sub-dvbapi SYSTEM "dvb/dvbapi.xml">
320 <!ENTITY sub-media SYSTEM "media.xml"> 324 <!ENTITY sub-media SYSTEM "media.xml">
321 <!ENTITY sub-media-entities SYSTEM "media-entities.tmpl"> 325 <!ENTITY sub-media-entities SYSTEM "media-entities.tmpl">
322 <!ENTITY sub-media-indices SYSTEM "media-indices.tmpl"> 326 <!ENTITY sub-media-indices SYSTEM "media-indices.tmpl">
323 327
324 <!-- Function Reference --> 328 <!-- Function Reference -->
325 <!ENTITY close SYSTEM "v4l/func-close.xml"> 329 <!ENTITY close SYSTEM "v4l/func-close.xml">
326 <!ENTITY ioctl SYSTEM "v4l/func-ioctl.xml"> 330 <!ENTITY ioctl SYSTEM "v4l/func-ioctl.xml">
327 <!ENTITY mmap SYSTEM "v4l/func-mmap.xml"> 331 <!ENTITY mmap SYSTEM "v4l/func-mmap.xml">
328 <!ENTITY munmap SYSTEM "v4l/func-munmap.xml"> 332 <!ENTITY munmap SYSTEM "v4l/func-munmap.xml">
329 <!ENTITY open SYSTEM "v4l/func-open.xml"> 333 <!ENTITY open SYSTEM "v4l/func-open.xml">
330 <!ENTITY poll SYSTEM "v4l/func-poll.xml"> 334 <!ENTITY poll SYSTEM "v4l/func-poll.xml">
331 <!ENTITY read SYSTEM "v4l/func-read.xml"> 335 <!ENTITY read SYSTEM "v4l/func-read.xml">
332 <!ENTITY select SYSTEM "v4l/func-select.xml"> 336 <!ENTITY select SYSTEM "v4l/func-select.xml">
333 <!ENTITY write SYSTEM "v4l/func-write.xml"> 337 <!ENTITY write SYSTEM "v4l/func-write.xml">
334 <!ENTITY grey SYSTEM "v4l/pixfmt-grey.xml"> 338 <!ENTITY grey SYSTEM "v4l/pixfmt-grey.xml">
335 <!ENTITY nv12 SYSTEM "v4l/pixfmt-nv12.xml"> 339 <!ENTITY nv12 SYSTEM "v4l/pixfmt-nv12.xml">
336 <!ENTITY nv16 SYSTEM "v4l/pixfmt-nv16.xml"> 340 <!ENTITY nv16 SYSTEM "v4l/pixfmt-nv16.xml">
337 <!ENTITY packed-rgb SYSTEM "v4l/pixfmt-packed-rgb.xml"> 341 <!ENTITY packed-rgb SYSTEM "v4l/pixfmt-packed-rgb.xml">
338 <!ENTITY packed-yuv SYSTEM "v4l/pixfmt-packed-yuv.xml"> 342 <!ENTITY packed-yuv SYSTEM "v4l/pixfmt-packed-yuv.xml">
339 <!ENTITY sbggr16 SYSTEM "v4l/pixfmt-sbggr16.xml"> 343 <!ENTITY sbggr16 SYSTEM "v4l/pixfmt-sbggr16.xml">
340 <!ENTITY sbggr8 SYSTEM "v4l/pixfmt-sbggr8.xml"> 344 <!ENTITY sbggr8 SYSTEM "v4l/pixfmt-sbggr8.xml">
341 <!ENTITY sgbrg8 SYSTEM "v4l/pixfmt-sgbrg8.xml"> 345 <!ENTITY sgbrg8 SYSTEM "v4l/pixfmt-sgbrg8.xml">
342 <!ENTITY sgrbg8 SYSTEM "v4l/pixfmt-sgrbg8.xml"> 346 <!ENTITY sgrbg8 SYSTEM "v4l/pixfmt-sgrbg8.xml">
343 <!ENTITY uyvy SYSTEM "v4l/pixfmt-uyvy.xml"> 347 <!ENTITY uyvy SYSTEM "v4l/pixfmt-uyvy.xml">
344 <!ENTITY vyuy SYSTEM "v4l/pixfmt-vyuy.xml"> 348 <!ENTITY vyuy SYSTEM "v4l/pixfmt-vyuy.xml">
345 <!ENTITY y16 SYSTEM "v4l/pixfmt-y16.xml"> 349 <!ENTITY y16 SYSTEM "v4l/pixfmt-y16.xml">
346 <!ENTITY y41p SYSTEM "v4l/pixfmt-y41p.xml"> 350 <!ENTITY y41p SYSTEM "v4l/pixfmt-y41p.xml">
347 <!ENTITY yuv410 SYSTEM "v4l/pixfmt-yuv410.xml"> 351 <!ENTITY yuv410 SYSTEM "v4l/pixfmt-yuv410.xml">
348 <!ENTITY yuv411p SYSTEM "v4l/pixfmt-yuv411p.xml"> 352 <!ENTITY yuv411p SYSTEM "v4l/pixfmt-yuv411p.xml">
349 <!ENTITY yuv420 SYSTEM "v4l/pixfmt-yuv420.xml"> 353 <!ENTITY yuv420 SYSTEM "v4l/pixfmt-yuv420.xml">
350 <!ENTITY yuv422p SYSTEM "v4l/pixfmt-yuv422p.xml"> 354 <!ENTITY yuv422p SYSTEM "v4l/pixfmt-yuv422p.xml">
351 <!ENTITY yuyv SYSTEM "v4l/pixfmt-yuyv.xml"> 355 <!ENTITY yuyv SYSTEM "v4l/pixfmt-yuyv.xml">
352 <!ENTITY yvyu SYSTEM "v4l/pixfmt-yvyu.xml"> 356 <!ENTITY yvyu SYSTEM "v4l/pixfmt-yvyu.xml">
353 <!ENTITY srggb10 SYSTEM "v4l/pixfmt-srggb10.xml"> 357 <!ENTITY srggb10 SYSTEM "v4l/pixfmt-srggb10.xml">
354 <!ENTITY srggb8 SYSTEM "v4l/pixfmt-srggb8.xml"> 358 <!ENTITY srggb8 SYSTEM "v4l/pixfmt-srggb8.xml">
355 <!ENTITY y10 SYSTEM "v4l/pixfmt-y10.xml"> 359 <!ENTITY y10 SYSTEM "v4l/pixfmt-y10.xml">
356 <!ENTITY cropcap SYSTEM "v4l/vidioc-cropcap.xml"> 360 <!ENTITY cropcap SYSTEM "v4l/vidioc-cropcap.xml">
357 <!ENTITY dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml"> 361 <!ENTITY dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml">
358 <!ENTITY encoder-cmd SYSTEM "v4l/vidioc-encoder-cmd.xml"> 362 <!ENTITY encoder-cmd SYSTEM "v4l/vidioc-encoder-cmd.xml">
359 <!ENTITY enum-fmt SYSTEM "v4l/vidioc-enum-fmt.xml"> 363 <!ENTITY enum-fmt SYSTEM "v4l/vidioc-enum-fmt.xml">
360 <!ENTITY enum-frameintervals SYSTEM "v4l/vidioc-enum-frameintervals.xml"> 364 <!ENTITY enum-frameintervals SYSTEM "v4l/vidioc-enum-frameintervals.xml">
361 <!ENTITY enum-framesizes SYSTEM "v4l/vidioc-enum-framesizes.xml"> 365 <!ENTITY enum-framesizes SYSTEM "v4l/vidioc-enum-framesizes.xml">
362 <!ENTITY enumaudio SYSTEM "v4l/vidioc-enumaudio.xml"> 366 <!ENTITY enumaudio SYSTEM "v4l/vidioc-enumaudio.xml">
363 <!ENTITY enumaudioout SYSTEM "v4l/vidioc-enumaudioout.xml"> 367 <!ENTITY enumaudioout SYSTEM "v4l/vidioc-enumaudioout.xml">
364 <!ENTITY enuminput SYSTEM "v4l/vidioc-enuminput.xml"> 368 <!ENTITY enuminput SYSTEM "v4l/vidioc-enuminput.xml">
365 <!ENTITY enumoutput SYSTEM "v4l/vidioc-enumoutput.xml"> 369 <!ENTITY enumoutput SYSTEM "v4l/vidioc-enumoutput.xml">
366 <!ENTITY enum-dv-presets SYSTEM "v4l/vidioc-enum-dv-presets.xml"> 370 <!ENTITY enum-dv-presets SYSTEM "v4l/vidioc-enum-dv-presets.xml">
367 <!ENTITY g-dv-preset SYSTEM "v4l/vidioc-g-dv-preset.xml"> 371 <!ENTITY g-dv-preset SYSTEM "v4l/vidioc-g-dv-preset.xml">
368 <!ENTITY query-dv-preset SYSTEM "v4l/vidioc-query-dv-preset.xml"> 372 <!ENTITY query-dv-preset SYSTEM "v4l/vidioc-query-dv-preset.xml">
369 <!ENTITY g-dv-timings SYSTEM "v4l/vidioc-g-dv-timings.xml"> 373 <!ENTITY g-dv-timings SYSTEM "v4l/vidioc-g-dv-timings.xml">
370 <!ENTITY enumstd SYSTEM "v4l/vidioc-enumstd.xml"> 374 <!ENTITY enumstd SYSTEM "v4l/vidioc-enumstd.xml">
371 <!ENTITY g-audio SYSTEM "v4l/vidioc-g-audio.xml"> 375 <!ENTITY g-audio SYSTEM "v4l/vidioc-g-audio.xml">
372 <!ENTITY g-audioout SYSTEM "v4l/vidioc-g-audioout.xml"> 376 <!ENTITY g-audioout SYSTEM "v4l/vidioc-g-audioout.xml">
373 <!ENTITY dbg-g-chip-ident SYSTEM "v4l/vidioc-dbg-g-chip-ident.xml"> 377 <!ENTITY dbg-g-chip-ident SYSTEM "v4l/vidioc-dbg-g-chip-ident.xml">
374 <!ENTITY g-crop SYSTEM "v4l/vidioc-g-crop.xml"> 378 <!ENTITY g-crop SYSTEM "v4l/vidioc-g-crop.xml">
375 <!ENTITY g-ctrl SYSTEM "v4l/vidioc-g-ctrl.xml"> 379 <!ENTITY g-ctrl SYSTEM "v4l/vidioc-g-ctrl.xml">
376 <!ENTITY g-enc-index SYSTEM "v4l/vidioc-g-enc-index.xml"> 380 <!ENTITY g-enc-index SYSTEM "v4l/vidioc-g-enc-index.xml">
377 <!ENTITY g-ext-ctrls SYSTEM "v4l/vidioc-g-ext-ctrls.xml"> 381 <!ENTITY g-ext-ctrls SYSTEM "v4l/vidioc-g-ext-ctrls.xml">
378 <!ENTITY g-fbuf SYSTEM "v4l/vidioc-g-fbuf.xml"> 382 <!ENTITY g-fbuf SYSTEM "v4l/vidioc-g-fbuf.xml">
379 <!ENTITY g-fmt SYSTEM "v4l/vidioc-g-fmt.xml"> 383 <!ENTITY g-fmt SYSTEM "v4l/vidioc-g-fmt.xml">
380 <!ENTITY g-frequency SYSTEM "v4l/vidioc-g-frequency.xml"> 384 <!ENTITY g-frequency SYSTEM "v4l/vidioc-g-frequency.xml">
381 <!ENTITY g-input SYSTEM "v4l/vidioc-g-input.xml"> 385 <!ENTITY g-input SYSTEM "v4l/vidioc-g-input.xml">
382 <!ENTITY g-jpegcomp SYSTEM "v4l/vidioc-g-jpegcomp.xml"> 386 <!ENTITY g-jpegcomp SYSTEM "v4l/vidioc-g-jpegcomp.xml">
383 <!ENTITY g-modulator SYSTEM "v4l/vidioc-g-modulator.xml"> 387 <!ENTITY g-modulator SYSTEM "v4l/vidioc-g-modulator.xml">
384 <!ENTITY g-output SYSTEM "v4l/vidioc-g-output.xml"> 388 <!ENTITY g-output SYSTEM "v4l/vidioc-g-output.xml">
385 <!ENTITY g-parm SYSTEM "v4l/vidioc-g-parm.xml"> 389 <!ENTITY g-parm SYSTEM "v4l/vidioc-g-parm.xml">
386 <!ENTITY g-priority SYSTEM "v4l/vidioc-g-priority.xml"> 390 <!ENTITY g-priority SYSTEM "v4l/vidioc-g-priority.xml">
387 <!ENTITY g-sliced-vbi-cap SYSTEM "v4l/vidioc-g-sliced-vbi-cap.xml"> 391 <!ENTITY g-sliced-vbi-cap SYSTEM "v4l/vidioc-g-sliced-vbi-cap.xml">
388 <!ENTITY g-std SYSTEM "v4l/vidioc-g-std.xml"> 392 <!ENTITY g-std SYSTEM "v4l/vidioc-g-std.xml">
389 <!ENTITY g-tuner SYSTEM "v4l/vidioc-g-tuner.xml"> 393 <!ENTITY g-tuner SYSTEM "v4l/vidioc-g-tuner.xml">
390 <!ENTITY log-status SYSTEM "v4l/vidioc-log-status.xml"> 394 <!ENTITY log-status SYSTEM "v4l/vidioc-log-status.xml">
391 <!ENTITY overlay SYSTEM "v4l/vidioc-overlay.xml"> 395 <!ENTITY overlay SYSTEM "v4l/vidioc-overlay.xml">
392 <!ENTITY qbuf SYSTEM "v4l/vidioc-qbuf.xml"> 396 <!ENTITY qbuf SYSTEM "v4l/vidioc-qbuf.xml">
393 <!ENTITY querybuf SYSTEM "v4l/vidioc-querybuf.xml"> 397 <!ENTITY querybuf SYSTEM "v4l/vidioc-querybuf.xml">
394 <!ENTITY querycap SYSTEM "v4l/vidioc-querycap.xml"> 398 <!ENTITY querycap SYSTEM "v4l/vidioc-querycap.xml">
395 <!ENTITY queryctrl SYSTEM "v4l/vidioc-queryctrl.xml"> 399 <!ENTITY queryctrl SYSTEM "v4l/vidioc-queryctrl.xml">
396 <!ENTITY querystd SYSTEM "v4l/vidioc-querystd.xml"> 400 <!ENTITY querystd SYSTEM "v4l/vidioc-querystd.xml">
397 <!ENTITY reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> 401 <!ENTITY reqbufs SYSTEM "v4l/vidioc-reqbufs.xml">
398 <!ENTITY s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> 402 <!ENTITY s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml">
399 <!ENTITY streamon SYSTEM "v4l/vidioc-streamon.xml"> 403 <!ENTITY streamon SYSTEM "v4l/vidioc-streamon.xml">
400 <!ENTITY dqevent SYSTEM "v4l/vidioc-dqevent.xml"> 404 <!ENTITY dqevent SYSTEM "v4l/vidioc-dqevent.xml">
401 <!ENTITY subscribe_event SYSTEM "v4l/vidioc-subscribe-event.xml"> 405 <!ENTITY subscribe_event SYSTEM "v4l/vidioc-subscribe-event.xml">
402 406
Documentation/DocBook/v4l/common.xml
1 <title>Common API Elements</title> 1 <title>Common API Elements</title>
2 2
3 <para>Programming a V4L2 device consists of these 3 <para>Programming a V4L2 device consists of these
4 steps:</para> 4 steps:</para>
5 5
6 <itemizedlist> 6 <itemizedlist>
7 <listitem> 7 <listitem>
8 <para>Opening the device</para> 8 <para>Opening the device</para>
9 </listitem> 9 </listitem>
10 <listitem> 10 <listitem>
11 <para>Changing device properties, selecting a video and audio 11 <para>Changing device properties, selecting a video and audio
12 input, video standard, picture brightness a.&nbsp;o.</para> 12 input, video standard, picture brightness a.&nbsp;o.</para>
13 </listitem> 13 </listitem>
14 <listitem> 14 <listitem>
15 <para>Negotiating a data format</para> 15 <para>Negotiating a data format</para>
16 </listitem> 16 </listitem>
17 <listitem> 17 <listitem>
18 <para>Negotiating an input/output method</para> 18 <para>Negotiating an input/output method</para>
19 </listitem> 19 </listitem>
20 <listitem> 20 <listitem>
21 <para>The actual input/output loop</para> 21 <para>The actual input/output loop</para>
22 </listitem> 22 </listitem>
23 <listitem> 23 <listitem>
24 <para>Closing the device</para> 24 <para>Closing the device</para>
25 </listitem> 25 </listitem>
26 </itemizedlist> 26 </itemizedlist>
27 27
28 <para>In practice most steps are optional and can be executed out of 28 <para>In practice most steps are optional and can be executed out of
29 order. It depends on the V4L2 device type, you can read about the 29 order. It depends on the V4L2 device type, you can read about the
30 details in <xref linkend="devices" />. In this chapter we will discuss 30 details in <xref linkend="devices" />. In this chapter we will discuss
31 the basic concepts applicable to all devices.</para> 31 the basic concepts applicable to all devices.</para>
32 32
33 <section id="open"> 33 <section id="open">
34 <title>Opening and Closing Devices</title> 34 <title>Opening and Closing Devices</title>
35 35
36 <section> 36 <section>
37 <title>Device Naming</title> 37 <title>Device Naming</title>
38 38
39 <para>V4L2 drivers are implemented as kernel modules, loaded 39 <para>V4L2 drivers are implemented as kernel modules, loaded
40 manually by the system administrator or automatically when a device is 40 manually by the system administrator or automatically when a device is
41 first opened. The driver modules plug into the "videodev" kernel 41 first opened. The driver modules plug into the "videodev" kernel
42 module. It provides helper functions and a common application 42 module. It provides helper functions and a common application
43 interface specified in this document.</para> 43 interface specified in this document.</para>
44 44
45 <para>Each driver thus loaded registers one or more device nodes 45 <para>Each driver thus loaded registers one or more device nodes
46 with major number 81 and a minor number between 0 and 255. Assigning 46 with major number 81 and a minor number between 0 and 255. Assigning
47 minor numbers to V4L2 devices is entirely up to the system administrator, 47 minor numbers to V4L2 devices is entirely up to the system administrator,
48 this is primarily intended to solve conflicts between devices.<footnote> 48 this is primarily intended to solve conflicts between devices.<footnote>
49 <para>Access permissions are associated with character 49 <para>Access permissions are associated with character
50 device special files, hence we must ensure device numbers cannot 50 device special files, hence we must ensure device numbers cannot
51 change with the module load order. To this end minor numbers are no 51 change with the module load order. To this end minor numbers are no
52 longer automatically assigned by the "videodev" module as in V4L but 52 longer automatically assigned by the "videodev" module as in V4L but
53 requested by the driver. The defaults will suffice for most people 53 requested by the driver. The defaults will suffice for most people
54 unless two drivers compete for the same minor numbers.</para> 54 unless two drivers compete for the same minor numbers.</para>
55 </footnote> The module options to select minor numbers are named 55 </footnote> The module options to select minor numbers are named
56 after the device special file with a "_nr" suffix. For example "video_nr" 56 after the device special file with a "_nr" suffix. For example "video_nr"
57 for <filename>/dev/video</filename> video capture devices. The number is 57 for <filename>/dev/video</filename> video capture devices. The number is
58 an offset to the base minor number associated with the device type. 58 an offset to the base minor number associated with the device type.
59 <footnote> 59 <footnote>
60 <para>In earlier versions of the V4L2 API the module options 60 <para>In earlier versions of the V4L2 API the module options
61 where named after the device special file with a "unit_" prefix, expressing 61 where named after the device special file with a "unit_" prefix, expressing
62 the minor number itself, not an offset. Rationale for this change is unknown. 62 the minor number itself, not an offset. Rationale for this change is unknown.
63 Lastly the naming and semantics are just a convention among driver writers, 63 Lastly the naming and semantics are just a convention among driver writers,
64 the point to note is that minor numbers are not supposed to be hardcoded 64 the point to note is that minor numbers are not supposed to be hardcoded
65 into drivers.</para> 65 into drivers.</para>
66 </footnote> When the driver supports multiple devices of the same 66 </footnote> When the driver supports multiple devices of the same
67 type more than one minor number can be assigned, separated by commas: 67 type more than one minor number can be assigned, separated by commas:
68 <informalexample> 68 <informalexample>
69 <screen> 69 <screen>
70 &gt; insmod mydriver.o video_nr=0,1 radio_nr=0,1</screen> 70 &gt; insmod mydriver.o video_nr=0,1 radio_nr=0,1</screen>
71 </informalexample></para> 71 </informalexample></para>
72 72
73 <para>In <filename>/etc/modules.conf</filename> this may be 73 <para>In <filename>/etc/modules.conf</filename> this may be
74 written as: <informalexample> 74 written as: <informalexample>
75 <screen> 75 <screen>
76 alias char-major-81-0 mydriver 76 alias char-major-81-0 mydriver
77 alias char-major-81-1 mydriver 77 alias char-major-81-1 mydriver
78 alias char-major-81-64 mydriver <co id="alias" /> 78 alias char-major-81-64 mydriver <co id="alias" />
79 options mydriver video_nr=0,1 radio_nr=0,1 <co id="options" /> 79 options mydriver video_nr=0,1 radio_nr=0,1 <co id="options" />
80 </screen> 80 </screen>
81 <calloutlist> 81 <calloutlist>
82 <callout arearefs="alias"> 82 <callout arearefs="alias">
83 <para>When an application attempts to open a device 83 <para>When an application attempts to open a device
84 special file with major number 81 and minor number 0, 1, or 64, load 84 special file with major number 81 and minor number 0, 1, or 64, load
85 "mydriver" (and the "videodev" module it depends upon).</para> 85 "mydriver" (and the "videodev" module it depends upon).</para>
86 </callout> 86 </callout>
87 <callout arearefs="options"> 87 <callout arearefs="options">
88 <para>Register the first two video capture devices with 88 <para>Register the first two video capture devices with
89 minor number 0 and 1 (base number is 0), the first two radio device 89 minor number 0 and 1 (base number is 0), the first two radio device
90 with minor number 64 and 65 (base 64).</para> 90 with minor number 64 and 65 (base 64).</para>
91 </callout> 91 </callout>
92 </calloutlist> 92 </calloutlist>
93 </informalexample> When no minor number is given as module 93 </informalexample> When no minor number is given as module
94 option the driver supplies a default. <xref linkend="devices" /> 94 option the driver supplies a default. <xref linkend="devices" />
95 recommends the base minor numbers to be used for the various device 95 recommends the base minor numbers to be used for the various device
96 types. Obviously minor numbers must be unique. When the number is 96 types. Obviously minor numbers must be unique. When the number is
97 already in use the <emphasis>offending device</emphasis> will not be 97 already in use the <emphasis>offending device</emphasis> will not be
98 registered. <!-- Blessed by Linus Torvalds on 98 registered. <!-- Blessed by Linus Torvalds on
99 linux-kernel@vger.kernel.org, 2002-11-20. --></para> 99 linux-kernel@vger.kernel.org, 2002-11-20. --></para>
100 100
101 <para>By convention system administrators create various 101 <para>By convention system administrators create various
102 character device special files with these major and minor numbers in 102 character device special files with these major and minor numbers in
103 the <filename>/dev</filename> directory. The names recomended for the 103 the <filename>/dev</filename> directory. The names recomended for the
104 different V4L2 device types are listed in <xref linkend="devices" />. 104 different V4L2 device types are listed in <xref linkend="devices" />.
105 </para> 105 </para>
106 106
107 <para>The creation of character special files (with 107 <para>The creation of character special files (with
108 <application>mknod</application>) is a privileged operation and 108 <application>mknod</application>) is a privileged operation and
109 devices cannot be opened by major and minor number. That means 109 devices cannot be opened by major and minor number. That means
110 applications cannot <emphasis>reliable</emphasis> scan for loaded or 110 applications cannot <emphasis>reliable</emphasis> scan for loaded or
111 installed drivers. The user must enter a device name, or the 111 installed drivers. The user must enter a device name, or the
112 application can try the conventional device names.</para> 112 application can try the conventional device names.</para>
113 113
114 <para>Under the device filesystem (devfs) the minor number 114 <para>Under the device filesystem (devfs) the minor number
115 options are ignored. V4L2 drivers (or by proxy the "videodev" module) 115 options are ignored. V4L2 drivers (or by proxy the "videodev" module)
116 automatically create the required device files in the 116 automatically create the required device files in the
117 <filename>/dev/v4l</filename> directory using the conventional device 117 <filename>/dev/v4l</filename> directory using the conventional device
118 names above.</para> 118 names above.</para>
119 </section> 119 </section>
120 120
121 <section id="related"> 121 <section id="related">
122 <title>Related Devices</title> 122 <title>Related Devices</title>
123 123
124 <para>Devices can support several related functions. For example 124 <para>Devices can support several related functions. For example
125 video capturing, video overlay and VBI capturing are related because 125 video capturing, video overlay and VBI capturing are related because
126 these functions share, amongst other, the same video input and tuner 126 these functions share, amongst other, the same video input and tuner
127 frequency. V4L and earlier versions of V4L2 used the same device name 127 frequency. V4L and earlier versions of V4L2 used the same device name
128 and minor number for video capturing and overlay, but different ones 128 and minor number for video capturing and overlay, but different ones
129 for VBI. Experience showed this approach has several problems<footnote> 129 for VBI. Experience showed this approach has several problems<footnote>
130 <para>Given a device file name one cannot reliable find 130 <para>Given a device file name one cannot reliable find
131 related devices. For once names are arbitrary and in a system with 131 related devices. For once names are arbitrary and in a system with
132 multiple devices, where only some support VBI capturing, a 132 multiple devices, where only some support VBI capturing, a
133 <filename>/dev/video2</filename> is not necessarily related to 133 <filename>/dev/video2</filename> is not necessarily related to
134 <filename>/dev/vbi2</filename>. The V4L 134 <filename>/dev/vbi2</filename>. The V4L
135 <constant>VIDIOCGUNIT</constant> ioctl would require a search for a 135 <constant>VIDIOCGUNIT</constant> ioctl would require a search for a
136 device file with a particular major and minor number.</para> 136 device file with a particular major and minor number.</para>
137 </footnote>, and to make things worse the V4L videodev module 137 </footnote>, and to make things worse the V4L videodev module
138 used to prohibit multiple opens of a device.</para> 138 used to prohibit multiple opens of a device.</para>
139 139
140 <para>As a remedy the present version of the V4L2 API relaxed the 140 <para>As a remedy the present version of the V4L2 API relaxed the
141 concept of device types with specific names and minor numbers. For 141 concept of device types with specific names and minor numbers. For
142 compatibility with old applications drivers must still register different 142 compatibility with old applications drivers must still register different
143 minor numbers to assign a default function to the device. But if related 143 minor numbers to assign a default function to the device. But if related
144 functions are supported by the driver they must be available under all 144 functions are supported by the driver they must be available under all
145 registered minor numbers. The desired function can be selected after 145 registered minor numbers. The desired function can be selected after
146 opening the device as described in <xref linkend="devices" />.</para> 146 opening the device as described in <xref linkend="devices" />.</para>
147 147
148 <para>Imagine a driver supporting video capturing, video 148 <para>Imagine a driver supporting video capturing, video
149 overlay, raw VBI capturing, and FM radio reception. It registers three 149 overlay, raw VBI capturing, and FM radio reception. It registers three
150 devices with minor number 0, 64 and 224 (this numbering scheme is 150 devices with minor number 0, 64 and 224 (this numbering scheme is
151 inherited from the V4L API). Regardless if 151 inherited from the V4L API). Regardless if
152 <filename>/dev/video</filename> (81, 0) or 152 <filename>/dev/video</filename> (81, 0) or
153 <filename>/dev/vbi</filename> (81, 224) is opened the application can 153 <filename>/dev/vbi</filename> (81, 224) is opened the application can
154 select any one of the video capturing, overlay or VBI capturing 154 select any one of the video capturing, overlay or VBI capturing
155 functions. Without programming (e.&nbsp;g. reading from the device 155 functions. Without programming (e.&nbsp;g. reading from the device
156 with <application>dd</application> or <application>cat</application>) 156 with <application>dd</application> or <application>cat</application>)
157 <filename>/dev/video</filename> captures video images, while 157 <filename>/dev/video</filename> captures video images, while
158 <filename>/dev/vbi</filename> captures raw VBI data. 158 <filename>/dev/vbi</filename> captures raw VBI data.
159 <filename>/dev/radio</filename> (81, 64) is invariable a radio device, 159 <filename>/dev/radio</filename> (81, 64) is invariable a radio device,
160 unrelated to the video functions. Being unrelated does not imply the 160 unrelated to the video functions. Being unrelated does not imply the
161 devices can be used at the same time, however. The &func-open; 161 devices can be used at the same time, however. The &func-open;
162 function may very well return an &EBUSY;.</para> 162 function may very well return an &EBUSY;.</para>
163 163
164 <para>Besides video input or output the hardware may also 164 <para>Besides video input or output the hardware may also
165 support audio sampling or playback. If so, these functions are 165 support audio sampling or playback. If so, these functions are
166 implemented as OSS or ALSA PCM devices and eventually OSS or ALSA 166 implemented as OSS or ALSA PCM devices and eventually OSS or ALSA
167 audio mixer. The V4L2 API makes no provisions yet to find these 167 audio mixer. The V4L2 API makes no provisions yet to find these
168 related devices. If you have an idea please write to the linux-media 168 related devices. If you have an idea please write to the linux-media
169 mailing list: &v4l-ml;.</para> 169 mailing list: &v4l-ml;.</para>
170 </section> 170 </section>
171 171
172 <section> 172 <section>
173 <title>Multiple Opens</title> 173 <title>Multiple Opens</title>
174 174
175 <para>In general, V4L2 devices can be opened more than once. 175 <para>In general, V4L2 devices can be opened more than once.
176 When this is supported by the driver, users can for example start a 176 When this is supported by the driver, users can for example start a
177 "panel" application to change controls like brightness or audio 177 "panel" application to change controls like brightness or audio
178 volume, while another application captures video and audio. In other words, panel 178 volume, while another application captures video and audio. In other words, panel
179 applications are comparable to an OSS or ALSA audio mixer application. 179 applications are comparable to an OSS or ALSA audio mixer application.
180 When a device supports multiple functions like capturing and overlay 180 When a device supports multiple functions like capturing and overlay
181 <emphasis>simultaneously</emphasis>, multiple opens allow concurrent 181 <emphasis>simultaneously</emphasis>, multiple opens allow concurrent
182 use of the device by forked processes or specialized applications.</para> 182 use of the device by forked processes or specialized applications.</para>
183 183
184 <para>Multiple opens are optional, although drivers should 184 <para>Multiple opens are optional, although drivers should
185 permit at least concurrent accesses without data exchange, &ie; panel 185 permit at least concurrent accesses without data exchange, &ie; panel
186 applications. This implies &func-open; can return an &EBUSY; when the 186 applications. This implies &func-open; can return an &EBUSY; when the
187 device is already in use, as well as &func-ioctl; functions initiating 187 device is already in use, as well as &func-ioctl; functions initiating
188 data exchange (namely the &VIDIOC-S-FMT; ioctl), and the &func-read; 188 data exchange (namely the &VIDIOC-S-FMT; ioctl), and the &func-read;
189 and &func-write; functions.</para> 189 and &func-write; functions.</para>
190 190
191 <para>Mere opening a V4L2 device does not grant exclusive 191 <para>Mere opening a V4L2 device does not grant exclusive
192 access.<footnote> 192 access.<footnote>
193 <para>Drivers could recognize the 193 <para>Drivers could recognize the
194 <constant>O_EXCL</constant> open flag. Presently this is not required, 194 <constant>O_EXCL</constant> open flag. Presently this is not required,
195 so applications cannot know if it really works.</para> 195 so applications cannot know if it really works.</para>
196 </footnote> Initiating data exchange however assigns the right 196 </footnote> Initiating data exchange however assigns the right
197 to read or write the requested type of data, and to change related 197 to read or write the requested type of data, and to change related
198 properties, to this file descriptor. Applications can request 198 properties, to this file descriptor. Applications can request
199 additional access privileges using the priority mechanism described in 199 additional access privileges using the priority mechanism described in
200 <xref linkend="app-pri" />.</para> 200 <xref linkend="app-pri" />.</para>
201 </section> 201 </section>
202 202
203 <section> 203 <section>
204 <title>Shared Data Streams</title> 204 <title>Shared Data Streams</title>
205 205
206 <para>V4L2 drivers should not support multiple applications 206 <para>V4L2 drivers should not support multiple applications
207 reading or writing the same data stream on a device by copying 207 reading or writing the same data stream on a device by copying
208 buffers, time multiplexing or similar means. This is better handled by 208 buffers, time multiplexing or similar means. This is better handled by
209 a proxy application in user space. When the driver supports stream 209 a proxy application in user space. When the driver supports stream
210 sharing anyway it must be implemented transparently. The V4L2 API does 210 sharing anyway it must be implemented transparently. The V4L2 API does
211 not specify how conflicts are solved. <!-- For example O_EXCL when the 211 not specify how conflicts are solved. <!-- For example O_EXCL when the
212 application does not want to be preempted, PROT_READ mmapped buffers 212 application does not want to be preempted, PROT_READ mmapped buffers
213 which can be mapped twice, what happens when image formats do not 213 which can be mapped twice, what happens when image formats do not
214 match etc.--></para> 214 match etc.--></para>
215 </section> 215 </section>
216 216
217 <section> 217 <section>
218 <title>Functions</title> 218 <title>Functions</title>
219 219
220 <para>To open and close V4L2 devices applications use the 220 <para>To open and close V4L2 devices applications use the
221 &func-open; and &func-close; function, respectively. Devices are 221 &func-open; and &func-close; function, respectively. Devices are
222 programmed using the &func-ioctl; function as explained in the 222 programmed using the &func-ioctl; function as explained in the
223 following sections.</para> 223 following sections.</para>
224 </section> 224 </section>
225 </section> 225 </section>
226 226
227 <section id="querycap"> 227 <section id="querycap">
228 <title>Querying Capabilities</title> 228 <title>Querying Capabilities</title>
229 229
230 <para>Because V4L2 covers a wide variety of devices not all 230 <para>Because V4L2 covers a wide variety of devices not all
231 aspects of the API are equally applicable to all types of devices. 231 aspects of the API are equally applicable to all types of devices.
232 Furthermore devices of the same type have different capabilities and 232 Furthermore devices of the same type have different capabilities and
233 this specification permits the omission of a few complicated and less 233 this specification permits the omission of a few complicated and less
234 important parts of the API.</para> 234 important parts of the API.</para>
235 235
236 <para>The &VIDIOC-QUERYCAP; ioctl is available to check if the kernel 236 <para>The &VIDIOC-QUERYCAP; ioctl is available to check if the kernel
237 device is compatible with this specification, and to query the <link 237 device is compatible with this specification, and to query the <link
238 linkend="devices">functions</link> and <link linkend="io">I/O 238 linkend="devices">functions</link> and <link linkend="io">I/O
239 methods</link> supported by the device. Other features can be queried 239 methods</link> supported by the device. Other features can be queried
240 by calling the respective ioctl, for example &VIDIOC-ENUMINPUT; 240 by calling the respective ioctl, for example &VIDIOC-ENUMINPUT;
241 to learn about the number, types and names of video connectors on the 241 to learn about the number, types and names of video connectors on the
242 device. Although abstraction is a major objective of this API, the 242 device. Although abstraction is a major objective of this API, the
243 ioctl also allows driver specific applications to reliable identify 243 ioctl also allows driver specific applications to reliable identify
244 the driver.</para> 244 the driver.</para>
245 245
246 <para>All V4L2 drivers must support 246 <para>All V4L2 drivers must support
247 <constant>VIDIOC_QUERYCAP</constant>. Applications should always call 247 <constant>VIDIOC_QUERYCAP</constant>. Applications should always call
248 this ioctl after opening the device.</para> 248 this ioctl after opening the device.</para>
249 </section> 249 </section>
250 250
251 <section id="app-pri"> 251 <section id="app-pri">
252 <title>Application Priority</title> 252 <title>Application Priority</title>
253 253
254 <para>When multiple applications share a device it may be 254 <para>When multiple applications share a device it may be
255 desirable to assign them different priorities. Contrary to the 255 desirable to assign them different priorities. Contrary to the
256 traditional "rm -rf /" school of thought a video recording application 256 traditional "rm -rf /" school of thought a video recording application
257 could for example block other applications from changing video 257 could for example block other applications from changing video
258 controls or switching the current TV channel. Another objective is to 258 controls or switching the current TV channel. Another objective is to
259 permit low priority applications working in background, which can be 259 permit low priority applications working in background, which can be
260 preempted by user controlled applications and automatically regain 260 preempted by user controlled applications and automatically regain
261 control of the device at a later time.</para> 261 control of the device at a later time.</para>
262 262
263 <para>Since these features cannot be implemented entirely in user 263 <para>Since these features cannot be implemented entirely in user
264 space V4L2 defines the &VIDIOC-G-PRIORITY; and &VIDIOC-S-PRIORITY; 264 space V4L2 defines the &VIDIOC-G-PRIORITY; and &VIDIOC-S-PRIORITY;
265 ioctls to request and query the access priority associate with a file 265 ioctls to request and query the access priority associate with a file
266 descriptor. Opening a device assigns a medium priority, compatible 266 descriptor. Opening a device assigns a medium priority, compatible
267 with earlier versions of V4L2 and drivers not supporting these ioctls. 267 with earlier versions of V4L2 and drivers not supporting these ioctls.
268 Applications requiring a different priority will usually call 268 Applications requiring a different priority will usually call
269 <constant>VIDIOC_S_PRIORITY</constant> after verifying the device with 269 <constant>VIDIOC_S_PRIORITY</constant> after verifying the device with
270 the &VIDIOC-QUERYCAP; ioctl.</para> 270 the &VIDIOC-QUERYCAP; ioctl.</para>
271 271
272 <para>Ioctls changing driver properties, such as &VIDIOC-S-INPUT;, 272 <para>Ioctls changing driver properties, such as &VIDIOC-S-INPUT;,
273 return an &EBUSY; after another application obtained higher priority. 273 return an &EBUSY; after another application obtained higher priority.
274 An event mechanism to notify applications about asynchronous property 274 An event mechanism to notify applications about asynchronous property
275 changes has been proposed but not added yet.</para> 275 changes has been proposed but not added yet.</para>
276 </section> 276 </section>
277 277
278 <section id="video"> 278 <section id="video">
279 <title>Video Inputs and Outputs</title> 279 <title>Video Inputs and Outputs</title>
280 280
281 <para>Video inputs and outputs are physical connectors of a 281 <para>Video inputs and outputs are physical connectors of a
282 device. These can be for example RF connectors (antenna/cable), CVBS 282 device. These can be for example RF connectors (antenna/cable), CVBS
283 a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI 283 a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI
284 capture devices have inputs, output devices have outputs, at least one 284 capture devices have inputs, output devices have outputs, at least one
285 each. Radio devices have no video inputs or outputs.</para> 285 each. Radio devices have no video inputs or outputs.</para>
286 286
287 <para>To learn about the number and attributes of the 287 <para>To learn about the number and attributes of the
288 available inputs and outputs applications can enumerate them with the 288 available inputs and outputs applications can enumerate them with the
289 &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; ioctl, respectively. The 289 &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; ioctl, respectively. The
290 &v4l2-input; returned by the <constant>VIDIOC_ENUMINPUT</constant> 290 &v4l2-input; returned by the <constant>VIDIOC_ENUMINPUT</constant>
291 ioctl also contains signal status information applicable when the 291 ioctl also contains signal status information applicable when the
292 current video input is queried.</para> 292 current video input is queried.</para>
293 293
294 <para>The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctl return the 294 <para>The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctl return the
295 index of the current video input or output. To select a different 295 index of the current video input or output. To select a different
296 input or output applications call the &VIDIOC-S-INPUT; and 296 input or output applications call the &VIDIOC-S-INPUT; and
297 &VIDIOC-S-OUTPUT; ioctl. Drivers must implement all the input ioctls 297 &VIDIOC-S-OUTPUT; ioctl. Drivers must implement all the input ioctls
298 when the device has one or more inputs, all the output ioctls when the 298 when the device has one or more inputs, all the output ioctls when the
299 device has one or more outputs.</para> 299 device has one or more outputs.</para>
300 300
301 <!-- 301 <!--
302 <figure id=io-tree> 302 <figure id=io-tree>
303 <title>Input and output enumeration is the root of most device properties.</title> 303 <title>Input and output enumeration is the root of most device properties.</title>
304 <mediaobject> 304 <mediaobject>
305 <imageobject> 305 <imageobject>
306 <imagedata fileref="links.pdf" format="ps" /> 306 <imagedata fileref="links.pdf" format="ps" />
307 </imageobject> 307 </imageobject>
308 <imageobject> 308 <imageobject>
309 <imagedata fileref="links.gif" format="gif" /> 309 <imagedata fileref="links.gif" format="gif" />
310 </imageobject> 310 </imageobject>
311 <textobject> 311 <textobject>
312 <phrase>Links between various device property structures.</phrase> 312 <phrase>Links between various device property structures.</phrase>
313 </textobject> 313 </textobject>
314 </mediaobject> 314 </mediaobject>
315 </figure> 315 </figure>
316 --> 316 -->
317 317
318 <example> 318 <example>
319 <title>Information about the current video input</title> 319 <title>Information about the current video input</title>
320 320
321 <programlisting> 321 <programlisting>
322 &v4l2-input; input; 322 &v4l2-input; input;
323 int index; 323 int index;
324 324
325 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;index)) { 325 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;index)) {
326 perror ("VIDIOC_G_INPUT"); 326 perror ("VIDIOC_G_INPUT");
327 exit (EXIT_FAILURE); 327 exit (EXIT_FAILURE);
328 } 328 }
329 329
330 memset (&amp;input, 0, sizeof (input)); 330 memset (&amp;input, 0, sizeof (input));
331 input.index = index; 331 input.index = index;
332 332
333 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) { 333 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) {
334 perror ("VIDIOC_ENUMINPUT"); 334 perror ("VIDIOC_ENUMINPUT");
335 exit (EXIT_FAILURE); 335 exit (EXIT_FAILURE);
336 } 336 }
337 337
338 printf ("Current input: %s\n", input.name); 338 printf ("Current input: %s\n", input.name);
339 </programlisting> 339 </programlisting>
340 </example> 340 </example>
341 341
342 <example> 342 <example>
343 <title>Switching to the first video input</title> 343 <title>Switching to the first video input</title>
344 344
345 <programlisting> 345 <programlisting>
346 int index; 346 int index;
347 347
348 index = 0; 348 index = 0;
349 349
350 if (-1 == ioctl (fd, &VIDIOC-S-INPUT;, &amp;index)) { 350 if (-1 == ioctl (fd, &VIDIOC-S-INPUT;, &amp;index)) {
351 perror ("VIDIOC_S_INPUT"); 351 perror ("VIDIOC_S_INPUT");
352 exit (EXIT_FAILURE); 352 exit (EXIT_FAILURE);
353 } 353 }
354 </programlisting> 354 </programlisting>
355 </example> 355 </example>
356 </section> 356 </section>
357 357
358 <section id="audio"> 358 <section id="audio">
359 <title>Audio Inputs and Outputs</title> 359 <title>Audio Inputs and Outputs</title>
360 360
361 <para>Audio inputs and outputs are physical connectors of a 361 <para>Audio inputs and outputs are physical connectors of a
362 device. Video capture devices have inputs, output devices have 362 device. Video capture devices have inputs, output devices have
363 outputs, zero or more each. Radio devices have no audio inputs or 363 outputs, zero or more each. Radio devices have no audio inputs or
364 outputs. They have exactly one tuner which in fact 364 outputs. They have exactly one tuner which in fact
365 <emphasis>is</emphasis> an audio source, but this API associates 365 <emphasis>is</emphasis> an audio source, but this API associates
366 tuners with video inputs or outputs only, and radio devices have 366 tuners with video inputs or outputs only, and radio devices have
367 none of these.<footnote> 367 none of these.<footnote>
368 <para>Actually &v4l2-audio; ought to have a 368 <para>Actually &v4l2-audio; ought to have a
369 <structfield>tuner</structfield> field like &v4l2-input;, not only 369 <structfield>tuner</structfield> field like &v4l2-input;, not only
370 making the API more consistent but also permitting radio devices with 370 making the API more consistent but also permitting radio devices with
371 multiple tuners.</para> 371 multiple tuners.</para>
372 </footnote> A connector on a TV card to loop back the received 372 </footnote> A connector on a TV card to loop back the received
373 audio signal to a sound card is not considered an audio output.</para> 373 audio signal to a sound card is not considered an audio output.</para>
374 374
375 <para>Audio and video inputs and outputs are associated. Selecting 375 <para>Audio and video inputs and outputs are associated. Selecting
376 a video source also selects an audio source. This is most evident when 376 a video source also selects an audio source. This is most evident when
377 the video and audio source is a tuner. Further audio connectors can 377 the video and audio source is a tuner. Further audio connectors can
378 combine with more than one video input or output. Assumed two 378 combine with more than one video input or output. Assumed two
379 composite video inputs and two audio inputs exist, there may be up to 379 composite video inputs and two audio inputs exist, there may be up to
380 four valid combinations. The relation of video and audio connectors 380 four valid combinations. The relation of video and audio connectors
381 is defined in the <structfield>audioset</structfield> field of the 381 is defined in the <structfield>audioset</structfield> field of the
382 respective &v4l2-input; or &v4l2-output;, where each bit represents 382 respective &v4l2-input; or &v4l2-output;, where each bit represents
383 the index number, starting at zero, of one audio input or output.</para> 383 the index number, starting at zero, of one audio input or output.</para>
384 384
385 <para>To learn about the number and attributes of the 385 <para>To learn about the number and attributes of the
386 available inputs and outputs applications can enumerate them with the 386 available inputs and outputs applications can enumerate them with the
387 &VIDIOC-ENUMAUDIO; and &VIDIOC-ENUMAUDOUT; ioctl, respectively. The 387 &VIDIOC-ENUMAUDIO; and &VIDIOC-ENUMAUDOUT; ioctl, respectively. The
388 &v4l2-audio; returned by the <constant>VIDIOC_ENUMAUDIO</constant> ioctl 388 &v4l2-audio; returned by the <constant>VIDIOC_ENUMAUDIO</constant> ioctl
389 also contains signal status information applicable when the current 389 also contains signal status information applicable when the current
390 audio input is queried.</para> 390 audio input is queried.</para>
391 391
392 <para>The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctl report 392 <para>The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctl report
393 the current audio input and output, respectively. Note that, unlike 393 the current audio input and output, respectively. Note that, unlike
394 &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; these ioctls return a structure 394 &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; these ioctls return a structure
395 as <constant>VIDIOC_ENUMAUDIO</constant> and 395 as <constant>VIDIOC_ENUMAUDIO</constant> and
396 <constant>VIDIOC_ENUMAUDOUT</constant> do, not just an index.</para> 396 <constant>VIDIOC_ENUMAUDOUT</constant> do, not just an index.</para>
397 397
398 <para>To select an audio input and change its properties 398 <para>To select an audio input and change its properties
399 applications call the &VIDIOC-S-AUDIO; ioctl. To select an audio 399 applications call the &VIDIOC-S-AUDIO; ioctl. To select an audio
400 output (which presently has no changeable properties) applications 400 output (which presently has no changeable properties) applications
401 call the &VIDIOC-S-AUDOUT; ioctl.</para> 401 call the &VIDIOC-S-AUDOUT; ioctl.</para>
402 402
403 <para>Drivers must implement all input ioctls when the device 403 <para>Drivers must implement all input ioctls when the device
404 has one or more inputs, all output ioctls when the device has one 404 has one or more inputs, all output ioctls when the device has one
405 or more outputs. When the device has any audio inputs or outputs the 405 or more outputs. When the device has any audio inputs or outputs the
406 driver must set the <constant>V4L2_CAP_AUDIO</constant> flag in the 406 driver must set the <constant>V4L2_CAP_AUDIO</constant> flag in the
407 &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl.</para> 407 &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl.</para>
408 408
409 <example> 409 <example>
410 <title>Information about the current audio input</title> 410 <title>Information about the current audio input</title>
411 411
412 <programlisting> 412 <programlisting>
413 &v4l2-audio; audio; 413 &v4l2-audio; audio;
414 414
415 memset (&amp;audio, 0, sizeof (audio)); 415 memset (&amp;audio, 0, sizeof (audio));
416 416
417 if (-1 == ioctl (fd, &VIDIOC-G-AUDIO;, &amp;audio)) { 417 if (-1 == ioctl (fd, &VIDIOC-G-AUDIO;, &amp;audio)) {
418 perror ("VIDIOC_G_AUDIO"); 418 perror ("VIDIOC_G_AUDIO");
419 exit (EXIT_FAILURE); 419 exit (EXIT_FAILURE);
420 } 420 }
421 421
422 printf ("Current input: %s\n", audio.name); 422 printf ("Current input: %s\n", audio.name);
423 </programlisting> 423 </programlisting>
424 </example> 424 </example>
425 425
426 <example> 426 <example>
427 <title>Switching to the first audio input</title> 427 <title>Switching to the first audio input</title>
428 428
429 <programlisting> 429 <programlisting>
430 &v4l2-audio; audio; 430 &v4l2-audio; audio;
431 431
432 memset (&amp;audio, 0, sizeof (audio)); /* clear audio.mode, audio.reserved */ 432 memset (&amp;audio, 0, sizeof (audio)); /* clear audio.mode, audio.reserved */
433 433
434 audio.index = 0; 434 audio.index = 0;
435 435
436 if (-1 == ioctl (fd, &VIDIOC-S-AUDIO;, &amp;audio)) { 436 if (-1 == ioctl (fd, &VIDIOC-S-AUDIO;, &amp;audio)) {
437 perror ("VIDIOC_S_AUDIO"); 437 perror ("VIDIOC_S_AUDIO");
438 exit (EXIT_FAILURE); 438 exit (EXIT_FAILURE);
439 } 439 }
440 </programlisting> 440 </programlisting>
441 </example> 441 </example>
442 </section> 442 </section>
443 443
444 <section id="tuner"> 444 <section id="tuner">
445 <title>Tuners and Modulators</title> 445 <title>Tuners and Modulators</title>
446 446
447 <section> 447 <section>
448 <title>Tuners</title> 448 <title>Tuners</title>
449 449
450 <para>Video input devices can have one or more tuners 450 <para>Video input devices can have one or more tuners
451 demodulating a RF signal. Each tuner is associated with one or more 451 demodulating a RF signal. Each tuner is associated with one or more
452 video inputs, depending on the number of RF connectors on the tuner. 452 video inputs, depending on the number of RF connectors on the tuner.
453 The <structfield>type</structfield> field of the respective 453 The <structfield>type</structfield> field of the respective
454 &v4l2-input; returned by the &VIDIOC-ENUMINPUT; ioctl is set to 454 &v4l2-input; returned by the &VIDIOC-ENUMINPUT; ioctl is set to
455 <constant>V4L2_INPUT_TYPE_TUNER</constant> and its 455 <constant>V4L2_INPUT_TYPE_TUNER</constant> and its
456 <structfield>tuner</structfield> field contains the index number of 456 <structfield>tuner</structfield> field contains the index number of
457 the tuner.</para> 457 the tuner.</para>
458 458
459 <para>Radio devices have exactly one tuner with index zero, no 459 <para>Radio devices have exactly one tuner with index zero, no
460 video inputs.</para> 460 video inputs.</para>
461 461
462 <para>To query and change tuner properties applications use the 462 <para>To query and change tuner properties applications use the
463 &VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The 463 &VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The
464 &v4l2-tuner; returned by <constant>VIDIOC_G_TUNER</constant> also 464 &v4l2-tuner; returned by <constant>VIDIOC_G_TUNER</constant> also
465 contains signal status information applicable when the tuner of the 465 contains signal status information applicable when the tuner of the
466 current video input, or a radio tuner is queried. Note that 466 current video input, or a radio tuner is queried. Note that
467 <constant>VIDIOC_S_TUNER</constant> does not switch the current tuner, 467 <constant>VIDIOC_S_TUNER</constant> does not switch the current tuner,
468 when there is more than one at all. The tuner is solely determined by 468 when there is more than one at all. The tuner is solely determined by
469 the current video input. Drivers must support both ioctls and set the 469 the current video input. Drivers must support both ioctls and set the
470 <constant>V4L2_CAP_TUNER</constant> flag in the &v4l2-capability; 470 <constant>V4L2_CAP_TUNER</constant> flag in the &v4l2-capability;
471 returned by the &VIDIOC-QUERYCAP; ioctl when the device has one or 471 returned by the &VIDIOC-QUERYCAP; ioctl when the device has one or
472 more tuners.</para> 472 more tuners.</para>
473 </section> 473 </section>
474 474
475 <section> 475 <section>
476 <title>Modulators</title> 476 <title>Modulators</title>
477 477
478 <para>Video output devices can have one or more modulators, uh, 478 <para>Video output devices can have one or more modulators, uh,
479 modulating a video signal for radiation or connection to the antenna 479 modulating a video signal for radiation or connection to the antenna
480 input of a TV set or video recorder. Each modulator is associated with 480 input of a TV set or video recorder. Each modulator is associated with
481 one or more video outputs, depending on the number of RF connectors on 481 one or more video outputs, depending on the number of RF connectors on
482 the modulator. The <structfield>type</structfield> field of the 482 the modulator. The <structfield>type</structfield> field of the
483 respective &v4l2-output; returned by the &VIDIOC-ENUMOUTPUT; ioctl is 483 respective &v4l2-output; returned by the &VIDIOC-ENUMOUTPUT; ioctl is
484 set to <constant>V4L2_OUTPUT_TYPE_MODULATOR</constant> and its 484 set to <constant>V4L2_OUTPUT_TYPE_MODULATOR</constant> and its
485 <structfield>modulator</structfield> field contains the index number 485 <structfield>modulator</structfield> field contains the index number
486 of the modulator. This specification does not define radio output 486 of the modulator. This specification does not define radio output
487 devices.</para> 487 devices.</para>
488 488
489 <para>To query and change modulator properties applications use 489 <para>To query and change modulator properties applications use
490 the &VIDIOC-G-MODULATOR; and &VIDIOC-S-MODULATOR; ioctl. Note that 490 the &VIDIOC-G-MODULATOR; and &VIDIOC-S-MODULATOR; ioctl. Note that
491 <constant>VIDIOC_S_MODULATOR</constant> does not switch the current 491 <constant>VIDIOC_S_MODULATOR</constant> does not switch the current
492 modulator, when there is more than one at all. The modulator is solely 492 modulator, when there is more than one at all. The modulator is solely
493 determined by the current video output. Drivers must support both 493 determined by the current video output. Drivers must support both
494 ioctls and set the <constant>V4L2_CAP_MODULATOR</constant> flag in 494 ioctls and set the <constant>V4L2_CAP_MODULATOR</constant> flag in
495 the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl when the 495 the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl when the
496 device has one or more modulators.</para> 496 device has one or more modulators.</para>
497 </section> 497 </section>
498 498
499 <section> 499 <section>
500 <title>Radio Frequency</title> 500 <title>Radio Frequency</title>
501 501
502 <para>To get and set the tuner or modulator radio frequency 502 <para>To get and set the tuner or modulator radio frequency
503 applications use the &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY; 503 applications use the &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;
504 ioctl which both take a pointer to a &v4l2-frequency;. These ioctls 504 ioctl which both take a pointer to a &v4l2-frequency;. These ioctls
505 are used for TV and radio devices alike. Drivers must support both 505 are used for TV and radio devices alike. Drivers must support both
506 ioctls when the tuner or modulator ioctls are supported, or 506 ioctls when the tuner or modulator ioctls are supported, or
507 when the device is a radio device.</para> 507 when the device is a radio device.</para>
508 </section> 508 </section>
509 </section> 509 </section>
510 510
511 <section id="standard"> 511 <section id="standard">
512 <title>Video Standards</title> 512 <title>Video Standards</title>
513 513
514 <para>Video devices typically support one or more different video 514 <para>Video devices typically support one or more different video
515 standards or variations of standards. Each video input and output may 515 standards or variations of standards. Each video input and output may
516 support another set of standards. This set is reported by the 516 support another set of standards. This set is reported by the
517 <structfield>std</structfield> field of &v4l2-input; and 517 <structfield>std</structfield> field of &v4l2-input; and
518 &v4l2-output; returned by the &VIDIOC-ENUMINPUT; and 518 &v4l2-output; returned by the &VIDIOC-ENUMINPUT; and
519 &VIDIOC-ENUMOUTPUT; ioctl, respectively.</para> 519 &VIDIOC-ENUMOUTPUT; ioctl, respectively.</para>
520 520
521 <para>V4L2 defines one bit for each analog video standard 521 <para>V4L2 defines one bit for each analog video standard
522 currently in use worldwide, and sets aside bits for driver defined 522 currently in use worldwide, and sets aside bits for driver defined
523 standards, &eg; hybrid standards to watch NTSC video tapes on PAL TVs 523 standards, &eg; hybrid standards to watch NTSC video tapes on PAL TVs
524 and vice versa. Applications can use the predefined bits to select a 524 and vice versa. Applications can use the predefined bits to select a
525 particular standard, although presenting the user a menu of supported 525 particular standard, although presenting the user a menu of supported
526 standards is preferred. To enumerate and query the attributes of the 526 standards is preferred. To enumerate and query the attributes of the
527 supported standards applications use the &VIDIOC-ENUMSTD; ioctl.</para> 527 supported standards applications use the &VIDIOC-ENUMSTD; ioctl.</para>
528 528
529 <para>Many of the defined standards are actually just variations 529 <para>Many of the defined standards are actually just variations
530 of a few major standards. The hardware may in fact not distinguish 530 of a few major standards. The hardware may in fact not distinguish
531 between them, or do so internal and switch automatically. Therefore 531 between them, or do so internal and switch automatically. Therefore
532 enumerated standards also contain sets of one or more standard 532 enumerated standards also contain sets of one or more standard
533 bits.</para> 533 bits.</para>
534 534
535 <para>Assume a hypothetic tuner capable of demodulating B/PAL, 535 <para>Assume a hypothetic tuner capable of demodulating B/PAL,
536 G/PAL and I/PAL signals. The first enumerated standard is a set of B 536 G/PAL and I/PAL signals. The first enumerated standard is a set of B
537 and G/PAL, switched automatically depending on the selected radio 537 and G/PAL, switched automatically depending on the selected radio
538 frequency in UHF or VHF band. Enumeration gives a "PAL-B/G" or "PAL-I" 538 frequency in UHF or VHF band. Enumeration gives a "PAL-B/G" or "PAL-I"
539 choice. Similar a Composite input may collapse standards, enumerating 539 choice. Similar a Composite input may collapse standards, enumerating
540 "PAL-B/G/H/I", "NTSC-M" and "SECAM-D/K".<footnote> 540 "PAL-B/G/H/I", "NTSC-M" and "SECAM-D/K".<footnote>
541 <para>Some users are already confused by technical terms PAL, 541 <para>Some users are already confused by technical terms PAL,
542 NTSC and SECAM. There is no point asking them to distinguish between 542 NTSC and SECAM. There is no point asking them to distinguish between
543 B, G, D, or K when the software or hardware can do that 543 B, G, D, or K when the software or hardware can do that
544 automatically.</para> 544 automatically.</para>
545 </footnote></para> 545 </footnote></para>
546 546
547 <para>To query and select the standard used by the current video 547 <para>To query and select the standard used by the current video
548 input or output applications call the &VIDIOC-G-STD; and 548 input or output applications call the &VIDIOC-G-STD; and
549 &VIDIOC-S-STD; ioctl, respectively. The <emphasis>received</emphasis> 549 &VIDIOC-S-STD; ioctl, respectively. The <emphasis>received</emphasis>
550 standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note parameter of all these ioctls is a pointer to a &v4l2-std-id; type (a standard set), <emphasis>not</emphasis> an index into the standard enumeration.<footnote> 550 standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note parameter of all these ioctls is a pointer to a &v4l2-std-id; type (a standard set), <emphasis>not</emphasis> an index into the standard enumeration.<footnote>
551 <para>An alternative to the current scheme is to use pointers 551 <para>An alternative to the current scheme is to use pointers
552 to indices as arguments of <constant>VIDIOC_G_STD</constant> and 552 to indices as arguments of <constant>VIDIOC_G_STD</constant> and
553 <constant>VIDIOC_S_STD</constant>, the &v4l2-input; and 553 <constant>VIDIOC_S_STD</constant>, the &v4l2-input; and
554 &v4l2-output; <structfield>std</structfield> field would be a set of 554 &v4l2-output; <structfield>std</structfield> field would be a set of
555 indices like <structfield>audioset</structfield>.</para> 555 indices like <structfield>audioset</structfield>.</para>
556 <para>Indices are consistent with the rest of the API 556 <para>Indices are consistent with the rest of the API
557 and identify the standard unambiguously. In the present scheme of 557 and identify the standard unambiguously. In the present scheme of
558 things an enumerated standard is looked up by &v4l2-std-id;. Now the 558 things an enumerated standard is looked up by &v4l2-std-id;. Now the
559 standards supported by the inputs of a device can overlap. Just 559 standards supported by the inputs of a device can overlap. Just
560 assume the tuner and composite input in the example above both 560 assume the tuner and composite input in the example above both
561 exist on a device. An enumeration of "PAL-B/G", "PAL-H/I" suggests 561 exist on a device. An enumeration of "PAL-B/G", "PAL-H/I" suggests
562 a choice which does not exist. We cannot merge or omit sets, because 562 a choice which does not exist. We cannot merge or omit sets, because
563 applications would be unable to find the standards reported by 563 applications would be unable to find the standards reported by
564 <constant>VIDIOC_G_STD</constant>. That leaves separate enumerations 564 <constant>VIDIOC_G_STD</constant>. That leaves separate enumerations
565 for each input. Also selecting a standard by &v4l2-std-id; can be 565 for each input. Also selecting a standard by &v4l2-std-id; can be
566 ambiguous. Advantage of this method is that applications need not 566 ambiguous. Advantage of this method is that applications need not
567 identify the standard indirectly, after enumerating.</para><para>So in 567 identify the standard indirectly, after enumerating.</para><para>So in
568 summary, the lookup itself is unavoidable. The difference is only 568 summary, the lookup itself is unavoidable. The difference is only
569 whether the lookup is necessary to find an enumerated standard or to 569 whether the lookup is necessary to find an enumerated standard or to
570 switch to a standard by &v4l2-std-id;.</para> 570 switch to a standard by &v4l2-std-id;.</para>
571 </footnote> Drivers must implement all video standard ioctls 571 </footnote> Drivers must implement all video standard ioctls
572 when the device has one or more video inputs or outputs.</para> 572 when the device has one or more video inputs or outputs.</para>
573 573
574 <para>Special rules apply to USB cameras where the notion of video 574 <para>Special rules apply to USB cameras where the notion of video
575 standards makes little sense. More generally any capture device, 575 standards makes little sense. More generally any capture device,
576 output devices accordingly, which is <itemizedlist> 576 output devices accordingly, which is <itemizedlist>
577 <listitem> 577 <listitem>
578 <para>incapable of capturing fields or frames at the nominal 578 <para>incapable of capturing fields or frames at the nominal
579 rate of the video standard, or</para> 579 rate of the video standard, or</para>
580 </listitem> 580 </listitem>
581 <listitem> 581 <listitem>
582 <para>where <link linkend="buffer">timestamps</link> refer 582 <para>where <link linkend="buffer">timestamps</link> refer
583 to the instant the field or frame was received by the driver, not the 583 to the instant the field or frame was received by the driver, not the
584 capture time, or</para> 584 capture time, or</para>
585 </listitem> 585 </listitem>
586 <listitem> 586 <listitem>
587 <para>where <link linkend="buffer">sequence numbers</link> 587 <para>where <link linkend="buffer">sequence numbers</link>
588 refer to the frames received by the driver, not the captured 588 refer to the frames received by the driver, not the captured
589 frames.</para> 589 frames.</para>
590 </listitem> 590 </listitem>
591 </itemizedlist> Here the driver shall set the 591 </itemizedlist> Here the driver shall set the
592 <structfield>std</structfield> field of &v4l2-input; and &v4l2-output; 592 <structfield>std</structfield> field of &v4l2-input; and &v4l2-output;
593 to zero, the <constant>VIDIOC_G_STD</constant>, 593 to zero, the <constant>VIDIOC_G_STD</constant>,
594 <constant>VIDIOC_S_STD</constant>, 594 <constant>VIDIOC_S_STD</constant>,
595 <constant>VIDIOC_QUERYSTD</constant> and 595 <constant>VIDIOC_QUERYSTD</constant> and
596 <constant>VIDIOC_ENUMSTD</constant> ioctls shall return the 596 <constant>VIDIOC_ENUMSTD</constant> ioctls shall return the
597 &EINVAL;.<footnote> 597 &EINVAL;.<footnote>
598 <para>See <xref linkend="buffer" /> for a rationale. Probably 598 <para>See <xref linkend="buffer" /> for a rationale. Probably
599 even USB cameras follow some well known video standard. It might have 599 even USB cameras follow some well known video standard. It might have
600 been better to explicitly indicate elsewhere if a device cannot live 600 been better to explicitly indicate elsewhere if a device cannot live
601 up to normal expectations, instead of this exception.</para> 601 up to normal expectations, instead of this exception.</para>
602 </footnote></para> 602 </footnote></para>
603 603
604 <example> 604 <example>
605 <title>Information about the current video standard</title> 605 <title>Information about the current video standard</title>
606 606
607 <programlisting> 607 <programlisting>
608 &v4l2-std-id; std_id; 608 &v4l2-std-id; std_id;
609 &v4l2-standard; standard; 609 &v4l2-standard; standard;
610 610
611 if (-1 == ioctl (fd, &VIDIOC-G-STD;, &amp;std_id)) { 611 if (-1 == ioctl (fd, &VIDIOC-G-STD;, &amp;std_id)) {
612 /* Note when VIDIOC_ENUMSTD always returns EINVAL this 612 /* Note when VIDIOC_ENUMSTD always returns EINVAL this
613 is no video device or it falls under the USB exception, 613 is no video device or it falls under the USB exception,
614 and VIDIOC_G_STD returning EINVAL is no error. */ 614 and VIDIOC_G_STD returning EINVAL is no error. */
615 615
616 perror ("VIDIOC_G_STD"); 616 perror ("VIDIOC_G_STD");
617 exit (EXIT_FAILURE); 617 exit (EXIT_FAILURE);
618 } 618 }
619 619
620 memset (&amp;standard, 0, sizeof (standard)); 620 memset (&amp;standard, 0, sizeof (standard));
621 standard.index = 0; 621 standard.index = 0;
622 622
623 while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &amp;standard)) { 623 while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &amp;standard)) {
624 if (standard.id &amp; std_id) { 624 if (standard.id &amp; std_id) {
625 printf ("Current video standard: %s\n", standard.name); 625 printf ("Current video standard: %s\n", standard.name);
626 exit (EXIT_SUCCESS); 626 exit (EXIT_SUCCESS);
627 } 627 }
628 628
629 standard.index++; 629 standard.index++;
630 } 630 }
631 631
632 /* EINVAL indicates the end of the enumeration, which cannot be 632 /* EINVAL indicates the end of the enumeration, which cannot be
633 empty unless this device falls under the USB exception. */ 633 empty unless this device falls under the USB exception. */
634 634
635 if (errno == EINVAL || standard.index == 0) { 635 if (errno == EINVAL || standard.index == 0) {
636 perror ("VIDIOC_ENUMSTD"); 636 perror ("VIDIOC_ENUMSTD");
637 exit (EXIT_FAILURE); 637 exit (EXIT_FAILURE);
638 } 638 }
639 </programlisting> 639 </programlisting>
640 </example> 640 </example>
641 641
642 <example> 642 <example>
643 <title>Listing the video standards supported by the current 643 <title>Listing the video standards supported by the current
644 input</title> 644 input</title>
645 645
646 <programlisting> 646 <programlisting>
647 &v4l2-input; input; 647 &v4l2-input; input;
648 &v4l2-standard; standard; 648 &v4l2-standard; standard;
649 649
650 memset (&amp;input, 0, sizeof (input)); 650 memset (&amp;input, 0, sizeof (input));
651 651
652 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;input.index)) { 652 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;input.index)) {
653 perror ("VIDIOC_G_INPUT"); 653 perror ("VIDIOC_G_INPUT");
654 exit (EXIT_FAILURE); 654 exit (EXIT_FAILURE);
655 } 655 }
656 656
657 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) { 657 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) {
658 perror ("VIDIOC_ENUM_INPUT"); 658 perror ("VIDIOC_ENUM_INPUT");
659 exit (EXIT_FAILURE); 659 exit (EXIT_FAILURE);
660 } 660 }
661 661
662 printf ("Current input %s supports:\n", input.name); 662 printf ("Current input %s supports:\n", input.name);
663 663
664 memset (&amp;standard, 0, sizeof (standard)); 664 memset (&amp;standard, 0, sizeof (standard));
665 standard.index = 0; 665 standard.index = 0;
666 666
667 while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &amp;standard)) { 667 while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &amp;standard)) {
668 if (standard.id &amp; input.std) 668 if (standard.id &amp; input.std)
669 printf ("%s\n", standard.name); 669 printf ("%s\n", standard.name);
670 670
671 standard.index++; 671 standard.index++;
672 } 672 }
673 673
674 /* EINVAL indicates the end of the enumeration, which cannot be 674 /* EINVAL indicates the end of the enumeration, which cannot be
675 empty unless this device falls under the USB exception. */ 675 empty unless this device falls under the USB exception. */
676 676
677 if (errno != EINVAL || standard.index == 0) { 677 if (errno != EINVAL || standard.index == 0) {
678 perror ("VIDIOC_ENUMSTD"); 678 perror ("VIDIOC_ENUMSTD");
679 exit (EXIT_FAILURE); 679 exit (EXIT_FAILURE);
680 } 680 }
681 </programlisting> 681 </programlisting>
682 </example> 682 </example>
683 683
684 <example> 684 <example>
685 <title>Selecting a new video standard</title> 685 <title>Selecting a new video standard</title>
686 686
687 <programlisting> 687 <programlisting>
688 &v4l2-input; input; 688 &v4l2-input; input;
689 &v4l2-std-id; std_id; 689 &v4l2-std-id; std_id;
690 690
691 memset (&amp;input, 0, sizeof (input)); 691 memset (&amp;input, 0, sizeof (input));
692 692
693 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;input.index)) { 693 if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &amp;input.index)) {
694 perror ("VIDIOC_G_INPUT"); 694 perror ("VIDIOC_G_INPUT");
695 exit (EXIT_FAILURE); 695 exit (EXIT_FAILURE);
696 } 696 }
697 697
698 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) { 698 if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &amp;input)) {
699 perror ("VIDIOC_ENUM_INPUT"); 699 perror ("VIDIOC_ENUM_INPUT");
700 exit (EXIT_FAILURE); 700 exit (EXIT_FAILURE);
701 } 701 }
702 702
703 if (0 == (input.std &amp; V4L2_STD_PAL_BG)) { 703 if (0 == (input.std &amp; V4L2_STD_PAL_BG)) {
704 fprintf (stderr, "Oops. B/G PAL is not supported.\n"); 704 fprintf (stderr, "Oops. B/G PAL is not supported.\n");
705 exit (EXIT_FAILURE); 705 exit (EXIT_FAILURE);
706 } 706 }
707 707
708 /* Note this is also supposed to work when only B 708 /* Note this is also supposed to work when only B
709 <emphasis>or</emphasis> G/PAL is supported. */ 709 <emphasis>or</emphasis> G/PAL is supported. */
710 710
711 std_id = V4L2_STD_PAL_BG; 711 std_id = V4L2_STD_PAL_BG;
712 712
713 if (-1 == ioctl (fd, &VIDIOC-S-STD;, &amp;std_id)) { 713 if (-1 == ioctl (fd, &VIDIOC-S-STD;, &amp;std_id)) {
714 perror ("VIDIOC_S_STD"); 714 perror ("VIDIOC_S_STD");
715 exit (EXIT_FAILURE); 715 exit (EXIT_FAILURE);
716 } 716 }
717 </programlisting> 717 </programlisting>
718 </example> 718 </example>
719 <section id="dv-timings"> 719 <section id="dv-timings">
720 <title>Digital Video (DV) Timings</title> 720 <title>Digital Video (DV) Timings</title>
721 <para> 721 <para>
722 The video standards discussed so far has been dealing with Analog TV and the 722 The video standards discussed so far has been dealing with Analog TV and the
723 corresponding video timings. Today there are many more different hardware interfaces 723 corresponding video timings. Today there are many more different hardware interfaces
724 such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry 724 such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry
725 video signals and there is a need to extend the API to select the video timings 725 video signals and there is a need to extend the API to select the video timings
726 for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to 726 for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to
727 the limited bits available, a new set of IOCTLs is added to set/get video timings at 727 the limited bits available, a new set of IOCTLs is added to set/get video timings at
728 the input and output: </para><itemizedlist> 728 the input and output: </para><itemizedlist>
729 <listitem> 729 <listitem>
730 <para>DV Presets: Digital Video (DV) presets. These are IDs representing a 730 <para>DV Presets: Digital Video (DV) presets. These are IDs representing a
731 video timing at the input/output. Presets are pre-defined timings implemented 731 video timing at the input/output. Presets are pre-defined timings implemented
732 by the hardware according to video standards. A __u32 data type is used to represent 732 by the hardware according to video standards. A __u32 data type is used to represent
733 a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions 733 a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions
734 to support as many different presets as needed.</para> 734 to support as many different presets as needed.</para>
735 </listitem> 735 </listitem>
736 <listitem> 736 <listitem>
737 <para>Custom DV Timings: This will allow applications to define more detailed 737 <para>Custom DV Timings: This will allow applications to define more detailed
738 custom video timings for the interface. This includes parameters such as width, height, 738 custom video timings for the interface. This includes parameters such as width, height,
739 polarities, frontporch, backporch etc. 739 polarities, frontporch, backporch etc.
740 </para> 740 </para>
741 </listitem> 741 </listitem>
742 </itemizedlist> 742 </itemizedlist>
743 <para>To enumerate and query the attributes of DV presets supported by a device, 743 <para>To enumerate and query the attributes of DV presets supported by a device,
744 applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset, 744 applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset,
745 applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the 745 applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the
746 &VIDIOC-S-DV-PRESET; ioctl.</para> 746 &VIDIOC-S-DV-PRESET; ioctl.</para>
747 <para>To set custom DV timings for the device, applications use the 747 <para>To set custom DV timings for the device, applications use the
748 &VIDIOC-S-DV-TIMINGS; ioctl and to get current custom DV timings they use the 748 &VIDIOC-S-DV-TIMINGS; ioctl and to get current custom DV timings they use the
749 &VIDIOC-G-DV-TIMINGS; ioctl.</para> 749 &VIDIOC-G-DV-TIMINGS; ioctl.</para>
750 <para>Applications can make use of the <xref linkend="input-capabilities" /> and 750 <para>Applications can make use of the <xref linkend="input-capabilities" /> and
751 <xref linkend="output-capabilities"/> flags to decide what ioctls are available to set the 751 <xref linkend="output-capabilities"/> flags to decide what ioctls are available to set the
752 video timings for the device.</para> 752 video timings for the device.</para>
753 </section> 753 </section>
754 </section> 754 </section>
755 755
756 &sub-controls; 756 &sub-controls;
757 757
758 <section id="format"> 758 <section id="format">
759 <title>Data Formats</title> 759 <title>Data Formats</title>
760 760
761 <section> 761 <section>
762 <title>Data Format Negotiation</title> 762 <title>Data Format Negotiation</title>
763 763
764 <para>Different devices exchange different kinds of data with 764 <para>Different devices exchange different kinds of data with
765 applications, for example video images, raw or sliced VBI data, RDS 765 applications, for example video images, raw or sliced VBI data, RDS
766 datagrams. Even within one kind many different formats are possible, 766 datagrams. Even within one kind many different formats are possible,
767 in particular an abundance of image formats. Although drivers must 767 in particular an abundance of image formats. Although drivers must
768 provide a default and the selection persists across closing and 768 provide a default and the selection persists across closing and
769 reopening a device, applications should always negotiate a data format 769 reopening a device, applications should always negotiate a data format
770 before engaging in data exchange. Negotiation means the application 770 before engaging in data exchange. Negotiation means the application
771 asks for a particular format and the driver selects and reports the 771 asks for a particular format and the driver selects and reports the
772 best the hardware can do to satisfy the request. Of course 772 best the hardware can do to satisfy the request. Of course
773 applications can also just query the current selection.</para> 773 applications can also just query the current selection.</para>
774 774
775 <para>A single mechanism exists to negotiate all data formats 775 <para>A single mechanism exists to negotiate all data formats
776 using the aggregate &v4l2-format; and the &VIDIOC-G-FMT; and 776 using the aggregate &v4l2-format; and the &VIDIOC-G-FMT; and
777 &VIDIOC-S-FMT; ioctls. Additionally the &VIDIOC-TRY-FMT; ioctl can be 777 &VIDIOC-S-FMT; ioctls. Additionally the &VIDIOC-TRY-FMT; ioctl can be
778 used to examine what the hardware <emphasis>could</emphasis> do, 778 used to examine what the hardware <emphasis>could</emphasis> do,
779 without actually selecting a new data format. The data formats 779 without actually selecting a new data format. The data formats
780 supported by the V4L2 API are covered in the respective device section 780 supported by the V4L2 API are covered in the respective device section
781 in <xref linkend="devices" />. For a closer look at image formats see 781 in <xref linkend="devices" />. For a closer look at image formats see
782 <xref linkend="pixfmt" />.</para> 782 <xref linkend="pixfmt" />.</para>
783 783
784 <para>The <constant>VIDIOC_S_FMT</constant> ioctl is a major 784 <para>The <constant>VIDIOC_S_FMT</constant> ioctl is a major
785 turning-point in the initialization sequence. Prior to this point 785 turning-point in the initialization sequence. Prior to this point
786 multiple panel applications can access the same device concurrently to 786 multiple panel applications can access the same device concurrently to
787 select the current input, change controls or modify other properties. 787 select the current input, change controls or modify other properties.
788 The first <constant>VIDIOC_S_FMT</constant> assigns a logical stream 788 The first <constant>VIDIOC_S_FMT</constant> assigns a logical stream
789 (video data, VBI data etc.) exclusively to one file descriptor.</para> 789 (video data, VBI data etc.) exclusively to one file descriptor.</para>
790 790
791 <para>Exclusive means no other application, more precisely no 791 <para>Exclusive means no other application, more precisely no
792 other file descriptor, can grab this stream or change device 792 other file descriptor, can grab this stream or change device
793 properties inconsistent with the negotiated parameters. A video 793 properties inconsistent with the negotiated parameters. A video
794 standard change for example, when the new standard uses a different 794 standard change for example, when the new standard uses a different
795 number of scan lines, can invalidate the selected image format. 795 number of scan lines, can invalidate the selected image format.
796 Therefore only the file descriptor owning the stream can make 796 Therefore only the file descriptor owning the stream can make
797 invalidating changes. Accordingly multiple file descriptors which 797 invalidating changes. Accordingly multiple file descriptors which
798 grabbed different logical streams prevent each other from interfering 798 grabbed different logical streams prevent each other from interfering
799 with their settings. When for example video overlay is about to start 799 with their settings. When for example video overlay is about to start
800 or already in progress, simultaneous video capturing may be restricted 800 or already in progress, simultaneous video capturing may be restricted
801 to the same cropping and image size.</para> 801 to the same cropping and image size.</para>
802 802
803 <para>When applications omit the 803 <para>When applications omit the
804 <constant>VIDIOC_S_FMT</constant> ioctl its locking side effects are 804 <constant>VIDIOC_S_FMT</constant> ioctl its locking side effects are
805 implied by the next step, the selection of an I/O method with the 805 implied by the next step, the selection of an I/O method with the
806 &VIDIOC-REQBUFS; ioctl or implicit with the first &func-read; or 806 &VIDIOC-REQBUFS; ioctl or implicit with the first &func-read; or
807 &func-write; call.</para> 807 &func-write; call.</para>
808 808
809 <para>Generally only one logical stream can be assigned to a 809 <para>Generally only one logical stream can be assigned to a
810 file descriptor, the exception being drivers permitting simultaneous 810 file descriptor, the exception being drivers permitting simultaneous
811 video capturing and overlay using the same file descriptor for 811 video capturing and overlay using the same file descriptor for
812 compatibility with V4L and earlier versions of V4L2. Switching the 812 compatibility with V4L and earlier versions of V4L2. Switching the
813 logical stream or returning into "panel mode" is possible by closing 813 logical stream or returning into "panel mode" is possible by closing
814 and reopening the device. Drivers <emphasis>may</emphasis> support a 814 and reopening the device. Drivers <emphasis>may</emphasis> support a
815 switch using <constant>VIDIOC_S_FMT</constant>.</para> 815 switch using <constant>VIDIOC_S_FMT</constant>.</para>
816 816
817 <para>All drivers exchanging data with 817 <para>All drivers exchanging data with
818 applications must support the <constant>VIDIOC_G_FMT</constant> and 818 applications must support the <constant>VIDIOC_G_FMT</constant> and
819 <constant>VIDIOC_S_FMT</constant> ioctl. Implementation of the 819 <constant>VIDIOC_S_FMT</constant> ioctl. Implementation of the
820 <constant>VIDIOC_TRY_FMT</constant> is highly recommended but 820 <constant>VIDIOC_TRY_FMT</constant> is highly recommended but
821 optional.</para> 821 optional.</para>
822 </section> 822 </section>
823 823
824 <section> 824 <section>
825 <title>Image Format Enumeration</title> 825 <title>Image Format Enumeration</title>
826 826
827 <para>Apart of the generic format negotiation functions 827 <para>Apart of the generic format negotiation functions
828 a special ioctl to enumerate all image formats supported by video 828 a special ioctl to enumerate all image formats supported by video
829 capture, overlay or output devices is available.<footnote> 829 capture, overlay or output devices is available.<footnote>
830 <para>Enumerating formats an application has no a-priori 830 <para>Enumerating formats an application has no a-priori
831 knowledge of (otherwise it could explicitly ask for them and need not 831 knowledge of (otherwise it could explicitly ask for them and need not
832 enumerate) seems useless, but there are applications serving as proxy 832 enumerate) seems useless, but there are applications serving as proxy
833 between drivers and the actual video applications for which this is 833 between drivers and the actual video applications for which this is
834 useful.</para> 834 useful.</para>
835 </footnote></para> 835 </footnote></para>
836 836
837 <para>The &VIDIOC-ENUM-FMT; ioctl must be supported 837 <para>The &VIDIOC-ENUM-FMT; ioctl must be supported
838 by all drivers exchanging image data with applications.</para> 838 by all drivers exchanging image data with applications.</para>
839 839
840 <important> 840 <important>
841 <para>Drivers are not supposed to convert image formats in 841 <para>Drivers are not supposed to convert image formats in
842 kernel space. They must enumerate only formats directly supported by 842 kernel space. They must enumerate only formats directly supported by
843 the hardware. If necessary driver writers should publish an example 843 the hardware. If necessary driver writers should publish an example
844 conversion routine or library for integration into applications.</para> 844 conversion routine or library for integration into applications.</para>
845 </important> 845 </important>
846 </section> 846 </section>
847 </section> 847 </section>
848 848
849 &sub-planar-apis;
850
849 <section id="crop"> 851 <section id="crop">
850 <title>Image Cropping, Insertion and Scaling</title> 852 <title>Image Cropping, Insertion and Scaling</title>
851 853
852 <para>Some video capture devices can sample a subsection of the 854 <para>Some video capture devices can sample a subsection of the
853 picture and shrink or enlarge it to an image of arbitrary size. We 855 picture and shrink or enlarge it to an image of arbitrary size. We
854 call these abilities cropping and scaling. Some video output devices 856 call these abilities cropping and scaling. Some video output devices
855 can scale an image up or down and insert it at an arbitrary scan line 857 can scale an image up or down and insert it at an arbitrary scan line
856 and horizontal offset into a video signal.</para> 858 and horizontal offset into a video signal.</para>
857 859
858 <para>Applications can use the following API to select an area in 860 <para>Applications can use the following API to select an area in
859 the video signal, query the default area and the hardware limits. 861 the video signal, query the default area and the hardware limits.
860 <emphasis>Despite their name, the &VIDIOC-CROPCAP;, &VIDIOC-G-CROP; 862 <emphasis>Despite their name, the &VIDIOC-CROPCAP;, &VIDIOC-G-CROP;
861 and &VIDIOC-S-CROP; ioctls apply to input as well as output 863 and &VIDIOC-S-CROP; ioctls apply to input as well as output
862 devices.</emphasis></para> 864 devices.</emphasis></para>
863 865
864 <para>Scaling requires a source and a target. On a video capture 866 <para>Scaling requires a source and a target. On a video capture
865 or overlay device the source is the video signal, and the cropping 867 or overlay device the source is the video signal, and the cropping
866 ioctls determine the area actually sampled. The target are images 868 ioctls determine the area actually sampled. The target are images
867 read by the application or overlaid onto the graphics screen. Their 869 read by the application or overlaid onto the graphics screen. Their
868 size (and position for an overlay) is negotiated with the 870 size (and position for an overlay) is negotiated with the
869 &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls.</para> 871 &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls.</para>
870 872
871 <para>On a video output device the source are the images passed in 873 <para>On a video output device the source are the images passed in
872 by the application, and their size is again negotiated with the 874 by the application, and their size is again negotiated with the
873 <constant>VIDIOC_G/S_FMT</constant> ioctls, or may be encoded in a 875 <constant>VIDIOC_G/S_FMT</constant> ioctls, or may be encoded in a
874 compressed video stream. The target is the video signal, and the 876 compressed video stream. The target is the video signal, and the
875 cropping ioctls determine the area where the images are 877 cropping ioctls determine the area where the images are
876 inserted.</para> 878 inserted.</para>
877 879
878 <para>Source and target rectangles are defined even if the device 880 <para>Source and target rectangles are defined even if the device
879 does not support scaling or the <constant>VIDIOC_G/S_CROP</constant> 881 does not support scaling or the <constant>VIDIOC_G/S_CROP</constant>
880 ioctls. Their size (and position where applicable) will be fixed in 882 ioctls. Their size (and position where applicable) will be fixed in
881 this case. <emphasis>All capture and output device must support the 883 this case. <emphasis>All capture and output device must support the
882 <constant>VIDIOC_CROPCAP</constant> ioctl such that applications can 884 <constant>VIDIOC_CROPCAP</constant> ioctl such that applications can
883 determine if scaling takes place.</emphasis></para> 885 determine if scaling takes place.</emphasis></para>
884 886
885 <section> 887 <section>
886 <title>Cropping Structures</title> 888 <title>Cropping Structures</title>
887 889
888 <figure id="crop-scale"> 890 <figure id="crop-scale">
889 <title>Image Cropping, Insertion and Scaling</title> 891 <title>Image Cropping, Insertion and Scaling</title>
890 <mediaobject> 892 <mediaobject>
891 <imageobject> 893 <imageobject>
892 <imagedata fileref="crop.pdf" format="PS" /> 894 <imagedata fileref="crop.pdf" format="PS" />
893 </imageobject> 895 </imageobject>
894 <imageobject> 896 <imageobject>
895 <imagedata fileref="crop.gif" format="GIF" /> 897 <imagedata fileref="crop.gif" format="GIF" />
896 </imageobject> 898 </imageobject>
897 <textobject> 899 <textobject>
898 <phrase>The cropping, insertion and scaling process</phrase> 900 <phrase>The cropping, insertion and scaling process</phrase>
899 </textobject> 901 </textobject>
900 </mediaobject> 902 </mediaobject>
901 </figure> 903 </figure>
902 904
903 <para>For capture devices the coordinates of the top left 905 <para>For capture devices the coordinates of the top left
904 corner, width and height of the area which can be sampled is given by 906 corner, width and height of the area which can be sampled is given by
905 the <structfield>bounds</structfield> substructure of the 907 the <structfield>bounds</structfield> substructure of the
906 &v4l2-cropcap; returned by the <constant>VIDIOC_CROPCAP</constant> 908 &v4l2-cropcap; returned by the <constant>VIDIOC_CROPCAP</constant>
907 ioctl. To support a wide range of hardware this specification does not 909 ioctl. To support a wide range of hardware this specification does not
908 define an origin or units. However by convention drivers should 910 define an origin or units. However by convention drivers should
909 horizontally count unscaled samples relative to 0H (the leading edge 911 horizontally count unscaled samples relative to 0H (the leading edge
910 of the horizontal sync pulse, see <xref linkend="vbi-hsync" />). 912 of the horizontal sync pulse, see <xref linkend="vbi-hsync" />).
911 Vertically ITU-R line 913 Vertically ITU-R line
912 numbers of the first field (<xref linkend="vbi-525" />, <xref 914 numbers of the first field (<xref linkend="vbi-525" />, <xref
913 linkend="vbi-625" />), multiplied by two if the driver can capture both 915 linkend="vbi-625" />), multiplied by two if the driver can capture both
914 fields.</para> 916 fields.</para>
915 917
916 <para>The top left corner, width and height of the source 918 <para>The top left corner, width and height of the source
917 rectangle, that is the area actually sampled, is given by &v4l2-crop; 919 rectangle, that is the area actually sampled, is given by &v4l2-crop;
918 using the same coordinate system as &v4l2-cropcap;. Applications can 920 using the same coordinate system as &v4l2-cropcap;. Applications can
919 use the <constant>VIDIOC_G_CROP</constant> and 921 use the <constant>VIDIOC_G_CROP</constant> and
920 <constant>VIDIOC_S_CROP</constant> ioctls to get and set this 922 <constant>VIDIOC_S_CROP</constant> ioctls to get and set this
921 rectangle. It must lie completely within the capture boundaries and 923 rectangle. It must lie completely within the capture boundaries and
922 the driver may further adjust the requested size and/or position 924 the driver may further adjust the requested size and/or position
923 according to hardware limitations.</para> 925 according to hardware limitations.</para>
924 926
925 <para>Each capture device has a default source rectangle, given 927 <para>Each capture device has a default source rectangle, given
926 by the <structfield>defrect</structfield> substructure of 928 by the <structfield>defrect</structfield> substructure of
927 &v4l2-cropcap;. The center of this rectangle shall align with the 929 &v4l2-cropcap;. The center of this rectangle shall align with the
928 center of the active picture area of the video signal, and cover what 930 center of the active picture area of the video signal, and cover what
929 the driver writer considers the complete picture. Drivers shall reset 931 the driver writer considers the complete picture. Drivers shall reset
930 the source rectangle to the default when the driver is first loaded, 932 the source rectangle to the default when the driver is first loaded,
931 but not later.</para> 933 but not later.</para>
932 934
933 <para>For output devices these structures and ioctls are used 935 <para>For output devices these structures and ioctls are used
934 accordingly, defining the <emphasis>target</emphasis> rectangle where 936 accordingly, defining the <emphasis>target</emphasis> rectangle where
935 the images will be inserted into the video signal.</para> 937 the images will be inserted into the video signal.</para>
936 938
937 </section> 939 </section>
938 940
939 <section> 941 <section>
940 <title>Scaling Adjustments</title> 942 <title>Scaling Adjustments</title>
941 943
942 <para>Video hardware can have various cropping, insertion and 944 <para>Video hardware can have various cropping, insertion and
943 scaling limitations. It may only scale up or down, support only 945 scaling limitations. It may only scale up or down, support only
944 discrete scaling factors, or have different scaling abilities in 946 discrete scaling factors, or have different scaling abilities in
945 horizontal and vertical direction. Also it may not support scaling at 947 horizontal and vertical direction. Also it may not support scaling at
946 all. At the same time the &v4l2-crop; rectangle may have to be 948 all. At the same time the &v4l2-crop; rectangle may have to be
947 aligned, and both the source and target rectangles may have arbitrary 949 aligned, and both the source and target rectangles may have arbitrary
948 upper and lower size limits. In particular the maximum 950 upper and lower size limits. In particular the maximum
949 <structfield>width</structfield> and <structfield>height</structfield> 951 <structfield>width</structfield> and <structfield>height</structfield>
950 in &v4l2-crop; may be smaller than the 952 in &v4l2-crop; may be smaller than the
951 &v4l2-cropcap;.<structfield>bounds</structfield> area. Therefore, as 953 &v4l2-cropcap;.<structfield>bounds</structfield> area. Therefore, as
952 usual, drivers are expected to adjust the requested parameters and 954 usual, drivers are expected to adjust the requested parameters and
953 return the actual values selected.</para> 955 return the actual values selected.</para>
954 956
955 <para>Applications can change the source or the target rectangle 957 <para>Applications can change the source or the target rectangle
956 first, as they may prefer a particular image size or a certain area in 958 first, as they may prefer a particular image size or a certain area in
957 the video signal. If the driver has to adjust both to satisfy hardware 959 the video signal. If the driver has to adjust both to satisfy hardware
958 limitations, the last requested rectangle shall take priority, and the 960 limitations, the last requested rectangle shall take priority, and the
959 driver should preferably adjust the opposite one. The &VIDIOC-TRY-FMT; 961 driver should preferably adjust the opposite one. The &VIDIOC-TRY-FMT;
960 ioctl however shall not change the driver state and therefore only 962 ioctl however shall not change the driver state and therefore only
961 adjust the requested rectangle.</para> 963 adjust the requested rectangle.</para>
962 964
963 <para>Suppose scaling on a video capture device is restricted to 965 <para>Suppose scaling on a video capture device is restricted to
964 a factor 1:1 or 2:1 in either direction and the target image size must 966 a factor 1:1 or 2:1 in either direction and the target image size must
965 be a multiple of 16&nbsp;&times;&nbsp;16 pixels. The source cropping 967 be a multiple of 16&nbsp;&times;&nbsp;16 pixels. The source cropping
966 rectangle is set to defaults, which are also the upper limit in this 968 rectangle is set to defaults, which are also the upper limit in this
967 example, of 640&nbsp;&times;&nbsp;400 pixels at offset 0,&nbsp;0. An 969 example, of 640&nbsp;&times;&nbsp;400 pixels at offset 0,&nbsp;0. An
968 application requests an image size of 300&nbsp;&times;&nbsp;225 970 application requests an image size of 300&nbsp;&times;&nbsp;225
969 pixels, assuming video will be scaled down from the "full picture" 971 pixels, assuming video will be scaled down from the "full picture"
970 accordingly. The driver sets the image size to the closest possible 972 accordingly. The driver sets the image size to the closest possible
971 values 304&nbsp;&times;&nbsp;224, then chooses the cropping rectangle 973 values 304&nbsp;&times;&nbsp;224, then chooses the cropping rectangle
972 closest to the requested size, that is 608&nbsp;&times;&nbsp;224 974 closest to the requested size, that is 608&nbsp;&times;&nbsp;224
973 (224&nbsp;&times;&nbsp;2:1 would exceed the limit 400). The offset 975 (224&nbsp;&times;&nbsp;2:1 would exceed the limit 400). The offset
974 0,&nbsp;0 is still valid, thus unmodified. Given the default cropping 976 0,&nbsp;0 is still valid, thus unmodified. Given the default cropping
975 rectangle reported by <constant>VIDIOC_CROPCAP</constant> the 977 rectangle reported by <constant>VIDIOC_CROPCAP</constant> the
976 application can easily propose another offset to center the cropping 978 application can easily propose another offset to center the cropping
977 rectangle.</para> 979 rectangle.</para>
978 980
979 <para>Now the application may insist on covering an area using a 981 <para>Now the application may insist on covering an area using a
980 picture aspect ratio closer to the original request, so it asks for a 982 picture aspect ratio closer to the original request, so it asks for a
981 cropping rectangle of 608&nbsp;&times;&nbsp;456 pixels. The present 983 cropping rectangle of 608&nbsp;&times;&nbsp;456 pixels. The present
982 scaling factors limit cropping to 640&nbsp;&times;&nbsp;384, so the 984 scaling factors limit cropping to 640&nbsp;&times;&nbsp;384, so the
983 driver returns the cropping size 608&nbsp;&times;&nbsp;384 and adjusts 985 driver returns the cropping size 608&nbsp;&times;&nbsp;384 and adjusts
984 the image size to closest possible 304&nbsp;&times;&nbsp;192.</para> 986 the image size to closest possible 304&nbsp;&times;&nbsp;192.</para>
985 987
986 </section> 988 </section>
987 989
988 <section> 990 <section>
989 <title>Examples</title> 991 <title>Examples</title>
990 992
991 <para>Source and target rectangles shall remain unchanged across 993 <para>Source and target rectangles shall remain unchanged across
992 closing and reopening a device, such that piping data into or out of a 994 closing and reopening a device, such that piping data into or out of a
993 device will work without special preparations. More advanced 995 device will work without special preparations. More advanced
994 applications should ensure the parameters are suitable before starting 996 applications should ensure the parameters are suitable before starting
995 I/O.</para> 997 I/O.</para>
996 998
997 <example> 999 <example>
998 <title>Resetting the cropping parameters</title> 1000 <title>Resetting the cropping parameters</title>
999 1001
1000 <para>(A video capture device is assumed; change 1002 <para>(A video capture device is assumed; change
1001 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> for other 1003 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> for other
1002 devices.)</para> 1004 devices.)</para>
1003 1005
1004 <programlisting> 1006 <programlisting>
1005 &v4l2-cropcap; cropcap; 1007 &v4l2-cropcap; cropcap;
1006 &v4l2-crop; crop; 1008 &v4l2-crop; crop;
1007 1009
1008 memset (&amp;cropcap, 0, sizeof (cropcap)); 1010 memset (&amp;cropcap, 0, sizeof (cropcap));
1009 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1011 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1010 1012
1011 if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &amp;cropcap)) { 1013 if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &amp;cropcap)) {
1012 perror ("VIDIOC_CROPCAP"); 1014 perror ("VIDIOC_CROPCAP");
1013 exit (EXIT_FAILURE); 1015 exit (EXIT_FAILURE);
1014 } 1016 }
1015 1017
1016 memset (&amp;crop, 0, sizeof (crop)); 1018 memset (&amp;crop, 0, sizeof (crop));
1017 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1019 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1018 crop.c = cropcap.defrect; 1020 crop.c = cropcap.defrect;
1019 1021
1020 /* Ignore if cropping is not supported (EINVAL). */ 1022 /* Ignore if cropping is not supported (EINVAL). */
1021 1023
1022 if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &amp;crop) 1024 if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &amp;crop)
1023 &amp;&amp; errno != EINVAL) { 1025 &amp;&amp; errno != EINVAL) {
1024 perror ("VIDIOC_S_CROP"); 1026 perror ("VIDIOC_S_CROP");
1025 exit (EXIT_FAILURE); 1027 exit (EXIT_FAILURE);
1026 } 1028 }
1027 </programlisting> 1029 </programlisting>
1028 </example> 1030 </example>
1029 1031
1030 <example> 1032 <example>
1031 <title>Simple downscaling</title> 1033 <title>Simple downscaling</title>
1032 1034
1033 <para>(A video capture device is assumed.)</para> 1035 <para>(A video capture device is assumed.)</para>
1034 1036
1035 <programlisting> 1037 <programlisting>
1036 &v4l2-cropcap; cropcap; 1038 &v4l2-cropcap; cropcap;
1037 &v4l2-format; format; 1039 &v4l2-format; format;
1038 1040
1039 reset_cropping_parameters (); 1041 reset_cropping_parameters ();
1040 1042
1041 /* Scale down to 1/4 size of full picture. */ 1043 /* Scale down to 1/4 size of full picture. */
1042 1044
1043 memset (&amp;format, 0, sizeof (format)); /* defaults */ 1045 memset (&amp;format, 0, sizeof (format)); /* defaults */
1044 1046
1045 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1047 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1046 1048
1047 format.fmt.pix.width = cropcap.defrect.width &gt;&gt; 1; 1049 format.fmt.pix.width = cropcap.defrect.width &gt;&gt; 1;
1048 format.fmt.pix.height = cropcap.defrect.height &gt;&gt; 1; 1050 format.fmt.pix.height = cropcap.defrect.height &gt;&gt; 1;
1049 format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; 1051 format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
1050 1052
1051 if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &amp;format)) { 1053 if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &amp;format)) {
1052 perror ("VIDIOC_S_FORMAT"); 1054 perror ("VIDIOC_S_FORMAT");
1053 exit (EXIT_FAILURE); 1055 exit (EXIT_FAILURE);
1054 } 1056 }
1055 1057
1056 /* We could check the actual image size now, the actual scaling factor 1058 /* We could check the actual image size now, the actual scaling factor
1057 or if the driver can scale at all. */ 1059 or if the driver can scale at all. */
1058 </programlisting> 1060 </programlisting>
1059 </example> 1061 </example>
1060 1062
1061 <example> 1063 <example>
1062 <title>Selecting an output area</title> 1064 <title>Selecting an output area</title>
1063 1065
1064 <programlisting> 1066 <programlisting>
1065 &v4l2-cropcap; cropcap; 1067 &v4l2-cropcap; cropcap;
1066 &v4l2-crop; crop; 1068 &v4l2-crop; crop;
1067 1069
1068 memset (&amp;cropcap, 0, sizeof (cropcap)); 1070 memset (&amp;cropcap, 0, sizeof (cropcap));
1069 cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 1071 cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
1070 1072
1071 if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &amp;cropcap)) { 1073 if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &amp;cropcap)) {
1072 perror ("VIDIOC_CROPCAP"); 1074 perror ("VIDIOC_CROPCAP");
1073 exit (EXIT_FAILURE); 1075 exit (EXIT_FAILURE);
1074 } 1076 }
1075 1077
1076 memset (&amp;crop, 0, sizeof (crop)); 1078 memset (&amp;crop, 0, sizeof (crop));
1077 1079
1078 crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 1080 crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
1079 crop.c = cropcap.defrect; 1081 crop.c = cropcap.defrect;
1080 1082
1081 /* Scale the width and height to 50 % of their original size 1083 /* Scale the width and height to 50 % of their original size
1082 and center the output. */ 1084 and center the output. */
1083 1085
1084 crop.c.width /= 2; 1086 crop.c.width /= 2;
1085 crop.c.height /= 2; 1087 crop.c.height /= 2;
1086 crop.c.left += crop.c.width / 2; 1088 crop.c.left += crop.c.width / 2;
1087 crop.c.top += crop.c.height / 2; 1089 crop.c.top += crop.c.height / 2;
1088 1090
1089 /* Ignore if cropping is not supported (EINVAL). */ 1091 /* Ignore if cropping is not supported (EINVAL). */
1090 1092
1091 if (-1 == ioctl (fd, VIDIOC_S_CROP, &amp;crop) 1093 if (-1 == ioctl (fd, VIDIOC_S_CROP, &amp;crop)
1092 &amp;&amp; errno != EINVAL) { 1094 &amp;&amp; errno != EINVAL) {
1093 perror ("VIDIOC_S_CROP"); 1095 perror ("VIDIOC_S_CROP");
1094 exit (EXIT_FAILURE); 1096 exit (EXIT_FAILURE);
1095 } 1097 }
1096 </programlisting> 1098 </programlisting>
1097 </example> 1099 </example>
1098 1100
1099 <example> 1101 <example>
1100 <title>Current scaling factor and pixel aspect</title> 1102 <title>Current scaling factor and pixel aspect</title>
1101 1103
1102 <para>(A video capture device is assumed.)</para> 1104 <para>(A video capture device is assumed.)</para>
1103 1105
1104 <programlisting> 1106 <programlisting>
1105 &v4l2-cropcap; cropcap; 1107 &v4l2-cropcap; cropcap;
1106 &v4l2-crop; crop; 1108 &v4l2-crop; crop;
1107 &v4l2-format; format; 1109 &v4l2-format; format;
1108 double hscale, vscale; 1110 double hscale, vscale;
1109 double aspect; 1111 double aspect;
1110 int dwidth, dheight; 1112 int dwidth, dheight;
1111 1113
1112 memset (&amp;cropcap, 0, sizeof (cropcap)); 1114 memset (&amp;cropcap, 0, sizeof (cropcap));
1113 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1115 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1114 1116
1115 if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &amp;cropcap)) { 1117 if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &amp;cropcap)) {
1116 perror ("VIDIOC_CROPCAP"); 1118 perror ("VIDIOC_CROPCAP");
1117 exit (EXIT_FAILURE); 1119 exit (EXIT_FAILURE);
1118 } 1120 }
1119 1121
1120 memset (&amp;crop, 0, sizeof (crop)); 1122 memset (&amp;crop, 0, sizeof (crop));
1121 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1123 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1122 1124
1123 if (-1 == ioctl (fd, &VIDIOC-G-CROP;, &amp;crop)) { 1125 if (-1 == ioctl (fd, &VIDIOC-G-CROP;, &amp;crop)) {
1124 if (errno != EINVAL) { 1126 if (errno != EINVAL) {
1125 perror ("VIDIOC_G_CROP"); 1127 perror ("VIDIOC_G_CROP");
1126 exit (EXIT_FAILURE); 1128 exit (EXIT_FAILURE);
1127 } 1129 }
1128 1130
1129 /* Cropping not supported. */ 1131 /* Cropping not supported. */
1130 crop.c = cropcap.defrect; 1132 crop.c = cropcap.defrect;
1131 } 1133 }
1132 1134
1133 memset (&amp;format, 0, sizeof (format)); 1135 memset (&amp;format, 0, sizeof (format));
1134 format.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1136 format.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1135 1137
1136 if (-1 == ioctl (fd, &VIDIOC-G-FMT;, &amp;format)) { 1138 if (-1 == ioctl (fd, &VIDIOC-G-FMT;, &amp;format)) {
1137 perror ("VIDIOC_G_FMT"); 1139 perror ("VIDIOC_G_FMT");
1138 exit (EXIT_FAILURE); 1140 exit (EXIT_FAILURE);
1139 } 1141 }
1140 1142
1141 /* The scaling applied by the driver. */ 1143 /* The scaling applied by the driver. */
1142 1144
1143 hscale = format.fmt.pix.width / (double) crop.c.width; 1145 hscale = format.fmt.pix.width / (double) crop.c.width;
1144 vscale = format.fmt.pix.height / (double) crop.c.height; 1146 vscale = format.fmt.pix.height / (double) crop.c.height;
1145 1147
1146 aspect = cropcap.pixelaspect.numerator / 1148 aspect = cropcap.pixelaspect.numerator /
1147 (double) cropcap.pixelaspect.denominator; 1149 (double) cropcap.pixelaspect.denominator;
1148 aspect = aspect * hscale / vscale; 1150 aspect = aspect * hscale / vscale;
1149 1151
1150 /* Devices following ITU-R BT.601 do not capture 1152 /* Devices following ITU-R BT.601 do not capture
1151 square pixels. For playback on a computer monitor 1153 square pixels. For playback on a computer monitor
1152 we should scale the images to this size. */ 1154 we should scale the images to this size. */
1153 1155
1154 dwidth = format.fmt.pix.width / aspect; 1156 dwidth = format.fmt.pix.width / aspect;
1155 dheight = format.fmt.pix.height; 1157 dheight = format.fmt.pix.height;
1156 </programlisting> 1158 </programlisting>
1157 </example> 1159 </example>
1158 </section> 1160 </section>
1159 </section> 1161 </section>
1160 1162
1161 <section id="streaming-par"> 1163 <section id="streaming-par">
1162 <title>Streaming Parameters</title> 1164 <title>Streaming Parameters</title>
1163 1165
1164 <para>Streaming parameters are intended to optimize the video 1166 <para>Streaming parameters are intended to optimize the video
1165 capture process as well as I/O. Presently applications can request a 1167 capture process as well as I/O. Presently applications can request a
1166 high quality capture mode with the &VIDIOC-S-PARM; ioctl.</para> 1168 high quality capture mode with the &VIDIOC-S-PARM; ioctl.</para>
1167 1169
1168 <para>The current video standard determines a nominal number of 1170 <para>The current video standard determines a nominal number of
1169 frames per second. If less than this number of frames is to be 1171 frames per second. If less than this number of frames is to be
1170 captured or output, applications can request frame skipping or 1172 captured or output, applications can request frame skipping or
1171 duplicating on the driver side. This is especially useful when using 1173 duplicating on the driver side. This is especially useful when using
1172 the &func-read; or &func-write;, which are not augmented by timestamps 1174 the &func-read; or &func-write;, which are not augmented by timestamps
1173 or sequence counters, and to avoid unnecessary data copying.</para> 1175 or sequence counters, and to avoid unnecessary data copying.</para>
1174 1176
1175 <para>Finally these ioctls can be used to determine the number of 1177 <para>Finally these ioctls can be used to determine the number of
1176 buffers used internally by a driver in read/write mode. For 1178 buffers used internally by a driver in read/write mode. For
1177 implications see the section discussing the &func-read; 1179 implications see the section discussing the &func-read;
1178 function.</para> 1180 function.</para>
1179 1181
1180 <para>To get and set the streaming parameters applications call 1182 <para>To get and set the streaming parameters applications call
1181 the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; ioctl, respectively. They take 1183 the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; ioctl, respectively. They take
1182 a pointer to a &v4l2-streamparm;, which contains a union holding 1184 a pointer to a &v4l2-streamparm;, which contains a union holding
1183 separate parameters for input and output devices.</para> 1185 separate parameters for input and output devices.</para>
1184 1186
1185 <para>These ioctls are optional, drivers need not implement 1187 <para>These ioctls are optional, drivers need not implement
1186 them. If so, they return the &EINVAL;.</para> 1188 them. If so, they return the &EINVAL;.</para>
1187 </section> 1189 </section>
1188 1190
1189 <!-- 1191 <!--
1190 Local Variables: 1192 Local Variables:
1191 mode: sgml 1193 mode: sgml
1192 sgml-parent-document: "v4l2.sgml" 1194 sgml-parent-document: "v4l2.sgml"
1193 indent-tabs-mode: nil 1195 indent-tabs-mode: nil
1194 End: 1196 End:
1195 --> 1197 -->
1196 1198
Documentation/DocBook/v4l/compat.xml
1 <title>Changes</title> 1 <title>Changes</title>
2 2
3 <para>The following chapters document the evolution of the V4L2 API, 3 <para>The following chapters document the evolution of the V4L2 API,
4 errata or extensions. They are also intended to help application and 4 errata or extensions. They are also intended to help application and
5 driver writers to port or update their code.</para> 5 driver writers to port or update their code.</para>
6 6
7 <section id="diff-v4l"> 7 <section id="diff-v4l">
8 <title>Differences between V4L and V4L2</title> 8 <title>Differences between V4L and V4L2</title>
9 9
10 <para>The Video For Linux API was first introduced in Linux 2.1 to 10 <para>The Video For Linux API was first introduced in Linux 2.1 to
11 unify and replace various TV and radio device related interfaces, 11 unify and replace various TV and radio device related interfaces,
12 developed independently by driver writers in prior years. Starting 12 developed independently by driver writers in prior years. Starting
13 with Linux 2.5 the much improved V4L2 API replaces the V4L API, 13 with Linux 2.5 the much improved V4L2 API replaces the V4L API,
14 although existing drivers will continue to support V4L applications in 14 although existing drivers will continue to support V4L applications in
15 the future, either directly or through the V4L2 compatibility layer in 15 the future, either directly or through the V4L2 compatibility layer in
16 the <filename>videodev</filename> kernel module translating ioctls on 16 the <filename>videodev</filename> kernel module translating ioctls on
17 the fly. For a transition period not all drivers will support the V4L2 17 the fly. For a transition period not all drivers will support the V4L2
18 API.</para> 18 API.</para>
19 19
20 <section> 20 <section>
21 <title>Opening and Closing Devices</title> 21 <title>Opening and Closing Devices</title>
22 22
23 <para>For compatibility reasons the character device file names 23 <para>For compatibility reasons the character device file names
24 recommended for V4L2 video capture, overlay, radio and raw 24 recommended for V4L2 video capture, overlay, radio and raw
25 vbi capture devices did not change from those used by V4L. They are 25 vbi capture devices did not change from those used by V4L. They are
26 listed in <xref linkend="devices" /> and below in <xref 26 listed in <xref linkend="devices" /> and below in <xref
27 linkend="v4l-dev" />.</para> 27 linkend="v4l-dev" />.</para>
28 28
29 <para>The teletext devices (minor range 192-223) have been removed in 29 <para>The teletext devices (minor range 192-223) have been removed in
30 V4L2 and no longer exist. There is no hardware available anymore for handling 30 V4L2 and no longer exist. There is no hardware available anymore for handling
31 pure teletext. Instead raw or sliced VBI is used.</para> 31 pure teletext. Instead raw or sliced VBI is used.</para>
32 32
33 <para>The V4L <filename>videodev</filename> module automatically 33 <para>The V4L <filename>videodev</filename> module automatically
34 assigns minor numbers to drivers in load order, depending on the 34 assigns minor numbers to drivers in load order, depending on the
35 registered device type. We recommend that V4L2 drivers by default 35 registered device type. We recommend that V4L2 drivers by default
36 register devices with the same numbers, but the system administrator 36 register devices with the same numbers, but the system administrator
37 can assign arbitrary minor numbers using driver module options. The 37 can assign arbitrary minor numbers using driver module options. The
38 major device number remains 81.</para> 38 major device number remains 81.</para>
39 39
40 <table id="v4l-dev"> 40 <table id="v4l-dev">
41 <title>V4L Device Types, Names and Numbers</title> 41 <title>V4L Device Types, Names and Numbers</title>
42 <tgroup cols="3"> 42 <tgroup cols="3">
43 <thead> 43 <thead>
44 <row> 44 <row>
45 <entry>Device Type</entry> 45 <entry>Device Type</entry>
46 <entry>File Name</entry> 46 <entry>File Name</entry>
47 <entry>Minor Numbers</entry> 47 <entry>Minor Numbers</entry>
48 </row> 48 </row>
49 </thead> 49 </thead>
50 <tbody valign="top"> 50 <tbody valign="top">
51 <row> 51 <row>
52 <entry>Video capture and overlay</entry> 52 <entry>Video capture and overlay</entry>
53 <entry><para><filename>/dev/video</filename> and 53 <entry><para><filename>/dev/video</filename> and
54 <filename>/dev/bttv0</filename><footnote> <para>According to 54 <filename>/dev/bttv0</filename><footnote> <para>According to
55 Documentation/devices.txt these should be symbolic links to 55 Documentation/devices.txt these should be symbolic links to
56 <filename>/dev/video0</filename>. Note the original bttv interface is 56 <filename>/dev/video0</filename>. Note the original bttv interface is
57 not compatible with V4L or V4L2.</para> </footnote>, 57 not compatible with V4L or V4L2.</para> </footnote>,
58 <filename>/dev/video0</filename> to 58 <filename>/dev/video0</filename> to
59 <filename>/dev/video63</filename></para></entry> 59 <filename>/dev/video63</filename></para></entry>
60 <entry>0-63</entry> 60 <entry>0-63</entry>
61 </row> 61 </row>
62 <row> 62 <row>
63 <entry>Radio receiver</entry> 63 <entry>Radio receiver</entry>
64 <entry><para><filename>/dev/radio</filename><footnote> 64 <entry><para><filename>/dev/radio</filename><footnote>
65 <para>According to 65 <para>According to
66 <filename>Documentation/devices.txt</filename> a symbolic link to 66 <filename>Documentation/devices.txt</filename> a symbolic link to
67 <filename>/dev/radio0</filename>.</para> 67 <filename>/dev/radio0</filename>.</para>
68 </footnote>, <filename>/dev/radio0</filename> to 68 </footnote>, <filename>/dev/radio0</filename> to
69 <filename>/dev/radio63</filename></para></entry> 69 <filename>/dev/radio63</filename></para></entry>
70 <entry>64-127</entry> 70 <entry>64-127</entry>
71 </row> 71 </row>
72 <row> 72 <row>
73 <entry>Raw VBI capture</entry> 73 <entry>Raw VBI capture</entry>
74 <entry><para><filename>/dev/vbi</filename>, 74 <entry><para><filename>/dev/vbi</filename>,
75 <filename>/dev/vbi0</filename> to 75 <filename>/dev/vbi0</filename> to
76 <filename>/dev/vbi31</filename></para></entry> 76 <filename>/dev/vbi31</filename></para></entry>
77 <entry>224-255</entry> 77 <entry>224-255</entry>
78 </row> 78 </row>
79 </tbody> 79 </tbody>
80 </tgroup> 80 </tgroup>
81 </table> 81 </table>
82 82
83 <para>V4L prohibits (or used to prohibit) multiple opens of a 83 <para>V4L prohibits (or used to prohibit) multiple opens of a
84 device file. V4L2 drivers <emphasis>may</emphasis> support multiple 84 device file. V4L2 drivers <emphasis>may</emphasis> support multiple
85 opens, see <xref linkend="open" /> for details and consequences.</para> 85 opens, see <xref linkend="open" /> for details and consequences.</para>
86 86
87 <para>V4L drivers respond to V4L2 ioctls with an &EINVAL;. The 87 <para>V4L drivers respond to V4L2 ioctls with an &EINVAL;. The
88 compatibility layer in the V4L2 <filename>videodev</filename> module 88 compatibility layer in the V4L2 <filename>videodev</filename> module
89 can translate V4L ioctl requests to their V4L2 counterpart, however a 89 can translate V4L ioctl requests to their V4L2 counterpart, however a
90 V4L2 driver usually needs more preparation to become fully V4L 90 V4L2 driver usually needs more preparation to become fully V4L
91 compatible. This is covered in more detail in <xref 91 compatible. This is covered in more detail in <xref
92 linkend="driver" />.</para> 92 linkend="driver" />.</para>
93 </section> 93 </section>
94 94
95 <section> 95 <section>
96 <title>Querying Capabilities</title> 96 <title>Querying Capabilities</title>
97 97
98 <para>The V4L <constant>VIDIOCGCAP</constant> ioctl is 98 <para>The V4L <constant>VIDIOCGCAP</constant> ioctl is
99 equivalent to V4L2's &VIDIOC-QUERYCAP;.</para> 99 equivalent to V4L2's &VIDIOC-QUERYCAP;.</para>
100 100
101 <para>The <structfield>name</structfield> field in struct 101 <para>The <structfield>name</structfield> field in struct
102 <structname>video_capability</structname> became 102 <structname>video_capability</structname> became
103 <structfield>card</structfield> in &v4l2-capability;, 103 <structfield>card</structfield> in &v4l2-capability;,
104 <structfield>type</structfield> was replaced by 104 <structfield>type</structfield> was replaced by
105 <structfield>capabilities</structfield>. Note V4L2 does not 105 <structfield>capabilities</structfield>. Note V4L2 does not
106 distinguish between device types like this, better think of basic 106 distinguish between device types like this, better think of basic
107 video input, video output and radio devices supporting a set of 107 video input, video output and radio devices supporting a set of
108 related functions like video capturing, video overlay and VBI 108 related functions like video capturing, video overlay and VBI
109 capturing. See <xref linkend="open" /> for an 109 capturing. See <xref linkend="open" /> for an
110 introduction.<informaltable> 110 introduction.<informaltable>
111 <tgroup cols="3"> 111 <tgroup cols="3">
112 <thead> 112 <thead>
113 <row> 113 <row>
114 <entry>struct 114 <entry>struct
115 <structname>video_capability</structname> 115 <structname>video_capability</structname>
116 <structfield>type</structfield></entry> 116 <structfield>type</structfield></entry>
117 <entry>&v4l2-capability; 117 <entry>&v4l2-capability;
118 <structfield>capabilities</structfield> flags</entry> 118 <structfield>capabilities</structfield> flags</entry>
119 <entry>Purpose</entry> 119 <entry>Purpose</entry>
120 </row> 120 </row>
121 </thead> 121 </thead>
122 <tbody valign="top"> 122 <tbody valign="top">
123 <row> 123 <row>
124 <entry><constant>VID_TYPE_CAPTURE</constant></entry> 124 <entry><constant>VID_TYPE_CAPTURE</constant></entry>
125 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry> 125 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
126 <entry>The <link linkend="capture">video 126 <entry>The <link linkend="capture">video
127 capture</link> interface is supported.</entry> 127 capture</link> interface is supported.</entry>
128 </row> 128 </row>
129 <row> 129 <row>
130 <entry><constant>VID_TYPE_TUNER</constant></entry> 130 <entry><constant>VID_TYPE_TUNER</constant></entry>
131 <entry><constant>V4L2_CAP_TUNER</constant></entry> 131 <entry><constant>V4L2_CAP_TUNER</constant></entry>
132 <entry>The device has a <link linkend="tuner">tuner or 132 <entry>The device has a <link linkend="tuner">tuner or
133 modulator</link>.</entry> 133 modulator</link>.</entry>
134 </row> 134 </row>
135 <row> 135 <row>
136 <entry><constant>VID_TYPE_TELETEXT</constant></entry> 136 <entry><constant>VID_TYPE_TELETEXT</constant></entry>
137 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry> 137 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
138 <entry>The <link linkend="raw-vbi">raw VBI 138 <entry>The <link linkend="raw-vbi">raw VBI
139 capture</link> interface is supported.</entry> 139 capture</link> interface is supported.</entry>
140 </row> 140 </row>
141 <row> 141 <row>
142 <entry><constant>VID_TYPE_OVERLAY</constant></entry> 142 <entry><constant>VID_TYPE_OVERLAY</constant></entry>
143 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry> 143 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
144 <entry>The <link linkend="overlay">video 144 <entry>The <link linkend="overlay">video
145 overlay</link> interface is supported.</entry> 145 overlay</link> interface is supported.</entry>
146 </row> 146 </row>
147 <row> 147 <row>
148 <entry><constant>VID_TYPE_CHROMAKEY</constant></entry> 148 <entry><constant>VID_TYPE_CHROMAKEY</constant></entry>
149 <entry><constant>V4L2_FBUF_CAP_CHROMAKEY</constant> in 149 <entry><constant>V4L2_FBUF_CAP_CHROMAKEY</constant> in
150 field <structfield>capability</structfield> of 150 field <structfield>capability</structfield> of
151 &v4l2-framebuffer;</entry> 151 &v4l2-framebuffer;</entry>
152 <entry>Whether chromakey overlay is supported. For 152 <entry>Whether chromakey overlay is supported. For
153 more information on overlay see 153 more information on overlay see
154 <xref linkend="overlay" />.</entry> 154 <xref linkend="overlay" />.</entry>
155 </row> 155 </row>
156 <row> 156 <row>
157 <entry><constant>VID_TYPE_CLIPPING</constant></entry> 157 <entry><constant>VID_TYPE_CLIPPING</constant></entry>
158 <entry><constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant> 158 <entry><constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant>
159 and <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant> in field 159 and <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant> in field
160 <structfield>capability</structfield> of &v4l2-framebuffer;</entry> 160 <structfield>capability</structfield> of &v4l2-framebuffer;</entry>
161 <entry>Whether clipping the overlaid image is 161 <entry>Whether clipping the overlaid image is
162 supported, see <xref linkend="overlay" />.</entry> 162 supported, see <xref linkend="overlay" />.</entry>
163 </row> 163 </row>
164 <row> 164 <row>
165 <entry><constant>VID_TYPE_FRAMERAM</constant></entry> 165 <entry><constant>VID_TYPE_FRAMERAM</constant></entry>
166 <entry><constant>V4L2_FBUF_CAP_EXTERNOVERLAY</constant> 166 <entry><constant>V4L2_FBUF_CAP_EXTERNOVERLAY</constant>
167 <emphasis>not set</emphasis> in field 167 <emphasis>not set</emphasis> in field
168 <structfield>capability</structfield> of &v4l2-framebuffer;</entry> 168 <structfield>capability</structfield> of &v4l2-framebuffer;</entry>
169 <entry>Whether overlay overwrites frame buffer memory, 169 <entry>Whether overlay overwrites frame buffer memory,
170 see <xref linkend="overlay" />.</entry> 170 see <xref linkend="overlay" />.</entry>
171 </row> 171 </row>
172 <row> 172 <row>
173 <entry><constant>VID_TYPE_SCALES</constant></entry> 173 <entry><constant>VID_TYPE_SCALES</constant></entry>
174 <entry><constant>-</constant></entry> 174 <entry><constant>-</constant></entry>
175 <entry>This flag indicates if the hardware can scale 175 <entry>This flag indicates if the hardware can scale
176 images. The V4L2 API implies the scale factor by setting the cropping 176 images. The V4L2 API implies the scale factor by setting the cropping
177 dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT; 177 dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT;
178 ioctl, respectively. The driver returns the closest sizes possible. 178 ioctl, respectively. The driver returns the closest sizes possible.
179 For more information on cropping and scaling see <xref 179 For more information on cropping and scaling see <xref
180 linkend="crop" />.</entry> 180 linkend="crop" />.</entry>
181 </row> 181 </row>
182 <row> 182 <row>
183 <entry><constant>VID_TYPE_MONOCHROME</constant></entry> 183 <entry><constant>VID_TYPE_MONOCHROME</constant></entry>
184 <entry><constant>-</constant></entry> 184 <entry><constant>-</constant></entry>
185 <entry>Applications can enumerate the supported image 185 <entry>Applications can enumerate the supported image
186 formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device 186 formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device
187 supports grey scale capturing only. For more information on image 187 supports grey scale capturing only. For more information on image
188 formats see <xref linkend="pixfmt" />.</entry> 188 formats see <xref linkend="pixfmt" />.</entry>
189 </row> 189 </row>
190 <row> 190 <row>
191 <entry><constant>VID_TYPE_SUBCAPTURE</constant></entry> 191 <entry><constant>VID_TYPE_SUBCAPTURE</constant></entry>
192 <entry><constant>-</constant></entry> 192 <entry><constant>-</constant></entry>
193 <entry>Applications can call the &VIDIOC-G-CROP; ioctl 193 <entry>Applications can call the &VIDIOC-G-CROP; ioctl
194 to determine if the device supports capturing a subsection of the full 194 to determine if the device supports capturing a subsection of the full
195 picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;. 195 picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;.
196 For more information on cropping and scaling see <xref 196 For more information on cropping and scaling see <xref
197 linkend="crop" />.</entry> 197 linkend="crop" />.</entry>
198 </row> 198 </row>
199 <row> 199 <row>
200 <entry><constant>VID_TYPE_MPEG_DECODER</constant></entry> 200 <entry><constant>VID_TYPE_MPEG_DECODER</constant></entry>
201 <entry><constant>-</constant></entry> 201 <entry><constant>-</constant></entry>
202 <entry>Applications can enumerate the supported image 202 <entry>Applications can enumerate the supported image
203 formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device 203 formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device
204 supports MPEG streams.</entry> 204 supports MPEG streams.</entry>
205 </row> 205 </row>
206 <row> 206 <row>
207 <entry><constant>VID_TYPE_MPEG_ENCODER</constant></entry> 207 <entry><constant>VID_TYPE_MPEG_ENCODER</constant></entry>
208 <entry><constant>-</constant></entry> 208 <entry><constant>-</constant></entry>
209 <entry>See above.</entry> 209 <entry>See above.</entry>
210 </row> 210 </row>
211 <row> 211 <row>
212 <entry><constant>VID_TYPE_MJPEG_DECODER</constant></entry> 212 <entry><constant>VID_TYPE_MJPEG_DECODER</constant></entry>
213 <entry><constant>-</constant></entry> 213 <entry><constant>-</constant></entry>
214 <entry>See above.</entry> 214 <entry>See above.</entry>
215 </row> 215 </row>
216 <row> 216 <row>
217 <entry><constant>VID_TYPE_MJPEG_ENCODER</constant></entry> 217 <entry><constant>VID_TYPE_MJPEG_ENCODER</constant></entry>
218 <entry><constant>-</constant></entry> 218 <entry><constant>-</constant></entry>
219 <entry>See above.</entry> 219 <entry>See above.</entry>
220 </row> 220 </row>
221 </tbody> 221 </tbody>
222 </tgroup> 222 </tgroup>
223 </informaltable></para> 223 </informaltable></para>
224 224
225 <para>The <structfield>audios</structfield> field was replaced 225 <para>The <structfield>audios</structfield> field was replaced
226 by <structfield>capabilities</structfield> flag 226 by <structfield>capabilities</structfield> flag
227 <constant>V4L2_CAP_AUDIO</constant>, indicating 227 <constant>V4L2_CAP_AUDIO</constant>, indicating
228 <emphasis>if</emphasis> the device has any audio inputs or outputs. To 228 <emphasis>if</emphasis> the device has any audio inputs or outputs. To
229 determine their number applications can enumerate audio inputs with 229 determine their number applications can enumerate audio inputs with
230 the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in <xref 230 the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in <xref
231 linkend="audio" />.</para> 231 linkend="audio" />.</para>
232 232
233 <para>The <structfield>maxwidth</structfield>, 233 <para>The <structfield>maxwidth</structfield>,
234 <structfield>maxheight</structfield>, 234 <structfield>maxheight</structfield>,
235 <structfield>minwidth</structfield> and 235 <structfield>minwidth</structfield> and
236 <structfield>minheight</structfield> fields were removed. Calling the 236 <structfield>minheight</structfield> fields were removed. Calling the
237 &VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions 237 &VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions
238 returns the closest size possible, taking into account the current 238 returns the closest size possible, taking into account the current
239 video standard, cropping and scaling limitations.</para> 239 video standard, cropping and scaling limitations.</para>
240 </section> 240 </section>
241 241
242 <section> 242 <section>
243 <title>Video Sources</title> 243 <title>Video Sources</title>
244 244
245 <para>V4L provides the <constant>VIDIOCGCHAN</constant> and 245 <para>V4L provides the <constant>VIDIOCGCHAN</constant> and
246 <constant>VIDIOCSCHAN</constant> ioctl using struct 246 <constant>VIDIOCSCHAN</constant> ioctl using struct
247 <structname>video_channel</structname> to enumerate 247 <structname>video_channel</structname> to enumerate
248 the video inputs of a V4L device. The equivalent V4L2 ioctls 248 the video inputs of a V4L device. The equivalent V4L2 ioctls
249 are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT; 249 are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT;
250 using &v4l2-input; as discussed in <xref linkend="video" />.</para> 250 using &v4l2-input; as discussed in <xref linkend="video" />.</para>
251 251
252 <para>The <structfield>channel</structfield> field counting 252 <para>The <structfield>channel</structfield> field counting
253 inputs was renamed to <structfield>index</structfield>, the video 253 inputs was renamed to <structfield>index</structfield>, the video
254 input types were renamed as follows: <informaltable> 254 input types were renamed as follows: <informaltable>
255 <tgroup cols="2"> 255 <tgroup cols="2">
256 <thead> 256 <thead>
257 <row> 257 <row>
258 <entry>struct <structname>video_channel</structname> 258 <entry>struct <structname>video_channel</structname>
259 <structfield>type</structfield></entry> 259 <structfield>type</structfield></entry>
260 <entry>&v4l2-input; 260 <entry>&v4l2-input;
261 <structfield>type</structfield></entry> 261 <structfield>type</structfield></entry>
262 </row> 262 </row>
263 </thead> 263 </thead>
264 <tbody valign="top"> 264 <tbody valign="top">
265 <row> 265 <row>
266 <entry><constant>VIDEO_TYPE_TV</constant></entry> 266 <entry><constant>VIDEO_TYPE_TV</constant></entry>
267 <entry><constant>V4L2_INPUT_TYPE_TUNER</constant></entry> 267 <entry><constant>V4L2_INPUT_TYPE_TUNER</constant></entry>
268 </row> 268 </row>
269 <row> 269 <row>
270 <entry><constant>VIDEO_TYPE_CAMERA</constant></entry> 270 <entry><constant>VIDEO_TYPE_CAMERA</constant></entry>
271 <entry><constant>V4L2_INPUT_TYPE_CAMERA</constant></entry> 271 <entry><constant>V4L2_INPUT_TYPE_CAMERA</constant></entry>
272 </row> 272 </row>
273 </tbody> 273 </tbody>
274 </tgroup> 274 </tgroup>
275 </informaltable></para> 275 </informaltable></para>
276 276
277 <para>Unlike the <structfield>tuners</structfield> field 277 <para>Unlike the <structfield>tuners</structfield> field
278 expressing the number of tuners of this input, V4L2 assumes each video 278 expressing the number of tuners of this input, V4L2 assumes each video
279 input is connected to at most one tuner. However a tuner can have more 279 input is connected to at most one tuner. However a tuner can have more
280 than one input, &ie; RF connectors, and a device can have multiple 280 than one input, &ie; RF connectors, and a device can have multiple
281 tuners. The index number of the tuner associated with the input, if 281 tuners. The index number of the tuner associated with the input, if
282 any, is stored in field <structfield>tuner</structfield> of 282 any, is stored in field <structfield>tuner</structfield> of
283 &v4l2-input;. Enumeration of tuners is discussed in <xref 283 &v4l2-input;. Enumeration of tuners is discussed in <xref
284 linkend="tuner" />.</para> 284 linkend="tuner" />.</para>
285 285
286 <para>The redundant <constant>VIDEO_VC_TUNER</constant> flag was 286 <para>The redundant <constant>VIDEO_VC_TUNER</constant> flag was
287 dropped. Video inputs associated with a tuner are of type 287 dropped. Video inputs associated with a tuner are of type
288 <constant>V4L2_INPUT_TYPE_TUNER</constant>. The 288 <constant>V4L2_INPUT_TYPE_TUNER</constant>. The
289 <constant>VIDEO_VC_AUDIO</constant> flag was replaced by the 289 <constant>VIDEO_VC_AUDIO</constant> flag was replaced by the
290 <structfield>audioset</structfield> field. V4L2 considers devices with 290 <structfield>audioset</structfield> field. V4L2 considers devices with
291 up to 32 audio inputs. Each set bit in the 291 up to 32 audio inputs. Each set bit in the
292 <structfield>audioset</structfield> field represents one audio input 292 <structfield>audioset</structfield> field represents one audio input
293 this video input combines with. For information about audio inputs and 293 this video input combines with. For information about audio inputs and
294 how to switch between them see <xref linkend="audio" />.</para> 294 how to switch between them see <xref linkend="audio" />.</para>
295 295
296 <para>The <structfield>norm</structfield> field describing the 296 <para>The <structfield>norm</structfield> field describing the
297 supported video standards was replaced by 297 supported video standards was replaced by
298 <structfield>std</structfield>. The V4L specification mentions a flag 298 <structfield>std</structfield>. The V4L specification mentions a flag
299 <constant>VIDEO_VC_NORM</constant> indicating whether the standard can 299 <constant>VIDEO_VC_NORM</constant> indicating whether the standard can
300 be changed. This flag was a later addition together with the 300 be changed. This flag was a later addition together with the
301 <structfield>norm</structfield> field and has been removed in the 301 <structfield>norm</structfield> field and has been removed in the
302 meantime. V4L2 has a similar, albeit more comprehensive approach 302 meantime. V4L2 has a similar, albeit more comprehensive approach
303 to video standards, see <xref linkend="standard" /> for more 303 to video standards, see <xref linkend="standard" /> for more
304 information.</para> 304 information.</para>
305 </section> 305 </section>
306 306
307 <section> 307 <section>
308 <title>Tuning</title> 308 <title>Tuning</title>
309 309
310 <para>The V4L <constant>VIDIOCGTUNER</constant> and 310 <para>The V4L <constant>VIDIOCGTUNER</constant> and
311 <constant>VIDIOCSTUNER</constant> ioctl and struct 311 <constant>VIDIOCSTUNER</constant> ioctl and struct
312 <structname>video_tuner</structname> can be used to enumerate the 312 <structname>video_tuner</structname> can be used to enumerate the
313 tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are 313 tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are
314 &VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are 314 &VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are
315 covered in <xref linkend="tuner" />.</para> 315 covered in <xref linkend="tuner" />.</para>
316 316
317 <para>The <structfield>tuner</structfield> field counting tuners 317 <para>The <structfield>tuner</structfield> field counting tuners
318 was renamed to <structfield>index</structfield>. The fields 318 was renamed to <structfield>index</structfield>. The fields
319 <structfield>name</structfield>, <structfield>rangelow</structfield> 319 <structfield>name</structfield>, <structfield>rangelow</structfield>
320 and <structfield>rangehigh</structfield> remained unchanged.</para> 320 and <structfield>rangehigh</structfield> remained unchanged.</para>
321 321
322 <para>The <constant>VIDEO_TUNER_PAL</constant>, 322 <para>The <constant>VIDEO_TUNER_PAL</constant>,
323 <constant>VIDEO_TUNER_NTSC</constant> and 323 <constant>VIDEO_TUNER_NTSC</constant> and
324 <constant>VIDEO_TUNER_SECAM</constant> flags indicating the supported 324 <constant>VIDEO_TUNER_SECAM</constant> flags indicating the supported
325 video standards were dropped. This information is now contained in the 325 video standards were dropped. This information is now contained in the
326 associated &v4l2-input;. No replacement exists for the 326 associated &v4l2-input;. No replacement exists for the
327 <constant>VIDEO_TUNER_NORM</constant> flag indicating whether the 327 <constant>VIDEO_TUNER_NORM</constant> flag indicating whether the
328 video standard can be switched. The <structfield>mode</structfield> 328 video standard can be switched. The <structfield>mode</structfield>
329 field to select a different video standard was replaced by a whole new 329 field to select a different video standard was replaced by a whole new
330 set of ioctls and structures described in <xref linkend="standard" />. 330 set of ioctls and structures described in <xref linkend="standard" />.
331 Due to its ubiquity it should be mentioned the BTTV driver supports 331 Due to its ubiquity it should be mentioned the BTTV driver supports
332 several standards in addition to the regular 332 several standards in addition to the regular
333 <constant>VIDEO_MODE_PAL</constant> (0), 333 <constant>VIDEO_MODE_PAL</constant> (0),
334 <constant>VIDEO_MODE_NTSC</constant>, 334 <constant>VIDEO_MODE_NTSC</constant>,
335 <constant>VIDEO_MODE_SECAM</constant> and 335 <constant>VIDEO_MODE_SECAM</constant> and
336 <constant>VIDEO_MODE_AUTO</constant> (3). Namely N/PAL Argentina, 336 <constant>VIDEO_MODE_AUTO</constant> (3). Namely N/PAL Argentina,
337 M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic).</para> 337 M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic).</para>
338 338
339 <para>The <constant>VIDEO_TUNER_STEREO_ON</constant> flag 339 <para>The <constant>VIDEO_TUNER_STEREO_ON</constant> flag
340 indicating stereo reception became 340 indicating stereo reception became
341 <constant>V4L2_TUNER_SUB_STEREO</constant> in field 341 <constant>V4L2_TUNER_SUB_STEREO</constant> in field
342 <structfield>rxsubchans</structfield>. This field also permits the 342 <structfield>rxsubchans</structfield>. This field also permits the
343 detection of monaural and bilingual audio, see the definition of 343 detection of monaural and bilingual audio, see the definition of
344 &v4l2-tuner; for details. Presently no replacement exists for the 344 &v4l2-tuner; for details. Presently no replacement exists for the
345 <constant>VIDEO_TUNER_RDS_ON</constant> and 345 <constant>VIDEO_TUNER_RDS_ON</constant> and
346 <constant>VIDEO_TUNER_MBS_ON</constant> flags.</para> 346 <constant>VIDEO_TUNER_MBS_ON</constant> flags.</para>
347 347
348 <para> The <constant>VIDEO_TUNER_LOW</constant> flag was renamed 348 <para> The <constant>VIDEO_TUNER_LOW</constant> flag was renamed
349 to <constant>V4L2_TUNER_CAP_LOW</constant> in the &v4l2-tuner; 349 to <constant>V4L2_TUNER_CAP_LOW</constant> in the &v4l2-tuner;
350 <structfield>capability</structfield> field.</para> 350 <structfield>capability</structfield> field.</para>
351 351
352 <para>The <constant>VIDIOCGFREQ</constant> and 352 <para>The <constant>VIDIOCGFREQ</constant> and
353 <constant>VIDIOCSFREQ</constant> ioctl to change the tuner frequency 353 <constant>VIDIOCSFREQ</constant> ioctl to change the tuner frequency
354 where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They 354 where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They
355 take a pointer to a &v4l2-frequency; instead of an unsigned long 355 take a pointer to a &v4l2-frequency; instead of an unsigned long
356 integer.</para> 356 integer.</para>
357 </section> 357 </section>
358 358
359 <section id="v4l-image-properties"> 359 <section id="v4l-image-properties">
360 <title>Image Properties</title> 360 <title>Image Properties</title>
361 361
362 <para>V4L2 has no equivalent of the 362 <para>V4L2 has no equivalent of the
363 <constant>VIDIOCGPICT</constant> and <constant>VIDIOCSPICT</constant> 363 <constant>VIDIOCGPICT</constant> and <constant>VIDIOCSPICT</constant>
364 ioctl and struct <structname>video_picture</structname>. The following 364 ioctl and struct <structname>video_picture</structname>. The following
365 fields where replaced by V4L2 controls accessible with the 365 fields where replaced by V4L2 controls accessible with the
366 &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls:<informaltable> 366 &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls:<informaltable>
367 <tgroup cols="2"> 367 <tgroup cols="2">
368 <thead> 368 <thead>
369 <row> 369 <row>
370 <entry>struct <structname>video_picture</structname></entry> 370 <entry>struct <structname>video_picture</structname></entry>
371 <entry>V4L2 Control ID</entry> 371 <entry>V4L2 Control ID</entry>
372 </row> 372 </row>
373 </thead> 373 </thead>
374 <tbody valign="top"> 374 <tbody valign="top">
375 <row> 375 <row>
376 <entry><structfield>brightness</structfield></entry> 376 <entry><structfield>brightness</structfield></entry>
377 <entry><constant>V4L2_CID_BRIGHTNESS</constant></entry> 377 <entry><constant>V4L2_CID_BRIGHTNESS</constant></entry>
378 </row> 378 </row>
379 <row> 379 <row>
380 <entry><structfield>hue</structfield></entry> 380 <entry><structfield>hue</structfield></entry>
381 <entry><constant>V4L2_CID_HUE</constant></entry> 381 <entry><constant>V4L2_CID_HUE</constant></entry>
382 </row> 382 </row>
383 <row> 383 <row>
384 <entry><structfield>colour</structfield></entry> 384 <entry><structfield>colour</structfield></entry>
385 <entry><constant>V4L2_CID_SATURATION</constant></entry> 385 <entry><constant>V4L2_CID_SATURATION</constant></entry>
386 </row> 386 </row>
387 <row> 387 <row>
388 <entry><structfield>contrast</structfield></entry> 388 <entry><structfield>contrast</structfield></entry>
389 <entry><constant>V4L2_CID_CONTRAST</constant></entry> 389 <entry><constant>V4L2_CID_CONTRAST</constant></entry>
390 </row> 390 </row>
391 <row> 391 <row>
392 <entry><structfield>whiteness</structfield></entry> 392 <entry><structfield>whiteness</structfield></entry>
393 <entry><constant>V4L2_CID_WHITENESS</constant></entry> 393 <entry><constant>V4L2_CID_WHITENESS</constant></entry>
394 </row> 394 </row>
395 </tbody> 395 </tbody>
396 </tgroup> 396 </tgroup>
397 </informaltable></para> 397 </informaltable></para>
398 398
399 <para>The V4L picture controls are assumed to range from 0 to 399 <para>The V4L picture controls are assumed to range from 0 to
400 65535 with no particular reset value. The V4L2 API permits arbitrary 400 65535 with no particular reset value. The V4L2 API permits arbitrary
401 limits and defaults which can be queried with the &VIDIOC-QUERYCTRL; 401 limits and defaults which can be queried with the &VIDIOC-QUERYCTRL;
402 ioctl. For general information about controls see <xref 402 ioctl. For general information about controls see <xref
403 linkend="control" />.</para> 403 linkend="control" />.</para>
404 404
405 <para>The <structfield>depth</structfield> (average number of 405 <para>The <structfield>depth</structfield> (average number of
406 bits per pixel) of a video image is implied by the selected image 406 bits per pixel) of a video image is implied by the selected image
407 format. V4L2 does not explicitely provide such information assuming 407 format. V4L2 does not explicitely provide such information assuming
408 applications recognizing the format are aware of the image depth and 408 applications recognizing the format are aware of the image depth and
409 others need not know. The <structfield>palette</structfield> field 409 others need not know. The <structfield>palette</structfield> field
410 moved into the &v4l2-pix-format;:<informaltable> 410 moved into the &v4l2-pix-format;:<informaltable>
411 <tgroup cols="2"> 411 <tgroup cols="2">
412 <thead> 412 <thead>
413 <row> 413 <row>
414 <entry>struct <structname>video_picture</structname> 414 <entry>struct <structname>video_picture</structname>
415 <structfield>palette</structfield></entry> 415 <structfield>palette</structfield></entry>
416 <entry>&v4l2-pix-format; 416 <entry>&v4l2-pix-format;
417 <structfield>pixfmt</structfield></entry> 417 <structfield>pixfmt</structfield></entry>
418 </row> 418 </row>
419 </thead> 419 </thead>
420 <tbody valign="top"> 420 <tbody valign="top">
421 <row> 421 <row>
422 <entry><constant>VIDEO_PALETTE_GREY</constant></entry> 422 <entry><constant>VIDEO_PALETTE_GREY</constant></entry>
423 <entry><para><link 423 <entry><para><link
424 linkend="V4L2-PIX-FMT-GREY"><constant>V4L2_PIX_FMT_GREY</constant></link></para></entry> 424 linkend="V4L2-PIX-FMT-GREY"><constant>V4L2_PIX_FMT_GREY</constant></link></para></entry>
425 </row> 425 </row>
426 <row> 426 <row>
427 <entry><constant>VIDEO_PALETTE_HI240</constant></entry> 427 <entry><constant>VIDEO_PALETTE_HI240</constant></entry>
428 <entry><para><link 428 <entry><para><link
429 linkend="pixfmt-reserved"><constant>V4L2_PIX_FMT_HI240</constant></link><footnote> 429 linkend="pixfmt-reserved"><constant>V4L2_PIX_FMT_HI240</constant></link><footnote>
430 <para>This is a custom format used by the BTTV 430 <para>This is a custom format used by the BTTV
431 driver, not one of the V4L2 standard formats.</para> 431 driver, not one of the V4L2 standard formats.</para>
432 </footnote></para></entry> 432 </footnote></para></entry>
433 </row> 433 </row>
434 <row> 434 <row>
435 <entry><constant>VIDEO_PALETTE_RGB565</constant></entry> 435 <entry><constant>VIDEO_PALETTE_RGB565</constant></entry>
436 <entry><para><link 436 <entry><para><link
437 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB565</constant></link></para></entry> 437 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB565</constant></link></para></entry>
438 </row> 438 </row>
439 <row> 439 <row>
440 <entry><constant>VIDEO_PALETTE_RGB555</constant></entry> 440 <entry><constant>VIDEO_PALETTE_RGB555</constant></entry>
441 <entry><para><link 441 <entry><para><link
442 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB555</constant></link></para></entry> 442 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB555</constant></link></para></entry>
443 </row> 443 </row>
444 <row> 444 <row>
445 <entry><constant>VIDEO_PALETTE_RGB24</constant></entry> 445 <entry><constant>VIDEO_PALETTE_RGB24</constant></entry>
446 <entry><para><link 446 <entry><para><link
447 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR24</constant></link></para></entry> 447 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR24</constant></link></para></entry>
448 </row> 448 </row>
449 <row> 449 <row>
450 <entry><constant>VIDEO_PALETTE_RGB32</constant></entry> 450 <entry><constant>VIDEO_PALETTE_RGB32</constant></entry>
451 <entry><para><link 451 <entry><para><link
452 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR32</constant></link><footnote> 452 linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR32</constant></link><footnote>
453 <para>Presumably all V4L RGB formats are 453 <para>Presumably all V4L RGB formats are
454 little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue 454 little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue
455 swapped variants. For details see <xref linkend="pixfmt-rgb" />.</para> 455 swapped variants. For details see <xref linkend="pixfmt-rgb" />.</para>
456 </footnote></para></entry> 456 </footnote></para></entry>
457 </row> 457 </row>
458 <row> 458 <row>
459 <entry><constant>VIDEO_PALETTE_YUV422</constant></entry> 459 <entry><constant>VIDEO_PALETTE_YUV422</constant></entry>
460 <entry><para><link 460 <entry><para><link
461 linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry> 461 linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>
462 </row> 462 </row>
463 <row> 463 <row>
464 <entry><para><constant>VIDEO_PALETTE_YUYV</constant><footnote> 464 <entry><para><constant>VIDEO_PALETTE_YUYV</constant><footnote>
465 <para><constant>VIDEO_PALETTE_YUV422</constant> 465 <para><constant>VIDEO_PALETTE_YUV422</constant>
466 and <constant>VIDEO_PALETTE_YUYV</constant> are the same formats. Some 466 and <constant>VIDEO_PALETTE_YUYV</constant> are the same formats. Some
467 V4L drivers respond to one, some to the other.</para> 467 V4L drivers respond to one, some to the other.</para>
468 </footnote></para></entry> 468 </footnote></para></entry>
469 <entry><para><link 469 <entry><para><link
470 linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry> 470 linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>
471 </row> 471 </row>
472 <row> 472 <row>
473 <entry><constant>VIDEO_PALETTE_UYVY</constant></entry> 473 <entry><constant>VIDEO_PALETTE_UYVY</constant></entry>
474 <entry><para><link 474 <entry><para><link
475 linkend="V4L2-PIX-FMT-UYVY"><constant>V4L2_PIX_FMT_UYVY</constant></link></para></entry> 475 linkend="V4L2-PIX-FMT-UYVY"><constant>V4L2_PIX_FMT_UYVY</constant></link></para></entry>
476 </row> 476 </row>
477 <row> 477 <row>
478 <entry><constant>VIDEO_PALETTE_YUV420</constant></entry> 478 <entry><constant>VIDEO_PALETTE_YUV420</constant></entry>
479 <entry>None</entry> 479 <entry>None</entry>
480 </row> 480 </row>
481 <row> 481 <row>
482 <entry><constant>VIDEO_PALETTE_YUV411</constant></entry> 482 <entry><constant>VIDEO_PALETTE_YUV411</constant></entry>
483 <entry><para><link 483 <entry><para><link
484 linkend="V4L2-PIX-FMT-Y41P"><constant>V4L2_PIX_FMT_Y41P</constant></link><footnote> 484 linkend="V4L2-PIX-FMT-Y41P"><constant>V4L2_PIX_FMT_Y41P</constant></link><footnote>
485 <para>Not to be confused with 485 <para>Not to be confused with
486 <constant>V4L2_PIX_FMT_YUV411P</constant>, which is a planar 486 <constant>V4L2_PIX_FMT_YUV411P</constant>, which is a planar
487 format.</para> </footnote></para></entry> 487 format.</para> </footnote></para></entry>
488 </row> 488 </row>
489 <row> 489 <row>
490 <entry><constant>VIDEO_PALETTE_RAW</constant></entry> 490 <entry><constant>VIDEO_PALETTE_RAW</constant></entry>
491 <entry><para>None<footnote> <para>V4L explains this 491 <entry><para>None<footnote> <para>V4L explains this
492 as: "RAW capture (BT848)"</para> </footnote></para></entry> 492 as: "RAW capture (BT848)"</para> </footnote></para></entry>
493 </row> 493 </row>
494 <row> 494 <row>
495 <entry><constant>VIDEO_PALETTE_YUV422P</constant></entry> 495 <entry><constant>VIDEO_PALETTE_YUV422P</constant></entry>
496 <entry><para><link 496 <entry><para><link
497 linkend="V4L2-PIX-FMT-YUV422P"><constant>V4L2_PIX_FMT_YUV422P</constant></link></para></entry> 497 linkend="V4L2-PIX-FMT-YUV422P"><constant>V4L2_PIX_FMT_YUV422P</constant></link></para></entry>
498 </row> 498 </row>
499 <row> 499 <row>
500 <entry><constant>VIDEO_PALETTE_YUV411P</constant></entry> 500 <entry><constant>VIDEO_PALETTE_YUV411P</constant></entry>
501 <entry><para><link 501 <entry><para><link
502 linkend="V4L2-PIX-FMT-YUV411P"><constant>V4L2_PIX_FMT_YUV411P</constant></link><footnote> 502 linkend="V4L2-PIX-FMT-YUV411P"><constant>V4L2_PIX_FMT_YUV411P</constant></link><footnote>
503 <para>Not to be confused with 503 <para>Not to be confused with
504 <constant>V4L2_PIX_FMT_Y41P</constant>, which is a packed 504 <constant>V4L2_PIX_FMT_Y41P</constant>, which is a packed
505 format.</para> </footnote></para></entry> 505 format.</para> </footnote></para></entry>
506 </row> 506 </row>
507 <row> 507 <row>
508 <entry><constant>VIDEO_PALETTE_YUV420P</constant></entry> 508 <entry><constant>VIDEO_PALETTE_YUV420P</constant></entry>
509 <entry><para><link 509 <entry><para><link
510 linkend="V4L2-PIX-FMT-YVU420"><constant>V4L2_PIX_FMT_YVU420</constant></link></para></entry> 510 linkend="V4L2-PIX-FMT-YVU420"><constant>V4L2_PIX_FMT_YVU420</constant></link></para></entry>
511 </row> 511 </row>
512 <row> 512 <row>
513 <entry><constant>VIDEO_PALETTE_YUV410P</constant></entry> 513 <entry><constant>VIDEO_PALETTE_YUV410P</constant></entry>
514 <entry><para><link 514 <entry><para><link
515 linkend="V4L2-PIX-FMT-YVU410"><constant>V4L2_PIX_FMT_YVU410</constant></link></para></entry> 515 linkend="V4L2-PIX-FMT-YVU410"><constant>V4L2_PIX_FMT_YVU410</constant></link></para></entry>
516 </row> 516 </row>
517 </tbody> 517 </tbody>
518 </tgroup> 518 </tgroup>
519 </informaltable></para> 519 </informaltable></para>
520 520
521 <para>V4L2 image formats are defined in <xref 521 <para>V4L2 image formats are defined in <xref
522 linkend="pixfmt" />. The image format can be selected with the 522 linkend="pixfmt" />. The image format can be selected with the
523 &VIDIOC-S-FMT; ioctl.</para> 523 &VIDIOC-S-FMT; ioctl.</para>
524 </section> 524 </section>
525 525
526 <section> 526 <section>
527 <title>Audio</title> 527 <title>Audio</title>
528 528
529 <para>The <constant>VIDIOCGAUDIO</constant> and 529 <para>The <constant>VIDIOCGAUDIO</constant> and
530 <constant>VIDIOCSAUDIO</constant> ioctl and struct 530 <constant>VIDIOCSAUDIO</constant> ioctl and struct
531 <structname>video_audio</structname> are used to enumerate the 531 <structname>video_audio</structname> are used to enumerate the
532 audio inputs of a V4L device. The equivalent V4L2 ioctls are 532 audio inputs of a V4L device. The equivalent V4L2 ioctls are
533 &VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as 533 &VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as
534 discussed in <xref linkend="audio" />.</para> 534 discussed in <xref linkend="audio" />.</para>
535 535
536 <para>The <structfield>audio</structfield> "channel number" 536 <para>The <structfield>audio</structfield> "channel number"
537 field counting audio inputs was renamed to 537 field counting audio inputs was renamed to
538 <structfield>index</structfield>.</para> 538 <structfield>index</structfield>.</para>
539 539
540 <para>On <constant>VIDIOCSAUDIO</constant> the 540 <para>On <constant>VIDIOCSAUDIO</constant> the
541 <structfield>mode</structfield> field selects <emphasis>one</emphasis> 541 <structfield>mode</structfield> field selects <emphasis>one</emphasis>
542 of the <constant>VIDEO_SOUND_MONO</constant>, 542 of the <constant>VIDEO_SOUND_MONO</constant>,
543 <constant>VIDEO_SOUND_STEREO</constant>, 543 <constant>VIDEO_SOUND_STEREO</constant>,
544 <constant>VIDEO_SOUND_LANG1</constant> or 544 <constant>VIDEO_SOUND_LANG1</constant> or
545 <constant>VIDEO_SOUND_LANG2</constant> audio demodulation modes. When 545 <constant>VIDEO_SOUND_LANG2</constant> audio demodulation modes. When
546 the current audio standard is BTSC 546 the current audio standard is BTSC
547 <constant>VIDEO_SOUND_LANG2</constant> refers to SAP and 547 <constant>VIDEO_SOUND_LANG2</constant> refers to SAP and
548 <constant>VIDEO_SOUND_LANG1</constant> is meaningless. Also 548 <constant>VIDEO_SOUND_LANG1</constant> is meaningless. Also
549 undocumented in the V4L specification, there is no way to query the 549 undocumented in the V4L specification, there is no way to query the
550 selected mode. On <constant>VIDIOCGAUDIO</constant> the driver returns 550 selected mode. On <constant>VIDIOCGAUDIO</constant> the driver returns
551 the <emphasis>actually received</emphasis> audio programmes in this 551 the <emphasis>actually received</emphasis> audio programmes in this
552 field. In the V4L2 API this information is stored in the &v4l2-tuner; 552 field. In the V4L2 API this information is stored in the &v4l2-tuner;
553 <structfield>rxsubchans</structfield> and 553 <structfield>rxsubchans</structfield> and
554 <structfield>audmode</structfield> fields, respectively. See <xref 554 <structfield>audmode</structfield> fields, respectively. See <xref
555 linkend="tuner" /> for more information on tuners. Related to audio 555 linkend="tuner" /> for more information on tuners. Related to audio
556 modes &v4l2-audio; also reports if this is a mono or stereo 556 modes &v4l2-audio; also reports if this is a mono or stereo
557 input, regardless if the source is a tuner.</para> 557 input, regardless if the source is a tuner.</para>
558 558
559 <para>The following fields where replaced by V4L2 controls 559 <para>The following fields where replaced by V4L2 controls
560 accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and 560 accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and
561 &VIDIOC-S-CTRL; ioctls:<informaltable> 561 &VIDIOC-S-CTRL; ioctls:<informaltable>
562 <tgroup cols="2"> 562 <tgroup cols="2">
563 <thead> 563 <thead>
564 <row> 564 <row>
565 <entry>struct 565 <entry>struct
566 <structname>video_audio</structname></entry> 566 <structname>video_audio</structname></entry>
567 <entry>V4L2 Control ID</entry> 567 <entry>V4L2 Control ID</entry>
568 </row> 568 </row>
569 </thead> 569 </thead>
570 <tbody valign="top"> 570 <tbody valign="top">
571 <row> 571 <row>
572 <entry><structfield>volume</structfield></entry> 572 <entry><structfield>volume</structfield></entry>
573 <entry><constant>V4L2_CID_AUDIO_VOLUME</constant></entry> 573 <entry><constant>V4L2_CID_AUDIO_VOLUME</constant></entry>
574 </row> 574 </row>
575 <row> 575 <row>
576 <entry><structfield>bass</structfield></entry> 576 <entry><structfield>bass</structfield></entry>
577 <entry><constant>V4L2_CID_AUDIO_BASS</constant></entry> 577 <entry><constant>V4L2_CID_AUDIO_BASS</constant></entry>
578 </row> 578 </row>
579 <row> 579 <row>
580 <entry><structfield>treble</structfield></entry> 580 <entry><structfield>treble</structfield></entry>
581 <entry><constant>V4L2_CID_AUDIO_TREBLE</constant></entry> 581 <entry><constant>V4L2_CID_AUDIO_TREBLE</constant></entry>
582 </row> 582 </row>
583 <row> 583 <row>
584 <entry><structfield>balance</structfield></entry> 584 <entry><structfield>balance</structfield></entry>
585 <entry><constant>V4L2_CID_AUDIO_BALANCE</constant></entry> 585 <entry><constant>V4L2_CID_AUDIO_BALANCE</constant></entry>
586 </row> 586 </row>
587 </tbody> 587 </tbody>
588 </tgroup> 588 </tgroup>
589 </informaltable></para> 589 </informaltable></para>
590 590
591 <para>To determine which of these controls are supported by a 591 <para>To determine which of these controls are supported by a
592 driver V4L provides the <structfield>flags</structfield> 592 driver V4L provides the <structfield>flags</structfield>
593 <constant>VIDEO_AUDIO_VOLUME</constant>, 593 <constant>VIDEO_AUDIO_VOLUME</constant>,
594 <constant>VIDEO_AUDIO_BASS</constant>, 594 <constant>VIDEO_AUDIO_BASS</constant>,
595 <constant>VIDEO_AUDIO_TREBLE</constant> and 595 <constant>VIDEO_AUDIO_TREBLE</constant> and
596 <constant>VIDEO_AUDIO_BALANCE</constant>. In the V4L2 API the 596 <constant>VIDEO_AUDIO_BALANCE</constant>. In the V4L2 API the
597 &VIDIOC-QUERYCTRL; ioctl reports if the respective control is 597 &VIDIOC-QUERYCTRL; ioctl reports if the respective control is
598 supported. Accordingly the <constant>VIDEO_AUDIO_MUTABLE</constant> 598 supported. Accordingly the <constant>VIDEO_AUDIO_MUTABLE</constant>
599 and <constant>VIDEO_AUDIO_MUTE</constant> flags where replaced by the 599 and <constant>VIDEO_AUDIO_MUTE</constant> flags where replaced by the
600 boolean <constant>V4L2_CID_AUDIO_MUTE</constant> control.</para> 600 boolean <constant>V4L2_CID_AUDIO_MUTE</constant> control.</para>
601 601
602 <para>All V4L2 controls have a <structfield>step</structfield> 602 <para>All V4L2 controls have a <structfield>step</structfield>
603 attribute replacing the struct <structname>video_audio</structname> 603 attribute replacing the struct <structname>video_audio</structname>
604 <structfield>step</structfield> field. The V4L audio controls are 604 <structfield>step</structfield> field. The V4L audio controls are
605 assumed to range from 0 to 65535 with no particular reset value. The 605 assumed to range from 0 to 65535 with no particular reset value. The
606 V4L2 API permits arbitrary limits and defaults which can be queried 606 V4L2 API permits arbitrary limits and defaults which can be queried
607 with the &VIDIOC-QUERYCTRL; ioctl. For general information about 607 with the &VIDIOC-QUERYCTRL; ioctl. For general information about
608 controls see <xref linkend="control" />.</para> 608 controls see <xref linkend="control" />.</para>
609 </section> 609 </section>
610 610
611 <section> 611 <section>
612 <title>Frame Buffer Overlay</title> 612 <title>Frame Buffer Overlay</title>
613 613
614 <para>The V4L2 ioctls equivalent to 614 <para>The V4L2 ioctls equivalent to
615 <constant>VIDIOCGFBUF</constant> and <constant>VIDIOCSFBUF</constant> 615 <constant>VIDIOCGFBUF</constant> and <constant>VIDIOCSFBUF</constant>
616 are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The 616 are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The
617 <structfield>base</structfield> field of struct 617 <structfield>base</structfield> field of struct
618 <structname>video_buffer</structname> remained unchanged, except V4L2 618 <structname>video_buffer</structname> remained unchanged, except V4L2
619 defines a flag to indicate non-destructive overlays instead of a 619 defines a flag to indicate non-destructive overlays instead of a
620 <constant>NULL</constant> pointer. All other fields moved into the 620 <constant>NULL</constant> pointer. All other fields moved into the
621 &v4l2-pix-format; <structfield>fmt</structfield> substructure of 621 &v4l2-pix-format; <structfield>fmt</structfield> substructure of
622 &v4l2-framebuffer;. The <structfield>depth</structfield> field was 622 &v4l2-framebuffer;. The <structfield>depth</structfield> field was
623 replaced by <structfield>pixelformat</structfield>. See <xref 623 replaced by <structfield>pixelformat</structfield>. See <xref
624 linkend="pixfmt-rgb" /> for a list of RGB formats and their 624 linkend="pixfmt-rgb" /> for a list of RGB formats and their
625 respective color depths.</para> 625 respective color depths.</para>
626 626
627 <para>Instead of the special ioctls 627 <para>Instead of the special ioctls
628 <constant>VIDIOCGWIN</constant> and <constant>VIDIOCSWIN</constant> 628 <constant>VIDIOCGWIN</constant> and <constant>VIDIOCSWIN</constant>
629 V4L2 uses the general-purpose data format negotiation ioctls 629 V4L2 uses the general-purpose data format negotiation ioctls
630 &VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a 630 &VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a
631 &v4l2-format; as argument. Here the <structfield>win</structfield> 631 &v4l2-format; as argument. Here the <structfield>win</structfield>
632 member of the <structfield>fmt</structfield> union is used, a 632 member of the <structfield>fmt</structfield> union is used, a
633 &v4l2-window;.</para> 633 &v4l2-window;.</para>
634 634
635 <para>The <structfield>x</structfield>, 635 <para>The <structfield>x</structfield>,
636 <structfield>y</structfield>, <structfield>width</structfield> and 636 <structfield>y</structfield>, <structfield>width</structfield> and
637 <structfield>height</structfield> fields of struct 637 <structfield>height</structfield> fields of struct
638 <structname>video_window</structname> moved into &v4l2-rect; 638 <structname>video_window</structname> moved into &v4l2-rect;
639 substructure <structfield>w</structfield> of struct 639 substructure <structfield>w</structfield> of struct
640 <structname>v4l2_window</structname>. The 640 <structname>v4l2_window</structname>. The
641 <structfield>chromakey</structfield>, 641 <structfield>chromakey</structfield>,
642 <structfield>clips</structfield>, and 642 <structfield>clips</structfield>, and
643 <structfield>clipcount</structfield> fields remained unchanged. Struct 643 <structfield>clipcount</structfield> fields remained unchanged. Struct
644 <structname>video_clip</structname> was renamed to &v4l2-clip;, also 644 <structname>video_clip</structname> was renamed to &v4l2-clip;, also
645 containing a struct <structname>v4l2_rect</structname>, but the 645 containing a struct <structname>v4l2_rect</structname>, but the
646 semantics are still the same.</para> 646 semantics are still the same.</para>
647 647
648 <para>The <constant>VIDEO_WINDOW_INTERLACE</constant> flag was 648 <para>The <constant>VIDEO_WINDOW_INTERLACE</constant> flag was
649 dropped. Instead applications must set the 649 dropped. Instead applications must set the
650 <structfield>field</structfield> field to 650 <structfield>field</structfield> field to
651 <constant>V4L2_FIELD_ANY</constant> or 651 <constant>V4L2_FIELD_ANY</constant> or
652 <constant>V4L2_FIELD_INTERLACED</constant>. The 652 <constant>V4L2_FIELD_INTERLACED</constant>. The
653 <constant>VIDEO_WINDOW_CHROMAKEY</constant> flag moved into 653 <constant>VIDEO_WINDOW_CHROMAKEY</constant> flag moved into
654 &v4l2-framebuffer;, under the new name 654 &v4l2-framebuffer;, under the new name
655 <constant>V4L2_FBUF_FLAG_CHROMAKEY</constant>.</para> 655 <constant>V4L2_FBUF_FLAG_CHROMAKEY</constant>.</para>
656 656
657 <para>In V4L, storing a bitmap pointer in 657 <para>In V4L, storing a bitmap pointer in
658 <structfield>clips</structfield> and setting 658 <structfield>clips</structfield> and setting
659 <structfield>clipcount</structfield> to 659 <structfield>clipcount</structfield> to
660 <constant>VIDEO_CLIP_BITMAP</constant> (-1) requests bitmap 660 <constant>VIDEO_CLIP_BITMAP</constant> (-1) requests bitmap
661 clipping, using a fixed size bitmap of 1024 &times; 625 bits. Struct 661 clipping, using a fixed size bitmap of 1024 &times; 625 bits. Struct
662 <structname>v4l2_window</structname> has a separate 662 <structname>v4l2_window</structname> has a separate
663 <structfield>bitmap</structfield> pointer field for this purpose and 663 <structfield>bitmap</structfield> pointer field for this purpose and
664 the bitmap size is determined by <structfield>w.width</structfield> and 664 the bitmap size is determined by <structfield>w.width</structfield> and
665 <structfield>w.height</structfield>.</para> 665 <structfield>w.height</structfield>.</para>
666 666
667 <para>The <constant>VIDIOCCAPTURE</constant> ioctl to enable or 667 <para>The <constant>VIDIOCCAPTURE</constant> ioctl to enable or
668 disable overlay was renamed to &VIDIOC-OVERLAY;.</para> 668 disable overlay was renamed to &VIDIOC-OVERLAY;.</para>
669 </section> 669 </section>
670 670
671 <section> 671 <section>
672 <title>Cropping</title> 672 <title>Cropping</title>
673 673
674 <para>To capture only a subsection of the full picture V4L 674 <para>To capture only a subsection of the full picture V4L
675 defines the <constant>VIDIOCGCAPTURE</constant> and 675 defines the <constant>VIDIOCGCAPTURE</constant> and
676 <constant>VIDIOCSCAPTURE</constant> ioctls using struct 676 <constant>VIDIOCSCAPTURE</constant> ioctls using struct
677 <structname>video_capture</structname>. The equivalent V4L2 ioctls are 677 <structname>video_capture</structname>. The equivalent V4L2 ioctls are
678 &VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related 678 &VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related
679 &VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see 679 &VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see
680 <xref linkend="crop" /> for details.</para> 680 <xref linkend="crop" /> for details.</para>
681 681
682 <para>The <structfield>x</structfield>, 682 <para>The <structfield>x</structfield>,
683 <structfield>y</structfield>, <structfield>width</structfield> and 683 <structfield>y</structfield>, <structfield>width</structfield> and
684 <structfield>height</structfield> fields moved into &v4l2-rect; 684 <structfield>height</structfield> fields moved into &v4l2-rect;
685 substructure <structfield>c</structfield> of struct 685 substructure <structfield>c</structfield> of struct
686 <structname>v4l2_crop</structname>. The 686 <structname>v4l2_crop</structname>. The
687 <structfield>decimation</structfield> field was dropped. In the V4L2 687 <structfield>decimation</structfield> field was dropped. In the V4L2
688 API the scaling factor is implied by the size of the cropping 688 API the scaling factor is implied by the size of the cropping
689 rectangle and the size of the captured or overlaid image.</para> 689 rectangle and the size of the captured or overlaid image.</para>
690 690
691 <para>The <constant>VIDEO_CAPTURE_ODD</constant> 691 <para>The <constant>VIDEO_CAPTURE_ODD</constant>
692 and <constant>VIDEO_CAPTURE_EVEN</constant> flags to capture only the 692 and <constant>VIDEO_CAPTURE_EVEN</constant> flags to capture only the
693 odd or even field, respectively, were replaced by 693 odd or even field, respectively, were replaced by
694 <constant>V4L2_FIELD_TOP</constant> and 694 <constant>V4L2_FIELD_TOP</constant> and
695 <constant>V4L2_FIELD_BOTTOM</constant> in the field named 695 <constant>V4L2_FIELD_BOTTOM</constant> in the field named
696 <structfield>field</structfield> of &v4l2-pix-format; and 696 <structfield>field</structfield> of &v4l2-pix-format; and
697 &v4l2-window;. These structures are used to select a capture or 697 &v4l2-window;. These structures are used to select a capture or
698 overlay format with the &VIDIOC-S-FMT; ioctl.</para> 698 overlay format with the &VIDIOC-S-FMT; ioctl.</para>
699 </section> 699 </section>
700 700
701 <section> 701 <section>
702 <title>Reading Images, Memory Mapping</title> 702 <title>Reading Images, Memory Mapping</title>
703 703
704 <section> 704 <section>
705 <title>Capturing using the read method</title> 705 <title>Capturing using the read method</title>
706 706
707 <para>There is no essential difference between reading images 707 <para>There is no essential difference between reading images
708 from a V4L or V4L2 device using the &func-read; function, however V4L2 708 from a V4L or V4L2 device using the &func-read; function, however V4L2
709 drivers are not required to support this I/O method. Applications can 709 drivers are not required to support this I/O method. Applications can
710 determine if the function is available with the &VIDIOC-QUERYCAP; 710 determine if the function is available with the &VIDIOC-QUERYCAP;
711 ioctl. All V4L2 devices exchanging data with applications must support 711 ioctl. All V4L2 devices exchanging data with applications must support
712 the &func-select; and &func-poll; functions.</para> 712 the &func-select; and &func-poll; functions.</para>
713 713
714 <para>To select an image format and size, V4L provides the 714 <para>To select an image format and size, V4L provides the
715 <constant>VIDIOCSPICT</constant> and <constant>VIDIOCSWIN</constant> 715 <constant>VIDIOCSPICT</constant> and <constant>VIDIOCSWIN</constant>
716 ioctls. V4L2 uses the general-purpose data format negotiation ioctls 716 ioctls. V4L2 uses the general-purpose data format negotiation ioctls
717 &VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a 717 &VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a
718 &v4l2-format; as argument, here the &v4l2-pix-format; named 718 &v4l2-format; as argument, here the &v4l2-pix-format; named
719 <structfield>pix</structfield> of its <structfield>fmt</structfield> 719 <structfield>pix</structfield> of its <structfield>fmt</structfield>
720 union is used.</para> 720 union is used.</para>
721 721
722 <para>For more information about the V4L2 read interface see 722 <para>For more information about the V4L2 read interface see
723 <xref linkend="rw" />.</para> 723 <xref linkend="rw" />.</para>
724 </section> 724 </section>
725 <section> 725 <section>
726 <title>Capturing using memory mapping</title> 726 <title>Capturing using memory mapping</title>
727 727
728 <para>Applications can read from V4L devices by mapping 728 <para>Applications can read from V4L devices by mapping
729 buffers in device memory, or more often just buffers allocated in 729 buffers in device memory, or more often just buffers allocated in
730 DMA-able system memory, into their address space. This avoids the data 730 DMA-able system memory, into their address space. This avoids the data
731 copying overhead of the read method. V4L2 supports memory mapping as 731 copying overhead of the read method. V4L2 supports memory mapping as
732 well, with a few differences.</para> 732 well, with a few differences.</para>
733 733
734 <informaltable> 734 <informaltable>
735 <tgroup cols="2"> 735 <tgroup cols="2">
736 <thead> 736 <thead>
737 <row> 737 <row>
738 <entry>V4L</entry> 738 <entry>V4L</entry>
739 <entry>V4L2</entry> 739 <entry>V4L2</entry>
740 </row> 740 </row>
741 </thead> 741 </thead>
742 <tbody valign="top"> 742 <tbody valign="top">
743 <row> 743 <row>
744 <entry></entry> 744 <entry></entry>
745 <entry>The image format must be selected before 745 <entry>The image format must be selected before
746 buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format 746 buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format
747 is selected the driver may use the last, possibly by another 747 is selected the driver may use the last, possibly by another
748 application requested format.</entry> 748 application requested format.</entry>
749 </row> 749 </row>
750 <row> 750 <row>
751 <entry><para>Applications cannot change the number of 751 <entry><para>Applications cannot change the number of
752 buffers. The it is built into the driver, unless it has a module 752 buffers. The it is built into the driver, unless it has a module
753 option to change the number when the driver module is 753 option to change the number when the driver module is
754 loaded.</para></entry> 754 loaded.</para></entry>
755 <entry><para>The &VIDIOC-REQBUFS; ioctl allocates the 755 <entry><para>The &VIDIOC-REQBUFS; ioctl allocates the
756 desired number of buffers, this is a required step in the initialization 756 desired number of buffers, this is a required step in the initialization
757 sequence.</para></entry> 757 sequence.</para></entry>
758 </row> 758 </row>
759 <row> 759 <row>
760 <entry><para>Drivers map all buffers as one contiguous 760 <entry><para>Drivers map all buffers as one contiguous
761 range of memory. The <constant>VIDIOCGMBUF</constant> ioctl is 761 range of memory. The <constant>VIDIOCGMBUF</constant> ioctl is
762 available to query the number of buffers, the offset of each buffer 762 available to query the number of buffers, the offset of each buffer
763 from the start of the virtual file, and the overall amount of memory 763 from the start of the virtual file, and the overall amount of memory
764 used, which can be used as arguments for the &func-mmap; 764 used, which can be used as arguments for the &func-mmap;
765 function.</para></entry> 765 function.</para></entry>
766 <entry><para>Buffers are individually mapped. The 766 <entry><para>Buffers are individually mapped. The
767 offset and size of each buffer can be determined with the 767 offset and size of each buffer can be determined with the
768 &VIDIOC-QUERYBUF; ioctl.</para></entry> 768 &VIDIOC-QUERYBUF; ioctl.</para></entry>
769 </row> 769 </row>
770 <row> 770 <row>
771 <entry><para>The <constant>VIDIOCMCAPTURE</constant> 771 <entry><para>The <constant>VIDIOCMCAPTURE</constant>
772 ioctl prepares a buffer for capturing. It also determines the image 772 ioctl prepares a buffer for capturing. It also determines the image
773 format for this buffer. The ioctl returns immediately, eventually with 773 format for this buffer. The ioctl returns immediately, eventually with
774 an &EAGAIN; if no video signal had been detected. When the driver 774 an &EAGAIN; if no video signal had been detected. When the driver
775 supports more than one buffer applications can call the ioctl multiple 775 supports more than one buffer applications can call the ioctl multiple
776 times and thus have multiple outstanding capture 776 times and thus have multiple outstanding capture
777 requests.</para><para>The <constant>VIDIOCSYNC</constant> ioctl 777 requests.</para><para>The <constant>VIDIOCSYNC</constant> ioctl
778 suspends execution until a particular buffer has been 778 suspends execution until a particular buffer has been
779 filled.</para></entry> 779 filled.</para></entry>
780 <entry><para>Drivers maintain an incoming and outgoing 780 <entry><para>Drivers maintain an incoming and outgoing
781 queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming 781 queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming
782 queue. Filled buffers are dequeued from the outgoing queue with the 782 queue. Filled buffers are dequeued from the outgoing queue with the
783 &VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this 783 &VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this
784 function, &func-select; or &func-poll; can be used. The 784 function, &func-select; or &func-poll; can be used. The
785 &VIDIOC-STREAMON; ioctl must be called once after enqueuing one or 785 &VIDIOC-STREAMON; ioctl must be called once after enqueuing one or
786 more buffers to start capturing. Its counterpart 786 more buffers to start capturing. Its counterpart
787 &VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both 787 &VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both
788 queues. Applications can query the signal status, if known, with the 788 queues. Applications can query the signal status, if known, with the
789 &VIDIOC-ENUMINPUT; ioctl.</para></entry> 789 &VIDIOC-ENUMINPUT; ioctl.</para></entry>
790 </row> 790 </row>
791 </tbody> 791 </tbody>
792 </tgroup> 792 </tgroup>
793 </informaltable> 793 </informaltable>
794 794
795 <para>For a more in-depth discussion of memory mapping and 795 <para>For a more in-depth discussion of memory mapping and
796 examples, see <xref linkend="mmap" />.</para> 796 examples, see <xref linkend="mmap" />.</para>
797 </section> 797 </section>
798 </section> 798 </section>
799 799
800 <section> 800 <section>
801 <title>Reading Raw VBI Data</title> 801 <title>Reading Raw VBI Data</title>
802 802
803 <para>Originally the V4L API did not specify a raw VBI capture 803 <para>Originally the V4L API did not specify a raw VBI capture
804 interface, only the device file <filename>/dev/vbi</filename> was 804 interface, only the device file <filename>/dev/vbi</filename> was
805 reserved for this purpose. The only driver supporting this interface 805 reserved for this purpose. The only driver supporting this interface
806 was the BTTV driver, de-facto defining the V4L VBI interface. Reading 806 was the BTTV driver, de-facto defining the V4L VBI interface. Reading
807 from the device yields a raw VBI image with the following 807 from the device yields a raw VBI image with the following
808 parameters:<informaltable> 808 parameters:<informaltable>
809 <tgroup cols="2"> 809 <tgroup cols="2">
810 <thead> 810 <thead>
811 <row> 811 <row>
812 <entry>&v4l2-vbi-format;</entry> 812 <entry>&v4l2-vbi-format;</entry>
813 <entry>V4L, BTTV driver</entry> 813 <entry>V4L, BTTV driver</entry>
814 </row> 814 </row>
815 </thead> 815 </thead>
816 <tbody valign="top"> 816 <tbody valign="top">
817 <row> 817 <row>
818 <entry>sampling_rate</entry> 818 <entry>sampling_rate</entry>
819 <entry>28636363&nbsp;Hz NTSC (or any other 525-line 819 <entry>28636363&nbsp;Hz NTSC (or any other 525-line
820 standard); 35468950&nbsp;Hz PAL and SECAM (625-line standards)</entry> 820 standard); 35468950&nbsp;Hz PAL and SECAM (625-line standards)</entry>
821 </row> 821 </row>
822 <row> 822 <row>
823 <entry>offset</entry> 823 <entry>offset</entry>
824 <entry>?</entry> 824 <entry>?</entry>
825 </row> 825 </row>
826 <row> 826 <row>
827 <entry>samples_per_line</entry> 827 <entry>samples_per_line</entry>
828 <entry>2048</entry> 828 <entry>2048</entry>
829 </row> 829 </row>
830 <row> 830 <row>
831 <entry>sample_format</entry> 831 <entry>sample_format</entry>
832 <entry>V4L2_PIX_FMT_GREY. The last four bytes (a 832 <entry>V4L2_PIX_FMT_GREY. The last four bytes (a
833 machine endianess integer) contain a frame counter.</entry> 833 machine endianess integer) contain a frame counter.</entry>
834 </row> 834 </row>
835 <row> 835 <row>
836 <entry>start[]</entry> 836 <entry>start[]</entry>
837 <entry>10, 273 NTSC; 22, 335 PAL and SECAM</entry> 837 <entry>10, 273 NTSC; 22, 335 PAL and SECAM</entry>
838 </row> 838 </row>
839 <row> 839 <row>
840 <entry>count[]</entry> 840 <entry>count[]</entry>
841 <entry><para>16, 16<footnote><para>Old driver 841 <entry><para>16, 16<footnote><para>Old driver
842 versions used different values, eventually the custom 842 versions used different values, eventually the custom
843 <constant>BTTV_VBISIZE</constant> ioctl was added to query the 843 <constant>BTTV_VBISIZE</constant> ioctl was added to query the
844 correct values.</para></footnote></para></entry> 844 correct values.</para></footnote></para></entry>
845 </row> 845 </row>
846 <row> 846 <row>
847 <entry>flags</entry> 847 <entry>flags</entry>
848 <entry>0</entry> 848 <entry>0</entry>
849 </row> 849 </row>
850 </tbody> 850 </tbody>
851 </tgroup> 851 </tgroup>
852 </informaltable></para> 852 </informaltable></para>
853 853
854 <para>Undocumented in the V4L specification, in Linux 2.3 the 854 <para>Undocumented in the V4L specification, in Linux 2.3 the
855 <constant>VIDIOCGVBIFMT</constant> and 855 <constant>VIDIOCGVBIFMT</constant> and
856 <constant>VIDIOCSVBIFMT</constant> ioctls using struct 856 <constant>VIDIOCSVBIFMT</constant> ioctls using struct
857 <structname>vbi_format</structname> were added to determine the VBI 857 <structname>vbi_format</structname> were added to determine the VBI
858 image parameters. These ioctls are only partially compatible with the 858 image parameters. These ioctls are only partially compatible with the
859 V4L2 VBI interface specified in <xref linkend="raw-vbi" />.</para> 859 V4L2 VBI interface specified in <xref linkend="raw-vbi" />.</para>
860 860
861 <para>An <structfield>offset</structfield> field does not 861 <para>An <structfield>offset</structfield> field does not
862 exist, <structfield>sample_format</structfield> is supposed to be 862 exist, <structfield>sample_format</structfield> is supposed to be
863 <constant>VIDEO_PALETTE_RAW</constant>, equivalent to 863 <constant>VIDEO_PALETTE_RAW</constant>, equivalent to
864 <constant>V4L2_PIX_FMT_GREY</constant>. The remaining fields are 864 <constant>V4L2_PIX_FMT_GREY</constant>. The remaining fields are
865 probably equivalent to &v4l2-vbi-format;.</para> 865 probably equivalent to &v4l2-vbi-format;.</para>
866 866
867 <para>Apparently only the Zoran (ZR 36120) driver implements 867 <para>Apparently only the Zoran (ZR 36120) driver implements
868 these ioctls. The semantics differ from those specified for V4L2 in two 868 these ioctls. The semantics differ from those specified for V4L2 in two
869 ways. The parameters are reset on &func-open; and 869 ways. The parameters are reset on &func-open; and
870 <constant>VIDIOCSVBIFMT</constant> always returns an &EINVAL; if the 870 <constant>VIDIOCSVBIFMT</constant> always returns an &EINVAL; if the
871 parameters are invalid.</para> 871 parameters are invalid.</para>
872 </section> 872 </section>
873 873
874 <section> 874 <section>
875 <title>Miscellaneous</title> 875 <title>Miscellaneous</title>
876 876
877 <para>V4L2 has no equivalent of the 877 <para>V4L2 has no equivalent of the
878 <constant>VIDIOCGUNIT</constant> ioctl. Applications can find the VBI 878 <constant>VIDIOCGUNIT</constant> ioctl. Applications can find the VBI
879 device associated with a video capture device (or vice versa) by 879 device associated with a video capture device (or vice versa) by
880 reopening the device and requesting VBI data. For details see 880 reopening the device and requesting VBI data. For details see
881 <xref linkend="open" />.</para> 881 <xref linkend="open" />.</para>
882 882
883 <para>No replacement exists for <constant>VIDIOCKEY</constant>, 883 <para>No replacement exists for <constant>VIDIOCKEY</constant>,
884 and the V4L functions for microcode programming. A new interface for 884 and the V4L functions for microcode programming. A new interface for
885 MPEG compression and playback devices is documented in <xref 885 MPEG compression and playback devices is documented in <xref
886 linkend="extended-controls" />.</para> 886 linkend="extended-controls" />.</para>
887 </section> 887 </section>
888 888
889 </section> 889 </section>
890 890
891 <section id="hist-v4l2"> 891 <section id="hist-v4l2">
892 <title>Changes of the V4L2 API</title> 892 <title>Changes of the V4L2 API</title>
893 893
894 <para>Soon after the V4L API was added to the kernel it was 894 <para>Soon after the V4L API was added to the kernel it was
895 criticised as too inflexible. In August 1998 Bill Dirks proposed a 895 criticised as too inflexible. In August 1998 Bill Dirks proposed a
896 number of improvements and began to work on documentation, example 896 number of improvements and began to work on documentation, example
897 drivers and applications. With the help of other volunteers this 897 drivers and applications. With the help of other volunteers this
898 eventually became the V4L2 API, not just an extension but a 898 eventually became the V4L2 API, not just an extension but a
899 replacement for the V4L API. However it took another four years and 899 replacement for the V4L API. However it took another four years and
900 two stable kernel releases until the new API was finally accepted for 900 two stable kernel releases until the new API was finally accepted for
901 inclusion into the kernel in its present form.</para> 901 inclusion into the kernel in its present form.</para>
902 902
903 <section> 903 <section>
904 <title>Early Versions</title> 904 <title>Early Versions</title>
905 <para>1998-08-20: First version.</para> 905 <para>1998-08-20: First version.</para>
906 906
907 <para>1998-08-27: The &func-select; function was introduced.</para> 907 <para>1998-08-27: The &func-select; function was introduced.</para>
908 908
909 <para>1998-09-10: New video standard interface.</para> 909 <para>1998-09-10: New video standard interface.</para>
910 910
911 <para>1998-09-18: The <constant>VIDIOC_NONCAP</constant> ioctl 911 <para>1998-09-18: The <constant>VIDIOC_NONCAP</constant> ioctl
912 was replaced by the otherwise meaningless <constant>O_TRUNC</constant> 912 was replaced by the otherwise meaningless <constant>O_TRUNC</constant>
913 &func-open; flag, and the aliases <constant>O_NONCAP</constant> and 913 &func-open; flag, and the aliases <constant>O_NONCAP</constant> and
914 <constant>O_NOIO</constant> were defined. Applications can set this 914 <constant>O_NOIO</constant> were defined. Applications can set this
915 flag if they intend to access controls only, as opposed to capture 915 flag if they intend to access controls only, as opposed to capture
916 applications which need exclusive access. The 916 applications which need exclusive access. The
917 <constant>VIDEO_STD_XXX</constant> identifiers are now ordinals 917 <constant>VIDEO_STD_XXX</constant> identifiers are now ordinals
918 instead of flags, and the <function>video_std_construct()</function> 918 instead of flags, and the <function>video_std_construct()</function>
919 helper function takes id and transmission arguments.</para> 919 helper function takes id and transmission arguments.</para>
920 920
921 <para>1998-09-28: Revamped video standard. Made video controls 921 <para>1998-09-28: Revamped video standard. Made video controls
922 individually enumerable.</para> 922 individually enumerable.</para>
923 923
924 <para>1998-10-02: The <structfield>id</structfield> field was 924 <para>1998-10-02: The <structfield>id</structfield> field was
925 removed from struct <structname>video_standard</structname> and the 925 removed from struct <structname>video_standard</structname> and the
926 color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was 926 color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was
927 renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A 927 renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A
928 first draft of the Codec API was released.</para> 928 first draft of the Codec API was released.</para>
929 929
930 <para>1998-11-08: Many minor changes. Most symbols have been 930 <para>1998-11-08: Many minor changes. Most symbols have been
931 renamed. Some material changes to &v4l2-capability;.</para> 931 renamed. Some material changes to &v4l2-capability;.</para>
932 932
933 <para>1998-11-12: The read/write directon of some ioctls was misdefined.</para> 933 <para>1998-11-12: The read/write directon of some ioctls was misdefined.</para>
934 934
935 <para>1998-11-14: <constant>V4L2_PIX_FMT_RGB24</constant> 935 <para>1998-11-14: <constant>V4L2_PIX_FMT_RGB24</constant>
936 changed to <constant>V4L2_PIX_FMT_BGR24</constant>, and 936 changed to <constant>V4L2_PIX_FMT_BGR24</constant>, and
937 <constant>V4L2_PIX_FMT_RGB32</constant> changed to 937 <constant>V4L2_PIX_FMT_RGB32</constant> changed to
938 <constant>V4L2_PIX_FMT_BGR32</constant>. Audio controls are now 938 <constant>V4L2_PIX_FMT_BGR32</constant>. Audio controls are now
939 accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under 939 accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under
940 names starting with <constant>V4L2_CID_AUDIO</constant>. The 940 names starting with <constant>V4L2_CID_AUDIO</constant>. The
941 <constant>V4L2_MAJOR</constant> define was removed from 941 <constant>V4L2_MAJOR</constant> define was removed from
942 <filename>videodev.h</filename> since it was only used once in the 942 <filename>videodev.h</filename> since it was only used once in the
943 <filename>videodev</filename> kernel module. The 943 <filename>videodev</filename> kernel module. The
944 <constant>YUV422</constant> and <constant>YUV411</constant> planar 944 <constant>YUV422</constant> and <constant>YUV411</constant> planar
945 image formats were added.</para> 945 image formats were added.</para>
946 946
947 <para>1998-11-28: A few ioctl symbols changed. Interfaces for codecs and 947 <para>1998-11-28: A few ioctl symbols changed. Interfaces for codecs and
948 video output devices were added.</para> 948 video output devices were added.</para>
949 949
950 <para>1999-01-14: A raw VBI capture interface was added.</para> 950 <para>1999-01-14: A raw VBI capture interface was added.</para>
951 951
952 <para>1999-01-19: The <constant>VIDIOC_NEXTBUF</constant> ioctl 952 <para>1999-01-19: The <constant>VIDIOC_NEXTBUF</constant> ioctl
953 was removed.</para> 953 was removed.</para>
954 </section> 954 </section>
955 955
956 <section> 956 <section>
957 <title>V4L2 Version 0.16 1999-01-31</title> 957 <title>V4L2 Version 0.16 1999-01-31</title>
958 <para>1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF 958 <para>1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF
959 are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added 959 are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added
960 digital zoom (cropping) controls.</para> 960 digital zoom (cropping) controls.</para>
961 </section> 961 </section>
962 962
963 <!-- Where's 0.17? mhs couldn't find that videodev.h, perhaps Bill 963 <!-- Where's 0.17? mhs couldn't find that videodev.h, perhaps Bill
964 forgot to bump the version number or never released it. --> 964 forgot to bump the version number or never released it. -->
965 965
966 <section> 966 <section>
967 <title>V4L2 Version 0.18 1999-03-16</title> 967 <title>V4L2 Version 0.18 1999-03-16</title>
968 <para>Added a v4l to V4L2 ioctl compatibility layer to 968 <para>Added a v4l to V4L2 ioctl compatibility layer to
969 videodev.c. Driver writers, this changes how you implement your ioctl 969 videodev.c. Driver writers, this changes how you implement your ioctl
970 handler. See the Driver Writer's Guide. Added some more control id 970 handler. See the Driver Writer's Guide. Added some more control id
971 codes.</para> 971 codes.</para>
972 </section> 972 </section>
973 973
974 <section> 974 <section>
975 <title>V4L2 Version 0.19 1999-06-05</title> 975 <title>V4L2 Version 0.19 1999-06-05</title>
976 <para>1999-03-18: Fill in the category and catname fields of 976 <para>1999-03-18: Fill in the category and catname fields of
977 v4l2_queryctrl objects before passing them to the driver. Required a 977 v4l2_queryctrl objects before passing them to the driver. Required a
978 minor change to the VIDIOC_QUERYCTRL handlers in the sample 978 minor change to the VIDIOC_QUERYCTRL handlers in the sample
979 drivers.</para> 979 drivers.</para>
980 <para>1999-03-31: Better compatibility for v4l memory capture 980 <para>1999-03-31: Better compatibility for v4l memory capture
981 ioctls. Requires changes to drivers to fully support new compatibility 981 ioctls. Requires changes to drivers to fully support new compatibility
982 features, see Driver Writer's Guide and v4l2cap.c. Added new control 982 features, see Driver Writer's Guide and v4l2cap.c. Added new control
983 IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P, 983 IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P,
984 and _YUV411P to _YUV411P.</para> 984 and _YUV411P to _YUV411P.</para>
985 <para>1999-04-04: Added a few more control IDs.</para> 985 <para>1999-04-04: Added a few more control IDs.</para>
986 <para>1999-04-07: Added the button control type.</para> 986 <para>1999-04-07: Added the button control type.</para>
987 <para>1999-05-02: Fixed a typo in videodev.h, and added the 987 <para>1999-05-02: Fixed a typo in videodev.h, and added the
988 V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag.</para> 988 V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag.</para>
989 <para>1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing 989 <para>1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing
990 a malfunction of this ioctl.</para> 990 a malfunction of this ioctl.</para>
991 <para>1999-06-05: Changed the value of 991 <para>1999-06-05: Changed the value of
992 V4L2_CID_WHITENESS.</para> 992 V4L2_CID_WHITENESS.</para>
993 </section> 993 </section>
994 994
995 <section> 995 <section>
996 <title>V4L2 Version 0.20 (1999-09-10)</title> 996 <title>V4L2 Version 0.20 (1999-09-10)</title>
997 997
998 <para>Version 0.20 introduced a number of changes which were 998 <para>Version 0.20 introduced a number of changes which were
999 <emphasis>not backward compatible</emphasis> with 0.19 and earlier 999 <emphasis>not backward compatible</emphasis> with 0.19 and earlier
1000 versions. Purpose of these changes was to simplify the API, while 1000 versions. Purpose of these changes was to simplify the API, while
1001 making it more extensible and following common Linux driver API 1001 making it more extensible and following common Linux driver API
1002 conventions.</para> 1002 conventions.</para>
1003 1003
1004 <orderedlist> 1004 <orderedlist>
1005 <listitem> 1005 <listitem>
1006 <para>Some typos in <constant>V4L2_FMT_FLAG</constant> 1006 <para>Some typos in <constant>V4L2_FMT_FLAG</constant>
1007 symbols were fixed. &v4l2-clip; was changed for compatibility with 1007 symbols were fixed. &v4l2-clip; was changed for compatibility with
1008 v4l. (1999-08-30)</para> 1008 v4l. (1999-08-30)</para>
1009 </listitem> 1009 </listitem>
1010 1010
1011 <listitem> 1011 <listitem>
1012 <para><constant>V4L2_TUNER_SUB_LANG1</constant> was added. 1012 <para><constant>V4L2_TUNER_SUB_LANG1</constant> was added.
1013 (1999-09-05)</para> 1013 (1999-09-05)</para>
1014 </listitem> 1014 </listitem>
1015 1015
1016 <listitem> 1016 <listitem>
1017 <para>All ioctl() commands that used an integer argument now 1017 <para>All ioctl() commands that used an integer argument now
1018 take a pointer to an integer. Where it makes sense, ioctls will return 1018 take a pointer to an integer. Where it makes sense, ioctls will return
1019 the actual new value in the integer pointed to by the argument, a 1019 the actual new value in the integer pointed to by the argument, a
1020 common convention in the V4L2 API. The affected ioctls are: 1020 common convention in the V4L2 API. The affected ioctls are:
1021 VIDIOC_PREVIEW, VIDIOC_STREAMON, VIDIOC_STREAMOFF, VIDIOC_S_FREQ, 1021 VIDIOC_PREVIEW, VIDIOC_STREAMON, VIDIOC_STREAMOFF, VIDIOC_S_FREQ,
1022 VIDIOC_S_INPUT, VIDIOC_S_OUTPUT, VIDIOC_S_EFFECT. For example 1022 VIDIOC_S_INPUT, VIDIOC_S_OUTPUT, VIDIOC_S_EFFECT. For example
1023 <programlisting> 1023 <programlisting>
1024 err = ioctl (fd, VIDIOC_XXX, V4L2_XXX); 1024 err = ioctl (fd, VIDIOC_XXX, V4L2_XXX);
1025 </programlisting> becomes <programlisting> 1025 </programlisting> becomes <programlisting>
1026 int a = V4L2_XXX; err = ioctl(fd, VIDIOC_XXX, &amp;a); 1026 int a = V4L2_XXX; err = ioctl(fd, VIDIOC_XXX, &amp;a);
1027 </programlisting> 1027 </programlisting>
1028 </para> 1028 </para>
1029 </listitem> 1029 </listitem>
1030 1030
1031 <listitem> 1031 <listitem>
1032 <para>All the different get- and set-format commands were 1032 <para>All the different get- and set-format commands were
1033 swept into one &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctl taking a union 1033 swept into one &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctl taking a union
1034 and a type field selecting the union member as parameter. Purpose is to 1034 and a type field selecting the union member as parameter. Purpose is to
1035 simplify the API by eliminating several ioctls and to allow new and 1035 simplify the API by eliminating several ioctls and to allow new and
1036 driver private data streams without adding new ioctls.</para> 1036 driver private data streams without adding new ioctls.</para>
1037 1037
1038 <para>This change obsoletes the following ioctls: 1038 <para>This change obsoletes the following ioctls:
1039 <constant>VIDIOC_S_INFMT</constant>, 1039 <constant>VIDIOC_S_INFMT</constant>,
1040 <constant>VIDIOC_G_INFMT</constant>, 1040 <constant>VIDIOC_G_INFMT</constant>,
1041 <constant>VIDIOC_S_OUTFMT</constant>, 1041 <constant>VIDIOC_S_OUTFMT</constant>,
1042 <constant>VIDIOC_G_OUTFMT</constant>, 1042 <constant>VIDIOC_G_OUTFMT</constant>,
1043 <constant>VIDIOC_S_VBIFMT</constant> and 1043 <constant>VIDIOC_S_VBIFMT</constant> and
1044 <constant>VIDIOC_G_VBIFMT</constant>. The image format structure 1044 <constant>VIDIOC_G_VBIFMT</constant>. The image format structure
1045 <structname>v4l2_format</structname> was renamed to &v4l2-pix-format;, 1045 <structname>v4l2_format</structname> was renamed to &v4l2-pix-format;,
1046 while &v4l2-format; is now the envelopping structure for all format 1046 while &v4l2-format; is now the envelopping structure for all format
1047 negotiations.</para> 1047 negotiations.</para>
1048 </listitem> 1048 </listitem>
1049 1049
1050 <listitem> 1050 <listitem>
1051 <para>Similar to the changes above, the 1051 <para>Similar to the changes above, the
1052 <constant>VIDIOC_G_PARM</constant> and 1052 <constant>VIDIOC_G_PARM</constant> and
1053 <constant>VIDIOC_S_PARM</constant> ioctls were merged with 1053 <constant>VIDIOC_S_PARM</constant> ioctls were merged with
1054 <constant>VIDIOC_G_OUTPARM</constant> and 1054 <constant>VIDIOC_G_OUTPARM</constant> and
1055 <constant>VIDIOC_S_OUTPARM</constant>. A 1055 <constant>VIDIOC_S_OUTPARM</constant>. A
1056 <structfield>type</structfield> field in the new &v4l2-streamparm; 1056 <structfield>type</structfield> field in the new &v4l2-streamparm;
1057 selects the respective union member.</para> 1057 selects the respective union member.</para>
1058 1058
1059 <para>This change obsoletes the 1059 <para>This change obsoletes the
1060 <constant>VIDIOC_G_OUTPARM</constant> and 1060 <constant>VIDIOC_G_OUTPARM</constant> and
1061 <constant>VIDIOC_S_OUTPARM</constant> ioctls.</para> 1061 <constant>VIDIOC_S_OUTPARM</constant> ioctls.</para>
1062 </listitem> 1062 </listitem>
1063 1063
1064 <listitem> 1064 <listitem>
1065 <para>Control enumeration was simplified, and two new 1065 <para>Control enumeration was simplified, and two new
1066 control flags were introduced and one dropped. The 1066 control flags were introduced and one dropped. The
1067 <structfield>catname</structfield> field was replaced by a 1067 <structfield>catname</structfield> field was replaced by a
1068 <structfield>group</structfield> field.</para> 1068 <structfield>group</structfield> field.</para>
1069 1069
1070 <para>Drivers can now flag unsupported and temporarily 1070 <para>Drivers can now flag unsupported and temporarily
1071 unavailable controls with <constant>V4L2_CTRL_FLAG_DISABLED</constant> 1071 unavailable controls with <constant>V4L2_CTRL_FLAG_DISABLED</constant>
1072 and <constant>V4L2_CTRL_FLAG_GRABBED</constant> respectively. The 1072 and <constant>V4L2_CTRL_FLAG_GRABBED</constant> respectively. The
1073 <structfield>group</structfield> name indicates a possibly narrower 1073 <structfield>group</structfield> name indicates a possibly narrower
1074 classification than the <structfield>category</structfield>. In other 1074 classification than the <structfield>category</structfield>. In other
1075 words, there may be multiple groups within a category. Controls within 1075 words, there may be multiple groups within a category. Controls within
1076 a group would typically be drawn within a group box. Controls in 1076 a group would typically be drawn within a group box. Controls in
1077 different categories might have a greater separation, or may even 1077 different categories might have a greater separation, or may even
1078 appear in separate windows.</para> 1078 appear in separate windows.</para>
1079 </listitem> 1079 </listitem>
1080 1080
1081 <listitem> 1081 <listitem>
1082 <para>The &v4l2-buffer; <structfield>timestamp</structfield> 1082 <para>The &v4l2-buffer; <structfield>timestamp</structfield>
1083 was changed to a 64 bit integer, containing the sampling or output 1083 was changed to a 64 bit integer, containing the sampling or output
1084 time of the frame in nanoseconds. Additionally timestamps will be in 1084 time of the frame in nanoseconds. Additionally timestamps will be in
1085 absolute system time, not starting from zero at the beginning of a 1085 absolute system time, not starting from zero at the beginning of a
1086 stream. The data type name for timestamps is stamp_t, defined as a 1086 stream. The data type name for timestamps is stamp_t, defined as a
1087 signed 64-bit integer. Output devices should not send a buffer out 1087 signed 64-bit integer. Output devices should not send a buffer out
1088 until the time in the timestamp field has arrived. I would like to 1088 until the time in the timestamp field has arrived. I would like to
1089 follow SGI's lead, and adopt a multimedia timestamping system like 1089 follow SGI's lead, and adopt a multimedia timestamping system like
1090 their UST (Unadjusted System Time). See 1090 their UST (Unadjusted System Time). See
1091 http://web.archive.org/web/*/http://reality.sgi.com 1091 http://web.archive.org/web/*/http://reality.sgi.com
1092 /cpirazzi_engr/lg/time/intro.html. 1092 /cpirazzi_engr/lg/time/intro.html.
1093 UST uses timestamps that are 64-bit signed integers 1093 UST uses timestamps that are 64-bit signed integers
1094 (not struct timeval's) and given in nanosecond units. The UST clock 1094 (not struct timeval's) and given in nanosecond units. The UST clock
1095 starts at zero when the system is booted and runs continuously and 1095 starts at zero when the system is booted and runs continuously and
1096 uniformly. It takes a little over 292 years for UST to overflow. There 1096 uniformly. It takes a little over 292 years for UST to overflow. There
1097 is no way to set the UST clock. The regular Linux time-of-day clock 1097 is no way to set the UST clock. The regular Linux time-of-day clock
1098 can be changed periodically, which would cause errors if it were being 1098 can be changed periodically, which would cause errors if it were being
1099 used for timestamping a multimedia stream. A real UST style clock will 1099 used for timestamping a multimedia stream. A real UST style clock will
1100 require some support in the kernel that is not there yet. But in 1100 require some support in the kernel that is not there yet. But in
1101 anticipation, I will change the timestamp field to a 64-bit integer, 1101 anticipation, I will change the timestamp field to a 64-bit integer,
1102 and I will change the v4l2_masterclock_gettime() function (used only 1102 and I will change the v4l2_masterclock_gettime() function (used only
1103 by drivers) to return a 64-bit integer.</para> 1103 by drivers) to return a 64-bit integer.</para>
1104 </listitem> 1104 </listitem>
1105 1105
1106 <listitem> 1106 <listitem>
1107 <para>A <structfield>sequence</structfield> field was added 1107 <para>A <structfield>sequence</structfield> field was added
1108 to &v4l2-buffer;. The <structfield>sequence</structfield> field counts 1108 to &v4l2-buffer;. The <structfield>sequence</structfield> field counts
1109 captured frames, it is ignored by output devices. When a capture 1109 captured frames, it is ignored by output devices. When a capture
1110 driver drops a frame, the sequence number of that frame is 1110 driver drops a frame, the sequence number of that frame is
1111 skipped.</para> 1111 skipped.</para>
1112 </listitem> 1112 </listitem>
1113 </orderedlist> 1113 </orderedlist>
1114 </section> 1114 </section>
1115 1115
1116 <section> 1116 <section>
1117 <title>V4L2 Version 0.20 incremental changes</title> 1117 <title>V4L2 Version 0.20 incremental changes</title>
1118 <!-- Version number didn't change anymore, reason unknown. --> 1118 <!-- Version number didn't change anymore, reason unknown. -->
1119 1119
1120 <para>1999-12-23: In &v4l2-vbi-format; the 1120 <para>1999-12-23: In &v4l2-vbi-format; the
1121 <structfield>reserved1</structfield> field became 1121 <structfield>reserved1</structfield> field became
1122 <structfield>offset</structfield>. Previously drivers were required to 1122 <structfield>offset</structfield>. Previously drivers were required to
1123 clear the <structfield>reserved1</structfield> field.</para> 1123 clear the <structfield>reserved1</structfield> field.</para>
1124 1124
1125 <para>2000-01-13: The 1125 <para>2000-01-13: The
1126 <constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant> flag was added.</para> 1126 <constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant> flag was added.</para>
1127 1127
1128 <para>2000-07-31: The <filename>linux/poll.h</filename> header 1128 <para>2000-07-31: The <filename>linux/poll.h</filename> header
1129 is now included by <filename>videodev.h</filename> for compatibility 1129 is now included by <filename>videodev.h</filename> for compatibility
1130 with the original <filename>videodev.h</filename> file.</para> 1130 with the original <filename>videodev.h</filename> file.</para>
1131 1131
1132 <para>2000-11-20: <constant>V4L2_TYPE_VBI_OUTPUT</constant> and 1132 <para>2000-11-20: <constant>V4L2_TYPE_VBI_OUTPUT</constant> and
1133 <constant>V4L2_PIX_FMT_Y41P</constant> were added.</para> 1133 <constant>V4L2_PIX_FMT_Y41P</constant> were added.</para>
1134 1134
1135 <para>2000-11-25: <constant>V4L2_TYPE_VBI_INPUT</constant> was 1135 <para>2000-11-25: <constant>V4L2_TYPE_VBI_INPUT</constant> was
1136 added.</para> 1136 added.</para>
1137 1137
1138 <para>2000-12-04: A couple typos in symbol names were fixed.</para> 1138 <para>2000-12-04: A couple typos in symbol names were fixed.</para>
1139 1139
1140 <para>2001-01-18: To avoid namespace conflicts the 1140 <para>2001-01-18: To avoid namespace conflicts the
1141 <constant>fourcc</constant> macro defined in the 1141 <constant>fourcc</constant> macro defined in the
1142 <filename>videodev.h</filename> header file was renamed to 1142 <filename>videodev.h</filename> header file was renamed to
1143 <constant>v4l2_fourcc</constant>.</para> 1143 <constant>v4l2_fourcc</constant>.</para>
1144 1144
1145 <para>2001-01-25: A possible driver-level compatibility problem 1145 <para>2001-01-25: A possible driver-level compatibility problem
1146 between the <filename>videodev.h</filename> file in Linux 2.4.0 and 1146 between the <filename>videodev.h</filename> file in Linux 2.4.0 and
1147 the <filename>videodev.h</filename> file included in the 1147 the <filename>videodev.h</filename> file included in the
1148 <filename>videodevX</filename> patch was fixed. Users of an earlier 1148 <filename>videodevX</filename> patch was fixed. Users of an earlier
1149 version of <filename>videodevX</filename> on Linux 2.4.0 should 1149 version of <filename>videodevX</filename> on Linux 2.4.0 should
1150 recompile their V4L and V4L2 drivers.</para> 1150 recompile their V4L and V4L2 drivers.</para>
1151 1151
1152 <para>2001-01-26: A possible kernel-level incompatibility 1152 <para>2001-01-26: A possible kernel-level incompatibility
1153 between the <filename>videodev.h</filename> file in the 1153 between the <filename>videodev.h</filename> file in the
1154 <filename>videodevX</filename> patch and the 1154 <filename>videodevX</filename> patch and the
1155 <filename>videodev.h</filename> file in Linux 2.2.x with devfs patches 1155 <filename>videodev.h</filename> file in Linux 2.2.x with devfs patches
1156 applied was fixed.</para> 1156 applied was fixed.</para>
1157 1157
1158 <para>2001-03-02: Certain V4L ioctls which pass data in both 1158 <para>2001-03-02: Certain V4L ioctls which pass data in both
1159 direction although they are defined with read-only parameter, did not 1159 direction although they are defined with read-only parameter, did not
1160 work correctly through the backward compatibility layer. 1160 work correctly through the backward compatibility layer.
1161 [Solution?]</para> 1161 [Solution?]</para>
1162 1162
1163 <para>2001-04-13: Big endian 16-bit RGB formats were added.</para> 1163 <para>2001-04-13: Big endian 16-bit RGB formats were added.</para>
1164 1164
1165 <para>2001-09-17: New YUV formats and the &VIDIOC-G-FREQUENCY; and 1165 <para>2001-09-17: New YUV formats and the &VIDIOC-G-FREQUENCY; and
1166 &VIDIOC-S-FREQUENCY; ioctls were added. (The old 1166 &VIDIOC-S-FREQUENCY; ioctls were added. (The old
1167 <constant>VIDIOC_G_FREQ</constant> and 1167 <constant>VIDIOC_G_FREQ</constant> and
1168 <constant>VIDIOC_S_FREQ</constant> ioctls did not take multiple tuners 1168 <constant>VIDIOC_S_FREQ</constant> ioctls did not take multiple tuners
1169 into account.)</para> 1169 into account.)</para>
1170 1170
1171 <para>2000-09-18: <constant>V4L2_BUF_TYPE_VBI</constant> was 1171 <para>2000-09-18: <constant>V4L2_BUF_TYPE_VBI</constant> was
1172 added. This may <emphasis>break compatibility</emphasis> as the 1172 added. This may <emphasis>break compatibility</emphasis> as the
1173 &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls may fail now if the struct 1173 &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls may fail now if the struct
1174 <structname>v4l2_fmt</structname> <structfield>type</structfield> 1174 <structname>v4l2_fmt</structname> <structfield>type</structfield>
1175 field does not contain <constant>V4L2_BUF_TYPE_VBI</constant>. In the 1175 field does not contain <constant>V4L2_BUF_TYPE_VBI</constant>. In the
1176 documentation of the &v4l2-vbi-format; 1176 documentation of the &v4l2-vbi-format;
1177 <structfield>offset</structfield> field the ambiguous phrase "rising 1177 <structfield>offset</structfield> field the ambiguous phrase "rising
1178 edge" was changed to "leading edge".</para> 1178 edge" was changed to "leading edge".</para>
1179 </section> 1179 </section>
1180 1180
1181 <section> 1181 <section>
1182 <title>V4L2 Version 0.20 2000-11-23</title> 1182 <title>V4L2 Version 0.20 2000-11-23</title>
1183 1183
1184 <para>A number of changes were made to the raw VBI 1184 <para>A number of changes were made to the raw VBI
1185 interface.</para> 1185 interface.</para>
1186 1186
1187 <orderedlist> 1187 <orderedlist>
1188 <listitem> 1188 <listitem>
1189 <para>Figures clarifying the line numbering scheme were 1189 <para>Figures clarifying the line numbering scheme were
1190 added to the V4L2 API specification. The 1190 added to the V4L2 API specification. The
1191 <structfield>start</structfield>[0] and 1191 <structfield>start</structfield>[0] and
1192 <structfield>start</structfield>[1] fields no longer count line 1192 <structfield>start</structfield>[1] fields no longer count line
1193 numbers beginning at zero. Rationale: a) The previous definition was 1193 numbers beginning at zero. Rationale: a) The previous definition was
1194 unclear. b) The <structfield>start</structfield>[] values are ordinal 1194 unclear. b) The <structfield>start</structfield>[] values are ordinal
1195 numbers. c) There is no point in inventing a new line numbering 1195 numbers. c) There is no point in inventing a new line numbering
1196 scheme. We now use line number as defined by ITU-R, period. 1196 scheme. We now use line number as defined by ITU-R, period.
1197 Compatibility: Add one to the start values. Applications depending on 1197 Compatibility: Add one to the start values. Applications depending on
1198 the previous semantics may not function correctly.</para> 1198 the previous semantics may not function correctly.</para>
1199 </listitem> 1199 </listitem>
1200 1200
1201 <listitem> 1201 <listitem>
1202 <para>The restriction "count[0] &gt; 0 and count[1] &gt; 0" 1202 <para>The restriction "count[0] &gt; 0 and count[1] &gt; 0"
1203 has been relaxed to "(count[0] + count[1]) &gt; 0". Rationale: 1203 has been relaxed to "(count[0] + count[1]) &gt; 0". Rationale:
1204 Drivers may allocate resources at scan line granularity and some data 1204 Drivers may allocate resources at scan line granularity and some data
1205 services are transmitted only on the first field. The comment that 1205 services are transmitted only on the first field. The comment that
1206 both <structfield>count</structfield> values will usually be equal is 1206 both <structfield>count</structfield> values will usually be equal is
1207 misleading and pointless and has been removed. This change 1207 misleading and pointless and has been removed. This change
1208 <emphasis>breaks compatibility</emphasis> with earlier versions: 1208 <emphasis>breaks compatibility</emphasis> with earlier versions:
1209 Drivers may return EINVAL, applications may not function 1209 Drivers may return EINVAL, applications may not function
1210 correctly.</para> 1210 correctly.</para>
1211 </listitem> 1211 </listitem>
1212 1212
1213 <listitem> 1213 <listitem>
1214 <para>Drivers are again permitted to return negative 1214 <para>Drivers are again permitted to return negative
1215 (unknown) start values as proposed earlier. Why this feature was 1215 (unknown) start values as proposed earlier. Why this feature was
1216 dropped is unclear. This change may <emphasis>break 1216 dropped is unclear. This change may <emphasis>break
1217 compatibility</emphasis> with applications depending on the start 1217 compatibility</emphasis> with applications depending on the start
1218 values being positive. The use of <constant>EBUSY</constant> and 1218 values being positive. The use of <constant>EBUSY</constant> and
1219 <constant>EINVAL</constant> error codes with the &VIDIOC-S-FMT; ioctl 1219 <constant>EINVAL</constant> error codes with the &VIDIOC-S-FMT; ioctl
1220 was clarified. The &EBUSY; was finally documented, and the 1220 was clarified. The &EBUSY; was finally documented, and the
1221 <structfield>reserved2</structfield> field which was previously 1221 <structfield>reserved2</structfield> field which was previously
1222 mentioned only in the <filename>videodev.h</filename> header 1222 mentioned only in the <filename>videodev.h</filename> header
1223 file.</para> 1223 file.</para>
1224 </listitem> 1224 </listitem>
1225 1225
1226 <listitem> 1226 <listitem>
1227 <para>New buffer types 1227 <para>New buffer types
1228 <constant>V4L2_TYPE_VBI_INPUT</constant> and 1228 <constant>V4L2_TYPE_VBI_INPUT</constant> and
1229 <constant>V4L2_TYPE_VBI_OUTPUT</constant> were added. The former is an 1229 <constant>V4L2_TYPE_VBI_OUTPUT</constant> were added. The former is an
1230 alias for the old <constant>V4L2_TYPE_VBI</constant>, the latter was 1230 alias for the old <constant>V4L2_TYPE_VBI</constant>, the latter was
1231 missing in the <filename>videodev.h</filename> file.</para> 1231 missing in the <filename>videodev.h</filename> file.</para>
1232 </listitem> 1232 </listitem>
1233 </orderedlist> 1233 </orderedlist>
1234 </section> 1234 </section>
1235 1235
1236 <section> 1236 <section>
1237 <title>V4L2 Version 0.20 2002-07-25</title> 1237 <title>V4L2 Version 0.20 2002-07-25</title>
1238 <para>Added sliced VBI interface proposal.</para> 1238 <para>Added sliced VBI interface proposal.</para>
1239 </section> 1239 </section>
1240 1240
1241 <section> 1241 <section>
1242 <title>V4L2 in Linux 2.5.46, 2002-10</title> 1242 <title>V4L2 in Linux 2.5.46, 2002-10</title>
1243 1243
1244 <para>Around October-November 2002, prior to an announced 1244 <para>Around October-November 2002, prior to an announced
1245 feature freeze of Linux 2.5, the API was revised, drawing from 1245 feature freeze of Linux 2.5, the API was revised, drawing from
1246 experience with V4L2 0.20. This unnamed version was finally merged 1246 experience with V4L2 0.20. This unnamed version was finally merged
1247 into Linux 2.5.46.</para> 1247 into Linux 2.5.46.</para>
1248 1248
1249 <orderedlist> 1249 <orderedlist>
1250 <listitem> 1250 <listitem>
1251 <para>As specified in <xref linkend="related" />, drivers 1251 <para>As specified in <xref linkend="related" />, drivers
1252 must make related device functions available under all minor device 1252 must make related device functions available under all minor device
1253 numbers.</para> 1253 numbers.</para>
1254 </listitem> 1254 </listitem>
1255 1255
1256 <listitem> 1256 <listitem>
1257 <para>The &func-open; function requires access mode 1257 <para>The &func-open; function requires access mode
1258 <constant>O_RDWR</constant> regardless of the device type. All V4L2 1258 <constant>O_RDWR</constant> regardless of the device type. All V4L2
1259 drivers exchanging data with applications must support the 1259 drivers exchanging data with applications must support the
1260 <constant>O_NONBLOCK</constant> flag. The <constant>O_NOIO</constant> 1260 <constant>O_NONBLOCK</constant> flag. The <constant>O_NOIO</constant>
1261 flag, a V4L2 symbol which aliased the meaningless 1261 flag, a V4L2 symbol which aliased the meaningless
1262 <constant>O_TRUNC</constant> to indicate accesses without data 1262 <constant>O_TRUNC</constant> to indicate accesses without data
1263 exchange (panel applications) was dropped. Drivers must stay in "panel 1263 exchange (panel applications) was dropped. Drivers must stay in "panel
1264 mode" until the application attempts to initiate a data exchange, see 1264 mode" until the application attempts to initiate a data exchange, see
1265 <xref linkend="open" />.</para> 1265 <xref linkend="open" />.</para>
1266 </listitem> 1266 </listitem>
1267 1267
1268 <listitem> 1268 <listitem>
1269 <para>The &v4l2-capability; changed dramatically. Note that 1269 <para>The &v4l2-capability; changed dramatically. Note that
1270 also the size of the structure changed, which is encoded in the ioctl 1270 also the size of the structure changed, which is encoded in the ioctl
1271 request code, thus older V4L2 devices will respond with an &EINVAL; to 1271 request code, thus older V4L2 devices will respond with an &EINVAL; to
1272 the new &VIDIOC-QUERYCAP; ioctl.</para> 1272 the new &VIDIOC-QUERYCAP; ioctl.</para>
1273 1273
1274 <para>There are new fields to identify the driver, a new RDS 1274 <para>There are new fields to identify the driver, a new RDS
1275 device function <constant>V4L2_CAP_RDS_CAPTURE</constant>, the 1275 device function <constant>V4L2_CAP_RDS_CAPTURE</constant>, the
1276 <constant>V4L2_CAP_AUDIO</constant> flag indicates if the device has 1276 <constant>V4L2_CAP_AUDIO</constant> flag indicates if the device has
1277 any audio connectors, another I/O capability 1277 any audio connectors, another I/O capability
1278 <constant>V4L2_CAP_ASYNCIO</constant> can be flagged. In response to 1278 <constant>V4L2_CAP_ASYNCIO</constant> can be flagged. In response to
1279 these changes the <structfield>type</structfield> field became a bit 1279 these changes the <structfield>type</structfield> field became a bit
1280 set and was merged into the <structfield>flags</structfield> field. 1280 set and was merged into the <structfield>flags</structfield> field.
1281 <constant>V4L2_FLAG_TUNER</constant> was renamed to 1281 <constant>V4L2_FLAG_TUNER</constant> was renamed to
1282 <constant>V4L2_CAP_TUNER</constant>, 1282 <constant>V4L2_CAP_TUNER</constant>,
1283 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> replaced 1283 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> replaced
1284 <constant>V4L2_FLAG_PREVIEW</constant> and 1284 <constant>V4L2_FLAG_PREVIEW</constant> and
1285 <constant>V4L2_CAP_VBI_CAPTURE</constant> and 1285 <constant>V4L2_CAP_VBI_CAPTURE</constant> and
1286 <constant>V4L2_CAP_VBI_OUTPUT</constant> replaced 1286 <constant>V4L2_CAP_VBI_OUTPUT</constant> replaced
1287 <constant>V4L2_FLAG_DATA_SERVICE</constant>. 1287 <constant>V4L2_FLAG_DATA_SERVICE</constant>.
1288 <constant>V4L2_FLAG_READ</constant> and 1288 <constant>V4L2_FLAG_READ</constant> and
1289 <constant>V4L2_FLAG_WRITE</constant> were merged into 1289 <constant>V4L2_FLAG_WRITE</constant> were merged into
1290 <constant>V4L2_CAP_READWRITE</constant>.</para> 1290 <constant>V4L2_CAP_READWRITE</constant>.</para>
1291 1291
1292 <para>The redundant fields 1292 <para>The redundant fields
1293 <structfield>inputs</structfield>, <structfield>outputs</structfield> 1293 <structfield>inputs</structfield>, <structfield>outputs</structfield>
1294 and <structfield>audios</structfield> were removed. These properties 1294 and <structfield>audios</structfield> were removed. These properties
1295 can be determined as described in <xref linkend="video" /> and <xref 1295 can be determined as described in <xref linkend="video" /> and <xref
1296 linkend="audio" />.</para> 1296 linkend="audio" />.</para>
1297 1297
1298 <para>The somewhat volatile and therefore barely useful 1298 <para>The somewhat volatile and therefore barely useful
1299 fields <structfield>maxwidth</structfield>, 1299 fields <structfield>maxwidth</structfield>,
1300 <structfield>maxheight</structfield>, 1300 <structfield>maxheight</structfield>,
1301 <structfield>minwidth</structfield>, 1301 <structfield>minwidth</structfield>,
1302 <structfield>minheight</structfield>, 1302 <structfield>minheight</structfield>,
1303 <structfield>maxframerate</structfield> were removed. This information 1303 <structfield>maxframerate</structfield> were removed. This information
1304 is available as described in <xref linkend="format" /> and 1304 is available as described in <xref linkend="format" /> and
1305 <xref linkend="standard" />.</para> 1305 <xref linkend="standard" />.</para>
1306 1306
1307 <para><constant>V4L2_FLAG_SELECT</constant> was removed. We 1307 <para><constant>V4L2_FLAG_SELECT</constant> was removed. We
1308 believe the select() function is important enough to require support 1308 believe the select() function is important enough to require support
1309 of it in all V4L2 drivers exchanging data with applications. The 1309 of it in all V4L2 drivers exchanging data with applications. The
1310 redundant <constant>V4L2_FLAG_MONOCHROME</constant> flag was removed, 1310 redundant <constant>V4L2_FLAG_MONOCHROME</constant> flag was removed,
1311 this information is available as described in <xref 1311 this information is available as described in <xref
1312 linkend="format" />.</para> 1312 linkend="format" />.</para>
1313 </listitem> 1313 </listitem>
1314 1314
1315 <listitem> 1315 <listitem>
1316 <para>In &v4l2-input; the 1316 <para>In &v4l2-input; the
1317 <structfield>assoc_audio</structfield> field and the 1317 <structfield>assoc_audio</structfield> field and the
1318 <structfield>capability</structfield> field and its only flag 1318 <structfield>capability</structfield> field and its only flag
1319 <constant>V4L2_INPUT_CAP_AUDIO</constant> was replaced by the new 1319 <constant>V4L2_INPUT_CAP_AUDIO</constant> was replaced by the new
1320 <structfield>audioset</structfield> field. Instead of linking one 1320 <structfield>audioset</structfield> field. Instead of linking one
1321 video input to one audio input this field reports all audio inputs 1321 video input to one audio input this field reports all audio inputs
1322 this video input combines with.</para> 1322 this video input combines with.</para>
1323 1323
1324 <para>New fields are <structfield>tuner</structfield> 1324 <para>New fields are <structfield>tuner</structfield>
1325 (reversing the former link from tuners to video inputs), 1325 (reversing the former link from tuners to video inputs),
1326 <structfield>std</structfield> and 1326 <structfield>std</structfield> and
1327 <structfield>status</structfield>.</para> 1327 <structfield>status</structfield>.</para>
1328 1328
1329 <para>Accordingly &v4l2-output; lost its 1329 <para>Accordingly &v4l2-output; lost its
1330 <structfield>capability</structfield> and 1330 <structfield>capability</structfield> and
1331 <structfield>assoc_audio</structfield> fields. 1331 <structfield>assoc_audio</structfield> fields.
1332 <structfield>audioset</structfield>, 1332 <structfield>audioset</structfield>,
1333 <structfield>modulator</structfield> and 1333 <structfield>modulator</structfield> and
1334 <structfield>std</structfield> where added instead.</para> 1334 <structfield>std</structfield> where added instead.</para>
1335 </listitem> 1335 </listitem>
1336 1336
1337 <listitem> 1337 <listitem>
1338 <para>The &v4l2-audio; field 1338 <para>The &v4l2-audio; field
1339 <structfield>audio</structfield> was renamed to 1339 <structfield>audio</structfield> was renamed to
1340 <structfield>index</structfield>, for consistency with other 1340 <structfield>index</structfield>, for consistency with other
1341 structures. A new capability flag 1341 structures. A new capability flag
1342 <constant>V4L2_AUDCAP_STEREO</constant> was added to indicated if the 1342 <constant>V4L2_AUDCAP_STEREO</constant> was added to indicated if the
1343 audio input in question supports stereo sound. 1343 audio input in question supports stereo sound.
1344 <constant>V4L2_AUDCAP_EFFECTS</constant> and the corresponding 1344 <constant>V4L2_AUDCAP_EFFECTS</constant> and the corresponding
1345 <constant>V4L2_AUDMODE</constant> flags where removed. This can be 1345 <constant>V4L2_AUDMODE</constant> flags where removed. This can be
1346 easily implemented using controls. (However the same applies to AVL 1346 easily implemented using controls. (However the same applies to AVL
1347 which is still there.)</para> 1347 which is still there.)</para>
1348 1348
1349 <para>Again for consistency the &v4l2-audioout; field 1349 <para>Again for consistency the &v4l2-audioout; field
1350 <structfield>audio</structfield> was renamed to 1350 <structfield>audio</structfield> was renamed to
1351 <structfield>index</structfield>.</para> 1351 <structfield>index</structfield>.</para>
1352 </listitem> 1352 </listitem>
1353 1353
1354 <listitem> 1354 <listitem>
1355 <para>The &v4l2-tuner; 1355 <para>The &v4l2-tuner;
1356 <structfield>input</structfield> field was replaced by an 1356 <structfield>input</structfield> field was replaced by an
1357 <structfield>index</structfield> field, permitting devices with 1357 <structfield>index</structfield> field, permitting devices with
1358 multiple tuners. The link between video inputs and tuners is now 1358 multiple tuners. The link between video inputs and tuners is now
1359 reversed, inputs point to their tuner. The 1359 reversed, inputs point to their tuner. The
1360 <structfield>std</structfield> substructure became a 1360 <structfield>std</structfield> substructure became a
1361 simple set (more about this below) and moved into &v4l2-input;. A 1361 simple set (more about this below) and moved into &v4l2-input;. A
1362 <structfield>type</structfield> field was added.</para> 1362 <structfield>type</structfield> field was added.</para>
1363 1363
1364 <para>Accordingly in &v4l2-modulator; the 1364 <para>Accordingly in &v4l2-modulator; the
1365 <structfield>output</structfield> was replaced by an 1365 <structfield>output</structfield> was replaced by an
1366 <structfield>index</structfield> field.</para> 1366 <structfield>index</structfield> field.</para>
1367 1367
1368 <para>In &v4l2-frequency; the 1368 <para>In &v4l2-frequency; the
1369 <structfield>port</structfield> field was replaced by a 1369 <structfield>port</structfield> field was replaced by a
1370 <structfield>tuner</structfield> field containing the respective tuner 1370 <structfield>tuner</structfield> field containing the respective tuner
1371 or modulator index number. A tuner <structfield>type</structfield> 1371 or modulator index number. A tuner <structfield>type</structfield>
1372 field was added and the <structfield>reserved</structfield> field 1372 field was added and the <structfield>reserved</structfield> field
1373 became larger for future extensions (satellite tuners in 1373 became larger for future extensions (satellite tuners in
1374 particular).</para> 1374 particular).</para>
1375 </listitem> 1375 </listitem>
1376 1376
1377 <listitem> 1377 <listitem>
1378 <para>The idea of completely transparent video standards was 1378 <para>The idea of completely transparent video standards was
1379 dropped. Experience showed that applications must be able to work with 1379 dropped. Experience showed that applications must be able to work with
1380 video standards beyond presenting the user a menu. Instead of 1380 video standards beyond presenting the user a menu. Instead of
1381 enumerating supported standards with an ioctl applications can now 1381 enumerating supported standards with an ioctl applications can now
1382 refer to standards by &v4l2-std-id; and symbols defined in the 1382 refer to standards by &v4l2-std-id; and symbols defined in the
1383 <filename>videodev2.h</filename> header file. For details see <xref 1383 <filename>videodev2.h</filename> header file. For details see <xref
1384 linkend="standard" />. The &VIDIOC-G-STD; and 1384 linkend="standard" />. The &VIDIOC-G-STD; and
1385 &VIDIOC-S-STD; now take a pointer to this type as argument. 1385 &VIDIOC-S-STD; now take a pointer to this type as argument.
1386 &VIDIOC-QUERYSTD; was added to autodetect the received standard, if 1386 &VIDIOC-QUERYSTD; was added to autodetect the received standard, if
1387 the hardware has this capability. In &v4l2-standard; an 1387 the hardware has this capability. In &v4l2-standard; an
1388 <structfield>index</structfield> field was added for &VIDIOC-ENUMSTD;. 1388 <structfield>index</structfield> field was added for &VIDIOC-ENUMSTD;.
1389 A &v4l2-std-id; field named <structfield>id</structfield> was added as 1389 A &v4l2-std-id; field named <structfield>id</structfield> was added as
1390 machine readable identifier, also replacing the 1390 machine readable identifier, also replacing the
1391 <structfield>transmission</structfield> field. The misleading 1391 <structfield>transmission</structfield> field. The misleading
1392 <structfield>framerate</structfield> field was renamed 1392 <structfield>framerate</structfield> field was renamed
1393 to <structfield>frameperiod</structfield>. The now obsolete 1393 to <structfield>frameperiod</structfield>. The now obsolete
1394 <structfield>colorstandard</structfield> information, originally 1394 <structfield>colorstandard</structfield> information, originally
1395 needed to distguish between variations of standards, were 1395 needed to distguish between variations of standards, were
1396 removed.</para> 1396 removed.</para>
1397 1397
1398 <para>Struct <structname>v4l2_enumstd</structname> ceased to 1398 <para>Struct <structname>v4l2_enumstd</structname> ceased to
1399 be. &VIDIOC-ENUMSTD; now takes a pointer to a &v4l2-standard; 1399 be. &VIDIOC-ENUMSTD; now takes a pointer to a &v4l2-standard;
1400 directly. The information which standards are supported by a 1400 directly. The information which standards are supported by a
1401 particular video input or output moved into &v4l2-input; and 1401 particular video input or output moved into &v4l2-input; and
1402 &v4l2-output; fields named <structfield>std</structfield>, 1402 &v4l2-output; fields named <structfield>std</structfield>,
1403 respectively.</para> 1403 respectively.</para>
1404 </listitem> 1404 </listitem>
1405 1405
1406 <listitem> 1406 <listitem>
1407 <para>The &v4l2-queryctrl; fields 1407 <para>The &v4l2-queryctrl; fields
1408 <structfield>category</structfield> and 1408 <structfield>category</structfield> and
1409 <structfield>group</structfield> did not catch on and/or were not 1409 <structfield>group</structfield> did not catch on and/or were not
1410 implemented as expected and therefore removed.</para> 1410 implemented as expected and therefore removed.</para>
1411 </listitem> 1411 </listitem>
1412 1412
1413 <listitem> 1413 <listitem>
1414 <para>The &VIDIOC-TRY-FMT; ioctl was added to negotiate data 1414 <para>The &VIDIOC-TRY-FMT; ioctl was added to negotiate data
1415 formats as with &VIDIOC-S-FMT;, but without the overhead of 1415 formats as with &VIDIOC-S-FMT;, but without the overhead of
1416 programming the hardware and regardless of I/O in progress.</para> 1416 programming the hardware and regardless of I/O in progress.</para>
1417 1417
1418 <para>In &v4l2-format; the <structfield>fmt</structfield> 1418 <para>In &v4l2-format; the <structfield>fmt</structfield>
1419 union was extended to contain &v4l2-window;. All image format 1419 union was extended to contain &v4l2-window;. All image format
1420 negotiations are now possible with <constant>VIDIOC_G_FMT</constant>, 1420 negotiations are now possible with <constant>VIDIOC_G_FMT</constant>,
1421 <constant>VIDIOC_S_FMT</constant> and 1421 <constant>VIDIOC_S_FMT</constant> and
1422 <constant>VIDIOC_TRY_FMT</constant>; ioctl. The 1422 <constant>VIDIOC_TRY_FMT</constant>; ioctl. The
1423 <constant>VIDIOC_G_WIN</constant> and 1423 <constant>VIDIOC_G_WIN</constant> and
1424 <constant>VIDIOC_S_WIN</constant> ioctls to prepare for a video 1424 <constant>VIDIOC_S_WIN</constant> ioctls to prepare for a video
1425 overlay were removed. The <structfield>type</structfield> field 1425 overlay were removed. The <structfield>type</structfield> field
1426 changed to type &v4l2-buf-type; and the buffer type names changed as 1426 changed to type &v4l2-buf-type; and the buffer type names changed as
1427 follows.<informaltable> 1427 follows.<informaltable>
1428 <tgroup cols="2"> 1428 <tgroup cols="2">
1429 <thead> 1429 <thead>
1430 <row> 1430 <row>
1431 <entry>Old defines</entry> 1431 <entry>Old defines</entry>
1432 <entry>&v4l2-buf-type;</entry> 1432 <entry>&v4l2-buf-type;</entry>
1433 </row> 1433 </row>
1434 </thead> 1434 </thead>
1435 <tbody valign="top"> 1435 <tbody valign="top">
1436 <row> 1436 <row>
1437 <entry><constant>V4L2_BUF_TYPE_CAPTURE</constant></entry> 1437 <entry><constant>V4L2_BUF_TYPE_CAPTURE</constant></entry>
1438 <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry> 1438 <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry>
1439 </row> 1439 </row>
1440 <row> 1440 <row>
1441 <entry><constant>V4L2_BUF_TYPE_CODECIN</constant></entry> 1441 <entry><constant>V4L2_BUF_TYPE_CODECIN</constant></entry>
1442 <entry>Omitted for now</entry> 1442 <entry>Omitted for now</entry>
1443 </row> 1443 </row>
1444 <row> 1444 <row>
1445 <entry><constant>V4L2_BUF_TYPE_CODECOUT</constant></entry> 1445 <entry><constant>V4L2_BUF_TYPE_CODECOUT</constant></entry>
1446 <entry>Omitted for now</entry> 1446 <entry>Omitted for now</entry>
1447 </row> 1447 </row>
1448 <row> 1448 <row>
1449 <entry><constant>V4L2_BUF_TYPE_EFFECTSIN</constant></entry> 1449 <entry><constant>V4L2_BUF_TYPE_EFFECTSIN</constant></entry>
1450 <entry>Omitted for now</entry> 1450 <entry>Omitted for now</entry>
1451 </row> 1451 </row>
1452 <row> 1452 <row>
1453 <entry><constant>V4L2_BUF_TYPE_EFFECTSIN2</constant></entry> 1453 <entry><constant>V4L2_BUF_TYPE_EFFECTSIN2</constant></entry>
1454 <entry>Omitted for now</entry> 1454 <entry>Omitted for now</entry>
1455 </row> 1455 </row>
1456 <row> 1456 <row>
1457 <entry><constant>V4L2_BUF_TYPE_EFFECTSOUT</constant></entry> 1457 <entry><constant>V4L2_BUF_TYPE_EFFECTSOUT</constant></entry>
1458 <entry>Omitted for now</entry> 1458 <entry>Omitted for now</entry>
1459 </row> 1459 </row>
1460 <row> 1460 <row>
1461 <entry><constant>V4L2_BUF_TYPE_VIDEOOUT</constant></entry> 1461 <entry><constant>V4L2_BUF_TYPE_VIDEOOUT</constant></entry>
1462 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry> 1462 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry>
1463 </row> 1463 </row>
1464 <row> 1464 <row>
1465 <entry><constant>-</constant></entry> 1465 <entry><constant>-</constant></entry>
1466 <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry> 1466 <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry>
1467 </row> 1467 </row>
1468 <row> 1468 <row>
1469 <entry><constant>-</constant></entry> 1469 <entry><constant>-</constant></entry>
1470 <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry> 1470 <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry>
1471 </row> 1471 </row>
1472 <row> 1472 <row>
1473 <entry><constant>-</constant></entry> 1473 <entry><constant>-</constant></entry>
1474 <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry> 1474 <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry>
1475 </row> 1475 </row>
1476 <row> 1476 <row>
1477 <entry><constant>-</constant></entry> 1477 <entry><constant>-</constant></entry>
1478 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry> 1478 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry>
1479 </row> 1479 </row>
1480 <row> 1480 <row>
1481 <entry><constant>-</constant></entry> 1481 <entry><constant>-</constant></entry>
1482 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry> 1482 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry>
1483 </row> 1483 </row>
1484 <row> 1484 <row>
1485 <entry><constant>V4L2_BUF_TYPE_PRIVATE_BASE</constant></entry> 1485 <entry><constant>V4L2_BUF_TYPE_PRIVATE_BASE</constant></entry>
1486 <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry> 1486 <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry>
1487 </row> 1487 </row>
1488 </tbody> 1488 </tbody>
1489 </tgroup> 1489 </tgroup>
1490 </informaltable></para> 1490 </informaltable></para>
1491 </listitem> 1491 </listitem>
1492 1492
1493 <listitem> 1493 <listitem>
1494 <para>In &v4l2-fmtdesc; a &v4l2-buf-type; field named 1494 <para>In &v4l2-fmtdesc; a &v4l2-buf-type; field named
1495 <structfield>type</structfield> was added as in &v4l2-format;. The 1495 <structfield>type</structfield> was added as in &v4l2-format;. The
1496 <constant>VIDIOC_ENUM_FBUFFMT</constant> ioctl is no longer needed and 1496 <constant>VIDIOC_ENUM_FBUFFMT</constant> ioctl is no longer needed and
1497 was removed. These calls can be replaced by &VIDIOC-ENUM-FMT; with 1497 was removed. These calls can be replaced by &VIDIOC-ENUM-FMT; with
1498 type <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>.</para> 1498 type <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>.</para>
1499 </listitem> 1499 </listitem>
1500 1500
1501 <listitem> 1501 <listitem>
1502 <para>In &v4l2-pix-format; the 1502 <para>In &v4l2-pix-format; the
1503 <structfield>depth</structfield> field was removed, assuming 1503 <structfield>depth</structfield> field was removed, assuming
1504 applications which recognize the format by its four-character-code 1504 applications which recognize the format by its four-character-code
1505 already know the color depth, and others do not care about it. The 1505 already know the color depth, and others do not care about it. The
1506 same rationale lead to the removal of the 1506 same rationale lead to the removal of the
1507 <constant>V4L2_FMT_FLAG_COMPRESSED</constant> flag. The 1507 <constant>V4L2_FMT_FLAG_COMPRESSED</constant> flag. The
1508 <constant>V4L2_FMT_FLAG_SWCONVECOMPRESSED</constant> flag was removed 1508 <constant>V4L2_FMT_FLAG_SWCONVECOMPRESSED</constant> flag was removed
1509 because drivers are not supposed to convert images in kernel space. A 1509 because drivers are not supposed to convert images in kernel space. A
1510 user library of conversion functions should be provided instead. The 1510 user library of conversion functions should be provided instead. The
1511 <constant>V4L2_FMT_FLAG_BYTESPERLINE</constant> flag was redundant. 1511 <constant>V4L2_FMT_FLAG_BYTESPERLINE</constant> flag was redundant.
1512 Applications can set the <structfield>bytesperline</structfield> field 1512 Applications can set the <structfield>bytesperline</structfield> field
1513 to zero to get a reasonable default. Since the remaining flags were 1513 to zero to get a reasonable default. Since the remaining flags were
1514 replaced as well, the <structfield>flags</structfield> field itself 1514 replaced as well, the <structfield>flags</structfield> field itself
1515 was removed.</para> 1515 was removed.</para>
1516 <para>The interlace flags were replaced by a &v4l2-field; 1516 <para>The interlace flags were replaced by a &v4l2-field;
1517 value in a newly added <structfield>field</structfield> 1517 value in a newly added <structfield>field</structfield>
1518 field.<informaltable> 1518 field.<informaltable>
1519 <tgroup cols="2"> 1519 <tgroup cols="2">
1520 <thead> 1520 <thead>
1521 <row> 1521 <row>
1522 <entry>Old flag</entry> 1522 <entry>Old flag</entry>
1523 <entry>&v4l2-field;</entry> 1523 <entry>&v4l2-field;</entry>
1524 </row> 1524 </row>
1525 </thead> 1525 </thead>
1526 <tbody valign="top"> 1526 <tbody valign="top">
1527 <row> 1527 <row>
1528 <entry><constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant></entry> 1528 <entry><constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant></entry>
1529 <entry>?</entry> 1529 <entry>?</entry>
1530 </row> 1530 </row>
1531 <row> 1531 <row>
1532 <entry><constant>V4L2_FMT_FLAG_INTERLACED</constant> 1532 <entry><constant>V4L2_FMT_FLAG_INTERLACED</constant>
1533 = <constant>V4L2_FMT_FLAG_COMBINED</constant></entry> 1533 = <constant>V4L2_FMT_FLAG_COMBINED</constant></entry>
1534 <entry><constant>V4L2_FIELD_INTERLACED</constant></entry> 1534 <entry><constant>V4L2_FIELD_INTERLACED</constant></entry>
1535 </row> 1535 </row>
1536 <row> 1536 <row>
1537 <entry><constant>V4L2_FMT_FLAG_TOPFIELD</constant> 1537 <entry><constant>V4L2_FMT_FLAG_TOPFIELD</constant>
1538 = <constant>V4L2_FMT_FLAG_ODDFIELD</constant></entry> 1538 = <constant>V4L2_FMT_FLAG_ODDFIELD</constant></entry>
1539 <entry><constant>V4L2_FIELD_TOP</constant></entry> 1539 <entry><constant>V4L2_FIELD_TOP</constant></entry>
1540 </row> 1540 </row>
1541 <row> 1541 <row>
1542 <entry><constant>V4L2_FMT_FLAG_BOTFIELD</constant> 1542 <entry><constant>V4L2_FMT_FLAG_BOTFIELD</constant>
1543 = <constant>V4L2_FMT_FLAG_EVENFIELD</constant></entry> 1543 = <constant>V4L2_FMT_FLAG_EVENFIELD</constant></entry>
1544 <entry><constant>V4L2_FIELD_BOTTOM</constant></entry> 1544 <entry><constant>V4L2_FIELD_BOTTOM</constant></entry>
1545 </row> 1545 </row>
1546 <row> 1546 <row>
1547 <entry><constant>-</constant></entry> 1547 <entry><constant>-</constant></entry>
1548 <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry> 1548 <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry>
1549 </row> 1549 </row>
1550 <row> 1550 <row>
1551 <entry><constant>-</constant></entry> 1551 <entry><constant>-</constant></entry>
1552 <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry> 1552 <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry>
1553 </row> 1553 </row>
1554 <row> 1554 <row>
1555 <entry><constant>-</constant></entry> 1555 <entry><constant>-</constant></entry>
1556 <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry> 1556 <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry>
1557 </row> 1557 </row>
1558 </tbody> 1558 </tbody>
1559 </tgroup> 1559 </tgroup>
1560 </informaltable></para> 1560 </informaltable></para>
1561 1561
1562 <para>The color space flags were replaced by a 1562 <para>The color space flags were replaced by a
1563 &v4l2-colorspace; value in a newly added 1563 &v4l2-colorspace; value in a newly added
1564 <structfield>colorspace</structfield> field, where one of 1564 <structfield>colorspace</structfield> field, where one of
1565 <constant>V4L2_COLORSPACE_SMPTE170M</constant>, 1565 <constant>V4L2_COLORSPACE_SMPTE170M</constant>,
1566 <constant>V4L2_COLORSPACE_BT878</constant>, 1566 <constant>V4L2_COLORSPACE_BT878</constant>,
1567 <constant>V4L2_COLORSPACE_470_SYSTEM_M</constant> or 1567 <constant>V4L2_COLORSPACE_470_SYSTEM_M</constant> or
1568 <constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant> replaces 1568 <constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant> replaces
1569 <constant>V4L2_FMT_CS_601YUV</constant>.</para> 1569 <constant>V4L2_FMT_CS_601YUV</constant>.</para>
1570 </listitem> 1570 </listitem>
1571 1571
1572 <listitem> 1572 <listitem>
1573 <para>In &v4l2-requestbuffers; the 1573 <para>In &v4l2-requestbuffers; the
1574 <structfield>type</structfield> field was properly defined as 1574 <structfield>type</structfield> field was properly defined as
1575 &v4l2-buf-type;. Buffer types changed as mentioned above. A new 1575 &v4l2-buf-type;. Buffer types changed as mentioned above. A new
1576 <structfield>memory</structfield> field of type &v4l2-memory; was 1576 <structfield>memory</structfield> field of type &v4l2-memory; was
1577 added to distinguish between I/O methods using buffers allocated 1577 added to distinguish between I/O methods using buffers allocated
1578 by the driver or the application. See <xref linkend="io" /> for 1578 by the driver or the application. See <xref linkend="io" /> for
1579 details.</para> 1579 details.</para>
1580 </listitem> 1580 </listitem>
1581 1581
1582 <listitem> 1582 <listitem>
1583 <para>In &v4l2-buffer; the <structfield>type</structfield> 1583 <para>In &v4l2-buffer; the <structfield>type</structfield>
1584 field was properly defined as &v4l2-buf-type;. Buffer types changed as 1584 field was properly defined as &v4l2-buf-type;. Buffer types changed as
1585 mentioned above. A <structfield>field</structfield> field of type 1585 mentioned above. A <structfield>field</structfield> field of type
1586 &v4l2-field; was added to indicate if a buffer contains a top or 1586 &v4l2-field; was added to indicate if a buffer contains a top or
1587 bottom field. The old field flags were removed. Since no unadjusted 1587 bottom field. The old field flags were removed. Since no unadjusted
1588 system time clock was added to the kernel as planned, the 1588 system time clock was added to the kernel as planned, the
1589 <structfield>timestamp</structfield> field changed back from type 1589 <structfield>timestamp</structfield> field changed back from type
1590 stamp_t, an unsigned 64 bit integer expressing the sample time in 1590 stamp_t, an unsigned 64 bit integer expressing the sample time in
1591 nanoseconds, to struct <structname>timeval</structname>. With the 1591 nanoseconds, to struct <structname>timeval</structname>. With the
1592 addition of a second memory mapping method the 1592 addition of a second memory mapping method the
1593 <structfield>offset</structfield> field moved into union 1593 <structfield>offset</structfield> field moved into union
1594 <structfield>m</structfield>, and a new 1594 <structfield>m</structfield>, and a new
1595 <structfield>memory</structfield> field of type &v4l2-memory; was 1595 <structfield>memory</structfield> field of type &v4l2-memory; was
1596 added to distinguish between I/O methods. See <xref linkend="io" /> 1596 added to distinguish between I/O methods. See <xref linkend="io" />
1597 for details.</para> 1597 for details.</para>
1598 1598
1599 <para>The <constant>V4L2_BUF_REQ_CONTIG</constant> 1599 <para>The <constant>V4L2_BUF_REQ_CONTIG</constant>
1600 flag was used by the V4L compatibility layer, after changes to this 1600 flag was used by the V4L compatibility layer, after changes to this
1601 code it was no longer needed. The 1601 code it was no longer needed. The
1602 <constant>V4L2_BUF_ATTR_DEVICEMEM</constant> flag would indicate if 1602 <constant>V4L2_BUF_ATTR_DEVICEMEM</constant> flag would indicate if
1603 the buffer was indeed allocated in device memory rather than DMA-able 1603 the buffer was indeed allocated in device memory rather than DMA-able
1604 system memory. It was barely useful and so was removed.</para> 1604 system memory. It was barely useful and so was removed.</para>
1605 </listitem> 1605 </listitem>
1606 1606
1607 <listitem> 1607 <listitem>
1608 <para>In &v4l2-framebuffer; the 1608 <para>In &v4l2-framebuffer; the
1609 <structfield>base[3]</structfield> array anticipating double- and 1609 <structfield>base[3]</structfield> array anticipating double- and
1610 triple-buffering in off-screen video memory, however without defining 1610 triple-buffering in off-screen video memory, however without defining
1611 a synchronization mechanism, was replaced by a single pointer. The 1611 a synchronization mechanism, was replaced by a single pointer. The
1612 <constant>V4L2_FBUF_CAP_SCALEUP</constant> and 1612 <constant>V4L2_FBUF_CAP_SCALEUP</constant> and
1613 <constant>V4L2_FBUF_CAP_SCALEDOWN</constant> flags were removed. 1613 <constant>V4L2_FBUF_CAP_SCALEDOWN</constant> flags were removed.
1614 Applications can determine this capability more accurately using the 1614 Applications can determine this capability more accurately using the
1615 new cropping and scaling interface. The 1615 new cropping and scaling interface. The
1616 <constant>V4L2_FBUF_CAP_CLIPPING</constant> flag was replaced by 1616 <constant>V4L2_FBUF_CAP_CLIPPING</constant> flag was replaced by
1617 <constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant> and 1617 <constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant> and
1618 <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant>.</para> 1618 <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant>.</para>
1619 </listitem> 1619 </listitem>
1620 1620
1621 <listitem> 1621 <listitem>
1622 <para>In &v4l2-clip; the <structfield>x</structfield>, 1622 <para>In &v4l2-clip; the <structfield>x</structfield>,
1623 <structfield>y</structfield>, <structfield>width</structfield> and 1623 <structfield>y</structfield>, <structfield>width</structfield> and
1624 <structfield>height</structfield> field moved into a 1624 <structfield>height</structfield> field moved into a
1625 <structfield>c</structfield> substructure of type &v4l2-rect;. The 1625 <structfield>c</structfield> substructure of type &v4l2-rect;. The
1626 <structfield>x</structfield> and <structfield>y</structfield> fields 1626 <structfield>x</structfield> and <structfield>y</structfield> fields
1627 were renamed to <structfield>left</structfield> and 1627 were renamed to <structfield>left</structfield> and
1628 <structfield>top</structfield>, &ie; offsets to a context dependent 1628 <structfield>top</structfield>, &ie; offsets to a context dependent
1629 origin.</para> 1629 origin.</para>
1630 </listitem> 1630 </listitem>
1631 1631
1632 <listitem> 1632 <listitem>
1633 <para>In &v4l2-window; the <structfield>x</structfield>, 1633 <para>In &v4l2-window; the <structfield>x</structfield>,
1634 <structfield>y</structfield>, <structfield>width</structfield> and 1634 <structfield>y</structfield>, <structfield>width</structfield> and
1635 <structfield>height</structfield> field moved into a 1635 <structfield>height</structfield> field moved into a
1636 <structfield>w</structfield> substructure as above. A 1636 <structfield>w</structfield> substructure as above. A
1637 <structfield>field</structfield> field of type %v4l2-field; was added 1637 <structfield>field</structfield> field of type %v4l2-field; was added
1638 to distinguish between field and frame (interlaced) overlay.</para> 1638 to distinguish between field and frame (interlaced) overlay.</para>
1639 </listitem> 1639 </listitem>
1640 1640
1641 <listitem> 1641 <listitem>
1642 <para>The digital zoom interface, including struct 1642 <para>The digital zoom interface, including struct
1643 <structname>v4l2_zoomcap</structname>, struct 1643 <structname>v4l2_zoomcap</structname>, struct
1644 <structname>v4l2_zoom</structname>, 1644 <structname>v4l2_zoom</structname>,
1645 <constant>V4L2_ZOOM_NONCAP</constant> and 1645 <constant>V4L2_ZOOM_NONCAP</constant> and
1646 <constant>V4L2_ZOOM_WHILESTREAMING</constant> was replaced by a new 1646 <constant>V4L2_ZOOM_WHILESTREAMING</constant> was replaced by a new
1647 cropping and scaling interface. The previously unused struct 1647 cropping and scaling interface. The previously unused struct
1648 <structname>v4l2_cropcap</structname> and 1648 <structname>v4l2_cropcap</structname> and
1649 <structname>v4l2_crop</structname> where redefined for this purpose. 1649 <structname>v4l2_crop</structname> where redefined for this purpose.
1650 See <xref linkend="crop" /> for details.</para> 1650 See <xref linkend="crop" /> for details.</para>
1651 </listitem> 1651 </listitem>
1652 1652
1653 <listitem> 1653 <listitem>
1654 <para>In &v4l2-vbi-format; the 1654 <para>In &v4l2-vbi-format; the
1655 <structfield>SAMPLE_FORMAT</structfield> field now contains a 1655 <structfield>SAMPLE_FORMAT</structfield> field now contains a
1656 four-character-code as used to identify video image formats and 1656 four-character-code as used to identify video image formats and
1657 <constant>V4L2_PIX_FMT_GREY</constant> replaces the 1657 <constant>V4L2_PIX_FMT_GREY</constant> replaces the
1658 <constant>V4L2_VBI_SF_UBYTE</constant> define. The 1658 <constant>V4L2_VBI_SF_UBYTE</constant> define. The
1659 <structfield>reserved</structfield> field was extended.</para> 1659 <structfield>reserved</structfield> field was extended.</para>
1660 </listitem> 1660 </listitem>
1661 1661
1662 <listitem> 1662 <listitem>
1663 <para>In &v4l2-captureparm; the type of the 1663 <para>In &v4l2-captureparm; the type of the
1664 <structfield>timeperframe</structfield> field changed from unsigned 1664 <structfield>timeperframe</structfield> field changed from unsigned
1665 long to &v4l2-fract;. This allows the accurate expression of multiples 1665 long to &v4l2-fract;. This allows the accurate expression of multiples
1666 of the NTSC-M frame rate 30000 / 1001. A new field 1666 of the NTSC-M frame rate 30000 / 1001. A new field
1667 <structfield>readbuffers</structfield> was added to control the driver 1667 <structfield>readbuffers</structfield> was added to control the driver
1668 behaviour in read I/O mode.</para> 1668 behaviour in read I/O mode.</para>
1669 1669
1670 <para>Similar changes were made to &v4l2-outputparm;.</para> 1670 <para>Similar changes were made to &v4l2-outputparm;.</para>
1671 </listitem> 1671 </listitem>
1672 1672
1673 <listitem> 1673 <listitem>
1674 <para>The struct <structname>v4l2_performance</structname> 1674 <para>The struct <structname>v4l2_performance</structname>
1675 and <constant>VIDIOC_G_PERF</constant> ioctl were dropped. Except when 1675 and <constant>VIDIOC_G_PERF</constant> ioctl were dropped. Except when
1676 using the <link linkend="rw">read/write I/O method</link>, which is 1676 using the <link linkend="rw">read/write I/O method</link>, which is
1677 limited anyway, this information is already available to 1677 limited anyway, this information is already available to
1678 applications.</para> 1678 applications.</para>
1679 </listitem> 1679 </listitem>
1680 1680
1681 <listitem> 1681 <listitem>
1682 <para>The example transformation from RGB to YCbCr color 1682 <para>The example transformation from RGB to YCbCr color
1683 space in the old V4L2 documentation was inaccurate, this has been 1683 space in the old V4L2 documentation was inaccurate, this has been
1684 corrected in <xref linkend="pixfmt" />.<!-- 0.5670G should be 1684 corrected in <xref linkend="pixfmt" />.<!-- 0.5670G should be
1685 0.587, and 127/112 != 255/224 --></para> 1685 0.587, and 127/112 != 255/224 --></para>
1686 </listitem> 1686 </listitem>
1687 </orderedlist> 1687 </orderedlist>
1688 </section> 1688 </section>
1689 1689
1690 <section> 1690 <section>
1691 <title>V4L2 2003-06-19</title> 1691 <title>V4L2 2003-06-19</title>
1692 1692
1693 <orderedlist> 1693 <orderedlist>
1694 <listitem> 1694 <listitem>
1695 <para>A new capability flag 1695 <para>A new capability flag
1696 <constant>V4L2_CAP_RADIO</constant> was added for radio devices. Prior 1696 <constant>V4L2_CAP_RADIO</constant> was added for radio devices. Prior
1697 to this change radio devices would identify solely by having exactly one 1697 to this change radio devices would identify solely by having exactly one
1698 tuner whose type field reads <constant>V4L2_TUNER_RADIO</constant>.</para> 1698 tuner whose type field reads <constant>V4L2_TUNER_RADIO</constant>.</para>
1699 </listitem> 1699 </listitem>
1700 1700
1701 <listitem> 1701 <listitem>
1702 <para>An optional driver access priority mechanism was 1702 <para>An optional driver access priority mechanism was
1703 added, see <xref linkend="app-pri" /> for details.</para> 1703 added, see <xref linkend="app-pri" /> for details.</para>
1704 </listitem> 1704 </listitem>
1705 1705
1706 <listitem> 1706 <listitem>
1707 <para>The audio input and output interface was found to be 1707 <para>The audio input and output interface was found to be
1708 incomplete.</para> 1708 incomplete.</para>
1709 <para>Previously the &VIDIOC-G-AUDIO; 1709 <para>Previously the &VIDIOC-G-AUDIO;
1710 ioctl would enumerate the available audio inputs. An ioctl to 1710 ioctl would enumerate the available audio inputs. An ioctl to
1711 determine the current audio input, if more than one combines with the 1711 determine the current audio input, if more than one combines with the
1712 current video input, did not exist. So 1712 current video input, did not exist. So
1713 <constant>VIDIOC_G_AUDIO</constant> was renamed to 1713 <constant>VIDIOC_G_AUDIO</constant> was renamed to
1714 <constant>VIDIOC_G_AUDIO_OLD</constant>, this ioctl will be removed in 1714 <constant>VIDIOC_G_AUDIO_OLD</constant>, this ioctl will be removed in
1715 the future. The &VIDIOC-ENUMAUDIO; ioctl was added to enumerate 1715 the future. The &VIDIOC-ENUMAUDIO; ioctl was added to enumerate
1716 audio inputs, while &VIDIOC-G-AUDIO; now reports the current audio 1716 audio inputs, while &VIDIOC-G-AUDIO; now reports the current audio
1717 input.</para> 1717 input.</para>
1718 <para>The same changes were made to &VIDIOC-G-AUDOUT; and 1718 <para>The same changes were made to &VIDIOC-G-AUDOUT; and
1719 &VIDIOC-ENUMAUDOUT;.</para> 1719 &VIDIOC-ENUMAUDOUT;.</para>
1720 <para>Until further the "videodev" module will automatically 1720 <para>Until further the "videodev" module will automatically
1721 translate between the old and new ioctls, but drivers and applications 1721 translate between the old and new ioctls, but drivers and applications
1722 must be updated to successfully compile again.</para> 1722 must be updated to successfully compile again.</para>
1723 </listitem> 1723 </listitem>
1724 1724
1725 <listitem> 1725 <listitem>
1726 <para>The &VIDIOC-OVERLAY; ioctl was incorrectly defined with 1726 <para>The &VIDIOC-OVERLAY; ioctl was incorrectly defined with
1727 write-read parameter. It was changed to write-only, while the write-read 1727 write-read parameter. It was changed to write-only, while the write-read
1728 version was renamed to <constant>VIDIOC_OVERLAY_OLD</constant>. The old 1728 version was renamed to <constant>VIDIOC_OVERLAY_OLD</constant>. The old
1729 ioctl will be removed in the future. Until further the "videodev" 1729 ioctl will be removed in the future. Until further the "videodev"
1730 kernel module will automatically translate to the new version, so drivers 1730 kernel module will automatically translate to the new version, so drivers
1731 must be recompiled, but not applications.</para> 1731 must be recompiled, but not applications.</para>
1732 </listitem> 1732 </listitem>
1733 1733
1734 <listitem> 1734 <listitem>
1735 <para><xref linkend="overlay" /> incorrectly stated that 1735 <para><xref linkend="overlay" /> incorrectly stated that
1736 clipping rectangles define regions where the video can be seen. 1736 clipping rectangles define regions where the video can be seen.
1737 Correct is that clipping rectangles define regions where 1737 Correct is that clipping rectangles define regions where
1738 <emphasis>no</emphasis> video shall be displayed and so the graphics 1738 <emphasis>no</emphasis> video shall be displayed and so the graphics
1739 surface can be seen.</para> 1739 surface can be seen.</para>
1740 </listitem> 1740 </listitem>
1741 1741
1742 <listitem> 1742 <listitem>
1743 <para>The &VIDIOC-S-PARM; and &VIDIOC-S-CTRL; ioctls were 1743 <para>The &VIDIOC-S-PARM; and &VIDIOC-S-CTRL; ioctls were
1744 defined with write-only parameter, inconsistent with other ioctls 1744 defined with write-only parameter, inconsistent with other ioctls
1745 modifying their argument. They were changed to write-read, while a 1745 modifying their argument. They were changed to write-read, while a
1746 <constant>_OLD</constant> suffix was added to the write-only versions. 1746 <constant>_OLD</constant> suffix was added to the write-only versions.
1747 The old ioctls will be removed in the future. Drivers and 1747 The old ioctls will be removed in the future. Drivers and
1748 applications assuming a constant parameter need an update.</para> 1748 applications assuming a constant parameter need an update.</para>
1749 </listitem> 1749 </listitem>
1750 </orderedlist> 1750 </orderedlist>
1751 </section> 1751 </section>
1752 1752
1753 <section> 1753 <section>
1754 <title>V4L2 2003-11-05</title> 1754 <title>V4L2 2003-11-05</title>
1755 <orderedlist> 1755 <orderedlist>
1756 <listitem> 1756 <listitem>
1757 <para>In <xref linkend="pixfmt-rgb" /> the following pixel 1757 <para>In <xref linkend="pixfmt-rgb" /> the following pixel
1758 formats were incorrectly transferred from Bill Dirks' V4L2 1758 formats were incorrectly transferred from Bill Dirks' V4L2
1759 specification. Descriptions below refer to bytes in memory, in 1759 specification. Descriptions below refer to bytes in memory, in
1760 ascending address order.<informaltable> 1760 ascending address order.<informaltable>
1761 <tgroup cols="3"> 1761 <tgroup cols="3">
1762 <thead> 1762 <thead>
1763 <row> 1763 <row>
1764 <entry>Symbol</entry> 1764 <entry>Symbol</entry>
1765 <entry>In this document prior to revision 1765 <entry>In this document prior to revision
1766 0.5</entry> 1766 0.5</entry>
1767 <entry>Corrected</entry> 1767 <entry>Corrected</entry>
1768 </row> 1768 </row>
1769 </thead> 1769 </thead>
1770 <tbody valign="top"> 1770 <tbody valign="top">
1771 <row> 1771 <row>
1772 <entry><constant>V4L2_PIX_FMT_RGB24</constant></entry> 1772 <entry><constant>V4L2_PIX_FMT_RGB24</constant></entry>
1773 <entry>B, G, R</entry> 1773 <entry>B, G, R</entry>
1774 <entry>R, G, B</entry> 1774 <entry>R, G, B</entry>
1775 </row> 1775 </row>
1776 <row> 1776 <row>
1777 <entry><constant>V4L2_PIX_FMT_BGR24</constant></entry> 1777 <entry><constant>V4L2_PIX_FMT_BGR24</constant></entry>
1778 <entry>R, G, B</entry> 1778 <entry>R, G, B</entry>
1779 <entry>B, G, R</entry> 1779 <entry>B, G, R</entry>
1780 </row> 1780 </row>
1781 <row> 1781 <row>
1782 <entry><constant>V4L2_PIX_FMT_RGB32</constant></entry> 1782 <entry><constant>V4L2_PIX_FMT_RGB32</constant></entry>
1783 <entry>B, G, R, X</entry> 1783 <entry>B, G, R, X</entry>
1784 <entry>R, G, B, X</entry> 1784 <entry>R, G, B, X</entry>
1785 </row> 1785 </row>
1786 <row> 1786 <row>
1787 <entry><constant>V4L2_PIX_FMT_BGR32</constant></entry> 1787 <entry><constant>V4L2_PIX_FMT_BGR32</constant></entry>
1788 <entry>R, G, B, X</entry> 1788 <entry>R, G, B, X</entry>
1789 <entry>B, G, R, X</entry> 1789 <entry>B, G, R, X</entry>
1790 </row> 1790 </row>
1791 </tbody> 1791 </tbody>
1792 </tgroup> 1792 </tgroup>
1793 </informaltable> The 1793 </informaltable> The
1794 <constant>V4L2_PIX_FMT_BGR24</constant> example was always 1794 <constant>V4L2_PIX_FMT_BGR24</constant> example was always
1795 correct.</para> 1795 correct.</para>
1796 <para>In <xref linkend="v4l-image-properties" /> the mapping 1796 <para>In <xref linkend="v4l-image-properties" /> the mapping
1797 of the V4L <constant>VIDEO_PALETTE_RGB24</constant> and 1797 of the V4L <constant>VIDEO_PALETTE_RGB24</constant> and
1798 <constant>VIDEO_PALETTE_RGB32</constant> formats to V4L2 pixel formats 1798 <constant>VIDEO_PALETTE_RGB32</constant> formats to V4L2 pixel formats
1799 was accordingly corrected.</para> 1799 was accordingly corrected.</para>
1800 </listitem> 1800 </listitem>
1801 1801
1802 <listitem> 1802 <listitem>
1803 <para>Unrelated to the fixes above, drivers may still 1803 <para>Unrelated to the fixes above, drivers may still
1804 interpret some V4L2 RGB pixel formats differently. These issues have 1804 interpret some V4L2 RGB pixel formats differently. These issues have
1805 yet to be addressed, for details see <xref 1805 yet to be addressed, for details see <xref
1806 linkend="pixfmt-rgb" />.</para> 1806 linkend="pixfmt-rgb" />.</para>
1807 </listitem> 1807 </listitem>
1808 </orderedlist> 1808 </orderedlist>
1809 </section> 1809 </section>
1810 1810
1811 <section> 1811 <section>
1812 <title>V4L2 in Linux 2.6.6, 2004-05-09</title> 1812 <title>V4L2 in Linux 2.6.6, 2004-05-09</title>
1813 <orderedlist> 1813 <orderedlist>
1814 <listitem> 1814 <listitem>
1815 <para>The &VIDIOC-CROPCAP; ioctl was incorrectly defined 1815 <para>The &VIDIOC-CROPCAP; ioctl was incorrectly defined
1816 with read-only parameter. It is now defined as write-read ioctl, while 1816 with read-only parameter. It is now defined as write-read ioctl, while
1817 the read-only version was renamed to 1817 the read-only version was renamed to
1818 <constant>VIDIOC_CROPCAP_OLD</constant>. The old ioctl will be removed 1818 <constant>VIDIOC_CROPCAP_OLD</constant>. The old ioctl will be removed
1819 in the future.</para> 1819 in the future.</para>
1820 </listitem> 1820 </listitem>
1821 </orderedlist> 1821 </orderedlist>
1822 </section> 1822 </section>
1823 1823
1824 <section> 1824 <section>
1825 <title>V4L2 in Linux 2.6.8</title> 1825 <title>V4L2 in Linux 2.6.8</title>
1826 <orderedlist> 1826 <orderedlist>
1827 <listitem> 1827 <listitem>
1828 <para>A new field <structfield>input</structfield> (former 1828 <para>A new field <structfield>input</structfield> (former
1829 <structfield>reserved[0]</structfield>) was added to the &v4l2-buffer; 1829 <structfield>reserved[0]</structfield>) was added to the &v4l2-buffer;
1830 structure. Purpose of this field is to alternate between video inputs 1830 structure. Purpose of this field is to alternate between video inputs
1831 (&eg; cameras) in step with the video capturing process. This function 1831 (&eg; cameras) in step with the video capturing process. This function
1832 must be enabled with the new <constant>V4L2_BUF_FLAG_INPUT</constant> 1832 must be enabled with the new <constant>V4L2_BUF_FLAG_INPUT</constant>
1833 flag. The <structfield>flags</structfield> field is no longer 1833 flag. The <structfield>flags</structfield> field is no longer
1834 read-only.</para> 1834 read-only.</para>
1835 </listitem> 1835 </listitem>
1836 </orderedlist> 1836 </orderedlist>
1837 </section> 1837 </section>
1838 1838
1839 <section> 1839 <section>
1840 <title>V4L2 spec erratum 2004-08-01</title> 1840 <title>V4L2 spec erratum 2004-08-01</title>
1841 1841
1842 <orderedlist> 1842 <orderedlist>
1843 <listitem> 1843 <listitem>
1844 <para>The return value of the 1844 <para>The return value of the
1845 <xref linkend="func-open" /> function was incorrectly documented.</para> 1845 <xref linkend="func-open" /> function was incorrectly documented.</para>
1846 </listitem> 1846 </listitem>
1847 1847
1848 <listitem> 1848 <listitem>
1849 <para>Audio output ioctls end in -AUDOUT, not -AUDIOOUT.</para> 1849 <para>Audio output ioctls end in -AUDOUT, not -AUDIOOUT.</para>
1850 </listitem> 1850 </listitem>
1851 1851
1852 <listitem> 1852 <listitem>
1853 <para>In the Current Audio Input example the 1853 <para>In the Current Audio Input example the
1854 <constant>VIDIOC_G_AUDIO</constant> ioctl took the wrong 1854 <constant>VIDIOC_G_AUDIO</constant> ioctl took the wrong
1855 argument.</para> 1855 argument.</para>
1856 </listitem> 1856 </listitem>
1857 1857
1858 <listitem> 1858 <listitem>
1859 <para>The documentation of the &VIDIOC-QBUF; and 1859 <para>The documentation of the &VIDIOC-QBUF; and
1860 &VIDIOC-DQBUF; ioctls did not mention the &v4l2-buffer; 1860 &VIDIOC-DQBUF; ioctls did not mention the &v4l2-buffer;
1861 <structfield>memory</structfield> field. It was also missing from 1861 <structfield>memory</structfield> field. It was also missing from
1862 examples. Also on the <constant>VIDIOC_DQBUF</constant> page the &EIO; 1862 examples. Also on the <constant>VIDIOC_DQBUF</constant> page the &EIO;
1863 was not documented.</para> 1863 was not documented.</para>
1864 </listitem> 1864 </listitem>
1865 </orderedlist> 1865 </orderedlist>
1866 </section> 1866 </section>
1867 1867
1868 <section> 1868 <section>
1869 <title>V4L2 in Linux 2.6.14</title> 1869 <title>V4L2 in Linux 2.6.14</title>
1870 <orderedlist> 1870 <orderedlist>
1871 <listitem> 1871 <listitem>
1872 <para>A new sliced VBI interface was added. It is documented 1872 <para>A new sliced VBI interface was added. It is documented
1873 in <xref linkend="sliced" /> and replaces the interface first 1873 in <xref linkend="sliced" /> and replaces the interface first
1874 proposed in V4L2 specification 0.8.</para> 1874 proposed in V4L2 specification 0.8.</para>
1875 </listitem> 1875 </listitem>
1876 </orderedlist> 1876 </orderedlist>
1877 </section> 1877 </section>
1878 1878
1879 <section> 1879 <section>
1880 <title>V4L2 in Linux 2.6.15</title> 1880 <title>V4L2 in Linux 2.6.15</title>
1881 <orderedlist> 1881 <orderedlist>
1882 <listitem> 1882 <listitem>
1883 <para>The &VIDIOC-LOG-STATUS; ioctl was added.</para> 1883 <para>The &VIDIOC-LOG-STATUS; ioctl was added.</para>
1884 </listitem> 1884 </listitem>
1885 1885
1886 <listitem> 1886 <listitem>
1887 <para>New video standards 1887 <para>New video standards
1888 <constant>V4L2_STD_NTSC_443</constant>, 1888 <constant>V4L2_STD_NTSC_443</constant>,
1889 <constant>V4L2_STD_SECAM_LC</constant>, 1889 <constant>V4L2_STD_SECAM_LC</constant>,
1890 <constant>V4L2_STD_SECAM_DK</constant> (a set of SECAM D, K and K1), 1890 <constant>V4L2_STD_SECAM_DK</constant> (a set of SECAM D, K and K1),
1891 and <constant>V4L2_STD_ATSC</constant> (a set of 1891 and <constant>V4L2_STD_ATSC</constant> (a set of
1892 <constant>V4L2_STD_ATSC_8_VSB</constant> and 1892 <constant>V4L2_STD_ATSC_8_VSB</constant> and
1893 <constant>V4L2_STD_ATSC_16_VSB</constant>) were defined. Note the 1893 <constant>V4L2_STD_ATSC_16_VSB</constant>) were defined. Note the
1894 <constant>V4L2_STD_525_60</constant> set now includes 1894 <constant>V4L2_STD_525_60</constant> set now includes
1895 <constant>V4L2_STD_NTSC_443</constant>. See also <xref 1895 <constant>V4L2_STD_NTSC_443</constant>. See also <xref
1896 linkend="v4l2-std-id" />.</para> 1896 linkend="v4l2-std-id" />.</para>
1897 </listitem> 1897 </listitem>
1898 1898
1899 <listitem> 1899 <listitem>
1900 <para>The <constant>VIDIOC_G_COMP</constant> and 1900 <para>The <constant>VIDIOC_G_COMP</constant> and
1901 <constant>VIDIOC_S_COMP</constant> ioctl were renamed to 1901 <constant>VIDIOC_S_COMP</constant> ioctl were renamed to
1902 <constant>VIDIOC_G_MPEGCOMP</constant> and 1902 <constant>VIDIOC_G_MPEGCOMP</constant> and
1903 <constant>VIDIOC_S_MPEGCOMP</constant> respectively. Their argument 1903 <constant>VIDIOC_S_MPEGCOMP</constant> respectively. Their argument
1904 was replaced by a struct 1904 was replaced by a struct
1905 <structname>v4l2_mpeg_compression</structname> pointer. (The 1905 <structname>v4l2_mpeg_compression</structname> pointer. (The
1906 <constant>VIDIOC_G_MPEGCOMP</constant> and 1906 <constant>VIDIOC_G_MPEGCOMP</constant> and
1907 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls where removed in Linux 1907 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls where removed in Linux
1908 2.6.25.)</para> 1908 2.6.25.)</para>
1909 </listitem> 1909 </listitem>
1910 </orderedlist> 1910 </orderedlist>
1911 </section> 1911 </section>
1912 1912
1913 <section> 1913 <section>
1914 <title>V4L2 spec erratum 2005-11-27</title> 1914 <title>V4L2 spec erratum 2005-11-27</title>
1915 <para>The capture example in <xref linkend="capture-example" /> 1915 <para>The capture example in <xref linkend="capture-example" />
1916 called the &VIDIOC-S-CROP; ioctl without checking if cropping is 1916 called the &VIDIOC-S-CROP; ioctl without checking if cropping is
1917 supported. In the video standard selection example in 1917 supported. In the video standard selection example in
1918 <xref linkend="standard" /> the &VIDIOC-S-STD; call used the wrong 1918 <xref linkend="standard" /> the &VIDIOC-S-STD; call used the wrong
1919 argument type.</para> 1919 argument type.</para>
1920 </section> 1920 </section>
1921 1921
1922 <section> 1922 <section>
1923 <title>V4L2 spec erratum 2006-01-10</title> 1923 <title>V4L2 spec erratum 2006-01-10</title>
1924 <orderedlist> 1924 <orderedlist>
1925 <listitem> 1925 <listitem>
1926 <para>The <constant>V4L2_IN_ST_COLOR_KILL</constant> flag in 1926 <para>The <constant>V4L2_IN_ST_COLOR_KILL</constant> flag in
1927 &v4l2-input; not only indicates if the color killer is enabled, but 1927 &v4l2-input; not only indicates if the color killer is enabled, but
1928 also if it is active. (The color killer disables color decoding when 1928 also if it is active. (The color killer disables color decoding when
1929 it detects no color in the video signal to improve the image 1929 it detects no color in the video signal to improve the image
1930 quality.)</para> 1930 quality.)</para>
1931 </listitem> 1931 </listitem>
1932 1932
1933 <listitem> 1933 <listitem>
1934 <para>&VIDIOC-S-PARM; is a write-read ioctl, not write-only as 1934 <para>&VIDIOC-S-PARM; is a write-read ioctl, not write-only as
1935 stated on its reference page. The ioctl changed in 2003 as noted above.</para> 1935 stated on its reference page. The ioctl changed in 2003 as noted above.</para>
1936 </listitem> 1936 </listitem>
1937 </orderedlist> 1937 </orderedlist>
1938 </section> 1938 </section>
1939 1939
1940 <section> 1940 <section>
1941 <title>V4L2 spec erratum 2006-02-03</title> 1941 <title>V4L2 spec erratum 2006-02-03</title>
1942 <orderedlist> 1942 <orderedlist>
1943 <listitem> 1943 <listitem>
1944 <para>In &v4l2-captureparm; and &v4l2-outputparm; the 1944 <para>In &v4l2-captureparm; and &v4l2-outputparm; the
1945 <structfield>timeperframe</structfield> field gives the time in 1945 <structfield>timeperframe</structfield> field gives the time in
1946 seconds, not microseconds.</para> 1946 seconds, not microseconds.</para>
1947 </listitem> 1947 </listitem>
1948 </orderedlist> 1948 </orderedlist>
1949 </section> 1949 </section>
1950 1950
1951 <section> 1951 <section>
1952 <title>V4L2 spec erratum 2006-02-04</title> 1952 <title>V4L2 spec erratum 2006-02-04</title>
1953 <orderedlist> 1953 <orderedlist>
1954 <listitem> 1954 <listitem>
1955 <para>The <structfield>clips</structfield> field in 1955 <para>The <structfield>clips</structfield> field in
1956 &v4l2-window; must point to an array of &v4l2-clip;, not a linked 1956 &v4l2-window; must point to an array of &v4l2-clip;, not a linked
1957 list, because drivers ignore the struct 1957 list, because drivers ignore the struct
1958 <structname>v4l2_clip</structname>.<structfield>next</structfield> 1958 <structname>v4l2_clip</structname>.<structfield>next</structfield>
1959 pointer.</para> 1959 pointer.</para>
1960 </listitem> 1960 </listitem>
1961 </orderedlist> 1961 </orderedlist>
1962 </section> 1962 </section>
1963 1963
1964 <section> 1964 <section>
1965 <title>V4L2 in Linux 2.6.17</title> 1965 <title>V4L2 in Linux 2.6.17</title>
1966 <orderedlist> 1966 <orderedlist>
1967 <listitem> 1967 <listitem>
1968 <para>New video standard macros were added: 1968 <para>New video standard macros were added:
1969 <constant>V4L2_STD_NTSC_M_KR</constant> (NTSC M South Korea), and the 1969 <constant>V4L2_STD_NTSC_M_KR</constant> (NTSC M South Korea), and the
1970 sets <constant>V4L2_STD_MN</constant>, 1970 sets <constant>V4L2_STD_MN</constant>,
1971 <constant>V4L2_STD_B</constant>, <constant>V4L2_STD_GH</constant> and 1971 <constant>V4L2_STD_B</constant>, <constant>V4L2_STD_GH</constant> and
1972 <constant>V4L2_STD_DK</constant>. The 1972 <constant>V4L2_STD_DK</constant>. The
1973 <constant>V4L2_STD_NTSC</constant> and 1973 <constant>V4L2_STD_NTSC</constant> and
1974 <constant>V4L2_STD_SECAM</constant> sets now include 1974 <constant>V4L2_STD_SECAM</constant> sets now include
1975 <constant>V4L2_STD_NTSC_M_KR</constant> and 1975 <constant>V4L2_STD_NTSC_M_KR</constant> and
1976 <constant>V4L2_STD_SECAM_LC</constant> respectively.</para> 1976 <constant>V4L2_STD_SECAM_LC</constant> respectively.</para>
1977 </listitem> 1977 </listitem>
1978 1978
1979 <listitem> 1979 <listitem>
1980 <para>A new <constant>V4L2_TUNER_MODE_LANG1_LANG2</constant> 1980 <para>A new <constant>V4L2_TUNER_MODE_LANG1_LANG2</constant>
1981 was defined to record both languages of a bilingual program. The 1981 was defined to record both languages of a bilingual program. The
1982 use of <constant>V4L2_TUNER_MODE_STEREO</constant> for this purpose 1982 use of <constant>V4L2_TUNER_MODE_STEREO</constant> for this purpose
1983 is deprecated now. See the &VIDIOC-G-TUNER; section for 1983 is deprecated now. See the &VIDIOC-G-TUNER; section for
1984 details.</para> 1984 details.</para>
1985 </listitem> 1985 </listitem>
1986 </orderedlist> 1986 </orderedlist>
1987 </section> 1987 </section>
1988 1988
1989 <section> 1989 <section>
1990 <title>V4L2 spec erratum 2006-09-23 (Draft 0.15)</title> 1990 <title>V4L2 spec erratum 2006-09-23 (Draft 0.15)</title>
1991 <orderedlist> 1991 <orderedlist>
1992 <listitem> 1992 <listitem>
1993 <para>In various places 1993 <para>In various places
1994 <constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant> and 1994 <constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant> and
1995 <constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant> of the sliced VBI 1995 <constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant> of the sliced VBI
1996 interface were not mentioned along with other buffer types.</para> 1996 interface were not mentioned along with other buffer types.</para>
1997 </listitem> 1997 </listitem>
1998 1998
1999 <listitem> 1999 <listitem>
2000 <para>In <xref linkend="vidioc-g-audio" /> it was clarified 2000 <para>In <xref linkend="vidioc-g-audio" /> it was clarified
2001 that the &v4l2-audio; <structfield>mode</structfield> field is a flags 2001 that the &v4l2-audio; <structfield>mode</structfield> field is a flags
2002 field.</para> 2002 field.</para>
2003 </listitem> 2003 </listitem>
2004 2004
2005 <listitem> 2005 <listitem>
2006 <para><xref linkend="vidioc-querycap" /> did not mention the 2006 <para><xref linkend="vidioc-querycap" /> did not mention the
2007 sliced VBI and radio capability flags.</para> 2007 sliced VBI and radio capability flags.</para>
2008 </listitem> 2008 </listitem>
2009 2009
2010 <listitem> 2010 <listitem>
2011 <para>In <xref linkend="vidioc-g-frequency" /> it was 2011 <para>In <xref linkend="vidioc-g-frequency" /> it was
2012 clarified that applications must initialize the tuner 2012 clarified that applications must initialize the tuner
2013 <structfield>type</structfield> field of &v4l2-frequency; before 2013 <structfield>type</structfield> field of &v4l2-frequency; before
2014 calling &VIDIOC-S-FREQUENCY;.</para> 2014 calling &VIDIOC-S-FREQUENCY;.</para>
2015 </listitem> 2015 </listitem>
2016 2016
2017 <listitem> 2017 <listitem>
2018 <para>The <structfield>reserved</structfield> array 2018 <para>The <structfield>reserved</structfield> array
2019 in &v4l2-requestbuffers; has 2 elements, not 32.</para> 2019 in &v4l2-requestbuffers; has 2 elements, not 32.</para>
2020 </listitem> 2020 </listitem>
2021 2021
2022 <listitem> 2022 <listitem>
2023 <para>In <xref linkend="output" /> and <xref 2023 <para>In <xref linkend="output" /> and <xref
2024 linkend="raw-vbi" /> the device file names 2024 linkend="raw-vbi" /> the device file names
2025 <filename>/dev/vout</filename> which never caught on were replaced 2025 <filename>/dev/vout</filename> which never caught on were replaced
2026 by <filename>/dev/video</filename>.</para> 2026 by <filename>/dev/video</filename>.</para>
2027 </listitem> 2027 </listitem>
2028 2028
2029 <listitem> 2029 <listitem>
2030 <para>With Linux 2.6.15 the possible range for VBI device minor 2030 <para>With Linux 2.6.15 the possible range for VBI device minor
2031 numbers was extended from 224-239 to 224-255. Accordingly device file names 2031 numbers was extended from 224-239 to 224-255. Accordingly device file names
2032 <filename>/dev/vbi0</filename> to <filename>/dev/vbi31</filename> are 2032 <filename>/dev/vbi0</filename> to <filename>/dev/vbi31</filename> are
2033 possible now.</para> 2033 possible now.</para>
2034 </listitem> 2034 </listitem>
2035 </orderedlist> 2035 </orderedlist>
2036 </section> 2036 </section>
2037 2037
2038 <section> 2038 <section>
2039 <title>V4L2 in Linux 2.6.18</title> 2039 <title>V4L2 in Linux 2.6.18</title>
2040 <orderedlist> 2040 <orderedlist>
2041 <listitem> 2041 <listitem>
2042 <para>New ioctls &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; 2042 <para>New ioctls &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS;
2043 and &VIDIOC-TRY-EXT-CTRLS; were added, a flag to skip unsupported 2043 and &VIDIOC-TRY-EXT-CTRLS; were added, a flag to skip unsupported
2044 controls with &VIDIOC-QUERYCTRL;, new control types 2044 controls with &VIDIOC-QUERYCTRL;, new control types
2045 <constant>V4L2_CTRL_TYPE_INTEGER64</constant> and 2045 <constant>V4L2_CTRL_TYPE_INTEGER64</constant> and
2046 <constant>V4L2_CTRL_TYPE_CTRL_CLASS</constant> (<xref 2046 <constant>V4L2_CTRL_TYPE_CTRL_CLASS</constant> (<xref
2047 linkend="v4l2-ctrl-type" />), and new control flags 2047 linkend="v4l2-ctrl-type" />), and new control flags
2048 <constant>V4L2_CTRL_FLAG_READ_ONLY</constant>, 2048 <constant>V4L2_CTRL_FLAG_READ_ONLY</constant>,
2049 <constant>V4L2_CTRL_FLAG_UPDATE</constant>, 2049 <constant>V4L2_CTRL_FLAG_UPDATE</constant>,
2050 <constant>V4L2_CTRL_FLAG_INACTIVE</constant> and 2050 <constant>V4L2_CTRL_FLAG_INACTIVE</constant> and
2051 <constant>V4L2_CTRL_FLAG_SLIDER</constant> (<xref 2051 <constant>V4L2_CTRL_FLAG_SLIDER</constant> (<xref
2052 linkend="control-flags" />). See <xref 2052 linkend="control-flags" />). See <xref
2053 linkend="extended-controls" /> for details.</para> 2053 linkend="extended-controls" /> for details.</para>
2054 </listitem> 2054 </listitem>
2055 </orderedlist> 2055 </orderedlist>
2056 </section> 2056 </section>
2057 2057
2058 <section> 2058 <section>
2059 <title>V4L2 in Linux 2.6.19</title> 2059 <title>V4L2 in Linux 2.6.19</title>
2060 <orderedlist> 2060 <orderedlist>
2061 <listitem> 2061 <listitem>
2062 <para>In &v4l2-sliced-vbi-cap; a buffer type field was added 2062 <para>In &v4l2-sliced-vbi-cap; a buffer type field was added
2063 replacing a reserved field. Note on architectures where the size of 2063 replacing a reserved field. Note on architectures where the size of
2064 enum types differs from int types the size of the structure changed. 2064 enum types differs from int types the size of the structure changed.
2065 The &VIDIOC-G-SLICED-VBI-CAP; ioctl was redefined from being read-only 2065 The &VIDIOC-G-SLICED-VBI-CAP; ioctl was redefined from being read-only
2066 to write-read. Applications must initialize the type field and clear 2066 to write-read. Applications must initialize the type field and clear
2067 the reserved fields now. These changes may <emphasis>break the 2067 the reserved fields now. These changes may <emphasis>break the
2068 compatibility</emphasis> with older drivers and applications.</para> 2068 compatibility</emphasis> with older drivers and applications.</para>
2069 </listitem> 2069 </listitem>
2070 2070
2071 <listitem> 2071 <listitem>
2072 <para>The ioctls &VIDIOC-ENUM-FRAMESIZES; and 2072 <para>The ioctls &VIDIOC-ENUM-FRAMESIZES; and
2073 &VIDIOC-ENUM-FRAMEINTERVALS; were added.</para> 2073 &VIDIOC-ENUM-FRAMEINTERVALS; were added.</para>
2074 </listitem> 2074 </listitem>
2075 2075
2076 <listitem> 2076 <listitem>
2077 <para>A new pixel format <constant>V4L2_PIX_FMT_RGB444</constant> (<xref 2077 <para>A new pixel format <constant>V4L2_PIX_FMT_RGB444</constant> (<xref
2078 linkend="rgb-formats" />) was added.</para> 2078 linkend="rgb-formats" />) was added.</para>
2079 </listitem> 2079 </listitem>
2080 </orderedlist> 2080 </orderedlist>
2081 </section> 2081 </section>
2082 2082
2083 <section> 2083 <section>
2084 <title>V4L2 spec erratum 2006-10-12 (Draft 0.17)</title> 2084 <title>V4L2 spec erratum 2006-10-12 (Draft 0.17)</title>
2085 <orderedlist> 2085 <orderedlist>
2086 <listitem> 2086 <listitem>
2087 <para><constant>V4L2_PIX_FMT_HM12</constant> (<xref 2087 <para><constant>V4L2_PIX_FMT_HM12</constant> (<xref
2088 linkend="reserved-formats" />) is a YUV 4:2:0, not 4:2:2 format.</para> 2088 linkend="reserved-formats" />) is a YUV 4:2:0, not 4:2:2 format.</para>
2089 </listitem> 2089 </listitem>
2090 </orderedlist> 2090 </orderedlist>
2091 </section> 2091 </section>
2092 2092
2093 <section> 2093 <section>
2094 <title>V4L2 in Linux 2.6.21</title> 2094 <title>V4L2 in Linux 2.6.21</title>
2095 <orderedlist> 2095 <orderedlist>
2096 <listitem> 2096 <listitem>
2097 <para>The <filename>videodev2.h</filename> header file is 2097 <para>The <filename>videodev2.h</filename> header file is
2098 now dual licensed under GNU General Public License version two or 2098 now dual licensed under GNU General Public License version two or
2099 later, and under a 3-clause BSD-style license.</para> 2099 later, and under a 3-clause BSD-style license.</para>
2100 </listitem> 2100 </listitem>
2101 </orderedlist> 2101 </orderedlist>
2102 </section> 2102 </section>
2103 2103
2104 <section> 2104 <section>
2105 <title>V4L2 in Linux 2.6.22</title> 2105 <title>V4L2 in Linux 2.6.22</title>
2106 <orderedlist> 2106 <orderedlist>
2107 <listitem> 2107 <listitem>
2108 <para>Two new field orders 2108 <para>Two new field orders
2109 <constant>V4L2_FIELD_INTERLACED_TB</constant> and 2109 <constant>V4L2_FIELD_INTERLACED_TB</constant> and
2110 <constant>V4L2_FIELD_INTERLACED_BT</constant> were 2110 <constant>V4L2_FIELD_INTERLACED_BT</constant> were
2111 added. See <xref linkend="v4l2-field" /> for details.</para> 2111 added. See <xref linkend="v4l2-field" /> for details.</para>
2112 </listitem> 2112 </listitem>
2113 2113
2114 <listitem> 2114 <listitem>
2115 <para>Three new clipping/blending methods with a global or 2115 <para>Three new clipping/blending methods with a global or
2116 straight or inverted local alpha value were added to the video overlay 2116 straight or inverted local alpha value were added to the video overlay
2117 interface. See the description of the &VIDIOC-G-FBUF; and 2117 interface. See the description of the &VIDIOC-G-FBUF; and
2118 &VIDIOC-S-FBUF; ioctls for details.</para> 2118 &VIDIOC-S-FBUF; ioctls for details.</para>
2119 <para>A new <structfield>global_alpha</structfield> field 2119 <para>A new <structfield>global_alpha</structfield> field
2120 was added to <link 2120 was added to <link
2121 linkend="v4l2-window"><structname>v4l2_window</structname></link>, 2121 linkend="v4l2-window"><structname>v4l2_window</structname></link>,
2122 extending the structure. This may <emphasis>break 2122 extending the structure. This may <emphasis>break
2123 compatibility</emphasis> with applications using a struct 2123 compatibility</emphasis> with applications using a struct
2124 <structname>v4l2_window</structname> directly. However the <link 2124 <structname>v4l2_window</structname> directly. However the <link
2125 linkend="vidioc-g-fmt">VIDIOC_G/S/TRY_FMT</link> ioctls, which take a 2125 linkend="vidioc-g-fmt">VIDIOC_G/S/TRY_FMT</link> ioctls, which take a
2126 pointer to a <link linkend="v4l2-format">v4l2_format</link> parent 2126 pointer to a <link linkend="v4l2-format">v4l2_format</link> parent
2127 structure with padding bytes at the end, are not affected.</para> 2127 structure with padding bytes at the end, are not affected.</para>
2128 </listitem> 2128 </listitem>
2129 2129
2130 <listitem> 2130 <listitem>
2131 <para>The format of the <structfield>chromakey</structfield> 2131 <para>The format of the <structfield>chromakey</structfield>
2132 field in &v4l2-window; changed from "host order RGB32" to a pixel 2132 field in &v4l2-window; changed from "host order RGB32" to a pixel
2133 value in the same format as the framebuffer. This may <emphasis>break 2133 value in the same format as the framebuffer. This may <emphasis>break
2134 compatibility</emphasis> with existing applications. Drivers 2134 compatibility</emphasis> with existing applications. Drivers
2135 supporting the "host order RGB32" format are not known.</para> 2135 supporting the "host order RGB32" format are not known.</para>
2136 </listitem> 2136 </listitem>
2137 2137
2138 </orderedlist> 2138 </orderedlist>
2139 </section> 2139 </section>
2140 2140
2141 <section> 2141 <section>
2142 <title>V4L2 in Linux 2.6.24</title> 2142 <title>V4L2 in Linux 2.6.24</title>
2143 <orderedlist> 2143 <orderedlist>
2144 <listitem> 2144 <listitem>
2145 <para>The pixel formats 2145 <para>The pixel formats
2146 <constant>V4L2_PIX_FMT_PAL8</constant>, 2146 <constant>V4L2_PIX_FMT_PAL8</constant>,
2147 <constant>V4L2_PIX_FMT_YUV444</constant>, 2147 <constant>V4L2_PIX_FMT_YUV444</constant>,
2148 <constant>V4L2_PIX_FMT_YUV555</constant>, 2148 <constant>V4L2_PIX_FMT_YUV555</constant>,
2149 <constant>V4L2_PIX_FMT_YUV565</constant> and 2149 <constant>V4L2_PIX_FMT_YUV565</constant> and
2150 <constant>V4L2_PIX_FMT_YUV32</constant> were added.</para> 2150 <constant>V4L2_PIX_FMT_YUV32</constant> were added.</para>
2151 </listitem> 2151 </listitem>
2152 </orderedlist> 2152 </orderedlist>
2153 </section> 2153 </section>
2154 2154
2155 <section> 2155 <section>
2156 <title>V4L2 in Linux 2.6.25</title> 2156 <title>V4L2 in Linux 2.6.25</title>
2157 <orderedlist> 2157 <orderedlist>
2158 <listitem> 2158 <listitem>
2159 <para>The pixel formats <link linkend="V4L2-PIX-FMT-Y16"> 2159 <para>The pixel formats <link linkend="V4L2-PIX-FMT-Y16">
2160 <constant>V4L2_PIX_FMT_Y16</constant></link> and <link 2160 <constant>V4L2_PIX_FMT_Y16</constant></link> and <link
2161 linkend="V4L2-PIX-FMT-SBGGR16"> 2161 linkend="V4L2-PIX-FMT-SBGGR16">
2162 <constant>V4L2_PIX_FMT_SBGGR16</constant></link> were added.</para> 2162 <constant>V4L2_PIX_FMT_SBGGR16</constant></link> were added.</para>
2163 </listitem> 2163 </listitem>
2164 <listitem> 2164 <listitem>
2165 <para>New <link linkend="control">controls</link> 2165 <para>New <link linkend="control">controls</link>
2166 <constant>V4L2_CID_POWER_LINE_FREQUENCY</constant>, 2166 <constant>V4L2_CID_POWER_LINE_FREQUENCY</constant>,
2167 <constant>V4L2_CID_HUE_AUTO</constant>, 2167 <constant>V4L2_CID_HUE_AUTO</constant>,
2168 <constant>V4L2_CID_WHITE_BALANCE_TEMPERATURE</constant>, 2168 <constant>V4L2_CID_WHITE_BALANCE_TEMPERATURE</constant>,
2169 <constant>V4L2_CID_SHARPNESS</constant> and 2169 <constant>V4L2_CID_SHARPNESS</constant> and
2170 <constant>V4L2_CID_BACKLIGHT_COMPENSATION</constant> were added. The 2170 <constant>V4L2_CID_BACKLIGHT_COMPENSATION</constant> were added. The
2171 controls <constant>V4L2_CID_BLACK_LEVEL</constant>, 2171 controls <constant>V4L2_CID_BLACK_LEVEL</constant>,
2172 <constant>V4L2_CID_WHITENESS</constant>, 2172 <constant>V4L2_CID_WHITENESS</constant>,
2173 <constant>V4L2_CID_HCENTER</constant> and 2173 <constant>V4L2_CID_HCENTER</constant> and
2174 <constant>V4L2_CID_VCENTER</constant> were deprecated. 2174 <constant>V4L2_CID_VCENTER</constant> were deprecated.
2175 </para> 2175 </para>
2176 </listitem> 2176 </listitem>
2177 <listitem> 2177 <listitem>
2178 <para>A <link linkend="camera-controls">Camera controls 2178 <para>A <link linkend="camera-controls">Camera controls
2179 class</link> was added, with the new controls 2179 class</link> was added, with the new controls
2180 <constant>V4L2_CID_EXPOSURE_AUTO</constant>, 2180 <constant>V4L2_CID_EXPOSURE_AUTO</constant>,
2181 <constant>V4L2_CID_EXPOSURE_ABSOLUTE</constant>, 2181 <constant>V4L2_CID_EXPOSURE_ABSOLUTE</constant>,
2182 <constant>V4L2_CID_EXPOSURE_AUTO_PRIORITY</constant>, 2182 <constant>V4L2_CID_EXPOSURE_AUTO_PRIORITY</constant>,
2183 <constant>V4L2_CID_PAN_RELATIVE</constant>, 2183 <constant>V4L2_CID_PAN_RELATIVE</constant>,
2184 <constant>V4L2_CID_TILT_RELATIVE</constant>, 2184 <constant>V4L2_CID_TILT_RELATIVE</constant>,
2185 <constant>V4L2_CID_PAN_RESET</constant>, 2185 <constant>V4L2_CID_PAN_RESET</constant>,
2186 <constant>V4L2_CID_TILT_RESET</constant>, 2186 <constant>V4L2_CID_TILT_RESET</constant>,
2187 <constant>V4L2_CID_PAN_ABSOLUTE</constant>, 2187 <constant>V4L2_CID_PAN_ABSOLUTE</constant>,
2188 <constant>V4L2_CID_TILT_ABSOLUTE</constant>, 2188 <constant>V4L2_CID_TILT_ABSOLUTE</constant>,
2189 <constant>V4L2_CID_FOCUS_ABSOLUTE</constant>, 2189 <constant>V4L2_CID_FOCUS_ABSOLUTE</constant>,
2190 <constant>V4L2_CID_FOCUS_RELATIVE</constant> and 2190 <constant>V4L2_CID_FOCUS_RELATIVE</constant> and
2191 <constant>V4L2_CID_FOCUS_AUTO</constant>.</para> 2191 <constant>V4L2_CID_FOCUS_AUTO</constant>.</para>
2192 </listitem> 2192 </listitem>
2193 <listitem> 2193 <listitem>
2194 <para>The <constant>VIDIOC_G_MPEGCOMP</constant> and 2194 <para>The <constant>VIDIOC_G_MPEGCOMP</constant> and
2195 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls, which were superseded 2195 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls, which were superseded
2196 by the <link linkend="extended-controls">extended controls</link> 2196 by the <link linkend="extended-controls">extended controls</link>
2197 interface in Linux 2.6.18, where finally removed from the 2197 interface in Linux 2.6.18, where finally removed from the
2198 <filename>videodev2.h</filename> header file.</para> 2198 <filename>videodev2.h</filename> header file.</para>
2199 </listitem> 2199 </listitem>
2200 </orderedlist> 2200 </orderedlist>
2201 </section> 2201 </section>
2202 2202
2203 <section> 2203 <section>
2204 <title>V4L2 in Linux 2.6.26</title> 2204 <title>V4L2 in Linux 2.6.26</title>
2205 <orderedlist> 2205 <orderedlist>
2206 <listitem> 2206 <listitem>
2207 <para>The pixel formats 2207 <para>The pixel formats
2208 <constant>V4L2_PIX_FMT_Y16</constant> and 2208 <constant>V4L2_PIX_FMT_Y16</constant> and
2209 <constant>V4L2_PIX_FMT_SBGGR16</constant> were added.</para> 2209 <constant>V4L2_PIX_FMT_SBGGR16</constant> were added.</para>
2210 </listitem> 2210 </listitem>
2211 <listitem> 2211 <listitem>
2212 <para>Added user controls 2212 <para>Added user controls
2213 <constant>V4L2_CID_CHROMA_AGC</constant> and 2213 <constant>V4L2_CID_CHROMA_AGC</constant> and
2214 <constant>V4L2_CID_COLOR_KILLER</constant>.</para> 2214 <constant>V4L2_CID_COLOR_KILLER</constant>.</para>
2215 </listitem> 2215 </listitem>
2216 </orderedlist> 2216 </orderedlist>
2217 </section> 2217 </section>
2218 2218
2219 <section> 2219 <section>
2220 <title>V4L2 in Linux 2.6.27</title> 2220 <title>V4L2 in Linux 2.6.27</title>
2221 <orderedlist> 2221 <orderedlist>
2222 <listitem> 2222 <listitem>
2223 <para>The &VIDIOC-S-HW-FREQ-SEEK; ioctl and the 2223 <para>The &VIDIOC-S-HW-FREQ-SEEK; ioctl and the
2224 <constant>V4L2_CAP_HW_FREQ_SEEK</constant> capability were added.</para> 2224 <constant>V4L2_CAP_HW_FREQ_SEEK</constant> capability were added.</para>
2225 </listitem> 2225 </listitem>
2226 <listitem> 2226 <listitem>
2227 <para>The pixel formats 2227 <para>The pixel formats
2228 <constant>V4L2_PIX_FMT_YVYU</constant>, 2228 <constant>V4L2_PIX_FMT_YVYU</constant>,
2229 <constant>V4L2_PIX_FMT_PCA501</constant>, 2229 <constant>V4L2_PIX_FMT_PCA501</constant>,
2230 <constant>V4L2_PIX_FMT_PCA505</constant>, 2230 <constant>V4L2_PIX_FMT_PCA505</constant>,
2231 <constant>V4L2_PIX_FMT_PCA508</constant>, 2231 <constant>V4L2_PIX_FMT_PCA508</constant>,
2232 <constant>V4L2_PIX_FMT_PCA561</constant>, 2232 <constant>V4L2_PIX_FMT_PCA561</constant>,
2233 <constant>V4L2_PIX_FMT_SGBRG8</constant>, 2233 <constant>V4L2_PIX_FMT_SGBRG8</constant>,
2234 <constant>V4L2_PIX_FMT_PAC207</constant> and 2234 <constant>V4L2_PIX_FMT_PAC207</constant> and
2235 <constant>V4L2_PIX_FMT_PJPG</constant> were added.</para> 2235 <constant>V4L2_PIX_FMT_PJPG</constant> were added.</para>
2236 </listitem> 2236 </listitem>
2237 </orderedlist> 2237 </orderedlist>
2238 </section> 2238 </section>
2239 2239
2240 <section> 2240 <section>
2241 <title>V4L2 in Linux 2.6.28</title> 2241 <title>V4L2 in Linux 2.6.28</title>
2242 <orderedlist> 2242 <orderedlist>
2243 <listitem> 2243 <listitem>
2244 <para>Added <constant>V4L2_MPEG_AUDIO_ENCODING_AAC</constant> and 2244 <para>Added <constant>V4L2_MPEG_AUDIO_ENCODING_AAC</constant> and
2245 <constant>V4L2_MPEG_AUDIO_ENCODING_AC3</constant> MPEG audio encodings.</para> 2245 <constant>V4L2_MPEG_AUDIO_ENCODING_AC3</constant> MPEG audio encodings.</para>
2246 </listitem> 2246 </listitem>
2247 <listitem> 2247 <listitem>
2248 <para>Added <constant>V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC</constant> MPEG 2248 <para>Added <constant>V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC</constant> MPEG
2249 video encoding.</para> 2249 video encoding.</para>
2250 </listitem> 2250 </listitem>
2251 <listitem> 2251 <listitem>
2252 <para>The pixel formats 2252 <para>The pixel formats
2253 <constant>V4L2_PIX_FMT_SGRBG10</constant> and 2253 <constant>V4L2_PIX_FMT_SGRBG10</constant> and
2254 <constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant> were added.</para> 2254 <constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant> were added.</para>
2255 </listitem> 2255 </listitem>
2256 </orderedlist> 2256 </orderedlist>
2257 </section> 2257 </section>
2258 2258
2259 <section> 2259 <section>
2260 <title>V4L2 in Linux 2.6.29</title> 2260 <title>V4L2 in Linux 2.6.29</title>
2261 <orderedlist> 2261 <orderedlist>
2262 <listitem> 2262 <listitem>
2263 <para>The <constant>VIDIOC_G_CHIP_IDENT</constant> ioctl was renamed 2263 <para>The <constant>VIDIOC_G_CHIP_IDENT</constant> ioctl was renamed
2264 to <constant>VIDIOC_G_CHIP_IDENT_OLD</constant> and &VIDIOC-DBG-G-CHIP-IDENT; 2264 to <constant>VIDIOC_G_CHIP_IDENT_OLD</constant> and &VIDIOC-DBG-G-CHIP-IDENT;
2265 was introduced in its place. The old struct <structname>v4l2_chip_ident</structname> 2265 was introduced in its place. The old struct <structname>v4l2_chip_ident</structname>
2266 was renamed to <structname id="v4l2-chip-ident-old">v4l2_chip_ident_old</structname>.</para> 2266 was renamed to <structname id="v4l2-chip-ident-old">v4l2_chip_ident_old</structname>.</para>
2267 </listitem> 2267 </listitem>
2268 <listitem> 2268 <listitem>
2269 <para>The pixel formats 2269 <para>The pixel formats
2270 <constant>V4L2_PIX_FMT_VYUY</constant>, 2270 <constant>V4L2_PIX_FMT_VYUY</constant>,
2271 <constant>V4L2_PIX_FMT_NV16</constant> and 2271 <constant>V4L2_PIX_FMT_NV16</constant> and
2272 <constant>V4L2_PIX_FMT_NV61</constant> were added.</para> 2272 <constant>V4L2_PIX_FMT_NV61</constant> were added.</para>
2273 </listitem> 2273 </listitem>
2274 <listitem> 2274 <listitem>
2275 <para>Added camera controls 2275 <para>Added camera controls
2276 <constant>V4L2_CID_ZOOM_ABSOLUTE</constant>, 2276 <constant>V4L2_CID_ZOOM_ABSOLUTE</constant>,
2277 <constant>V4L2_CID_ZOOM_RELATIVE</constant>, 2277 <constant>V4L2_CID_ZOOM_RELATIVE</constant>,
2278 <constant>V4L2_CID_ZOOM_CONTINUOUS</constant> and 2278 <constant>V4L2_CID_ZOOM_CONTINUOUS</constant> and
2279 <constant>V4L2_CID_PRIVACY</constant>.</para> 2279 <constant>V4L2_CID_PRIVACY</constant>.</para>
2280 </listitem> 2280 </listitem>
2281 </orderedlist> 2281 </orderedlist>
2282 </section> 2282 </section>
2283 <section> 2283 <section>
2284 <title>V4L2 in Linux 2.6.30</title> 2284 <title>V4L2 in Linux 2.6.30</title>
2285 <orderedlist> 2285 <orderedlist>
2286 <listitem> 2286 <listitem>
2287 <para>New control flag <constant>V4L2_CTRL_FLAG_WRITE_ONLY</constant> was added.</para> 2287 <para>New control flag <constant>V4L2_CTRL_FLAG_WRITE_ONLY</constant> was added.</para>
2288 </listitem> 2288 </listitem>
2289 <listitem> 2289 <listitem>
2290 <para>New control <constant>V4L2_CID_COLORFX</constant> was added.</para> 2290 <para>New control <constant>V4L2_CID_COLORFX</constant> was added.</para>
2291 </listitem> 2291 </listitem>
2292 </orderedlist> 2292 </orderedlist>
2293 </section> 2293 </section>
2294 <section> 2294 <section>
2295 <title>V4L2 in Linux 2.6.32</title> 2295 <title>V4L2 in Linux 2.6.32</title>
2296 <orderedlist> 2296 <orderedlist>
2297 <listitem> 2297 <listitem>
2298 <para>In order to be easier to compare a V4L2 API and a kernel 2298 <para>In order to be easier to compare a V4L2 API and a kernel
2299 version, now V4L2 API is numbered using the Linux Kernel version numeration.</para> 2299 version, now V4L2 API is numbered using the Linux Kernel version numeration.</para>
2300 </listitem> 2300 </listitem>
2301 <listitem> 2301 <listitem>
2302 <para>Finalized the RDS capture API. See <xref linkend="rds" /> for 2302 <para>Finalized the RDS capture API. See <xref linkend="rds" /> for
2303 more information.</para> 2303 more information.</para>
2304 </listitem> 2304 </listitem>
2305 <listitem> 2305 <listitem>
2306 <para>Added new capabilities for modulators and RDS encoders.</para> 2306 <para>Added new capabilities for modulators and RDS encoders.</para>
2307 </listitem> 2307 </listitem>
2308 <listitem> 2308 <listitem>
2309 <para>Add description for libv4l API.</para> 2309 <para>Add description for libv4l API.</para>
2310 </listitem> 2310 </listitem>
2311 <listitem> 2311 <listitem>
2312 <para>Added support for string controls via new type <constant>V4L2_CTRL_TYPE_STRING</constant>.</para> 2312 <para>Added support for string controls via new type <constant>V4L2_CTRL_TYPE_STRING</constant>.</para>
2313 </listitem> 2313 </listitem>
2314 <listitem> 2314 <listitem>
2315 <para>Added <constant>V4L2_CID_BAND_STOP_FILTER</constant> documentation.</para> 2315 <para>Added <constant>V4L2_CID_BAND_STOP_FILTER</constant> documentation.</para>
2316 </listitem> 2316 </listitem>
2317 <listitem> 2317 <listitem>
2318 <para>Added FM Modulator (FM TX) Extended Control Class: <constant>V4L2_CTRL_CLASS_FM_TX</constant> and their Control IDs.</para> 2318 <para>Added FM Modulator (FM TX) Extended Control Class: <constant>V4L2_CTRL_CLASS_FM_TX</constant> and their Control IDs.</para>
2319 </listitem> 2319 </listitem>
2320 <listitem> 2320 <listitem>
2321 <para>Added Remote Controller chapter, describing the default Remote Controller mapping for media devices.</para> 2321 <para>Added Remote Controller chapter, describing the default Remote Controller mapping for media devices.</para>
2322 </listitem> 2322 </listitem>
2323 </orderedlist> 2323 </orderedlist>
2324 </section> 2324 </section>
2325 <section> 2325 <section>
2326 <title>V4L2 in Linux 2.6.33</title> 2326 <title>V4L2 in Linux 2.6.33</title>
2327 <orderedlist> 2327 <orderedlist>
2328 <listitem> 2328 <listitem>
2329 <para>Added support for Digital Video timings in order to support HDTV receivers and transmitters.</para> 2329 <para>Added support for Digital Video timings in order to support HDTV receivers and transmitters.</para>
2330 </listitem> 2330 </listitem>
2331 </orderedlist> 2331 </orderedlist>
2332 </section> 2332 </section>
2333 <section> 2333 <section>
2334 <title>V4L2 in Linux 2.6.34</title> 2334 <title>V4L2 in Linux 2.6.34</title>
2335 <orderedlist> 2335 <orderedlist>
2336 <listitem> 2336 <listitem>
2337 <para>Added 2337 <para>Added
2338 <constant>V4L2_CID_IRIS_ABSOLUTE</constant> and 2338 <constant>V4L2_CID_IRIS_ABSOLUTE</constant> and
2339 <constant>V4L2_CID_IRIS_RELATIVE</constant> controls to the 2339 <constant>V4L2_CID_IRIS_RELATIVE</constant> controls to the
2340 <link linkend="camera-controls">Camera controls class</link>. 2340 <link linkend="camera-controls">Camera controls class</link>.
2341 </para> 2341 </para>
2342 </listitem> 2342 </listitem>
2343 </orderedlist> 2343 </orderedlist>
2344 </section> 2344 </section>
2345 <section> 2345 <section>
2346 <title>V4L2 in Linux 2.6.37</title> 2346 <title>V4L2 in Linux 2.6.37</title>
2347 <orderedlist> 2347 <orderedlist>
2348 <listitem> 2348 <listitem>
2349 <para>Remove the vtx (videotext/teletext) API. This API was no longer 2349 <para>Remove the vtx (videotext/teletext) API. This API was no longer
2350 used and no hardware exists to verify the API. Nor were any userspace applications found 2350 used and no hardware exists to verify the API. Nor were any userspace applications found
2351 that used it. It was originally scheduled for removal in 2.6.35. 2351 that used it. It was originally scheduled for removal in 2.6.35.
2352 </para> 2352 </para>
2353 </listitem> 2353 </listitem>
2354 </orderedlist> 2354 </orderedlist>
2355 </section> 2355 </section>
2356 <section>
2357 <title>V4L2 in Linux 2.6.38</title>
2358 <orderedlist>
2359 <listitem>
2360 <para>Multi-planar API added. Does not affect the compatibility of
2361 current drivers and applications. See
2362 <link linkend="planar-apis">multi-planar API</link>
2363 for details.</para>
2364 </listitem>
2365 </orderedlist>
2366 </section>
2356 2367
2357 <section id="other"> 2368 <section id="other">
2358 <title>Relation of V4L2 to other Linux multimedia APIs</title> 2369 <title>Relation of V4L2 to other Linux multimedia APIs</title>
2359 2370
2360 <section id="xvideo"> 2371 <section id="xvideo">
2361 <title>X Video Extension</title> 2372 <title>X Video Extension</title>
2362 2373
2363 <para>The X Video Extension (abbreviated XVideo or just Xv) is 2374 <para>The X Video Extension (abbreviated XVideo or just Xv) is
2364 an extension of the X Window system, implemented for example by the 2375 an extension of the X Window system, implemented for example by the
2365 XFree86 project. Its scope is similar to V4L2, an API to video capture 2376 XFree86 project. Its scope is similar to V4L2, an API to video capture
2366 and output devices for X clients. Xv allows applications to display 2377 and output devices for X clients. Xv allows applications to display
2367 live video in a window, send window contents to a TV output, and 2378 live video in a window, send window contents to a TV output, and
2368 capture or output still images in XPixmaps<footnote> 2379 capture or output still images in XPixmaps<footnote>
2369 <para>This is not implemented in XFree86.</para> 2380 <para>This is not implemented in XFree86.</para>
2370 </footnote>. With their implementation XFree86 makes the 2381 </footnote>. With their implementation XFree86 makes the
2371 extension available across many operating systems and 2382 extension available across many operating systems and
2372 architectures.</para> 2383 architectures.</para>
2373 2384
2374 <para>Because the driver is embedded into the X server Xv has a 2385 <para>Because the driver is embedded into the X server Xv has a
2375 number of advantages over the V4L2 <link linkend="overlay">video 2386 number of advantages over the V4L2 <link linkend="overlay">video
2376 overlay interface</link>. The driver can easily determine the overlay 2387 overlay interface</link>. The driver can easily determine the overlay
2377 target, &ie; visible graphics memory or off-screen buffers for a 2388 target, &ie; visible graphics memory or off-screen buffers for a
2378 destructive overlay. It can program the RAMDAC for a non-destructive 2389 destructive overlay. It can program the RAMDAC for a non-destructive
2379 overlay, scaling or color-keying, or the clipping functions of the 2390 overlay, scaling or color-keying, or the clipping functions of the
2380 video capture hardware, always in sync with drawing operations or 2391 video capture hardware, always in sync with drawing operations or
2381 windows moving or changing their stacking order.</para> 2392 windows moving or changing their stacking order.</para>
2382 2393
2383 <para>To combine the advantages of Xv and V4L a special Xv 2394 <para>To combine the advantages of Xv and V4L a special Xv
2384 driver exists in XFree86 and XOrg, just programming any overlay capable 2395 driver exists in XFree86 and XOrg, just programming any overlay capable
2385 Video4Linux device it finds. To enable it 2396 Video4Linux device it finds. To enable it
2386 <filename>/etc/X11/XF86Config</filename> must contain these lines:</para> 2397 <filename>/etc/X11/XF86Config</filename> must contain these lines:</para>
2387 <para><screen> 2398 <para><screen>
2388 Section "Module" 2399 Section "Module"
2389 Load "v4l" 2400 Load "v4l"
2390 EndSection</screen></para> 2401 EndSection</screen></para>
2391 2402
2392 <para>As of XFree86 4.2 this driver still supports only V4L 2403 <para>As of XFree86 4.2 this driver still supports only V4L
2393 ioctls, however it should work just fine with all V4L2 devices through 2404 ioctls, however it should work just fine with all V4L2 devices through
2394 the V4L2 backward-compatibility layer. Since V4L2 permits multiple 2405 the V4L2 backward-compatibility layer. Since V4L2 permits multiple
2395 opens it is possible (if supported by the V4L2 driver) to capture 2406 opens it is possible (if supported by the V4L2 driver) to capture
2396 video while an X client requested video overlay. Restrictions of 2407 video while an X client requested video overlay. Restrictions of
2397 simultaneous capturing and overlay are discussed in <xref 2408 simultaneous capturing and overlay are discussed in <xref
2398 linkend="overlay" /> apply.</para> 2409 linkend="overlay" /> apply.</para>
2399 2410
2400 <para>Only marginally related to V4L2, XFree86 extended Xv to 2411 <para>Only marginally related to V4L2, XFree86 extended Xv to
2401 support hardware YUV to RGB conversion and scaling for faster video 2412 support hardware YUV to RGB conversion and scaling for faster video
2402 playback, and added an interface to MPEG-2 decoding hardware. This API 2413 playback, and added an interface to MPEG-2 decoding hardware. This API
2403 is useful to display images captured with V4L2 devices.</para> 2414 is useful to display images captured with V4L2 devices.</para>
2404 </section> 2415 </section>
2405 2416
2406 <section> 2417 <section>
2407 <title>Digital Video</title> 2418 <title>Digital Video</title>
2408 2419
2409 <para>V4L2 does not support digital terrestrial, cable or 2420 <para>V4L2 does not support digital terrestrial, cable or
2410 satellite broadcast. A separate project aiming at digital receivers 2421 satellite broadcast. A separate project aiming at digital receivers
2411 exists. You can find its homepage at <ulink 2422 exists. You can find its homepage at <ulink
2412 url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API 2423 url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API
2413 has no connection to the V4L2 API except that drivers for hybrid 2424 has no connection to the V4L2 API except that drivers for hybrid
2414 hardware may support both.</para> 2425 hardware may support both.</para>
2415 </section> 2426 </section>
2416 2427
2417 <section> 2428 <section>
2418 <title>Audio Interfaces</title> 2429 <title>Audio Interfaces</title>
2419 2430
2420 <para>[to do - OSS/ALSA]</para> 2431 <para>[to do - OSS/ALSA]</para>
2421 </section> 2432 </section>
2422 </section> 2433 </section>
2423 2434
2424 <section id="experimental"> 2435 <section id="experimental">
2425 <title>Experimental API Elements</title> 2436 <title>Experimental API Elements</title>
2426 2437
2427 <para>The following V4L2 API elements are currently experimental 2438 <para>The following V4L2 API elements are currently experimental
2428 and may change in the future.</para> 2439 and may change in the future.</para>
2429 2440
2430 <itemizedlist> 2441 <itemizedlist>
2431 <listitem> 2442 <listitem>
2432 <para>Video Output Overlay (OSD) Interface, <xref 2443 <para>Video Output Overlay (OSD) Interface, <xref
2433 linkend="osd" />.</para> 2444 linkend="osd" />.</para>
2434 </listitem> 2445 </listitem>
2435 <listitem> 2446 <listitem>
2436 <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>, 2447 <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>,
2437 &v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para> 2448 &v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para>
2438 </listitem> 2449 </listitem>
2439 <listitem> 2450 <listitem>
2440 <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>, 2451 <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>,
2441 &VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para> 2452 &VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para>
2442 </listitem> 2453 </listitem>
2443 <listitem> 2454 <listitem>
2444 <para>&VIDIOC-ENUM-FRAMESIZES; and 2455 <para>&VIDIOC-ENUM-FRAMESIZES; and
2445 &VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para> 2456 &VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para>
2446 </listitem> 2457 </listitem>
2447 <listitem> 2458 <listitem>
2448 <para>&VIDIOC-G-ENC-INDEX; ioctl.</para> 2459 <para>&VIDIOC-G-ENC-INDEX; ioctl.</para>
2449 </listitem> 2460 </listitem>
2450 <listitem> 2461 <listitem>
2451 <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; 2462 <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD;
2452 ioctls.</para> 2463 ioctls.</para>
2453 </listitem> 2464 </listitem>
2454 <listitem> 2465 <listitem>
2455 <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; 2466 <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER;
2456 ioctls.</para> 2467 ioctls.</para>
2457 </listitem> 2468 </listitem>
2458 <listitem> 2469 <listitem>
2459 <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para> 2470 <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para>
2460 </listitem> 2471 </listitem>
2461 </itemizedlist> 2472 </itemizedlist>
2462 </section> 2473 </section>
2463 2474
2464 <section id="obsolete"> 2475 <section id="obsolete">
2465 <title>Obsolete API Elements</title> 2476 <title>Obsolete API Elements</title>
2466 2477
2467 <para>The following V4L2 API elements were superseded by new 2478 <para>The following V4L2 API elements were superseded by new
2468 interfaces and should not be implemented in new drivers.</para> 2479 interfaces and should not be implemented in new drivers.</para>
2469 2480
2470 <itemizedlist> 2481 <itemizedlist>
2471 <listitem> 2482 <listitem>
2472 <para><constant>VIDIOC_G_MPEGCOMP</constant> and 2483 <para><constant>VIDIOC_G_MPEGCOMP</constant> and
2473 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls, 2484 <constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls,
2474 <xref linkend="extended-controls" />.</para> 2485 <xref linkend="extended-controls" />.</para>
2475 </listitem> 2486 </listitem>
2476 </itemizedlist> 2487 </itemizedlist>
2477 </section> 2488 </section>
2478 </section> 2489 </section>
2479 2490
2480 <!-- 2491 <!--
2481 Local Variables: 2492 Local Variables:
2482 mode: sgml 2493 mode: sgml
2483 sgml-parent-document: "v4l2.sgml" 2494 sgml-parent-document: "v4l2.sgml"
2484 indent-tabs-mode: nil 2495 indent-tabs-mode: nil
2485 End: 2496 End:
2486 --> 2497 -->
2487 2498
Documentation/DocBook/v4l/dev-capture.xml
1 <title>Video Capture Interface</title> 1 <title>Video Capture Interface</title>
2 2
3 <para>Video capture devices sample an analog video signal and store 3 <para>Video capture devices sample an analog video signal and store
4 the digitized images in memory. Today nearly all devices can capture 4 the digitized images in memory. Today nearly all devices can capture
5 at full 25 or 30 frames/second. With this interface applications can 5 at full 25 or 30 frames/second. With this interface applications can
6 control the capture process and move images from the driver into user 6 control the capture process and move images from the driver into user
7 space.</para> 7 space.</para>
8 8
9 <para>Conventionally V4L2 video capture devices are accessed through 9 <para>Conventionally V4L2 video capture devices are accessed through
10 character device special files named <filename>/dev/video</filename> 10 character device special files named <filename>/dev/video</filename>
11 and <filename>/dev/video0</filename> to 11 and <filename>/dev/video0</filename> to
12 <filename>/dev/video63</filename> with major number 81 and minor 12 <filename>/dev/video63</filename> with major number 81 and minor
13 numbers 0 to 63. <filename>/dev/video</filename> is typically a 13 numbers 0 to 63. <filename>/dev/video</filename> is typically a
14 symbolic link to the preferred video device. Note the same device 14 symbolic link to the preferred video device. Note the same device
15 files are used for video output devices.</para> 15 files are used for video output devices.</para>
16 16
17 <section> 17 <section>
18 <title>Querying Capabilities</title> 18 <title>Querying Capabilities</title>
19 19
20 <para>Devices supporting the video capture interface set the 20 <para>Devices supporting the video capture interface set the
21 <constant>V4L2_CAP_VIDEO_CAPTURE</constant> flag in the 21 <constant>V4L2_CAP_VIDEO_CAPTURE</constant> or
22 <constant>V4L2_CAP_VIDEO_CAPTURE_MPLANE</constant> flag in the
22 <structfield>capabilities</structfield> field of &v4l2-capability; 23 <structfield>capabilities</structfield> field of &v4l2-capability;
23 returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions 24 returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions
24 they may also support the <link linkend="overlay">video overlay</link> 25 they may also support the <link linkend="overlay">video overlay</link>
25 (<constant>V4L2_CAP_VIDEO_OVERLAY</constant>) and the <link 26 (<constant>V4L2_CAP_VIDEO_OVERLAY</constant>) and the <link
26 linkend="raw-vbi">raw VBI capture</link> 27 linkend="raw-vbi">raw VBI capture</link>
27 (<constant>V4L2_CAP_VBI_CAPTURE</constant>) interface. At least one of 28 (<constant>V4L2_CAP_VBI_CAPTURE</constant>) interface. At least one of
28 the read/write or streaming I/O methods must be supported. Tuners and 29 the read/write or streaming I/O methods must be supported. Tuners and
29 audio inputs are optional.</para> 30 audio inputs are optional.</para>
30 </section> 31 </section>
31 32
32 <section> 33 <section>
33 <title>Supplemental Functions</title> 34 <title>Supplemental Functions</title>
34 35
35 <para>Video capture devices shall support <link 36 <para>Video capture devices shall support <link
36 linkend="audio">audio input</link>, <link 37 linkend="audio">audio input</link>, <link
37 linkend="tuner">tuner</link>, <link linkend="control">controls</link>, 38 linkend="tuner">tuner</link>, <link linkend="control">controls</link>,
38 <link linkend="crop">cropping and scaling</link> and <link 39 <link linkend="crop">cropping and scaling</link> and <link
39 linkend="streaming-par">streaming parameter</link> ioctls as needed. 40 linkend="streaming-par">streaming parameter</link> ioctls as needed.
40 The <link linkend="video">video input</link> and <link 41 The <link linkend="video">video input</link> and <link
41 linkend="standard">video standard</link> ioctls must be supported by 42 linkend="standard">video standard</link> ioctls must be supported by
42 all video capture devices.</para> 43 all video capture devices.</para>
43 </section> 44 </section>
44 45
45 <section> 46 <section>
46 <title>Image Format Negotiation</title> 47 <title>Image Format Negotiation</title>
47 48
48 <para>The result of a capture operation is determined by 49 <para>The result of a capture operation is determined by
49 cropping and image format parameters. The former select an area of the 50 cropping and image format parameters. The former select an area of the
50 video picture to capture, the latter how images are stored in memory, 51 video picture to capture, the latter how images are stored in memory,
51 &ie; in RGB or YUV format, the number of bits per pixel or width and 52 &ie; in RGB or YUV format, the number of bits per pixel or width and
52 height. Together they also define how images are scaled in the 53 height. Together they also define how images are scaled in the
53 process.</para> 54 process.</para>
54 55
55 <para>As usual these parameters are <emphasis>not</emphasis> reset 56 <para>As usual these parameters are <emphasis>not</emphasis> reset
56 at &func-open; time to permit Unix tool chains, programming a device 57 at &func-open; time to permit Unix tool chains, programming a device
57 and then reading from it as if it was a plain file. Well written V4L2 58 and then reading from it as if it was a plain file. Well written V4L2
58 applications ensure they really get what they want, including cropping 59 applications ensure they really get what they want, including cropping
59 and scaling.</para> 60 and scaling.</para>
60 61
61 <para>Cropping initialization at minimum requires to reset the 62 <para>Cropping initialization at minimum requires to reset the
62 parameters to defaults. An example is given in <xref 63 parameters to defaults. An example is given in <xref
63 linkend="crop" />.</para> 64 linkend="crop" />.</para>
64 65
65 <para>To query the current image format applications set the 66 <para>To query the current image format applications set the
66 <structfield>type</structfield> field of a &v4l2-format; to 67 <structfield>type</structfield> field of a &v4l2-format; to
67 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> and call the 68 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> or
69 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant> and call the
68 &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill 70 &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill
69 the &v4l2-pix-format; <structfield>pix</structfield> member of the 71 the &v4l2-pix-format; <structfield>pix</structfield> or the
72 &v4l2-pix-format-mplane; <structfield>pix_mp</structfield> member of the
70 <structfield>fmt</structfield> union.</para> 73 <structfield>fmt</structfield> union.</para>
71 74
72 <para>To request different parameters applications set the 75 <para>To request different parameters applications set the
73 <structfield>type</structfield> field of a &v4l2-format; as above and 76 <structfield>type</structfield> field of a &v4l2-format; as above and
74 initialize all fields of the &v4l2-pix-format; 77 initialize all fields of the &v4l2-pix-format;
75 <structfield>vbi</structfield> member of the 78 <structfield>vbi</structfield> member of the
76 <structfield>fmt</structfield> union, or better just modify the 79 <structfield>fmt</structfield> union, or better just modify the
77 results of <constant>VIDIOC_G_FMT</constant>, and call the 80 results of <constant>VIDIOC_G_FMT</constant>, and call the
78 &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may 81 &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may
79 adjust the parameters and finally return the actual parameters as 82 adjust the parameters and finally return the actual parameters as
80 <constant>VIDIOC_G_FMT</constant> does.</para> 83 <constant>VIDIOC_G_FMT</constant> does.</para>
81 84
82 <para>Like <constant>VIDIOC_S_FMT</constant> the 85 <para>Like <constant>VIDIOC_S_FMT</constant> the
83 &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations 86 &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations
84 without disabling I/O or possibly time consuming hardware 87 without disabling I/O or possibly time consuming hardware
85 preparations.</para> 88 preparations.</para>
86 89
87 <para>The contents of &v4l2-pix-format; are discussed in <xref 90 <para>The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane;
88 linkend="pixfmt" />. See also the specification of the 91 are discussed in <xref linkend="pixfmt" />. See also the specification of the
89 <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant> 92 <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant>
90 and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video 93 and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video
91 capture devices must implement both the 94 capture devices must implement both the
92 <constant>VIDIOC_G_FMT</constant> and 95 <constant>VIDIOC_G_FMT</constant> and
93 <constant>VIDIOC_S_FMT</constant> ioctl, even if 96 <constant>VIDIOC_S_FMT</constant> ioctl, even if
94 <constant>VIDIOC_S_FMT</constant> ignores all requests and always 97 <constant>VIDIOC_S_FMT</constant> ignores all requests and always
95 returns default parameters as <constant>VIDIOC_G_FMT</constant> does. 98 returns default parameters as <constant>VIDIOC_G_FMT</constant> does.
96 <constant>VIDIOC_TRY_FMT</constant> is optional.</para> 99 <constant>VIDIOC_TRY_FMT</constant> is optional.</para>
97 </section> 100 </section>
98 101
99 <section> 102 <section>
100 <title>Reading Images</title> 103 <title>Reading Images</title>
101 104
102 <para>A video capture device may support the <link 105 <para>A video capture device may support the <link
103 linkend="rw">read() function</link> and/or streaming (<link 106 linkend="rw">read() function</link> and/or streaming (<link
104 linkend="mmap">memory mapping</link> or <link 107 linkend="mmap">memory mapping</link> or <link
105 linkend="userp">user pointer</link>) I/O. See <xref 108 linkend="userp">user pointer</link>) I/O. See <xref
106 linkend="io" /> for details.</para> 109 linkend="io" /> for details.</para>
107 </section> 110 </section>
108 111
109 <!-- 112 <!--
110 Local Variables: 113 Local Variables:
111 mode: sgml 114 mode: sgml
112 sgml-parent-document: "v4l2.sgml" 115 sgml-parent-document: "v4l2.sgml"
113 indent-tabs-mode: nil 116 indent-tabs-mode: nil
114 End: 117 End:
115 --> 118 -->
116 119
Documentation/DocBook/v4l/dev-output.xml
1 <title>Video Output Interface</title> 1 <title>Video Output Interface</title>
2 2
3 <para>Video output devices encode stills or image sequences as 3 <para>Video output devices encode stills or image sequences as
4 analog video signal. With this interface applications can 4 analog video signal. With this interface applications can
5 control the encoding process and move images from user space to 5 control the encoding process and move images from user space to
6 the driver.</para> 6 the driver.</para>
7 7
8 <para>Conventionally V4L2 video output devices are accessed through 8 <para>Conventionally V4L2 video output devices are accessed through
9 character device special files named <filename>/dev/video</filename> 9 character device special files named <filename>/dev/video</filename>
10 and <filename>/dev/video0</filename> to 10 and <filename>/dev/video0</filename> to
11 <filename>/dev/video63</filename> with major number 81 and minor 11 <filename>/dev/video63</filename> with major number 81 and minor
12 numbers 0 to 63. <filename>/dev/video</filename> is typically a 12 numbers 0 to 63. <filename>/dev/video</filename> is typically a
13 symbolic link to the preferred video device. Note the same device 13 symbolic link to the preferred video device. Note the same device
14 files are used for video capture devices.</para> 14 files are used for video capture devices.</para>
15 15
16 <section> 16 <section>
17 <title>Querying Capabilities</title> 17 <title>Querying Capabilities</title>
18 18
19 <para>Devices supporting the video output interface set the 19 <para>Devices supporting the video output interface set the
20 <constant>V4L2_CAP_VIDEO_OUTPUT</constant> flag in the 20 <constant>V4L2_CAP_VIDEO_OUTPUT</constant> or
21 <constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant> flag in the
21 <structfield>capabilities</structfield> field of &v4l2-capability; 22 <structfield>capabilities</structfield> field of &v4l2-capability;
22 returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions 23 returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions
23 they may also support the <link linkend="raw-vbi">raw VBI 24 they may also support the <link linkend="raw-vbi">raw VBI
24 output</link> (<constant>V4L2_CAP_VBI_OUTPUT</constant>) interface. At 25 output</link> (<constant>V4L2_CAP_VBI_OUTPUT</constant>) interface. At
25 least one of the read/write or streaming I/O methods must be 26 least one of the read/write or streaming I/O methods must be
26 supported. Modulators and audio outputs are optional.</para> 27 supported. Modulators and audio outputs are optional.</para>
27 </section> 28 </section>
28 29
29 <section> 30 <section>
30 <title>Supplemental Functions</title> 31 <title>Supplemental Functions</title>
31 32
32 <para>Video output devices shall support <link 33 <para>Video output devices shall support <link
33 linkend="audio">audio output</link>, <link 34 linkend="audio">audio output</link>, <link
34 linkend="tuner">modulator</link>, <link linkend="control">controls</link>, 35 linkend="tuner">modulator</link>, <link linkend="control">controls</link>,
35 <link linkend="crop">cropping and scaling</link> and <link 36 <link linkend="crop">cropping and scaling</link> and <link
36 linkend="streaming-par">streaming parameter</link> ioctls as needed. 37 linkend="streaming-par">streaming parameter</link> ioctls as needed.
37 The <link linkend="video">video output</link> and <link 38 The <link linkend="video">video output</link> and <link
38 linkend="standard">video standard</link> ioctls must be supported by 39 linkend="standard">video standard</link> ioctls must be supported by
39 all video output devices.</para> 40 all video output devices.</para>
40 </section> 41 </section>
41 42
42 <section> 43 <section>
43 <title>Image Format Negotiation</title> 44 <title>Image Format Negotiation</title>
44 45
45 <para>The output is determined by cropping and image format 46 <para>The output is determined by cropping and image format
46 parameters. The former select an area of the video picture where the 47 parameters. The former select an area of the video picture where the
47 image will appear, the latter how images are stored in memory, &ie; in 48 image will appear, the latter how images are stored in memory, &ie; in
48 RGB or YUV format, the number of bits per pixel or width and height. 49 RGB or YUV format, the number of bits per pixel or width and height.
49 Together they also define how images are scaled in the process.</para> 50 Together they also define how images are scaled in the process.</para>
50 51
51 <para>As usual these parameters are <emphasis>not</emphasis> reset 52 <para>As usual these parameters are <emphasis>not</emphasis> reset
52 at &func-open; time to permit Unix tool chains, programming a device 53 at &func-open; time to permit Unix tool chains, programming a device
53 and then writing to it as if it was a plain file. Well written V4L2 54 and then writing to it as if it was a plain file. Well written V4L2
54 applications ensure they really get what they want, including cropping 55 applications ensure they really get what they want, including cropping
55 and scaling.</para> 56 and scaling.</para>
56 57
57 <para>Cropping initialization at minimum requires to reset the 58 <para>Cropping initialization at minimum requires to reset the
58 parameters to defaults. An example is given in <xref 59 parameters to defaults. An example is given in <xref
59 linkend="crop" />.</para> 60 linkend="crop" />.</para>
60 61
61 <para>To query the current image format applications set the 62 <para>To query the current image format applications set the
62 <structfield>type</structfield> field of a &v4l2-format; to 63 <structfield>type</structfield> field of a &v4l2-format; to
63 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> and call the 64 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> or
65 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant> and call the
64 &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill 66 &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill
65 the &v4l2-pix-format; <structfield>pix</structfield> member of the 67 the &v4l2-pix-format; <structfield>pix</structfield> or the
68 &v4l2-pix-format-mplane; <structfield>pix_mp</structfield> member of the
66 <structfield>fmt</structfield> union.</para> 69 <structfield>fmt</structfield> union.</para>
67 70
68 <para>To request different parameters applications set the 71 <para>To request different parameters applications set the
69 <structfield>type</structfield> field of a &v4l2-format; as above and 72 <structfield>type</structfield> field of a &v4l2-format; as above and
70 initialize all fields of the &v4l2-pix-format; 73 initialize all fields of the &v4l2-pix-format;
71 <structfield>vbi</structfield> member of the 74 <structfield>vbi</structfield> member of the
72 <structfield>fmt</structfield> union, or better just modify the 75 <structfield>fmt</structfield> union, or better just modify the
73 results of <constant>VIDIOC_G_FMT</constant>, and call the 76 results of <constant>VIDIOC_G_FMT</constant>, and call the
74 &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may 77 &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may
75 adjust the parameters and finally return the actual parameters as 78 adjust the parameters and finally return the actual parameters as
76 <constant>VIDIOC_G_FMT</constant> does.</para> 79 <constant>VIDIOC_G_FMT</constant> does.</para>
77 80
78 <para>Like <constant>VIDIOC_S_FMT</constant> the 81 <para>Like <constant>VIDIOC_S_FMT</constant> the
79 &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations 82 &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations
80 without disabling I/O or possibly time consuming hardware 83 without disabling I/O or possibly time consuming hardware
81 preparations.</para> 84 preparations.</para>
82 85
83 <para>The contents of &v4l2-pix-format; are discussed in <xref 86 <para>The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane;
84 linkend="pixfmt" />. See also the specification of the 87 are discussed in <xref linkend="pixfmt" />. See also the specification of the
85 <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant> 88 <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant>
86 and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video 89 and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video
87 output devices must implement both the 90 output devices must implement both the
88 <constant>VIDIOC_G_FMT</constant> and 91 <constant>VIDIOC_G_FMT</constant> and
89 <constant>VIDIOC_S_FMT</constant> ioctl, even if 92 <constant>VIDIOC_S_FMT</constant> ioctl, even if
90 <constant>VIDIOC_S_FMT</constant> ignores all requests and always 93 <constant>VIDIOC_S_FMT</constant> ignores all requests and always
91 returns default parameters as <constant>VIDIOC_G_FMT</constant> does. 94 returns default parameters as <constant>VIDIOC_G_FMT</constant> does.
92 <constant>VIDIOC_TRY_FMT</constant> is optional.</para> 95 <constant>VIDIOC_TRY_FMT</constant> is optional.</para>
93 </section> 96 </section>
94 97
95 <section> 98 <section>
96 <title>Writing Images</title> 99 <title>Writing Images</title>
97 100
98 <para>A video output device may support the <link 101 <para>A video output device may support the <link
99 linkend="rw">write() function</link> and/or streaming (<link 102 linkend="rw">write() function</link> and/or streaming (<link
100 linkend="mmap">memory mapping</link> or <link 103 linkend="mmap">memory mapping</link> or <link
101 linkend="userp">user pointer</link>) I/O. See <xref 104 linkend="userp">user pointer</link>) I/O. See <xref
102 linkend="io" /> for details.</para> 105 linkend="io" /> for details.</para>
103 </section> 106 </section>
104 107
105 <!-- 108 <!--
106 Local Variables: 109 Local Variables:
107 mode: sgml 110 mode: sgml
108 sgml-parent-document: "v4l2.sgml" 111 sgml-parent-document: "v4l2.sgml"
109 indent-tabs-mode: nil 112 indent-tabs-mode: nil
110 End: 113 End:
111 --> 114 -->
112 115
Documentation/DocBook/v4l/func-mmap.xml
1 <refentry id="func-mmap"> 1 <refentry id="func-mmap">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2 mmap()</refentrytitle> 3 <refentrytitle>V4L2 mmap()</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>v4l2-mmap</refname> 8 <refname>v4l2-mmap</refname>
9 <refpurpose>Map device memory into application address space</refpurpose> 9 <refpurpose>Map device memory into application address space</refpurpose>
10 </refnamediv> 10 </refnamediv>
11 11
12 <refsynopsisdiv> 12 <refsynopsisdiv>
13 <funcsynopsis> 13 <funcsynopsis>
14 <funcsynopsisinfo> 14 <funcsynopsisinfo>
15 #include &lt;unistd.h&gt; 15 #include &lt;unistd.h&gt;
16 #include &lt;sys/mman.h&gt;</funcsynopsisinfo> 16 #include &lt;sys/mman.h&gt;</funcsynopsisinfo>
17 <funcprototype> 17 <funcprototype>
18 <funcdef>void *<function>mmap</function></funcdef> 18 <funcdef>void *<function>mmap</function></funcdef>
19 <paramdef>void *<parameter>start</parameter></paramdef> 19 <paramdef>void *<parameter>start</parameter></paramdef>
20 <paramdef>size_t <parameter>length</parameter></paramdef> 20 <paramdef>size_t <parameter>length</parameter></paramdef>
21 <paramdef>int <parameter>prot</parameter></paramdef> 21 <paramdef>int <parameter>prot</parameter></paramdef>
22 <paramdef>int <parameter>flags</parameter></paramdef> 22 <paramdef>int <parameter>flags</parameter></paramdef>
23 <paramdef>int <parameter>fd</parameter></paramdef> 23 <paramdef>int <parameter>fd</parameter></paramdef>
24 <paramdef>off_t <parameter>offset</parameter></paramdef> 24 <paramdef>off_t <parameter>offset</parameter></paramdef>
25 </funcprototype> 25 </funcprototype>
26 </funcsynopsis> 26 </funcsynopsis>
27 </refsynopsisdiv> 27 </refsynopsisdiv>
28 28
29 <refsect1> 29 <refsect1>
30 <title>Arguments</title> 30 <title>Arguments</title>
31 <variablelist> 31 <variablelist>
32 <varlistentry> 32 <varlistentry>
33 <term><parameter>start</parameter></term> 33 <term><parameter>start</parameter></term>
34 <listitem> 34 <listitem>
35 <para>Map the buffer to this address in the 35 <para>Map the buffer to this address in the
36 application's address space. When the <constant>MAP_FIXED</constant> 36 application's address space. When the <constant>MAP_FIXED</constant>
37 flag is specified, <parameter>start</parameter> must be a multiple of the 37 flag is specified, <parameter>start</parameter> must be a multiple of the
38 pagesize and mmap will fail when the specified address 38 pagesize and mmap will fail when the specified address
39 cannot be used. Use of this option is discouraged; applications should 39 cannot be used. Use of this option is discouraged; applications should
40 just specify a <constant>NULL</constant> pointer here.</para> 40 just specify a <constant>NULL</constant> pointer here.</para>
41 </listitem> 41 </listitem>
42 </varlistentry> 42 </varlistentry>
43 <varlistentry> 43 <varlistentry>
44 <term><parameter>length</parameter></term> 44 <term><parameter>length</parameter></term>
45 <listitem> 45 <listitem>
46 <para>Length of the memory area to map. This must be the 46 <para>Length of the memory area to map. This must be the
47 same value as returned by the driver in the &v4l2-buffer; 47 same value as returned by the driver in the &v4l2-buffer;
48 <structfield>length</structfield> field.</para> 48 <structfield>length</structfield> field for the
49 single-planar API, and the same value as returned by the driver
50 in the &v4l2-plane; <structfield>length</structfield> field for the
51 multi-planar API.</para>
49 </listitem> 52 </listitem>
50 </varlistentry> 53 </varlistentry>
51 <varlistentry> 54 <varlistentry>
52 <term><parameter>prot</parameter></term> 55 <term><parameter>prot</parameter></term>
53 <listitem> 56 <listitem>
54 <para>The <parameter>prot</parameter> argument describes the 57 <para>The <parameter>prot</parameter> argument describes the
55 desired memory protection. Regardless of the device type and the 58 desired memory protection. Regardless of the device type and the
56 direction of data exchange it should be set to 59 direction of data exchange it should be set to
57 <constant>PROT_READ</constant> | <constant>PROT_WRITE</constant>, 60 <constant>PROT_READ</constant> | <constant>PROT_WRITE</constant>,
58 permitting read and write access to image buffers. Drivers should 61 permitting read and write access to image buffers. Drivers should
59 support at least this combination of flags. Note the Linux 62 support at least this combination of flags. Note the Linux
60 <filename>video-buf</filename> kernel module, which is used by the 63 <filename>video-buf</filename> kernel module, which is used by the
61 bttv, saa7134, saa7146, cx88 and vivi driver supports only 64 bttv, saa7134, saa7146, cx88 and vivi driver supports only
62 <constant>PROT_READ</constant> | <constant>PROT_WRITE</constant>. When 65 <constant>PROT_READ</constant> | <constant>PROT_WRITE</constant>. When
63 the driver does not support the desired protection the 66 the driver does not support the desired protection the
64 <function>mmap()</function> function fails.</para> 67 <function>mmap()</function> function fails.</para>
65 <para>Note device memory accesses (&eg; the memory on a 68 <para>Note device memory accesses (&eg; the memory on a
66 graphics card with video capturing hardware) may incur a performance 69 graphics card with video capturing hardware) may incur a performance
67 penalty compared to main memory accesses, or reads may be 70 penalty compared to main memory accesses, or reads may be
68 significantly slower than writes or vice versa. Other I/O methods may 71 significantly slower than writes or vice versa. Other I/O methods may
69 be more efficient in this case.</para> 72 be more efficient in this case.</para>
70 </listitem> 73 </listitem>
71 </varlistentry> 74 </varlistentry>
72 <varlistentry> 75 <varlistentry>
73 <term><parameter>flags</parameter></term> 76 <term><parameter>flags</parameter></term>
74 <listitem> 77 <listitem>
75 <para>The <parameter>flags</parameter> parameter 78 <para>The <parameter>flags</parameter> parameter
76 specifies the type of the mapped object, mapping options and whether 79 specifies the type of the mapped object, mapping options and whether
77 modifications made to the mapped copy of the page are private to the 80 modifications made to the mapped copy of the page are private to the
78 process or are to be shared with other references.</para> 81 process or are to be shared with other references.</para>
79 <para><constant>MAP_FIXED</constant> requests that the 82 <para><constant>MAP_FIXED</constant> requests that the
80 driver selects no other address than the one specified. If the 83 driver selects no other address than the one specified. If the
81 specified address cannot be used, <function>mmap()</function> will fail. If 84 specified address cannot be used, <function>mmap()</function> will fail. If
82 <constant>MAP_FIXED</constant> is specified, 85 <constant>MAP_FIXED</constant> is specified,
83 <parameter>start</parameter> must be a multiple of the pagesize. Use 86 <parameter>start</parameter> must be a multiple of the pagesize. Use
84 of this option is discouraged.</para> 87 of this option is discouraged.</para>
85 <para>One of the <constant>MAP_SHARED</constant> or 88 <para>One of the <constant>MAP_SHARED</constant> or
86 <constant>MAP_PRIVATE</constant> flags must be set. 89 <constant>MAP_PRIVATE</constant> flags must be set.
87 <constant>MAP_SHARED</constant> allows applications to share the 90 <constant>MAP_SHARED</constant> allows applications to share the
88 mapped memory with other (&eg; child-) processes. Note the Linux 91 mapped memory with other (&eg; child-) processes. Note the Linux
89 <filename>video-buf</filename> module which is used by the bttv, 92 <filename>video-buf</filename> module which is used by the bttv,
90 saa7134, saa7146, cx88 and vivi driver supports only 93 saa7134, saa7146, cx88 and vivi driver supports only
91 <constant>MAP_SHARED</constant>. <constant>MAP_PRIVATE</constant> 94 <constant>MAP_SHARED</constant>. <constant>MAP_PRIVATE</constant>
92 requests copy-on-write semantics. V4L2 applications should not set the 95 requests copy-on-write semantics. V4L2 applications should not set the
93 <constant>MAP_PRIVATE</constant>, <constant>MAP_DENYWRITE</constant>, 96 <constant>MAP_PRIVATE</constant>, <constant>MAP_DENYWRITE</constant>,
94 <constant>MAP_EXECUTABLE</constant> or <constant>MAP_ANON</constant> 97 <constant>MAP_EXECUTABLE</constant> or <constant>MAP_ANON</constant>
95 flag.</para> 98 flag.</para>
96 </listitem> 99 </listitem>
97 </varlistentry> 100 </varlistentry>
98 <varlistentry> 101 <varlistentry>
99 <term><parameter>fd</parameter></term> 102 <term><parameter>fd</parameter></term>
100 <listitem> 103 <listitem>
101 <para>&fd;</para> 104 <para>&fd;</para>
102 </listitem> 105 </listitem>
103 </varlistentry> 106 </varlistentry>
104 <varlistentry> 107 <varlistentry>
105 <term><parameter>offset</parameter></term> 108 <term><parameter>offset</parameter></term>
106 <listitem> 109 <listitem>
107 <para>Offset of the buffer in device memory. This must be the 110 <para>Offset of the buffer in device memory. This must be the
108 same value as returned by the driver in the &v4l2-buffer; 111 same value as returned by the driver in the &v4l2-buffer;
109 <structfield>m</structfield> union <structfield>offset</structfield> field.</para> 112 <structfield>m</structfield> union <structfield>offset</structfield> field for
113 the single-planar API, and the same value as returned by the driver
114 in the &v4l2-plane; <structfield>m</structfield> union
115 <structfield>mem_offset</structfield> field for the multi-planar API.</para>
110 </listitem> 116 </listitem>
111 </varlistentry> 117 </varlistentry>
112 </variablelist> 118 </variablelist>
113 </refsect1> 119 </refsect1>
114 120
115 <refsect1> 121 <refsect1>
116 <title>Description</title> 122 <title>Description</title>
117 123
118 <para>The <function>mmap()</function> function asks to map 124 <para>The <function>mmap()</function> function asks to map
119 <parameter>length</parameter> bytes starting at 125 <parameter>length</parameter> bytes starting at
120 <parameter>offset</parameter> in the memory of the device specified by 126 <parameter>offset</parameter> in the memory of the device specified by
121 <parameter>fd</parameter> into the application address space, 127 <parameter>fd</parameter> into the application address space,
122 preferably at address <parameter>start</parameter>. This latter 128 preferably at address <parameter>start</parameter>. This latter
123 address is a hint only, and is usually specified as 0.</para> 129 address is a hint only, and is usually specified as 0.</para>
124 130
125 <para>Suitable length and offset parameters are queried with the 131 <para>Suitable length and offset parameters are queried with the
126 &VIDIOC-QUERYBUF; ioctl. Buffers must be allocated with the 132 &VIDIOC-QUERYBUF; ioctl. Buffers must be allocated with the
127 &VIDIOC-REQBUFS; ioctl before they can be queried.</para> 133 &VIDIOC-REQBUFS; ioctl before they can be queried.</para>
128 134
129 <para>To unmap buffers the &func-munmap; function is used.</para> 135 <para>To unmap buffers the &func-munmap; function is used.</para>
130 </refsect1> 136 </refsect1>
131 137
132 <refsect1> 138 <refsect1>
133 <title>Return Value</title> 139 <title>Return Value</title>
134 140
135 <para>On success <function>mmap()</function> returns a pointer to 141 <para>On success <function>mmap()</function> returns a pointer to
136 the mapped buffer. On error <constant>MAP_FAILED</constant> (-1) is 142 the mapped buffer. On error <constant>MAP_FAILED</constant> (-1) is
137 returned, and the <varname>errno</varname> variable is set 143 returned, and the <varname>errno</varname> variable is set
138 appropriately. Possible error codes are:</para> 144 appropriately. Possible error codes are:</para>
139 145
140 <variablelist> 146 <variablelist>
141 <varlistentry> 147 <varlistentry>
142 <term><errorcode>EBADF</errorcode></term> 148 <term><errorcode>EBADF</errorcode></term>
143 <listitem> 149 <listitem>
144 <para><parameter>fd</parameter> is not a valid file 150 <para><parameter>fd</parameter> is not a valid file
145 descriptor.</para> 151 descriptor.</para>
146 </listitem> 152 </listitem>
147 </varlistentry> 153 </varlistentry>
148 <varlistentry> 154 <varlistentry>
149 <term><errorcode>EACCES</errorcode></term> 155 <term><errorcode>EACCES</errorcode></term>
150 <listitem> 156 <listitem>
151 <para><parameter>fd</parameter> is 157 <para><parameter>fd</parameter> is
152 not open for reading and writing.</para> 158 not open for reading and writing.</para>
153 </listitem> 159 </listitem>
154 </varlistentry> 160 </varlistentry>
155 <varlistentry> 161 <varlistentry>
156 <term><errorcode>EINVAL</errorcode></term> 162 <term><errorcode>EINVAL</errorcode></term>
157 <listitem> 163 <listitem>
158 <para>The <parameter>start</parameter> or 164 <para>The <parameter>start</parameter> or
159 <parameter>length</parameter> or <parameter>offset</parameter> are not 165 <parameter>length</parameter> or <parameter>offset</parameter> are not
160 suitable. (E.&nbsp;g. they are too large, or not aligned on a 166 suitable. (E.&nbsp;g. they are too large, or not aligned on a
161 <constant>PAGESIZE</constant> boundary.)</para> 167 <constant>PAGESIZE</constant> boundary.)</para>
162 <para>The <parameter>flags</parameter> or 168 <para>The <parameter>flags</parameter> or
163 <parameter>prot</parameter> value is not supported.</para> 169 <parameter>prot</parameter> value is not supported.</para>
164 <para>No buffers have been allocated with the 170 <para>No buffers have been allocated with the
165 &VIDIOC-REQBUFS; ioctl.</para> 171 &VIDIOC-REQBUFS; ioctl.</para>
166 </listitem> 172 </listitem>
167 </varlistentry> 173 </varlistentry>
168 <varlistentry> 174 <varlistentry>
169 <term><errorcode>ENOMEM</errorcode></term> 175 <term><errorcode>ENOMEM</errorcode></term>
170 <listitem> 176 <listitem>
171 <para>Not enough physical or virtual memory was available to 177 <para>Not enough physical or virtual memory was available to
172 complete the request.</para> 178 complete the request.</para>
173 </listitem> 179 </listitem>
174 </varlistentry> 180 </varlistentry>
175 </variablelist> 181 </variablelist>
176 </refsect1> 182 </refsect1>
177 </refentry> 183 </refentry>
178 184
179 <!-- 185 <!--
180 Local Variables: 186 Local Variables:
181 mode: sgml 187 mode: sgml
182 sgml-parent-document: "v4l2.sgml" 188 sgml-parent-document: "v4l2.sgml"
183 indent-tabs-mode: nil 189 indent-tabs-mode: nil
184 End: 190 End:
185 --> 191 -->
186 192
Documentation/DocBook/v4l/func-munmap.xml
1 <refentry id="func-munmap"> 1 <refentry id="func-munmap">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2 munmap()</refentrytitle> 3 <refentrytitle>V4L2 munmap()</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>v4l2-munmap</refname> 8 <refname>v4l2-munmap</refname>
9 <refpurpose>Unmap device memory</refpurpose> 9 <refpurpose>Unmap device memory</refpurpose>
10 </refnamediv> 10 </refnamediv>
11 11
12 <refsynopsisdiv> 12 <refsynopsisdiv>
13 <funcsynopsis> 13 <funcsynopsis>
14 <funcsynopsisinfo> 14 <funcsynopsisinfo>
15 #include &lt;unistd.h&gt; 15 #include &lt;unistd.h&gt;
16 #include &lt;sys/mman.h&gt;</funcsynopsisinfo> 16 #include &lt;sys/mman.h&gt;</funcsynopsisinfo>
17 <funcprototype> 17 <funcprototype>
18 <funcdef>int <function>munmap</function></funcdef> 18 <funcdef>int <function>munmap</function></funcdef>
19 <paramdef>void *<parameter>start</parameter></paramdef> 19 <paramdef>void *<parameter>start</parameter></paramdef>
20 <paramdef>size_t <parameter>length</parameter></paramdef> 20 <paramdef>size_t <parameter>length</parameter></paramdef>
21 </funcprototype> 21 </funcprototype>
22 </funcsynopsis> 22 </funcsynopsis>
23 </refsynopsisdiv> 23 </refsynopsisdiv>
24 <refsect1> 24 <refsect1>
25 <title>Arguments</title> 25 <title>Arguments</title>
26 <variablelist> 26 <variablelist>
27 <varlistentry> 27 <varlistentry>
28 <term><parameter>start</parameter></term> 28 <term><parameter>start</parameter></term>
29 <listitem> 29 <listitem>
30 <para>Address of the mapped buffer as returned by the 30 <para>Address of the mapped buffer as returned by the
31 &func-mmap; function.</para> 31 &func-mmap; function.</para>
32 </listitem> 32 </listitem>
33 </varlistentry> 33 </varlistentry>
34 <varlistentry> 34 <varlistentry>
35 <term><parameter>length</parameter></term> 35 <term><parameter>length</parameter></term>
36 <listitem> 36 <listitem>
37 <para>Length of the mapped buffer. This must be the same 37 <para>Length of the mapped buffer. This must be the same
38 value as given to <function>mmap()</function> and returned by the 38 value as given to <function>mmap()</function> and returned by the
39 driver in the &v4l2-buffer; <structfield>length</structfield> 39 driver in the &v4l2-buffer; <structfield>length</structfield>
40 field.</para> 40 field for the single-planar API and in the &v4l2-plane;
41 <structfield>length</structfield> field for the multi-planar API.</para>
41 </listitem> 42 </listitem>
42 </varlistentry> 43 </varlistentry>
43 </variablelist> 44 </variablelist>
44 </refsect1> 45 </refsect1>
45 46
46 <refsect1> 47 <refsect1>
47 <title>Description</title> 48 <title>Description</title>
48 49
49 <para>Unmaps a previously with the &func-mmap; function mapped 50 <para>Unmaps a previously with the &func-mmap; function mapped
50 buffer and frees it, if possible. <!-- ? This function (not freeing) 51 buffer and frees it, if possible. <!-- ? This function (not freeing)
51 has no impact on I/O in progress, specifically it does not imply 52 has no impact on I/O in progress, specifically it does not imply
52 &VIDIOC-STREAMOFF; to terminate I/O. Unmapped buffers can still be 53 &VIDIOC-STREAMOFF; to terminate I/O. Unmapped buffers can still be
53 enqueued, dequeued or queried, they are just not accessible by the 54 enqueued, dequeued or queried, they are just not accessible by the
54 application.--></para> 55 application.--></para>
55 </refsect1> 56 </refsect1>
56 57
57 <refsect1> 58 <refsect1>
58 <title>Return Value</title> 59 <title>Return Value</title>
59 60
60 <para>On success <function>munmap()</function> returns 0, on 61 <para>On success <function>munmap()</function> returns 0, on
61 failure -1 and the <varname>errno</varname> variable is set 62 failure -1 and the <varname>errno</varname> variable is set
62 appropriately:</para> 63 appropriately:</para>
63 64
64 <variablelist> 65 <variablelist>
65 <varlistentry> 66 <varlistentry>
66 <term><errorcode>EINVAL</errorcode></term> 67 <term><errorcode>EINVAL</errorcode></term>
67 <listitem> 68 <listitem>
68 <para>The <parameter>start</parameter> or 69 <para>The <parameter>start</parameter> or
69 <parameter>length</parameter> is incorrect, or no buffers have been 70 <parameter>length</parameter> is incorrect, or no buffers have been
70 mapped yet.</para> 71 mapped yet.</para>
71 </listitem> 72 </listitem>
72 </varlistentry> 73 </varlistentry>
73 </variablelist> 74 </variablelist>
74 </refsect1> 75 </refsect1>
75 </refentry> 76 </refentry>
76 77
77 <!-- 78 <!--
78 Local Variables: 79 Local Variables:
79 mode: sgml 80 mode: sgml
80 sgml-parent-document: "v4l2.sgml" 81 sgml-parent-document: "v4l2.sgml"
81 indent-tabs-mode: nil 82 indent-tabs-mode: nil
82 End: 83 End:
83 --> 84 -->
84 85
Documentation/DocBook/v4l/io.xml
1 <title>Input/Output</title> 1 <title>Input/Output</title>
2 2
3 <para>The V4L2 API defines several different methods to read from or 3 <para>The V4L2 API defines several different methods to read from or
4 write to a device. All drivers exchanging data with applications must 4 write to a device. All drivers exchanging data with applications must
5 support at least one of them.</para> 5 support at least one of them.</para>
6 6
7 <para>The classic I/O method using the <function>read()</function> 7 <para>The classic I/O method using the <function>read()</function>
8 and <function>write()</function> function is automatically selected 8 and <function>write()</function> function is automatically selected
9 after opening a V4L2 device. When the driver does not support this 9 after opening a V4L2 device. When the driver does not support this
10 method attempts to read or write will fail at any time.</para> 10 method attempts to read or write will fail at any time.</para>
11 11
12 <para>Other methods must be negotiated. To select the streaming I/O 12 <para>Other methods must be negotiated. To select the streaming I/O
13 method with memory mapped or user buffers applications call the 13 method with memory mapped or user buffers applications call the
14 &VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined 14 &VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined
15 yet.</para> 15 yet.</para>
16 16
17 <para>Video overlay can be considered another I/O method, although 17 <para>Video overlay can be considered another I/O method, although
18 the application does not directly receive the image data. It is 18 the application does not directly receive the image data. It is
19 selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl. 19 selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl.
20 For more information see <xref linkend="overlay" />.</para> 20 For more information see <xref linkend="overlay" />.</para>
21 21
22 <para>Generally exactly one I/O method, including overlay, is 22 <para>Generally exactly one I/O method, including overlay, is
23 associated with each file descriptor. The only exceptions are 23 associated with each file descriptor. The only exceptions are
24 applications not exchanging data with a driver ("panel applications", 24 applications not exchanging data with a driver ("panel applications",
25 see <xref linkend="open" />) and drivers permitting simultaneous video capturing 25 see <xref linkend="open" />) and drivers permitting simultaneous video capturing
26 and overlay using the same file descriptor, for compatibility with V4L 26 and overlay using the same file descriptor, for compatibility with V4L
27 and earlier versions of V4L2.</para> 27 and earlier versions of V4L2.</para>
28 28
29 <para><constant>VIDIOC_S_FMT</constant> and 29 <para><constant>VIDIOC_S_FMT</constant> and
30 <constant>VIDIOC_REQBUFS</constant> would permit this to some degree, 30 <constant>VIDIOC_REQBUFS</constant> would permit this to some degree,
31 but for simplicity drivers need not support switching the I/O method 31 but for simplicity drivers need not support switching the I/O method
32 (after first switching away from read/write) other than by closing 32 (after first switching away from read/write) other than by closing
33 and reopening the device.</para> 33 and reopening the device.</para>
34 34
35 <para>The following sections describe the various I/O methods in 35 <para>The following sections describe the various I/O methods in
36 more detail.</para> 36 more detail.</para>
37 37
38 <section id="rw"> 38 <section id="rw">
39 <title>Read/Write</title> 39 <title>Read/Write</title>
40 40
41 <para>Input and output devices support the 41 <para>Input and output devices support the
42 <function>read()</function> and <function>write()</function> function, 42 <function>read()</function> and <function>write()</function> function,
43 respectively, when the <constant>V4L2_CAP_READWRITE</constant> flag in 43 respectively, when the <constant>V4L2_CAP_READWRITE</constant> flag in
44 the <structfield>capabilities</structfield> field of &v4l2-capability; 44 the <structfield>capabilities</structfield> field of &v4l2-capability;
45 returned by the &VIDIOC-QUERYCAP; ioctl is set.</para> 45 returned by the &VIDIOC-QUERYCAP; ioctl is set.</para>
46 46
47 <para>Drivers may need the CPU to copy the data, but they may also 47 <para>Drivers may need the CPU to copy the data, but they may also
48 support DMA to or from user memory, so this I/O method is not 48 support DMA to or from user memory, so this I/O method is not
49 necessarily less efficient than other methods merely exchanging buffer 49 necessarily less efficient than other methods merely exchanging buffer
50 pointers. It is considered inferior though because no meta-information 50 pointers. It is considered inferior though because no meta-information
51 like frame counters or timestamps are passed. This information is 51 like frame counters or timestamps are passed. This information is
52 necessary to recognize frame dropping and to synchronize with other 52 necessary to recognize frame dropping and to synchronize with other
53 data streams. However this is also the simplest I/O method, requiring 53 data streams. However this is also the simplest I/O method, requiring
54 little or no setup to exchange data. It permits command line stunts 54 little or no setup to exchange data. It permits command line stunts
55 like this (the <application>vidctrl</application> tool is 55 like this (the <application>vidctrl</application> tool is
56 fictitious):</para> 56 fictitious):</para>
57 57
58 <informalexample> 58 <informalexample>
59 <screen> 59 <screen>
60 &gt; vidctrl /dev/video --input=0 --format=YUYV --size=352x288 60 &gt; vidctrl /dev/video --input=0 --format=YUYV --size=352x288
61 &gt; dd if=/dev/video of=myimage.422 bs=202752 count=1 61 &gt; dd if=/dev/video of=myimage.422 bs=202752 count=1
62 </screen> 62 </screen>
63 </informalexample> 63 </informalexample>
64 64
65 <para>To read from the device applications use the 65 <para>To read from the device applications use the
66 &func-read; function, to write the &func-write; function. 66 &func-read; function, to write the &func-write; function.
67 Drivers must implement one I/O method if they 67 Drivers must implement one I/O method if they
68 exchange data with applications, but it need not be this.<footnote> 68 exchange data with applications, but it need not be this.<footnote>
69 <para>It would be desirable if applications could depend on 69 <para>It would be desirable if applications could depend on
70 drivers supporting all I/O interfaces, but as much as the complex 70 drivers supporting all I/O interfaces, but as much as the complex
71 memory mapping I/O can be inadequate for some devices we have no 71 memory mapping I/O can be inadequate for some devices we have no
72 reason to require this interface, which is most useful for simple 72 reason to require this interface, which is most useful for simple
73 applications capturing still images.</para> 73 applications capturing still images.</para>
74 </footnote> When reading or writing is supported, the driver 74 </footnote> When reading or writing is supported, the driver
75 must also support the &func-select; and &func-poll; 75 must also support the &func-select; and &func-poll;
76 function.<footnote> 76 function.<footnote>
77 <para>At the driver level <function>select()</function> and 77 <para>At the driver level <function>select()</function> and
78 <function>poll()</function> are the same, and 78 <function>poll()</function> are the same, and
79 <function>select()</function> is too important to be optional.</para> 79 <function>select()</function> is too important to be optional.</para>
80 </footnote></para> 80 </footnote></para>
81 </section> 81 </section>
82 82
83 <section id="mmap"> 83 <section id="mmap">
84 <title>Streaming I/O (Memory Mapping)</title> 84 <title>Streaming I/O (Memory Mapping)</title>
85 85
86 <para>Input and output devices support this I/O method when the 86 <para>Input and output devices support this I/O method when the
87 <constant>V4L2_CAP_STREAMING</constant> flag in the 87 <constant>V4L2_CAP_STREAMING</constant> flag in the
88 <structfield>capabilities</structfield> field of &v4l2-capability; 88 <structfield>capabilities</structfield> field of &v4l2-capability;
89 returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two 89 returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two
90 streaming methods, to determine if the memory mapping flavor is 90 streaming methods, to determine if the memory mapping flavor is
91 supported applications must call the &VIDIOC-REQBUFS; ioctl.</para> 91 supported applications must call the &VIDIOC-REQBUFS; ioctl.</para>
92 92
93 <para>Streaming is an I/O method where only pointers to buffers 93 <para>Streaming is an I/O method where only pointers to buffers
94 are exchanged between application and driver, the data itself is not 94 are exchanged between application and driver, the data itself is not
95 copied. Memory mapping is primarily intended to map buffers in device 95 copied. Memory mapping is primarily intended to map buffers in device
96 memory into the application's address space. Device memory can be for 96 memory into the application's address space. Device memory can be for
97 example the video memory on a graphics card with a video capture 97 example the video memory on a graphics card with a video capture
98 add-on. However, being the most efficient I/O method available for a 98 add-on. However, being the most efficient I/O method available for a
99 long time, many other drivers support streaming as well, allocating 99 long time, many other drivers support streaming as well, allocating
100 buffers in DMA-able main memory.</para> 100 buffers in DMA-able main memory.</para>
101 101
102 <para>A driver can support many sets of buffers. Each set is 102 <para>A driver can support many sets of buffers. Each set is
103 identified by a unique buffer type value. The sets are independent and 103 identified by a unique buffer type value. The sets are independent and
104 each set can hold a different type of data. To access different sets 104 each set can hold a different type of data. To access different sets
105 at the same time different file descriptors must be used.<footnote> 105 at the same time different file descriptors must be used.<footnote>
106 <para>One could use one file descriptor and set the buffer 106 <para>One could use one file descriptor and set the buffer
107 type field accordingly when calling &VIDIOC-QBUF; etc., but it makes 107 type field accordingly when calling &VIDIOC-QBUF; etc., but it makes
108 the <function>select()</function> function ambiguous. We also like the 108 the <function>select()</function> function ambiguous. We also like the
109 clean approach of one file descriptor per logical stream. Video 109 clean approach of one file descriptor per logical stream. Video
110 overlay for example is also a logical stream, although the CPU is not 110 overlay for example is also a logical stream, although the CPU is not
111 needed for continuous operation.</para> 111 needed for continuous operation.</para>
112 </footnote></para> 112 </footnote></para>
113 113
114 <para>To allocate device buffers applications call the 114 <para>To allocate device buffers applications call the
115 &VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer 115 &VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer
116 type, for example <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>. 116 type, for example <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>.
117 This ioctl can also be used to change the number of buffers or to free 117 This ioctl can also be used to change the number of buffers or to free
118 the allocated memory, provided none of the buffers are still 118 the allocated memory, provided none of the buffers are still
119 mapped.</para> 119 mapped.</para>
120 120
121 <para>Before applications can access the buffers they must map 121 <para>Before applications can access the buffers they must map
122 them into their address space with the &func-mmap; function. The 122 them into their address space with the &func-mmap; function. The
123 location of the buffers in device memory can be determined with the 123 location of the buffers in device memory can be determined with the
124 &VIDIOC-QUERYBUF; ioctl. The <structfield>m.offset</structfield> and 124 &VIDIOC-QUERYBUF; ioctl. In the single-planar API case, the
125 <structfield>length</structfield> returned in a &v4l2-buffer; are 125 <structfield>m.offset</structfield> and <structfield>length</structfield>
126 passed as sixth and second parameter to the 126 returned in a &v4l2-buffer; are passed as sixth and second parameter to the
127 <function>mmap()</function> function. The offset and length values 127 <function>mmap()</function> function. When using the multi-planar API,
128 must not be modified. Remember the buffers are allocated in physical 128 struct &v4l2-buffer; contains an array of &v4l2-plane; structures, each
129 memory, as opposed to virtual memory which can be swapped out to disk. 129 containing its own <structfield>m.offset</structfield> and
130 Applications should free the buffers as soon as possible with the 130 <structfield>length</structfield>. When using the multi-planar API, every
131 &func-munmap; function.</para> 131 plane of every buffer has to be mapped separately, so the number of
132 calls to &func-mmap; should be equal to number of buffers times number of
133 planes in each buffer. The offset and length values must not be modified.
134 Remember, the buffers are allocated in physical memory, as opposed to virtual
135 memory, which can be swapped out to disk. Applications should free the buffers
136 as soon as possible with the &func-munmap; function.</para>
132 137
133 <example> 138 <example>
134 <title>Mapping buffers</title> 139 <title>Mapping buffers in the single-planar API</title>
135
136 <programlisting> 140 <programlisting>
137 &v4l2-requestbuffers; reqbuf; 141 &v4l2-requestbuffers; reqbuf;
138 struct { 142 struct {
139 void *start; 143 void *start;
140 size_t length; 144 size_t length;
141 } *buffers; 145 } *buffers;
142 unsigned int i; 146 unsigned int i;
143 147
144 memset(&amp;reqbuf, 0, sizeof(reqbuf)); 148 memset(&amp;reqbuf, 0, sizeof(reqbuf));
145 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 149 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
146 reqbuf.memory = V4L2_MEMORY_MMAP; 150 reqbuf.memory = V4L2_MEMORY_MMAP;
147 reqbuf.count = 20; 151 reqbuf.count = 20;
148 152
149 if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf)) { 153 if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf)) {
150 if (errno == EINVAL) 154 if (errno == EINVAL)
151 printf("Video capturing or mmap-streaming is not supported\n"); 155 printf("Video capturing or mmap-streaming is not supported\n");
152 else 156 else
153 perror("VIDIOC_REQBUFS"); 157 perror("VIDIOC_REQBUFS");
154 158
155 exit(EXIT_FAILURE); 159 exit(EXIT_FAILURE);
156 } 160 }
157 161
158 /* We want at least five buffers. */ 162 /* We want at least five buffers. */
159 163
160 if (reqbuf.count &lt; 5) { 164 if (reqbuf.count &lt; 5) {
161 /* You may need to free the buffers here. */ 165 /* You may need to free the buffers here. */
162 printf("Not enough buffer memory\n"); 166 printf("Not enough buffer memory\n");
163 exit(EXIT_FAILURE); 167 exit(EXIT_FAILURE);
164 } 168 }
165 169
166 buffers = calloc(reqbuf.count, sizeof(*buffers)); 170 buffers = calloc(reqbuf.count, sizeof(*buffers));
167 assert(buffers != NULL); 171 assert(buffers != NULL);
168 172
169 for (i = 0; i &lt; reqbuf.count; i++) { 173 for (i = 0; i &lt; reqbuf.count; i++) {
170 &v4l2-buffer; buffer; 174 &v4l2-buffer; buffer;
171 175
172 memset(&amp;buffer, 0, sizeof(buffer)); 176 memset(&amp;buffer, 0, sizeof(buffer));
173 buffer.type = reqbuf.type; 177 buffer.type = reqbuf.type;
174 buffer.memory = V4L2_MEMORY_MMAP; 178 buffer.memory = V4L2_MEMORY_MMAP;
175 buffer.index = i; 179 buffer.index = i;
176 180
177 if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &amp;buffer)) { 181 if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &amp;buffer)) {
178 perror("VIDIOC_QUERYBUF"); 182 perror("VIDIOC_QUERYBUF");
179 exit(EXIT_FAILURE); 183 exit(EXIT_FAILURE);
180 } 184 }
181 185
182 buffers[i].length = buffer.length; /* remember for munmap() */ 186 buffers[i].length = buffer.length; /* remember for munmap() */
183 187
184 buffers[i].start = mmap(NULL, buffer.length, 188 buffers[i].start = mmap(NULL, buffer.length,
185 PROT_READ | PROT_WRITE, /* recommended */ 189 PROT_READ | PROT_WRITE, /* recommended */
186 MAP_SHARED, /* recommended */ 190 MAP_SHARED, /* recommended */
187 fd, buffer.m.offset); 191 fd, buffer.m.offset);
188 192
189 if (MAP_FAILED == buffers[i].start) { 193 if (MAP_FAILED == buffers[i].start) {
190 /* If you do not exit here you should unmap() and free() 194 /* If you do not exit here you should unmap() and free()
191 the buffers mapped so far. */ 195 the buffers mapped so far. */
192 perror("mmap"); 196 perror("mmap");
193 exit(EXIT_FAILURE); 197 exit(EXIT_FAILURE);
194 } 198 }
195 } 199 }
196 200
197 /* Cleanup. */ 201 /* Cleanup. */
198 202
199 for (i = 0; i &lt; reqbuf.count; i++) 203 for (i = 0; i &lt; reqbuf.count; i++)
200 munmap(buffers[i].start, buffers[i].length); 204 munmap(buffers[i].start, buffers[i].length);
201 </programlisting> 205 </programlisting>
202 </example> 206 </example>
203 207
208 <example>
209 <title>Mapping buffers in the multi-planar API</title>
210 <programlisting>
211 &v4l2-requestbuffers; reqbuf;
212 /* Our current format uses 3 planes per buffer */
213 #define FMT_NUM_PLANES = 3;
214
215 struct {
216 void *start[FMT_NUM_PLANES];
217 size_t length[FMT_NUM_PLANES];
218 } *buffers;
219 unsigned int i, j;
220
221 memset(&amp;reqbuf, 0, sizeof(reqbuf));
222 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
223 reqbuf.memory = V4L2_MEMORY_MMAP;
224 reqbuf.count = 20;
225
226 if (ioctl(fd, &VIDIOC-REQBUFS;, &amp;reqbuf) &lt; 0) {
227 if (errno == EINVAL)
228 printf("Video capturing or mmap-streaming is not supported\n");
229 else
230 perror("VIDIOC_REQBUFS");
231
232 exit(EXIT_FAILURE);
233 }
234
235 /* We want at least five buffers. */
236
237 if (reqbuf.count &lt; 5) {
238 /* You may need to free the buffers here. */
239 printf("Not enough buffer memory\n");
240 exit(EXIT_FAILURE);
241 }
242
243 buffers = calloc(reqbuf.count, sizeof(*buffers));
244 assert(buffers != NULL);
245
246 for (i = 0; i &lt; reqbuf.count; i++) {
247 &v4l2-buffer; buffer;
248 &v4l2-plane; planes[FMT_NUM_PLANES];
249
250 memset(&amp;buffer, 0, sizeof(buffer));
251 buffer.type = reqbuf.type;
252 buffer.memory = V4L2_MEMORY_MMAP;
253 buffer.index = i;
254 /* length in struct v4l2_buffer in multi-planar API stores the size
255 * of planes array. */
256 buffer.length = FMT_NUM_PLANES;
257 buffer.m.planes = planes;
258
259 if (ioctl(fd, &VIDIOC-QUERYBUF;, &amp;buffer) &lt; 0) {
260 perror("VIDIOC_QUERYBUF");
261 exit(EXIT_FAILURE);
262 }
263
264 /* Every plane has to be mapped separately */
265 for (j = 0; j &lt; FMT_NUM_PLANES; j++) {
266 buffers[i].length[j] = buffer.m.planes[j].length; /* remember for munmap() */
267
268 buffers[i].start[j] = mmap(NULL, buffer.m.planes[j].length,
269 PROT_READ | PROT_WRITE, /* recommended */
270 MAP_SHARED, /* recommended */
271 fd, buffer.m.planes[j].m.offset);
272
273 if (MAP_FAILED == buffers[i].start[j]) {
274 /* If you do not exit here you should unmap() and free()
275 the buffers and planes mapped so far. */
276 perror("mmap");
277 exit(EXIT_FAILURE);
278 }
279 }
280 }
281
282 /* Cleanup. */
283
284 for (i = 0; i &lt; reqbuf.count; i++)
285 for (j = 0; j &lt; FMT_NUM_PLANES; j++)
286 munmap(buffers[i].start[j], buffers[i].length[j]);
287 </programlisting>
288 </example>
289
204 <para>Conceptually streaming drivers maintain two buffer queues, an incoming 290 <para>Conceptually streaming drivers maintain two buffer queues, an incoming
205 and an outgoing queue. They separate the synchronous capture or output 291 and an outgoing queue. They separate the synchronous capture or output
206 operation locked to a video clock from the application which is 292 operation locked to a video clock from the application which is
207 subject to random disk or network delays and preemption by 293 subject to random disk or network delays and preemption by
208 other processes, thereby reducing the probability of data loss. 294 other processes, thereby reducing the probability of data loss.
209 The queues are organized as FIFOs, buffers will be 295 The queues are organized as FIFOs, buffers will be
210 output in the order enqueued in the incoming FIFO, and were 296 output in the order enqueued in the incoming FIFO, and were
211 captured in the order dequeued from the outgoing FIFO.</para> 297 captured in the order dequeued from the outgoing FIFO.</para>
212 298
213 <para>The driver may require a minimum number of buffers enqueued 299 <para>The driver may require a minimum number of buffers enqueued
214 at all times to function, apart of this no limit exists on the number 300 at all times to function, apart of this no limit exists on the number
215 of buffers applications can enqueue in advance, or dequeue and 301 of buffers applications can enqueue in advance, or dequeue and
216 process. They can also enqueue in a different order than buffers have 302 process. They can also enqueue in a different order than buffers have
217 been dequeued, and the driver can <emphasis>fill</emphasis> enqueued 303 been dequeued, and the driver can <emphasis>fill</emphasis> enqueued
218 <emphasis>empty</emphasis> buffers in any order. <footnote> 304 <emphasis>empty</emphasis> buffers in any order. <footnote>
219 <para>Random enqueue order permits applications processing 305 <para>Random enqueue order permits applications processing
220 images out of order (such as video codecs) to return buffers earlier, 306 images out of order (such as video codecs) to return buffers earlier,
221 reducing the probability of data loss. Random fill order allows 307 reducing the probability of data loss. Random fill order allows
222 drivers to reuse buffers on a LIFO-basis, taking advantage of caches 308 drivers to reuse buffers on a LIFO-basis, taking advantage of caches
223 holding scatter-gather lists and the like.</para> 309 holding scatter-gather lists and the like.</para>
224 </footnote> The index number of a buffer (&v4l2-buffer; 310 </footnote> The index number of a buffer (&v4l2-buffer;
225 <structfield>index</structfield>) plays no role here, it only 311 <structfield>index</structfield>) plays no role here, it only
226 identifies the buffer.</para> 312 identifies the buffer.</para>
227 313
228 <para>Initially all mapped buffers are in dequeued state, 314 <para>Initially all mapped buffers are in dequeued state,
229 inaccessible by the driver. For capturing applications it is customary 315 inaccessible by the driver. For capturing applications it is customary
230 to first enqueue all mapped buffers, then to start capturing and enter 316 to first enqueue all mapped buffers, then to start capturing and enter
231 the read loop. Here the application waits until a filled buffer can be 317 the read loop. Here the application waits until a filled buffer can be
232 dequeued, and re-enqueues the buffer when the data is no longer 318 dequeued, and re-enqueues the buffer when the data is no longer
233 needed. Output applications fill and enqueue buffers, when enough 319 needed. Output applications fill and enqueue buffers, when enough
234 buffers are stacked up the output is started with 320 buffers are stacked up the output is started with
235 <constant>VIDIOC_STREAMON</constant>. In the write loop, when 321 <constant>VIDIOC_STREAMON</constant>. In the write loop, when
236 the application runs out of free buffers, it must wait until an empty 322 the application runs out of free buffers, it must wait until an empty
237 buffer can be dequeued and reused.</para> 323 buffer can be dequeued and reused.</para>
238 324
239 <para>To enqueue and dequeue a buffer applications use the 325 <para>To enqueue and dequeue a buffer applications use the
240 &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being 326 &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being
241 mapped, enqueued, full or empty can be determined at any time using the 327 mapped, enqueued, full or empty can be determined at any time using the
242 &VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the 328 &VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the
243 application until one or more buffers can be dequeued. By default 329 application until one or more buffers can be dequeued. By default
244 <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the 330 <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
245 outgoing queue. When the <constant>O_NONBLOCK</constant> flag was 331 outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
246 given to the &func-open; function, <constant>VIDIOC_DQBUF</constant> 332 given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
247 returns immediately with an &EAGAIN; when no buffer is available. The 333 returns immediately with an &EAGAIN; when no buffer is available. The
248 &func-select; or &func-poll; function are always available.</para> 334 &func-select; or &func-poll; function are always available.</para>
249 335
250 <para>To start and stop capturing or output applications call the 336 <para>To start and stop capturing or output applications call the
251 &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note 337 &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
252 <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both 338 <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
253 queues as a side effect. Since there is no notion of doing anything 339 queues as a side effect. Since there is no notion of doing anything
254 "now" on a multitasking system, if an application needs to synchronize 340 "now" on a multitasking system, if an application needs to synchronize
255 with another event it should examine the &v4l2-buffer; 341 with another event it should examine the &v4l2-buffer;
256 <structfield>timestamp</structfield> of captured buffers, or set the 342 <structfield>timestamp</structfield> of captured buffers, or set the
257 field before enqueuing buffers for output.</para> 343 field before enqueuing buffers for output.</para>
258 344
259 <para>Drivers implementing memory mapping I/O must 345 <para>Drivers implementing memory mapping I/O must
260 support the <constant>VIDIOC_REQBUFS</constant>, 346 support the <constant>VIDIOC_REQBUFS</constant>,
261 <constant>VIDIOC_QUERYBUF</constant>, 347 <constant>VIDIOC_QUERYBUF</constant>,
262 <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>, 348 <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
263 <constant>VIDIOC_STREAMON</constant> and 349 <constant>VIDIOC_STREAMON</constant> and
264 <constant>VIDIOC_STREAMOFF</constant> ioctl, the 350 <constant>VIDIOC_STREAMOFF</constant> ioctl, the
265 <function>mmap()</function>, <function>munmap()</function>, 351 <function>mmap()</function>, <function>munmap()</function>,
266 <function>select()</function> and <function>poll()</function> 352 <function>select()</function> and <function>poll()</function>
267 function.<footnote> 353 function.<footnote>
268 <para>At the driver level <function>select()</function> and 354 <para>At the driver level <function>select()</function> and
269 <function>poll()</function> are the same, and 355 <function>poll()</function> are the same, and
270 <function>select()</function> is too important to be optional. The 356 <function>select()</function> is too important to be optional. The
271 rest should be evident.</para> 357 rest should be evident.</para>
272 </footnote></para> 358 </footnote></para>
273 359
274 <para>[capture example]</para> 360 <para>[capture example]</para>
275 361
276 </section> 362 </section>
277 363
278 <section id="userp"> 364 <section id="userp">
279 <title>Streaming I/O (User Pointers)</title> 365 <title>Streaming I/O (User Pointers)</title>
280 366
281 <para>Input and output devices support this I/O method when the 367 <para>Input and output devices support this I/O method when the
282 <constant>V4L2_CAP_STREAMING</constant> flag in the 368 <constant>V4L2_CAP_STREAMING</constant> flag in the
283 <structfield>capabilities</structfield> field of &v4l2-capability; 369 <structfield>capabilities</structfield> field of &v4l2-capability;
284 returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user 370 returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user
285 pointer method (not only memory mapping) is supported must be 371 pointer method (not only memory mapping) is supported must be
286 determined by calling the &VIDIOC-REQBUFS; ioctl.</para> 372 determined by calling the &VIDIOC-REQBUFS; ioctl.</para>
287 373
288 <para>This I/O method combines advantages of the read/write and 374 <para>This I/O method combines advantages of the read/write and
289 memory mapping methods. Buffers are allocated by the application 375 memory mapping methods. Buffers (planes) are allocated by the application
290 itself, and can reside for example in virtual or shared memory. Only 376 itself, and can reside for example in virtual or shared memory. Only
291 pointers to data are exchanged, these pointers and meta-information 377 pointers to data are exchanged, these pointers and meta-information
292 are passed in &v4l2-buffer;. The driver must be switched 378 are passed in &v4l2-buffer; (or in &v4l2-plane; in the multi-planar API case).
293 into user pointer I/O mode by calling the &VIDIOC-REQBUFS; with the 379 The driver must be switched into user pointer I/O mode by calling the
294 desired buffer type. No buffers are allocated beforehands, 380 &VIDIOC-REQBUFS; with the desired buffer type. No buffers (planes) are allocated
295 consequently they are not indexed and cannot be queried like mapped 381 beforehand, consequently they are not indexed and cannot be queried like mapped
296 buffers with the <constant>VIDIOC_QUERYBUF</constant> ioctl.</para> 382 buffers with the <constant>VIDIOC_QUERYBUF</constant> ioctl.</para>
297 383
298 <example> 384 <example>
299 <title>Initiating streaming I/O with user pointers</title> 385 <title>Initiating streaming I/O with user pointers</title>
300 386
301 <programlisting> 387 <programlisting>
302 &v4l2-requestbuffers; reqbuf; 388 &v4l2-requestbuffers; reqbuf;
303 389
304 memset (&amp;reqbuf, 0, sizeof (reqbuf)); 390 memset (&amp;reqbuf, 0, sizeof (reqbuf));
305 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 391 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
306 reqbuf.memory = V4L2_MEMORY_USERPTR; 392 reqbuf.memory = V4L2_MEMORY_USERPTR;
307 393
308 if (ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf) == -1) { 394 if (ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf) == -1) {
309 if (errno == EINVAL) 395 if (errno == EINVAL)
310 printf ("Video capturing or user pointer streaming is not supported\n"); 396 printf ("Video capturing or user pointer streaming is not supported\n");
311 else 397 else
312 perror ("VIDIOC_REQBUFS"); 398 perror ("VIDIOC_REQBUFS");
313 399
314 exit (EXIT_FAILURE); 400 exit (EXIT_FAILURE);
315 } 401 }
316 </programlisting> 402 </programlisting>
317 </example> 403 </example>
318 404
319 <para>Buffer addresses and sizes are passed on the fly with the 405 <para>Buffer (plane) addresses and sizes are passed on the fly with the
320 &VIDIOC-QBUF; ioctl. Although buffers are commonly cycled, 406 &VIDIOC-QBUF; ioctl. Although buffers are commonly cycled,
321 applications can pass different addresses and sizes at each 407 applications can pass different addresses and sizes at each
322 <constant>VIDIOC_QBUF</constant> call. If required by the hardware the 408 <constant>VIDIOC_QBUF</constant> call. If required by the hardware the
323 driver swaps memory pages within physical memory to create a 409 driver swaps memory pages within physical memory to create a
324 continuous area of memory. This happens transparently to the 410 continuous area of memory. This happens transparently to the
325 application in the virtual memory subsystem of the kernel. When buffer 411 application in the virtual memory subsystem of the kernel. When buffer
326 pages have been swapped out to disk they are brought back and finally 412 pages have been swapped out to disk they are brought back and finally
327 locked in physical memory for DMA.<footnote> 413 locked in physical memory for DMA.<footnote>
328 <para>We expect that frequently used buffers are typically not 414 <para>We expect that frequently used buffers are typically not
329 swapped out. Anyway, the process of swapping, locking or generating 415 swapped out. Anyway, the process of swapping, locking or generating
330 scatter-gather lists may be time consuming. The delay can be masked by 416 scatter-gather lists may be time consuming. The delay can be masked by
331 the depth of the incoming buffer queue, and perhaps by maintaining 417 the depth of the incoming buffer queue, and perhaps by maintaining
332 caches assuming a buffer will be soon enqueued again. On the other 418 caches assuming a buffer will be soon enqueued again. On the other
333 hand, to optimize memory usage drivers can limit the number of buffers 419 hand, to optimize memory usage drivers can limit the number of buffers
334 locked in advance and recycle the most recently used buffers first. Of 420 locked in advance and recycle the most recently used buffers first. Of
335 course, the pages of empty buffers in the incoming queue need not be 421 course, the pages of empty buffers in the incoming queue need not be
336 saved to disk. Output buffers must be saved on the incoming and 422 saved to disk. Output buffers must be saved on the incoming and
337 outgoing queue because an application may share them with other 423 outgoing queue because an application may share them with other
338 processes.</para> 424 processes.</para>
339 </footnote></para> 425 </footnote></para>
340 426
341 <para>Filled or displayed buffers are dequeued with the 427 <para>Filled or displayed buffers are dequeued with the
342 &VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any 428 &VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any
343 time between the completion of the DMA and this ioctl. The memory is 429 time between the completion of the DMA and this ioctl. The memory is
344 also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or 430 also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or
345 when the device is closed. Applications must take care not to free 431 when the device is closed. Applications must take care not to free
346 buffers without dequeuing. For once, the buffers remain locked until 432 buffers without dequeuing. For once, the buffers remain locked until
347 further, wasting physical memory. Second the driver will not be 433 further, wasting physical memory. Second the driver will not be
348 notified when the memory is returned to the application's free list 434 notified when the memory is returned to the application's free list
349 and subsequently reused for other purposes, possibly completing the 435 and subsequently reused for other purposes, possibly completing the
350 requested DMA and overwriting valuable data.</para> 436 requested DMA and overwriting valuable data.</para>
351 437
352 <para>For capturing applications it is customary to enqueue a 438 <para>For capturing applications it is customary to enqueue a
353 number of empty buffers, to start capturing and enter the read loop. 439 number of empty buffers, to start capturing and enter the read loop.
354 Here the application waits until a filled buffer can be dequeued, and 440 Here the application waits until a filled buffer can be dequeued, and
355 re-enqueues the buffer when the data is no longer needed. Output 441 re-enqueues the buffer when the data is no longer needed. Output
356 applications fill and enqueue buffers, when enough buffers are stacked 442 applications fill and enqueue buffers, when enough buffers are stacked
357 up output is started. In the write loop, when the application 443 up output is started. In the write loop, when the application
358 runs out of free buffers it must wait until an empty buffer can be 444 runs out of free buffers it must wait until an empty buffer can be
359 dequeued and reused. Two methods exist to suspend execution of the 445 dequeued and reused. Two methods exist to suspend execution of the
360 application until one or more buffers can be dequeued. By default 446 application until one or more buffers can be dequeued. By default
361 <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the 447 <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
362 outgoing queue. When the <constant>O_NONBLOCK</constant> flag was 448 outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
363 given to the &func-open; function, <constant>VIDIOC_DQBUF</constant> 449 given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
364 returns immediately with an &EAGAIN; when no buffer is available. The 450 returns immediately with an &EAGAIN; when no buffer is available. The
365 &func-select; or &func-poll; function are always available.</para> 451 &func-select; or &func-poll; function are always available.</para>
366 452
367 <para>To start and stop capturing or output applications call the 453 <para>To start and stop capturing or output applications call the
368 &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note 454 &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
369 <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both 455 <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
370 queues and unlocks all buffers as a side effect. Since there is no 456 queues and unlocks all buffers as a side effect. Since there is no
371 notion of doing anything "now" on a multitasking system, if an 457 notion of doing anything "now" on a multitasking system, if an
372 application needs to synchronize with another event it should examine 458 application needs to synchronize with another event it should examine
373 the &v4l2-buffer; <structfield>timestamp</structfield> of captured 459 the &v4l2-buffer; <structfield>timestamp</structfield> of captured
374 buffers, or set the field before enqueuing buffers for output.</para> 460 buffers, or set the field before enqueuing buffers for output.</para>
375 461
376 <para>Drivers implementing user pointer I/O must 462 <para>Drivers implementing user pointer I/O must
377 support the <constant>VIDIOC_REQBUFS</constant>, 463 support the <constant>VIDIOC_REQBUFS</constant>,
378 <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>, 464 <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
379 <constant>VIDIOC_STREAMON</constant> and 465 <constant>VIDIOC_STREAMON</constant> and
380 <constant>VIDIOC_STREAMOFF</constant> ioctl, the 466 <constant>VIDIOC_STREAMOFF</constant> ioctl, the
381 <function>select()</function> and <function>poll()</function> function.<footnote> 467 <function>select()</function> and <function>poll()</function> function.<footnote>
382 <para>At the driver level <function>select()</function> and 468 <para>At the driver level <function>select()</function> and
383 <function>poll()</function> are the same, and 469 <function>poll()</function> are the same, and
384 <function>select()</function> is too important to be optional. The 470 <function>select()</function> is too important to be optional. The
385 rest should be evident.</para> 471 rest should be evident.</para>
386 </footnote></para> 472 </footnote></para>
387 </section> 473 </section>
388 474
389 <section id="async"> 475 <section id="async">
390 <title>Asynchronous I/O</title> 476 <title>Asynchronous I/O</title>
391 477
392 <para>This method is not defined yet.</para> 478 <para>This method is not defined yet.</para>
393 </section> 479 </section>
394 480
395 <section id="buffer"> 481 <section id="buffer">
396 <title>Buffers</title> 482 <title>Buffers</title>
397 483
398 <para>A buffer contains data exchanged by application and 484 <para>A buffer contains data exchanged by application and
399 driver using one of the Streaming I/O methods. Only pointers to 485 driver using one of the Streaming I/O methods. In the multi-planar API, the
400 buffers are exchanged, the data itself is not copied. These pointers, 486 data is held in planes, while the buffer structure acts as a container
401 together with meta-information like timestamps or field parity, are 487 for the planes. Only pointers to buffers (planes) are exchanged, the data
402 stored in a struct <structname>v4l2_buffer</structname>, argument to 488 itself is not copied. These pointers, together with meta-information like
403 the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl.</para> 489 timestamps or field parity, are stored in a struct
490 <structname>v4l2_buffer</structname>, argument to
491 the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl.
492 In the multi-planar API, some plane-specific members of struct
493 <structname>v4l2_buffer</structname>, such as pointers and sizes for each
494 plane, are stored in struct <structname>v4l2_plane</structname> instead.
495 In that case, struct <structname>v4l2_buffer</structname> contains an array of
496 plane structures.</para>
404 497
405 <para>Nominally timestamps refer to the first data byte transmitted. 498 <para>Nominally timestamps refer to the first data byte transmitted.
406 In practice however the wide range of hardware covered by the V4L2 API 499 In practice however the wide range of hardware covered by the V4L2 API
407 limits timestamp accuracy. Often an interrupt routine will 500 limits timestamp accuracy. Often an interrupt routine will
408 sample the system clock shortly after the field or frame was stored 501 sample the system clock shortly after the field or frame was stored
409 completely in memory. So applications must expect a constant 502 completely in memory. So applications must expect a constant
410 difference up to one field or frame period plus a small (few scan 503 difference up to one field or frame period plus a small (few scan
411 lines) random error. The delay and error can be much 504 lines) random error. The delay and error can be much
412 larger due to compression or transmission over an external bus when 505 larger due to compression or transmission over an external bus when
413 the frames are not properly stamped by the sender. This is frequently 506 the frames are not properly stamped by the sender. This is frequently
414 the case with USB cameras. Here timestamps refer to the instant the 507 the case with USB cameras. Here timestamps refer to the instant the
415 field or frame was received by the driver, not the capture time. These 508 field or frame was received by the driver, not the capture time. These
416 devices identify by not enumerating any video standards, see <xref 509 devices identify by not enumerating any video standards, see <xref
417 linkend="standard" />.</para> 510 linkend="standard" />.</para>
418 511
419 <para>Similar limitations apply to output timestamps. Typically 512 <para>Similar limitations apply to output timestamps. Typically
420 the video hardware locks to a clock controlling the video timing, the 513 the video hardware locks to a clock controlling the video timing, the
421 horizontal and vertical synchronization pulses. At some point in the 514 horizontal and vertical synchronization pulses. At some point in the
422 line sequence, possibly the vertical blanking, an interrupt routine 515 line sequence, possibly the vertical blanking, an interrupt routine
423 samples the system clock, compares against the timestamp and programs 516 samples the system clock, compares against the timestamp and programs
424 the hardware to repeat the previous field or frame, or to display the 517 the hardware to repeat the previous field or frame, or to display the
425 buffer contents.</para> 518 buffer contents.</para>
426 519
427 <para>Apart of limitations of the video device and natural 520 <para>Apart of limitations of the video device and natural
428 inaccuracies of all clocks, it should be noted system time itself is 521 inaccuracies of all clocks, it should be noted system time itself is
429 not perfectly stable. It can be affected by power saving cycles, 522 not perfectly stable. It can be affected by power saving cycles,
430 warped to insert leap seconds, or even turned back or forth by the 523 warped to insert leap seconds, or even turned back or forth by the
431 system administrator affecting long term measurements. <footnote> 524 system administrator affecting long term measurements. <footnote>
432 <para>Since no other Linux multimedia 525 <para>Since no other Linux multimedia
433 API supports unadjusted time it would be foolish to introduce here. We 526 API supports unadjusted time it would be foolish to introduce here. We
434 must use a universally supported clock to synchronize different media, 527 must use a universally supported clock to synchronize different media,
435 hence time of day.</para> 528 hence time of day.</para>
436 </footnote></para> 529 </footnote></para>
437 530
438 <table frame="none" pgwide="1" id="v4l2-buffer"> 531 <table frame="none" pgwide="1" id="v4l2-buffer">
439 <title>struct <structname>v4l2_buffer</structname></title> 532 <title>struct <structname>v4l2_buffer</structname></title>
440 <tgroup cols="4"> 533 <tgroup cols="4">
441 &cs-ustr; 534 &cs-ustr;
442 <tbody valign="top"> 535 <tbody valign="top">
443 <row> 536 <row>
444 <entry>__u32</entry> 537 <entry>__u32</entry>
445 <entry><structfield>index</structfield></entry> 538 <entry><structfield>index</structfield></entry>
446 <entry></entry> 539 <entry></entry>
447 <entry>Number of the buffer, set by the application. This 540 <entry>Number of the buffer, set by the application. This
448 field is only used for <link linkend="mmap">memory mapping</link> I/O 541 field is only used for <link linkend="mmap">memory mapping</link> I/O
449 and can range from zero to the number of buffers allocated 542 and can range from zero to the number of buffers allocated
450 with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry> 543 with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry>
451 </row> 544 </row>
452 <row> 545 <row>
453 <entry>&v4l2-buf-type;</entry> 546 <entry>&v4l2-buf-type;</entry>
454 <entry><structfield>type</structfield></entry> 547 <entry><structfield>type</structfield></entry>
455 <entry></entry> 548 <entry></entry>
456 <entry>Type of the buffer, same as &v4l2-format; 549 <entry>Type of the buffer, same as &v4l2-format;
457 <structfield>type</structfield> or &v4l2-requestbuffers; 550 <structfield>type</structfield> or &v4l2-requestbuffers;
458 <structfield>type</structfield>, set by the application.</entry> 551 <structfield>type</structfield>, set by the application.</entry>
459 </row> 552 </row>
460 <row> 553 <row>
461 <entry>__u32</entry> 554 <entry>__u32</entry>
462 <entry><structfield>bytesused</structfield></entry> 555 <entry><structfield>bytesused</structfield></entry>
463 <entry></entry> 556 <entry></entry>
464 <entry>The number of bytes occupied by the data in the 557 <entry>The number of bytes occupied by the data in the
465 buffer. It depends on the negotiated data format and may change with 558 buffer. It depends on the negotiated data format and may change with
466 each buffer for compressed variable size data like JPEG images. 559 each buffer for compressed variable size data like JPEG images.
467 Drivers must set this field when <structfield>type</structfield> 560 Drivers must set this field when <structfield>type</structfield>
468 refers to an input stream, applications when an output stream.</entry> 561 refers to an input stream, applications when an output stream.</entry>
469 </row> 562 </row>
470 <row> 563 <row>
471 <entry>__u32</entry> 564 <entry>__u32</entry>
472 <entry><structfield>flags</structfield></entry> 565 <entry><structfield>flags</structfield></entry>
473 <entry></entry> 566 <entry></entry>
474 <entry>Flags set by the application or driver, see <xref 567 <entry>Flags set by the application or driver, see <xref
475 linkend="buffer-flags" />.</entry> 568 linkend="buffer-flags" />.</entry>
476 </row> 569 </row>
477 <row> 570 <row>
478 <entry>&v4l2-field;</entry> 571 <entry>&v4l2-field;</entry>
479 <entry><structfield>field</structfield></entry> 572 <entry><structfield>field</structfield></entry>
480 <entry></entry> 573 <entry></entry>
481 <entry>Indicates the field order of the image in the 574 <entry>Indicates the field order of the image in the
482 buffer, see <xref linkend="v4l2-field" />. This field is not used when 575 buffer, see <xref linkend="v4l2-field" />. This field is not used when
483 the buffer contains VBI data. Drivers must set it when 576 the buffer contains VBI data. Drivers must set it when
484 <structfield>type</structfield> refers to an input stream, 577 <structfield>type</structfield> refers to an input stream,
485 applications when an output stream.</entry> 578 applications when an output stream.</entry>
486 </row> 579 </row>
487 <row> 580 <row>
488 <entry>struct timeval</entry> 581 <entry>struct timeval</entry>
489 <entry><structfield>timestamp</structfield></entry> 582 <entry><structfield>timestamp</structfield></entry>
490 <entry></entry> 583 <entry></entry>
491 <entry><para>For input streams this is the 584 <entry><para>For input streams this is the
492 system time (as returned by the <function>gettimeofday()</function> 585 system time (as returned by the <function>gettimeofday()</function>
493 function) when the first data byte was captured. For output streams 586 function) when the first data byte was captured. For output streams
494 the data will not be displayed before this time, secondary to the 587 the data will not be displayed before this time, secondary to the
495 nominal frame rate determined by the current video standard in 588 nominal frame rate determined by the current video standard in
496 enqueued order. Applications can for example zero this field to 589 enqueued order. Applications can for example zero this field to
497 display frames as soon as possible. The driver stores the time at 590 display frames as soon as possible. The driver stores the time at
498 which the first data byte was actually sent out in the 591 which the first data byte was actually sent out in the
499 <structfield>timestamp</structfield> field. This permits 592 <structfield>timestamp</structfield> field. This permits
500 applications to monitor the drift between the video and system 593 applications to monitor the drift between the video and system
501 clock.</para></entry> 594 clock.</para></entry>
502 </row> 595 </row>
503 <row> 596 <row>
504 <entry>&v4l2-timecode;</entry> 597 <entry>&v4l2-timecode;</entry>
505 <entry><structfield>timecode</structfield></entry> 598 <entry><structfield>timecode</structfield></entry>
506 <entry></entry> 599 <entry></entry>
507 <entry>When <structfield>type</structfield> is 600 <entry>When <structfield>type</structfield> is
508 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> and the 601 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> and the
509 <constant>V4L2_BUF_FLAG_TIMECODE</constant> flag is set in 602 <constant>V4L2_BUF_FLAG_TIMECODE</constant> flag is set in
510 <structfield>flags</structfield>, this structure contains a frame 603 <structfield>flags</structfield>, this structure contains a frame
511 timecode. In <link linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link> 604 timecode. In <link linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link>
512 mode the top and bottom field contain the same timecode. 605 mode the top and bottom field contain the same timecode.
513 Timecodes are intended to help video editing and are typically recorded on 606 Timecodes are intended to help video editing and are typically recorded on
514 video tapes, but also embedded in compressed formats like MPEG. This 607 video tapes, but also embedded in compressed formats like MPEG. This
515 field is independent of the <structfield>timestamp</structfield> and 608 field is independent of the <structfield>timestamp</structfield> and
516 <structfield>sequence</structfield> fields.</entry> 609 <structfield>sequence</structfield> fields.</entry>
517 </row> 610 </row>
518 <row> 611 <row>
519 <entry>__u32</entry> 612 <entry>__u32</entry>
520 <entry><structfield>sequence</structfield></entry> 613 <entry><structfield>sequence</structfield></entry>
521 <entry></entry> 614 <entry></entry>
522 <entry>Set by the driver, counting the frames in the 615 <entry>Set by the driver, counting the frames in the
523 sequence.</entry> 616 sequence.</entry>
524 </row> 617 </row>
525 <row> 618 <row>
526 <entry spanname="hspan"><para>In <link 619 <entry spanname="hspan"><para>In <link
527 linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link> mode the top and 620 linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link> mode the top and
528 bottom field have the same sequence number. The count starts at zero 621 bottom field have the same sequence number. The count starts at zero
529 and includes dropped or repeated frames. A dropped frame was received 622 and includes dropped or repeated frames. A dropped frame was received
530 by an input device but could not be stored due to lack of free buffer 623 by an input device but could not be stored due to lack of free buffer
531 space. A repeated frame was displayed again by an output device 624 space. A repeated frame was displayed again by an output device
532 because the application did not pass new data in 625 because the application did not pass new data in
533 time.</para><para>Note this may count the frames received 626 time.</para><para>Note this may count the frames received
534 e.g. over USB, without taking into account the frames dropped by the 627 e.g. over USB, without taking into account the frames dropped by the
535 remote hardware due to limited compression throughput or bus 628 remote hardware due to limited compression throughput or bus
536 bandwidth. These devices identify by not enumerating any video 629 bandwidth. These devices identify by not enumerating any video
537 standards, see <xref linkend="standard" />.</para></entry> 630 standards, see <xref linkend="standard" />.</para></entry>
538 </row> 631 </row>
539 <row> 632 <row>
540 <entry>&v4l2-memory;</entry> 633 <entry>&v4l2-memory;</entry>
541 <entry><structfield>memory</structfield></entry> 634 <entry><structfield>memory</structfield></entry>
542 <entry></entry> 635 <entry></entry>
543 <entry>This field must be set by applications and/or drivers 636 <entry>This field must be set by applications and/or drivers
544 in accordance with the selected I/O method.</entry> 637 in accordance with the selected I/O method.</entry>
545 </row> 638 </row>
546 <row> 639 <row>
547 <entry>union</entry> 640 <entry>union</entry>
548 <entry><structfield>m</structfield></entry> 641 <entry><structfield>m</structfield></entry>
549 </row> 642 </row>
550 <row> 643 <row>
551 <entry></entry> 644 <entry></entry>
552 <entry>__u32</entry> 645 <entry>__u32</entry>
553 <entry><structfield>offset</structfield></entry> 646 <entry><structfield>offset</structfield></entry>
554 <entry>When <structfield>memory</structfield> is 647 <entry>For the single-planar API and when
555 <constant>V4L2_MEMORY_MMAP</constant> this is the offset of the buffer 648 <structfield>memory</structfield> is <constant>V4L2_MEMORY_MMAP</constant> this
556 from the start of the device memory. The value is returned by the 649 is the offset of the buffer from the start of the device memory. The value is
557 driver and apart of serving as parameter to the &func-mmap; function 650 returned by the driver and apart of serving as parameter to the &func-mmap;
558 not useful for applications. See <xref linkend="mmap" /> for details.</entry> 651 function not useful for applications. See <xref linkend="mmap" /> for details
652 </entry>
559 </row> 653 </row>
560 <row> 654 <row>
561 <entry></entry> 655 <entry></entry>
562 <entry>unsigned long</entry> 656 <entry>unsigned long</entry>
563 <entry><structfield>userptr</structfield></entry> 657 <entry><structfield>userptr</structfield></entry>
564 <entry>When <structfield>memory</structfield> is 658 <entry>For the single-planar API and when
565 <constant>V4L2_MEMORY_USERPTR</constant> this is a pointer to the 659 <structfield>memory</structfield> is <constant>V4L2_MEMORY_USERPTR</constant>
566 buffer (casted to unsigned long type) in virtual memory, set by the 660 this is a pointer to the buffer (casted to unsigned long type) in virtual
567 application. See <xref linkend="userp" /> for details.</entry> 661 memory, set by the application. See <xref linkend="userp" /> for details.
662 </entry>
568 </row> 663 </row>
569 <row> 664 <row>
665 <entry></entry>
666 <entry>struct v4l2_plane</entry>
667 <entry><structfield>*planes</structfield></entry>
668 <entry>When using the multi-planar API, contains a userspace pointer
669 to an array of &v4l2-plane;. The size of the array should be put
670 in the <structfield>length</structfield> field of this
671 <structname>v4l2_buffer</structname> structure.</entry>
672 </row>
673 <row>
570 <entry>__u32</entry> 674 <entry>__u32</entry>
571 <entry><structfield>length</structfield></entry> 675 <entry><structfield>length</structfield></entry>
572 <entry></entry> 676 <entry></entry>
573 <entry>Size of the buffer (not the payload) in bytes.</entry> 677 <entry>Size of the buffer (not the payload) in bytes for the
678 single-planar API. For the multi-planar API should contain the
679 number of elements in the <structfield>planes</structfield> array.
680 </entry>
574 </row> 681 </row>
575 <row> 682 <row>
576 <entry>__u32</entry> 683 <entry>__u32</entry>
577 <entry><structfield>input</structfield></entry> 684 <entry><structfield>input</structfield></entry>
578 <entry></entry> 685 <entry></entry>
579 <entry>Some video capture drivers support rapid and 686 <entry>Some video capture drivers support rapid and
580 synchronous video input changes, a function useful for example in 687 synchronous video input changes, a function useful for example in
581 video surveillance applications. For this purpose applications set the 688 video surveillance applications. For this purpose applications set the
582 <constant>V4L2_BUF_FLAG_INPUT</constant> flag, and this field to the 689 <constant>V4L2_BUF_FLAG_INPUT</constant> flag, and this field to the
583 number of a video input as in &v4l2-input; field 690 number of a video input as in &v4l2-input; field
584 <structfield>index</structfield>.</entry> 691 <structfield>index</structfield>.</entry>
585 </row> 692 </row>
586 <row> 693 <row>
587 <entry>__u32</entry> 694 <entry>__u32</entry>
588 <entry><structfield>reserved</structfield></entry> 695 <entry><structfield>reserved</structfield></entry>
589 <entry></entry> 696 <entry></entry>
590 <entry>A place holder for future extensions and custom 697 <entry>A place holder for future extensions and custom
591 (driver defined) buffer types 698 (driver defined) buffer types
592 <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher. Applications 699 <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher. Applications
593 should set this to 0.</entry> 700 should set this to 0.</entry>
594 </row> 701 </row>
595 </tbody> 702 </tbody>
596 </tgroup> 703 </tgroup>
597 </table> 704 </table>
598 705
706 <table frame="none" pgwide="1" id="v4l2-plane">
707 <title>struct <structname>v4l2_plane</structname></title>
708 <tgroup cols="4">
709 &cs-ustr;
710 <tbody valign="top">
711 <row>
712 <entry>__u32</entry>
713 <entry><structfield>bytesused</structfield></entry>
714 <entry></entry>
715 <entry>The number of bytes occupied by data in the plane
716 (its payload).</entry>
717 </row>
718 <row>
719 <entry>__u32</entry>
720 <entry><structfield>length</structfield></entry>
721 <entry></entry>
722 <entry>Size in bytes of the plane (not its payload).</entry>
723 </row>
724 <row>
725 <entry>union</entry>
726 <entry><structfield>m</structfield></entry>
727 <entry></entry>
728 <entry></entry>
729 </row>
730 <row>
731 <entry></entry>
732 <entry>__u32</entry>
733 <entry><structfield>mem_offset</structfield></entry>
734 <entry>When the memory type in the containing &v4l2-buffer; is
735 <constant>V4L2_MEMORY_MMAP</constant>, this is the value that
736 should be passed to &func-mmap;, similar to the
737 <structfield>offset</structfield> field in &v4l2-buffer;.</entry>
738 </row>
739 <row>
740 <entry></entry>
741 <entry>__unsigned long</entry>
742 <entry><structfield>userptr</structfield></entry>
743 <entry>When the memory type in the containing &v4l2-buffer; is
744 <constant>V4L2_MEMORY_USERPTR</constant>, this is a userspace
745 pointer to the memory allocated for this plane by an application.
746 </entry>
747 </row>
748 <row>
749 <entry>__u32</entry>
750 <entry><structfield>data_offset</structfield></entry>
751 <entry></entry>
752 <entry>Offset in bytes to video data in the plane, if applicable.
753 </entry>
754 </row>
755 <row>
756 <entry>__u32</entry>
757 <entry><structfield>reserved[11]</structfield></entry>
758 <entry></entry>
759 <entry>Reserved for future use. Should be zeroed by an
760 application.</entry>
761 </row>
762 </tbody>
763 </tgroup>
764 </table>
765
599 <table frame="none" pgwide="1" id="v4l2-buf-type"> 766 <table frame="none" pgwide="1" id="v4l2-buf-type">
600 <title>enum v4l2_buf_type</title> 767 <title>enum v4l2_buf_type</title>
601 <tgroup cols="3"> 768 <tgroup cols="3">
602 &cs-def; 769 &cs-def;
603 <tbody valign="top"> 770 <tbody valign="top">
604 <row> 771 <row>
605 <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry> 772 <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry>
606 <entry>1</entry> 773 <entry>1</entry>
607 <entry>Buffer of a video capture stream, see <xref 774 <entry>Buffer of a single-planar video capture stream, see <xref
608 linkend="capture" />.</entry> 775 linkend="capture" />.</entry>
609 </row> 776 </row>
610 <row> 777 <row>
778 <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>
779 </entry>
780 <entry>9</entry>
781 <entry>Buffer of a multi-planar video capture stream, see <xref
782 linkend="capture" />.</entry>
783 </row>
784 <row>
611 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry> 785 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry>
612 <entry>2</entry> 786 <entry>2</entry>
613 <entry>Buffer of a video output stream, see <xref 787 <entry>Buffer of a single-planar video output stream, see <xref
788 linkend="output" />.</entry>
789 </row>
790 <row>
791 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>
792 </entry>
793 <entry>10</entry>
794 <entry>Buffer of a multi-planar video output stream, see <xref
614 linkend="output" />.</entry> 795 linkend="output" />.</entry>
615 </row> 796 </row>
616 <row> 797 <row>
617 <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry> 798 <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry>
618 <entry>3</entry> 799 <entry>3</entry>
619 <entry>Buffer for video overlay, see <xref linkend="overlay" />.</entry> 800 <entry>Buffer for video overlay, see <xref linkend="overlay" />.</entry>
620 </row> 801 </row>
621 <row> 802 <row>
622 <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry> 803 <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry>
623 <entry>4</entry> 804 <entry>4</entry>
624 <entry>Buffer of a raw VBI capture stream, see <xref 805 <entry>Buffer of a raw VBI capture stream, see <xref
625 linkend="raw-vbi" />.</entry> 806 linkend="raw-vbi" />.</entry>
626 </row> 807 </row>
627 <row> 808 <row>
628 <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry> 809 <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry>
629 <entry>5</entry> 810 <entry>5</entry>
630 <entry>Buffer of a raw VBI output stream, see <xref 811 <entry>Buffer of a raw VBI output stream, see <xref
631 linkend="raw-vbi" />.</entry> 812 linkend="raw-vbi" />.</entry>
632 </row> 813 </row>
633 <row> 814 <row>
634 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry> 815 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry>
635 <entry>6</entry> 816 <entry>6</entry>
636 <entry>Buffer of a sliced VBI capture stream, see <xref 817 <entry>Buffer of a sliced VBI capture stream, see <xref
637 linkend="sliced" />.</entry> 818 linkend="sliced" />.</entry>
638 </row> 819 </row>
639 <row> 820 <row>
640 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry> 821 <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry>
641 <entry>7</entry> 822 <entry>7</entry>
642 <entry>Buffer of a sliced VBI output stream, see <xref 823 <entry>Buffer of a sliced VBI output stream, see <xref
643 linkend="sliced" />.</entry> 824 linkend="sliced" />.</entry>
644 </row> 825 </row>
645 <row> 826 <row>
646 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant></entry> 827 <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant></entry>
647 <entry>8</entry> 828 <entry>8</entry>
648 <entry>Buffer for video output overlay (OSD), see <xref 829 <entry>Buffer for video output overlay (OSD), see <xref
649 linkend="osd" />. Status: <link 830 linkend="osd" />. Status: <link
650 linkend="experimental">Experimental</link>.</entry> 831 linkend="experimental">Experimental</link>.</entry>
651 </row> 832 </row>
652 <row> 833 <row>
653 <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry> 834 <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry>
654 <entry>0x80</entry> 835 <entry>0x80</entry>
655 <entry>This and higher values are reserved for custom 836 <entry>This and higher values are reserved for custom
656 (driver defined) buffer types.</entry> 837 (driver defined) buffer types.</entry>
657 </row> 838 </row>
658 </tbody> 839 </tbody>
659 </tgroup> 840 </tgroup>
660 </table> 841 </table>
661 842
662 <table frame="none" pgwide="1" id="buffer-flags"> 843 <table frame="none" pgwide="1" id="buffer-flags">
663 <title>Buffer Flags</title> 844 <title>Buffer Flags</title>
664 <tgroup cols="3"> 845 <tgroup cols="3">
665 &cs-def; 846 &cs-def;
666 <tbody valign="top"> 847 <tbody valign="top">
667 <row> 848 <row>
668 <entry><constant>V4L2_BUF_FLAG_MAPPED</constant></entry> 849 <entry><constant>V4L2_BUF_FLAG_MAPPED</constant></entry>
669 <entry>0x0001</entry> 850 <entry>0x0001</entry>
670 <entry>The buffer resides in device memory and has been mapped 851 <entry>The buffer resides in device memory and has been mapped
671 into the application's address space, see <xref linkend="mmap" /> for details. 852 into the application's address space, see <xref linkend="mmap" /> for details.
672 Drivers set or clear this flag when the 853 Drivers set or clear this flag when the
673 <link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link 854 <link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link
674 linkend="vidioc-qbuf">VIDIOC_QBUF</link> or <link 855 linkend="vidioc-qbuf">VIDIOC_QBUF</link> or <link
675 linkend="vidioc-qbuf">VIDIOC_DQBUF</link> ioctl is called. Set by the driver.</entry> 856 linkend="vidioc-qbuf">VIDIOC_DQBUF</link> ioctl is called. Set by the driver.</entry>
676 </row> 857 </row>
677 <row> 858 <row>
678 <entry><constant>V4L2_BUF_FLAG_QUEUED</constant></entry> 859 <entry><constant>V4L2_BUF_FLAG_QUEUED</constant></entry>
679 <entry>0x0002</entry> 860 <entry>0x0002</entry>
680 <entry>Internally drivers maintain two buffer queues, an 861 <entry>Internally drivers maintain two buffer queues, an
681 incoming and outgoing queue. When this flag is set, the buffer is 862 incoming and outgoing queue. When this flag is set, the buffer is
682 currently on the incoming queue. It automatically moves to the 863 currently on the incoming queue. It automatically moves to the
683 outgoing queue after the buffer has been filled (capture devices) or 864 outgoing queue after the buffer has been filled (capture devices) or
684 displayed (output devices). Drivers set or clear this flag when the 865 displayed (output devices). Drivers set or clear this flag when the
685 <constant>VIDIOC_QUERYBUF</constant> ioctl is called. After 866 <constant>VIDIOC_QUERYBUF</constant> ioctl is called. After
686 (successful) calling the <constant>VIDIOC_QBUF </constant>ioctl it is 867 (successful) calling the <constant>VIDIOC_QBUF </constant>ioctl it is
687 always set and after <constant>VIDIOC_DQBUF</constant> always 868 always set and after <constant>VIDIOC_DQBUF</constant> always
688 cleared.</entry> 869 cleared.</entry>
689 </row> 870 </row>
690 <row> 871 <row>
691 <entry><constant>V4L2_BUF_FLAG_DONE</constant></entry> 872 <entry><constant>V4L2_BUF_FLAG_DONE</constant></entry>
692 <entry>0x0004</entry> 873 <entry>0x0004</entry>
693 <entry>When this flag is set, the buffer is currently on 874 <entry>When this flag is set, the buffer is currently on
694 the outgoing queue, ready to be dequeued from the driver. Drivers set 875 the outgoing queue, ready to be dequeued from the driver. Drivers set
695 or clear this flag when the <constant>VIDIOC_QUERYBUF</constant> ioctl 876 or clear this flag when the <constant>VIDIOC_QUERYBUF</constant> ioctl
696 is called. After calling the <constant>VIDIOC_QBUF</constant> or 877 is called. After calling the <constant>VIDIOC_QBUF</constant> or
697 <constant>VIDIOC_DQBUF</constant> it is always cleared. Of course a 878 <constant>VIDIOC_DQBUF</constant> it is always cleared. Of course a
698 buffer cannot be on both queues at the same time, the 879 buffer cannot be on both queues at the same time, the
699 <constant>V4L2_BUF_FLAG_QUEUED</constant> and 880 <constant>V4L2_BUF_FLAG_QUEUED</constant> and
700 <constant>V4L2_BUF_FLAG_DONE</constant> flag are mutually exclusive. 881 <constant>V4L2_BUF_FLAG_DONE</constant> flag are mutually exclusive.
701 They can be both cleared however, then the buffer is in "dequeued" 882 They can be both cleared however, then the buffer is in "dequeued"
702 state, in the application domain to say so.</entry> 883 state, in the application domain to say so.</entry>
703 </row> 884 </row>
704 <row> 885 <row>
705 <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry> 886 <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry>
706 <entry>0x0040</entry> 887 <entry>0x0040</entry>
707 <entry>When this flag is set, the buffer has been dequeued 888 <entry>When this flag is set, the buffer has been dequeued
708 successfully, although the data might have been corrupted. 889 successfully, although the data might have been corrupted.
709 This is recoverable, streaming may continue as normal and 890 This is recoverable, streaming may continue as normal and
710 the buffer may be reused normally. 891 the buffer may be reused normally.
711 Drivers set this flag when the <constant>VIDIOC_DQBUF</constant> 892 Drivers set this flag when the <constant>VIDIOC_DQBUF</constant>
712 ioctl is called.</entry> 893 ioctl is called.</entry>
713 </row> 894 </row>
714 <row> 895 <row>
715 <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry> 896 <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry>
716 <entry>0x0008</entry> 897 <entry>0x0008</entry>
717 <entry>Drivers set or clear this flag when calling the 898 <entry>Drivers set or clear this flag when calling the
718 <constant>VIDIOC_DQBUF</constant> ioctl. It may be set by video 899 <constant>VIDIOC_DQBUF</constant> ioctl. It may be set by video
719 capture devices when the buffer contains a compressed image which is a 900 capture devices when the buffer contains a compressed image which is a
720 key frame (or field), &ie; can be decompressed on its own.</entry> 901 key frame (or field), &ie; can be decompressed on its own.</entry>
721 </row> 902 </row>
722 <row> 903 <row>
723 <entry><constant>V4L2_BUF_FLAG_PFRAME</constant></entry> 904 <entry><constant>V4L2_BUF_FLAG_PFRAME</constant></entry>
724 <entry>0x0010</entry> 905 <entry>0x0010</entry>
725 <entry>Similar to <constant>V4L2_BUF_FLAG_KEYFRAME</constant> 906 <entry>Similar to <constant>V4L2_BUF_FLAG_KEYFRAME</constant>
726 this flags predicted frames or fields which contain only differences to a 907 this flags predicted frames or fields which contain only differences to a
727 previous key frame.</entry> 908 previous key frame.</entry>
728 </row> 909 </row>
729 <row> 910 <row>
730 <entry><constant>V4L2_BUF_FLAG_BFRAME</constant></entry> 911 <entry><constant>V4L2_BUF_FLAG_BFRAME</constant></entry>
731 <entry>0x0020</entry> 912 <entry>0x0020</entry>
732 <entry>Similar to <constant>V4L2_BUF_FLAG_PFRAME</constant> 913 <entry>Similar to <constant>V4L2_BUF_FLAG_PFRAME</constant>
733 this is a bidirectional predicted frame or field. [ooc tbd]</entry> 914 this is a bidirectional predicted frame or field. [ooc tbd]</entry>
734 </row> 915 </row>
735 <row> 916 <row>
736 <entry><constant>V4L2_BUF_FLAG_TIMECODE</constant></entry> 917 <entry><constant>V4L2_BUF_FLAG_TIMECODE</constant></entry>
737 <entry>0x0100</entry> 918 <entry>0x0100</entry>
738 <entry>The <structfield>timecode</structfield> field is valid. 919 <entry>The <structfield>timecode</structfield> field is valid.
739 Drivers set or clear this flag when the <constant>VIDIOC_DQBUF</constant> 920 Drivers set or clear this flag when the <constant>VIDIOC_DQBUF</constant>
740 ioctl is called.</entry> 921 ioctl is called.</entry>
741 </row> 922 </row>
742 <row> 923 <row>
743 <entry><constant>V4L2_BUF_FLAG_INPUT</constant></entry> 924 <entry><constant>V4L2_BUF_FLAG_INPUT</constant></entry>
744 <entry>0x0200</entry> 925 <entry>0x0200</entry>
745 <entry>The <structfield>input</structfield> field is valid. 926 <entry>The <structfield>input</structfield> field is valid.
746 Applications set or clear this flag before calling the 927 Applications set or clear this flag before calling the
747 <constant>VIDIOC_QBUF</constant> ioctl.</entry> 928 <constant>VIDIOC_QBUF</constant> ioctl.</entry>
748 </row> 929 </row>
749 </tbody> 930 </tbody>
750 </tgroup> 931 </tgroup>
751 </table> 932 </table>
752 933
753 <table pgwide="1" frame="none" id="v4l2-memory"> 934 <table pgwide="1" frame="none" id="v4l2-memory">
754 <title>enum v4l2_memory</title> 935 <title>enum v4l2_memory</title>
755 <tgroup cols="3"> 936 <tgroup cols="3">
756 &cs-def; 937 &cs-def;
757 <tbody valign="top"> 938 <tbody valign="top">
758 <row> 939 <row>
759 <entry><constant>V4L2_MEMORY_MMAP</constant></entry> 940 <entry><constant>V4L2_MEMORY_MMAP</constant></entry>
760 <entry>1</entry> 941 <entry>1</entry>
761 <entry>The buffer is used for <link linkend="mmap">memory 942 <entry>The buffer is used for <link linkend="mmap">memory
762 mapping</link> I/O.</entry> 943 mapping</link> I/O.</entry>
763 </row> 944 </row>
764 <row> 945 <row>
765 <entry><constant>V4L2_MEMORY_USERPTR</constant></entry> 946 <entry><constant>V4L2_MEMORY_USERPTR</constant></entry>
766 <entry>2</entry> 947 <entry>2</entry>
767 <entry>The buffer is used for <link linkend="userp">user 948 <entry>The buffer is used for <link linkend="userp">user
768 pointer</link> I/O.</entry> 949 pointer</link> I/O.</entry>
769 </row> 950 </row>
770 <row> 951 <row>
771 <entry><constant>V4L2_MEMORY_OVERLAY</constant></entry> 952 <entry><constant>V4L2_MEMORY_OVERLAY</constant></entry>
772 <entry>3</entry> 953 <entry>3</entry>
773 <entry>[to do]</entry> 954 <entry>[to do]</entry>
774 </row> 955 </row>
775 </tbody> 956 </tbody>
776 </tgroup> 957 </tgroup>
777 </table> 958 </table>
778 959
779 <section> 960 <section>
780 <title>Timecodes</title> 961 <title>Timecodes</title>
781 962
782 <para>The <structname>v4l2_timecode</structname> structure is 963 <para>The <structname>v4l2_timecode</structname> structure is
783 designed to hold a <xref linkend="smpte12m" /> or similar timecode. 964 designed to hold a <xref linkend="smpte12m" /> or similar timecode.
784 (struct <structname>timeval</structname> timestamps are stored in 965 (struct <structname>timeval</structname> timestamps are stored in
785 &v4l2-buffer; field <structfield>timestamp</structfield>.)</para> 966 &v4l2-buffer; field <structfield>timestamp</structfield>.)</para>
786 967
787 <table frame="none" pgwide="1" id="v4l2-timecode"> 968 <table frame="none" pgwide="1" id="v4l2-timecode">
788 <title>struct <structname>v4l2_timecode</structname></title> 969 <title>struct <structname>v4l2_timecode</structname></title>
789 <tgroup cols="3"> 970 <tgroup cols="3">
790 &cs-str; 971 &cs-str;
791 <tbody valign="top"> 972 <tbody valign="top">
792 <row> 973 <row>
793 <entry>__u32</entry> 974 <entry>__u32</entry>
794 <entry><structfield>type</structfield></entry> 975 <entry><structfield>type</structfield></entry>
795 <entry>Frame rate the timecodes are based on, see <xref 976 <entry>Frame rate the timecodes are based on, see <xref
796 linkend="timecode-type" />.</entry> 977 linkend="timecode-type" />.</entry>
797 </row> 978 </row>
798 <row> 979 <row>
799 <entry>__u32</entry> 980 <entry>__u32</entry>
800 <entry><structfield>flags</structfield></entry> 981 <entry><structfield>flags</structfield></entry>
801 <entry>Timecode flags, see <xref linkend="timecode-flags" />.</entry> 982 <entry>Timecode flags, see <xref linkend="timecode-flags" />.</entry>
802 </row> 983 </row>
803 <row> 984 <row>
804 <entry>__u8</entry> 985 <entry>__u8</entry>
805 <entry><structfield>frames</structfield></entry> 986 <entry><structfield>frames</structfield></entry>
806 <entry>Frame count, 0 ... 23/24/29/49/59, depending on the 987 <entry>Frame count, 0 ... 23/24/29/49/59, depending on the
807 type of timecode.</entry> 988 type of timecode.</entry>
808 </row> 989 </row>
809 <row> 990 <row>
810 <entry>__u8</entry> 991 <entry>__u8</entry>
811 <entry><structfield>seconds</structfield></entry> 992 <entry><structfield>seconds</structfield></entry>
812 <entry>Seconds count, 0 ... 59. This is a binary, not BCD number.</entry> 993 <entry>Seconds count, 0 ... 59. This is a binary, not BCD number.</entry>
813 </row> 994 </row>
814 <row> 995 <row>
815 <entry>__u8</entry> 996 <entry>__u8</entry>
816 <entry><structfield>minutes</structfield></entry> 997 <entry><structfield>minutes</structfield></entry>
817 <entry>Minutes count, 0 ... 59. This is a binary, not BCD number.</entry> 998 <entry>Minutes count, 0 ... 59. This is a binary, not BCD number.</entry>
818 </row> 999 </row>
819 <row> 1000 <row>
820 <entry>__u8</entry> 1001 <entry>__u8</entry>
821 <entry><structfield>hours</structfield></entry> 1002 <entry><structfield>hours</structfield></entry>
822 <entry>Hours count, 0 ... 29. This is a binary, not BCD number.</entry> 1003 <entry>Hours count, 0 ... 29. This is a binary, not BCD number.</entry>
823 </row> 1004 </row>
824 <row> 1005 <row>
825 <entry>__u8</entry> 1006 <entry>__u8</entry>
826 <entry><structfield>userbits</structfield>[4]</entry> 1007 <entry><structfield>userbits</structfield>[4]</entry>
827 <entry>The "user group" bits from the timecode.</entry> 1008 <entry>The "user group" bits from the timecode.</entry>
828 </row> 1009 </row>
829 </tbody> 1010 </tbody>
830 </tgroup> 1011 </tgroup>
831 </table> 1012 </table>
832 1013
833 <table frame="none" pgwide="1" id="timecode-type"> 1014 <table frame="none" pgwide="1" id="timecode-type">
834 <title>Timecode Types</title> 1015 <title>Timecode Types</title>
835 <tgroup cols="3"> 1016 <tgroup cols="3">
836 &cs-def; 1017 &cs-def;
837 <tbody valign="top"> 1018 <tbody valign="top">
838 <row> 1019 <row>
839 <entry><constant>V4L2_TC_TYPE_24FPS</constant></entry> 1020 <entry><constant>V4L2_TC_TYPE_24FPS</constant></entry>
840 <entry>1</entry> 1021 <entry>1</entry>
841 <entry>24 frames per second, i.&nbsp;e. film.</entry> 1022 <entry>24 frames per second, i.&nbsp;e. film.</entry>
842 </row> 1023 </row>
843 <row> 1024 <row>
844 <entry><constant>V4L2_TC_TYPE_25FPS</constant></entry> 1025 <entry><constant>V4L2_TC_TYPE_25FPS</constant></entry>
845 <entry>2</entry> 1026 <entry>2</entry>
846 <entry>25 frames per second, &ie; PAL or SECAM video.</entry> 1027 <entry>25 frames per second, &ie; PAL or SECAM video.</entry>
847 </row> 1028 </row>
848 <row> 1029 <row>
849 <entry><constant>V4L2_TC_TYPE_30FPS</constant></entry> 1030 <entry><constant>V4L2_TC_TYPE_30FPS</constant></entry>
850 <entry>3</entry> 1031 <entry>3</entry>
851 <entry>30 frames per second, &ie; NTSC video.</entry> 1032 <entry>30 frames per second, &ie; NTSC video.</entry>
852 </row> 1033 </row>
853 <row> 1034 <row>
854 <entry><constant>V4L2_TC_TYPE_50FPS</constant></entry> 1035 <entry><constant>V4L2_TC_TYPE_50FPS</constant></entry>
855 <entry>4</entry> 1036 <entry>4</entry>
856 <entry></entry> 1037 <entry></entry>
857 </row> 1038 </row>
858 <row> 1039 <row>
859 <entry><constant>V4L2_TC_TYPE_60FPS</constant></entry> 1040 <entry><constant>V4L2_TC_TYPE_60FPS</constant></entry>
860 <entry>5</entry> 1041 <entry>5</entry>
861 <entry></entry> 1042 <entry></entry>
862 </row> 1043 </row>
863 </tbody> 1044 </tbody>
864 </tgroup> 1045 </tgroup>
865 </table> 1046 </table>
866 1047
867 <table frame="none" pgwide="1" id="timecode-flags"> 1048 <table frame="none" pgwide="1" id="timecode-flags">
868 <title>Timecode Flags</title> 1049 <title>Timecode Flags</title>
869 <tgroup cols="3"> 1050 <tgroup cols="3">
870 &cs-def; 1051 &cs-def;
871 <tbody valign="top"> 1052 <tbody valign="top">
872 <row> 1053 <row>
873 <entry><constant>V4L2_TC_FLAG_DROPFRAME</constant></entry> 1054 <entry><constant>V4L2_TC_FLAG_DROPFRAME</constant></entry>
874 <entry>0x0001</entry> 1055 <entry>0x0001</entry>
875 <entry>Indicates "drop frame" semantics for counting frames 1056 <entry>Indicates "drop frame" semantics for counting frames
876 in 29.97 fps material. When set, frame numbers 0 and 1 at the start of 1057 in 29.97 fps material. When set, frame numbers 0 and 1 at the start of
877 each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the 1058 each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the
878 count.</entry> 1059 count.</entry>
879 </row> 1060 </row>
880 <row> 1061 <row>
881 <entry><constant>V4L2_TC_FLAG_COLORFRAME</constant></entry> 1062 <entry><constant>V4L2_TC_FLAG_COLORFRAME</constant></entry>
882 <entry>0x0002</entry> 1063 <entry>0x0002</entry>
883 <entry>The "color frame" flag.</entry> 1064 <entry>The "color frame" flag.</entry>
884 </row> 1065 </row>
885 <row> 1066 <row>
886 <entry><constant>V4L2_TC_USERBITS_field</constant></entry> 1067 <entry><constant>V4L2_TC_USERBITS_field</constant></entry>
887 <entry>0x000C</entry> 1068 <entry>0x000C</entry>
888 <entry>Field mask for the "binary group flags".</entry> 1069 <entry>Field mask for the "binary group flags".</entry>
889 </row> 1070 </row>
890 <row> 1071 <row>
891 <entry><constant>V4L2_TC_USERBITS_USERDEFINED</constant></entry> 1072 <entry><constant>V4L2_TC_USERBITS_USERDEFINED</constant></entry>
892 <entry>0x0000</entry> 1073 <entry>0x0000</entry>
893 <entry>Unspecified format.</entry> 1074 <entry>Unspecified format.</entry>
894 </row> 1075 </row>
895 <row> 1076 <row>
896 <entry><constant>V4L2_TC_USERBITS_8BITCHARS</constant></entry> 1077 <entry><constant>V4L2_TC_USERBITS_8BITCHARS</constant></entry>
897 <entry>0x0008</entry> 1078 <entry>0x0008</entry>
898 <entry>8-bit ISO characters.</entry> 1079 <entry>8-bit ISO characters.</entry>
899 </row> 1080 </row>
900 </tbody> 1081 </tbody>
901 </tgroup> 1082 </tgroup>
902 </table> 1083 </table>
903 </section> 1084 </section>
904 </section> 1085 </section>
905 1086
906 <section id="field-order"> 1087 <section id="field-order">
907 <title>Field Order</title> 1088 <title>Field Order</title>
908 1089
909 <para>We have to distinguish between progressive and interlaced 1090 <para>We have to distinguish between progressive and interlaced
910 video. Progressive video transmits all lines of a video image 1091 video. Progressive video transmits all lines of a video image
911 sequentially. Interlaced video divides an image into two fields, 1092 sequentially. Interlaced video divides an image into two fields,
912 containing only the odd and even lines of the image, respectively. 1093 containing only the odd and even lines of the image, respectively.
913 Alternating the so called odd and even field are transmitted, and due 1094 Alternating the so called odd and even field are transmitted, and due
914 to a small delay between fields a cathode ray TV displays the lines 1095 to a small delay between fields a cathode ray TV displays the lines
915 interleaved, yielding the original frame. This curious technique was 1096 interleaved, yielding the original frame. This curious technique was
916 invented because at refresh rates similar to film the image would 1097 invented because at refresh rates similar to film the image would
917 fade out too quickly. Transmitting fields reduces the flicker without 1098 fade out too quickly. Transmitting fields reduces the flicker without
918 the necessity of doubling the frame rate and with it the bandwidth 1099 the necessity of doubling the frame rate and with it the bandwidth
919 required for each channel.</para> 1100 required for each channel.</para>
920 1101
921 <para>It is important to understand a video camera does not expose 1102 <para>It is important to understand a video camera does not expose
922 one frame at a time, merely transmitting the frames separated into 1103 one frame at a time, merely transmitting the frames separated into
923 fields. The fields are in fact captured at two different instances in 1104 fields. The fields are in fact captured at two different instances in
924 time. An object on screen may well move between one field and the 1105 time. An object on screen may well move between one field and the
925 next. For applications analysing motion it is of paramount importance 1106 next. For applications analysing motion it is of paramount importance
926 to recognize which field of a frame is older, the <emphasis>temporal 1107 to recognize which field of a frame is older, the <emphasis>temporal
927 order</emphasis>.</para> 1108 order</emphasis>.</para>
928 1109
929 <para>When the driver provides or accepts images field by field 1110 <para>When the driver provides or accepts images field by field
930 rather than interleaved, it is also important applications understand 1111 rather than interleaved, it is also important applications understand
931 how the fields combine to frames. We distinguish between top (aka odd) and 1112 how the fields combine to frames. We distinguish between top (aka odd) and
932 bottom (aka even) fields, the <emphasis>spatial order</emphasis>: The first line 1113 bottom (aka even) fields, the <emphasis>spatial order</emphasis>: The first line
933 of the top field is the first line of an interlaced frame, the first 1114 of the top field is the first line of an interlaced frame, the first
934 line of the bottom field is the second line of that frame.</para> 1115 line of the bottom field is the second line of that frame.</para>
935 1116
936 <para>However because fields were captured one after the other, 1117 <para>However because fields were captured one after the other,
937 arguing whether a frame commences with the top or bottom field is 1118 arguing whether a frame commences with the top or bottom field is
938 pointless. Any two successive top and bottom, or bottom and top fields 1119 pointless. Any two successive top and bottom, or bottom and top fields
939 yield a valid frame. Only when the source was progressive to begin 1120 yield a valid frame. Only when the source was progressive to begin
940 with, &eg; when transferring film to video, two fields may come from 1121 with, &eg; when transferring film to video, two fields may come from
941 the same frame, creating a natural order.</para> 1122 the same frame, creating a natural order.</para>
942 1123
943 <para>Counter to intuition the top field is not necessarily the 1124 <para>Counter to intuition the top field is not necessarily the
944 older field. Whether the older field contains the top or bottom lines 1125 older field. Whether the older field contains the top or bottom lines
945 is a convention determined by the video standard. Hence the 1126 is a convention determined by the video standard. Hence the
946 distinction between temporal and spatial order of fields. The diagrams 1127 distinction between temporal and spatial order of fields. The diagrams
947 below should make this clearer.</para> 1128 below should make this clearer.</para>
948 1129
949 <para>All video capture and output devices must report the current 1130 <para>All video capture and output devices must report the current
950 field order. Some drivers may permit the selection of a different 1131 field order. Some drivers may permit the selection of a different
951 order, to this end applications initialize the 1132 order, to this end applications initialize the
952 <structfield>field</structfield> field of &v4l2-pix-format; before 1133 <structfield>field</structfield> field of &v4l2-pix-format; before
953 calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should 1134 calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should
954 have the value <constant>V4L2_FIELD_ANY</constant> (0).</para> 1135 have the value <constant>V4L2_FIELD_ANY</constant> (0).</para>
955 1136
956 <table frame="none" pgwide="1" id="v4l2-field"> 1137 <table frame="none" pgwide="1" id="v4l2-field">
957 <title>enum v4l2_field</title> 1138 <title>enum v4l2_field</title>
958 <tgroup cols="3"> 1139 <tgroup cols="3">
959 &cs-def; 1140 &cs-def;
960 <tbody valign="top"> 1141 <tbody valign="top">
961 <row> 1142 <row>
962 <entry><constant>V4L2_FIELD_ANY</constant></entry> 1143 <entry><constant>V4L2_FIELD_ANY</constant></entry>
963 <entry>0</entry> 1144 <entry>0</entry>
964 <entry>Applications request this field order when any 1145 <entry>Applications request this field order when any
965 one of the <constant>V4L2_FIELD_NONE</constant>, 1146 one of the <constant>V4L2_FIELD_NONE</constant>,
966 <constant>V4L2_FIELD_TOP</constant>, 1147 <constant>V4L2_FIELD_TOP</constant>,
967 <constant>V4L2_FIELD_BOTTOM</constant>, or 1148 <constant>V4L2_FIELD_BOTTOM</constant>, or
968 <constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable. 1149 <constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable.
969 Drivers choose depending on hardware capabilities or e.&nbsp;g. the 1150 Drivers choose depending on hardware capabilities or e.&nbsp;g. the
970 requested image size, and return the actual field order. &v4l2-buffer; 1151 requested image size, and return the actual field order. &v4l2-buffer;
971 <structfield>field</structfield> can never be 1152 <structfield>field</structfield> can never be
972 <constant>V4L2_FIELD_ANY</constant>.</entry> 1153 <constant>V4L2_FIELD_ANY</constant>.</entry>
973 </row> 1154 </row>
974 <row> 1155 <row>
975 <entry><constant>V4L2_FIELD_NONE</constant></entry> 1156 <entry><constant>V4L2_FIELD_NONE</constant></entry>
976 <entry>1</entry> 1157 <entry>1</entry>
977 <entry>Images are in progressive format, not interlaced. 1158 <entry>Images are in progressive format, not interlaced.
978 The driver may also indicate this order when it cannot distinguish 1159 The driver may also indicate this order when it cannot distinguish
979 between <constant>V4L2_FIELD_TOP</constant> and 1160 between <constant>V4L2_FIELD_TOP</constant> and
980 <constant>V4L2_FIELD_BOTTOM</constant>.</entry> 1161 <constant>V4L2_FIELD_BOTTOM</constant>.</entry>
981 </row> 1162 </row>
982 <row> 1163 <row>
983 <entry><constant>V4L2_FIELD_TOP</constant></entry> 1164 <entry><constant>V4L2_FIELD_TOP</constant></entry>
984 <entry>2</entry> 1165 <entry>2</entry>
985 <entry>Images consist of the top (aka odd) field only.</entry> 1166 <entry>Images consist of the top (aka odd) field only.</entry>
986 </row> 1167 </row>
987 <row> 1168 <row>
988 <entry><constant>V4L2_FIELD_BOTTOM</constant></entry> 1169 <entry><constant>V4L2_FIELD_BOTTOM</constant></entry>
989 <entry>3</entry> 1170 <entry>3</entry>
990 <entry>Images consist of the bottom (aka even) field only. 1171 <entry>Images consist of the bottom (aka even) field only.
991 Applications may wish to prevent a device from capturing interlaced 1172 Applications may wish to prevent a device from capturing interlaced
992 images because they will have "comb" or "feathering" artefacts around 1173 images because they will have "comb" or "feathering" artefacts around
993 moving objects.</entry> 1174 moving objects.</entry>
994 </row> 1175 </row>
995 <row> 1176 <row>
996 <entry><constant>V4L2_FIELD_INTERLACED</constant></entry> 1177 <entry><constant>V4L2_FIELD_INTERLACED</constant></entry>
997 <entry>4</entry> 1178 <entry>4</entry>
998 <entry>Images contain both fields, interleaved line by 1179 <entry>Images contain both fields, interleaved line by
999 line. The temporal order of the fields (whether the top or bottom 1180 line. The temporal order of the fields (whether the top or bottom
1000 field is first transmitted) depends on the current video standard. 1181 field is first transmitted) depends on the current video standard.
1001 M/NTSC transmits the bottom field first, all other standards the top 1182 M/NTSC transmits the bottom field first, all other standards the top
1002 field first.</entry> 1183 field first.</entry>
1003 </row> 1184 </row>
1004 <row> 1185 <row>
1005 <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry> 1186 <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry>
1006 <entry>5</entry> 1187 <entry>5</entry>
1007 <entry>Images contain both fields, the top field lines 1188 <entry>Images contain both fields, the top field lines
1008 are stored first in memory, immediately followed by the bottom field 1189 are stored first in memory, immediately followed by the bottom field
1009 lines. Fields are always stored in temporal order, the older one first 1190 lines. Fields are always stored in temporal order, the older one first
1010 in memory. Image sizes refer to the frame, not fields.</entry> 1191 in memory. Image sizes refer to the frame, not fields.</entry>
1011 </row> 1192 </row>
1012 <row> 1193 <row>
1013 <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry> 1194 <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry>
1014 <entry>6</entry> 1195 <entry>6</entry>
1015 <entry>Images contain both fields, the bottom field 1196 <entry>Images contain both fields, the bottom field
1016 lines are stored first in memory, immediately followed by the top 1197 lines are stored first in memory, immediately followed by the top
1017 field lines. Fields are always stored in temporal order, the older one 1198 field lines. Fields are always stored in temporal order, the older one
1018 first in memory. Image sizes refer to the frame, not fields.</entry> 1199 first in memory. Image sizes refer to the frame, not fields.</entry>
1019 </row> 1200 </row>
1020 <row> 1201 <row>
1021 <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry> 1202 <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry>
1022 <entry>7</entry> 1203 <entry>7</entry>
1023 <entry>The two fields of a frame are passed in separate 1204 <entry>The two fields of a frame are passed in separate
1024 buffers, in temporal order, &ie; the older one first. To indicate the field 1205 buffers, in temporal order, &ie; the older one first. To indicate the field
1025 parity (whether the current field is a top or bottom field) the driver 1206 parity (whether the current field is a top or bottom field) the driver
1026 or application, depending on data direction, must set &v4l2-buffer; 1207 or application, depending on data direction, must set &v4l2-buffer;
1027 <structfield>field</structfield> to 1208 <structfield>field</structfield> to
1028 <constant>V4L2_FIELD_TOP</constant> or 1209 <constant>V4L2_FIELD_TOP</constant> or
1029 <constant>V4L2_FIELD_BOTTOM</constant>. Any two successive fields pair 1210 <constant>V4L2_FIELD_BOTTOM</constant>. Any two successive fields pair
1030 to build a frame. If fields are successive, without any dropped fields 1211 to build a frame. If fields are successive, without any dropped fields
1031 between them (fields can drop individually), can be determined from 1212 between them (fields can drop individually), can be determined from
1032 the &v4l2-buffer; <structfield>sequence</structfield> field. Image 1213 the &v4l2-buffer; <structfield>sequence</structfield> field. Image
1033 sizes refer to the frame, not fields. This format cannot be selected 1214 sizes refer to the frame, not fields. This format cannot be selected
1034 when using the read/write I/O method.<!-- Where it's indistinguishable 1215 when using the read/write I/O method.<!-- Where it's indistinguishable
1035 from V4L2_FIELD_SEQ_*. --></entry> 1216 from V4L2_FIELD_SEQ_*. --></entry>
1036 </row> 1217 </row>
1037 <row> 1218 <row>
1038 <entry><constant>V4L2_FIELD_INTERLACED_TB</constant></entry> 1219 <entry><constant>V4L2_FIELD_INTERLACED_TB</constant></entry>
1039 <entry>8</entry> 1220 <entry>8</entry>
1040 <entry>Images contain both fields, interleaved line by 1221 <entry>Images contain both fields, interleaved line by
1041 line, top field first. The top field is transmitted first.</entry> 1222 line, top field first. The top field is transmitted first.</entry>
1042 </row> 1223 </row>
1043 <row> 1224 <row>
1044 <entry><constant>V4L2_FIELD_INTERLACED_BT</constant></entry> 1225 <entry><constant>V4L2_FIELD_INTERLACED_BT</constant></entry>
1045 <entry>9</entry> 1226 <entry>9</entry>
1046 <entry>Images contain both fields, interleaved line by 1227 <entry>Images contain both fields, interleaved line by
1047 line, top field first. The bottom field is transmitted first.</entry> 1228 line, top field first. The bottom field is transmitted first.</entry>
1048 </row> 1229 </row>
1049 </tbody> 1230 </tbody>
1050 </tgroup> 1231 </tgroup>
1051 </table> 1232 </table>
1052 1233
1053 <figure id="fieldseq-tb"> 1234 <figure id="fieldseq-tb">
1054 <title>Field Order, Top Field First Transmitted</title> 1235 <title>Field Order, Top Field First Transmitted</title>
1055 <mediaobject> 1236 <mediaobject>
1056 <imageobject> 1237 <imageobject>
1057 <imagedata fileref="fieldseq_tb.pdf" format="PS" /> 1238 <imagedata fileref="fieldseq_tb.pdf" format="PS" />
1058 </imageobject> 1239 </imageobject>
1059 <imageobject> 1240 <imageobject>
1060 <imagedata fileref="fieldseq_tb.gif" format="GIF" /> 1241 <imagedata fileref="fieldseq_tb.gif" format="GIF" />
1061 </imageobject> 1242 </imageobject>
1062 </mediaobject> 1243 </mediaobject>
1063 </figure> 1244 </figure>
1064 1245
1065 <figure id="fieldseq-bt"> 1246 <figure id="fieldseq-bt">
1066 <title>Field Order, Bottom Field First Transmitted</title> 1247 <title>Field Order, Bottom Field First Transmitted</title>
1067 <mediaobject> 1248 <mediaobject>
1068 <imageobject> 1249 <imageobject>
1069 <imagedata fileref="fieldseq_bt.pdf" format="PS" /> 1250 <imagedata fileref="fieldseq_bt.pdf" format="PS" />
1070 </imageobject> 1251 </imageobject>
1071 <imageobject> 1252 <imageobject>
1072 <imagedata fileref="fieldseq_bt.gif" format="GIF" /> 1253 <imagedata fileref="fieldseq_bt.gif" format="GIF" />
1073 </imageobject> 1254 </imageobject>
1074 </mediaobject> 1255 </mediaobject>
1075 </figure> 1256 </figure>
1076 </section> 1257 </section>
1077 1258
1078 <!-- 1259 <!--
1079 Local Variables: 1260 Local Variables:
1080 mode: sgml 1261 mode: sgml
1081 sgml-parent-document: "v4l2.sgml" 1262 sgml-parent-document: "v4l2.sgml"
1082 indent-tabs-mode: nil 1263 indent-tabs-mode: nil
1083 End: 1264 End:
1084 --> 1265 -->
Documentation/DocBook/v4l/pixfmt.xml
1 <title>Image Formats</title> 1 <title>Image Formats</title>
2 2
3 <para>The V4L2 API was primarily designed for devices exchanging 3 <para>The V4L2 API was primarily designed for devices exchanging
4 image data with applications. The 4 image data with applications. The
5 <structname>v4l2_pix_format</structname> structure defines the format 5 <structname>v4l2_pix_format</structname> and <structname>v4l2_pix_format_mplane
6 and layout of an image in memory. Image formats are negotiated with 6 </structname> structures define the format and layout of an image in memory.
7 the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video 7 The former is used with the single-planar API, while the latter is used with the
8 multi-planar version (see <xref linkend="planar-apis"/>). Image formats are
9 negotiated with the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video
8 capturing and output, for overlay frame buffer formats see also 10 capturing and output, for overlay frame buffer formats see also
9 &VIDIOC-G-FBUF;.)</para> 11 &VIDIOC-G-FBUF;.)</para>
10 12
13 <section>
14 <title>Single-planar format structure</title>
11 <table pgwide="1" frame="none" id="v4l2-pix-format"> 15 <table pgwide="1" frame="none" id="v4l2-pix-format">
12 <title>struct <structname>v4l2_pix_format</structname></title> 16 <title>struct <structname>v4l2_pix_format</structname></title>
13 <tgroup cols="3"> 17 <tgroup cols="3">
14 &cs-str; 18 &cs-str;
15 <tbody valign="top"> 19 <tbody valign="top">
16 <row> 20 <row>
17 <entry>__u32</entry> 21 <entry>__u32</entry>
18 <entry><structfield>width</structfield></entry> 22 <entry><structfield>width</structfield></entry>
19 <entry>Image width in pixels.</entry> 23 <entry>Image width in pixels.</entry>
20 </row> 24 </row>
21 <row> 25 <row>
22 <entry>__u32</entry> 26 <entry>__u32</entry>
23 <entry><structfield>height</structfield></entry> 27 <entry><structfield>height</structfield></entry>
24 <entry>Image height in pixels.</entry> 28 <entry>Image height in pixels.</entry>
25 </row> 29 </row>
26 <row> 30 <row>
27 <entry spanname="hspan">Applications set these fields to 31 <entry spanname="hspan">Applications set these fields to
28 request an image size, drivers return the closest possible values. In 32 request an image size, drivers return the closest possible values. In
29 case of planar formats the <structfield>width</structfield> and 33 case of planar formats the <structfield>width</structfield> and
30 <structfield>height</structfield> applies to the largest plane. To 34 <structfield>height</structfield> applies to the largest plane. To
31 avoid ambiguities drivers must return values rounded up to a multiple 35 avoid ambiguities drivers must return values rounded up to a multiple
32 of the scale factor of any smaller planes. For example when the image 36 of the scale factor of any smaller planes. For example when the image
33 format is YUV 4:2:0, <structfield>width</structfield> and 37 format is YUV 4:2:0, <structfield>width</structfield> and
34 <structfield>height</structfield> must be multiples of two.</entry> 38 <structfield>height</structfield> must be multiples of two.</entry>
35 </row> 39 </row>
36 <row> 40 <row>
37 <entry>__u32</entry> 41 <entry>__u32</entry>
38 <entry><structfield>pixelformat</structfield></entry> 42 <entry><structfield>pixelformat</structfield></entry>
39 <entry>The pixel format or type of compression, set by the 43 <entry>The pixel format or type of compression, set by the
40 application. This is a little endian <link 44 application. This is a little endian <link
41 linkend="v4l2-fourcc">four character code</link>. V4L2 defines 45 linkend="v4l2-fourcc">four character code</link>. V4L2 defines
42 standard RGB formats in <xref linkend="rgb-formats" />, YUV formats in <xref 46 standard RGB formats in <xref linkend="rgb-formats" />, YUV formats in <xref
43 linkend="yuv-formats" />, and reserved codes in <xref 47 linkend="yuv-formats" />, and reserved codes in <xref
44 linkend="reserved-formats" /></entry> 48 linkend="reserved-formats" /></entry>
45 </row> 49 </row>
46 <row> 50 <row>
47 <entry>&v4l2-field;</entry> 51 <entry>&v4l2-field;</entry>
48 <entry><structfield>field</structfield></entry> 52 <entry><structfield>field</structfield></entry>
49 <entry>Video images are typically interlaced. Applications 53 <entry>Video images are typically interlaced. Applications
50 can request to capture or output only the top or bottom field, or both 54 can request to capture or output only the top or bottom field, or both
51 fields interlaced or sequentially stored in one buffer or alternating 55 fields interlaced or sequentially stored in one buffer or alternating
52 in separate buffers. Drivers return the actual field order selected. 56 in separate buffers. Drivers return the actual field order selected.
53 For details see <xref linkend="field-order" />.</entry> 57 For details see <xref linkend="field-order" />.</entry>
54 </row> 58 </row>
55 <row> 59 <row>
56 <entry>__u32</entry> 60 <entry>__u32</entry>
57 <entry><structfield>bytesperline</structfield></entry> 61 <entry><structfield>bytesperline</structfield></entry>
58 <entry>Distance in bytes between the leftmost pixels in two 62 <entry>Distance in bytes between the leftmost pixels in two
59 adjacent lines.</entry> 63 adjacent lines.</entry>
60 </row> 64 </row>
61 <row> 65 <row>
62 <entry spanname="hspan"><para>Both applications and drivers 66 <entry spanname="hspan"><para>Both applications and drivers
63 can set this field to request padding bytes at the end of each line. 67 can set this field to request padding bytes at the end of each line.
64 Drivers however may ignore the value requested by the application, 68 Drivers however may ignore the value requested by the application,
65 returning <structfield>width</structfield> times bytes per pixel or a 69 returning <structfield>width</structfield> times bytes per pixel or a
66 larger value required by the hardware. That implies applications can 70 larger value required by the hardware. That implies applications can
67 just set this field to zero to get a reasonable 71 just set this field to zero to get a reasonable
68 default.</para><para>Video hardware may access padding bytes, 72 default.</para><para>Video hardware may access padding bytes,
69 therefore they must reside in accessible memory. Consider cases where 73 therefore they must reside in accessible memory. Consider cases where
70 padding bytes after the last line of an image cross a system page 74 padding bytes after the last line of an image cross a system page
71 boundary. Input devices may write padding bytes, the value is 75 boundary. Input devices may write padding bytes, the value is
72 undefined. Output devices ignore the contents of padding 76 undefined. Output devices ignore the contents of padding
73 bytes.</para><para>When the image format is planar the 77 bytes.</para><para>When the image format is planar the
74 <structfield>bytesperline</structfield> value applies to the largest 78 <structfield>bytesperline</structfield> value applies to the largest
75 plane and is divided by the same factor as the 79 plane and is divided by the same factor as the
76 <structfield>width</structfield> field for any smaller planes. For 80 <structfield>width</structfield> field for any smaller planes. For
77 example the Cb and Cr planes of a YUV 4:2:0 image have half as many 81 example the Cb and Cr planes of a YUV 4:2:0 image have half as many
78 padding bytes following each line as the Y plane. To avoid ambiguities 82 padding bytes following each line as the Y plane. To avoid ambiguities
79 drivers must return a <structfield>bytesperline</structfield> value 83 drivers must return a <structfield>bytesperline</structfield> value
80 rounded up to a multiple of the scale factor.</para></entry> 84 rounded up to a multiple of the scale factor.</para></entry>
81 </row> 85 </row>
82 <row> 86 <row>
83 <entry>__u32</entry> 87 <entry>__u32</entry>
84 <entry><structfield>sizeimage</structfield></entry> 88 <entry><structfield>sizeimage</structfield></entry>
85 <entry>Size in bytes of the buffer to hold a complete image, 89 <entry>Size in bytes of the buffer to hold a complete image,
86 set by the driver. Usually this is 90 set by the driver. Usually this is
87 <structfield>bytesperline</structfield> times 91 <structfield>bytesperline</structfield> times
88 <structfield>height</structfield>. When the image consists of variable 92 <structfield>height</structfield>. When the image consists of variable
89 length compressed data this is the maximum number of bytes required to 93 length compressed data this is the maximum number of bytes required to
90 hold an image.</entry> 94 hold an image.</entry>
91 </row> 95 </row>
92 <row> 96 <row>
93 <entry>&v4l2-colorspace;</entry> 97 <entry>&v4l2-colorspace;</entry>
94 <entry><structfield>colorspace</structfield></entry> 98 <entry><structfield>colorspace</structfield></entry>
95 <entry>This information supplements the 99 <entry>This information supplements the
96 <structfield>pixelformat</structfield> and must be set by the driver, 100 <structfield>pixelformat</structfield> and must be set by the driver,
97 see <xref linkend="colorspaces" />.</entry> 101 see <xref linkend="colorspaces" />.</entry>
98 </row> 102 </row>
99 <row> 103 <row>
100 <entry>__u32</entry> 104 <entry>__u32</entry>
101 <entry><structfield>priv</structfield></entry> 105 <entry><structfield>priv</structfield></entry>
102 <entry>Reserved for custom (driver defined) additional 106 <entry>Reserved for custom (driver defined) additional
103 information about formats. When not used drivers and applications must 107 information about formats. When not used drivers and applications must
104 set this field to zero.</entry> 108 set this field to zero.</entry>
105 </row> 109 </row>
106 </tbody> 110 </tbody>
107 </tgroup> 111 </tgroup>
108 </table> 112 </table>
113 </section>
109 114
115 <section>
116 <title>Multi-planar format structures</title>
117 <para>The <structname>v4l2_plane_pix_format</structname> structures define
118 size and layout for each of the planes in a multi-planar format.
119 The <structname>v4l2_pix_format_mplane</structname> structure contains
120 information common to all planes (such as image width and height) and
121 an array of <structname>v4l2_plane_pix_format</structname> structures,
122 describing all planes of that format.</para>
123 <table pgwide="1" frame="none" id="v4l2-plane-pix-format">
124 <title>struct <structname>vl42_plane_pix_format</structname></title>
125 <tgroup cols="3">
126 &cs-str;
127 <tbody valign="top">
128 <row>
129 <entry>__u32</entry>
130 <entry><structfield>sizeimage</structfield></entry>
131 <entry>Maximum size in bytes required for image data in this plane.
132 </entry>
133 </row>
134 <row>
135 <entry>__u16</entry>
136 <entry><structfield>bytesperline</structfield></entry>
137 <entry>Distance in bytes between the leftmost pixels in two adjacent
138 lines.</entry>
139 </row>
140 <row>
141 <entry>__u16</entry>
142 <entry><structfield>reserved[7]</structfield></entry>
143 <entry>Reserved for future extensions. Should be zeroed by the
144 application.</entry>
145 </row>
146 </tbody>
147 </tgroup>
148 </table>
149 <table pgwide="1" frame="none" id="v4l2-pix-format-mplane">
150 <title>struct <structname>v4l2_pix_format_mplane</structname></title>
151 <tgroup cols="3">
152 &cs-str;
153 <tbody valign="top">
154 <row>
155 <entry>__u32</entry>
156 <entry><structfield>width</structfield></entry>
157 <entry>Image width in pixels.</entry>
158 </row>
159 <row>
160 <entry>__u32</entry>
161 <entry><structfield>height</structfield></entry>
162 <entry>Image height in pixels.</entry>
163 </row>
164 <row>
165 <entry>__u32</entry>
166 <entry><structfield>pixelformat</structfield></entry>
167 <entry>The pixel format. Both single- and multi-planar four character
168 codes can be used.</entry>
169 </row>
170 <row>
171 <entry>&v4l2-field;</entry>
172 <entry><structfield>field</structfield></entry>
173 <entry>See &v4l2-pix-format;.</entry>
174 </row>
175 <row>
176 <entry>&v4l2-colorspace;</entry>
177 <entry><structfield>colorspace</structfield></entry>
178 <entry>See &v4l2-pix-format;.</entry>
179 </row>
180 <row>
181 <entry>&v4l2-plane-pix-format;</entry>
182 <entry><structfield>plane_fmt[VIDEO_MAX_PLANES]</structfield></entry>
183 <entry>An array of structures describing format of each plane this
184 pixel format consists of. The number of valid entries in this array
185 has to be put in the <structfield>num_planes</structfield>
186 field.</entry>
187 </row>
188 <row>
189 <entry>__u8</entry>
190 <entry><structfield>num_planes</structfield></entry>
191 <entry>Number of planes (i.e. separate memory buffers) for this format
192 and the number of valid entries in the
193 <structfield>plane_fmt</structfield> array.</entry>
194 </row>
195 <row>
196 <entry>__u8</entry>
197 <entry><structfield>reserved[11]</structfield></entry>
198 <entry>Reserved for future extensions. Should be zeroed by the
199 application.</entry>
200 </row>
201 </tbody>
202 </tgroup>
203 </table>
204 </section>
205
110 <section> 206 <section>
111 <title>Standard Image Formats</title> 207 <title>Standard Image Formats</title>
112 208
113 <para>In order to exchange images between drivers and 209 <para>In order to exchange images between drivers and
114 applications, it is necessary to have standard image data formats 210 applications, it is necessary to have standard image data formats
115 which both sides will interpret the same way. V4L2 includes several 211 which both sides will interpret the same way. V4L2 includes several
116 such formats, and this section is intended to be an unambiguous 212 such formats, and this section is intended to be an unambiguous
117 specification of the standard image data formats in V4L2.</para> 213 specification of the standard image data formats in V4L2.</para>
118 214
119 <para>V4L2 drivers are not limited to these formats, however. 215 <para>V4L2 drivers are not limited to these formats, however.
120 Driver-specific formats are possible. In that case the application may 216 Driver-specific formats are possible. In that case the application may
121 depend on a codec to convert images to one of the standard formats 217 depend on a codec to convert images to one of the standard formats
122 when needed. But the data can still be stored and retrieved in the 218 when needed. But the data can still be stored and retrieved in the
123 proprietary format. For example, a device may support a proprietary 219 proprietary format. For example, a device may support a proprietary
124 compressed format. Applications can still capture and save the data in 220 compressed format. Applications can still capture and save the data in
125 the compressed format, saving much disk space, and later use a codec 221 the compressed format, saving much disk space, and later use a codec
126 to convert the images to the X Windows screen format when the video is 222 to convert the images to the X Windows screen format when the video is
127 to be displayed.</para> 223 to be displayed.</para>
128 224
129 <para>Even so, ultimately, some standard formats are needed, so 225 <para>Even so, ultimately, some standard formats are needed, so
130 the V4L2 specification would not be complete without well-defined 226 the V4L2 specification would not be complete without well-defined
131 standard formats.</para> 227 standard formats.</para>
132 228
133 <para>The V4L2 standard formats are mainly uncompressed formats. The 229 <para>The V4L2 standard formats are mainly uncompressed formats. The
134 pixels are always arranged in memory from left to right, and from top 230 pixels are always arranged in memory from left to right, and from top
135 to bottom. The first byte of data in the image buffer is always for 231 to bottom. The first byte of data in the image buffer is always for
136 the leftmost pixel of the topmost row. Following that is the pixel 232 the leftmost pixel of the topmost row. Following that is the pixel
137 immediately to its right, and so on until the end of the top row of 233 immediately to its right, and so on until the end of the top row of
138 pixels. Following the rightmost pixel of the row there may be zero or 234 pixels. Following the rightmost pixel of the row there may be zero or
139 more bytes of padding to guarantee that each row of pixel data has a 235 more bytes of padding to guarantee that each row of pixel data has a
140 certain alignment. Following the pad bytes, if any, is data for the 236 certain alignment. Following the pad bytes, if any, is data for the
141 leftmost pixel of the second row from the top, and so on. The last row 237 leftmost pixel of the second row from the top, and so on. The last row
142 has just as many pad bytes after it as the other rows.</para> 238 has just as many pad bytes after it as the other rows.</para>
143 239
144 <para>In V4L2 each format has an identifier which looks like 240 <para>In V4L2 each format has an identifier which looks like
145 <constant>PIX_FMT_XXX</constant>, defined in the <filename>videodev2.h</filename> 241 <constant>PIX_FMT_XXX</constant>, defined in the <link
146 header file. These identifiers 242 linkend="videodev">videodev.h</link> header file. These identifiers
147 represent <link linkend="v4l2-fourcc">four character codes</link> 243 represent <link linkend="v4l2-fourcc">four character (FourCC) codes</link>
148 which are also listed below, however they are not the same as those 244 which are also listed below, however they are not the same as those
149 used in the Windows world.</para> 245 used in the Windows world.</para>
246
247 <para>For some formats, data is stored in separate, discontiguous
248 memory buffers. Those formats are identified by a separate set of FourCC codes
249 and are referred to as "multi-planar formats". For example, a YUV422 frame is
250 normally stored in one memory buffer, but it can also be placed in two or three
251 separate buffers, with Y component in one buffer and CbCr components in another
252 in the 2-planar version or with each component in its own buffer in the
253 3-planar case. Those sub-buffers are referred to as "planes".</para>
150 </section> 254 </section>
151 255
152 <section id="colorspaces"> 256 <section id="colorspaces">
153 <title>Colorspaces</title> 257 <title>Colorspaces</title>
154 258
155 <para>[intro]</para> 259 <para>[intro]</para>
156 260
157 <!-- See proposal by Billy Biggs, video4linux-list@redhat.com 261 <!-- See proposal by Billy Biggs, video4linux-list@redhat.com
158 on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and 262 on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and
159 http://vektor.theorem.ca/graphics/ycbcr/ and 263 http://vektor.theorem.ca/graphics/ycbcr/ and
160 http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html --> 264 http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html -->
161 265
162 <para> 266 <para>
163 <variablelist> 267 <variablelist>
164 <varlistentry> 268 <varlistentry>
165 <term>Gamma Correction</term> 269 <term>Gamma Correction</term>
166 <listitem> 270 <listitem>
167 <para>[to do]</para> 271 <para>[to do]</para>
168 <para>E'<subscript>R</subscript> = f(R)</para> 272 <para>E'<subscript>R</subscript> = f(R)</para>
169 <para>E'<subscript>G</subscript> = f(G)</para> 273 <para>E'<subscript>G</subscript> = f(G)</para>
170 <para>E'<subscript>B</subscript> = f(B)</para> 274 <para>E'<subscript>B</subscript> = f(B)</para>
171 </listitem> 275 </listitem>
172 </varlistentry> 276 </varlistentry>
173 <varlistentry> 277 <varlistentry>
174 <term>Construction of luminance and color-difference 278 <term>Construction of luminance and color-difference
175 signals</term> 279 signals</term>
176 <listitem> 280 <listitem>
177 <para>[to do]</para> 281 <para>[to do]</para>
178 <para>E'<subscript>Y</subscript> = 282 <para>E'<subscript>Y</subscript> =
179 Coeff<subscript>R</subscript> E'<subscript>R</subscript> 283 Coeff<subscript>R</subscript> E'<subscript>R</subscript>
180 + Coeff<subscript>G</subscript> E'<subscript>G</subscript> 284 + Coeff<subscript>G</subscript> E'<subscript>G</subscript>
181 + Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 285 + Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
182 <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript> 286 <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript>
183 - Coeff<subscript>R</subscript> E'<subscript>R</subscript> 287 - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
184 - Coeff<subscript>G</subscript> E'<subscript>G</subscript> 288 - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
185 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 289 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
186 <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript> 290 <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript>
187 - Coeff<subscript>R</subscript> E'<subscript>R</subscript> 291 - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
188 - Coeff<subscript>G</subscript> E'<subscript>G</subscript> 292 - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
189 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 293 - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
190 </listitem> 294 </listitem>
191 </varlistentry> 295 </varlistentry>
192 <varlistentry> 296 <varlistentry>
193 <term>Re-normalized color-difference signals</term> 297 <term>Re-normalized color-difference signals</term>
194 <listitem> 298 <listitem>
195 <para>The color-difference signals are scaled back to unity 299 <para>The color-difference signals are scaled back to unity
196 range [-0.5;+0.5]:</para> 300 range [-0.5;+0.5]:</para>
197 <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para> 301 <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para>
198 <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para> 302 <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para>
199 <para>P<subscript>B</subscript> = 303 <para>P<subscript>B</subscript> =
200 K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = 304 K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) =
201 0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript> 305 0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript>
202 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript> 306 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript>
203 + 0.5 E'<subscript>B</subscript></para> 307 + 0.5 E'<subscript>B</subscript></para>
204 <para>P<subscript>R</subscript> = 308 <para>P<subscript>R</subscript> =
205 K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = 309 K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) =
206 0.5 E'<subscript>R</subscript> 310 0.5 E'<subscript>R</subscript>
207 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript> 311 + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript>
208 + 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para> 312 + 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para>
209 </listitem> 313 </listitem>
210 </varlistentry> 314 </varlistentry>
211 <varlistentry> 315 <varlistentry>
212 <term>Quantization</term> 316 <term>Quantization</term>
213 <listitem> 317 <listitem>
214 <para>[to do]</para> 318 <para>[to do]</para>
215 <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para> 319 <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para>
216 <para>C<subscript>B</subscript> = (Chrom. Levels - 1) 320 <para>C<subscript>B</subscript> = (Chrom. Levels - 1)
217 &middot; P<subscript>B</subscript> + Chrom. Offset</para> 321 &middot; P<subscript>B</subscript> + Chrom. Offset</para>
218 <para>C<subscript>R</subscript> = (Chrom. Levels - 1) 322 <para>C<subscript>R</subscript> = (Chrom. Levels - 1)
219 &middot; P<subscript>R</subscript> + Chrom. Offset</para> 323 &middot; P<subscript>R</subscript> + Chrom. Offset</para>
220 <para>Rounding to the nearest integer and clamping to the range 324 <para>Rounding to the nearest integer and clamping to the range
221 [0;255] finally yields the digital color components Y'CbCr 325 [0;255] finally yields the digital color components Y'CbCr
222 stored in YUV images.</para> 326 stored in YUV images.</para>
223 </listitem> 327 </listitem>
224 </varlistentry> 328 </varlistentry>
225 </variablelist> 329 </variablelist>
226 </para> 330 </para>
227 331
228 <example> 332 <example>
229 <title>ITU-R Rec. BT.601 color conversion</title> 333 <title>ITU-R Rec. BT.601 color conversion</title>
230 334
231 <para>Forward Transformation</para> 335 <para>Forward Transformation</para>
232 336
233 <programlisting> 337 <programlisting>
234 int ER, EG, EB; /* gamma corrected RGB input [0;255] */ 338 int ER, EG, EB; /* gamma corrected RGB input [0;255] */
235 int Y1, Cb, Cr; /* output [0;255] */ 339 int Y1, Cb, Cr; /* output [0;255] */
236 340
237 double r, g, b; /* temporaries */ 341 double r, g, b; /* temporaries */
238 double y1, pb, pr; 342 double y1, pb, pr;
239 343
240 int 344 int
241 clamp (double x) 345 clamp (double x)
242 { 346 {
243 int r = x; /* round to nearest */ 347 int r = x; /* round to nearest */
244 348
245 if (r &lt; 0) return 0; 349 if (r &lt; 0) return 0;
246 else if (r &gt; 255) return 255; 350 else if (r &gt; 255) return 255;
247 else return r; 351 else return r;
248 } 352 }
249 353
250 r = ER / 255.0; 354 r = ER / 255.0;
251 g = EG / 255.0; 355 g = EG / 255.0;
252 b = EB / 255.0; 356 b = EB / 255.0;
253 357
254 y1 = 0.299 * r + 0.587 * g + 0.114 * b; 358 y1 = 0.299 * r + 0.587 * g + 0.114 * b;
255 pb = -0.169 * r - 0.331 * g + 0.5 * b; 359 pb = -0.169 * r - 0.331 * g + 0.5 * b;
256 pr = 0.5 * r - 0.419 * g - 0.081 * b; 360 pr = 0.5 * r - 0.419 * g - 0.081 * b;
257 361
258 Y1 = clamp (219 * y1 + 16); 362 Y1 = clamp (219 * y1 + 16);
259 Cb = clamp (224 * pb + 128); 363 Cb = clamp (224 * pb + 128);
260 Cr = clamp (224 * pr + 128); 364 Cr = clamp (224 * pr + 128);
261 365
262 /* or shorter */ 366 /* or shorter */
263 367
264 y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB; 368 y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB;
265 369
266 Y1 = clamp ( (219 / 255.0) * y1 + 16); 370 Y1 = clamp ( (219 / 255.0) * y1 + 16);
267 Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128); 371 Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128);
268 Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128); 372 Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128);
269 </programlisting> 373 </programlisting>
270 374
271 <para>Inverse Transformation</para> 375 <para>Inverse Transformation</para>
272 376
273 <programlisting> 377 <programlisting>
274 int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */ 378 int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */
275 int ER, EG, EB; /* output [0;255] */ 379 int ER, EG, EB; /* output [0;255] */
276 380
277 double r, g, b; /* temporaries */ 381 double r, g, b; /* temporaries */
278 double y1, pb, pr; 382 double y1, pb, pr;
279 383
280 int 384 int
281 clamp (double x) 385 clamp (double x)
282 { 386 {
283 int r = x; /* round to nearest */ 387 int r = x; /* round to nearest */
284 388
285 if (r &lt; 0) return 0; 389 if (r &lt; 0) return 0;
286 else if (r &gt; 255) return 255; 390 else if (r &gt; 255) return 255;
287 else return r; 391 else return r;
288 } 392 }
289 393
290 y1 = (255 / 219.0) * (Y1 - 16); 394 y1 = (255 / 219.0) * (Y1 - 16);
291 pb = (255 / 224.0) * (Cb - 128); 395 pb = (255 / 224.0) * (Cb - 128);
292 pr = (255 / 224.0) * (Cr - 128); 396 pr = (255 / 224.0) * (Cr - 128);
293 397
294 r = 1.0 * y1 + 0 * pb + 1.402 * pr; 398 r = 1.0 * y1 + 0 * pb + 1.402 * pr;
295 g = 1.0 * y1 - 0.344 * pb - 0.714 * pr; 399 g = 1.0 * y1 - 0.344 * pb - 0.714 * pr;
296 b = 1.0 * y1 + 1.772 * pb + 0 * pr; 400 b = 1.0 * y1 + 1.772 * pb + 0 * pr;
297 401
298 ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */ 402 ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */
299 EG = clamp (g * 255); 403 EG = clamp (g * 255);
300 EB = clamp (b * 255); 404 EB = clamp (b * 255);
301 </programlisting> 405 </programlisting>
302 </example> 406 </example>
303 407
304 <table pgwide="1" id="v4l2-colorspace" orient="land"> 408 <table pgwide="1" id="v4l2-colorspace" orient="land">
305 <title>enum v4l2_colorspace</title> 409 <title>enum v4l2_colorspace</title>
306 <tgroup cols="11" align="center"> 410 <tgroup cols="11" align="center">
307 <colspec align="left" /> 411 <colspec align="left" />
308 <colspec align="center" /> 412 <colspec align="center" />
309 <colspec align="left" /> 413 <colspec align="left" />
310 <colspec colname="cr" /> 414 <colspec colname="cr" />
311 <colspec colname="cg" /> 415 <colspec colname="cg" />
312 <colspec colname="cb" /> 416 <colspec colname="cb" />
313 <colspec colname="wp" /> 417 <colspec colname="wp" />
314 <colspec colname="gc" /> 418 <colspec colname="gc" />
315 <colspec colname="lum" /> 419 <colspec colname="lum" />
316 <colspec colname="qy" /> 420 <colspec colname="qy" />
317 <colspec colname="qc" /> 421 <colspec colname="qc" />
318 <spanspec namest="cr" nameend="cb" spanname="chrom" /> 422 <spanspec namest="cr" nameend="cb" spanname="chrom" />
319 <spanspec namest="qy" nameend="qc" spanname="quant" /> 423 <spanspec namest="qy" nameend="qc" spanname="quant" />
320 <spanspec namest="lum" nameend="qc" spanname="spam" /> 424 <spanspec namest="lum" nameend="qc" spanname="spam" />
321 <thead> 425 <thead>
322 <row> 426 <row>
323 <entry morerows="1">Identifier</entry> 427 <entry morerows="1">Identifier</entry>
324 <entry morerows="1">Value</entry> 428 <entry morerows="1">Value</entry>
325 <entry morerows="1">Description</entry> 429 <entry morerows="1">Description</entry>
326 <entry spanname="chrom">Chromaticities<footnote> 430 <entry spanname="chrom">Chromaticities<footnote>
327 <para>The coordinates of the color primaries are 431 <para>The coordinates of the color primaries are
328 given in the CIE system (1931)</para> 432 given in the CIE system (1931)</para>
329 </footnote></entry> 433 </footnote></entry>
330 <entry morerows="1">White Point</entry> 434 <entry morerows="1">White Point</entry>
331 <entry morerows="1">Gamma Correction</entry> 435 <entry morerows="1">Gamma Correction</entry>
332 <entry morerows="1">Luminance E'<subscript>Y</subscript></entry> 436 <entry morerows="1">Luminance E'<subscript>Y</subscript></entry>
333 <entry spanname="quant">Quantization</entry> 437 <entry spanname="quant">Quantization</entry>
334 </row> 438 </row>
335 <row> 439 <row>
336 <entry>Red</entry> 440 <entry>Red</entry>
337 <entry>Green</entry> 441 <entry>Green</entry>
338 <entry>Blue</entry> 442 <entry>Blue</entry>
339 <entry>Y'</entry> 443 <entry>Y'</entry>
340 <entry>Cb, Cr</entry> 444 <entry>Cb, Cr</entry>
341 </row> 445 </row>
342 </thead> 446 </thead>
343 <tbody valign="top"> 447 <tbody valign="top">
344 <row> 448 <row>
345 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry> 449 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry>
346 <entry>1</entry> 450 <entry>1</entry>
347 <entry>NTSC/PAL according to <xref linkend="smpte170m" />, 451 <entry>NTSC/PAL according to <xref linkend="smpte170m" />,
348 <xref linkend="itu601" /></entry> 452 <xref linkend="itu601" /></entry>
349 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry> 453 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
350 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry> 454 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
351 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry> 455 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
352 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 456 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
353 Illuminant D<subscript>65</subscript></entry> 457 Illuminant D<subscript>65</subscript></entry>
354 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018, 458 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
355 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry> 459 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
356 <entry>0.299&nbsp;E'<subscript>R</subscript> 460 <entry>0.299&nbsp;E'<subscript>R</subscript>
357 +&nbsp;0.587&nbsp;E'<subscript>G</subscript> 461 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
358 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 462 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
359 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 463 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
360 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 464 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
361 </row> 465 </row>
362 <row> 466 <row>
363 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry> 467 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
364 <entry>2</entry> 468 <entry>2</entry>
365 <entry>1125-Line (US) HDTV, see <xref 469 <entry>1125-Line (US) HDTV, see <xref
366 linkend="smpte240m" /></entry> 470 linkend="smpte240m" /></entry>
367 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry> 471 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
368 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry> 472 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
369 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry> 473 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
370 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 474 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
371 Illuminant D<subscript>65</subscript></entry> 475 Illuminant D<subscript>65</subscript></entry>
372 <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228, 476 <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228,
373 1.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry> 477 1.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry>
374 <entry>0.212&nbsp;E'<subscript>R</subscript> 478 <entry>0.212&nbsp;E'<subscript>R</subscript>
375 +&nbsp;0.701&nbsp;E'<subscript>G</subscript> 479 +&nbsp;0.701&nbsp;E'<subscript>G</subscript>
376 +&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry> 480 +&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry>
377 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 481 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
378 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 482 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
379 </row> 483 </row>
380 <row> 484 <row>
381 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry> 485 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry>
382 <entry>3</entry> 486 <entry>3</entry>
383 <entry>HDTV and modern devices, see <xref 487 <entry>HDTV and modern devices, see <xref
384 linkend="itu709" /></entry> 488 linkend="itu709" /></entry>
385 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry> 489 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
386 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry> 490 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
387 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry> 491 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
388 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 492 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
389 Illuminant D<subscript>65</subscript></entry> 493 Illuminant D<subscript>65</subscript></entry>
390 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018, 494 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
391 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry> 495 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
392 <entry>0.2125&nbsp;E'<subscript>R</subscript> 496 <entry>0.2125&nbsp;E'<subscript>R</subscript>
393 +&nbsp;0.7154&nbsp;E'<subscript>G</subscript> 497 +&nbsp;0.7154&nbsp;E'<subscript>G</subscript>
394 +&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry> 498 +&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry>
395 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 499 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
396 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 500 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
397 </row> 501 </row>
398 <row> 502 <row>
399 <entry><constant>V4L2_COLORSPACE_BT878</constant></entry> 503 <entry><constant>V4L2_COLORSPACE_BT878</constant></entry>
400 <entry>4</entry> 504 <entry>4</entry>
401 <entry>Broken Bt878 extents<footnote> 505 <entry>Broken Bt878 extents<footnote>
402 <para>The ubiquitous Bt878 video capture chip 506 <para>The ubiquitous Bt878 video capture chip
403 quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range 507 quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range
404 of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip; 508 of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip;
405 235. This is not a typo in the Bt878 documentation, it has been 509 235. This is not a typo in the Bt878 documentation, it has been
406 implemented in silicon. The chroma extents are unclear.</para> 510 implemented in silicon. The chroma extents are unclear.</para>
407 </footnote>, <xref linkend="itu601" /></entry> 511 </footnote>, <xref linkend="itu601" /></entry>
408 <entry>?</entry> 512 <entry>?</entry>
409 <entry>?</entry> 513 <entry>?</entry>
410 <entry>?</entry> 514 <entry>?</entry>
411 <entry>?</entry> 515 <entry>?</entry>
412 <entry>?</entry> 516 <entry>?</entry>
413 <entry>0.299&nbsp;E'<subscript>R</subscript> 517 <entry>0.299&nbsp;E'<subscript>R</subscript>
414 +&nbsp;0.587&nbsp;E'<subscript>G</subscript> 518 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
415 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 519 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
416 <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 520 <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
417 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry> 521 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry>
418 </row> 522 </row>
419 <row> 523 <row>
420 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry> 524 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry>
421 <entry>5</entry> 525 <entry>5</entry>
422 <entry>M/NTSC<footnote> 526 <entry>M/NTSC<footnote>
423 <para>No identifier exists for M/PAL which uses 527 <para>No identifier exists for M/PAL which uses
424 the chromaticities of M/NTSC, the remaining parameters are equal to B and 528 the chromaticities of M/NTSC, the remaining parameters are equal to B and
425 G/PAL.</para> 529 G/PAL.</para>
426 </footnote> according to <xref linkend="itu470" />, <xref 530 </footnote> according to <xref linkend="itu470" />, <xref
427 linkend="itu601" /></entry> 531 linkend="itu601" /></entry>
428 <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry> 532 <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry>
429 <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry> 533 <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry>
430 <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry> 534 <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry>
431 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry> 535 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry>
432 <entry>?</entry> 536 <entry>?</entry>
433 <entry>0.299&nbsp;E'<subscript>R</subscript> 537 <entry>0.299&nbsp;E'<subscript>R</subscript>
434 +&nbsp;0.587&nbsp;E'<subscript>G</subscript> 538 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
435 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 539 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
436 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 540 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
437 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 541 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
438 </row> 542 </row>
439 <row> 543 <row>
440 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry> 544 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry>
441 <entry>6</entry> 545 <entry>6</entry>
442 <entry>625-line PAL and SECAM systems according to <xref 546 <entry>625-line PAL and SECAM systems according to <xref
443 linkend="itu470" />, <xref linkend="itu601" /></entry> 547 linkend="itu470" />, <xref linkend="itu601" /></entry>
444 <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry> 548 <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry>
445 <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry> 549 <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry>
446 <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry> 550 <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry>
447 <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329, 551 <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329,
448 Illuminant D<subscript>65</subscript></entry> 552 Illuminant D<subscript>65</subscript></entry>
449 <entry>?</entry> 553 <entry>?</entry>
450 <entry>0.299&nbsp;E'<subscript>R</subscript> 554 <entry>0.299&nbsp;E'<subscript>R</subscript>
451 +&nbsp;0.587&nbsp;E'<subscript>G</subscript> 555 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
452 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 556 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
453 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry> 557 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
454 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 558 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
455 </row> 559 </row>
456 <row> 560 <row>
457 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry> 561 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry>
458 <entry>7</entry> 562 <entry>7</entry>
459 <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry> 563 <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry>
460 <entry>?</entry> 564 <entry>?</entry>
461 <entry>?</entry> 565 <entry>?</entry>
462 <entry>?</entry> 566 <entry>?</entry>
463 <entry>?</entry> 567 <entry>?</entry>
464 <entry>?</entry> 568 <entry>?</entry>
465 <entry>0.299&nbsp;E'<subscript>R</subscript> 569 <entry>0.299&nbsp;E'<subscript>R</subscript>
466 +&nbsp;0.587&nbsp;E'<subscript>G</subscript> 570 +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
467 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 571 +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
468 <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote> 572 <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote>
469 <para>Note JFIF quantizes 573 <para>Note JFIF quantizes
470 Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and 574 Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and
471 [-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals 575 [-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals
472 are still clamped to [0;255].</para> 576 are still clamped to [0;255].</para>
473 </footnote></entry> 577 </footnote></entry>
474 <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry> 578 <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
475 </row> 579 </row>
476 <row> 580 <row>
477 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry> 581 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry>
478 <entry>8</entry> 582 <entry>8</entry>
479 <entry>[?]</entry> 583 <entry>[?]</entry>
480 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry> 584 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
481 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry> 585 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
482 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry> 586 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
483 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 587 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
484 Illuminant D<subscript>65</subscript></entry> 588 Illuminant D<subscript>65</subscript></entry>
485 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018, 589 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
486 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry> 590 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
487 <entry spanname="spam">n/a</entry> 591 <entry spanname="spam">n/a</entry>
488 </row> 592 </row>
489 </tbody> 593 </tbody>
490 </tgroup> 594 </tgroup>
491 </table> 595 </table>
492 </section> 596 </section>
493 597
494 <section id="pixfmt-indexed"> 598 <section id="pixfmt-indexed">
495 <title>Indexed Format</title> 599 <title>Indexed Format</title>
496 600
497 <para>In this format each pixel is represented by an 8 bit index 601 <para>In this format each pixel is represented by an 8 bit index
498 into a 256 entry ARGB palette. It is intended for <link 602 into a 256 entry ARGB palette. It is intended for <link
499 linkend="osd">Video Output Overlays</link> only. There are no ioctls to 603 linkend="osd">Video Output Overlays</link> only. There are no ioctls to
500 access the palette, this must be done with ioctls of the Linux framebuffer API.</para> 604 access the palette, this must be done with ioctls of the Linux framebuffer API.</para>
501 605
502 <table pgwide="0" frame="none"> 606 <table pgwide="0" frame="none">
503 <title>Indexed Image Format</title> 607 <title>Indexed Image Format</title>
504 <tgroup cols="37" align="center"> 608 <tgroup cols="37" align="center">
505 <colspec colname="id" align="left" /> 609 <colspec colname="id" align="left" />
506 <colspec colname="fourcc" /> 610 <colspec colname="fourcc" />
507 <colspec colname="bit" /> 611 <colspec colname="bit" />
508 612
509 <colspec colnum="4" colname="b07" align="center" /> 613 <colspec colnum="4" colname="b07" align="center" />
510 <colspec colnum="5" colname="b06" align="center" /> 614 <colspec colnum="5" colname="b06" align="center" />
511 <colspec colnum="6" colname="b05" align="center" /> 615 <colspec colnum="6" colname="b05" align="center" />
512 <colspec colnum="7" colname="b04" align="center" /> 616 <colspec colnum="7" colname="b04" align="center" />
513 <colspec colnum="8" colname="b03" align="center" /> 617 <colspec colnum="8" colname="b03" align="center" />
514 <colspec colnum="9" colname="b02" align="center" /> 618 <colspec colnum="9" colname="b02" align="center" />
515 <colspec colnum="10" colname="b01" align="center" /> 619 <colspec colnum="10" colname="b01" align="center" />
516 <colspec colnum="11" colname="b00" align="center" /> 620 <colspec colnum="11" colname="b00" align="center" />
517 621
518 <spanspec namest="b07" nameend="b00" spanname="b0" /> 622 <spanspec namest="b07" nameend="b00" spanname="b0" />
519 <spanspec namest="b17" nameend="b10" spanname="b1" /> 623 <spanspec namest="b17" nameend="b10" spanname="b1" />
520 <spanspec namest="b27" nameend="b20" spanname="b2" /> 624 <spanspec namest="b27" nameend="b20" spanname="b2" />
521 <spanspec namest="b37" nameend="b30" spanname="b3" /> 625 <spanspec namest="b37" nameend="b30" spanname="b3" />
522 <thead> 626 <thead>
523 <row> 627 <row>
524 <entry>Identifier</entry> 628 <entry>Identifier</entry>
525 <entry>Code</entry> 629 <entry>Code</entry>
526 <entry>&nbsp;</entry> 630 <entry>&nbsp;</entry>
527 <entry spanname="b0">Byte&nbsp;0</entry> 631 <entry spanname="b0">Byte&nbsp;0</entry>
528 </row> 632 </row>
529 <row> 633 <row>
530 <entry>&nbsp;</entry> 634 <entry>&nbsp;</entry>
531 <entry>&nbsp;</entry> 635 <entry>&nbsp;</entry>
532 <entry>Bit</entry> 636 <entry>Bit</entry>
533 <entry>7</entry> 637 <entry>7</entry>
534 <entry>6</entry> 638 <entry>6</entry>
535 <entry>5</entry> 639 <entry>5</entry>
536 <entry>4</entry> 640 <entry>4</entry>
537 <entry>3</entry> 641 <entry>3</entry>
538 <entry>2</entry> 642 <entry>2</entry>
539 <entry>1</entry> 643 <entry>1</entry>
540 <entry>0</entry> 644 <entry>0</entry>
541 </row> 645 </row>
542 </thead> 646 </thead>
543 <tbody valign="top"> 647 <tbody valign="top">
544 <row id="V4L2-PIX-FMT-PAL8"> 648 <row id="V4L2-PIX-FMT-PAL8">
545 <entry><constant>V4L2_PIX_FMT_PAL8</constant></entry> 649 <entry><constant>V4L2_PIX_FMT_PAL8</constant></entry>
546 <entry>'PAL8'</entry> 650 <entry>'PAL8'</entry>
547 <entry></entry> 651 <entry></entry>
548 <entry>i<subscript>7</subscript></entry> 652 <entry>i<subscript>7</subscript></entry>
549 <entry>i<subscript>6</subscript></entry> 653 <entry>i<subscript>6</subscript></entry>
550 <entry>i<subscript>5</subscript></entry> 654 <entry>i<subscript>5</subscript></entry>
551 <entry>i<subscript>4</subscript></entry> 655 <entry>i<subscript>4</subscript></entry>
552 <entry>i<subscript>3</subscript></entry> 656 <entry>i<subscript>3</subscript></entry>
553 <entry>i<subscript>2</subscript></entry> 657 <entry>i<subscript>2</subscript></entry>
554 <entry>i<subscript>1</subscript></entry> 658 <entry>i<subscript>1</subscript></entry>
555 <entry>i<subscript>0</subscript></entry> 659 <entry>i<subscript>0</subscript></entry>
556 </row> 660 </row>
557 </tbody> 661 </tbody>
558 </tgroup> 662 </tgroup>
559 </table> 663 </table>
560 </section> 664 </section>
561 665
562 <section id="pixfmt-rgb"> 666 <section id="pixfmt-rgb">
563 <title>RGB Formats</title> 667 <title>RGB Formats</title>
564 668
565 &sub-packed-rgb; 669 &sub-packed-rgb;
566 &sub-sbggr8; 670 &sub-sbggr8;
567 &sub-sgbrg8; 671 &sub-sgbrg8;
568 &sub-sgrbg8; 672 &sub-sgrbg8;
569 &sub-srggb8; 673 &sub-srggb8;
570 &sub-sbggr16; 674 &sub-sbggr16;
571 &sub-srggb10; 675 &sub-srggb10;
572 </section> 676 </section>
573 677
574 <section id="yuv-formats"> 678 <section id="yuv-formats">
575 <title>YUV Formats</title> 679 <title>YUV Formats</title>
576 680
577 <para>YUV is the format native to TV broadcast and composite video 681 <para>YUV is the format native to TV broadcast and composite video
578 signals. It separates the brightness information (Y) from the color 682 signals. It separates the brightness information (Y) from the color
579 information (U and V or Cb and Cr). The color information consists of 683 information (U and V or Cb and Cr). The color information consists of
580 red and blue <emphasis>color difference</emphasis> signals, this way 684 red and blue <emphasis>color difference</emphasis> signals, this way
581 the green component can be reconstructed by subtracting from the 685 the green component can be reconstructed by subtracting from the
582 brightness component. See <xref linkend="colorspaces" /> for conversion 686 brightness component. See <xref linkend="colorspaces" /> for conversion
583 examples. YUV was chosen because early television would only transmit 687 examples. YUV was chosen because early television would only transmit
584 brightness information. To add color in a way compatible with existing 688 brightness information. To add color in a way compatible with existing
585 receivers a new signal carrier was added to transmit the color 689 receivers a new signal carrier was added to transmit the color
586 difference signals. Secondary in the YUV format the U and V components 690 difference signals. Secondary in the YUV format the U and V components
587 usually have lower resolution than the Y component. This is an analog 691 usually have lower resolution than the Y component. This is an analog
588 video compression technique taking advantage of a property of the 692 video compression technique taking advantage of a property of the
589 human visual system, being more sensitive to brightness 693 human visual system, being more sensitive to brightness
590 information.</para> 694 information.</para>
591 695
592 &sub-packed-yuv; 696 &sub-packed-yuv;
593 &sub-grey; 697 &sub-grey;
594 &sub-y10; 698 &sub-y10;
595 &sub-y16; 699 &sub-y16;
596 &sub-yuyv; 700 &sub-yuyv;
597 &sub-uyvy; 701 &sub-uyvy;
598 &sub-yvyu; 702 &sub-yvyu;
599 &sub-vyuy; 703 &sub-vyuy;
600 &sub-y41p; 704 &sub-y41p;
601 &sub-yuv420; 705 &sub-yuv420;
602 &sub-yuv410; 706 &sub-yuv410;
603 &sub-yuv422p; 707 &sub-yuv422p;
604 &sub-yuv411p; 708 &sub-yuv411p;
605 &sub-nv12; 709 &sub-nv12;
606 &sub-nv16; 710 &sub-nv16;
607 </section> 711 </section>
608 712
609 <section> 713 <section>
610 <title>Compressed Formats</title> 714 <title>Compressed Formats</title>
611 715
612 <table pgwide="1" frame="none" id="compressed-formats"> 716 <table pgwide="1" frame="none" id="compressed-formats">
613 <title>Compressed Image Formats</title> 717 <title>Compressed Image Formats</title>
614 <tgroup cols="3" align="left"> 718 <tgroup cols="3" align="left">
615 &cs-def; 719 &cs-def;
616 <thead> 720 <thead>
617 <row> 721 <row>
618 <entry>Identifier</entry> 722 <entry>Identifier</entry>
619 <entry>Code</entry> 723 <entry>Code</entry>
620 <entry>Details</entry> 724 <entry>Details</entry>
621 </row> 725 </row>
622 </thead> 726 </thead>
623 <tbody valign="top"> 727 <tbody valign="top">
624 <row id="V4L2-PIX-FMT-JPEG"> 728 <row id="V4L2-PIX-FMT-JPEG">
625 <entry><constant>V4L2_PIX_FMT_JPEG</constant></entry> 729 <entry><constant>V4L2_PIX_FMT_JPEG</constant></entry>
626 <entry>'JPEG'</entry> 730 <entry>'JPEG'</entry>
627 <entry>TBD. See also &VIDIOC-G-JPEGCOMP;, 731 <entry>TBD. See also &VIDIOC-G-JPEGCOMP;,
628 &VIDIOC-S-JPEGCOMP;.</entry> 732 &VIDIOC-S-JPEGCOMP;.</entry>
629 </row> 733 </row>
630 <row id="V4L2-PIX-FMT-MPEG"> 734 <row id="V4L2-PIX-FMT-MPEG">
631 <entry><constant>V4L2_PIX_FMT_MPEG</constant></entry> 735 <entry><constant>V4L2_PIX_FMT_MPEG</constant></entry>
632 <entry>'MPEG'</entry> 736 <entry>'MPEG'</entry>
633 <entry>MPEG stream. The actual format is determined by 737 <entry>MPEG stream. The actual format is determined by
634 extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see 738 extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see
635 <xref linkend="mpeg-control-id" />.</entry> 739 <xref linkend="mpeg-control-id" />.</entry>
636 </row> 740 </row>
637 </tbody> 741 </tbody>
638 </tgroup> 742 </tgroup>
639 </table> 743 </table>
640 </section> 744 </section>
641 745
642 <section id="pixfmt-reserved"> 746 <section id="pixfmt-reserved">
643 <title>Reserved Format Identifiers</title> 747 <title>Reserved Format Identifiers</title>
644 748
645 <para>These formats are not defined by this specification, they 749 <para>These formats are not defined by this specification, they
646 are just listed for reference and to avoid naming conflicts. If you 750 are just listed for reference and to avoid naming conflicts. If you
647 want to register your own format, send an e-mail to the linux-media mailing 751 want to register your own format, send an e-mail to the linux-media mailing
648 list &v4l-ml; for inclusion in the <filename>videodev2.h</filename> 752 list &v4l-ml; for inclusion in the <filename>videodev2.h</filename>
649 file. If you want to share your format with other developers add a 753 file. If you want to share your format with other developers add a
650 link to your documentation and send a copy to the linux-media mailing list 754 link to your documentation and send a copy to the linux-media mailing list
651 for inclusion in this section. If you think your format should be listed 755 for inclusion in this section. If you think your format should be listed
652 in a standard format section please make a proposal on the linux-media mailing 756 in a standard format section please make a proposal on the linux-media mailing
653 list.</para> 757 list.</para>
654 758
655 <table pgwide="1" frame="none" id="reserved-formats"> 759 <table pgwide="1" frame="none" id="reserved-formats">
656 <title>Reserved Image Formats</title> 760 <title>Reserved Image Formats</title>
657 <tgroup cols="3" align="left"> 761 <tgroup cols="3" align="left">
658 &cs-def; 762 &cs-def;
659 <thead> 763 <thead>
660 <row> 764 <row>
661 <entry>Identifier</entry> 765 <entry>Identifier</entry>
662 <entry>Code</entry> 766 <entry>Code</entry>
663 <entry>Details</entry> 767 <entry>Details</entry>
664 </row> 768 </row>
665 </thead> 769 </thead>
666 <tbody valign="top"> 770 <tbody valign="top">
667 <row id="V4L2-PIX-FMT-DV"> 771 <row id="V4L2-PIX-FMT-DV">
668 <entry><constant>V4L2_PIX_FMT_DV</constant></entry> 772 <entry><constant>V4L2_PIX_FMT_DV</constant></entry>
669 <entry>'dvsd'</entry> 773 <entry>'dvsd'</entry>
670 <entry>unknown</entry> 774 <entry>unknown</entry>
671 </row> 775 </row>
672 <row id="V4L2-PIX-FMT-ET61X251"> 776 <row id="V4L2-PIX-FMT-ET61X251">
673 <entry><constant>V4L2_PIX_FMT_ET61X251</constant></entry> 777 <entry><constant>V4L2_PIX_FMT_ET61X251</constant></entry>
674 <entry>'E625'</entry> 778 <entry>'E625'</entry>
675 <entry>Compressed format of the ET61X251 driver.</entry> 779 <entry>Compressed format of the ET61X251 driver.</entry>
676 </row> 780 </row>
677 <row id="V4L2-PIX-FMT-HI240"> 781 <row id="V4L2-PIX-FMT-HI240">
678 <entry><constant>V4L2_PIX_FMT_HI240</constant></entry> 782 <entry><constant>V4L2_PIX_FMT_HI240</constant></entry>
679 <entry>'HI24'</entry> 783 <entry>'HI24'</entry>
680 <entry><para>8 bit RGB format used by the BTTV driver.</para></entry> 784 <entry><para>8 bit RGB format used by the BTTV driver.</para></entry>
681 </row> 785 </row>
682 <row id="V4L2-PIX-FMT-HM12"> 786 <row id="V4L2-PIX-FMT-HM12">
683 <entry><constant>V4L2_PIX_FMT_HM12</constant></entry> 787 <entry><constant>V4L2_PIX_FMT_HM12</constant></entry>
684 <entry>'HM12'</entry> 788 <entry>'HM12'</entry>
685 <entry><para>YUV 4:2:0 format used by the 789 <entry><para>YUV 4:2:0 format used by the
686 IVTV driver, <ulink url="http://www.ivtvdriver.org/"> 790 IVTV driver, <ulink url="http://www.ivtvdriver.org/">
687 http://www.ivtvdriver.org/</ulink></para><para>The format is documented in the 791 http://www.ivtvdriver.org/</ulink></para><para>The format is documented in the
688 kernel sources in the file <filename>Documentation/video4linux/cx2341x/README.hm12</filename> 792 kernel sources in the file <filename>Documentation/video4linux/cx2341x/README.hm12</filename>
689 </para></entry> 793 </para></entry>
690 </row> 794 </row>
691 <row id="V4L2-PIX-FMT-CPIA1"> 795 <row id="V4L2-PIX-FMT-CPIA1">
692 <entry><constant>V4L2_PIX_FMT_CPIA1</constant></entry> 796 <entry><constant>V4L2_PIX_FMT_CPIA1</constant></entry>
693 <entry>'CPIA'</entry> 797 <entry>'CPIA'</entry>
694 <entry>YUV format used by the gspca cpia1 driver.</entry> 798 <entry>YUV format used by the gspca cpia1 driver.</entry>
695 </row> 799 </row>
696 <row id="V4L2-PIX-FMT-SPCA501"> 800 <row id="V4L2-PIX-FMT-SPCA501">
697 <entry><constant>V4L2_PIX_FMT_SPCA501</constant></entry> 801 <entry><constant>V4L2_PIX_FMT_SPCA501</constant></entry>
698 <entry>'S501'</entry> 802 <entry>'S501'</entry>
699 <entry>YUYV per line used by the gspca driver.</entry> 803 <entry>YUYV per line used by the gspca driver.</entry>
700 </row> 804 </row>
701 <row id="V4L2-PIX-FMT-SPCA505"> 805 <row id="V4L2-PIX-FMT-SPCA505">
702 <entry><constant>V4L2_PIX_FMT_SPCA505</constant></entry> 806 <entry><constant>V4L2_PIX_FMT_SPCA505</constant></entry>
703 <entry>'S505'</entry> 807 <entry>'S505'</entry>
704 <entry>YYUV per line used by the gspca driver.</entry> 808 <entry>YYUV per line used by the gspca driver.</entry>
705 </row> 809 </row>
706 <row id="V4L2-PIX-FMT-SPCA508"> 810 <row id="V4L2-PIX-FMT-SPCA508">
707 <entry><constant>V4L2_PIX_FMT_SPCA508</constant></entry> 811 <entry><constant>V4L2_PIX_FMT_SPCA508</constant></entry>
708 <entry>'S508'</entry> 812 <entry>'S508'</entry>
709 <entry>YUVY per line used by the gspca driver.</entry> 813 <entry>YUVY per line used by the gspca driver.</entry>
710 </row> 814 </row>
711 <row id="V4L2-PIX-FMT-SPCA561"> 815 <row id="V4L2-PIX-FMT-SPCA561">
712 <entry><constant>V4L2_PIX_FMT_SPCA561</constant></entry> 816 <entry><constant>V4L2_PIX_FMT_SPCA561</constant></entry>
713 <entry>'S561'</entry> 817 <entry>'S561'</entry>
714 <entry>Compressed GBRG Bayer format used by the gspca driver.</entry> 818 <entry>Compressed GBRG Bayer format used by the gspca driver.</entry>
715 </row> 819 </row>
716 <row id="V4L2-PIX-FMT-SGRBG10DPCM8"> 820 <row id="V4L2-PIX-FMT-SGRBG10DPCM8">
717 <entry><constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant></entry> 821 <entry><constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant></entry>
718 <entry>'DB10'</entry> 822 <entry>'DB10'</entry>
719 <entry>10 bit raw Bayer DPCM compressed to 8 bits.</entry> 823 <entry>10 bit raw Bayer DPCM compressed to 8 bits.</entry>
720 </row> 824 </row>
721 <row id="V4L2-PIX-FMT-PAC207"> 825 <row id="V4L2-PIX-FMT-PAC207">
722 <entry><constant>V4L2_PIX_FMT_PAC207</constant></entry> 826 <entry><constant>V4L2_PIX_FMT_PAC207</constant></entry>
723 <entry>'P207'</entry> 827 <entry>'P207'</entry>
724 <entry>Compressed BGGR Bayer format used by the gspca driver.</entry> 828 <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
725 </row> 829 </row>
726 <row id="V4L2-PIX-FMT-MR97310A"> 830 <row id="V4L2-PIX-FMT-MR97310A">
727 <entry><constant>V4L2_PIX_FMT_MR97310A</constant></entry> 831 <entry><constant>V4L2_PIX_FMT_MR97310A</constant></entry>
728 <entry>'M310'</entry> 832 <entry>'M310'</entry>
729 <entry>Compressed BGGR Bayer format used by the gspca driver.</entry> 833 <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
730 </row> 834 </row>
731 <row id="V4L2-PIX-FMT-OV511"> 835 <row id="V4L2-PIX-FMT-OV511">
732 <entry><constant>V4L2_PIX_FMT_OV511</constant></entry> 836 <entry><constant>V4L2_PIX_FMT_OV511</constant></entry>
733 <entry>'O511'</entry> 837 <entry>'O511'</entry>
734 <entry>OV511 JPEG format used by the gspca driver.</entry> 838 <entry>OV511 JPEG format used by the gspca driver.</entry>
735 </row> 839 </row>
736 <row id="V4L2-PIX-FMT-OV518"> 840 <row id="V4L2-PIX-FMT-OV518">
737 <entry><constant>V4L2_PIX_FMT_OV518</constant></entry> 841 <entry><constant>V4L2_PIX_FMT_OV518</constant></entry>
738 <entry>'O518'</entry> 842 <entry>'O518'</entry>
739 <entry>OV518 JPEG format used by the gspca driver.</entry> 843 <entry>OV518 JPEG format used by the gspca driver.</entry>
740 </row> 844 </row>
741 <row id="V4L2-PIX-FMT-PJPG"> 845 <row id="V4L2-PIX-FMT-PJPG">
742 <entry><constant>V4L2_PIX_FMT_PJPG</constant></entry> 846 <entry><constant>V4L2_PIX_FMT_PJPG</constant></entry>
743 <entry>'PJPG'</entry> 847 <entry>'PJPG'</entry>
744 <entry>Pixart 73xx JPEG format used by the gspca driver.</entry> 848 <entry>Pixart 73xx JPEG format used by the gspca driver.</entry>
745 </row> 849 </row>
746 <row id="V4L2-PIX-FMT-SQ905C"> 850 <row id="V4L2-PIX-FMT-SQ905C">
747 <entry><constant>V4L2_PIX_FMT_SQ905C</constant></entry> 851 <entry><constant>V4L2_PIX_FMT_SQ905C</constant></entry>
748 <entry>'905C'</entry> 852 <entry>'905C'</entry>
749 <entry>Compressed RGGB bayer format used by the gspca driver.</entry> 853 <entry>Compressed RGGB bayer format used by the gspca driver.</entry>
750 </row> 854 </row>
751 <row id="V4L2-PIX-FMT-MJPEG"> 855 <row id="V4L2-PIX-FMT-MJPEG">
752 <entry><constant>V4L2_PIX_FMT_MJPEG</constant></entry> 856 <entry><constant>V4L2_PIX_FMT_MJPEG</constant></entry>
753 <entry>'MJPG'</entry> 857 <entry>'MJPG'</entry>
754 <entry>Compressed format used by the Zoran driver</entry> 858 <entry>Compressed format used by the Zoran driver</entry>
755 </row> 859 </row>
756 <row id="V4L2-PIX-FMT-PWC1"> 860 <row id="V4L2-PIX-FMT-PWC1">
757 <entry><constant>V4L2_PIX_FMT_PWC1</constant></entry> 861 <entry><constant>V4L2_PIX_FMT_PWC1</constant></entry>
758 <entry>'PWC1'</entry> 862 <entry>'PWC1'</entry>
759 <entry>Compressed format of the PWC driver.</entry> 863 <entry>Compressed format of the PWC driver.</entry>
760 </row> 864 </row>
761 <row id="V4L2-PIX-FMT-PWC2"> 865 <row id="V4L2-PIX-FMT-PWC2">
762 <entry><constant>V4L2_PIX_FMT_PWC2</constant></entry> 866 <entry><constant>V4L2_PIX_FMT_PWC2</constant></entry>
763 <entry>'PWC2'</entry> 867 <entry>'PWC2'</entry>
764 <entry>Compressed format of the PWC driver.</entry> 868 <entry>Compressed format of the PWC driver.</entry>
765 </row> 869 </row>
766 <row id="V4L2-PIX-FMT-SN9C10X"> 870 <row id="V4L2-PIX-FMT-SN9C10X">
767 <entry><constant>V4L2_PIX_FMT_SN9C10X</constant></entry> 871 <entry><constant>V4L2_PIX_FMT_SN9C10X</constant></entry>
768 <entry>'S910'</entry> 872 <entry>'S910'</entry>
769 <entry>Compressed format of the SN9C102 driver.</entry> 873 <entry>Compressed format of the SN9C102 driver.</entry>
770 </row> 874 </row>
771 <row id="V4L2-PIX-FMT-SN9C20X-I420"> 875 <row id="V4L2-PIX-FMT-SN9C20X-I420">
772 <entry><constant>V4L2_PIX_FMT_SN9C20X_I420</constant></entry> 876 <entry><constant>V4L2_PIX_FMT_SN9C20X_I420</constant></entry>
773 <entry>'S920'</entry> 877 <entry>'S920'</entry>
774 <entry>YUV 4:2:0 format of the gspca sn9c20x driver.</entry> 878 <entry>YUV 4:2:0 format of the gspca sn9c20x driver.</entry>
775 </row> 879 </row>
776 <row id="V4L2-PIX-FMT-SN9C2028"> 880 <row id="V4L2-PIX-FMT-SN9C2028">
777 <entry><constant>V4L2_PIX_FMT_SN9C2028</constant></entry> 881 <entry><constant>V4L2_PIX_FMT_SN9C2028</constant></entry>
778 <entry>'SONX'</entry> 882 <entry>'SONX'</entry>
779 <entry>Compressed GBRG bayer format of the gspca sn9c2028 driver.</entry> 883 <entry>Compressed GBRG bayer format of the gspca sn9c2028 driver.</entry>
780 </row> 884 </row>
781 <row id="V4L2-PIX-FMT-STV0680"> 885 <row id="V4L2-PIX-FMT-STV0680">
782 <entry><constant>V4L2_PIX_FMT_STV0680</constant></entry> 886 <entry><constant>V4L2_PIX_FMT_STV0680</constant></entry>
783 <entry>'S680'</entry> 887 <entry>'S680'</entry>
784 <entry>Bayer format of the gspca stv0680 driver.</entry> 888 <entry>Bayer format of the gspca stv0680 driver.</entry>
785 </row> 889 </row>
786 <row id="V4L2-PIX-FMT-WNVA"> 890 <row id="V4L2-PIX-FMT-WNVA">
787 <entry><constant>V4L2_PIX_FMT_WNVA</constant></entry> 891 <entry><constant>V4L2_PIX_FMT_WNVA</constant></entry>
788 <entry>'WNVA'</entry> 892 <entry>'WNVA'</entry>
789 <entry><para>Used by the Winnov Videum driver, <ulink 893 <entry><para>Used by the Winnov Videum driver, <ulink
790 url="http://www.thedirks.org/winnov/"> 894 url="http://www.thedirks.org/winnov/">
791 http://www.thedirks.org/winnov/</ulink></para></entry> 895 http://www.thedirks.org/winnov/</ulink></para></entry>
792 </row> 896 </row>
793 <row id="V4L2-PIX-FMT-TM6000"> 897 <row id="V4L2-PIX-FMT-TM6000">
794 <entry><constant>V4L2_PIX_FMT_TM6000</constant></entry> 898 <entry><constant>V4L2_PIX_FMT_TM6000</constant></entry>
795 <entry>'TM60'</entry> 899 <entry>'TM60'</entry>
796 <entry><para>Used by Trident tm6000</para></entry> 900 <entry><para>Used by Trident tm6000</para></entry>
797 </row> 901 </row>
798 <row id="V4L2-PIX-FMT-CIT-YYVYUY"> 902 <row id="V4L2-PIX-FMT-CIT-YYVYUY">
799 <entry><constant>V4L2_PIX_FMT_CIT_YYVYUY</constant></entry> 903 <entry><constant>V4L2_PIX_FMT_CIT_YYVYUY</constant></entry>
800 <entry>'CITV'</entry> 904 <entry>'CITV'</entry>
801 <entry><para>Used by xirlink CIT, found at IBM webcams.</para> 905 <entry><para>Used by xirlink CIT, found at IBM webcams.</para>
802 <para>Uses one line of Y then 1 line of VYUY</para> 906 <para>Uses one line of Y then 1 line of VYUY</para>
803 </entry> 907 </entry>
804 </row> 908 </row>
805 <row id="V4L2-PIX-FMT-KONICA420"> 909 <row id="V4L2-PIX-FMT-KONICA420">
806 <entry><constant>V4L2_PIX_FMT_KONICA420</constant></entry> 910 <entry><constant>V4L2_PIX_FMT_KONICA420</constant></entry>
807 <entry>'KONI'</entry> 911 <entry>'KONI'</entry>
808 <entry><para>Used by Konica webcams.</para> 912 <entry><para>Used by Konica webcams.</para>
809 <para>YUV420 planar in blocks of 256 pixels.</para> 913 <para>YUV420 planar in blocks of 256 pixels.</para>
810 </entry> 914 </entry>
811 </row> 915 </row>
812 <row id="V4L2-PIX-FMT-YYUV"> 916 <row id="V4L2-PIX-FMT-YYUV">
813 <entry><constant>V4L2_PIX_FMT_YYUV</constant></entry> 917 <entry><constant>V4L2_PIX_FMT_YYUV</constant></entry>
814 <entry>'YYUV'</entry> 918 <entry>'YYUV'</entry>
815 <entry>unknown</entry> 919 <entry>unknown</entry>
816 </row> 920 </row>
817 <row id="V4L2-PIX-FMT-Y4"> 921 <row id="V4L2-PIX-FMT-Y4">
818 <entry><constant>V4L2_PIX_FMT_Y4</constant></entry> 922 <entry><constant>V4L2_PIX_FMT_Y4</constant></entry>
819 <entry>'Y04 '</entry> 923 <entry>'Y04 '</entry>
820 <entry>Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, 924 <entry>Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used,
821 the other bits are set to 0.</entry> 925 the other bits are set to 0.</entry>
822 </row> 926 </row>
823 <row id="V4L2-PIX-FMT-Y6"> 927 <row id="V4L2-PIX-FMT-Y6">
824 <entry><constant>V4L2_PIX_FMT_Y6</constant></entry> 928 <entry><constant>V4L2_PIX_FMT_Y6</constant></entry>
825 <entry>'Y06 '</entry> 929 <entry>'Y06 '</entry>
826 <entry>Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, 930 <entry>Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used,
827 the other bits are set to 0.</entry> 931 the other bits are set to 0.</entry>
828 </row> 932 </row>
829 </tbody> 933 </tbody>
830 </tgroup> 934 </tgroup>
831 </table> 935 </table>
832 </section> 936 </section>
833 937
834 <!-- 938 <!--
835 Local Variables: 939 Local Variables:
836 mode: sgml 940 mode: sgml
837 sgml-parent-document: "v4l2.sgml" 941 sgml-parent-document: "v4l2.sgml"
838 indent-tabs-mode: nil 942 indent-tabs-mode: nil
839 End: 943 End:
840 --> 944 -->
841 945
Documentation/DocBook/v4l/planar-apis.xml
File was created 1 <section id="planar-apis">
2 <title>Single- and multi-planar APIs</title>
3
4 <para>Some devices require data for each input or output video frame
5 to be placed in discontiguous memory buffers. In such cases one
6 video frame has to be addressed using more than one memory address, i.e. one
7 pointer per "plane". A plane is a sub-buffer of current frame. For examples
8 of such formats see <xref linkend="pixfmt" />.</para>
9
10 <para>Initially, V4L2 API did not support multi-planar buffers and a set of
11 extensions has been introduced to handle them. Those extensions constitute
12 what is being referred to as the "multi-planar API".</para>
13
14 <para>Some of the V4L2 API calls and structures are interpreted differently,
15 depending on whether single- or multi-planar API is being used. An application
16 can choose whether to use one or the other by passing a corresponding buffer
17 type to its ioctl calls. Multi-planar versions of buffer types are suffixed with
18 an `_MPLANE' string. For a list of available multi-planar buffer types
19 see &v4l2-buf-type;.
20 </para>
21
22 <section>
23 <title>Multi-planar formats</title>
24 <para>Multi-planar API introduces new multi-planar formats. Those formats
25 use a separate set of FourCC codes. It is important to distinguish between
26 the multi-planar API and a multi-planar format. Multi-planar API calls can
27 handle all single-planar formats as well, while the single-planar API cannot
28 handle multi-planar formats. Applications do not have to switch between APIs
29 when handling both single- and multi-planar devices and should use the
30 multi-planar API version for both single- and multi-planar formats.
31 Drivers that do not support multi-planar API can still be handled with it,
32 utilizing a compatibility layer built into standard V4L2 ioctl handling.
33 </para>
34 </section>
35
36 <section>
37 <title>Single and multi-planar API compatibility layer</title>
38 <para>In most cases<footnote><para>The compatibility layer does not cover
39 drivers that do not use video_ioctl2() call.</para></footnote>, applications
40 can use the multi-planar API with older drivers that support
41 only its single-planar version and vice versa. Appropriate conversion is
42 done seamlessly for both applications and drivers in the V4L2 core. The
43 general rule of thumb is: as long as an application uses formats that
44 a driver supports, it can use either API (although use of multi-planar
45 formats is only possible with the multi-planar API). The list of formats
46 supported by a driver can be obtained using the &VIDIOC-ENUM-FMT; call.
47 It is possible, but discouraged, for a driver or an application to support
48 and use both versions of the API.</para>
49 </section>
50
51 <section>
52 <title>Calls that distinguish between single and multi-planar APIs</title>
53 <variablelist>
54 <varlistentry>
55 <term>&VIDIOC-QUERYCAP;</term>
56 <listitem>Two additional multi-planar capabilities are added. They can
57 be set together with non-multi-planar ones for devices that handle
58 both single- and multi-planar formats.</listitem>
59 </varlistentry>
60 <varlistentry>
61 <term>&VIDIOC-G-FMT;, &VIDIOC-S-FMT;, &VIDIOC-TRY-FMT;</term>
62 <listitem>New structures for describing multi-planar formats are added:
63 &v4l2-pix-format-mplane; and &v4l2-plane-pix-format;. Drivers may
64 define new multi-planar formats, which have distinct FourCC codes from
65 the existing single-planar ones.
66 </listitem>
67 </varlistentry>
68 <varlistentry>
69 <term>&VIDIOC-QBUF;, &VIDIOC-DQBUF;, &VIDIOC-QUERYBUF;</term>
70 <listitem>A new &v4l2-plane; structure for describing planes is added.
71 Arrays of this structure are passed in the new
72 <structfield>m.planes</structfield> field of &v4l2-buffer;.
73 </listitem>
74 </varlistentry>
75 <varlistentry>
76 <term>&VIDIOC-REQBUFS;</term>
77 <listitem>Will allocate multi-planar buffers as requested.</listitem>
78 </varlistentry>
79 </variablelist>
80 </section>
81 </section>
82
Documentation/DocBook/v4l/v4l2.xml
1 <partinfo> 1 <partinfo>
2 <authorgroup> 2 <authorgroup>
3 <author> 3 <author>
4 <firstname>Michael</firstname> 4 <firstname>Michael</firstname>
5 <surname>Schimek</surname> 5 <surname>Schimek</surname>
6 <othername role="mi">H</othername> 6 <othername role="mi">H</othername>
7 <affiliation> 7 <affiliation>
8 <address> 8 <address>
9 <email>mschimek@gmx.at</email> 9 <email>mschimek@gmx.at</email>
10 </address> 10 </address>
11 </affiliation> 11 </affiliation>
12 </author> 12 </author>
13 13
14 <author> 14 <author>
15 <firstname>Bill</firstname> 15 <firstname>Bill</firstname>
16 <surname>Dirks</surname> 16 <surname>Dirks</surname>
17 <!-- Commented until Bill opts in to be spammed. 17 <!-- Commented until Bill opts in to be spammed.
18 <affiliation> 18 <affiliation>
19 <address> 19 <address>
20 <email>bill@thedirks.org</email> 20 <email>bill@thedirks.org</email>
21 </address> 21 </address>
22 </affiliation> --> 22 </affiliation> -->
23 <contrib>Original author of the V4L2 API and 23 <contrib>Original author of the V4L2 API and
24 documentation.</contrib> 24 documentation.</contrib>
25 </author> 25 </author>
26 26
27 <author> 27 <author>
28 <firstname>Hans</firstname> 28 <firstname>Hans</firstname>
29 <surname>Verkuil</surname> 29 <surname>Verkuil</surname>
30 <contrib>Designed and documented the VIDIOC_LOG_STATUS ioctl, 30 <contrib>Designed and documented the VIDIOC_LOG_STATUS ioctl,
31 the extended control ioctls and major parts of the sliced VBI 31 the extended control ioctls and major parts of the sliced VBI
32 API.</contrib> 32 API.</contrib>
33 <affiliation> 33 <affiliation>
34 <address> 34 <address>
35 <email>hverkuil@xs4all.nl</email> 35 <email>hverkuil@xs4all.nl</email>
36 </address> 36 </address>
37 </affiliation> 37 </affiliation>
38 </author> 38 </author>
39 39
40 <author> 40 <author>
41 <firstname>Martin</firstname> 41 <firstname>Martin</firstname>
42 <surname>Rubli</surname> 42 <surname>Rubli</surname>
43 <!-- 43 <!--
44 <affiliation> 44 <affiliation>
45 <address> 45 <address>
46 <email>martin_rubli@logitech.com</email> 46 <email>martin_rubli@logitech.com</email>
47 </address> 47 </address>
48 </affiliation> --> 48 </affiliation> -->
49 <contrib>Designed and documented the VIDIOC_ENUM_FRAMESIZES 49 <contrib>Designed and documented the VIDIOC_ENUM_FRAMESIZES
50 and VIDIOC_ENUM_FRAMEINTERVALS ioctls.</contrib> 50 and VIDIOC_ENUM_FRAMEINTERVALS ioctls.</contrib>
51 </author> 51 </author>
52 52
53 <author> 53 <author>
54 <firstname>Andy</firstname> 54 <firstname>Andy</firstname>
55 <surname>Walls</surname> 55 <surname>Walls</surname>
56 <contrib>Documented the fielded V4L2_MPEG_STREAM_VBI_FMT_IVTV 56 <contrib>Documented the fielded V4L2_MPEG_STREAM_VBI_FMT_IVTV
57 MPEG stream embedded, sliced VBI data format in this specification. 57 MPEG stream embedded, sliced VBI data format in this specification.
58 </contrib> 58 </contrib>
59 <affiliation> 59 <affiliation>
60 <address> 60 <address>
61 <email>awalls@md.metrocast.net</email> 61 <email>awalls@md.metrocast.net</email>
62 </address> 62 </address>
63 </affiliation> 63 </affiliation>
64 </author> 64 </author>
65 65
66 <author> 66 <author>
67 <firstname>Mauro</firstname> 67 <firstname>Mauro</firstname>
68 <surname>Carvalho Chehab</surname> 68 <surname>Carvalho Chehab</surname>
69 <contrib>Documented libv4l, designed and added v4l2grab example, 69 <contrib>Documented libv4l, designed and added v4l2grab example,
70 Remote Controller chapter.</contrib> 70 Remote Controller chapter.</contrib>
71 <affiliation> 71 <affiliation>
72 <address> 72 <address>
73 <email>mchehab@redhat.com</email> 73 <email>mchehab@redhat.com</email>
74 </address> 74 </address>
75 </affiliation> 75 </affiliation>
76 </author> 76 </author>
77 77
78 <author> 78 <author>
79 <firstname>Muralidharan</firstname> 79 <firstname>Muralidharan</firstname>
80 <surname>Karicheri</surname> 80 <surname>Karicheri</surname>
81 <contrib>Documented the Digital Video timings API.</contrib> 81 <contrib>Documented the Digital Video timings API.</contrib>
82 <affiliation> 82 <affiliation>
83 <address> 83 <address>
84 <email>m-karicheri2@ti.com</email> 84 <email>m-karicheri2@ti.com</email>
85 </address> 85 </address>
86 </affiliation> 86 </affiliation>
87 </author> 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>
88 </authorgroup> 99 </authorgroup>
89 100
90 <copyright> 101 <copyright>
91 <year>1999</year> 102 <year>1999</year>
92 <year>2000</year> 103 <year>2000</year>
93 <year>2001</year> 104 <year>2001</year>
94 <year>2002</year> 105 <year>2002</year>
95 <year>2003</year> 106 <year>2003</year>
96 <year>2004</year> 107 <year>2004</year>
97 <year>2005</year> 108 <year>2005</year>
98 <year>2006</year> 109 <year>2006</year>
99 <year>2007</year> 110 <year>2007</year>
100 <year>2008</year> 111 <year>2008</year>
101 <year>2009</year> 112 <year>2009</year>
102 <year>2010</year> 113 <year>2010</year>
103 <year>2011</year> 114 <year>2011</year>
104 <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin 115 <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin
105 Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab</holder> 116 Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab,
117 Pawel Osciak</holder>
106 </copyright> 118 </copyright>
107 <legalnotice> 119 <legalnotice>
108 <para>Except when explicitly stated as GPL, programming examples within 120 <para>Except when explicitly stated as GPL, programming examples within
109 this part can be used and distributed without restrictions.</para> 121 this part can be used and distributed without restrictions.</para>
110 </legalnotice> 122 </legalnotice>
111 <revhistory> 123 <revhistory>
112 <!-- Put document revisions here, newest first. --> 124 <!-- Put document revisions here, newest first. -->
113 <!-- API revisions (changes and additions of defines, enums, 125 <!-- API revisions (changes and additions of defines, enums,
114 structs, ioctls) must be noted in more detail in the history chapter 126 structs, ioctls) must be noted in more detail in the history chapter
115 (compat.xml), along with the possible impact on existing drivers and 127 (compat.xml), along with the possible impact on existing drivers and
116 applications. --> 128 applications. -->
129
130 <revision>
131 <revnumber>2.6.38</revnumber>
132 <authorinitials>po</authorinitials>
133 <revremark>Added the <link linkend="planar-apis">multi-planar API</link>.
134 </revremark>
135 </revision>
117 136
118 <revision> 137 <revision>
119 <revnumber>2.6.37</revnumber> 138 <revnumber>2.6.37</revnumber>
120 <date>2010-08-06</date> 139 <date>2010-08-06</date>
121 <authorinitials>hv</authorinitials> 140 <authorinitials>hv</authorinitials>
122 <revremark>Removed obsolete vtx (videotext) API.</revremark> 141 <revremark>Removed obsolete vtx (videotext) API.</revremark>
123 </revision> 142 </revision>
124 143
125 <revision> 144 <revision>
126 <revnumber>2.6.33</revnumber> 145 <revnumber>2.6.33</revnumber>
127 <date>2009-12-03</date> 146 <date>2009-12-03</date>
128 <authorinitials>mk</authorinitials> 147 <authorinitials>mk</authorinitials>
129 <revremark>Added documentation for the Digital Video timings API.</revremark> 148 <revremark>Added documentation for the Digital Video timings API.</revremark>
130 </revision> 149 </revision>
131 150
132 <revision> 151 <revision>
133 <revnumber>2.6.32</revnumber> 152 <revnumber>2.6.32</revnumber>
134 <date>2009-08-31</date> 153 <date>2009-08-31</date>
135 <authorinitials>mcc</authorinitials> 154 <authorinitials>mcc</authorinitials>
136 <revremark>Now, revisions will match the kernel version where 155 <revremark>Now, revisions will match the kernel version where
137 the V4L2 API changes will be used by the Linux Kernel. 156 the V4L2 API changes will be used by the Linux Kernel.
138 Also added Remote Controller chapter.</revremark> 157 Also added Remote Controller chapter.</revremark>
139 </revision> 158 </revision>
140 159
141 <revision> 160 <revision>
142 <revnumber>0.29</revnumber> 161 <revnumber>0.29</revnumber>
143 <date>2009-08-26</date> 162 <date>2009-08-26</date>
144 <authorinitials>ev</authorinitials> 163 <authorinitials>ev</authorinitials>
145 <revremark>Added documentation for string controls and for FM Transmitter controls.</revremark> 164 <revremark>Added documentation for string controls and for FM Transmitter controls.</revremark>
146 </revision> 165 </revision>
147 166
148 <revision> 167 <revision>
149 <revnumber>0.28</revnumber> 168 <revnumber>0.28</revnumber>
150 <date>2009-08-26</date> 169 <date>2009-08-26</date>
151 <authorinitials>gl</authorinitials> 170 <authorinitials>gl</authorinitials>
152 <revremark>Added V4L2_CID_BAND_STOP_FILTER documentation.</revremark> 171 <revremark>Added V4L2_CID_BAND_STOP_FILTER documentation.</revremark>
153 </revision> 172 </revision>
154 173
155 <revision> 174 <revision>
156 <revnumber>0.27</revnumber> 175 <revnumber>0.27</revnumber>
157 <date>2009-08-15</date> 176 <date>2009-08-15</date>
158 <authorinitials>mcc</authorinitials> 177 <authorinitials>mcc</authorinitials>
159 <revremark>Added libv4l and Remote Controller documentation; 178 <revremark>Added libv4l and Remote Controller documentation;
160 added v4l2grab and keytable application examples.</revremark> 179 added v4l2grab and keytable application examples.</revremark>
161 </revision> 180 </revision>
162 181
163 <revision> 182 <revision>
164 <revnumber>0.26</revnumber> 183 <revnumber>0.26</revnumber>
165 <date>2009-07-23</date> 184 <date>2009-07-23</date>
166 <authorinitials>hv</authorinitials> 185 <authorinitials>hv</authorinitials>
167 <revremark>Finalized the RDS capture API. Added modulator and RDS encoder 186 <revremark>Finalized the RDS capture API. Added modulator and RDS encoder
168 capabilities. Added support for string controls.</revremark> 187 capabilities. Added support for string controls.</revremark>
169 </revision> 188 </revision>
170 189
171 <revision> 190 <revision>
172 <revnumber>0.25</revnumber> 191 <revnumber>0.25</revnumber>
173 <date>2009-01-18</date> 192 <date>2009-01-18</date>
174 <authorinitials>hv</authorinitials> 193 <authorinitials>hv</authorinitials>
175 <revremark>Added pixel formats VYUY, NV16 and NV61, and changed 194 <revremark>Added pixel formats VYUY, NV16 and NV61, and changed
176 the debug ioctls VIDIOC_DBG_G/S_REGISTER and VIDIOC_DBG_G_CHIP_IDENT. 195 the debug ioctls VIDIOC_DBG_G/S_REGISTER and VIDIOC_DBG_G_CHIP_IDENT.
177 Added camera controls V4L2_CID_ZOOM_ABSOLUTE, V4L2_CID_ZOOM_RELATIVE, 196 Added camera controls V4L2_CID_ZOOM_ABSOLUTE, V4L2_CID_ZOOM_RELATIVE,
178 V4L2_CID_ZOOM_CONTINUOUS and V4L2_CID_PRIVACY.</revremark> 197 V4L2_CID_ZOOM_CONTINUOUS and V4L2_CID_PRIVACY.</revremark>
179 </revision> 198 </revision>
180 199
181 <revision> 200 <revision>
182 <revnumber>0.24</revnumber> 201 <revnumber>0.24</revnumber>
183 <date>2008-03-04</date> 202 <date>2008-03-04</date>
184 <authorinitials>mhs</authorinitials> 203 <authorinitials>mhs</authorinitials>
185 <revremark>Added pixel formats Y16 and SBGGR16, new controls 204 <revremark>Added pixel formats Y16 and SBGGR16, new controls
186 and a camera controls class. Removed VIDIOC_G/S_MPEGCOMP.</revremark> 205 and a camera controls class. Removed VIDIOC_G/S_MPEGCOMP.</revremark>
187 </revision> 206 </revision>
188 207
189 <revision> 208 <revision>
190 <revnumber>0.23</revnumber> 209 <revnumber>0.23</revnumber>
191 <date>2007-08-30</date> 210 <date>2007-08-30</date>
192 <authorinitials>mhs</authorinitials> 211 <authorinitials>mhs</authorinitials>
193 <revremark>Fixed a typo in VIDIOC_DBG_G/S_REGISTER. 212 <revremark>Fixed a typo in VIDIOC_DBG_G/S_REGISTER.
194 Clarified the byte order of packed pixel formats.</revremark> 213 Clarified the byte order of packed pixel formats.</revremark>
195 </revision> 214 </revision>
196 215
197 <revision> 216 <revision>
198 <revnumber>0.22</revnumber> 217 <revnumber>0.22</revnumber>
199 <date>2007-08-29</date> 218 <date>2007-08-29</date>
200 <authorinitials>mhs</authorinitials> 219 <authorinitials>mhs</authorinitials>
201 <revremark>Added the Video Output Overlay interface, new MPEG 220 <revremark>Added the Video Output Overlay interface, new MPEG
202 controls, V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT, 221 controls, V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT,
203 VIDIOC_DBG_G/S_REGISTER, VIDIOC_(TRY_)ENCODER_CMD, 222 VIDIOC_DBG_G/S_REGISTER, VIDIOC_(TRY_)ENCODER_CMD,
204 VIDIOC_G_CHIP_IDENT, VIDIOC_G_ENC_INDEX, new pixel formats. 223 VIDIOC_G_CHIP_IDENT, VIDIOC_G_ENC_INDEX, new pixel formats.
205 Clarifications in the cropping chapter, about RGB pixel formats, the 224 Clarifications in the cropping chapter, about RGB pixel formats, the
206 mmap(), poll(), select(), read() and write() functions. Typographical 225 mmap(), poll(), select(), read() and write() functions. Typographical
207 fixes.</revremark> 226 fixes.</revremark>
208 </revision> 227 </revision>
209 228
210 <revision> 229 <revision>
211 <revnumber>0.21</revnumber> 230 <revnumber>0.21</revnumber>
212 <date>2006-12-19</date> 231 <date>2006-12-19</date>
213 <authorinitials>mhs</authorinitials> 232 <authorinitials>mhs</authorinitials>
214 <revremark>Fixed a link in the VIDIOC_G_EXT_CTRLS section.</revremark> 233 <revremark>Fixed a link in the VIDIOC_G_EXT_CTRLS section.</revremark>
215 </revision> 234 </revision>
216 235
217 <revision> 236 <revision>
218 <revnumber>0.20</revnumber> 237 <revnumber>0.20</revnumber>
219 <date>2006-11-24</date> 238 <date>2006-11-24</date>
220 <authorinitials>mhs</authorinitials> 239 <authorinitials>mhs</authorinitials>
221 <revremark>Clarified the purpose of the audioset field in 240 <revremark>Clarified the purpose of the audioset field in
222 struct v4l2_input and v4l2_output.</revremark> 241 struct v4l2_input and v4l2_output.</revremark>
223 </revision> 242 </revision>
224 243
225 <revision> 244 <revision>
226 <revnumber>0.19</revnumber> 245 <revnumber>0.19</revnumber>
227 <date>2006-10-19</date> 246 <date>2006-10-19</date>
228 <authorinitials>mhs</authorinitials> 247 <authorinitials>mhs</authorinitials>
229 <revremark>Documented V4L2_PIX_FMT_RGB444.</revremark> 248 <revremark>Documented V4L2_PIX_FMT_RGB444.</revremark>
230 </revision> 249 </revision>
231 250
232 <revision> 251 <revision>
233 <revnumber>0.18</revnumber> 252 <revnumber>0.18</revnumber>
234 <date>2006-10-18</date> 253 <date>2006-10-18</date>
235 <authorinitials>mhs</authorinitials> 254 <authorinitials>mhs</authorinitials>
236 <revremark>Added the description of extended controls by Hans 255 <revremark>Added the description of extended controls by Hans
237 Verkuil. Linked V4L2_PIX_FMT_MPEG to V4L2_CID_MPEG_STREAM_TYPE.</revremark> 256 Verkuil. Linked V4L2_PIX_FMT_MPEG to V4L2_CID_MPEG_STREAM_TYPE.</revremark>
238 </revision> 257 </revision>
239 258
240 <revision> 259 <revision>
241 <revnumber>0.17</revnumber> 260 <revnumber>0.17</revnumber>
242 <date>2006-10-12</date> 261 <date>2006-10-12</date>
243 <authorinitials>mhs</authorinitials> 262 <authorinitials>mhs</authorinitials>
244 <revremark>Corrected V4L2_PIX_FMT_HM12 description.</revremark> 263 <revremark>Corrected V4L2_PIX_FMT_HM12 description.</revremark>
245 </revision> 264 </revision>
246 265
247 <revision> 266 <revision>
248 <revnumber>0.16</revnumber> 267 <revnumber>0.16</revnumber>
249 <date>2006-10-08</date> 268 <date>2006-10-08</date>
250 <authorinitials>mhs</authorinitials> 269 <authorinitials>mhs</authorinitials>
251 <revremark>VIDIOC_ENUM_FRAMESIZES and 270 <revremark>VIDIOC_ENUM_FRAMESIZES and
252 VIDIOC_ENUM_FRAMEINTERVALS are now part of the API.</revremark> 271 VIDIOC_ENUM_FRAMEINTERVALS are now part of the API.</revremark>
253 </revision> 272 </revision>
254 273
255 <revision> 274 <revision>
256 <revnumber>0.15</revnumber> 275 <revnumber>0.15</revnumber>
257 <date>2006-09-23</date> 276 <date>2006-09-23</date>
258 <authorinitials>mhs</authorinitials> 277 <authorinitials>mhs</authorinitials>
259 <revremark>Cleaned up the bibliography, added BT.653 and 278 <revremark>Cleaned up the bibliography, added BT.653 and
260 BT.1119. capture.c/start_capturing() for user pointer I/O did not 279 BT.1119. capture.c/start_capturing() for user pointer I/O did not
261 initialize the buffer index. Documented the V4L MPEG and MJPEG 280 initialize the buffer index. Documented the V4L MPEG and MJPEG
262 VID_TYPEs and V4L2_PIX_FMT_SBGGR8. Updated the list of reserved pixel 281 VID_TYPEs and V4L2_PIX_FMT_SBGGR8. Updated the list of reserved pixel
263 formats. See the history chapter for API changes.</revremark> 282 formats. See the history chapter for API changes.</revremark>
264 </revision> 283 </revision>
265 284
266 <revision> 285 <revision>
267 <revnumber>0.14</revnumber> 286 <revnumber>0.14</revnumber>
268 <date>2006-09-14</date> 287 <date>2006-09-14</date>
269 <authorinitials>mr</authorinitials> 288 <authorinitials>mr</authorinitials>
270 <revremark>Added VIDIOC_ENUM_FRAMESIZES and 289 <revremark>Added VIDIOC_ENUM_FRAMESIZES and
271 VIDIOC_ENUM_FRAMEINTERVALS proposal for frame format enumeration of 290 VIDIOC_ENUM_FRAMEINTERVALS proposal for frame format enumeration of
272 digital devices.</revremark> 291 digital devices.</revremark>
273 </revision> 292 </revision>
274 293
275 <revision> 294 <revision>
276 <revnumber>0.13</revnumber> 295 <revnumber>0.13</revnumber>
277 <date>2006-04-07</date> 296 <date>2006-04-07</date>
278 <authorinitials>mhs</authorinitials> 297 <authorinitials>mhs</authorinitials>
279 <revremark>Corrected the description of struct v4l2_window 298 <revremark>Corrected the description of struct v4l2_window
280 clips. New V4L2_STD_ and V4L2_TUNER_MODE_LANG1_LANG2 299 clips. New V4L2_STD_ and V4L2_TUNER_MODE_LANG1_LANG2
281 defines.</revremark> 300 defines.</revremark>
282 </revision> 301 </revision>
283 302
284 <revision> 303 <revision>
285 <revnumber>0.12</revnumber> 304 <revnumber>0.12</revnumber>
286 <date>2006-02-03</date> 305 <date>2006-02-03</date>
287 <authorinitials>mhs</authorinitials> 306 <authorinitials>mhs</authorinitials>
288 <revremark>Corrected the description of struct 307 <revremark>Corrected the description of struct
289 v4l2_captureparm and v4l2_outputparm.</revremark> 308 v4l2_captureparm and v4l2_outputparm.</revremark>
290 </revision> 309 </revision>
291 310
292 <revision> 311 <revision>
293 <revnumber>0.11</revnumber> 312 <revnumber>0.11</revnumber>
294 <date>2006-01-27</date> 313 <date>2006-01-27</date>
295 <authorinitials>mhs</authorinitials> 314 <authorinitials>mhs</authorinitials>
296 <revremark>Improved the description of struct 315 <revremark>Improved the description of struct
297 v4l2_tuner.</revremark> 316 v4l2_tuner.</revremark>
298 </revision> 317 </revision>
299 318
300 <revision> 319 <revision>
301 <revnumber>0.10</revnumber> 320 <revnumber>0.10</revnumber>
302 <date>2006-01-10</date> 321 <date>2006-01-10</date>
303 <authorinitials>mhs</authorinitials> 322 <authorinitials>mhs</authorinitials>
304 <revremark>VIDIOC_G_INPUT and VIDIOC_S_PARM 323 <revremark>VIDIOC_G_INPUT and VIDIOC_S_PARM
305 clarifications.</revremark> 324 clarifications.</revremark>
306 </revision> 325 </revision>
307 326
308 <revision> 327 <revision>
309 <revnumber>0.9</revnumber> 328 <revnumber>0.9</revnumber>
310 <date>2005-11-27</date> 329 <date>2005-11-27</date>
311 <authorinitials>mhs</authorinitials> 330 <authorinitials>mhs</authorinitials>
312 <revremark>Improved the 525 line numbering diagram. Hans 331 <revremark>Improved the 525 line numbering diagram. Hans
313 Verkuil and I rewrote the sliced VBI section. He also contributed a 332 Verkuil and I rewrote the sliced VBI section. He also contributed a
314 VIDIOC_LOG_STATUS page. Fixed VIDIOC_S_STD call in the video standard 333 VIDIOC_LOG_STATUS page. Fixed VIDIOC_S_STD call in the video standard
315 selection example. Various updates.</revremark> 334 selection example. Various updates.</revremark>
316 </revision> 335 </revision>
317 336
318 <revision> 337 <revision>
319 <revnumber>0.8</revnumber> 338 <revnumber>0.8</revnumber>
320 <date>2004-10-04</date> 339 <date>2004-10-04</date>
321 <authorinitials>mhs</authorinitials> 340 <authorinitials>mhs</authorinitials>
322 <revremark>Somehow a piece of junk slipped into the capture 341 <revremark>Somehow a piece of junk slipped into the capture
323 example, removed.</revremark> 342 example, removed.</revremark>
324 </revision> 343 </revision>
325 344
326 <revision> 345 <revision>
327 <revnumber>0.7</revnumber> 346 <revnumber>0.7</revnumber>
328 <date>2004-09-19</date> 347 <date>2004-09-19</date>
329 <authorinitials>mhs</authorinitials> 348 <authorinitials>mhs</authorinitials>
330 <revremark>Fixed video standard selection, control 349 <revremark>Fixed video standard selection, control
331 enumeration, downscaling and aspect example. Added read and user 350 enumeration, downscaling and aspect example. Added read and user
332 pointer i/o to video capture example.</revremark> 351 pointer i/o to video capture example.</revremark>
333 </revision> 352 </revision>
334 353
335 <revision> 354 <revision>
336 <revnumber>0.6</revnumber> 355 <revnumber>0.6</revnumber>
337 <date>2004-08-01</date> 356 <date>2004-08-01</date>
338 <authorinitials>mhs</authorinitials> 357 <authorinitials>mhs</authorinitials>
339 <revremark>v4l2_buffer changes, added video capture example, 358 <revremark>v4l2_buffer changes, added video capture example,
340 various corrections.</revremark> 359 various corrections.</revremark>
341 </revision> 360 </revision>
342 361
343 <revision> 362 <revision>
344 <revnumber>0.5</revnumber> 363 <revnumber>0.5</revnumber>
345 <date>2003-11-05</date> 364 <date>2003-11-05</date>
346 <authorinitials>mhs</authorinitials> 365 <authorinitials>mhs</authorinitials>
347 <revremark>Pixel format erratum.</revremark> 366 <revremark>Pixel format erratum.</revremark>
348 </revision> 367 </revision>
349 368
350 <revision> 369 <revision>
351 <revnumber>0.4</revnumber> 370 <revnumber>0.4</revnumber>
352 <date>2003-09-17</date> 371 <date>2003-09-17</date>
353 <authorinitials>mhs</authorinitials> 372 <authorinitials>mhs</authorinitials>
354 <revremark>Corrected source and Makefile to generate a PDF. 373 <revremark>Corrected source and Makefile to generate a PDF.
355 SGML fixes. Added latest API changes. Closed gaps in the history 374 SGML fixes. Added latest API changes. Closed gaps in the history
356 chapter.</revremark> 375 chapter.</revremark>
357 </revision> 376 </revision>
358 377
359 <revision> 378 <revision>
360 <revnumber>0.3</revnumber> 379 <revnumber>0.3</revnumber>
361 <date>2003-02-05</date> 380 <date>2003-02-05</date>
362 <authorinitials>mhs</authorinitials> 381 <authorinitials>mhs</authorinitials>
363 <revremark>Another draft, more corrections.</revremark> 382 <revremark>Another draft, more corrections.</revremark>
364 </revision> 383 </revision>
365 384
366 <revision> 385 <revision>
367 <revnumber>0.2</revnumber> 386 <revnumber>0.2</revnumber>
368 <date>2003-01-15</date> 387 <date>2003-01-15</date>
369 <authorinitials>mhs</authorinitials> 388 <authorinitials>mhs</authorinitials>
370 <revremark>Second draft, with corrections pointed out by Gerd 389 <revremark>Second draft, with corrections pointed out by Gerd
371 Knorr.</revremark> 390 Knorr.</revremark>
372 </revision> 391 </revision>
373 392
374 <revision> 393 <revision>
375 <revnumber>0.1</revnumber> 394 <revnumber>0.1</revnumber>
376 <date>2002-12-01</date> 395 <date>2002-12-01</date>
377 <authorinitials>mhs</authorinitials> 396 <authorinitials>mhs</authorinitials>
378 <revremark>First draft, based on documentation by Bill Dirks 397 <revremark>First draft, based on documentation by Bill Dirks
379 and discussions on the V4L mailing list.</revremark> 398 and discussions on the V4L mailing list.</revremark>
380 </revision> 399 </revision>
381 </revhistory> 400 </revhistory>
382 </partinfo> 401 </partinfo>
383 402
384 <title>Video for Linux Two API Specification</title> 403 <title>Video for Linux Two API Specification</title>
385 <subtitle>Revision 2.6.38</subtitle> 404 <subtitle>Revision 2.6.38</subtitle>
386 405
387 <chapter id="common"> 406 <chapter id="common">
388 &sub-common; 407 &sub-common;
389 </chapter> 408 </chapter>
390 409
391 <chapter id="pixfmt"> 410 <chapter id="pixfmt">
392 &sub-pixfmt; 411 &sub-pixfmt;
393 </chapter> 412 </chapter>
394 413
395 <chapter id="io"> 414 <chapter id="io">
396 &sub-io; 415 &sub-io;
397 </chapter> 416 </chapter>
398 417
399 <chapter id="devices"> 418 <chapter id="devices">
400 <title>Interfaces</title> 419 <title>Interfaces</title>
401 420
402 <section id="capture"> &sub-dev-capture; </section> 421 <section id="capture"> &sub-dev-capture; </section>
403 <section id="overlay"> &sub-dev-overlay; </section> 422 <section id="overlay"> &sub-dev-overlay; </section>
404 <section id="output"> &sub-dev-output; </section> 423 <section id="output"> &sub-dev-output; </section>
405 <section id="osd"> &sub-dev-osd; </section> 424 <section id="osd"> &sub-dev-osd; </section>
406 <section id="codec"> &sub-dev-codec; </section> 425 <section id="codec"> &sub-dev-codec; </section>
407 <section id="effect"> &sub-dev-effect; </section> 426 <section id="effect"> &sub-dev-effect; </section>
408 <section id="raw-vbi"> &sub-dev-raw-vbi; </section> 427 <section id="raw-vbi"> &sub-dev-raw-vbi; </section>
409 <section id="sliced"> &sub-dev-sliced-vbi; </section> 428 <section id="sliced"> &sub-dev-sliced-vbi; </section>
410 <section id="ttx"> &sub-dev-teletext; </section> 429 <section id="ttx"> &sub-dev-teletext; </section>
411 <section id="radio"> &sub-dev-radio; </section> 430 <section id="radio"> &sub-dev-radio; </section>
412 <section id="rds"> &sub-dev-rds; </section> 431 <section id="rds"> &sub-dev-rds; </section>
413 <section id="event"> &sub-dev-event; </section> 432 <section id="event"> &sub-dev-event; </section>
414 </chapter> 433 </chapter>
415 434
416 <chapter id="driver"> 435 <chapter id="driver">
417 &sub-driver; 436 &sub-driver;
418 </chapter> 437 </chapter>
419 438
420 <chapter id="libv4l"> 439 <chapter id="libv4l">
421 &sub-libv4l; 440 &sub-libv4l;
422 </chapter> 441 </chapter>
423 442
424 <chapter id="compat"> 443 <chapter id="compat">
425 &sub-compat; 444 &sub-compat;
426 </chapter> 445 </chapter>
427 446
428 <appendix id="user-func"> 447 <appendix id="user-func">
429 <title>Function Reference</title> 448 <title>Function Reference</title>
430 449
431 <!-- Keep this alphabetically sorted. --> 450 <!-- Keep this alphabetically sorted. -->
432 451
433 &sub-close; 452 &sub-close;
434 &sub-ioctl; 453 &sub-ioctl;
435 <!-- All ioctls go here. --> 454 <!-- All ioctls go here. -->
436 &sub-cropcap; 455 &sub-cropcap;
437 &sub-dbg-g-chip-ident; 456 &sub-dbg-g-chip-ident;
438 &sub-dbg-g-register; 457 &sub-dbg-g-register;
439 &sub-dqevent; 458 &sub-dqevent;
440 &sub-encoder-cmd; 459 &sub-encoder-cmd;
441 &sub-enumaudio; 460 &sub-enumaudio;
442 &sub-enumaudioout; 461 &sub-enumaudioout;
443 &sub-enum-dv-presets; 462 &sub-enum-dv-presets;
444 &sub-enum-fmt; 463 &sub-enum-fmt;
445 &sub-enum-framesizes; 464 &sub-enum-framesizes;
446 &sub-enum-frameintervals; 465 &sub-enum-frameintervals;
447 &sub-enuminput; 466 &sub-enuminput;
448 &sub-enumoutput; 467 &sub-enumoutput;
449 &sub-enumstd; 468 &sub-enumstd;
450 &sub-g-audio; 469 &sub-g-audio;
451 &sub-g-audioout; 470 &sub-g-audioout;
452 &sub-g-crop; 471 &sub-g-crop;
453 &sub-g-ctrl; 472 &sub-g-ctrl;
454 &sub-g-dv-preset; 473 &sub-g-dv-preset;
455 &sub-g-dv-timings; 474 &sub-g-dv-timings;
456 &sub-g-enc-index; 475 &sub-g-enc-index;
457 &sub-g-ext-ctrls; 476 &sub-g-ext-ctrls;
458 &sub-g-fbuf; 477 &sub-g-fbuf;
459 &sub-g-fmt; 478 &sub-g-fmt;
460 &sub-g-frequency; 479 &sub-g-frequency;
461 &sub-g-input; 480 &sub-g-input;
462 &sub-g-jpegcomp; 481 &sub-g-jpegcomp;
463 &sub-g-modulator; 482 &sub-g-modulator;
464 &sub-g-output; 483 &sub-g-output;
465 &sub-g-parm; 484 &sub-g-parm;
466 &sub-g-priority; 485 &sub-g-priority;
467 &sub-g-sliced-vbi-cap; 486 &sub-g-sliced-vbi-cap;
468 &sub-g-std; 487 &sub-g-std;
469 &sub-g-tuner; 488 &sub-g-tuner;
470 &sub-log-status; 489 &sub-log-status;
471 &sub-overlay; 490 &sub-overlay;
472 &sub-qbuf; 491 &sub-qbuf;
473 &sub-querybuf; 492 &sub-querybuf;
474 &sub-querycap; 493 &sub-querycap;
475 &sub-queryctrl; 494 &sub-queryctrl;
476 &sub-query-dv-preset; 495 &sub-query-dv-preset;
477 &sub-querystd; 496 &sub-querystd;
478 &sub-reqbufs; 497 &sub-reqbufs;
479 &sub-s-hw-freq-seek; 498 &sub-s-hw-freq-seek;
480 &sub-streamon; 499 &sub-streamon;
481 &sub-subscribe-event; 500 &sub-subscribe-event;
482 <!-- End of ioctls. --> 501 <!-- End of ioctls. -->
483 &sub-mmap; 502 &sub-mmap;
484 &sub-munmap; 503 &sub-munmap;
485 &sub-open; 504 &sub-open;
486 &sub-poll; 505 &sub-poll;
487 &sub-read; 506 &sub-read;
488 &sub-select; 507 &sub-select;
489 &sub-write; 508 &sub-write;
490 </appendix> 509 </appendix>
491 510
492 <appendix id="videodev"> 511 <appendix id="videodev">
493 <title>Video For Linux Two Header File</title> 512 <title>Video For Linux Two Header File</title>
494 &sub-videodev2-h; 513 &sub-videodev2-h;
495 </appendix> 514 </appendix>
496 515
497 <appendix id="capture-example"> 516 <appendix id="capture-example">
498 <title>Video Capture Example</title> 517 <title>Video Capture Example</title>
499 &sub-capture-c; 518 &sub-capture-c;
500 </appendix> 519 </appendix>
501 520
502 <appendix id="v4l2grab-example"> 521 <appendix id="v4l2grab-example">
503 <title>Video Grabber example using libv4l</title> 522 <title>Video Grabber example using libv4l</title>
504 <para>This program demonstrates how to grab V4L2 images in ppm format by 523 <para>This program demonstrates how to grab V4L2 images in ppm format by
505 using libv4l handlers. The advantage is that this grabber can potentially work 524 using libv4l handlers. The advantage is that this grabber can potentially work
506 with any V4L2 driver.</para> 525 with any V4L2 driver.</para>
507 &sub-v4l2grab-c; 526 &sub-v4l2grab-c;
508 </appendix> 527 </appendix>
509 528
510 &sub-media-indices; 529 &sub-media-indices;
511 530
512 &sub-biblio; 531 &sub-biblio;
513 532
514 533
Documentation/DocBook/v4l/vidioc-enum-fmt.xml
1 <refentry id="vidioc-enum-fmt"> 1 <refentry id="vidioc-enum-fmt">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_ENUM_FMT</refentrytitle> 3 <refentrytitle>ioctl VIDIOC_ENUM_FMT</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>VIDIOC_ENUM_FMT</refname> 8 <refname>VIDIOC_ENUM_FMT</refname>
9 <refpurpose>Enumerate image formats</refpurpose> 9 <refpurpose>Enumerate image formats</refpurpose>
10 </refnamediv> 10 </refnamediv>
11 11
12 <refsynopsisdiv> 12 <refsynopsisdiv>
13 <funcsynopsis> 13 <funcsynopsis>
14 <funcprototype> 14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef> 15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef> 16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef> 17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_fmtdesc 18 <paramdef>struct v4l2_fmtdesc
19 *<parameter>argp</parameter></paramdef> 19 *<parameter>argp</parameter></paramdef>
20 </funcprototype> 20 </funcprototype>
21 </funcsynopsis> 21 </funcsynopsis>
22 </refsynopsisdiv> 22 </refsynopsisdiv>
23 23
24 <refsect1> 24 <refsect1>
25 <title>Arguments</title> 25 <title>Arguments</title>
26 26
27 <variablelist> 27 <variablelist>
28 <varlistentry> 28 <varlistentry>
29 <term><parameter>fd</parameter></term> 29 <term><parameter>fd</parameter></term>
30 <listitem> 30 <listitem>
31 <para>&fd;</para> 31 <para>&fd;</para>
32 </listitem> 32 </listitem>
33 </varlistentry> 33 </varlistentry>
34 <varlistentry> 34 <varlistentry>
35 <term><parameter>request</parameter></term> 35 <term><parameter>request</parameter></term>
36 <listitem> 36 <listitem>
37 <para>VIDIOC_ENUM_FMT</para> 37 <para>VIDIOC_ENUM_FMT</para>
38 </listitem> 38 </listitem>
39 </varlistentry> 39 </varlistentry>
40 <varlistentry> 40 <varlistentry>
41 <term><parameter>argp</parameter></term> 41 <term><parameter>argp</parameter></term>
42 <listitem> 42 <listitem>
43 <para></para> 43 <para></para>
44 </listitem> 44 </listitem>
45 </varlistentry> 45 </varlistentry>
46 </variablelist> 46 </variablelist>
47 </refsect1> 47 </refsect1>
48 48
49 <refsect1> 49 <refsect1>
50 <title>Description</title> 50 <title>Description</title>
51 51
52 <para>To enumerate image formats applications initialize the 52 <para>To enumerate image formats applications initialize the
53 <structfield>type</structfield> and <structfield>index</structfield> 53 <structfield>type</structfield> and <structfield>index</structfield>
54 field of &v4l2-fmtdesc; and call the 54 field of &v4l2-fmtdesc; and call the
55 <constant>VIDIOC_ENUM_FMT</constant> ioctl with a pointer to this 55 <constant>VIDIOC_ENUM_FMT</constant> ioctl with a pointer to this
56 structure. Drivers fill the rest of the structure or return an 56 structure. Drivers fill the rest of the structure or return an
57 &EINVAL;. All formats are enumerable by beginning at index zero and 57 &EINVAL;. All formats are enumerable by beginning at index zero and
58 incrementing by one until <errorcode>EINVAL</errorcode> is 58 incrementing by one until <errorcode>EINVAL</errorcode> is
59 returned.</para> 59 returned.</para>
60 60
61 <table pgwide="1" frame="none" id="v4l2-fmtdesc"> 61 <table pgwide="1" frame="none" id="v4l2-fmtdesc">
62 <title>struct <structname>v4l2_fmtdesc</structname></title> 62 <title>struct <structname>v4l2_fmtdesc</structname></title>
63 <tgroup cols="3"> 63 <tgroup cols="3">
64 &cs-str; 64 &cs-str;
65 <tbody valign="top"> 65 <tbody valign="top">
66 <row> 66 <row>
67 <entry>__u32</entry> 67 <entry>__u32</entry>
68 <entry><structfield>index</structfield></entry> 68 <entry><structfield>index</structfield></entry>
69 <entry>Number of the format in the enumeration, set by 69 <entry>Number of the format in the enumeration, set by
70 the application. This is in no way related to the <structfield> 70 the application. This is in no way related to the <structfield>
71 pixelformat</structfield> field.</entry> 71 pixelformat</structfield> field.</entry>
72 </row> 72 </row>
73 <row> 73 <row>
74 <entry>&v4l2-buf-type;</entry> 74 <entry>&v4l2-buf-type;</entry>
75 <entry><structfield>type</structfield></entry> 75 <entry><structfield>type</structfield></entry>
76 <entry>Type of the data stream, set by the application. 76 <entry>Type of the data stream, set by the application.
77 Only these types are valid here: 77 Only these types are valid here:
78 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>, 78 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
79 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>,
79 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, 80 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
81 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>,
80 <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver 82 <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
81 defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> 83 defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
82 and higher.</entry> 84 and higher.</entry>
83 </row> 85 </row>
84 <row> 86 <row>
85 <entry>__u32</entry> 87 <entry>__u32</entry>
86 <entry><structfield>flags</structfield></entry> 88 <entry><structfield>flags</structfield></entry>
87 <entry>See <xref linkend="fmtdesc-flags" /></entry> 89 <entry>See <xref linkend="fmtdesc-flags" /></entry>
88 </row> 90 </row>
89 <row> 91 <row>
90 <entry>__u8</entry> 92 <entry>__u8</entry>
91 <entry><structfield>description</structfield>[32]</entry> 93 <entry><structfield>description</structfield>[32]</entry>
92 <entry>Description of the format, a NUL-terminated ASCII 94 <entry>Description of the format, a NUL-terminated ASCII
93 string. This information is intended for the user, for example: "YUV 95 string. This information is intended for the user, for example: "YUV
94 4:2:2".</entry> 96 4:2:2".</entry>
95 </row> 97 </row>
96 <row> 98 <row>
97 <entry>__u32</entry> 99 <entry>__u32</entry>
98 <entry><structfield>pixelformat</structfield></entry> 100 <entry><structfield>pixelformat</structfield></entry>
99 <entry>The image format identifier. This is a 101 <entry>The image format identifier. This is a
100 four character code as computed by the v4l2_fourcc() 102 four character code as computed by the v4l2_fourcc()
101 macro:</entry> 103 macro:</entry>
102 </row> 104 </row>
103 <row> 105 <row>
104 <entry spanname="hspan"><para><programlisting id="v4l2-fourcc"> 106 <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
105 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)&lt;&lt;0)|((__u32)(b)&lt;&lt;8)|((__u32)(c)&lt;&lt;16)|((__u32)(d)&lt;&lt;24)) 107 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)&lt;&lt;0)|((__u32)(b)&lt;&lt;8)|((__u32)(c)&lt;&lt;16)|((__u32)(d)&lt;&lt;24))
106 </programlisting></para><para>Several image formats are already 108 </programlisting></para><para>Several image formats are already
107 defined by this specification in <xref linkend="pixfmt" />. Note these 109 defined by this specification in <xref linkend="pixfmt" />. Note these
108 codes are not the same as those used in the Windows world.</para></entry> 110 codes are not the same as those used in the Windows world.</para></entry>
109 </row> 111 </row>
110 <row> 112 <row>
111 <entry>__u32</entry> 113 <entry>__u32</entry>
112 <entry><structfield>reserved</structfield>[4]</entry> 114 <entry><structfield>reserved</structfield>[4]</entry>
113 <entry>Reserved for future extensions. Drivers must set 115 <entry>Reserved for future extensions. Drivers must set
114 the array to zero.</entry> 116 the array to zero.</entry>
115 </row> 117 </row>
116 </tbody> 118 </tbody>
117 </tgroup> 119 </tgroup>
118 </table> 120 </table>
119 121
120 <table pgwide="1" frame="none" id="fmtdesc-flags"> 122 <table pgwide="1" frame="none" id="fmtdesc-flags">
121 <title>Image Format Description Flags</title> 123 <title>Image Format Description Flags</title>
122 <tgroup cols="3"> 124 <tgroup cols="3">
123 &cs-def; 125 &cs-def;
124 <tbody valign="top"> 126 <tbody valign="top">
125 <row> 127 <row>
126 <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry> 128 <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
127 <entry>0x0001</entry> 129 <entry>0x0001</entry>
128 <entry>This is a compressed format.</entry> 130 <entry>This is a compressed format.</entry>
129 </row> 131 </row>
130 <row> 132 <row>
131 <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry> 133 <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
132 <entry>0x0002</entry> 134 <entry>0x0002</entry>
133 <entry>This format is not native to the device but emulated 135 <entry>This format is not native to the device but emulated
134 through software (usually libv4l2), where possible try to use a native format 136 through software (usually libv4l2), where possible try to use a native format
135 instead for better performance.</entry> 137 instead for better performance.</entry>
136 </row> 138 </row>
137 </tbody> 139 </tbody>
138 </tgroup> 140 </tgroup>
139 </table> 141 </table>
140 </refsect1> 142 </refsect1>
141 143
142 <refsect1> 144 <refsect1>
143 &return-value; 145 &return-value;
144 146
145 <variablelist> 147 <variablelist>
146 <varlistentry> 148 <varlistentry>
147 <term><errorcode>EINVAL</errorcode></term> 149 <term><errorcode>EINVAL</errorcode></term>
148 <listitem> 150 <listitem>
149 <para>The &v4l2-fmtdesc; <structfield>type</structfield> 151 <para>The &v4l2-fmtdesc; <structfield>type</structfield>
150 is not supported or the <structfield>index</structfield> is out of 152 is not supported or the <structfield>index</structfield> is out of
151 bounds.</para> 153 bounds.</para>
152 </listitem> 154 </listitem>
153 </varlistentry> 155 </varlistentry>
154 </variablelist> 156 </variablelist>
155 </refsect1> 157 </refsect1>
156 </refentry> 158 </refentry>
157 159
158 <!-- 160 <!--
159 Local Variables: 161 Local Variables:
160 mode: sgml 162 mode: sgml
161 sgml-parent-document: "v4l2.sgml" 163 sgml-parent-document: "v4l2.sgml"
162 indent-tabs-mode: nil 164 indent-tabs-mode: nil
163 End: 165 End:
164 --> 166 -->
165 167
Documentation/DocBook/v4l/vidioc-g-fmt.xml
1 <refentry id="vidioc-g-fmt"> 1 <refentry id="vidioc-g-fmt">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, 3 <refentrytitle>ioctl VIDIOC_G_FMT, VIDIOC_S_FMT,
4 VIDIOC_TRY_FMT</refentrytitle> 4 VIDIOC_TRY_FMT</refentrytitle>
5 &manvol; 5 &manvol;
6 </refmeta> 6 </refmeta>
7 7
8 <refnamediv> 8 <refnamediv>
9 <refname>VIDIOC_G_FMT</refname> 9 <refname>VIDIOC_G_FMT</refname>
10 <refname>VIDIOC_S_FMT</refname> 10 <refname>VIDIOC_S_FMT</refname>
11 <refname>VIDIOC_TRY_FMT</refname> 11 <refname>VIDIOC_TRY_FMT</refname>
12 <refpurpose>Get or set the data format, try a format</refpurpose> 12 <refpurpose>Get or set the data format, try a format</refpurpose>
13 </refnamediv> 13 </refnamediv>
14 14
15 <refsynopsisdiv> 15 <refsynopsisdiv>
16 <funcsynopsis> 16 <funcsynopsis>
17 <funcprototype> 17 <funcprototype>
18 <funcdef>int <function>ioctl</function></funcdef> 18 <funcdef>int <function>ioctl</function></funcdef>
19 <paramdef>int <parameter>fd</parameter></paramdef> 19 <paramdef>int <parameter>fd</parameter></paramdef>
20 <paramdef>int <parameter>request</parameter></paramdef> 20 <paramdef>int <parameter>request</parameter></paramdef>
21 <paramdef>struct v4l2_format 21 <paramdef>struct v4l2_format
22 *<parameter>argp</parameter></paramdef> 22 *<parameter>argp</parameter></paramdef>
23 </funcprototype> 23 </funcprototype>
24 </funcsynopsis> 24 </funcsynopsis>
25 </refsynopsisdiv> 25 </refsynopsisdiv>
26 26
27 <refsect1> 27 <refsect1>
28 <title>Arguments</title> 28 <title>Arguments</title>
29 29
30 <variablelist> 30 <variablelist>
31 <varlistentry> 31 <varlistentry>
32 <term><parameter>fd</parameter></term> 32 <term><parameter>fd</parameter></term>
33 <listitem> 33 <listitem>
34 <para>&fd;</para> 34 <para>&fd;</para>
35 </listitem> 35 </listitem>
36 </varlistentry> 36 </varlistentry>
37 <varlistentry> 37 <varlistentry>
38 <term><parameter>request</parameter></term> 38 <term><parameter>request</parameter></term>
39 <listitem> 39 <listitem>
40 <para>VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT</para> 40 <para>VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT</para>
41 </listitem> 41 </listitem>
42 </varlistentry> 42 </varlistentry>
43 <varlistentry> 43 <varlistentry>
44 <term><parameter>argp</parameter></term> 44 <term><parameter>argp</parameter></term>
45 <listitem> 45 <listitem>
46 <para></para> 46 <para></para>
47 </listitem> 47 </listitem>
48 </varlistentry> 48 </varlistentry>
49 </variablelist> 49 </variablelist>
50 </refsect1> 50 </refsect1>
51 51
52 <refsect1> 52 <refsect1>
53 <title>Description</title> 53 <title>Description</title>
54 54
55 <para>These ioctls are used to negotiate the format of data 55 <para>These ioctls are used to negotiate the format of data
56 (typically image format) exchanged between driver and 56 (typically image format) exchanged between driver and
57 application.</para> 57 application.</para>
58 58
59 <para>To query the current parameters applications set the 59 <para>To query the current parameters applications set the
60 <structfield>type</structfield> field of a struct 60 <structfield>type</structfield> field of a struct
61 <structname>v4l2_format</structname> to the respective buffer (stream) 61 <structname>v4l2_format</structname> to the respective buffer (stream)
62 type. For example video capture devices use 62 type. For example video capture devices use
63 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>. When the application 63 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> or
64 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>. When the application
64 calls the <constant>VIDIOC_G_FMT</constant> ioctl with a pointer to 65 calls the <constant>VIDIOC_G_FMT</constant> ioctl with a pointer to
65 this structure the driver fills the respective member of the 66 this structure the driver fills the respective member of the
66 <structfield>fmt</structfield> union. In case of video capture devices 67 <structfield>fmt</structfield> union. In case of video capture devices
67 that is the &v4l2-pix-format; <structfield>pix</structfield> member. 68 that is either the &v4l2-pix-format; <structfield>pix</structfield> or
69 the &v4l2-pix-format-mplane; <structfield>pix_mp</structfield> member.
68 When the requested buffer type is not supported drivers return an 70 When the requested buffer type is not supported drivers return an
69 &EINVAL;.</para> 71 &EINVAL;.</para>
70 72
71 <para>To change the current format parameters applications 73 <para>To change the current format parameters applications
72 initialize the <structfield>type</structfield> field and all 74 initialize the <structfield>type</structfield> field and all
73 fields of the respective <structfield>fmt</structfield> 75 fields of the respective <structfield>fmt</structfield>
74 union member. For details see the documentation of the various devices 76 union member. For details see the documentation of the various devices
75 types in <xref linkend="devices" />. Good practice is to query the 77 types in <xref linkend="devices" />. Good practice is to query the
76 current parameters first, and to 78 current parameters first, and to
77 modify only those parameters not suitable for the application. When 79 modify only those parameters not suitable for the application. When
78 the application calls the <constant>VIDIOC_S_FMT</constant> ioctl 80 the application calls the <constant>VIDIOC_S_FMT</constant> ioctl
79 with a pointer to a <structname>v4l2_format</structname> structure 81 with a pointer to a <structname>v4l2_format</structname> structure
80 the driver checks 82 the driver checks
81 and adjusts the parameters against hardware abilities. Drivers 83 and adjusts the parameters against hardware abilities. Drivers
82 should not return an error code unless the input is ambiguous, this is 84 should not return an error code unless the input is ambiguous, this is
83 a mechanism to fathom device capabilities and to approach parameters 85 a mechanism to fathom device capabilities and to approach parameters
84 acceptable for both the application and driver. On success the driver 86 acceptable for both the application and driver. On success the driver
85 may program the hardware, allocate resources and generally prepare for 87 may program the hardware, allocate resources and generally prepare for
86 data exchange. 88 data exchange.
87 Finally the <constant>VIDIOC_S_FMT</constant> ioctl returns the 89 Finally the <constant>VIDIOC_S_FMT</constant> ioctl returns the
88 current format parameters as <constant>VIDIOC_G_FMT</constant> does. 90 current format parameters as <constant>VIDIOC_G_FMT</constant> does.
89 Very simple, inflexible devices may even ignore all input and always 91 Very simple, inflexible devices may even ignore all input and always
90 return the default parameters. However all V4L2 devices exchanging 92 return the default parameters. However all V4L2 devices exchanging
91 data with the application must implement the 93 data with the application must implement the
92 <constant>VIDIOC_G_FMT</constant> and 94 <constant>VIDIOC_G_FMT</constant> and
93 <constant>VIDIOC_S_FMT</constant> ioctl. When the requested buffer 95 <constant>VIDIOC_S_FMT</constant> ioctl. When the requested buffer
94 type is not supported drivers return an &EINVAL; on a 96 type is not supported drivers return an &EINVAL; on a
95 <constant>VIDIOC_S_FMT</constant> attempt. When I/O is already in 97 <constant>VIDIOC_S_FMT</constant> attempt. When I/O is already in
96 progress or the resource is not available for other reasons drivers 98 progress or the resource is not available for other reasons drivers
97 return the &EBUSY;.</para> 99 return the &EBUSY;.</para>
98 100
99 <para>The <constant>VIDIOC_TRY_FMT</constant> ioctl is equivalent 101 <para>The <constant>VIDIOC_TRY_FMT</constant> ioctl is equivalent
100 to <constant>VIDIOC_S_FMT</constant> with one exception: it does not 102 to <constant>VIDIOC_S_FMT</constant> with one exception: it does not
101 change driver state. It can also be called at any time, never 103 change driver state. It can also be called at any time, never
102 returning <errorcode>EBUSY</errorcode>. This function is provided to 104 returning <errorcode>EBUSY</errorcode>. This function is provided to
103 negotiate parameters, to learn about hardware limitations, without 105 negotiate parameters, to learn about hardware limitations, without
104 disabling I/O or possibly time consuming hardware preparations. 106 disabling I/O or possibly time consuming hardware preparations.
105 Although strongly recommended drivers are not required to implement 107 Although strongly recommended drivers are not required to implement
106 this ioctl.</para> 108 this ioctl.</para>
107 109
108 <table pgwide="1" frame="none" id="v4l2-format"> 110 <table pgwide="1" frame="none" id="v4l2-format">
109 <title>struct <structname>v4l2_format</structname></title> 111 <title>struct <structname>v4l2_format</structname></title>
110 <tgroup cols="4"> 112 <tgroup cols="4">
111 <colspec colname="c1" /> 113 <colspec colname="c1" />
112 <colspec colname="c2" /> 114 <colspec colname="c2" />
113 <colspec colname="c3" /> 115 <colspec colname="c3" />
114 <colspec colname="c4" /> 116 <colspec colname="c4" />
115 <tbody valign="top"> 117 <tbody valign="top">
116 <row> 118 <row>
117 <entry>&v4l2-buf-type;</entry> 119 <entry>&v4l2-buf-type;</entry>
118 <entry><structfield>type</structfield></entry> 120 <entry><structfield>type</structfield></entry>
119 <entry></entry> 121 <entry></entry>
120 <entry>Type of the data stream, see <xref 122 <entry>Type of the data stream, see <xref
121 linkend="v4l2-buf-type" />.</entry> 123 linkend="v4l2-buf-type" />.</entry>
122 </row> 124 </row>
123 <row> 125 <row>
124 <entry>union</entry> 126 <entry>union</entry>
125 <entry><structfield>fmt</structfield></entry> 127 <entry><structfield>fmt</structfield></entry>
126 </row> 128 </row>
127 <row> 129 <row>
128 <entry></entry> 130 <entry></entry>
129 <entry>&v4l2-pix-format;</entry> 131 <entry>&v4l2-pix-format;</entry>
130 <entry><structfield>pix</structfield></entry> 132 <entry><structfield>pix</structfield></entry>
131 <entry>Definition of an image format, see <xref 133 <entry>Definition of an image format, see <xref
132 linkend="pixfmt" />, used by video capture and output 134 linkend="pixfmt" />, used by video capture and output
133 devices.</entry> 135 devices.</entry>
136 </row>
137 <row>
138 <entry></entry>
139 <entry>&v4l2-pix-format-mplane;</entry>
140 <entry><structfield>pix_mp</structfield></entry>
141 <entry>Definition of an image format, see <xref
142 linkend="pixfmt" />, used by video capture and output
143 devices that support the <link linkend="planar-apis">multi-planar
144 version of the API</link>.</entry>
134 </row> 145 </row>
135 <row> 146 <row>
136 <entry></entry> 147 <entry></entry>
137 <entry>&v4l2-window;</entry> 148 <entry>&v4l2-window;</entry>
138 <entry><structfield>win</structfield></entry> 149 <entry><structfield>win</structfield></entry>
139 <entry>Definition of an overlaid image, see <xref 150 <entry>Definition of an overlaid image, see <xref
140 linkend="overlay" />, used by video overlay devices.</entry> 151 linkend="overlay" />, used by video overlay devices.</entry>
141 </row> 152 </row>
142 <row> 153 <row>
143 <entry></entry> 154 <entry></entry>
144 <entry>&v4l2-vbi-format;</entry> 155 <entry>&v4l2-vbi-format;</entry>
145 <entry><structfield>vbi</structfield></entry> 156 <entry><structfield>vbi</structfield></entry>
146 <entry>Raw VBI capture or output parameters. This is 157 <entry>Raw VBI capture or output parameters. This is
147 discussed in more detail in <xref linkend="raw-vbi" />. Used by raw VBI 158 discussed in more detail in <xref linkend="raw-vbi" />. Used by raw VBI
148 capture and output devices.</entry> 159 capture and output devices.</entry>
149 </row> 160 </row>
150 <row> 161 <row>
151 <entry></entry> 162 <entry></entry>
152 <entry>&v4l2-sliced-vbi-format;</entry> 163 <entry>&v4l2-sliced-vbi-format;</entry>
153 <entry><structfield>sliced</structfield></entry> 164 <entry><structfield>sliced</structfield></entry>
154 <entry>Sliced VBI capture or output parameters. See 165 <entry>Sliced VBI capture or output parameters. See
155 <xref linkend="sliced" /> for details. Used by sliced VBI 166 <xref linkend="sliced" /> for details. Used by sliced VBI
156 capture and output devices.</entry> 167 capture and output devices.</entry>
157 </row> 168 </row>
158 <row> 169 <row>
159 <entry></entry> 170 <entry></entry>
160 <entry>__u8</entry> 171 <entry>__u8</entry>
161 <entry><structfield>raw_data</structfield>[200]</entry> 172 <entry><structfield>raw_data</structfield>[200]</entry>
162 <entry>Place holder for future extensions and custom 173 <entry>Place holder for future extensions and custom
163 (driver defined) formats with <structfield>type</structfield> 174 (driver defined) formats with <structfield>type</structfield>
164 <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher.</entry> 175 <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher.</entry>
165 </row> 176 </row>
166 </tbody> 177 </tbody>
167 </tgroup> 178 </tgroup>
168 </table> 179 </table>
169 </refsect1> 180 </refsect1>
170 181
171 <refsect1> 182 <refsect1>
172 &return-value; 183 &return-value;
173 184
174 <variablelist> 185 <variablelist>
175 <varlistentry> 186 <varlistentry>
176 <term><errorcode>EBUSY</errorcode></term> 187 <term><errorcode>EBUSY</errorcode></term>
177 <listitem> 188 <listitem>
178 <para>The data format cannot be changed at this 189 <para>The data format cannot be changed at this
179 time, for example because I/O is already in progress.</para> 190 time, for example because I/O is already in progress.</para>
180 </listitem> 191 </listitem>
181 </varlistentry> 192 </varlistentry>
182 <varlistentry> 193 <varlistentry>
183 <term><errorcode>EINVAL</errorcode></term> 194 <term><errorcode>EINVAL</errorcode></term>
184 <listitem> 195 <listitem>
185 <para>The &v4l2-format; <structfield>type</structfield> 196 <para>The &v4l2-format; <structfield>type</structfield>
186 field is invalid, the requested buffer type not supported, or 197 field is invalid, the requested buffer type not supported, or
187 <constant>VIDIOC_TRY_FMT</constant> was called and is not 198 <constant>VIDIOC_TRY_FMT</constant> was called and is not
188 supported with this buffer type.</para> 199 supported with this buffer type.</para>
189 </listitem> 200 </listitem>
190 </varlistentry> 201 </varlistentry>
191 </variablelist> 202 </variablelist>
192 </refsect1> 203 </refsect1>
193 </refentry> 204 </refentry>
194 205
195 <!-- 206 <!--
196 Local Variables: 207 Local Variables:
197 mode: sgml 208 mode: sgml
198 sgml-parent-document: "v4l2.sgml" 209 sgml-parent-document: "v4l2.sgml"
199 indent-tabs-mode: nil 210 indent-tabs-mode: nil
200 End: 211 End:
201 --> 212 -->
202 213
Documentation/DocBook/v4l/vidioc-qbuf.xml
1 <refentry id="vidioc-qbuf"> 1 <refentry id="vidioc-qbuf">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_QBUF, VIDIOC_DQBUF</refentrytitle> 3 <refentrytitle>ioctl VIDIOC_QBUF, VIDIOC_DQBUF</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>VIDIOC_QBUF</refname> 8 <refname>VIDIOC_QBUF</refname>
9 <refname>VIDIOC_DQBUF</refname> 9 <refname>VIDIOC_DQBUF</refname>
10 <refpurpose>Exchange a buffer with the driver</refpurpose> 10 <refpurpose>Exchange a buffer with the driver</refpurpose>
11 </refnamediv> 11 </refnamediv>
12 12
13 <refsynopsisdiv> 13 <refsynopsisdiv>
14 <funcsynopsis> 14 <funcsynopsis>
15 <funcprototype> 15 <funcprototype>
16 <funcdef>int <function>ioctl</function></funcdef> 16 <funcdef>int <function>ioctl</function></funcdef>
17 <paramdef>int <parameter>fd</parameter></paramdef> 17 <paramdef>int <parameter>fd</parameter></paramdef>
18 <paramdef>int <parameter>request</parameter></paramdef> 18 <paramdef>int <parameter>request</parameter></paramdef>
19 <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef> 19 <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef>
20 </funcprototype> 20 </funcprototype>
21 </funcsynopsis> 21 </funcsynopsis>
22 </refsynopsisdiv> 22 </refsynopsisdiv>
23 23
24 <refsect1> 24 <refsect1>
25 <title>Arguments</title> 25 <title>Arguments</title>
26 26
27 <variablelist> 27 <variablelist>
28 <varlistentry> 28 <varlistentry>
29 <term><parameter>fd</parameter></term> 29 <term><parameter>fd</parameter></term>
30 <listitem> 30 <listitem>
31 <para>&fd;</para> 31 <para>&fd;</para>
32 </listitem> 32 </listitem>
33 </varlistentry> 33 </varlistentry>
34 <varlistentry> 34 <varlistentry>
35 <term><parameter>request</parameter></term> 35 <term><parameter>request</parameter></term>
36 <listitem> 36 <listitem>
37 <para>VIDIOC_QBUF, VIDIOC_DQBUF</para> 37 <para>VIDIOC_QBUF, VIDIOC_DQBUF</para>
38 </listitem> 38 </listitem>
39 </varlistentry> 39 </varlistentry>
40 <varlistentry> 40 <varlistentry>
41 <term><parameter>argp</parameter></term> 41 <term><parameter>argp</parameter></term>
42 <listitem> 42 <listitem>
43 <para></para> 43 <para></para>
44 </listitem> 44 </listitem>
45 </varlistentry> 45 </varlistentry>
46 </variablelist> 46 </variablelist>
47 </refsect1> 47 </refsect1>
48 48
49 <refsect1> 49 <refsect1>
50 <title>Description</title> 50 <title>Description</title>
51 51
52 <para>Applications call the <constant>VIDIOC_QBUF</constant> ioctl 52 <para>Applications call the <constant>VIDIOC_QBUF</constant> ioctl
53 to enqueue an empty (capturing) or filled (output) buffer in the 53 to enqueue an empty (capturing) or filled (output) buffer in the
54 driver's incoming queue. The semantics depend on the selected I/O 54 driver's incoming queue. The semantics depend on the selected I/O
55 method.</para> 55 method.</para>
56 56
57 <para>To enqueue a buffer applications set the <structfield>type</structfield> 57 <para>To enqueue a buffer applications set the <structfield>type</structfield>
58 field of a &v4l2-buffer; to the same buffer type as was previously used 58 field of a &v4l2-buffer; to the same buffer type as was previously used
59 with &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; 59 with &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers;
60 <structfield>type</structfield>. Applications must also set the 60 <structfield>type</structfield>. Applications must also set the
61 <structfield>index</structfield> field. Valid index numbers range from 61 <structfield>index</structfield> field. Valid index numbers range from
62 zero to the number of buffers allocated with &VIDIOC-REQBUFS; 62 zero to the number of buffers allocated with &VIDIOC-REQBUFS;
63 (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. The 63 (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. The
64 contents of the struct <structname>v4l2_buffer</structname> returned 64 contents of the struct <structname>v4l2_buffer</structname> returned
65 by a &VIDIOC-QUERYBUF; ioctl will do as well. When the buffer is 65 by a &VIDIOC-QUERYBUF; ioctl will do as well. When the buffer is
66 intended for output (<structfield>type</structfield> is 66 intended for output (<structfield>type</structfield> is
67 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> or 67 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
68 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>, or
68 <constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant>) applications must also 69 <constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant>) applications must also
69 initialize the <structfield>bytesused</structfield>, 70 initialize the <structfield>bytesused</structfield>,
70 <structfield>field</structfield> and 71 <structfield>field</structfield> and
71 <structfield>timestamp</structfield> fields, see <xref 72 <structfield>timestamp</structfield> fields, see <xref
72 linkend="buffer" /> for details. 73 linkend="buffer" /> for details.
73 Applications must also set <structfield>flags</structfield> to 0. If a driver 74 Applications must also set <structfield>flags</structfield> to 0. If a driver
74 supports capturing from specific video inputs and you want to specify a video 75 supports capturing from specific video inputs and you want to specify a video
75 input, then <structfield>flags</structfield> should be set to 76 input, then <structfield>flags</structfield> should be set to
76 <constant>V4L2_BUF_FLAG_INPUT</constant> and the field 77 <constant>V4L2_BUF_FLAG_INPUT</constant> and the field
77 <structfield>input</structfield> must be initialized to the desired input. 78 <structfield>input</structfield> must be initialized to the desired input.
78 The <structfield>reserved</structfield> field must be set to 0. 79 The <structfield>reserved</structfield> field must be set to 0. When using
80 the <link linkend="planar-apis">multi-planar API</link>, the
81 <structfield>m.planes</structfield> field must contain a userspace pointer
82 to a filled-in array of &v4l2-plane; and the <structfield>length</structfield>
83 field must be set to the number of elements in that array.
79 </para> 84 </para>
80 85
81 <para>To enqueue a <link linkend="mmap">memory mapped</link> 86 <para>To enqueue a <link linkend="mmap">memory mapped</link>
82 buffer applications set the <structfield>memory</structfield> 87 buffer applications set the <structfield>memory</structfield>
83 field to <constant>V4L2_MEMORY_MMAP</constant>. When 88 field to <constant>V4L2_MEMORY_MMAP</constant>. When
84 <constant>VIDIOC_QBUF</constant> is called with a pointer to this 89 <constant>VIDIOC_QBUF</constant> is called with a pointer to this
85 structure the driver sets the 90 structure the driver sets the
86 <constant>V4L2_BUF_FLAG_MAPPED</constant> and 91 <constant>V4L2_BUF_FLAG_MAPPED</constant> and
87 <constant>V4L2_BUF_FLAG_QUEUED</constant> flags and clears the 92 <constant>V4L2_BUF_FLAG_QUEUED</constant> flags and clears the
88 <constant>V4L2_BUF_FLAG_DONE</constant> flag in the 93 <constant>V4L2_BUF_FLAG_DONE</constant> flag in the
89 <structfield>flags</structfield> field, or it returns an 94 <structfield>flags</structfield> field, or it returns an
90 &EINVAL;.</para> 95 &EINVAL;.</para>
91 96
92 <para>To enqueue a <link linkend="userp">user pointer</link> 97 <para>To enqueue a <link linkend="userp">user pointer</link>
93 buffer applications set the <structfield>memory</structfield> 98 buffer applications set the <structfield>memory</structfield>
94 field to <constant>V4L2_MEMORY_USERPTR</constant>, the 99 field to <constant>V4L2_MEMORY_USERPTR</constant>, the
95 <structfield>m.userptr</structfield> field to the address of the 100 <structfield>m.userptr</structfield> field to the address of the
96 buffer and <structfield>length</structfield> to its size. 101 buffer and <structfield>length</structfield> to its size. When the multi-planar
97 When <constant>VIDIOC_QBUF</constant> is called with a pointer to this 102 API is used, <structfield>m.userptr</structfield> and
98 structure the driver sets the <constant>V4L2_BUF_FLAG_QUEUED</constant> 103 <structfield>length</structfield> members of the passed array of &v4l2-plane;
99 flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and 104 have to be used instead. When <constant>VIDIOC_QBUF</constant> is called with
105 a pointer to this structure the driver sets the
106 <constant>V4L2_BUF_FLAG_QUEUED</constant> flag and clears the
107 <constant>V4L2_BUF_FLAG_MAPPED</constant> and
100 <constant>V4L2_BUF_FLAG_DONE</constant> flags in the 108 <constant>V4L2_BUF_FLAG_DONE</constant> flags in the
101 <structfield>flags</structfield> field, or it returns an error code. 109 <structfield>flags</structfield> field, or it returns an error code.
102 This ioctl locks the memory pages of the buffer in physical memory, 110 This ioctl locks the memory pages of the buffer in physical memory,
103 they cannot be swapped out to disk. Buffers remain locked until 111 they cannot be swapped out to disk. Buffers remain locked until
104 dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is 112 dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is
105 called, or until the device is closed.</para> 113 called, or until the device is closed.</para>
106 114
107 <para>Applications call the <constant>VIDIOC_DQBUF</constant> 115 <para>Applications call the <constant>VIDIOC_DQBUF</constant>
108 ioctl to dequeue a filled (capturing) or displayed (output) buffer 116 ioctl to dequeue a filled (capturing) or displayed (output) buffer
109 from the driver's outgoing queue. They just set the 117 from the driver's outgoing queue. They just set the
110 <structfield>type</structfield>, <structfield>memory</structfield> 118 <structfield>type</structfield>, <structfield>memory</structfield>
111 and <structfield>reserved</structfield> 119 and <structfield>reserved</structfield>
112 fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> 120 fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant>
113 is called with a pointer to this structure the driver fills the 121 is called with a pointer to this structure the driver fills the
114 remaining fields or returns an error code. The driver may also set 122 remaining fields or returns an error code. The driver may also set
115 <constant>V4L2_BUF_FLAG_ERROR</constant> in the <structfield>flags</structfield> 123 <constant>V4L2_BUF_FLAG_ERROR</constant> in the <structfield>flags</structfield>
116 field. It indicates a non-critical (recoverable) streaming error. In such case 124 field. It indicates a non-critical (recoverable) streaming error. In such case
117 the application may continue as normal, but should be aware that data in the 125 the application may continue as normal, but should be aware that data in the
118 dequeued buffer might be corrupted.</para> 126 dequeued buffer might be corrupted. When using the multi-planar API, the
127 planes array does not have to be passed; the <structfield>m.planes</structfield>
128 member must be set to NULL in that case.</para>
119 129
120 <para>By default <constant>VIDIOC_DQBUF</constant> blocks when no 130 <para>By default <constant>VIDIOC_DQBUF</constant> blocks when no
121 buffer is in the outgoing queue. When the 131 buffer is in the outgoing queue. When the
122 <constant>O_NONBLOCK</constant> flag was given to the &func-open; 132 <constant>O_NONBLOCK</constant> flag was given to the &func-open;
123 function, <constant>VIDIOC_DQBUF</constant> returns immediately 133 function, <constant>VIDIOC_DQBUF</constant> returns immediately
124 with an &EAGAIN; when no buffer is available.</para> 134 with an &EAGAIN; when no buffer is available.</para>
125 135
126 <para>The <structname>v4l2_buffer</structname> structure is 136 <para>The <structname>v4l2_buffer</structname> structure is
127 specified in <xref linkend="buffer" />.</para> 137 specified in <xref linkend="buffer" />.</para>
128 </refsect1> 138 </refsect1>
129 139
130 <refsect1> 140 <refsect1>
131 &return-value; 141 &return-value;
132 142
133 <variablelist> 143 <variablelist>
134 <varlistentry> 144 <varlistentry>
135 <term><errorcode>EAGAIN</errorcode></term> 145 <term><errorcode>EAGAIN</errorcode></term>
136 <listitem> 146 <listitem>
137 <para>Non-blocking I/O has been selected using 147 <para>Non-blocking I/O has been selected using
138 <constant>O_NONBLOCK</constant> and no buffer was in the outgoing 148 <constant>O_NONBLOCK</constant> and no buffer was in the outgoing
139 queue.</para> 149 queue.</para>
140 </listitem> 150 </listitem>
141 </varlistentry> 151 </varlistentry>
142 <varlistentry> 152 <varlistentry>
143 <term><errorcode>EINVAL</errorcode></term> 153 <term><errorcode>EINVAL</errorcode></term>
144 <listitem> 154 <listitem>
145 <para>The buffer <structfield>type</structfield> is not 155 <para>The buffer <structfield>type</structfield> is not
146 supported, or the <structfield>index</structfield> is out of bounds, 156 supported, or the <structfield>index</structfield> is out of bounds,
147 or no buffers have been allocated yet, or the 157 or no buffers have been allocated yet, or the
148 <structfield>userptr</structfield> or 158 <structfield>userptr</structfield> or
149 <structfield>length</structfield> are invalid.</para> 159 <structfield>length</structfield> are invalid.</para>
150 </listitem> 160 </listitem>
151 </varlistentry> 161 </varlistentry>
152 <varlistentry> 162 <varlistentry>
153 <term><errorcode>ENOMEM</errorcode></term> 163 <term><errorcode>ENOMEM</errorcode></term>
154 <listitem> 164 <listitem>
155 <para>Not enough physical or virtual memory was available to 165 <para>Not enough physical or virtual memory was available to
156 enqueue a user pointer buffer.</para> 166 enqueue a user pointer buffer.</para>
157 </listitem> 167 </listitem>
158 </varlistentry> 168 </varlistentry>
159 <varlistentry> 169 <varlistentry>
160 <term><errorcode>EIO</errorcode></term> 170 <term><errorcode>EIO</errorcode></term>
161 <listitem> 171 <listitem>
162 <para><constant>VIDIOC_DQBUF</constant> failed due to an 172 <para><constant>VIDIOC_DQBUF</constant> failed due to an
163 internal error. Can also indicate temporary problems like signal 173 internal error. Can also indicate temporary problems like signal
164 loss. Note the driver might dequeue an (empty) buffer despite 174 loss. Note the driver might dequeue an (empty) buffer despite
165 returning an error, or even stop capturing. Reusing such buffer may be unsafe 175 returning an error, or even stop capturing. Reusing such buffer may be unsafe
166 though and its details (e.g. <structfield>index</structfield>) may not be 176 though and its details (e.g. <structfield>index</structfield>) may not be
167 returned either. It is recommended that drivers indicate recoverable errors 177 returned either. It is recommended that drivers indicate recoverable errors
168 by setting the <constant>V4L2_BUF_FLAG_ERROR</constant> and returning 0 instead. 178 by setting the <constant>V4L2_BUF_FLAG_ERROR</constant> and returning 0 instead.
169 In that case the application should be able to safely reuse the buffer and 179 In that case the application should be able to safely reuse the buffer and
170 continue streaming. 180 continue streaming.
171 </para> 181 </para>
172 </listitem> 182 </listitem>
173 </varlistentry> 183 </varlistentry>
174 </variablelist> 184 </variablelist>
175 </refsect1> 185 </refsect1>
176 </refentry> 186 </refentry>
177 187
178 <!-- 188 <!--
179 Local Variables: 189 Local Variables:
180 mode: sgml 190 mode: sgml
181 sgml-parent-document: "v4l2.sgml" 191 sgml-parent-document: "v4l2.sgml"
182 indent-tabs-mode: nil 192 indent-tabs-mode: nil
183 End: 193 End:
184 --> 194 -->
185 195
Documentation/DocBook/v4l/vidioc-querybuf.xml
1 <refentry id="vidioc-querybuf"> 1 <refentry id="vidioc-querybuf">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_QUERYBUF</refentrytitle> 3 <refentrytitle>ioctl VIDIOC_QUERYBUF</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>VIDIOC_QUERYBUF</refname> 8 <refname>VIDIOC_QUERYBUF</refname>
9 <refpurpose>Query the status of a buffer</refpurpose> 9 <refpurpose>Query the status of a buffer</refpurpose>
10 </refnamediv> 10 </refnamediv>
11 11
12 <refsynopsisdiv> 12 <refsynopsisdiv>
13 <funcsynopsis> 13 <funcsynopsis>
14 <funcprototype> 14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef> 15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef> 16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef> 17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef> 18 <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef>
19 </funcprototype> 19 </funcprototype>
20 </funcsynopsis> 20 </funcsynopsis>
21 </refsynopsisdiv> 21 </refsynopsisdiv>
22 22
23 <refsect1> 23 <refsect1>
24 <title>Arguments</title> 24 <title>Arguments</title>
25 25
26 <variablelist> 26 <variablelist>
27 <varlistentry> 27 <varlistentry>
28 <term><parameter>fd</parameter></term> 28 <term><parameter>fd</parameter></term>
29 <listitem> 29 <listitem>
30 <para>&fd;</para> 30 <para>&fd;</para>
31 </listitem> 31 </listitem>
32 </varlistentry> 32 </varlistentry>
33 <varlistentry> 33 <varlistentry>
34 <term><parameter>request</parameter></term> 34 <term><parameter>request</parameter></term>
35 <listitem> 35 <listitem>
36 <para>VIDIOC_QUERYBUF</para> 36 <para>VIDIOC_QUERYBUF</para>
37 </listitem> 37 </listitem>
38 </varlistentry> 38 </varlistentry>
39 <varlistentry> 39 <varlistentry>
40 <term><parameter>argp</parameter></term> 40 <term><parameter>argp</parameter></term>
41 <listitem> 41 <listitem>
42 <para></para> 42 <para></para>
43 </listitem> 43 </listitem>
44 </varlistentry> 44 </varlistentry>
45 </variablelist> 45 </variablelist>
46 </refsect1> 46 </refsect1>
47 47
48 <refsect1> 48 <refsect1>
49 <title>Description</title> 49 <title>Description</title>
50 50
51 <para>This ioctl is part of the <link linkend="mmap">memory 51 <para>This ioctl is part of the <link linkend="mmap">memory
52 mapping</link> I/O method. It can be used to query the status of a 52 mapping</link> I/O method. It can be used to query the status of a
53 buffer at any time after buffers have been allocated with the 53 buffer at any time after buffers have been allocated with the
54 &VIDIOC-REQBUFS; ioctl.</para> 54 &VIDIOC-REQBUFS; ioctl.</para>
55 55
56 <para>Applications set the <structfield>type</structfield> field 56 <para>Applications set the <structfield>type</structfield> field
57 of a &v4l2-buffer; to the same buffer type as was previously used with 57 of a &v4l2-buffer; to the same buffer type as was previously used with
58 &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; 58 &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers;
59 <structfield>type</structfield>, and the <structfield>index</structfield> 59 <structfield>type</structfield>, and the <structfield>index</structfield>
60 field. Valid index numbers range from zero 60 field. Valid index numbers range from zero
61 to the number of buffers allocated with &VIDIOC-REQBUFS; 61 to the number of buffers allocated with &VIDIOC-REQBUFS;
62 (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. 62 (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.
63 The <structfield>reserved</structfield> field should to set to 0. 63 The <structfield>reserved</structfield> field should to set to 0.
64 When using the <link linkend="planar-apis">multi-planar API</link>, the
65 <structfield>m.planes</structfield> field must contain a userspace pointer to an
66 array of &v4l2-plane; and the <structfield>length</structfield> field has
67 to be set to the number of elements in that array.
64 After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to 68 After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to
65 this structure drivers return an error code or fill the rest of 69 this structure drivers return an error code or fill the rest of
66 the structure.</para> 70 the structure.</para>
67 71
68 <para>In the <structfield>flags</structfield> field the 72 <para>In the <structfield>flags</structfield> field the
69 <constant>V4L2_BUF_FLAG_MAPPED</constant>, 73 <constant>V4L2_BUF_FLAG_MAPPED</constant>,
70 <constant>V4L2_BUF_FLAG_QUEUED</constant> and 74 <constant>V4L2_BUF_FLAG_QUEUED</constant> and
71 <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The 75 <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The
72 <structfield>memory</structfield> field will be set to the current 76 <structfield>memory</structfield> field will be set to the current
73 I/O method, the <structfield>m.offset</structfield> 77 I/O method. For the single-planar API, the <structfield>m.offset</structfield>
74 contains the offset of the buffer from the start of the device memory, 78 contains the offset of the buffer from the start of the device memory,
75 the <structfield>length</structfield> field its size. The driver may 79 the <structfield>length</structfield> field its size. For the multi-planar API,
76 or may not set the remaining fields and flags, they are meaningless in 80 fields <structfield>m.mem_offset</structfield> and
77 this context.</para> 81 <structfield>length</structfield> in the <structfield>m.planes</structfield>
82 array elements will be used instead. The driver may or may not set the remaining
83 fields and flags, they are meaningless in this context.</para>
78 84
79 <para>The <structname>v4l2_buffer</structname> structure is 85 <para>The <structname>v4l2_buffer</structname> structure is
80 specified in <xref linkend="buffer" />.</para> 86 specified in <xref linkend="buffer" />.</para>
81 </refsect1> 87 </refsect1>
82 88
83 <refsect1> 89 <refsect1>
84 &return-value; 90 &return-value;
85 91
86 <variablelist> 92 <variablelist>
87 <varlistentry> 93 <varlistentry>
88 <term><errorcode>EINVAL</errorcode></term> 94 <term><errorcode>EINVAL</errorcode></term>
89 <listitem> 95 <listitem>
90 <para>The buffer <structfield>type</structfield> is not 96 <para>The buffer <structfield>type</structfield> is not
91 supported, or the <structfield>index</structfield> is out of bounds.</para> 97 supported, or the <structfield>index</structfield> is out of bounds.</para>
92 </listitem> 98 </listitem>
93 </varlistentry> 99 </varlistentry>
94 </variablelist> 100 </variablelist>
95 </refsect1> 101 </refsect1>
96 </refentry> 102 </refentry>
97 103
98 <!-- 104 <!--
99 Local Variables: 105 Local Variables:
100 mode: sgml 106 mode: sgml
101 sgml-parent-document: "v4l2.sgml" 107 sgml-parent-document: "v4l2.sgml"
102 indent-tabs-mode: nil 108 indent-tabs-mode: nil
103 End: 109 End:
104 --> 110 -->
105 111
Documentation/DocBook/v4l/vidioc-querycap.xml
1 <refentry id="vidioc-querycap"> 1 <refentry id="vidioc-querycap">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_QUERYCAP</refentrytitle> 3 <refentrytitle>ioctl VIDIOC_QUERYCAP</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 6
7 <refnamediv> 7 <refnamediv>
8 <refname>VIDIOC_QUERYCAP</refname> 8 <refname>VIDIOC_QUERYCAP</refname>
9 <refpurpose>Query device capabilities</refpurpose> 9 <refpurpose>Query device capabilities</refpurpose>
10 </refnamediv> 10 </refnamediv>
11 11
12 <refsynopsisdiv> 12 <refsynopsisdiv>
13 <funcsynopsis> 13 <funcsynopsis>
14 <funcprototype> 14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef> 15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef> 16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef> 17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_capability *<parameter>argp</parameter></paramdef> 18 <paramdef>struct v4l2_capability *<parameter>argp</parameter></paramdef>
19 </funcprototype> 19 </funcprototype>
20 </funcsynopsis> 20 </funcsynopsis>
21 </refsynopsisdiv> 21 </refsynopsisdiv>
22 22
23 <refsect1> 23 <refsect1>
24 <title>Arguments</title> 24 <title>Arguments</title>
25 25
26 <variablelist> 26 <variablelist>
27 <varlistentry> 27 <varlistentry>
28 <term><parameter>fd</parameter></term> 28 <term><parameter>fd</parameter></term>
29 <listitem> 29 <listitem>
30 <para>&fd;</para> 30 <para>&fd;</para>
31 </listitem> 31 </listitem>
32 </varlistentry> 32 </varlistentry>
33 <varlistentry> 33 <varlistentry>
34 <term><parameter>request</parameter></term> 34 <term><parameter>request</parameter></term>
35 <listitem> 35 <listitem>
36 <para>VIDIOC_QUERYCAP</para> 36 <para>VIDIOC_QUERYCAP</para>
37 </listitem> 37 </listitem>
38 </varlistentry> 38 </varlistentry>
39 <varlistentry> 39 <varlistentry>
40 <term><parameter>argp</parameter></term> 40 <term><parameter>argp</parameter></term>
41 <listitem> 41 <listitem>
42 <para></para> 42 <para></para>
43 </listitem> 43 </listitem>
44 </varlistentry> 44 </varlistentry>
45 </variablelist> 45 </variablelist>
46 </refsect1> 46 </refsect1>
47 47
48 <refsect1> 48 <refsect1>
49 <title>Description</title> 49 <title>Description</title>
50 50
51 <para>All V4L2 devices support the 51 <para>All V4L2 devices support the
52 <constant>VIDIOC_QUERYCAP</constant> ioctl. It is used to identify 52 <constant>VIDIOC_QUERYCAP</constant> ioctl. It is used to identify
53 kernel devices compatible with this specification and to obtain 53 kernel devices compatible with this specification and to obtain
54 information about driver and hardware capabilities. The ioctl takes a 54 information about driver and hardware capabilities. The ioctl takes a
55 pointer to a &v4l2-capability; which is filled by the driver. When the 55 pointer to a &v4l2-capability; which is filled by the driver. When the
56 driver is not compatible with this specification the ioctl returns an 56 driver is not compatible with this specification the ioctl returns an
57 &EINVAL;.</para> 57 &EINVAL;.</para>
58 58
59 <table pgwide="1" frame="none" id="v4l2-capability"> 59 <table pgwide="1" frame="none" id="v4l2-capability">
60 <title>struct <structname>v4l2_capability</structname></title> 60 <title>struct <structname>v4l2_capability</structname></title>
61 <tgroup cols="3"> 61 <tgroup cols="3">
62 &cs-str; 62 &cs-str;
63 <tbody valign="top"> 63 <tbody valign="top">
64 <row> 64 <row>
65 <entry>__u8</entry> 65 <entry>__u8</entry>
66 <entry><structfield>driver</structfield>[16]</entry> 66 <entry><structfield>driver</structfield>[16]</entry>
67 <entry><para>Name of the driver, a unique NUL-terminated 67 <entry><para>Name of the driver, a unique NUL-terminated
68 ASCII string. For example: "bttv". Driver specific applications can 68 ASCII string. For example: "bttv". Driver specific applications can
69 use this information to verify the driver identity. It is also useful 69 use this information to verify the driver identity. It is also useful
70 to work around known bugs, or to identify drivers in error reports. 70 to work around known bugs, or to identify drivers in error reports.
71 The driver version is stored in the <structfield>version</structfield> 71 The driver version is stored in the <structfield>version</structfield>
72 field.</para><para>Storing strings in fixed sized arrays is bad 72 field.</para><para>Storing strings in fixed sized arrays is bad
73 practice but unavoidable here. Drivers and applications should take 73 practice but unavoidable here. Drivers and applications should take
74 precautions to never read or write beyond the end of the array and to 74 precautions to never read or write beyond the end of the array and to
75 make sure the strings are properly NUL-terminated.</para></entry> 75 make sure the strings are properly NUL-terminated.</para></entry>
76 </row> 76 </row>
77 <row> 77 <row>
78 <entry>__u8</entry> 78 <entry>__u8</entry>
79 <entry><structfield>card</structfield>[32]</entry> 79 <entry><structfield>card</structfield>[32]</entry>
80 <entry>Name of the device, a NUL-terminated ASCII string. 80 <entry>Name of the device, a NUL-terminated ASCII string.
81 For example: "Yoyodyne TV/FM". One driver may support different brands 81 For example: "Yoyodyne TV/FM". One driver may support different brands
82 or models of video hardware. This information is intended for users, 82 or models of video hardware. This information is intended for users,
83 for example in a menu of available devices. Since multiple TV cards of 83 for example in a menu of available devices. Since multiple TV cards of
84 the same brand may be installed which are supported by the same 84 the same brand may be installed which are supported by the same
85 driver, this name should be combined with the character device file 85 driver, this name should be combined with the character device file
86 name (&eg; <filename>/dev/video2</filename>) or the 86 name (&eg; <filename>/dev/video2</filename>) or the
87 <structfield>bus_info</structfield> string to avoid 87 <structfield>bus_info</structfield> string to avoid
88 ambiguities.</entry> 88 ambiguities.</entry>
89 </row> 89 </row>
90 <row> 90 <row>
91 <entry>__u8</entry> 91 <entry>__u8</entry>
92 <entry><structfield>bus_info</structfield>[32]</entry> 92 <entry><structfield>bus_info</structfield>[32]</entry>
93 <entry>Location of the device in the system, a 93 <entry>Location of the device in the system, a
94 NUL-terminated ASCII string. For example: "PCI Slot 4". This 94 NUL-terminated ASCII string. For example: "PCI Slot 4". This
95 information is intended for users, to distinguish multiple 95 information is intended for users, to distinguish multiple
96 identical devices. If no such information is available the field may 96 identical devices. If no such information is available the field may
97 simply count the devices controlled by the driver, or contain the 97 simply count the devices controlled by the driver, or contain the
98 empty string (<structfield>bus_info</structfield>[0] = 0).<!-- XXX pci_dev->slot_name example --></entry> 98 empty string (<structfield>bus_info</structfield>[0] = 0).<!-- XXX pci_dev->slot_name example --></entry>
99 </row> 99 </row>
100 <row> 100 <row>
101 <entry>__u32</entry> 101 <entry>__u32</entry>
102 <entry><structfield>version</structfield></entry> 102 <entry><structfield>version</structfield></entry>
103 <entry><para>Version number of the driver. Together with 103 <entry><para>Version number of the driver. Together with
104 the <structfield>driver</structfield> field this identifies a 104 the <structfield>driver</structfield> field this identifies a
105 particular driver. The version number is formatted using the 105 particular driver. The version number is formatted using the
106 <constant>KERNEL_VERSION()</constant> macro:</para></entry> 106 <constant>KERNEL_VERSION()</constant> macro:</para></entry>
107 </row> 107 </row>
108 <row> 108 <row>
109 <entry spanname="hspan"><para> 109 <entry spanname="hspan"><para>
110 <programlisting> 110 <programlisting>
111 #define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c)) 111 #define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c))
112 112
113 __u32 version = KERNEL_VERSION(0, 8, 1); 113 __u32 version = KERNEL_VERSION(0, 8, 1);
114 114
115 printf ("Version: %u.%u.%u\n", 115 printf ("Version: %u.%u.%u\n",
116 (version &gt;&gt; 16) &amp; 0xFF, 116 (version &gt;&gt; 16) &amp; 0xFF,
117 (version &gt;&gt; 8) &amp; 0xFF, 117 (version &gt;&gt; 8) &amp; 0xFF,
118 version &amp; 0xFF); 118 version &amp; 0xFF);
119 </programlisting></para></entry> 119 </programlisting></para></entry>
120 </row> 120 </row>
121 <row> 121 <row>
122 <entry>__u32</entry> 122 <entry>__u32</entry>
123 <entry><structfield>capabilities</structfield></entry> 123 <entry><structfield>capabilities</structfield></entry>
124 <entry>Device capabilities, see <xref 124 <entry>Device capabilities, see <xref
125 linkend="device-capabilities" />.</entry> 125 linkend="device-capabilities" />.</entry>
126 </row> 126 </row>
127 <row> 127 <row>
128 <entry>__u32</entry> 128 <entry>__u32</entry>
129 <entry><structfield>reserved</structfield>[4]</entry> 129 <entry><structfield>reserved</structfield>[4]</entry>
130 <entry>Reserved for future extensions. Drivers must set 130 <entry>Reserved for future extensions. Drivers must set
131 this array to zero.</entry> 131 this array to zero.</entry>
132 </row> 132 </row>
133 </tbody> 133 </tbody>
134 </tgroup> 134 </tgroup>
135 </table> 135 </table>
136 136
137 <table pgwide="1" frame="none" id="device-capabilities"> 137 <table pgwide="1" frame="none" id="device-capabilities">
138 <title>Device Capabilities Flags</title> 138 <title>Device Capabilities Flags</title>
139 <tgroup cols="3"> 139 <tgroup cols="3">
140 &cs-def; 140 &cs-def;
141 <tbody valign="top"> 141 <tbody valign="top">
142 <row> 142 <row>
143 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry> 143 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
144 <entry>0x00000001</entry> 144 <entry>0x00000001</entry>
145 <entry>The device supports the <link 145 <entry>The device supports single-planar formats through the <link
146 linkend="capture">Video Capture</link> interface.</entry> 146 linkend="capture">Video Capture</link> interface. An application can use either
147 <link linkend="planar-apis">the single or the multi-planar API</link>.</entry>
147 </row> 148 </row>
148 <row> 149 <row>
150 <entry><constant>V4L2_CAP_VIDEO_CAPTURE_MPLANE</constant></entry>
151 <entry>0x00001000</entry>
152 <entry>The device supports multi-planar formats through the <link
153 linkend="capture">Video Capture</link> interface. An application has to use the
154 <link linkend="planar-apis">multi-planar API</link>.</entry>
155 </row>
156 <row>
149 <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry> 157 <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry>
150 <entry>0x00000002</entry> 158 <entry>0x00000002</entry>
151 <entry>The device supports the <link 159 <entry>The device supports single-planar formats through the <link
152 linkend="output">Video Output</link> interface.</entry> 160 linkend="output">Video Output</link> interface. An application can use either
161 <link linkend="planar-apis">the single or the multi-planar API</link>.</entry>
162 </row>
163 <row>
164 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant></entry>
165 <entry>0x00002000</entry>
166 <entry>The device supports multi-planar formats through the <link
167 linkend="output">Video Output</link> interface. An application has to use the
168 <link linkend="planar-apis">multi-planar API</link>.</entry>
153 </row> 169 </row>
154 <row> 170 <row>
155 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry> 171 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
156 <entry>0x00000004</entry> 172 <entry>0x00000004</entry>
157 <entry>The device supports the <link 173 <entry>The device supports the <link
158 linkend="overlay">Video Overlay</link> interface. A video overlay device 174 linkend="overlay">Video Overlay</link> interface. A video overlay device
159 typically stores captured images directly in the video memory of a 175 typically stores captured images directly in the video memory of a
160 graphics card, with hardware clipping and scaling.</entry> 176 graphics card, with hardware clipping and scaling.</entry>
161 </row> 177 </row>
162 <row> 178 <row>
163 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry> 179 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
164 <entry>0x00000010</entry> 180 <entry>0x00000010</entry>
165 <entry>The device supports the <link linkend="raw-vbi">Raw 181 <entry>The device supports the <link linkend="raw-vbi">Raw
166 VBI Capture</link> interface, providing Teletext and Closed Caption 182 VBI Capture</link> interface, providing Teletext and Closed Caption
167 data.</entry> 183 data.</entry>
168 </row> 184 </row>
169 <row> 185 <row>
170 <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry> 186 <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry>
171 <entry>0x00000020</entry> 187 <entry>0x00000020</entry>
172 <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry> 188 <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry>
173 </row> 189 </row>
174 <row> 190 <row>
175 <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry> 191 <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry>
176 <entry>0x00000040</entry> 192 <entry>0x00000040</entry>
177 <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry> 193 <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry>
178 </row> 194 </row>
179 <row> 195 <row>
180 <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry> 196 <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry>
181 <entry>0x00000080</entry> 197 <entry>0x00000080</entry>
182 <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry> 198 <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry>
183 </row> 199 </row>
184 <row> 200 <row>
185 <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry> 201 <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry>
186 <entry>0x00000100</entry> 202 <entry>0x00000100</entry>
187 <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry> 203 <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry>
188 </row> 204 </row>
189 <row> 205 <row>
190 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry> 206 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry>
191 <entry>0x00000200</entry> 207 <entry>0x00000200</entry>
192 <entry>The device supports the <link linkend="osd">Video 208 <entry>The device supports the <link linkend="osd">Video
193 Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video 209 Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
194 Overlay</wordasword> interface, this is a secondary function of video 210 Overlay</wordasword> interface, this is a secondary function of video
195 output devices and overlays an image onto an outgoing video signal. 211 output devices and overlays an image onto an outgoing video signal.
196 When the driver sets this flag, it must clear the 212 When the driver sets this flag, it must clear the
197 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice 213 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
198 versa.<footnote><para>The &v4l2-framebuffer; lacks an 214 versa.<footnote><para>The &v4l2-framebuffer; lacks an
199 &v4l2-buf-type; field, therefore the type of overlay is implied by the 215 &v4l2-buf-type; field, therefore the type of overlay is implied by the
200 driver capabilities.</para></footnote></entry> 216 driver capabilities.</para></footnote></entry>
201 </row> 217 </row>
202 <row> 218 <row>
203 <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry> 219 <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry>
204 <entry>0x00000400</entry> 220 <entry>0x00000400</entry>
205 <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for 221 <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for
206 hardware frequency seeking.</entry> 222 hardware frequency seeking.</entry>
207 </row> 223 </row>
208 <row> 224 <row>
209 <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry> 225 <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry>
210 <entry>0x00000800</entry> 226 <entry>0x00000800</entry>
211 <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry> 227 <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry>
212 </row> 228 </row>
213 <row> 229 <row>
214 <entry><constant>V4L2_CAP_TUNER</constant></entry> 230 <entry><constant>V4L2_CAP_TUNER</constant></entry>
215 <entry>0x00010000</entry> 231 <entry>0x00010000</entry>
216 <entry>The device has some sort of tuner to 232 <entry>The device has some sort of tuner to
217 receive RF-modulated video signals. For more information about 233 receive RF-modulated video signals. For more information about
218 tuner programming see 234 tuner programming see
219 <xref linkend="tuner" />.</entry> 235 <xref linkend="tuner" />.</entry>
220 </row> 236 </row>
221 <row> 237 <row>
222 <entry><constant>V4L2_CAP_AUDIO</constant></entry> 238 <entry><constant>V4L2_CAP_AUDIO</constant></entry>
223 <entry>0x00020000</entry> 239 <entry>0x00020000</entry>
224 <entry>The device has audio inputs or outputs. It may or 240 <entry>The device has audio inputs or outputs. It may or
225 may not support audio recording or playback, in PCM or compressed 241 may not support audio recording or playback, in PCM or compressed
226 formats. PCM audio support must be implemented as ALSA or OSS 242 formats. PCM audio support must be implemented as ALSA or OSS
227 interface. For more information on audio inputs and outputs see <xref 243 interface. For more information on audio inputs and outputs see <xref
228 linkend="audio" />.</entry> 244 linkend="audio" />.</entry>
229 </row> 245 </row>
230 <row> 246 <row>
231 <entry><constant>V4L2_CAP_RADIO</constant></entry> 247 <entry><constant>V4L2_CAP_RADIO</constant></entry>
232 <entry>0x00040000</entry> 248 <entry>0x00040000</entry>
233 <entry>This is a radio receiver.</entry> 249 <entry>This is a radio receiver.</entry>
234 </row> 250 </row>
235 <row> 251 <row>
236 <entry><constant>V4L2_CAP_MODULATOR</constant></entry> 252 <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
237 <entry>0x00080000</entry> 253 <entry>0x00080000</entry>
238 <entry>The device has some sort of modulator to 254 <entry>The device has some sort of modulator to
239 emit RF-modulated video/audio signals. For more information about 255 emit RF-modulated video/audio signals. For more information about
240 modulator programming see 256 modulator programming see
241 <xref linkend="tuner" />.</entry> 257 <xref linkend="tuner" />.</entry>
242 </row> 258 </row>
243 <row> 259 <row>
244 <entry><constant>V4L2_CAP_READWRITE</constant></entry> 260 <entry><constant>V4L2_CAP_READWRITE</constant></entry>
245 <entry>0x01000000</entry> 261 <entry>0x01000000</entry>
246 <entry>The device supports the <link 262 <entry>The device supports the <link
247 linkend="rw">read()</link> and/or <link linkend="rw">write()</link> 263 linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
248 I/O methods.</entry> 264 I/O methods.</entry>
249 </row> 265 </row>
250 <row> 266 <row>
251 <entry><constant>V4L2_CAP_ASYNCIO</constant></entry> 267 <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
252 <entry>0x02000000</entry> 268 <entry>0x02000000</entry>
253 <entry>The device supports the <link 269 <entry>The device supports the <link
254 linkend="async">asynchronous</link> I/O methods.</entry> 270 linkend="async">asynchronous</link> I/O methods.</entry>
255 </row> 271 </row>
256 <row> 272 <row>
257 <entry><constant>V4L2_CAP_STREAMING</constant></entry> 273 <entry><constant>V4L2_CAP_STREAMING</constant></entry>
258 <entry>0x04000000</entry> 274 <entry>0x04000000</entry>
259 <entry>The device supports the <link 275 <entry>The device supports the <link
260 linkend="mmap">streaming</link> I/O method.</entry> 276 linkend="mmap">streaming</link> I/O method.</entry>
261 </row> 277 </row>
262 </tbody> 278 </tbody>
263 </tgroup> 279 </tgroup>
264 </table> 280 </table>
265 </refsect1> 281 </refsect1>
266 282
267 <refsect1> 283 <refsect1>
268 &return-value; 284 &return-value;
269 285
270 <variablelist> 286 <variablelist>
271 <varlistentry> 287 <varlistentry>
272 <term><errorcode>EINVAL</errorcode></term> 288 <term><errorcode>EINVAL</errorcode></term>
273 <listitem> 289 <listitem>
274 <para>The device is not compatible with this 290 <para>The device is not compatible with this
275 specification.</para> 291 specification.</para>
276 </listitem> 292 </listitem>
277 </varlistentry> 293 </varlistentry>
278 </variablelist> 294 </variablelist>
279 </refsect1> 295 </refsect1>
280 </refentry> 296 </refentry>
281 297
282 <!-- 298 <!--
283 Local Variables: 299 Local Variables:
284 mode: sgml 300 mode: sgml
285 sgml-parent-document: "v4l2.sgml" 301 sgml-parent-document: "v4l2.sgml"
286 indent-tabs-mode: nil 302 indent-tabs-mode: nil
287 End: 303 End:
288 --> 304 -->
289 305
290 306