Path: blob/master/Documentation/DocBook/v4l/compat.xml
10823 views
<title>Changes</title>12<para>The following chapters document the evolution of the V4L2 API,3errata or extensions. They are also intended to help application and4driver writers to port or update their code.</para>56<section id="diff-v4l">7<title>Differences between V4L and V4L2</title>89<para>The Video For Linux API was first introduced in Linux 2.1 to10unify and replace various TV and radio device related interfaces,11developed independently by driver writers in prior years. Starting12with Linux 2.5 the much improved V4L2 API replaces the V4L API,13although existing drivers will continue to support V4L applications in14the future, either directly or through the V4L2 compatibility layer in15the <filename>videodev</filename> kernel module translating ioctls on16the fly. For a transition period not all drivers will support the V4L217API.</para>1819<section>20<title>Opening and Closing Devices</title>2122<para>For compatibility reasons the character device file names23recommended for V4L2 video capture, overlay, radio and raw24vbi capture devices did not change from those used by V4L. They are25listed in <xref linkend="devices" /> and below in <xref26linkend="v4l-dev" />.</para>2728<para>The teletext devices (minor range 192-223) have been removed in29V4L2 and no longer exist. There is no hardware available anymore for handling30pure teletext. Instead raw or sliced VBI is used.</para>3132<para>The V4L <filename>videodev</filename> module automatically33assigns minor numbers to drivers in load order, depending on the34registered device type. We recommend that V4L2 drivers by default35register devices with the same numbers, but the system administrator36can assign arbitrary minor numbers using driver module options. The37major device number remains 81.</para>3839<table id="v4l-dev">40<title>V4L Device Types, Names and Numbers</title>41<tgroup cols="3">42<thead>43<row>44<entry>Device Type</entry>45<entry>File Name</entry>46<entry>Minor Numbers</entry>47</row>48</thead>49<tbody valign="top">50<row>51<entry>Video capture and overlay</entry>52<entry><para><filename>/dev/video</filename> and53<filename>/dev/bttv0</filename><footnote> <para>According to54Documentation/devices.txt these should be symbolic links to55<filename>/dev/video0</filename>. Note the original bttv interface is56not compatible with V4L or V4L2.</para> </footnote>,57<filename>/dev/video0</filename> to58<filename>/dev/video63</filename></para></entry>59<entry>0-63</entry>60</row>61<row>62<entry>Radio receiver</entry>63<entry><para><filename>/dev/radio</filename><footnote>64<para>According to65<filename>Documentation/devices.txt</filename> a symbolic link to66<filename>/dev/radio0</filename>.</para>67</footnote>, <filename>/dev/radio0</filename> to68<filename>/dev/radio63</filename></para></entry>69<entry>64-127</entry>70</row>71<row>72<entry>Raw VBI capture</entry>73<entry><para><filename>/dev/vbi</filename>,74<filename>/dev/vbi0</filename> to75<filename>/dev/vbi31</filename></para></entry>76<entry>224-255</entry>77</row>78</tbody>79</tgroup>80</table>8182<para>V4L prohibits (or used to prohibit) multiple opens of a83device file. V4L2 drivers <emphasis>may</emphasis> support multiple84opens, see <xref linkend="open" /> for details and consequences.</para>8586<para>V4L drivers respond to V4L2 ioctls with an &EINVAL;. The87compatibility layer in the V4L2 <filename>videodev</filename> module88can translate V4L ioctl requests to their V4L2 counterpart, however a89V4L2 driver usually needs more preparation to become fully V4L90compatible. This is covered in more detail in <xref91linkend="driver" />.</para>92</section>9394<section>95<title>Querying Capabilities</title>9697<para>The V4L <constant>VIDIOCGCAP</constant> ioctl is98equivalent to V4L2's &VIDIOC-QUERYCAP;.</para>99100<para>The <structfield>name</structfield> field in struct101<structname>video_capability</structname> became102<structfield>card</structfield> in &v4l2-capability;,103<structfield>type</structfield> was replaced by104<structfield>capabilities</structfield>. Note V4L2 does not105distinguish between device types like this, better think of basic106video input, video output and radio devices supporting a set of107related functions like video capturing, video overlay and VBI108capturing. See <xref linkend="open" /> for an109introduction.<informaltable>110<tgroup cols="3">111<thead>112<row>113<entry>struct114<structname>video_capability</structname>115<structfield>type</structfield></entry>116<entry>&v4l2-capability;117<structfield>capabilities</structfield> flags</entry>118<entry>Purpose</entry>119</row>120</thead>121<tbody valign="top">122<row>123<entry><constant>VID_TYPE_CAPTURE</constant></entry>124<entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>125<entry>The <link linkend="capture">video126capture</link> interface is supported.</entry>127</row>128<row>129<entry><constant>VID_TYPE_TUNER</constant></entry>130<entry><constant>V4L2_CAP_TUNER</constant></entry>131<entry>The device has a <link linkend="tuner">tuner or132modulator</link>.</entry>133</row>134<row>135<entry><constant>VID_TYPE_TELETEXT</constant></entry>136<entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>137<entry>The <link linkend="raw-vbi">raw VBI138capture</link> interface is supported.</entry>139</row>140<row>141<entry><constant>VID_TYPE_OVERLAY</constant></entry>142<entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>143<entry>The <link linkend="overlay">video144overlay</link> interface is supported.</entry>145</row>146<row>147<entry><constant>VID_TYPE_CHROMAKEY</constant></entry>148<entry><constant>V4L2_FBUF_CAP_CHROMAKEY</constant> in149field <structfield>capability</structfield> of150&v4l2-framebuffer;</entry>151<entry>Whether chromakey overlay is supported. For152more information on overlay see153<xref linkend="overlay" />.</entry>154</row>155<row>156<entry><constant>VID_TYPE_CLIPPING</constant></entry>157<entry><constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant>158and <constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant> in field159<structfield>capability</structfield> of &v4l2-framebuffer;</entry>160<entry>Whether clipping the overlaid image is161supported, see <xref linkend="overlay" />.</entry>162</row>163<row>164<entry><constant>VID_TYPE_FRAMERAM</constant></entry>165<entry><constant>V4L2_FBUF_CAP_EXTERNOVERLAY</constant>166<emphasis>not set</emphasis> in field167<structfield>capability</structfield> of &v4l2-framebuffer;</entry>168<entry>Whether overlay overwrites frame buffer memory,169see <xref linkend="overlay" />.</entry>170</row>171<row>172<entry><constant>VID_TYPE_SCALES</constant></entry>173<entry><constant>-</constant></entry>174<entry>This flag indicates if the hardware can scale175images. The V4L2 API implies the scale factor by setting the cropping176dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT;177ioctl, respectively. The driver returns the closest sizes possible.178For more information on cropping and scaling see <xref179linkend="crop" />.</entry>180</row>181<row>182<entry><constant>VID_TYPE_MONOCHROME</constant></entry>183<entry><constant>-</constant></entry>184<entry>Applications can enumerate the supported image185formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device186supports grey scale capturing only. For more information on image187formats see <xref linkend="pixfmt" />.</entry>188</row>189<row>190<entry><constant>VID_TYPE_SUBCAPTURE</constant></entry>191<entry><constant>-</constant></entry>192<entry>Applications can call the &VIDIOC-G-CROP; ioctl193to determine if the device supports capturing a subsection of the full194picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;.195For more information on cropping and scaling see <xref196linkend="crop" />.</entry>197</row>198<row>199<entry><constant>VID_TYPE_MPEG_DECODER</constant></entry>200<entry><constant>-</constant></entry>201<entry>Applications can enumerate the supported image202formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device203supports MPEG streams.</entry>204</row>205<row>206<entry><constant>VID_TYPE_MPEG_ENCODER</constant></entry>207<entry><constant>-</constant></entry>208<entry>See above.</entry>209</row>210<row>211<entry><constant>VID_TYPE_MJPEG_DECODER</constant></entry>212<entry><constant>-</constant></entry>213<entry>See above.</entry>214</row>215<row>216<entry><constant>VID_TYPE_MJPEG_ENCODER</constant></entry>217<entry><constant>-</constant></entry>218<entry>See above.</entry>219</row>220</tbody>221</tgroup>222</informaltable></para>223224<para>The <structfield>audios</structfield> field was replaced225by <structfield>capabilities</structfield> flag226<constant>V4L2_CAP_AUDIO</constant>, indicating227<emphasis>if</emphasis> the device has any audio inputs or outputs. To228determine their number applications can enumerate audio inputs with229the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in <xref230linkend="audio" />.</para>231232<para>The <structfield>maxwidth</structfield>,233<structfield>maxheight</structfield>,234<structfield>minwidth</structfield> and235<structfield>minheight</structfield> fields were removed. Calling the236&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions237returns the closest size possible, taking into account the current238video standard, cropping and scaling limitations.</para>239</section>240241<section>242<title>Video Sources</title>243244<para>V4L provides the <constant>VIDIOCGCHAN</constant> and245<constant>VIDIOCSCHAN</constant> ioctl using struct246<structname>video_channel</structname> to enumerate247the video inputs of a V4L device. The equivalent V4L2 ioctls248are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT;249using &v4l2-input; as discussed in <xref linkend="video" />.</para>250251<para>The <structfield>channel</structfield> field counting252inputs was renamed to <structfield>index</structfield>, the video253input types were renamed as follows: <informaltable>254<tgroup cols="2">255<thead>256<row>257<entry>struct <structname>video_channel</structname>258<structfield>type</structfield></entry>259<entry>&v4l2-input;260<structfield>type</structfield></entry>261</row>262</thead>263<tbody valign="top">264<row>265<entry><constant>VIDEO_TYPE_TV</constant></entry>266<entry><constant>V4L2_INPUT_TYPE_TUNER</constant></entry>267</row>268<row>269<entry><constant>VIDEO_TYPE_CAMERA</constant></entry>270<entry><constant>V4L2_INPUT_TYPE_CAMERA</constant></entry>271</row>272</tbody>273</tgroup>274</informaltable></para>275276<para>Unlike the <structfield>tuners</structfield> field277expressing the number of tuners of this input, V4L2 assumes each video278input is connected to at most one tuner. However a tuner can have more279than one input, &ie; RF connectors, and a device can have multiple280tuners. The index number of the tuner associated with the input, if281any, is stored in field <structfield>tuner</structfield> of282&v4l2-input;. Enumeration of tuners is discussed in <xref283linkend="tuner" />.</para>284285<para>The redundant <constant>VIDEO_VC_TUNER</constant> flag was286dropped. Video inputs associated with a tuner are of type287<constant>V4L2_INPUT_TYPE_TUNER</constant>. The288<constant>VIDEO_VC_AUDIO</constant> flag was replaced by the289<structfield>audioset</structfield> field. V4L2 considers devices with290up to 32 audio inputs. Each set bit in the291<structfield>audioset</structfield> field represents one audio input292this video input combines with. For information about audio inputs and293how to switch between them see <xref linkend="audio" />.</para>294295<para>The <structfield>norm</structfield> field describing the296supported video standards was replaced by297<structfield>std</structfield>. The V4L specification mentions a flag298<constant>VIDEO_VC_NORM</constant> indicating whether the standard can299be changed. This flag was a later addition together with the300<structfield>norm</structfield> field and has been removed in the301meantime. V4L2 has a similar, albeit more comprehensive approach302to video standards, see <xref linkend="standard" /> for more303information.</para>304</section>305306<section>307<title>Tuning</title>308309<para>The V4L <constant>VIDIOCGTUNER</constant> and310<constant>VIDIOCSTUNER</constant> ioctl and struct311<structname>video_tuner</structname> can be used to enumerate the312tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are313&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are314covered in <xref linkend="tuner" />.</para>315316<para>The <structfield>tuner</structfield> field counting tuners317was renamed to <structfield>index</structfield>. The fields318<structfield>name</structfield>, <structfield>rangelow</structfield>319and <structfield>rangehigh</structfield> remained unchanged.</para>320321<para>The <constant>VIDEO_TUNER_PAL</constant>,322<constant>VIDEO_TUNER_NTSC</constant> and323<constant>VIDEO_TUNER_SECAM</constant> flags indicating the supported324video standards were dropped. This information is now contained in the325associated &v4l2-input;. No replacement exists for the326<constant>VIDEO_TUNER_NORM</constant> flag indicating whether the327video standard can be switched. The <structfield>mode</structfield>328field to select a different video standard was replaced by a whole new329set of ioctls and structures described in <xref linkend="standard" />.330Due to its ubiquity it should be mentioned the BTTV driver supports331several standards in addition to the regular332<constant>VIDEO_MODE_PAL</constant> (0),333<constant>VIDEO_MODE_NTSC</constant>,334<constant>VIDEO_MODE_SECAM</constant> and335<constant>VIDEO_MODE_AUTO</constant> (3). Namely N/PAL Argentina,336M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic).</para>337338<para>The <constant>VIDEO_TUNER_STEREO_ON</constant> flag339indicating stereo reception became340<constant>V4L2_TUNER_SUB_STEREO</constant> in field341<structfield>rxsubchans</structfield>. This field also permits the342detection of monaural and bilingual audio, see the definition of343&v4l2-tuner; for details. Presently no replacement exists for the344<constant>VIDEO_TUNER_RDS_ON</constant> and345<constant>VIDEO_TUNER_MBS_ON</constant> flags.</para>346347<para> The <constant>VIDEO_TUNER_LOW</constant> flag was renamed348to <constant>V4L2_TUNER_CAP_LOW</constant> in the &v4l2-tuner;349<structfield>capability</structfield> field.</para>350351<para>The <constant>VIDIOCGFREQ</constant> and352<constant>VIDIOCSFREQ</constant> ioctl to change the tuner frequency353where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They354take a pointer to a &v4l2-frequency; instead of an unsigned long355integer.</para>356</section>357358<section id="v4l-image-properties">359<title>Image Properties</title>360361<para>V4L2 has no equivalent of the362<constant>VIDIOCGPICT</constant> and <constant>VIDIOCSPICT</constant>363ioctl and struct <structname>video_picture</structname>. The following364fields where replaced by V4L2 controls accessible with the365&VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls:<informaltable>366<tgroup cols="2">367<thead>368<row>369<entry>struct <structname>video_picture</structname></entry>370<entry>V4L2 Control ID</entry>371</row>372</thead>373<tbody valign="top">374<row>375<entry><structfield>brightness</structfield></entry>376<entry><constant>V4L2_CID_BRIGHTNESS</constant></entry>377</row>378<row>379<entry><structfield>hue</structfield></entry>380<entry><constant>V4L2_CID_HUE</constant></entry>381</row>382<row>383<entry><structfield>colour</structfield></entry>384<entry><constant>V4L2_CID_SATURATION</constant></entry>385</row>386<row>387<entry><structfield>contrast</structfield></entry>388<entry><constant>V4L2_CID_CONTRAST</constant></entry>389</row>390<row>391<entry><structfield>whiteness</structfield></entry>392<entry><constant>V4L2_CID_WHITENESS</constant></entry>393</row>394</tbody>395</tgroup>396</informaltable></para>397398<para>The V4L picture controls are assumed to range from 0 to39965535 with no particular reset value. The V4L2 API permits arbitrary400limits and defaults which can be queried with the &VIDIOC-QUERYCTRL;401ioctl. For general information about controls see <xref402linkend="control" />.</para>403404<para>The <structfield>depth</structfield> (average number of405bits per pixel) of a video image is implied by the selected image406format. V4L2 does not explicitely provide such information assuming407applications recognizing the format are aware of the image depth and408others need not know. The <structfield>palette</structfield> field409moved into the &v4l2-pix-format;:<informaltable>410<tgroup cols="2">411<thead>412<row>413<entry>struct <structname>video_picture</structname>414<structfield>palette</structfield></entry>415<entry>&v4l2-pix-format;416<structfield>pixfmt</structfield></entry>417</row>418</thead>419<tbody valign="top">420<row>421<entry><constant>VIDEO_PALETTE_GREY</constant></entry>422<entry><para><link423linkend="V4L2-PIX-FMT-GREY"><constant>V4L2_PIX_FMT_GREY</constant></link></para></entry>424</row>425<row>426<entry><constant>VIDEO_PALETTE_HI240</constant></entry>427<entry><para><link428linkend="pixfmt-reserved"><constant>V4L2_PIX_FMT_HI240</constant></link><footnote>429<para>This is a custom format used by the BTTV430driver, not one of the V4L2 standard formats.</para>431</footnote></para></entry>432</row>433<row>434<entry><constant>VIDEO_PALETTE_RGB565</constant></entry>435<entry><para><link436linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB565</constant></link></para></entry>437</row>438<row>439<entry><constant>VIDEO_PALETTE_RGB555</constant></entry>440<entry><para><link441linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_RGB555</constant></link></para></entry>442</row>443<row>444<entry><constant>VIDEO_PALETTE_RGB24</constant></entry>445<entry><para><link446linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR24</constant></link></para></entry>447</row>448<row>449<entry><constant>VIDEO_PALETTE_RGB32</constant></entry>450<entry><para><link451linkend="pixfmt-rgb"><constant>V4L2_PIX_FMT_BGR32</constant></link><footnote>452<para>Presumably all V4L RGB formats are453little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue454swapped variants. For details see <xref linkend="pixfmt-rgb" />.</para>455</footnote></para></entry>456</row>457<row>458<entry><constant>VIDEO_PALETTE_YUV422</constant></entry>459<entry><para><link460linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>461</row>462<row>463<entry><para><constant>VIDEO_PALETTE_YUYV</constant><footnote>464<para><constant>VIDEO_PALETTE_YUV422</constant>465and <constant>VIDEO_PALETTE_YUYV</constant> are the same formats. Some466V4L drivers respond to one, some to the other.</para>467</footnote></para></entry>468<entry><para><link469linkend="V4L2-PIX-FMT-YUYV"><constant>V4L2_PIX_FMT_YUYV</constant></link></para></entry>470</row>471<row>472<entry><constant>VIDEO_PALETTE_UYVY</constant></entry>473<entry><para><link474linkend="V4L2-PIX-FMT-UYVY"><constant>V4L2_PIX_FMT_UYVY</constant></link></para></entry>475</row>476<row>477<entry><constant>VIDEO_PALETTE_YUV420</constant></entry>478<entry>None</entry>479</row>480<row>481<entry><constant>VIDEO_PALETTE_YUV411</constant></entry>482<entry><para><link483linkend="V4L2-PIX-FMT-Y41P"><constant>V4L2_PIX_FMT_Y41P</constant></link><footnote>484<para>Not to be confused with485<constant>V4L2_PIX_FMT_YUV411P</constant>, which is a planar486format.</para> </footnote></para></entry>487</row>488<row>489<entry><constant>VIDEO_PALETTE_RAW</constant></entry>490<entry><para>None<footnote> <para>V4L explains this491as: "RAW capture (BT848)"</para> </footnote></para></entry>492</row>493<row>494<entry><constant>VIDEO_PALETTE_YUV422P</constant></entry>495<entry><para><link496linkend="V4L2-PIX-FMT-YUV422P"><constant>V4L2_PIX_FMT_YUV422P</constant></link></para></entry>497</row>498<row>499<entry><constant>VIDEO_PALETTE_YUV411P</constant></entry>500<entry><para><link501linkend="V4L2-PIX-FMT-YUV411P"><constant>V4L2_PIX_FMT_YUV411P</constant></link><footnote>502<para>Not to be confused with503<constant>V4L2_PIX_FMT_Y41P</constant>, which is a packed504format.</para> </footnote></para></entry>505</row>506<row>507<entry><constant>VIDEO_PALETTE_YUV420P</constant></entry>508<entry><para><link509linkend="V4L2-PIX-FMT-YVU420"><constant>V4L2_PIX_FMT_YVU420</constant></link></para></entry>510</row>511<row>512<entry><constant>VIDEO_PALETTE_YUV410P</constant></entry>513<entry><para><link514linkend="V4L2-PIX-FMT-YVU410"><constant>V4L2_PIX_FMT_YVU410</constant></link></para></entry>515</row>516</tbody>517</tgroup>518</informaltable></para>519520<para>V4L2 image formats are defined in <xref521linkend="pixfmt" />. The image format can be selected with the522&VIDIOC-S-FMT; ioctl.</para>523</section>524525<section>526<title>Audio</title>527528<para>The <constant>VIDIOCGAUDIO</constant> and529<constant>VIDIOCSAUDIO</constant> ioctl and struct530<structname>video_audio</structname> are used to enumerate the531audio inputs of a V4L device. The equivalent V4L2 ioctls are532&VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as533discussed in <xref linkend="audio" />.</para>534535<para>The <structfield>audio</structfield> "channel number"536field counting audio inputs was renamed to537<structfield>index</structfield>.</para>538539<para>On <constant>VIDIOCSAUDIO</constant> the540<structfield>mode</structfield> field selects <emphasis>one</emphasis>541of the <constant>VIDEO_SOUND_MONO</constant>,542<constant>VIDEO_SOUND_STEREO</constant>,543<constant>VIDEO_SOUND_LANG1</constant> or544<constant>VIDEO_SOUND_LANG2</constant> audio demodulation modes. When545the current audio standard is BTSC546<constant>VIDEO_SOUND_LANG2</constant> refers to SAP and547<constant>VIDEO_SOUND_LANG1</constant> is meaningless. Also548undocumented in the V4L specification, there is no way to query the549selected mode. On <constant>VIDIOCGAUDIO</constant> the driver returns550the <emphasis>actually received</emphasis> audio programmes in this551field. In the V4L2 API this information is stored in the &v4l2-tuner;552<structfield>rxsubchans</structfield> and553<structfield>audmode</structfield> fields, respectively. See <xref554linkend="tuner" /> for more information on tuners. Related to audio555modes &v4l2-audio; also reports if this is a mono or stereo556input, regardless if the source is a tuner.</para>557558<para>The following fields where replaced by V4L2 controls559accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and560&VIDIOC-S-CTRL; ioctls:<informaltable>561<tgroup cols="2">562<thead>563<row>564<entry>struct565<structname>video_audio</structname></entry>566<entry>V4L2 Control ID</entry>567</row>568</thead>569<tbody valign="top">570<row>571<entry><structfield>volume</structfield></entry>572<entry><constant>V4L2_CID_AUDIO_VOLUME</constant></entry>573</row>574<row>575<entry><structfield>bass</structfield></entry>576<entry><constant>V4L2_CID_AUDIO_BASS</constant></entry>577</row>578<row>579<entry><structfield>treble</structfield></entry>580<entry><constant>V4L2_CID_AUDIO_TREBLE</constant></entry>581</row>582<row>583<entry><structfield>balance</structfield></entry>584<entry><constant>V4L2_CID_AUDIO_BALANCE</constant></entry>585</row>586</tbody>587</tgroup>588</informaltable></para>589590<para>To determine which of these controls are supported by a591driver V4L provides the <structfield>flags</structfield>592<constant>VIDEO_AUDIO_VOLUME</constant>,593<constant>VIDEO_AUDIO_BASS</constant>,594<constant>VIDEO_AUDIO_TREBLE</constant> and595<constant>VIDEO_AUDIO_BALANCE</constant>. In the V4L2 API the596&VIDIOC-QUERYCTRL; ioctl reports if the respective control is597supported. Accordingly the <constant>VIDEO_AUDIO_MUTABLE</constant>598and <constant>VIDEO_AUDIO_MUTE</constant> flags where replaced by the599boolean <constant>V4L2_CID_AUDIO_MUTE</constant> control.</para>600601<para>All V4L2 controls have a <structfield>step</structfield>602attribute replacing the struct <structname>video_audio</structname>603<structfield>step</structfield> field. The V4L audio controls are604assumed to range from 0 to 65535 with no particular reset value. The605V4L2 API permits arbitrary limits and defaults which can be queried606with the &VIDIOC-QUERYCTRL; ioctl. For general information about607controls see <xref linkend="control" />.</para>608</section>609610<section>611<title>Frame Buffer Overlay</title>612613<para>The V4L2 ioctls equivalent to614<constant>VIDIOCGFBUF</constant> and <constant>VIDIOCSFBUF</constant>615are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The616<structfield>base</structfield> field of struct617<structname>video_buffer</structname> remained unchanged, except V4L2618defines a flag to indicate non-destructive overlays instead of a619<constant>NULL</constant> pointer. All other fields moved into the620&v4l2-pix-format; <structfield>fmt</structfield> substructure of621&v4l2-framebuffer;. The <structfield>depth</structfield> field was622replaced by <structfield>pixelformat</structfield>. See <xref623linkend="pixfmt-rgb" /> for a list of RGB formats and their624respective color depths.</para>625626<para>Instead of the special ioctls627<constant>VIDIOCGWIN</constant> and <constant>VIDIOCSWIN</constant>628V4L2 uses the general-purpose data format negotiation ioctls629&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a630&v4l2-format; as argument. Here the <structfield>win</structfield>631member of the <structfield>fmt</structfield> union is used, a632&v4l2-window;.</para>633634<para>The <structfield>x</structfield>,635<structfield>y</structfield>, <structfield>width</structfield> and636<structfield>height</structfield> fields of struct637<structname>video_window</structname> moved into &v4l2-rect;638substructure <structfield>w</structfield> of struct639<structname>v4l2_window</structname>. The640<structfield>chromakey</structfield>,641<structfield>clips</structfield>, and642<structfield>clipcount</structfield> fields remained unchanged. Struct643<structname>video_clip</structname> was renamed to &v4l2-clip;, also644containing a struct <structname>v4l2_rect</structname>, but the645semantics are still the same.</para>646647<para>The <constant>VIDEO_WINDOW_INTERLACE</constant> flag was648dropped. Instead applications must set the649<structfield>field</structfield> field to650<constant>V4L2_FIELD_ANY</constant> or651<constant>V4L2_FIELD_INTERLACED</constant>. The652<constant>VIDEO_WINDOW_CHROMAKEY</constant> flag moved into653&v4l2-framebuffer;, under the new name654<constant>V4L2_FBUF_FLAG_CHROMAKEY</constant>.</para>655656<para>In V4L, storing a bitmap pointer in657<structfield>clips</structfield> and setting658<structfield>clipcount</structfield> to659<constant>VIDEO_CLIP_BITMAP</constant> (-1) requests bitmap660clipping, using a fixed size bitmap of 1024 × 625 bits. Struct661<structname>v4l2_window</structname> has a separate662<structfield>bitmap</structfield> pointer field for this purpose and663the bitmap size is determined by <structfield>w.width</structfield> and664<structfield>w.height</structfield>.</para>665666<para>The <constant>VIDIOCCAPTURE</constant> ioctl to enable or667disable overlay was renamed to &VIDIOC-OVERLAY;.</para>668</section>669670<section>671<title>Cropping</title>672673<para>To capture only a subsection of the full picture V4L674defines the <constant>VIDIOCGCAPTURE</constant> and675<constant>VIDIOCSCAPTURE</constant> ioctls using struct676<structname>video_capture</structname>. The equivalent V4L2 ioctls are677&VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related678&VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see679<xref linkend="crop" /> for details.</para>680681<para>The <structfield>x</structfield>,682<structfield>y</structfield>, <structfield>width</structfield> and683<structfield>height</structfield> fields moved into &v4l2-rect;684substructure <structfield>c</structfield> of struct685<structname>v4l2_crop</structname>. The686<structfield>decimation</structfield> field was dropped. In the V4L2687API the scaling factor is implied by the size of the cropping688rectangle and the size of the captured or overlaid image.</para>689690<para>The <constant>VIDEO_CAPTURE_ODD</constant>691and <constant>VIDEO_CAPTURE_EVEN</constant> flags to capture only the692odd or even field, respectively, were replaced by693<constant>V4L2_FIELD_TOP</constant> and694<constant>V4L2_FIELD_BOTTOM</constant> in the field named695<structfield>field</structfield> of &v4l2-pix-format; and696&v4l2-window;. These structures are used to select a capture or697overlay format with the &VIDIOC-S-FMT; ioctl.</para>698</section>699700<section>701<title>Reading Images, Memory Mapping</title>702703<section>704<title>Capturing using the read method</title>705706<para>There is no essential difference between reading images707from a V4L or V4L2 device using the &func-read; function, however V4L2708drivers are not required to support this I/O method. Applications can709determine if the function is available with the &VIDIOC-QUERYCAP;710ioctl. All V4L2 devices exchanging data with applications must support711the &func-select; and &func-poll; functions.</para>712713<para>To select an image format and size, V4L provides the714<constant>VIDIOCSPICT</constant> and <constant>VIDIOCSWIN</constant>715ioctls. V4L2 uses the general-purpose data format negotiation ioctls716&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a717&v4l2-format; as argument, here the &v4l2-pix-format; named718<structfield>pix</structfield> of its <structfield>fmt</structfield>719union is used.</para>720721<para>For more information about the V4L2 read interface see722<xref linkend="rw" />.</para>723</section>724<section>725<title>Capturing using memory mapping</title>726727<para>Applications can read from V4L devices by mapping728buffers in device memory, or more often just buffers allocated in729DMA-able system memory, into their address space. This avoids the data730copying overhead of the read method. V4L2 supports memory mapping as731well, with a few differences.</para>732733<informaltable>734<tgroup cols="2">735<thead>736<row>737<entry>V4L</entry>738<entry>V4L2</entry>739</row>740</thead>741<tbody valign="top">742<row>743<entry></entry>744<entry>The image format must be selected before745buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format746is selected the driver may use the last, possibly by another747application requested format.</entry>748</row>749<row>750<entry><para>Applications cannot change the number of751buffers. The it is built into the driver, unless it has a module752option to change the number when the driver module is753loaded.</para></entry>754<entry><para>The &VIDIOC-REQBUFS; ioctl allocates the755desired number of buffers, this is a required step in the initialization756sequence.</para></entry>757</row>758<row>759<entry><para>Drivers map all buffers as one contiguous760range of memory. The <constant>VIDIOCGMBUF</constant> ioctl is761available to query the number of buffers, the offset of each buffer762from the start of the virtual file, and the overall amount of memory763used, which can be used as arguments for the &func-mmap;764function.</para></entry>765<entry><para>Buffers are individually mapped. The766offset and size of each buffer can be determined with the767&VIDIOC-QUERYBUF; ioctl.</para></entry>768</row>769<row>770<entry><para>The <constant>VIDIOCMCAPTURE</constant>771ioctl prepares a buffer for capturing. It also determines the image772format for this buffer. The ioctl returns immediately, eventually with773an &EAGAIN; if no video signal had been detected. When the driver774supports more than one buffer applications can call the ioctl multiple775times and thus have multiple outstanding capture776requests.</para><para>The <constant>VIDIOCSYNC</constant> ioctl777suspends execution until a particular buffer has been778filled.</para></entry>779<entry><para>Drivers maintain an incoming and outgoing780queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming781queue. Filled buffers are dequeued from the outgoing queue with the782&VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this783function, &func-select; or &func-poll; can be used. The784&VIDIOC-STREAMON; ioctl must be called once after enqueuing one or785more buffers to start capturing. Its counterpart786&VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both787queues. Applications can query the signal status, if known, with the788&VIDIOC-ENUMINPUT; ioctl.</para></entry>789</row>790</tbody>791</tgroup>792</informaltable>793794<para>For a more in-depth discussion of memory mapping and795examples, see <xref linkend="mmap" />.</para>796</section>797</section>798799<section>800<title>Reading Raw VBI Data</title>801802<para>Originally the V4L API did not specify a raw VBI capture803interface, only the device file <filename>/dev/vbi</filename> was804reserved for this purpose. The only driver supporting this interface805was the BTTV driver, de-facto defining the V4L VBI interface. Reading806from the device yields a raw VBI image with the following807parameters:<informaltable>808<tgroup cols="2">809<thead>810<row>811<entry>&v4l2-vbi-format;</entry>812<entry>V4L, BTTV driver</entry>813</row>814</thead>815<tbody valign="top">816<row>817<entry>sampling_rate</entry>818<entry>28636363 Hz NTSC (or any other 525-line819standard); 35468950 Hz PAL and SECAM (625-line standards)</entry>820</row>821<row>822<entry>offset</entry>823<entry>?</entry>824</row>825<row>826<entry>samples_per_line</entry>827<entry>2048</entry>828</row>829<row>830<entry>sample_format</entry>831<entry>V4L2_PIX_FMT_GREY. The last four bytes (a832machine endianess integer) contain a frame counter.</entry>833</row>834<row>835<entry>start[]</entry>836<entry>10, 273 NTSC; 22, 335 PAL and SECAM</entry>837</row>838<row>839<entry>count[]</entry>840<entry><para>16, 16<footnote><para>Old driver841versions used different values, eventually the custom842<constant>BTTV_VBISIZE</constant> ioctl was added to query the843correct values.</para></footnote></para></entry>844</row>845<row>846<entry>flags</entry>847<entry>0</entry>848</row>849</tbody>850</tgroup>851</informaltable></para>852853<para>Undocumented in the V4L specification, in Linux 2.3 the854<constant>VIDIOCGVBIFMT</constant> and855<constant>VIDIOCSVBIFMT</constant> ioctls using struct856<structname>vbi_format</structname> were added to determine the VBI857image parameters. These ioctls are only partially compatible with the858V4L2 VBI interface specified in <xref linkend="raw-vbi" />.</para>859860<para>An <structfield>offset</structfield> field does not861exist, <structfield>sample_format</structfield> is supposed to be862<constant>VIDEO_PALETTE_RAW</constant>, equivalent to863<constant>V4L2_PIX_FMT_GREY</constant>. The remaining fields are864probably equivalent to &v4l2-vbi-format;.</para>865866<para>Apparently only the Zoran (ZR 36120) driver implements867these ioctls. The semantics differ from those specified for V4L2 in two868ways. The parameters are reset on &func-open; and869<constant>VIDIOCSVBIFMT</constant> always returns an &EINVAL; if the870parameters are invalid.</para>871</section>872873<section>874<title>Miscellaneous</title>875876<para>V4L2 has no equivalent of the877<constant>VIDIOCGUNIT</constant> ioctl. Applications can find the VBI878device associated with a video capture device (or vice versa) by879reopening the device and requesting VBI data. For details see880<xref linkend="open" />.</para>881882<para>No replacement exists for <constant>VIDIOCKEY</constant>,883and the V4L functions for microcode programming. A new interface for884MPEG compression and playback devices is documented in <xref885linkend="extended-controls" />.</para>886</section>887888</section>889890<section id="hist-v4l2">891<title>Changes of the V4L2 API</title>892893<para>Soon after the V4L API was added to the kernel it was894criticised as too inflexible. In August 1998 Bill Dirks proposed a895number of improvements and began to work on documentation, example896drivers and applications. With the help of other volunteers this897eventually became the V4L2 API, not just an extension but a898replacement for the V4L API. However it took another four years and899two stable kernel releases until the new API was finally accepted for900inclusion into the kernel in its present form.</para>901902<section>903<title>Early Versions</title>904<para>1998-08-20: First version.</para>905906<para>1998-08-27: The &func-select; function was introduced.</para>907908<para>1998-09-10: New video standard interface.</para>909910<para>1998-09-18: The <constant>VIDIOC_NONCAP</constant> ioctl911was replaced by the otherwise meaningless <constant>O_TRUNC</constant>912&func-open; flag, and the aliases <constant>O_NONCAP</constant> and913<constant>O_NOIO</constant> were defined. Applications can set this914flag if they intend to access controls only, as opposed to capture915applications which need exclusive access. The916<constant>VIDEO_STD_XXX</constant> identifiers are now ordinals917instead of flags, and the <function>video_std_construct()</function>918helper function takes id and transmission arguments.</para>919920<para>1998-09-28: Revamped video standard. Made video controls921individually enumerable.</para>922923<para>1998-10-02: The <structfield>id</structfield> field was924removed from struct <structname>video_standard</structname> and the925color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was926renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A927first draft of the Codec API was released.</para>928929<para>1998-11-08: Many minor changes. Most symbols have been930renamed. Some material changes to &v4l2-capability;.</para>931932<para>1998-11-12: The read/write directon of some ioctls was misdefined.</para>933934<para>1998-11-14: <constant>V4L2_PIX_FMT_RGB24</constant>935changed to <constant>V4L2_PIX_FMT_BGR24</constant>, and936<constant>V4L2_PIX_FMT_RGB32</constant> changed to937<constant>V4L2_PIX_FMT_BGR32</constant>. Audio controls are now938accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under939names starting with <constant>V4L2_CID_AUDIO</constant>. The940<constant>V4L2_MAJOR</constant> define was removed from941<filename>videodev.h</filename> since it was only used once in the942<filename>videodev</filename> kernel module. The943<constant>YUV422</constant> and <constant>YUV411</constant> planar944image formats were added.</para>945946<para>1998-11-28: A few ioctl symbols changed. Interfaces for codecs and947video output devices were added.</para>948949<para>1999-01-14: A raw VBI capture interface was added.</para>950951<para>1999-01-19: The <constant>VIDIOC_NEXTBUF</constant> ioctl952was removed.</para>953</section>954955<section>956<title>V4L2 Version 0.16 1999-01-31</title>957<para>1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF958are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added959digital zoom (cropping) controls.</para>960</section>961962<!-- Where's 0.17? mhs couldn't find that videodev.h, perhaps Bill963forgot to bump the version number or never released it. -->964965<section>966<title>V4L2 Version 0.18 1999-03-16</title>967<para>Added a v4l to V4L2 ioctl compatibility layer to968videodev.c. Driver writers, this changes how you implement your ioctl969handler. See the Driver Writer's Guide. Added some more control id970codes.</para>971</section>972973<section>974<title>V4L2 Version 0.19 1999-06-05</title>975<para>1999-03-18: Fill in the category and catname fields of976v4l2_queryctrl objects before passing them to the driver. Required a977minor change to the VIDIOC_QUERYCTRL handlers in the sample978drivers.</para>979<para>1999-03-31: Better compatibility for v4l memory capture980ioctls. Requires changes to drivers to fully support new compatibility981features, see Driver Writer's Guide and v4l2cap.c. Added new control982IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P,983and _YUV411P to _YUV411P.</para>984<para>1999-04-04: Added a few more control IDs.</para>985<para>1999-04-07: Added the button control type.</para>986<para>1999-05-02: Fixed a typo in videodev.h, and added the987V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag.</para>988<para>1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing989a malfunction of this ioctl.</para>990<para>1999-06-05: Changed the value of991V4L2_CID_WHITENESS.</para>992</section>993994<section>995<title>V4L2 Version 0.20 (1999-09-10)</title>996997<para>Version 0.20 introduced a number of changes which were998<emphasis>not backward compatible</emphasis> with 0.19 and earlier999versions. Purpose of these changes was to simplify the API, while1000making it more extensible and following common Linux driver API1001conventions.</para>10021003<orderedlist>1004<listitem>1005<para>Some typos in <constant>V4L2_FMT_FLAG</constant>1006symbols were fixed. &v4l2-clip; was changed for compatibility with1007v4l. (1999-08-30)</para>1008</listitem>10091010<listitem>1011<para><constant>V4L2_TUNER_SUB_LANG1</constant> was added.1012(1999-09-05)</para>1013</listitem>10141015<listitem>1016<para>All ioctl() commands that used an integer argument now1017take a pointer to an integer. Where it makes sense, ioctls will return1018the actual new value in the integer pointed to by the argument, a1019common convention in the V4L2 API. The affected ioctls are:1020VIDIOC_PREVIEW, VIDIOC_STREAMON, VIDIOC_STREAMOFF, VIDIOC_S_FREQ,1021VIDIOC_S_INPUT, VIDIOC_S_OUTPUT, VIDIOC_S_EFFECT. For example1022<programlisting>1023err = ioctl (fd, VIDIOC_XXX, V4L2_XXX);1024</programlisting> becomes <programlisting>1025int a = V4L2_XXX; err = ioctl(fd, VIDIOC_XXX, &a);1026</programlisting>1027</para>1028</listitem>10291030<listitem>1031<para>All the different get- and set-format commands were1032swept into one &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctl taking a union1033and a type field selecting the union member as parameter. Purpose is to1034simplify the API by eliminating several ioctls and to allow new and1035driver private data streams without adding new ioctls.</para>10361037<para>This change obsoletes the following ioctls:1038<constant>VIDIOC_S_INFMT</constant>,1039<constant>VIDIOC_G_INFMT</constant>,1040<constant>VIDIOC_S_OUTFMT</constant>,1041<constant>VIDIOC_G_OUTFMT</constant>,1042<constant>VIDIOC_S_VBIFMT</constant> and1043<constant>VIDIOC_G_VBIFMT</constant>. The image format structure1044<structname>v4l2_format</structname> was renamed to &v4l2-pix-format;,1045while &v4l2-format; is now the envelopping structure for all format1046negotiations.</para>1047</listitem>10481049<listitem>1050<para>Similar to the changes above, the1051<constant>VIDIOC_G_PARM</constant> and1052<constant>VIDIOC_S_PARM</constant> ioctls were merged with1053<constant>VIDIOC_G_OUTPARM</constant> and1054<constant>VIDIOC_S_OUTPARM</constant>. A1055<structfield>type</structfield> field in the new &v4l2-streamparm;1056selects the respective union member.</para>10571058<para>This change obsoletes the1059<constant>VIDIOC_G_OUTPARM</constant> and1060<constant>VIDIOC_S_OUTPARM</constant> ioctls.</para>1061</listitem>10621063<listitem>1064<para>Control enumeration was simplified, and two new1065control flags were introduced and one dropped. The1066<structfield>catname</structfield> field was replaced by a1067<structfield>group</structfield> field.</para>10681069<para>Drivers can now flag unsupported and temporarily1070unavailable controls with <constant>V4L2_CTRL_FLAG_DISABLED</constant>1071and <constant>V4L2_CTRL_FLAG_GRABBED</constant> respectively. The1072<structfield>group</structfield> name indicates a possibly narrower1073classification than the <structfield>category</structfield>. In other1074words, there may be multiple groups within a category. Controls within1075a group would typically be drawn within a group box. Controls in1076different categories might have a greater separation, or may even1077appear in separate windows.</para>1078</listitem>10791080<listitem>1081<para>The &v4l2-buffer; <structfield>timestamp</structfield>1082was changed to a 64 bit integer, containing the sampling or output1083time of the frame in nanoseconds. Additionally timestamps will be in1084absolute system time, not starting from zero at the beginning of a1085stream. The data type name for timestamps is stamp_t, defined as a1086signed 64-bit integer. Output devices should not send a buffer out1087until the time in the timestamp field has arrived. I would like to1088follow SGI's lead, and adopt a multimedia timestamping system like1089their UST (Unadjusted System Time). See1090http://web.archive.org/web/*/http://reality.sgi.com1091/cpirazzi_engr/lg/time/intro.html.1092UST uses timestamps that are 64-bit signed integers1093(not struct timeval's) and given in nanosecond units. The UST clock1094starts at zero when the system is booted and runs continuously and1095uniformly. It takes a little over 292 years for UST to overflow. There1096is no way to set the UST clock. The regular Linux time-of-day clock1097can be changed periodically, which would cause errors if it were being1098used for timestamping a multimedia stream. A real UST style clock will1099require some support in the kernel that is not there yet. But in1100anticipation, I will change the timestamp field to a 64-bit integer,1101and I will change the v4l2_masterclock_gettime() function (used only1102by drivers) to return a 64-bit integer.</para>1103</listitem>11041105<listitem>1106<para>A <structfield>sequence</structfield> field was added1107to &v4l2-buffer;. The <structfield>sequence</structfield> field counts1108captured frames, it is ignored by output devices. When a capture1109driver drops a frame, the sequence number of that frame is1110skipped.</para>1111</listitem>1112</orderedlist>1113</section>11141115<section>1116<title>V4L2 Version 0.20 incremental changes</title>1117<!-- Version number didn't change anymore, reason unknown. -->11181119<para>1999-12-23: In &v4l2-vbi-format; the1120<structfield>reserved1</structfield> field became1121<structfield>offset</structfield>. Previously drivers were required to1122clear the <structfield>reserved1</structfield> field.</para>11231124<para>2000-01-13: The1125<constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant> flag was added.</para>11261127<para>2000-07-31: The <filename>linux/poll.h</filename> header1128is now included by <filename>videodev.h</filename> for compatibility1129with the original <filename>videodev.h</filename> file.</para>11301131<para>2000-11-20: <constant>V4L2_TYPE_VBI_OUTPUT</constant> and1132<constant>V4L2_PIX_FMT_Y41P</constant> were added.</para>11331134<para>2000-11-25: <constant>V4L2_TYPE_VBI_INPUT</constant> was1135added.</para>11361137<para>2000-12-04: A couple typos in symbol names were fixed.</para>11381139<para>2001-01-18: To avoid namespace conflicts the1140<constant>fourcc</constant> macro defined in the1141<filename>videodev.h</filename> header file was renamed to1142<constant>v4l2_fourcc</constant>.</para>11431144<para>2001-01-25: A possible driver-level compatibility problem1145between the <filename>videodev.h</filename> file in Linux 2.4.0 and1146the <filename>videodev.h</filename> file included in the1147<filename>videodevX</filename> patch was fixed. Users of an earlier1148version of <filename>videodevX</filename> on Linux 2.4.0 should1149recompile their V4L and V4L2 drivers.</para>11501151<para>2001-01-26: A possible kernel-level incompatibility1152between the <filename>videodev.h</filename> file in the1153<filename>videodevX</filename> patch and the1154<filename>videodev.h</filename> file in Linux 2.2.x with devfs patches1155applied was fixed.</para>11561157<para>2001-03-02: Certain V4L ioctls which pass data in both1158direction although they are defined with read-only parameter, did not1159work correctly through the backward compatibility layer.1160[Solution?]</para>11611162<para>2001-04-13: Big endian 16-bit RGB formats were added.</para>11631164<para>2001-09-17: New YUV formats and the &VIDIOC-G-FREQUENCY; and1165&VIDIOC-S-FREQUENCY; ioctls were added. (The old1166<constant>VIDIOC_G_FREQ</constant> and1167<constant>VIDIOC_S_FREQ</constant> ioctls did not take multiple tuners1168into account.)</para>11691170<para>2000-09-18: <constant>V4L2_BUF_TYPE_VBI</constant> was1171added. This may <emphasis>break compatibility</emphasis> as the1172&VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls may fail now if the struct1173<structname>v4l2_fmt</structname> <structfield>type</structfield>1174field does not contain <constant>V4L2_BUF_TYPE_VBI</constant>. In the1175documentation of the &v4l2-vbi-format;1176<structfield>offset</structfield> field the ambiguous phrase "rising1177edge" was changed to "leading edge".</para>1178</section>11791180<section>1181<title>V4L2 Version 0.20 2000-11-23</title>11821183<para>A number of changes were made to the raw VBI1184interface.</para>11851186<orderedlist>1187<listitem>1188<para>Figures clarifying the line numbering scheme were1189added to the V4L2 API specification. The1190<structfield>start</structfield>[0] and1191<structfield>start</structfield>[1] fields no longer count line1192numbers beginning at zero. Rationale: a) The previous definition was1193unclear. b) The <structfield>start</structfield>[] values are ordinal1194numbers. c) There is no point in inventing a new line numbering1195scheme. We now use line number as defined by ITU-R, period.1196Compatibility: Add one to the start values. Applications depending on1197the previous semantics may not function correctly.</para>1198</listitem>11991200<listitem>1201<para>The restriction "count[0] > 0 and count[1] > 0"1202has been relaxed to "(count[0] + count[1]) > 0". Rationale:1203Drivers may allocate resources at scan line granularity and some data1204services are transmitted only on the first field. The comment that1205both <structfield>count</structfield> values will usually be equal is1206misleading and pointless and has been removed. This change1207<emphasis>breaks compatibility</emphasis> with earlier versions:1208Drivers may return EINVAL, applications may not function1209correctly.</para>1210</listitem>12111212<listitem>1213<para>Drivers are again permitted to return negative1214(unknown) start values as proposed earlier. Why this feature was1215dropped is unclear. This change may <emphasis>break1216compatibility</emphasis> with applications depending on the start1217values being positive. The use of <constant>EBUSY</constant> and1218<constant>EINVAL</constant> error codes with the &VIDIOC-S-FMT; ioctl1219was clarified. The &EBUSY; was finally documented, and the1220<structfield>reserved2</structfield> field which was previously1221mentioned only in the <filename>videodev.h</filename> header1222file.</para>1223</listitem>12241225<listitem>1226<para>New buffer types1227<constant>V4L2_TYPE_VBI_INPUT</constant> and1228<constant>V4L2_TYPE_VBI_OUTPUT</constant> were added. The former is an1229alias for the old <constant>V4L2_TYPE_VBI</constant>, the latter was1230missing in the <filename>videodev.h</filename> file.</para>1231</listitem>1232</orderedlist>1233</section>12341235<section>1236<title>V4L2 Version 0.20 2002-07-25</title>1237<para>Added sliced VBI interface proposal.</para>1238</section>12391240<section>1241<title>V4L2 in Linux 2.5.46, 2002-10</title>12421243<para>Around October-November 2002, prior to an announced1244feature freeze of Linux 2.5, the API was revised, drawing from1245experience with V4L2 0.20. This unnamed version was finally merged1246into Linux 2.5.46.</para>12471248<orderedlist>1249<listitem>1250<para>As specified in <xref linkend="related" />, drivers1251must make related device functions available under all minor device1252numbers.</para>1253</listitem>12541255<listitem>1256<para>The &func-open; function requires access mode1257<constant>O_RDWR</constant> regardless of the device type. All V4L21258drivers exchanging data with applications must support the1259<constant>O_NONBLOCK</constant> flag. The <constant>O_NOIO</constant>1260flag, a V4L2 symbol which aliased the meaningless1261<constant>O_TRUNC</constant> to indicate accesses without data1262exchange (panel applications) was dropped. Drivers must stay in "panel1263mode" until the application attempts to initiate a data exchange, see1264<xref linkend="open" />.</para>1265</listitem>12661267<listitem>1268<para>The &v4l2-capability; changed dramatically. Note that1269also the size of the structure changed, which is encoded in the ioctl1270request code, thus older V4L2 devices will respond with an &EINVAL; to1271the new &VIDIOC-QUERYCAP; ioctl.</para>12721273<para>There are new fields to identify the driver, a new RDS1274device function <constant>V4L2_CAP_RDS_CAPTURE</constant>, the1275<constant>V4L2_CAP_AUDIO</constant> flag indicates if the device has1276any audio connectors, another I/O capability1277<constant>V4L2_CAP_ASYNCIO</constant> can be flagged. In response to1278these changes the <structfield>type</structfield> field became a bit1279set and was merged into the <structfield>flags</structfield> field.1280<constant>V4L2_FLAG_TUNER</constant> was renamed to1281<constant>V4L2_CAP_TUNER</constant>,1282<constant>V4L2_CAP_VIDEO_OVERLAY</constant> replaced1283<constant>V4L2_FLAG_PREVIEW</constant> and1284<constant>V4L2_CAP_VBI_CAPTURE</constant> and1285<constant>V4L2_CAP_VBI_OUTPUT</constant> replaced1286<constant>V4L2_FLAG_DATA_SERVICE</constant>.1287<constant>V4L2_FLAG_READ</constant> and1288<constant>V4L2_FLAG_WRITE</constant> were merged into1289<constant>V4L2_CAP_READWRITE</constant>.</para>12901291<para>The redundant fields1292<structfield>inputs</structfield>, <structfield>outputs</structfield>1293and <structfield>audios</structfield> were removed. These properties1294can be determined as described in <xref linkend="video" /> and <xref1295linkend="audio" />.</para>12961297<para>The somewhat volatile and therefore barely useful1298fields <structfield>maxwidth</structfield>,1299<structfield>maxheight</structfield>,1300<structfield>minwidth</structfield>,1301<structfield>minheight</structfield>,1302<structfield>maxframerate</structfield> were removed. This information1303is available as described in <xref linkend="format" /> and1304<xref linkend="standard" />.</para>13051306<para><constant>V4L2_FLAG_SELECT</constant> was removed. We1307believe the select() function is important enough to require support1308of it in all V4L2 drivers exchanging data with applications. The1309redundant <constant>V4L2_FLAG_MONOCHROME</constant> flag was removed,1310this information is available as described in <xref1311linkend="format" />.</para>1312</listitem>13131314<listitem>1315<para>In &v4l2-input; the1316<structfield>assoc_audio</structfield> field and the1317<structfield>capability</structfield> field and its only flag1318<constant>V4L2_INPUT_CAP_AUDIO</constant> was replaced by the new1319<structfield>audioset</structfield> field. Instead of linking one1320video input to one audio input this field reports all audio inputs1321this video input combines with.</para>13221323<para>New fields are <structfield>tuner</structfield>1324(reversing the former link from tuners to video inputs),1325<structfield>std</structfield> and1326<structfield>status</structfield>.</para>13271328<para>Accordingly &v4l2-output; lost its1329<structfield>capability</structfield> and1330<structfield>assoc_audio</structfield> fields.1331<structfield>audioset</structfield>,1332<structfield>modulator</structfield> and1333<structfield>std</structfield> where added instead.</para>1334</listitem>13351336<listitem>1337<para>The &v4l2-audio; field1338<structfield>audio</structfield> was renamed to1339<structfield>index</structfield>, for consistency with other1340structures. A new capability flag1341<constant>V4L2_AUDCAP_STEREO</constant> was added to indicated if the1342audio input in question supports stereo sound.1343<constant>V4L2_AUDCAP_EFFECTS</constant> and the corresponding1344<constant>V4L2_AUDMODE</constant> flags where removed. This can be1345easily implemented using controls. (However the same applies to AVL1346which is still there.)</para>13471348<para>Again for consistency the &v4l2-audioout; field1349<structfield>audio</structfield> was renamed to1350<structfield>index</structfield>.</para>1351</listitem>13521353<listitem>1354<para>The &v4l2-tuner;1355<structfield>input</structfield> field was replaced by an1356<structfield>index</structfield> field, permitting devices with1357multiple tuners. The link between video inputs and tuners is now1358reversed, inputs point to their tuner. The1359<structfield>std</structfield> substructure became a1360simple set (more about this below) and moved into &v4l2-input;. A1361<structfield>type</structfield> field was added.</para>13621363<para>Accordingly in &v4l2-modulator; the1364<structfield>output</structfield> was replaced by an1365<structfield>index</structfield> field.</para>13661367<para>In &v4l2-frequency; the1368<structfield>port</structfield> field was replaced by a1369<structfield>tuner</structfield> field containing the respective tuner1370or modulator index number. A tuner <structfield>type</structfield>1371field was added and the <structfield>reserved</structfield> field1372became larger for future extensions (satellite tuners in1373particular).</para>1374</listitem>13751376<listitem>1377<para>The idea of completely transparent video standards was1378dropped. Experience showed that applications must be able to work with1379video standards beyond presenting the user a menu. Instead of1380enumerating supported standards with an ioctl applications can now1381refer to standards by &v4l2-std-id; and symbols defined in the1382<filename>videodev2.h</filename> header file. For details see <xref1383linkend="standard" />. The &VIDIOC-G-STD; and1384&VIDIOC-S-STD; now take a pointer to this type as argument.1385&VIDIOC-QUERYSTD; was added to autodetect the received standard, if1386the hardware has this capability. In &v4l2-standard; an1387<structfield>index</structfield> field was added for &VIDIOC-ENUMSTD;.1388A &v4l2-std-id; field named <structfield>id</structfield> was added as1389machine readable identifier, also replacing the1390<structfield>transmission</structfield> field. The misleading1391<structfield>framerate</structfield> field was renamed1392to <structfield>frameperiod</structfield>. The now obsolete1393<structfield>colorstandard</structfield> information, originally1394needed to distguish between variations of standards, were1395removed.</para>13961397<para>Struct <structname>v4l2_enumstd</structname> ceased to1398be. &VIDIOC-ENUMSTD; now takes a pointer to a &v4l2-standard;1399directly. The information which standards are supported by a1400particular video input or output moved into &v4l2-input; and1401&v4l2-output; fields named <structfield>std</structfield>,1402respectively.</para>1403</listitem>14041405<listitem>1406<para>The &v4l2-queryctrl; fields1407<structfield>category</structfield> and1408<structfield>group</structfield> did not catch on and/or were not1409implemented as expected and therefore removed.</para>1410</listitem>14111412<listitem>1413<para>The &VIDIOC-TRY-FMT; ioctl was added to negotiate data1414formats as with &VIDIOC-S-FMT;, but without the overhead of1415programming the hardware and regardless of I/O in progress.</para>14161417<para>In &v4l2-format; the <structfield>fmt</structfield>1418union was extended to contain &v4l2-window;. All image format1419negotiations are now possible with <constant>VIDIOC_G_FMT</constant>,1420<constant>VIDIOC_S_FMT</constant> and1421<constant>VIDIOC_TRY_FMT</constant>; ioctl. The1422<constant>VIDIOC_G_WIN</constant> and1423<constant>VIDIOC_S_WIN</constant> ioctls to prepare for a video1424overlay were removed. The <structfield>type</structfield> field1425changed to type &v4l2-buf-type; and the buffer type names changed as1426follows.<informaltable>1427<tgroup cols="2">1428<thead>1429<row>1430<entry>Old defines</entry>1431<entry>&v4l2-buf-type;</entry>1432</row>1433</thead>1434<tbody valign="top">1435<row>1436<entry><constant>V4L2_BUF_TYPE_CAPTURE</constant></entry>1437<entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry>1438</row>1439<row>1440<entry><constant>V4L2_BUF_TYPE_CODECIN</constant></entry>1441<entry>Omitted for now</entry>1442</row>1443<row>1444<entry><constant>V4L2_BUF_TYPE_CODECOUT</constant></entry>1445<entry>Omitted for now</entry>1446</row>1447<row>1448<entry><constant>V4L2_BUF_TYPE_EFFECTSIN</constant></entry>1449<entry>Omitted for now</entry>1450</row>1451<row>1452<entry><constant>V4L2_BUF_TYPE_EFFECTSIN2</constant></entry>1453<entry>Omitted for now</entry>1454</row>1455<row>1456<entry><constant>V4L2_BUF_TYPE_EFFECTSOUT</constant></entry>1457<entry>Omitted for now</entry>1458</row>1459<row>1460<entry><constant>V4L2_BUF_TYPE_VIDEOOUT</constant></entry>1461<entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry>1462</row>1463<row>1464<entry><constant>-</constant></entry>1465<entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry>1466</row>1467<row>1468<entry><constant>-</constant></entry>1469<entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry>1470</row>1471<row>1472<entry><constant>-</constant></entry>1473<entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry>1474</row>1475<row>1476<entry><constant>-</constant></entry>1477<entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry>1478</row>1479<row>1480<entry><constant>-</constant></entry>1481<entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry>1482</row>1483<row>1484<entry><constant>V4L2_BUF_TYPE_PRIVATE_BASE</constant></entry>1485<entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry>1486</row>1487</tbody>1488</tgroup>1489</informaltable></para>1490</listitem>14911492<listitem>1493<para>In &v4l2-fmtdesc; a &v4l2-buf-type; field named1494<structfield>type</structfield> was added as in &v4l2-format;. The1495<constant>VIDIOC_ENUM_FBUFFMT</constant> ioctl is no longer needed and1496was removed. These calls can be replaced by &VIDIOC-ENUM-FMT; with1497type <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>.</para>1498</listitem>14991500<listitem>1501<para>In &v4l2-pix-format; the1502<structfield>depth</structfield> field was removed, assuming1503applications which recognize the format by its four-character-code1504already know the color depth, and others do not care about it. The1505same rationale lead to the removal of the1506<constant>V4L2_FMT_FLAG_COMPRESSED</constant> flag. The1507<constant>V4L2_FMT_FLAG_SWCONVECOMPRESSED</constant> flag was removed1508because drivers are not supposed to convert images in kernel space. A1509user library of conversion functions should be provided instead. The1510<constant>V4L2_FMT_FLAG_BYTESPERLINE</constant> flag was redundant.1511Applications can set the <structfield>bytesperline</structfield> field1512to zero to get a reasonable default. Since the remaining flags were1513replaced as well, the <structfield>flags</structfield> field itself1514was removed.</para>1515<para>The interlace flags were replaced by a &v4l2-field;1516value in a newly added <structfield>field</structfield>1517field.<informaltable>1518<tgroup cols="2">1519<thead>1520<row>1521<entry>Old flag</entry>1522<entry>&v4l2-field;</entry>1523</row>1524</thead>1525<tbody valign="top">1526<row>1527<entry><constant>V4L2_FMT_FLAG_NOT_INTERLACED</constant></entry>1528<entry>?</entry>1529</row>1530<row>1531<entry><constant>V4L2_FMT_FLAG_INTERLACED</constant>1532= <constant>V4L2_FMT_FLAG_COMBINED</constant></entry>1533<entry><constant>V4L2_FIELD_INTERLACED</constant></entry>1534</row>1535<row>1536<entry><constant>V4L2_FMT_FLAG_TOPFIELD</constant>1537= <constant>V4L2_FMT_FLAG_ODDFIELD</constant></entry>1538<entry><constant>V4L2_FIELD_TOP</constant></entry>1539</row>1540<row>1541<entry><constant>V4L2_FMT_FLAG_BOTFIELD</constant>1542= <constant>V4L2_FMT_FLAG_EVENFIELD</constant></entry>1543<entry><constant>V4L2_FIELD_BOTTOM</constant></entry>1544</row>1545<row>1546<entry><constant>-</constant></entry>1547<entry><constant>V4L2_FIELD_SEQ_TB</constant></entry>1548</row>1549<row>1550<entry><constant>-</constant></entry>1551<entry><constant>V4L2_FIELD_SEQ_BT</constant></entry>1552</row>1553<row>1554<entry><constant>-</constant></entry>1555<entry><constant>V4L2_FIELD_ALTERNATE</constant></entry>1556</row>1557</tbody>1558</tgroup>1559</informaltable></para>15601561<para>The color space flags were replaced by a1562&v4l2-colorspace; value in a newly added1563<structfield>colorspace</structfield> field, where one of1564<constant>V4L2_COLORSPACE_SMPTE170M</constant>,1565<constant>V4L2_COLORSPACE_BT878</constant>,1566<constant>V4L2_COLORSPACE_470_SYSTEM_M</constant> or1567<constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant> replaces1568<constant>V4L2_FMT_CS_601YUV</constant>.</para>1569</listitem>15701571<listitem>1572<para>In &v4l2-requestbuffers; the1573<structfield>type</structfield> field was properly defined as1574&v4l2-buf-type;. Buffer types changed as mentioned above. A new1575<structfield>memory</structfield> field of type &v4l2-memory; was1576added to distinguish between I/O methods using buffers allocated1577by the driver or the application. See <xref linkend="io" /> for1578details.</para>1579</listitem>15801581<listitem>1582<para>In &v4l2-buffer; the <structfield>type</structfield>1583field was properly defined as &v4l2-buf-type;. Buffer types changed as1584mentioned above. A <structfield>field</structfield> field of type1585&v4l2-field; was added to indicate if a buffer contains a top or1586bottom field. The old field flags were removed. Since no unadjusted1587system time clock was added to the kernel as planned, the1588<structfield>timestamp</structfield> field changed back from type1589stamp_t, an unsigned 64 bit integer expressing the sample time in1590nanoseconds, to struct <structname>timeval</structname>. With the1591addition of a second memory mapping method the1592<structfield>offset</structfield> field moved into union1593<structfield>m</structfield>, and a new1594<structfield>memory</structfield> field of type &v4l2-memory; was1595added to distinguish between I/O methods. See <xref linkend="io" />1596for details.</para>15971598<para>The <constant>V4L2_BUF_REQ_CONTIG</constant>1599flag was used by the V4L compatibility layer, after changes to this1600code it was no longer needed. The1601<constant>V4L2_BUF_ATTR_DEVICEMEM</constant> flag would indicate if1602the buffer was indeed allocated in device memory rather than DMA-able1603system memory. It was barely useful and so was removed.</para>1604</listitem>16051606<listitem>1607<para>In &v4l2-framebuffer; the1608<structfield>base[3]</structfield> array anticipating double- and1609triple-buffering in off-screen video memory, however without defining1610a synchronization mechanism, was replaced by a single pointer. The1611<constant>V4L2_FBUF_CAP_SCALEUP</constant> and1612<constant>V4L2_FBUF_CAP_SCALEDOWN</constant> flags were removed.1613Applications can determine this capability more accurately using the1614new cropping and scaling interface. The1615<constant>V4L2_FBUF_CAP_CLIPPING</constant> flag was replaced by1616<constant>V4L2_FBUF_CAP_LIST_CLIPPING</constant> and1617<constant>V4L2_FBUF_CAP_BITMAP_CLIPPING</constant>.</para>1618</listitem>16191620<listitem>1621<para>In &v4l2-clip; the <structfield>x</structfield>,1622<structfield>y</structfield>, <structfield>width</structfield> and1623<structfield>height</structfield> field moved into a1624<structfield>c</structfield> substructure of type &v4l2-rect;. The1625<structfield>x</structfield> and <structfield>y</structfield> fields1626were renamed to <structfield>left</structfield> and1627<structfield>top</structfield>, &ie; offsets to a context dependent1628origin.</para>1629</listitem>16301631<listitem>1632<para>In &v4l2-window; the <structfield>x</structfield>,1633<structfield>y</structfield>, <structfield>width</structfield> and1634<structfield>height</structfield> field moved into a1635<structfield>w</structfield> substructure as above. A1636<structfield>field</structfield> field of type %v4l2-field; was added1637to distinguish between field and frame (interlaced) overlay.</para>1638</listitem>16391640<listitem>1641<para>The digital zoom interface, including struct1642<structname>v4l2_zoomcap</structname>, struct1643<structname>v4l2_zoom</structname>,1644<constant>V4L2_ZOOM_NONCAP</constant> and1645<constant>V4L2_ZOOM_WHILESTREAMING</constant> was replaced by a new1646cropping and scaling interface. The previously unused struct1647<structname>v4l2_cropcap</structname> and1648<structname>v4l2_crop</structname> where redefined for this purpose.1649See <xref linkend="crop" /> for details.</para>1650</listitem>16511652<listitem>1653<para>In &v4l2-vbi-format; the1654<structfield>SAMPLE_FORMAT</structfield> field now contains a1655four-character-code as used to identify video image formats and1656<constant>V4L2_PIX_FMT_GREY</constant> replaces the1657<constant>V4L2_VBI_SF_UBYTE</constant> define. The1658<structfield>reserved</structfield> field was extended.</para>1659</listitem>16601661<listitem>1662<para>In &v4l2-captureparm; the type of the1663<structfield>timeperframe</structfield> field changed from unsigned1664long to &v4l2-fract;. This allows the accurate expression of multiples1665of the NTSC-M frame rate 30000 / 1001. A new field1666<structfield>readbuffers</structfield> was added to control the driver1667behaviour in read I/O mode.</para>16681669<para>Similar changes were made to &v4l2-outputparm;.</para>1670</listitem>16711672<listitem>1673<para>The struct <structname>v4l2_performance</structname>1674and <constant>VIDIOC_G_PERF</constant> ioctl were dropped. Except when1675using the <link linkend="rw">read/write I/O method</link>, which is1676limited anyway, this information is already available to1677applications.</para>1678</listitem>16791680<listitem>1681<para>The example transformation from RGB to YCbCr color1682space in the old V4L2 documentation was inaccurate, this has been1683corrected in <xref linkend="pixfmt" />.<!-- 0.5670G should be16840.587, and 127/112 != 255/224 --></para>1685</listitem>1686</orderedlist>1687</section>16881689<section>1690<title>V4L2 2003-06-19</title>16911692<orderedlist>1693<listitem>1694<para>A new capability flag1695<constant>V4L2_CAP_RADIO</constant> was added for radio devices. Prior1696to this change radio devices would identify solely by having exactly one1697tuner whose type field reads <constant>V4L2_TUNER_RADIO</constant>.</para>1698</listitem>16991700<listitem>1701<para>An optional driver access priority mechanism was1702added, see <xref linkend="app-pri" /> for details.</para>1703</listitem>17041705<listitem>1706<para>The audio input and output interface was found to be1707incomplete.</para>1708<para>Previously the &VIDIOC-G-AUDIO;1709ioctl would enumerate the available audio inputs. An ioctl to1710determine the current audio input, if more than one combines with the1711current video input, did not exist. So1712<constant>VIDIOC_G_AUDIO</constant> was renamed to1713<constant>VIDIOC_G_AUDIO_OLD</constant>, this ioctl was removed on1714Kernel 2.6.39. The &VIDIOC-ENUMAUDIO; ioctl was added to enumerate1715audio inputs, while &VIDIOC-G-AUDIO; now reports the current audio1716input.</para>1717<para>The same changes were made to &VIDIOC-G-AUDOUT; and1718&VIDIOC-ENUMAUDOUT;.</para>1719<para>Until further the "videodev" module will automatically1720translate between the old and new ioctls, but drivers and applications1721must be updated to successfully compile again.</para>1722</listitem>17231724<listitem>1725<para>The &VIDIOC-OVERLAY; ioctl was incorrectly defined with1726write-read parameter. It was changed to write-only, while the write-read1727version was renamed to <constant>VIDIOC_OVERLAY_OLD</constant>. The old1728ioctl was removed on Kernel 2.6.39. Until further the "videodev"1729kernel module will automatically translate to the new version, so drivers1730must be recompiled, but not applications.</para>1731</listitem>17321733<listitem>1734<para><xref linkend="overlay" /> incorrectly stated that1735clipping rectangles define regions where the video can be seen.1736Correct is that clipping rectangles define regions where1737<emphasis>no</emphasis> video shall be displayed and so the graphics1738surface can be seen.</para>1739</listitem>17401741<listitem>1742<para>The &VIDIOC-S-PARM; and &VIDIOC-S-CTRL; ioctls were1743defined with write-only parameter, inconsistent with other ioctls1744modifying their argument. They were changed to write-read, while a1745<constant>_OLD</constant> suffix was added to the write-only versions.1746The old ioctls were removed on Kernel 2.6.39. Drivers and1747applications assuming a constant parameter need an update.</para>1748</listitem>1749</orderedlist>1750</section>17511752<section>1753<title>V4L2 2003-11-05</title>1754<orderedlist>1755<listitem>1756<para>In <xref linkend="pixfmt-rgb" /> the following pixel1757formats were incorrectly transferred from Bill Dirks' V4L21758specification. Descriptions below refer to bytes in memory, in1759ascending address order.<informaltable>1760<tgroup cols="3">1761<thead>1762<row>1763<entry>Symbol</entry>1764<entry>In this document prior to revision17650.5</entry>1766<entry>Corrected</entry>1767</row>1768</thead>1769<tbody valign="top">1770<row>1771<entry><constant>V4L2_PIX_FMT_RGB24</constant></entry>1772<entry>B, G, R</entry>1773<entry>R, G, B</entry>1774</row>1775<row>1776<entry><constant>V4L2_PIX_FMT_BGR24</constant></entry>1777<entry>R, G, B</entry>1778<entry>B, G, R</entry>1779</row>1780<row>1781<entry><constant>V4L2_PIX_FMT_RGB32</constant></entry>1782<entry>B, G, R, X</entry>1783<entry>R, G, B, X</entry>1784</row>1785<row>1786<entry><constant>V4L2_PIX_FMT_BGR32</constant></entry>1787<entry>R, G, B, X</entry>1788<entry>B, G, R, X</entry>1789</row>1790</tbody>1791</tgroup>1792</informaltable> The1793<constant>V4L2_PIX_FMT_BGR24</constant> example was always1794correct.</para>1795<para>In <xref linkend="v4l-image-properties" /> the mapping1796of the V4L <constant>VIDEO_PALETTE_RGB24</constant> and1797<constant>VIDEO_PALETTE_RGB32</constant> formats to V4L2 pixel formats1798was accordingly corrected.</para>1799</listitem>18001801<listitem>1802<para>Unrelated to the fixes above, drivers may still1803interpret some V4L2 RGB pixel formats differently. These issues have1804yet to be addressed, for details see <xref1805linkend="pixfmt-rgb" />.</para>1806</listitem>1807</orderedlist>1808</section>18091810<section>1811<title>V4L2 in Linux 2.6.6, 2004-05-09</title>1812<orderedlist>1813<listitem>1814<para>The &VIDIOC-CROPCAP; ioctl was incorrectly defined1815with read-only parameter. It is now defined as write-read ioctl, while1816the read-only version was renamed to1817<constant>VIDIOC_CROPCAP_OLD</constant>. The old ioctl was removed1818on Kernel 2.6.39.</para>1819</listitem>1820</orderedlist>1821</section>18221823<section>1824<title>V4L2 in Linux 2.6.8</title>1825<orderedlist>1826<listitem>1827<para>A new field <structfield>input</structfield> (former1828<structfield>reserved[0]</structfield>) was added to the &v4l2-buffer;1829structure. Purpose of this field is to alternate between video inputs1830(⪚ cameras) in step with the video capturing process. This function1831must be enabled with the new <constant>V4L2_BUF_FLAG_INPUT</constant>1832flag. The <structfield>flags</structfield> field is no longer1833read-only.</para>1834</listitem>1835</orderedlist>1836</section>18371838<section>1839<title>V4L2 spec erratum 2004-08-01</title>18401841<orderedlist>1842<listitem>1843<para>The return value of the1844<xref linkend="func-open" /> function was incorrectly documented.</para>1845</listitem>18461847<listitem>1848<para>Audio output ioctls end in -AUDOUT, not -AUDIOOUT.</para>1849</listitem>18501851<listitem>1852<para>In the Current Audio Input example the1853<constant>VIDIOC_G_AUDIO</constant> ioctl took the wrong1854argument.</para>1855</listitem>18561857<listitem>1858<para>The documentation of the &VIDIOC-QBUF; and1859&VIDIOC-DQBUF; ioctls did not mention the &v4l2-buffer;1860<structfield>memory</structfield> field. It was also missing from1861examples. Also on the <constant>VIDIOC_DQBUF</constant> page the &EIO;1862was not documented.</para>1863</listitem>1864</orderedlist>1865</section>18661867<section>1868<title>V4L2 in Linux 2.6.14</title>1869<orderedlist>1870<listitem>1871<para>A new sliced VBI interface was added. It is documented1872in <xref linkend="sliced" /> and replaces the interface first1873proposed in V4L2 specification 0.8.</para>1874</listitem>1875</orderedlist>1876</section>18771878<section>1879<title>V4L2 in Linux 2.6.15</title>1880<orderedlist>1881<listitem>1882<para>The &VIDIOC-LOG-STATUS; ioctl was added.</para>1883</listitem>18841885<listitem>1886<para>New video standards1887<constant>V4L2_STD_NTSC_443</constant>,1888<constant>V4L2_STD_SECAM_LC</constant>,1889<constant>V4L2_STD_SECAM_DK</constant> (a set of SECAM D, K and K1),1890and <constant>V4L2_STD_ATSC</constant> (a set of1891<constant>V4L2_STD_ATSC_8_VSB</constant> and1892<constant>V4L2_STD_ATSC_16_VSB</constant>) were defined. Note the1893<constant>V4L2_STD_525_60</constant> set now includes1894<constant>V4L2_STD_NTSC_443</constant>. See also <xref1895linkend="v4l2-std-id" />.</para>1896</listitem>18971898<listitem>1899<para>The <constant>VIDIOC_G_COMP</constant> and1900<constant>VIDIOC_S_COMP</constant> ioctl were renamed to1901<constant>VIDIOC_G_MPEGCOMP</constant> and1902<constant>VIDIOC_S_MPEGCOMP</constant> respectively. Their argument1903was replaced by a struct1904<structname>v4l2_mpeg_compression</structname> pointer. (The1905<constant>VIDIOC_G_MPEGCOMP</constant> and1906<constant>VIDIOC_S_MPEGCOMP</constant> ioctls where removed in Linux19072.6.25.)</para>1908</listitem>1909</orderedlist>1910</section>19111912<section>1913<title>V4L2 spec erratum 2005-11-27</title>1914<para>The capture example in <xref linkend="capture-example" />1915called the &VIDIOC-S-CROP; ioctl without checking if cropping is1916supported. In the video standard selection example in1917<xref linkend="standard" /> the &VIDIOC-S-STD; call used the wrong1918argument type.</para>1919</section>19201921<section>1922<title>V4L2 spec erratum 2006-01-10</title>1923<orderedlist>1924<listitem>1925<para>The <constant>V4L2_IN_ST_COLOR_KILL</constant> flag in1926&v4l2-input; not only indicates if the color killer is enabled, but1927also if it is active. (The color killer disables color decoding when1928it detects no color in the video signal to improve the image1929quality.)</para>1930</listitem>19311932<listitem>1933<para>&VIDIOC-S-PARM; is a write-read ioctl, not write-only as1934stated on its reference page. The ioctl changed in 2003 as noted above.</para>1935</listitem>1936</orderedlist>1937</section>19381939<section>1940<title>V4L2 spec erratum 2006-02-03</title>1941<orderedlist>1942<listitem>1943<para>In &v4l2-captureparm; and &v4l2-outputparm; the1944<structfield>timeperframe</structfield> field gives the time in1945seconds, not microseconds.</para>1946</listitem>1947</orderedlist>1948</section>19491950<section>1951<title>V4L2 spec erratum 2006-02-04</title>1952<orderedlist>1953<listitem>1954<para>The <structfield>clips</structfield> field in1955&v4l2-window; must point to an array of &v4l2-clip;, not a linked1956list, because drivers ignore the struct1957<structname>v4l2_clip</structname>.<structfield>next</structfield>1958pointer.</para>1959</listitem>1960</orderedlist>1961</section>19621963<section>1964<title>V4L2 in Linux 2.6.17</title>1965<orderedlist>1966<listitem>1967<para>New video standard macros were added:1968<constant>V4L2_STD_NTSC_M_KR</constant> (NTSC M South Korea), and the1969sets <constant>V4L2_STD_MN</constant>,1970<constant>V4L2_STD_B</constant>, <constant>V4L2_STD_GH</constant> and1971<constant>V4L2_STD_DK</constant>. The1972<constant>V4L2_STD_NTSC</constant> and1973<constant>V4L2_STD_SECAM</constant> sets now include1974<constant>V4L2_STD_NTSC_M_KR</constant> and1975<constant>V4L2_STD_SECAM_LC</constant> respectively.</para>1976</listitem>19771978<listitem>1979<para>A new <constant>V4L2_TUNER_MODE_LANG1_LANG2</constant>1980was defined to record both languages of a bilingual program. The1981use of <constant>V4L2_TUNER_MODE_STEREO</constant> for this purpose1982is deprecated now. See the &VIDIOC-G-TUNER; section for1983details.</para>1984</listitem>1985</orderedlist>1986</section>19871988<section>1989<title>V4L2 spec erratum 2006-09-23 (Draft 0.15)</title>1990<orderedlist>1991<listitem>1992<para>In various places1993<constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant> and1994<constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant> of the sliced VBI1995interface were not mentioned along with other buffer types.</para>1996</listitem>19971998<listitem>1999<para>In <xref linkend="vidioc-g-audio" /> it was clarified2000that the &v4l2-audio; <structfield>mode</structfield> field is a flags2001field.</para>2002</listitem>20032004<listitem>2005<para><xref linkend="vidioc-querycap" /> did not mention the2006sliced VBI and radio capability flags.</para>2007</listitem>20082009<listitem>2010<para>In <xref linkend="vidioc-g-frequency" /> it was2011clarified that applications must initialize the tuner2012<structfield>type</structfield> field of &v4l2-frequency; before2013calling &VIDIOC-S-FREQUENCY;.</para>2014</listitem>20152016<listitem>2017<para>The <structfield>reserved</structfield> array2018in &v4l2-requestbuffers; has 2 elements, not 32.</para>2019</listitem>20202021<listitem>2022<para>In <xref linkend="output" /> and <xref2023linkend="raw-vbi" /> the device file names2024<filename>/dev/vout</filename> which never caught on were replaced2025by <filename>/dev/video</filename>.</para>2026</listitem>20272028<listitem>2029<para>With Linux 2.6.15 the possible range for VBI device minor2030numbers was extended from 224-239 to 224-255. Accordingly device file names2031<filename>/dev/vbi0</filename> to <filename>/dev/vbi31</filename> are2032possible now.</para>2033</listitem>2034</orderedlist>2035</section>20362037<section>2038<title>V4L2 in Linux 2.6.18</title>2039<orderedlist>2040<listitem>2041<para>New ioctls &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS;2042and &VIDIOC-TRY-EXT-CTRLS; were added, a flag to skip unsupported2043controls with &VIDIOC-QUERYCTRL;, new control types2044<constant>V4L2_CTRL_TYPE_INTEGER64</constant> and2045<constant>V4L2_CTRL_TYPE_CTRL_CLASS</constant> (<xref2046linkend="v4l2-ctrl-type" />), and new control flags2047<constant>V4L2_CTRL_FLAG_READ_ONLY</constant>,2048<constant>V4L2_CTRL_FLAG_UPDATE</constant>,2049<constant>V4L2_CTRL_FLAG_INACTIVE</constant> and2050<constant>V4L2_CTRL_FLAG_SLIDER</constant> (<xref2051linkend="control-flags" />). See <xref2052linkend="extended-controls" /> for details.</para>2053</listitem>2054</orderedlist>2055</section>20562057<section>2058<title>V4L2 in Linux 2.6.19</title>2059<orderedlist>2060<listitem>2061<para>In &v4l2-sliced-vbi-cap; a buffer type field was added2062replacing a reserved field. Note on architectures where the size of2063enum types differs from int types the size of the structure changed.2064The &VIDIOC-G-SLICED-VBI-CAP; ioctl was redefined from being read-only2065to write-read. Applications must initialize the type field and clear2066the reserved fields now. These changes may <emphasis>break the2067compatibility</emphasis> with older drivers and applications.</para>2068</listitem>20692070<listitem>2071<para>The ioctls &VIDIOC-ENUM-FRAMESIZES; and2072&VIDIOC-ENUM-FRAMEINTERVALS; were added.</para>2073</listitem>20742075<listitem>2076<para>A new pixel format <constant>V4L2_PIX_FMT_RGB444</constant> (<xref2077linkend="rgb-formats" />) was added.</para>2078</listitem>2079</orderedlist>2080</section>20812082<section>2083<title>V4L2 spec erratum 2006-10-12 (Draft 0.17)</title>2084<orderedlist>2085<listitem>2086<para><constant>V4L2_PIX_FMT_HM12</constant> (<xref2087linkend="reserved-formats" />) is a YUV 4:2:0, not 4:2:2 format.</para>2088</listitem>2089</orderedlist>2090</section>20912092<section>2093<title>V4L2 in Linux 2.6.21</title>2094<orderedlist>2095<listitem>2096<para>The <filename>videodev2.h</filename> header file is2097now dual licensed under GNU General Public License version two or2098later, and under a 3-clause BSD-style license.</para>2099</listitem>2100</orderedlist>2101</section>21022103<section>2104<title>V4L2 in Linux 2.6.22</title>2105<orderedlist>2106<listitem>2107<para>Two new field orders2108<constant>V4L2_FIELD_INTERLACED_TB</constant> and2109<constant>V4L2_FIELD_INTERLACED_BT</constant> were2110added. See <xref linkend="v4l2-field" /> for details.</para>2111</listitem>21122113<listitem>2114<para>Three new clipping/blending methods with a global or2115straight or inverted local alpha value were added to the video overlay2116interface. See the description of the &VIDIOC-G-FBUF; and2117&VIDIOC-S-FBUF; ioctls for details.</para>2118<para>A new <structfield>global_alpha</structfield> field2119was added to <link2120linkend="v4l2-window"><structname>v4l2_window</structname></link>,2121extending the structure. This may <emphasis>break2122compatibility</emphasis> with applications using a struct2123<structname>v4l2_window</structname> directly. However the <link2124linkend="vidioc-g-fmt">VIDIOC_G/S/TRY_FMT</link> ioctls, which take a2125pointer to a <link linkend="v4l2-format">v4l2_format</link> parent2126structure with padding bytes at the end, are not affected.</para>2127</listitem>21282129<listitem>2130<para>The format of the <structfield>chromakey</structfield>2131field in &v4l2-window; changed from "host order RGB32" to a pixel2132value in the same format as the framebuffer. This may <emphasis>break2133compatibility</emphasis> with existing applications. Drivers2134supporting the "host order RGB32" format are not known.</para>2135</listitem>21362137</orderedlist>2138</section>21392140<section>2141<title>V4L2 in Linux 2.6.24</title>2142<orderedlist>2143<listitem>2144<para>The pixel formats2145<constant>V4L2_PIX_FMT_PAL8</constant>,2146<constant>V4L2_PIX_FMT_YUV444</constant>,2147<constant>V4L2_PIX_FMT_YUV555</constant>,2148<constant>V4L2_PIX_FMT_YUV565</constant> and2149<constant>V4L2_PIX_FMT_YUV32</constant> were added.</para>2150</listitem>2151</orderedlist>2152</section>21532154<section>2155<title>V4L2 in Linux 2.6.25</title>2156<orderedlist>2157<listitem>2158<para>The pixel formats <link linkend="V4L2-PIX-FMT-Y16">2159<constant>V4L2_PIX_FMT_Y16</constant></link> and <link2160linkend="V4L2-PIX-FMT-SBGGR16">2161<constant>V4L2_PIX_FMT_SBGGR16</constant></link> were added.</para>2162</listitem>2163<listitem>2164<para>New <link linkend="control">controls</link>2165<constant>V4L2_CID_POWER_LINE_FREQUENCY</constant>,2166<constant>V4L2_CID_HUE_AUTO</constant>,2167<constant>V4L2_CID_WHITE_BALANCE_TEMPERATURE</constant>,2168<constant>V4L2_CID_SHARPNESS</constant> and2169<constant>V4L2_CID_BACKLIGHT_COMPENSATION</constant> were added. The2170controls <constant>V4L2_CID_BLACK_LEVEL</constant>,2171<constant>V4L2_CID_WHITENESS</constant>,2172<constant>V4L2_CID_HCENTER</constant> and2173<constant>V4L2_CID_VCENTER</constant> were deprecated.2174</para>2175</listitem>2176<listitem>2177<para>A <link linkend="camera-controls">Camera controls2178class</link> was added, with the new controls2179<constant>V4L2_CID_EXPOSURE_AUTO</constant>,2180<constant>V4L2_CID_EXPOSURE_ABSOLUTE</constant>,2181<constant>V4L2_CID_EXPOSURE_AUTO_PRIORITY</constant>,2182<constant>V4L2_CID_PAN_RELATIVE</constant>,2183<constant>V4L2_CID_TILT_RELATIVE</constant>,2184<constant>V4L2_CID_PAN_RESET</constant>,2185<constant>V4L2_CID_TILT_RESET</constant>,2186<constant>V4L2_CID_PAN_ABSOLUTE</constant>,2187<constant>V4L2_CID_TILT_ABSOLUTE</constant>,2188<constant>V4L2_CID_FOCUS_ABSOLUTE</constant>,2189<constant>V4L2_CID_FOCUS_RELATIVE</constant> and2190<constant>V4L2_CID_FOCUS_AUTO</constant>.</para>2191</listitem>2192<listitem>2193<para>The <constant>VIDIOC_G_MPEGCOMP</constant> and2194<constant>VIDIOC_S_MPEGCOMP</constant> ioctls, which were superseded2195by the <link linkend="extended-controls">extended controls</link>2196interface in Linux 2.6.18, where finally removed from the2197<filename>videodev2.h</filename> header file.</para>2198</listitem>2199</orderedlist>2200</section>22012202<section>2203<title>V4L2 in Linux 2.6.26</title>2204<orderedlist>2205<listitem>2206<para>The pixel formats2207<constant>V4L2_PIX_FMT_Y16</constant> and2208<constant>V4L2_PIX_FMT_SBGGR16</constant> were added.</para>2209</listitem>2210<listitem>2211<para>Added user controls2212<constant>V4L2_CID_CHROMA_AGC</constant> and2213<constant>V4L2_CID_COLOR_KILLER</constant>.</para>2214</listitem>2215</orderedlist>2216</section>22172218<section>2219<title>V4L2 in Linux 2.6.27</title>2220<orderedlist>2221<listitem>2222<para>The &VIDIOC-S-HW-FREQ-SEEK; ioctl and the2223<constant>V4L2_CAP_HW_FREQ_SEEK</constant> capability were added.</para>2224</listitem>2225<listitem>2226<para>The pixel formats2227<constant>V4L2_PIX_FMT_YVYU</constant>,2228<constant>V4L2_PIX_FMT_PCA501</constant>,2229<constant>V4L2_PIX_FMT_PCA505</constant>,2230<constant>V4L2_PIX_FMT_PCA508</constant>,2231<constant>V4L2_PIX_FMT_PCA561</constant>,2232<constant>V4L2_PIX_FMT_SGBRG8</constant>,2233<constant>V4L2_PIX_FMT_PAC207</constant> and2234<constant>V4L2_PIX_FMT_PJPG</constant> were added.</para>2235</listitem>2236</orderedlist>2237</section>22382239<section>2240<title>V4L2 in Linux 2.6.28</title>2241<orderedlist>2242<listitem>2243<para>Added <constant>V4L2_MPEG_AUDIO_ENCODING_AAC</constant> and2244<constant>V4L2_MPEG_AUDIO_ENCODING_AC3</constant> MPEG audio encodings.</para>2245</listitem>2246<listitem>2247<para>Added <constant>V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC</constant> MPEG2248video encoding.</para>2249</listitem>2250<listitem>2251<para>The pixel formats2252<constant>V4L2_PIX_FMT_SGRBG10</constant> and2253<constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant> were added.</para>2254</listitem>2255</orderedlist>2256</section>22572258<section>2259<title>V4L2 in Linux 2.6.29</title>2260<orderedlist>2261<listitem>2262<para>The <constant>VIDIOC_G_CHIP_IDENT</constant> ioctl was renamed2263to <constant>VIDIOC_G_CHIP_IDENT_OLD</constant> and &VIDIOC-DBG-G-CHIP-IDENT;2264was introduced in its place. The old struct <structname>v4l2_chip_ident</structname>2265was renamed to <structname id="v4l2-chip-ident-old">v4l2_chip_ident_old</structname>.</para>2266</listitem>2267<listitem>2268<para>The pixel formats2269<constant>V4L2_PIX_FMT_VYUY</constant>,2270<constant>V4L2_PIX_FMT_NV16</constant> and2271<constant>V4L2_PIX_FMT_NV61</constant> were added.</para>2272</listitem>2273<listitem>2274<para>Added camera controls2275<constant>V4L2_CID_ZOOM_ABSOLUTE</constant>,2276<constant>V4L2_CID_ZOOM_RELATIVE</constant>,2277<constant>V4L2_CID_ZOOM_CONTINUOUS</constant> and2278<constant>V4L2_CID_PRIVACY</constant>.</para>2279</listitem>2280</orderedlist>2281</section>2282<section>2283<title>V4L2 in Linux 2.6.30</title>2284<orderedlist>2285<listitem>2286<para>New control flag <constant>V4L2_CTRL_FLAG_WRITE_ONLY</constant> was added.</para>2287</listitem>2288<listitem>2289<para>New control <constant>V4L2_CID_COLORFX</constant> was added.</para>2290</listitem>2291</orderedlist>2292</section>2293<section>2294<title>V4L2 in Linux 2.6.32</title>2295<orderedlist>2296<listitem>2297<para>In order to be easier to compare a V4L2 API and a kernel2298version, now V4L2 API is numbered using the Linux Kernel version numeration.</para>2299</listitem>2300<listitem>2301<para>Finalized the RDS capture API. See <xref linkend="rds" /> for2302more information.</para>2303</listitem>2304<listitem>2305<para>Added new capabilities for modulators and RDS encoders.</para>2306</listitem>2307<listitem>2308<para>Add description for libv4l API.</para>2309</listitem>2310<listitem>2311<para>Added support for string controls via new type <constant>V4L2_CTRL_TYPE_STRING</constant>.</para>2312</listitem>2313<listitem>2314<para>Added <constant>V4L2_CID_BAND_STOP_FILTER</constant> documentation.</para>2315</listitem>2316<listitem>2317<para>Added FM Modulator (FM TX) Extended Control Class: <constant>V4L2_CTRL_CLASS_FM_TX</constant> and their Control IDs.</para>2318</listitem>2319<listitem>2320<para>Added Remote Controller chapter, describing the default Remote Controller mapping for media devices.</para>2321</listitem>2322</orderedlist>2323</section>2324<section>2325<title>V4L2 in Linux 2.6.33</title>2326<orderedlist>2327<listitem>2328<para>Added support for Digital Video timings in order to support HDTV receivers and transmitters.</para>2329</listitem>2330</orderedlist>2331</section>2332<section>2333<title>V4L2 in Linux 2.6.34</title>2334<orderedlist>2335<listitem>2336<para>Added2337<constant>V4L2_CID_IRIS_ABSOLUTE</constant> and2338<constant>V4L2_CID_IRIS_RELATIVE</constant> controls to the2339<link linkend="camera-controls">Camera controls class</link>.2340</para>2341</listitem>2342</orderedlist>2343</section>2344<section>2345<title>V4L2 in Linux 2.6.37</title>2346<orderedlist>2347<listitem>2348<para>Remove the vtx (videotext/teletext) API. This API was no longer2349used and no hardware exists to verify the API. Nor were any userspace applications found2350that used it. It was originally scheduled for removal in 2.6.35.2351</para>2352</listitem>2353</orderedlist>2354</section>2355<section>2356<title>V4L2 in Linux 2.6.39</title>2357<orderedlist>2358<listitem>2359<para>The old VIDIOC_*_OLD symbols and V4L1 support were removed.</para>2360</listitem>2361<listitem>2362<para>Multi-planar API added. Does not affect the compatibility of2363current drivers and applications. See2364<link linkend="planar-apis">multi-planar API</link>2365for details.</para>2366</listitem>2367</orderedlist>2368</section>23692370<section id="other">2371<title>Relation of V4L2 to other Linux multimedia APIs</title>23722373<section id="xvideo">2374<title>X Video Extension</title>23752376<para>The X Video Extension (abbreviated XVideo or just Xv) is2377an extension of the X Window system, implemented for example by the2378XFree86 project. Its scope is similar to V4L2, an API to video capture2379and output devices for X clients. Xv allows applications to display2380live video in a window, send window contents to a TV output, and2381capture or output still images in XPixmaps<footnote>2382<para>This is not implemented in XFree86.</para>2383</footnote>. With their implementation XFree86 makes the2384extension available across many operating systems and2385architectures.</para>23862387<para>Because the driver is embedded into the X server Xv has a2388number of advantages over the V4L2 <link linkend="overlay">video2389overlay interface</link>. The driver can easily determine the overlay2390target, &ie; visible graphics memory or off-screen buffers for a2391destructive overlay. It can program the RAMDAC for a non-destructive2392overlay, scaling or color-keying, or the clipping functions of the2393video capture hardware, always in sync with drawing operations or2394windows moving or changing their stacking order.</para>23952396<para>To combine the advantages of Xv and V4L a special Xv2397driver exists in XFree86 and XOrg, just programming any overlay capable2398Video4Linux device it finds. To enable it2399<filename>/etc/X11/XF86Config</filename> must contain these lines:</para>2400<para><screen>2401Section "Module"2402Load "v4l"2403EndSection</screen></para>24042405<para>As of XFree86 4.2 this driver still supports only V4L2406ioctls, however it should work just fine with all V4L2 devices through2407the V4L2 backward-compatibility layer. Since V4L2 permits multiple2408opens it is possible (if supported by the V4L2 driver) to capture2409video while an X client requested video overlay. Restrictions of2410simultaneous capturing and overlay are discussed in <xref2411linkend="overlay" /> apply.</para>24122413<para>Only marginally related to V4L2, XFree86 extended Xv to2414support hardware YUV to RGB conversion and scaling for faster video2415playback, and added an interface to MPEG-2 decoding hardware. This API2416is useful to display images captured with V4L2 devices.</para>2417</section>24182419<section>2420<title>Digital Video</title>24212422<para>V4L2 does not support digital terrestrial, cable or2423satellite broadcast. A separate project aiming at digital receivers2424exists. You can find its homepage at <ulink2425url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API2426has no connection to the V4L2 API except that drivers for hybrid2427hardware may support both.</para>2428</section>24292430<section>2431<title>Audio Interfaces</title>24322433<para>[to do - OSS/ALSA]</para>2434</section>2435</section>24362437<section id="experimental">2438<title>Experimental API Elements</title>24392440<para>The following V4L2 API elements are currently experimental2441and may change in the future.</para>24422443<itemizedlist>2444<listitem>2445<para>Video Output Overlay (OSD) Interface, <xref2446linkend="osd" />.</para>2447</listitem>2448<listitem>2449<para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>,2450&v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para>2451</listitem>2452<listitem>2453<para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>,2454&VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para>2455</listitem>2456<listitem>2457<para>&VIDIOC-ENUM-FRAMESIZES; and2458&VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para>2459</listitem>2460<listitem>2461<para>&VIDIOC-G-ENC-INDEX; ioctl.</para>2462</listitem>2463<listitem>2464<para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD;2465ioctls.</para>2466</listitem>2467<listitem>2468<para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER;2469ioctls.</para>2470</listitem>2471<listitem>2472<para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para>2473</listitem>2474</itemizedlist>2475</section>24762477<section id="obsolete">2478<title>Obsolete API Elements</title>24792480<para>The following V4L2 API elements were superseded by new2481interfaces and should not be implemented in new drivers.</para>24822483<itemizedlist>2484<listitem>2485<para><constant>VIDIOC_G_MPEGCOMP</constant> and2486<constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls,2487<xref linkend="extended-controls" />.</para>2488</listitem>2489</itemizedlist>2490</section>2491</section>24922493<!--2494Local Variables:2495mode: sgml2496sgml-parent-document: "v4l2.sgml"2497indent-tabs-mode: nil2498End:2499-->250025012502