1<refentry id="vidioc-enuminput">
2  <refmeta>
3    <refentrytitle>ioctl VIDIOC_ENUMINPUT</refentrytitle>
4    &manvol;
5  </refmeta>
6
7  <refnamediv>
8    <refname>VIDIOC_ENUMINPUT</refname>
9    <refpurpose>Enumerate video inputs</refpurpose>
10  </refnamediv>
11
12  <refsynopsisdiv>
13    <funcsynopsis>
14      <funcprototype>
15	<funcdef>int <function>ioctl</function></funcdef>
16	<paramdef>int <parameter>fd</parameter></paramdef>
17	<paramdef>int <parameter>request</parameter></paramdef>
18	<paramdef>struct v4l2_input
19*<parameter>argp</parameter></paramdef>
20      </funcprototype>
21    </funcsynopsis>
22  </refsynopsisdiv>
23
24  <refsect1>
25    <title>Arguments</title>
26
27    <variablelist>
28      <varlistentry>
29	<term><parameter>fd</parameter></term>
30	<listitem>
31	  <para>&fd;</para>
32	</listitem>
33      </varlistentry>
34      <varlistentry>
35	<term><parameter>request</parameter></term>
36	<listitem>
37	  <para>VIDIOC_ENUMINPUT</para>
38	</listitem>
39      </varlistentry>
40      <varlistentry>
41	<term><parameter>argp</parameter></term>
42	<listitem>
43	  <para></para>
44	</listitem>
45      </varlistentry>
46    </variablelist>
47  </refsect1>
48
49  <refsect1>
50    <title>Description</title>
51
52    <para>To query the attributes of a video input applications
53initialize the <structfield>index</structfield> field of &v4l2-input;
54and call the <constant>VIDIOC_ENUMINPUT</constant> ioctl with a
55pointer to this structure. Drivers fill the rest of the structure or
56return an &EINVAL; when the index is out of bounds. To enumerate all
57inputs applications shall begin at index zero, incrementing by one
58until the driver returns <errorcode>EINVAL</errorcode>.</para>
59
60    <table frame="none" pgwide="1" id="v4l2-input">
61      <title>struct <structname>v4l2_input</structname></title>
62      <tgroup cols="3">
63	&cs-str;
64	<tbody valign="top">
65	  <row>
66	    <entry>__u32</entry>
67	    <entry><structfield>index</structfield></entry>
68	    <entry>Identifies the input, set by the
69application.</entry>
70	  </row>
71	  <row>
72	    <entry>__u8</entry>
73	    <entry><structfield>name</structfield>[32]</entry>
74	    <entry>Name of the video input, a NUL-terminated ASCII
75string, for example: "Vin (Composite 2)". This information is intended
76for the user, preferably the connector label on the device itself.</entry>
77	  </row>
78	  <row>
79	    <entry>__u32</entry>
80	    <entry><structfield>type</structfield></entry>
81	    <entry>Type of the input, see <xref
82		linkend="input-type" />.</entry>
83	  </row>
84	  <row>
85	    <entry>__u32</entry>
86	    <entry><structfield>audioset</structfield></entry>
87	    <entry><para>Drivers can enumerate up to 32 video and
88audio inputs. This field shows which audio inputs were selectable as
89audio source if this was the currently selected video input. It is a
90bit mask. The LSB corresponds to audio input 0, the MSB to input 31.
91Any number of bits can be set, or none.</para><para>When the driver
92does not enumerate audio inputs no bits must be set. Applications
93shall not interpret this as lack of audio support. Some drivers
94automatically select audio sources and do not enumerate them since
95there is no choice anyway.</para><para>For details on audio inputs and
96how to select the current input see <xref
97		  linkend="audio" />.</para></entry>
98	  </row>
99	  <row>
100	    <entry>__u32</entry>
101	    <entry><structfield>tuner</structfield></entry>
102	    <entry>Capture devices can have zero or more tuners (RF
103demodulators). When the <structfield>type</structfield> is set to
104<constant>V4L2_INPUT_TYPE_TUNER</constant> this is an RF connector and
105this field identifies the tuner. It corresponds to
106&v4l2-tuner; field <structfield>index</structfield>. For details on
107tuners see <xref linkend="tuner" />.</entry>
108	  </row>
109	  <row>
110	    <entry>&v4l2-std-id;</entry>
111	    <entry><structfield>std</structfield></entry>
112	    <entry>Every video input supports one or more different
113video standards. This field is a set of all supported standards. For
114details on video standards and how to switch see <xref
115linkend="standard" />.</entry>
116	  </row>
117	  <row>
118	    <entry>__u32</entry>
119	    <entry><structfield>status</structfield></entry>
120	    <entry>This field provides status information about the
121input. See <xref linkend="input-status" /> for flags.
122With the exception of the sensor orientation bits <structfield>status</structfield> is only valid when this is the
123current input.</entry>
124	  </row>
125	  <row>
126	    <entry>__u32</entry>
127	    <entry><structfield>capabilities</structfield></entry>
128	    <entry>This field provides capabilities for the
129input. See <xref linkend="input-capabilities" /> for flags.</entry>
130	  </row>
131	  <row>
132	    <entry>__u32</entry>
133	    <entry><structfield>reserved</structfield>[3]</entry>
134	    <entry>Reserved for future extensions. Drivers must set
135the array to zero.</entry>
136	  </row>
137	</tbody>
138      </tgroup>
139    </table>
140
141    <table frame="none" pgwide="1" id="input-type">
142      <title>Input Types</title>
143      <tgroup cols="3">
144	&cs-def;
145	<tbody valign="top">
146	  <row>
147	    <entry><constant>V4L2_INPUT_TYPE_TUNER</constant></entry>
148	    <entry>1</entry>
149	    <entry>This input uses a tuner (RF demodulator).</entry>
150	  </row>
151	  <row>
152	    <entry><constant>V4L2_INPUT_TYPE_CAMERA</constant></entry>
153	    <entry>2</entry>
154	    <entry>Analog baseband input, for example CVBS /
155Composite Video, S-Video, RGB.</entry>
156	  </row>
157	</tbody>
158      </tgroup>
159    </table>
160
161    <!-- Status flags based on proposal by Mark McClelland,
162video4linux-list@redhat.com on 18 Oct 2002, subject "Re: [V4L] Re:
163v4l2 api". "Why are some of them inverted? So that the driver doesn't
164have to lie about the status in cases where it can't tell one way or
165the other. Plus, a status of zero would generally mean that everything
166is OK." -->
167
168    <table frame="none" pgwide="1" id="input-status">
169      <title>Input Status Flags</title>
170      <tgroup cols="3">
171	<colspec colname="c1" />
172	<colspec colname="c2" align="center" />
173	<colspec colname="c3" />
174	<spanspec namest="c1" nameend="c3" spanname="hspan"
175	  align="left" />
176	<tbody valign="top">
177	  <row>
178	    <entry spanname="hspan">General</entry>
179	  </row>
180	  <row>
181	    <entry><constant>V4L2_IN_ST_NO_POWER</constant></entry>
182	    <entry>0x00000001</entry>
183	    <entry>Attached device is off.</entry>
184	  </row>
185	  <row>
186	    <entry><constant>V4L2_IN_ST_NO_SIGNAL</constant></entry>
187	    <entry>0x00000002</entry>
188	    <entry></entry>
189	  </row>
190	  <row>
191	    <entry><constant>V4L2_IN_ST_NO_COLOR</constant></entry>
192	    <entry>0x00000004</entry>
193	    <entry>The hardware supports color decoding, but does not
194detect color modulation in the signal.</entry>
195	  </row>
196	  <row>
197	    <entry spanname="hspan">Sensor Orientation</entry>
198	  </row>
199	  <row>
200	    <entry><constant>V4L2_IN_ST_HFLIP</constant></entry>
201	    <entry>0x00000010</entry>
202	    <entry>The input is connected to a device that produces a signal
203that is flipped horizontally and does not correct this before passing the
204signal to userspace.</entry>
205	  </row>
206	  <row>
207	    <entry><constant>V4L2_IN_ST_VFLIP</constant></entry>
208	    <entry>0x00000020</entry>
209	    <entry>The input is connected to a device that produces a signal
210that is flipped vertically and does not correct this before passing the
211signal to userspace. Note that a 180 degree rotation is the same as HFLIP | VFLIP</entry>
212	  </row>
213	  <row>
214	    <entry spanname="hspan">Analog Video</entry>
215	  </row>
216	  <row>
217	    <entry><constant>V4L2_IN_ST_NO_H_LOCK</constant></entry>
218	    <entry>0x00000100</entry>
219	    <entry>No horizontal sync lock.</entry>
220	  </row>
221	  <row>
222	    <entry><constant>V4L2_IN_ST_COLOR_KILL</constant></entry>
223	    <entry>0x00000200</entry>
224	    <entry>A color killer circuit automatically disables color
225decoding when it detects no color modulation. When this flag is set
226the color killer is enabled <emphasis>and</emphasis> has shut off
227color decoding.</entry>
228	  </row>
229	  <row>
230	    <entry spanname="hspan">Digital Video</entry>
231	  </row>
232	  <row>
233	    <entry><constant>V4L2_IN_ST_NO_SYNC</constant></entry>
234	    <entry>0x00010000</entry>
235	    <entry>No synchronization lock.</entry>
236	  </row>
237	  <row>
238	    <entry><constant>V4L2_IN_ST_NO_EQU</constant></entry>
239	    <entry>0x00020000</entry>
240	    <entry>No equalizer lock.</entry>
241	  </row>
242	  <row>
243	    <entry><constant>V4L2_IN_ST_NO_CARRIER</constant></entry>
244	    <entry>0x00040000</entry>
245	    <entry>Carrier recovery failed.</entry>
246	  </row>
247	  <row>
248	    <entry spanname="hspan">VCR and Set-Top Box</entry>
249	  </row>
250	  <row>
251	    <entry><constant>V4L2_IN_ST_MACROVISION</constant></entry>
252	    <entry>0x01000000</entry>
253	    <entry>Macrovision is an analog copy prevention system
254mangling the video signal to confuse video recorders. When this
255flag is set Macrovision has been detected.</entry>
256	  </row>
257	  <row>
258	    <entry><constant>V4L2_IN_ST_NO_ACCESS</constant></entry>
259	    <entry>0x02000000</entry>
260	    <entry>Conditional access denied.</entry>
261	  </row>
262	  <row>
263	    <entry><constant>V4L2_IN_ST_VTR</constant></entry>
264	    <entry>0x04000000</entry>
265	    <entry>VTR time constant. [?]</entry>
266	  </row>
267	</tbody>
268      </tgroup>
269    </table>
270
271    <!-- Capability flags based on video timings RFC by Muralidharan
272Karicheri, titled RFC (v1.2): V4L - Support for video timings at the
273input/output interface to linux-media@vger.kernel.org on 19 Oct 2009.
274	-->
275    <table frame="none" pgwide="1" id="input-capabilities">
276      <title>Input capabilities</title>
277      <tgroup cols="3">
278	&cs-def;
279	<tbody valign="top">
280	  <row>
281	    <entry><constant>V4L2_IN_CAP_DV_TIMINGS</constant></entry>
282	    <entry>0x00000002</entry>
283	    <entry>This input supports setting video timings by using VIDIOC_S_DV_TIMINGS.</entry>
284	  </row>
285	  <row>
286	    <entry><constant>V4L2_IN_CAP_STD</constant></entry>
287	    <entry>0x00000004</entry>
288	    <entry>This input supports setting the TV standard by using VIDIOC_S_STD.</entry>
289	  </row>
290	  <row>
291	    <entry><constant>V4L2_IN_CAP_NATIVE_SIZE</constant></entry>
292	    <entry>0x00000008</entry>
293	    <entry>This input supports setting the native size using
294	    the <constant>V4L2_SEL_TGT_NATIVE_SIZE</constant>
295	    selection target, see <xref
296	    linkend="v4l2-selections-common"/>.</entry>
297	  </row>
298	</tbody>
299      </tgroup>
300    </table>
301  </refsect1>
302
303  <refsect1>
304    &return-value;
305
306    <variablelist>
307      <varlistentry>
308	<term><errorcode>EINVAL</errorcode></term>
309	<listitem>
310	  <para>The &v4l2-input; <structfield>index</structfield> is
311out of bounds.</para>
312	</listitem>
313      </varlistentry>
314    </variablelist>
315  </refsect1>
316</refentry>
317