blob: f29f1b86213c68b55744420f8cb65eeaff708806 [file] [log] [blame]
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -03001<refentry id="vidioc-querycap">
2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_QUERYCAP</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>VIDIOC_QUERYCAP</refname>
9 <refpurpose>Query device capabilities</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_capability *<parameter>argp</parameter></paramdef>
19 </funcprototype>
20 </funcsynopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Arguments</title>
25
26 <variablelist>
27 <varlistentry>
28 <term><parameter>fd</parameter></term>
29 <listitem>
30 <para>&fd;</para>
31 </listitem>
32 </varlistentry>
33 <varlistentry>
34 <term><parameter>request</parameter></term>
35 <listitem>
36 <para>VIDIOC_QUERYCAP</para>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term><parameter>argp</parameter></term>
41 <listitem>
42 <para></para>
43 </listitem>
44 </varlistentry>
45 </variablelist>
46 </refsect1>
47
48 <refsect1>
49 <title>Description</title>
50
51 <para>All V4L2 devices support the
52<constant>VIDIOC_QUERYCAP</constant> ioctl. It is used to identify
53kernel devices compatible with this specification and to obtain
54information about driver and hardware capabilities. The ioctl takes a
55pointer to a &v4l2-capability; which is filled by the driver. When the
56driver is not compatible with this specification the ioctl returns an
57&EINVAL;.</para>
58
59 <table pgwide="1" frame="none" id="v4l2-capability">
60 <title>struct <structname>v4l2_capability</structname></title>
61 <tgroup cols="3">
62 &cs-str;
63 <tbody valign="top">
64 <row>
65 <entry>__u8</entry>
66 <entry><structfield>driver</structfield>[16]</entry>
67 <entry><para>Name of the driver, a unique NUL-terminated
68ASCII string. For example: "bttv". Driver specific applications can
69use this information to verify the driver identity. It is also useful
70to work around known bugs, or to identify drivers in error reports.
71The driver version is stored in the <structfield>version</structfield>
72field.</para><para>Storing strings in fixed sized arrays is bad
73practice but unavoidable here. Drivers and applications should take
74precautions to never read or write beyond the end of the array and to
75make sure the strings are properly NUL-terminated.</para></entry>
76 </row>
77 <row>
78 <entry>__u8</entry>
79 <entry><structfield>card</structfield>[32]</entry>
80 <entry>Name of the device, a NUL-terminated ASCII string.
81For example: "Yoyodyne TV/FM". One driver may support different brands
82or models of video hardware. This information is intended for users,
83for example in a menu of available devices. Since multiple TV cards of
84the same brand may be installed which are supported by the same
85driver, this name should be combined with the character device file
86name (&eg; <filename>/dev/video2</filename>) or the
87<structfield>bus_info</structfield> string to avoid
88ambiguities.</entry>
89 </row>
90 <row>
91 <entry>__u8</entry>
92 <entry><structfield>bus_info</structfield>[32]</entry>
93 <entry>Location of the device in the system, a
94NUL-terminated ASCII string. For example: "PCI Slot 4". This
95information is intended for users, to distinguish multiple
96identical devices. If no such information is available the field may
97simply count the devices controlled by the driver, or contain the
98empty string (<structfield>bus_info</structfield>[0] = 0).<!-- XXX pci_dev->slot_name example --></entry>
99 </row>
100 <row>
101 <entry>__u32</entry>
102 <entry><structfield>version</structfield></entry>
103 <entry><para>Version number of the driver. Together with
104the <structfield>driver</structfield> field this identifies a
105particular driver. The version number is formatted using the
106<constant>KERNEL_VERSION()</constant> macro:</para></entry>
107 </row>
108 <row>
109 <entry spanname="hspan"><para>
110<programlisting>
111#define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c))
112
113__u32 version = KERNEL_VERSION(0, 8, 1);
114
115printf ("Version: %u.%u.%u\n",
116 (version &gt;&gt; 16) &amp; 0xFF,
117 (version &gt;&gt; 8) &amp; 0xFF,
118 version &amp; 0xFF);
119</programlisting></para></entry>
120 </row>
121 <row>
122 <entry>__u32</entry>
123 <entry><structfield>capabilities</structfield></entry>
124 <entry>Device capabilities, see <xref
125 linkend="device-capabilities" />.</entry>
126 </row>
127 <row>
128 <entry>__u32</entry>
129 <entry><structfield>reserved</structfield>[4]</entry>
130 <entry>Reserved for future extensions. Drivers must set
131this array to zero.</entry>
132 </row>
133 </tbody>
134 </tgroup>
135 </table>
136
137 <table pgwide="1" frame="none" id="device-capabilities">
138 <title>Device Capabilities Flags</title>
139 <tgroup cols="3">
140 &cs-def;
141 <tbody valign="top">
142 <row>
143 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
144 <entry>0x00000001</entry>
Pawel Osciakd39155d2011-01-16 13:53:31 -0300145 <entry>The device supports the single-planar API through the <link
146linkend="capture">Video Capture</link> interface.</entry>
Pawel Osciak53b5d572011-01-07 01:41:33 -0300147 </row>
148 <row>
149 <entry><constant>V4L2_CAP_VIDEO_CAPTURE_MPLANE</constant></entry>
150 <entry>0x00001000</entry>
Pawel Osciakd39155d2011-01-16 13:53:31 -0300151 <entry>The device supports the
152 <link linkend="planar-apis">multi-planar API</link> through the
153 <link linkend="capture">Video Capture</link> interface.</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300154 </row>
155 <row>
156 <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry>
157 <entry>0x00000002</entry>
Pawel Osciakd39155d2011-01-16 13:53:31 -0300158 <entry>The device supports the single-planar API through the <link
159linkend="output">Video Output</link> interface.</entry>
Pawel Osciak53b5d572011-01-07 01:41:33 -0300160 </row>
161 <row>
162 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant></entry>
163 <entry>0x00002000</entry>
Pawel Osciakd39155d2011-01-16 13:53:31 -0300164 <entry>The device supports the
165 <link linkend="planar-apis">multi-planar API</link> through the
166 <link linkend="output">Video Output</link> interface.</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300167 </row>
168 <row>
169 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
170 <entry>0x00000004</entry>
171 <entry>The device supports the <link
172linkend="overlay">Video Overlay</link> interface. A video overlay device
173typically stores captured images directly in the video memory of a
174graphics card, with hardware clipping and scaling.</entry>
175 </row>
176 <row>
177 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
178 <entry>0x00000010</entry>
179 <entry>The device supports the <link linkend="raw-vbi">Raw
180VBI Capture</link> interface, providing Teletext and Closed Caption
181data.</entry>
182 </row>
183 <row>
184 <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry>
185 <entry>0x00000020</entry>
186 <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry>
187 </row>
188 <row>
189 <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry>
190 <entry>0x00000040</entry>
191 <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry>
192 </row>
193 <row>
194 <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry>
195 <entry>0x00000080</entry>
196 <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry>
197 </row>
198 <row>
199 <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry>
200 <entry>0x00000100</entry>
Hans Verkuil0827d062010-09-11 08:39:47 -0300201 <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300202 </row>
203 <row>
204 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry>
205 <entry>0x00000200</entry>
206 <entry>The device supports the <link linkend="osd">Video
207Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
208Overlay</wordasword> interface, this is a secondary function of video
209output devices and overlays an image onto an outgoing video signal.
210When the driver sets this flag, it must clear the
211<constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
212versa.<footnote><para>The &v4l2-framebuffer; lacks an
213&v4l2-buf-type; field, therefore the type of overlay is implied by the
214driver capabilities.</para></footnote></entry>
215 </row>
216 <row>
217 <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry>
218 <entry>0x00000400</entry>
219 <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for
220hardware frequency seeking.</entry>
221 </row>
222 <row>
Hans Verkuil0827d062010-09-11 08:39:47 -0300223 <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry>
224 <entry>0x00000800</entry>
225 <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry>
226 </row>
227 <row>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300228 <entry><constant>V4L2_CAP_TUNER</constant></entry>
229 <entry>0x00010000</entry>
230 <entry>The device has some sort of tuner to
231receive RF-modulated video signals. For more information about
232tuner programming see
233<xref linkend="tuner" />.</entry>
234 </row>
235 <row>
236 <entry><constant>V4L2_CAP_AUDIO</constant></entry>
237 <entry>0x00020000</entry>
238 <entry>The device has audio inputs or outputs. It may or
239may not support audio recording or playback, in PCM or compressed
240formats. PCM audio support must be implemented as ALSA or OSS
241interface. For more information on audio inputs and outputs see <xref
242 linkend="audio" />.</entry>
243 </row>
244 <row>
245 <entry><constant>V4L2_CAP_RADIO</constant></entry>
246 <entry>0x00040000</entry>
247 <entry>This is a radio receiver.</entry>
248 </row>
249 <row>
250 <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
251 <entry>0x00080000</entry>
252 <entry>The device has some sort of modulator to
253emit RF-modulated video/audio signals. For more information about
254modulator programming see
255<xref linkend="tuner" />.</entry>
256 </row>
257 <row>
258 <entry><constant>V4L2_CAP_READWRITE</constant></entry>
259 <entry>0x01000000</entry>
260 <entry>The device supports the <link
261linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
262I/O methods.</entry>
263 </row>
264 <row>
265 <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
266 <entry>0x02000000</entry>
267 <entry>The device supports the <link
268linkend="async">asynchronous</link> I/O methods.</entry>
269 </row>
270 <row>
271 <entry><constant>V4L2_CAP_STREAMING</constant></entry>
272 <entry>0x04000000</entry>
273 <entry>The device supports the <link
274linkend="mmap">streaming</link> I/O method.</entry>
275 </row>
276 </tbody>
277 </tgroup>
278 </table>
279 </refsect1>
280
281 <refsect1>
282 &return-value;
283
284 <variablelist>
285 <varlistentry>
286 <term><errorcode>EINVAL</errorcode></term>
287 <listitem>
288 <para>The device is not compatible with this
289specification.</para>
290 </listitem>
291 </varlistentry>
292 </variablelist>
293 </refsect1>
294</refentry>
295
296<!--
297Local Variables:
298mode: sgml
299sgml-parent-document: "v4l2.sgml"
300indent-tabs-mode: nil
301End:
302-->
303