1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Video Output Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="devices.html" title="Chapter&#160;4.&#160;Interfaces"><link rel="prev" href="overlay.html" title="Video Overlay Interface"><link rel="next" href="osd.html" title="Video Output Overlay Interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Video Output Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="overlay.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;Interfaces</th><td width="20%" align="right">&#160;<a accesskey="n" href="osd.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="output"></a>Video Output Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="output.html#idp1105304604">Querying Capabilities</a></span></dt><dt><span class="section"><a href="output.html#idp1105350052">Supplemental Functions</a></span></dt><dt><span class="section"><a href="output.html#idp1105353692">Image Format Negotiation</a></span></dt><dt><span class="section"><a href="output.html#idp1105366780">Writing Images</a></span></dt></dl></div><p>Video output devices encode stills or image sequences as
2analog video signal. With this interface applications can
3control the encoding process and move images from user space to
4the driver.</p><p>Conventionally V4L2 video output devices are accessed through
5character device special files named <code class="filename">/dev/video</code>
6and <code class="filename">/dev/video0</code> to
7<code class="filename">/dev/video63</code> with major number 81 and minor
8numbers 0 to 63. <code class="filename">/dev/video</code> is typically a
9symbolic link to the preferred video device. Note the same device
10files are used for video capture devices.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1105304604"></a>Querying Capabilities</h3></div></div></div><p>Devices supporting the video output interface set the
11<code class="constant">V4L2_CAP_VIDEO_OUTPUT</code> or
12<code class="constant">V4L2_CAP_VIDEO_OUTPUT_MPLANE</code> flag in the
13<em class="structfield"><code>capabilities</code></em> field of struct&#160;<a class="link" href="vidioc-querycap.html#v4l2-capability" title="Table&#160;A.93.&#160;struct v4l2_capability">v4l2_capability</a>
14returned by the <a class="link" href="vidioc-querycap.html" title="ioctl VIDIOC_QUERYCAP"><code class="constant">VIDIOC_QUERYCAP</code></a> ioctl. As secondary device functions
15they may also support the <a class="link" href="raw-vbi.html" title="Raw VBI Data Interface">raw VBI
16output</a> (<code class="constant">V4L2_CAP_VBI_OUTPUT</code>) interface. At
17least one of the read/write or streaming I/O methods must be
18supported. Modulators and audio outputs are optional.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1105350052"></a>Supplemental Functions</h3></div></div></div><p>Video output devices shall support <a class="link" href="audio.html" title="Audio Inputs and Outputs">audio output</a>, <a class="link" href="tuner.html" title="Tuners and Modulators">modulator</a>, <a class="link" href="control.html" title="User Controls">controls</a>,
19<a class="link" href="crop.html" title="Image Cropping, Insertion and Scaling">cropping and scaling</a> and <a class="link" href="streaming-par.html" title="Streaming Parameters">streaming parameter</a> ioctls as needed.
20The <a class="link" href="video.html" title="Video Inputs and Outputs">video output</a> and <a class="link" href="standard.html" title="Video Standards">video standard</a> ioctls must be supported by
21all video output devices.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1105353692"></a>Image Format Negotiation</h3></div></div></div><p>The output is determined by cropping and image format
22parameters. The former select an area of the video picture where the
23image will appear, the latter how images are stored in memory, i.&#160;e. in
24RGB or YUV format, the number of bits per pixel or width and height.
25Together they also define how images are scaled in the process.</p><p>As usual these parameters are <span class="emphasis"><em>not</em></span> reset
26at <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a> time to permit Unix tool chains, programming a device
27and then writing to it as if it was a plain file. Well written V4L2
28applications ensure they really get what they want, including cropping
29and scaling.</p><p>Cropping initialization at minimum requires to reset the
30parameters to defaults. An example is given in <a class="xref" href="crop.html" title="Image Cropping, Insertion and Scaling">the section called &#8220;Image Cropping, Insertion and Scaling&#8221;</a>.</p><p>To query the current image format applications set the
31<em class="structfield"><code>type</code></em> field of a struct&#160;<a class="link" href="vidioc-g-fmt.html#v4l2-format" title="Table&#160;A.72.&#160;struct v4l2_format">v4l2_format</a> to
32<code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT</code> or
33<code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</code> and call the
34<a class="link" href="vidioc-g-fmt.html" title="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT"><code class="constant">VIDIOC_G_FMT</code></a> ioctl with a pointer to this structure. Drivers fill
35the struct&#160;<a class="link" href="pixfmt.html#v4l2-pix-format" title="Table&#160;2.1.&#160;struct v4l2_pix_format">v4l2_pix_format</a> <em class="structfield"><code>pix</code></em> or the
36struct&#160;<a class="link" href="ch02s02.html#v4l2-pix-format-mplane" title="Table&#160;2.3.&#160;struct v4l2_pix_format_mplane">v4l2_pix_format_mplane</a> <em class="structfield"><code>pix_mp</code></em> member of the
37<em class="structfield"><code>fmt</code></em> union.</p><p>To request different parameters applications set the
38<em class="structfield"><code>type</code></em> field of a struct&#160;<a class="link" href="vidioc-g-fmt.html#v4l2-format" title="Table&#160;A.72.&#160;struct v4l2_format">v4l2_format</a> as above and
39initialize all fields of the struct&#160;<a class="link" href="pixfmt.html#v4l2-pix-format" title="Table&#160;2.1.&#160;struct v4l2_pix_format">v4l2_pix_format</a>
40<em class="structfield"><code>vbi</code></em> member of the
41<em class="structfield"><code>fmt</code></em> union, or better just modify the
42results of <code class="constant">VIDIOC_G_FMT</code>, and call the
43<a class="link" href="vidioc-g-fmt.html" title="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT"><code class="constant">VIDIOC_S_FMT</code></a> ioctl with a pointer to this structure. Drivers may
44adjust the parameters and finally return the actual parameters as
45<code class="constant">VIDIOC_G_FMT</code> does.</p><p>Like <code class="constant">VIDIOC_S_FMT</code> the
46<a class="link" href="vidioc-g-fmt.html" title="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT"><code class="constant">VIDIOC_TRY_FMT</code></a> ioctl can be used to learn about hardware limitations
47without disabling I/O or possibly time consuming hardware
48preparations.</p><p>The contents of struct&#160;<a class="link" href="pixfmt.html#v4l2-pix-format" title="Table&#160;2.1.&#160;struct v4l2_pix_format">v4l2_pix_format</a> and struct&#160;<a class="link" href="ch02s02.html#v4l2-pix-format-mplane" title="Table&#160;2.3.&#160;struct v4l2_pix_format_mplane">v4l2_pix_format_mplane</a>
49are discussed in <a class="xref" href="pixfmt.html" title="Chapter&#160;2.&#160;Image Formats">Chapter&#160;2, <i>Image Formats</i></a>. See also the specification of the
50<code class="constant">VIDIOC_G_FMT</code>, <code class="constant">VIDIOC_S_FMT</code>
51and <code class="constant">VIDIOC_TRY_FMT</code> ioctls for details. Video
52output devices must implement both the
53<code class="constant">VIDIOC_G_FMT</code> and
54<code class="constant">VIDIOC_S_FMT</code> ioctl, even if
55<code class="constant">VIDIOC_S_FMT</code> ignores all requests and always
56returns default parameters as <code class="constant">VIDIOC_G_FMT</code> does.
57<code class="constant">VIDIOC_TRY_FMT</code> is optional.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1105366780"></a>Writing Images</h3></div></div></div><p>A video output device may support the <a class="link" href="io.html#rw" title="Read/Write">write() function</a> and/or streaming (<a class="link" href="mmap.html" title="Streaming I/O (Memory Mapping)">memory mapping</a> or <a class="link" href="userp.html" title="Streaming I/O (User Pointers)">user pointer</a>) I/O. See <a class="xref" href="io.html" title="Chapter&#160;3.&#160;Input/Output">Chapter&#160;3, <i>Input/Output</i></a> for details.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="overlay.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="devices.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="osd.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Video Overlay Interface&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Video Output Overlay Interface</td></tr></table></div></body></html>
58