<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API" /><link rel="up" href="ch01.html" title="Chapter 1. Common API Elements" /><link rel="prev" href="ch01s03.html" title="Application Priority" /><link rel="next" href="ch01s05.html" title="Audio Inputs and Outputs" /></head><body><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="ch01s03.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Common API Elements</th><td width="20%" align="right"> <a accesskey="n" href="ch01s05.html">Next</a></td></tr></table><hr /></div><div class="section" title="Video Inputs and Outputs"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="video"></a>Video Inputs and Outputs</h2></div></div></div><p>Video inputs and outputs are physical connectors of a device. These can be for example RF connectors (antenna/cable), CVBS a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI capture devices have inputs, output devices have outputs, at least one each. Radio devices have no video inputs or outputs.</p><p>To learn about the number and attributes of the available inputs and outputs applications can enumerate them with the <a class="link" href="re31.html" title="ioctl VIDIOC_ENUMINPUT"><code class="constant">VIDIOC_ENUMINPUT</code></a> and <a class="link" href="re32.html" title="ioctl VIDIOC_ENUMOUTPUT"><code class="constant">VIDIOC_ENUMOUTPUT</code></a> ioctl, respectively. The struct <a class="link" href="re31.html#v4l2-input" title="Table A.22. struct v4l2_input">v4l2_input</a> returned by the <code class="constant">VIDIOC_ENUMINPUT</code> ioctl also contains signal status information applicable when the current video input is queried.</p><p>The <a class="link" href="re43.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_G_INPUT</code></a> and <a class="link" href="re46.html" title="ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT"><code class="constant">VIDIOC_G_OUTPUT</code></a> ioctl return the index of the current video input or output. To select a different input or output applications call the <a class="link" href="re43.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_S_INPUT</code></a> and <a class="link" href="re46.html" title="ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT"><code class="constant">VIDIOC_S_OUTPUT</code></a> ioctl. Drivers must implement all the input ioctls when the device has one or more inputs, all the output ioctls when the device has one or more outputs.</p><div class="example"><a id="id2577359"></a><p class="title"><b>Example 1.1. Information about the current video input</b></p><div class="example-contents"><pre class="programlisting"> struct <a class="link" href="re31.html#v4l2-input" title="Table A.22. struct v4l2_input">v4l2_input</a> input; int index; if (-1 == ioctl (fd, <a class="link" href="re43.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_G_INPUT</code></a>, &index)) { perror ("VIDIOC_G_INPUT"); exit (EXIT_FAILURE); } memset (&input, 0, sizeof (input)); input.index = index; if (-1 == ioctl (fd, <a class="link" href="re31.html" title="ioctl VIDIOC_ENUMINPUT"><code class="constant">VIDIOC_ENUMINPUT</code></a>, &input)) { perror ("VIDIOC_ENUMINPUT"); exit (EXIT_FAILURE); } printf ("Current input: %s\n", input.name); </pre></div></div><br class="example-break" /><div class="example"><a id="id2577407"></a><p class="title"><b>Example 1.2. Switching to the first video input</b></p><div class="example-contents"><pre class="programlisting"> int index; index = 0; if (-1 == ioctl (fd, <a class="link" href="re43.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"><code class="constant">VIDIOC_S_INPUT</code></a>, &index)) { perror ("VIDIOC_S_INPUT"); exit (EXIT_FAILURE); } </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="ch01s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch01s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Application Priority </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Audio Inputs and Outputs</td></tr></table></div></body></html>