blob: a5f0547ed6fc13f5440c9ce093dd635eeb975790 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Video Inputs and Outputs</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Video for Linux Two API Specification"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Common API Elements"
HREF="c174.htm"><LINK
REL="PREVIOUS"
TITLE="Application Priority"
HREF="x294.htm"><LINK
REL="NEXT"
TITLE="Audio Inputs and Outputs"
HREF="x341.htm"></HEAD
><BODY
CLASS="SECTION"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Video for Linux Two API Specification: Revision 0.24</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x294.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. Common API Elements</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x341.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="VIDEO"
>1.4. Video Inputs and Outputs</A
></H1
><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
HREF="r8936.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_ENUMINPUT</CODE
></A
> and <A
HREF="r9149.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_ENUMOUTPUT</CODE
></A
> ioctl, respectively. The
struct&nbsp;<A
HREF="r8936.htm#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
HREF="r11217.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_G_INPUT</CODE
></A
> and <A
HREF="r11612.htm"
><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
HREF="r11217.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_S_INPUT</CODE
></A
> and
<A
HREF="r11612.htm"
><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
NAME="AEN328"
></A
><P
><B
>Example 1-1. Information about the current video input</B
></P
><PRE
CLASS="PROGRAMLISTING"
>struct&nbsp;<A
HREF="r8936.htm#V4L2-INPUT"
>v4l2_input</A
> input;
int index;
if (-1 == ioctl (fd, <A
HREF="r11217.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_G_INPUT</CODE
></A
>, &amp;index)) {
perror ("VIDIOC_G_INPUT");
exit (EXIT_FAILURE);
}
memset (&amp;input, 0, sizeof (input));
input.index = index;
if (-1 == ioctl (fd, <A
HREF="r8936.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_ENUMINPUT</CODE
></A
>, &amp;input)) {
perror ("VIDIOC_ENUMINPUT");
exit (EXIT_FAILURE);
}
printf ("Current input: %s\n", input.name);
</PRE
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN336"
></A
><P
><B
>Example 1-2. Switching to the first video input</B
></P
><PRE
CLASS="PROGRAMLISTING"
>int index;
index = 0;
if (-1 == ioctl (fd, <A
HREF="r11217.htm"
><CODE
CLASS="CONSTANT"
>VIDIOC_S_INPUT</CODE
></A
>, &amp;index)) {
perror ("VIDIOC_S_INPUT");
exit (EXIT_FAILURE);
}
</PRE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x294.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x341.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Application Priority</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c174.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Audio Inputs and Outputs</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>