1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2 <HTML 3 ><HEAD 4 ><TITLE 5 >Video Inputs and Outputs</TITLE 6 ><META 7 NAME="GENERATOR" 8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9 REL="HOME" 10 TITLE="Video for Linux Two API Specification" 11 HREF="book1.htm"><LINK 12 REL="UP" 13 TITLE="Common API Elements" 14 HREF="c174.htm"><LINK 15 REL="PREVIOUS" 16 TITLE="Application Priority" 17 HREF="x294.htm"><LINK 18 REL="NEXT" 19 TITLE="Audio Inputs and Outputs" 20 HREF="x341.htm"></HEAD 21 ><BODY 22 CLASS="SECTION" 23 BGCOLOR="#FFFFFF" 24 TEXT="#000000" 25 LINK="#0000FF" 26 VLINK="#840084" 27 ALINK="#0000FF" 28 ><DIV 29 CLASS="NAVHEADER" 30 ><TABLE 31 SUMMARY="Header navigation table" 32 WIDTH="100%" 33 BORDER="0" 34 CELLPADDING="0" 35 CELLSPACING="0" 36 ><TR 37 ><TH 38 COLSPAN="3" 39 ALIGN="center" 40 >Video for Linux Two API Specification: Revision 0.24</TH 41 ></TR 42 ><TR 43 ><TD 44 WIDTH="10%" 45 ALIGN="left" 46 VALIGN="bottom" 47 ><A 48 HREF="x294.htm" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 >Chapter 1. Common API Elements</TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="x341.htm" 63 ACCESSKEY="N" 64 >Next</A 65 ></TD 66 ></TR 67 ></TABLE 68 ><HR 69 ALIGN="LEFT" 70 WIDTH="100%"></DIV 71 ><DIV 72 CLASS="SECTION" 73 ><H1 74 CLASS="SECTION" 75 ><A 76 NAME="VIDEO" 77 >1.4. Video Inputs and Outputs</A 78 ></H1 79 ><P 80 >Video inputs and outputs are physical connectors of a 81 device. These can be for example RF connectors (antenna/cable), CVBS 82 a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI 83 capture devices have inputs, output devices have outputs, at least one 84 each. Radio devices have no video inputs or outputs.</P 85 ><P 86 >To learn about the number and attributes of the 87 available inputs and outputs applications can enumerate them with the 88 <A 89 HREF="r8936.htm" 90 ><CODE 91 CLASS="CONSTANT" 92 >VIDIOC_ENUMINPUT</CODE 93 ></A 94 > and <A 95 HREF="r9149.htm" 96 ><CODE 97 CLASS="CONSTANT" 98 >VIDIOC_ENUMOUTPUT</CODE 99 ></A 100 > ioctl, respectively. The 101 struct <A 102 HREF="r8936.htm#V4L2-INPUT" 103 >v4l2_input</A 104 > returned by the <CODE 105 CLASS="CONSTANT" 106 >VIDIOC_ENUMINPUT</CODE 107 > 108 ioctl also contains signal status information applicable when the 109 current video input is queried.</P 110 ><P 111 >The <A 112 HREF="r11217.htm" 113 ><CODE 114 CLASS="CONSTANT" 115 >VIDIOC_G_INPUT</CODE 116 ></A 117 > and <A 118 HREF="r11612.htm" 119 ><CODE 120 CLASS="CONSTANT" 121 >VIDIOC_G_OUTPUT</CODE 122 ></A 123 > ioctl return the 124 index of the current video input or output. To select a different 125 input or output applications call the <A 126 HREF="r11217.htm" 127 ><CODE 128 CLASS="CONSTANT" 129 >VIDIOC_S_INPUT</CODE 130 ></A 131 > and 132 <A 133 HREF="r11612.htm" 134 ><CODE 135 CLASS="CONSTANT" 136 >VIDIOC_S_OUTPUT</CODE 137 ></A 138 > ioctl. Drivers must implement all the input ioctls 139 when the device has one or more inputs, all the output ioctls when the 140 device has one or more outputs.</P 141 ><DIV 142 CLASS="EXAMPLE" 143 ><A 144 NAME="AEN328" 145 ></A 146 ><P 147 ><B 148 >Example 1-1. Information about the current video input</B 149 ></P 150 ><PRE 151 CLASS="PROGRAMLISTING" 152 >struct <A 153 HREF="r8936.htm#V4L2-INPUT" 154 >v4l2_input</A 155 > input; 156 int index; 157 158 if (-1 == ioctl (fd, <A 159 HREF="r11217.htm" 160 ><CODE 161 CLASS="CONSTANT" 162 >VIDIOC_G_INPUT</CODE 163 ></A 164 >, &index)) { 165 perror ("VIDIOC_G_INPUT"); 166 exit (EXIT_FAILURE); 167 } 168 169 memset (&input, 0, sizeof (input)); 170 input.index = index; 171 172 if (-1 == ioctl (fd, <A 173 HREF="r8936.htm" 174 ><CODE 175 CLASS="CONSTANT" 176 >VIDIOC_ENUMINPUT</CODE 177 ></A 178 >, &input)) { 179 perror ("VIDIOC_ENUMINPUT"); 180 exit (EXIT_FAILURE); 181 } 182 183 printf ("Current input: %s\n", input.name); 184 </PRE 185 ></DIV 186 ><DIV 187 CLASS="EXAMPLE" 188 ><A 189 NAME="AEN336" 190 ></A 191 ><P 192 ><B 193 >Example 1-2. Switching to the first video input</B 194 ></P 195 ><PRE 196 CLASS="PROGRAMLISTING" 197 >int index; 198 199 index = 0; 200 201 if (-1 == ioctl (fd, <A 202 HREF="r11217.htm" 203 ><CODE 204 CLASS="CONSTANT" 205 >VIDIOC_S_INPUT</CODE 206 ></A 207 >, &index)) { 208 perror ("VIDIOC_S_INPUT"); 209 exit (EXIT_FAILURE); 210 } 211 </PRE 212 ></DIV 213 ></DIV 214 ><DIV 215 CLASS="NAVFOOTER" 216 ><HR 217 ALIGN="LEFT" 218 WIDTH="100%"><TABLE 219 SUMMARY="Footer navigation table" 220 WIDTH="100%" 221 BORDER="0" 222 CELLPADDING="0" 223 CELLSPACING="0" 224 ><TR 225 ><TD 226 WIDTH="33%" 227 ALIGN="left" 228 VALIGN="top" 229 ><A 230 HREF="x294.htm" 231 ACCESSKEY="P" 232 >Prev</A 233 ></TD 234 ><TD 235 WIDTH="34%" 236 ALIGN="center" 237 VALIGN="top" 238 ><A 239 HREF="book1.htm" 240 ACCESSKEY="H" 241 >Home</A 242 ></TD 243 ><TD 244 WIDTH="33%" 245 ALIGN="right" 246 VALIGN="top" 247 ><A 248 HREF="x341.htm" 249 ACCESSKEY="N" 250 >Next</A 251 ></TD 252 ></TR 253 ><TR 254 ><TD 255 WIDTH="33%" 256 ALIGN="left" 257 VALIGN="top" 258 >Application Priority</TD 259 ><TD 260 WIDTH="34%" 261 ALIGN="center" 262 VALIGN="top" 263 ><A 264 HREF="c174.htm" 265 ACCESSKEY="U" 266 >Up</A 267 ></TD 268 ><TD 269 WIDTH="33%" 270 ALIGN="right" 271 VALIGN="top" 272 >Audio Inputs and Outputs</TD 273 ></TR 274 ></TABLE 275 ></DIV 276 ></BODY 277 ></HTML 278 > 279