1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Video Inputs and Outputs</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="common.html" title="Chapter&#160;1.&#160;Common API Elements"><link rel="prev" href="app-pri.html" title="Application Priority"><link rel="next" href="audio.html" title="Audio Inputs and Outputs"></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 Inputs and Outputs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="app-pri.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;1.&#160;Common API Elements</th><td width="20%" align="right">&#160;<a accesskey="n" href="audio.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="video"></a>Video Inputs and Outputs</h2></div></div></div><p>Video inputs and outputs are physical connectors of a
2device. These can be for example RF connectors (antenna/cable), CVBS
3a.k.a. Composite Video, S-Video or RGB connectors. Video and VBI
4capture devices have inputs. Video and VBI output devices have outputs,
5at least one each. Radio devices have no video inputs or outputs.</p><p>To learn about the number and attributes of the
6available inputs and outputs applications can enumerate them with the
7<a class="link" href="vidioc-enuminput.html" title="ioctl VIDIOC_ENUMINPUT"><code class="constant">VIDIOC_ENUMINPUT</code></a> and <a class="link" href="vidioc-enumoutput.html" title="ioctl VIDIOC_ENUMOUTPUT"><code class="constant">VIDIOC_ENUMOUTPUT</code></a> ioctl, respectively. The
8struct&#160;<a class="link" href="vidioc-enuminput.html#v4l2-input" title="Table&#160;A.39.&#160;struct v4l2_input">v4l2_input</a> returned by the <code class="constant">VIDIOC_ENUMINPUT</code>
9ioctl also contains signal status information applicable when the
10current video input is queried.</p><p>The <a class="link" href="vidioc-g-input.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_G_INPUT</code></a> and <a class="link" href="vidioc-g-output.html" title="ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT"><code class="constant">VIDIOC_G_OUTPUT</code></a> ioctls return the
11index of the current video input or output. To select a different
12input or output applications call the <a class="link" href="vidioc-g-input.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_S_INPUT</code></a> and
13<a class="link" href="vidioc-g-output.html" title="ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT"><code class="constant">VIDIOC_S_OUTPUT</code></a> ioctls. Drivers must implement all the input ioctls
14when the device has one or more inputs, all the output ioctls when the
15device has one or more outputs.</p><div class="example"><a name="idp1096810732"></a><p class="title"><b>Example&#160;1.1.&#160;Information about the current video input</b></p><div class="example-contents"><pre class="programlisting">
16struct&#160;<a class="link" href="vidioc-enuminput.html#v4l2-input" title="Table&#160;A.39.&#160;struct v4l2_input">v4l2_input</a> input;
17int index;
18
19if (-1 == ioctl(fd, <a class="link" href="vidioc-g-input.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_G_INPUT</code></a>, &amp;index)) {
20	perror("VIDIOC_G_INPUT");
21	exit(EXIT_FAILURE);
22}
23
24memset(&amp;input, 0, sizeof(input));
25input.index = index;
26
27if (-1 == ioctl(fd, <a class="link" href="vidioc-enuminput.html" title="ioctl VIDIOC_ENUMINPUT"><code class="constant">VIDIOC_ENUMINPUT</code></a>, &amp;input)) {
28	perror("VIDIOC_ENUMINPUT");
29	exit(EXIT_FAILURE);
30}
31
32printf("Current input: %s\n", input.name);
33      </pre></div></div><br class="example-break"><div class="example"><a name="idp1096813068"></a><p class="title"><b>Example&#160;1.2.&#160;Switching to the first video input</b></p><div class="example-contents"><pre class="programlisting">
34int index;
35
36index = 0;
37
38if (-1 == ioctl(fd, <a class="link" href="vidioc-g-input.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_S_INPUT</code></a>, &amp;index)) {
39	perror("VIDIOC_S_INPUT");
40	exit(EXIT_FAILURE);
41}
42      </pre></div></div><br class="example-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pri.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="common.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="audio.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Application Priority&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Audio Inputs and Outputs</td></tr></table></div></body></html>
43