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