• 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>ioctl VIDIOC_QUERYCAP</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="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="ioctl VIDIOC_QUERYBUF"
17HREF="r13022.htm"><LINK
18REL="NEXT"
19TITLE="ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU"
20HREF="r13317.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
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="r13022.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="r13317.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="VIDIOC-QUERYCAP"
74></A
75>ioctl VIDIOC_QUERYCAP</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN13109"
80></A
81><H2
82>Name</H2
83>VIDIOC_QUERYCAP&nbsp;--&nbsp;Query device capabilities</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN13112"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><P
94></P
95><A
96NAME="AEN13113"
97></A
98><P
99><CODE
100><CODE
101CLASS="FUNCDEF"
102>int ioctl</CODE
103>(int fd, int request, struct v4l2_capability *argp);</CODE
104></P
105><P
106></P
107></DIV
108></DIV
109><DIV
110CLASS="REFSECT1"
111><A
112NAME="AEN13123"
113></A
114><H2
115>Arguments</H2
116><P
117></P
118><DIV
119CLASS="VARIABLELIST"
120><DL
121><DT
122><CODE
123CLASS="PARAMETER"
124>fd</CODE
125></DT
126><DD
127><P
128>File descriptor returned by <A
129HREF="r14090.htm"
130><CODE
131CLASS="FUNCTION"
132>open()</CODE
133></A
134>.</P
135></DD
136><DT
137><CODE
138CLASS="PARAMETER"
139>request</CODE
140></DT
141><DD
142><P
143>VIDIOC_QUERYCAP</P
144></DD
145><DT
146><CODE
147CLASS="PARAMETER"
148>argp</CODE
149></DT
150><DD
151><P
152></P
153></DD
154></DL
155></DIV
156></DIV
157><DIV
158CLASS="REFSECT1"
159><A
160NAME="AEN13143"
161></A
162><H2
163>Description</H2
164><P
165>All V4L2 devices support the
166<CODE
167CLASS="CONSTANT"
168>VIDIOC_QUERYCAP</CODE
169> ioctl. It is used to identify
170kernel devices compatible with this specification and to obtain
171information about driver and hardware capabilities. The ioctl takes a
172pointer to a struct&nbsp;<A
173HREF="r13105.htm#V4L2-CAPABILITY"
174>v4l2_capability</A
175> which is filled by the driver. When the
176driver is not compatible with this specification the ioctl returns an
177<SPAN
178CLASS="ERRORCODE"
179>EINVAL</SPAN
180> error code.</P
181><DIV
182CLASS="TABLE"
183><A
184NAME="V4L2-CAPABILITY"
185></A
186><P
187><B
188>Table 1. struct <CODE
189CLASS="STRUCTNAME"
190>v4l2_capability</CODE
191></B
192></P
193><TABLE
194BORDER="0"
195FRAME="void"
196WIDTH="100%"
197CLASS="CALSTABLE"
198><COL
199WIDTH="25%"
200TITLE="C1"><COL
201WIDTH="25%"
202TITLE="C2"><COL
203WIDTH="50%"
204TITLE="C3"><TBODY
205VALIGN="TOP"
206><TR
207><TD
208>__u8</TD
209><TD
210><CODE
211CLASS="STRUCTFIELD"
212>driver</CODE
213>[16]</TD
214><TD
215><P
216>Name of the driver, a unique NUL-terminated
217ASCII string. For example: "bttv". Driver specific applications can
218use this information to verify the driver identity. It is also useful
219to work around known bugs, or to identify drivers in error reports.
220The driver version is stored in the <CODE
221CLASS="STRUCTFIELD"
222>version</CODE
223>
224field.</P
225><P
226>Storing strings in fixed sized arrays is bad
227practice but unavoidable here. Drivers and applications should take
228precautions to never read or write beyond the end of the array and to
229make sure the strings are properly NUL-terminated.</P
230></TD
231></TR
232><TR
233><TD
234>__u8</TD
235><TD
236><CODE
237CLASS="STRUCTFIELD"
238>card</CODE
239>[32]</TD
240><TD
241>Name of the device, a NUL-terminated ASCII string.
242For example: "Yoyodyne TV/FM". One driver may support different brands
243or models of video hardware. This information is intended for users,
244for example in a menu of available devices. Since multiple TV cards of
245the same brand may be installed which are supported by the same
246driver, this name should be combined with the character device file
247name (e.&nbsp;g. <TT
248CLASS="FILENAME"
249>/dev/video2</TT
250>) or the
251<CODE
252CLASS="STRUCTFIELD"
253>bus_info</CODE
254> string to avoid
255ambiguities.</TD
256></TR
257><TR
258><TD
259>__u8</TD
260><TD
261><CODE
262CLASS="STRUCTFIELD"
263>bus_info</CODE
264>[32]</TD
265><TD
266>Location of the device in the system, a
267NUL-terminated ASCII string. For example: "PCI Slot 4". This
268information is intended for users, to distinguish multiple
269identical devices. If no such information is available the field may
270simply count the devices controlled by the driver, or contain the
271empty string (<CODE
272CLASS="STRUCTFIELD"
273>bus_info</CODE
274>[0] = 0).</TD
275></TR
276><TR
277><TD
278>__u32</TD
279><TD
280><CODE
281CLASS="STRUCTFIELD"
282>version</CODE
283></TD
284><TD
285><P
286>Version number of the driver. Together with
287the <CODE
288CLASS="STRUCTFIELD"
289>driver</CODE
290> field this identifies a
291particular driver. The version number is formatted using the
292<CODE
293CLASS="CONSTANT"
294>KERNEL_VERSION()</CODE
295> macro:</P
296></TD
297></TR
298><TR
299><TD
300COLSPAN="3"
301><P
302><PRE
303CLASS="PROGRAMLISTING"
304>#define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c))
305
306__u32 version = KERNEL_VERSION(0, 8, 1);
307
308printf ("Version: %u.%u.%u\n",
309        (version &gt;&gt; 16) &amp; 0xFF,
310        (version &gt;&gt; 8) &amp; 0xFF,
311         version &amp; 0xFF);</PRE
312></P
313></TD
314></TR
315><TR
316><TD
317>__u32</TD
318><TD
319><CODE
320CLASS="STRUCTFIELD"
321>capabilities</CODE
322></TD
323><TD
324>Device capabilities, see <A
325HREF="r13105.htm#DEVICE-CAPABILITIES"
326>Table 2</A
327>.</TD
328></TR
329><TR
330><TD
331>__u32</TD
332><TD
333><CODE
334CLASS="STRUCTFIELD"
335>reserved</CODE
336>[4]</TD
337><TD
338>Reserved for future extensions. Drivers must set
339this array to zero.</TD
340></TR
341></TBODY
342></TABLE
343></DIV
344><DIV
345CLASS="TABLE"
346><A
347NAME="DEVICE-CAPABILITIES"
348></A
349><P
350><B
351>Table 2. Device Capabilities Flags</B
352></P
353><TABLE
354BORDER="0"
355FRAME="void"
356WIDTH="100%"
357CLASS="CALSTABLE"
358><COL
359WIDTH="38%"
360TITLE="C1"><COL
361WIDTH="12%"
362TITLE="C2"><COL
363WIDTH="50%"
364TITLE="C3"><TBODY
365VALIGN="TOP"
366><TR
367><TD
368><CODE
369CLASS="CONSTANT"
370>V4L2_CAP_VIDEO_CAPTURE</CODE
371></TD
372><TD
373>0x00000001</TD
374><TD
375>The device supports the <A
376HREF="c6488.htm#CAPTURE"
377>Video Capture</A
378> interface.</TD
379></TR
380><TR
381><TD
382><CODE
383CLASS="CONSTANT"
384>V4L2_CAP_VIDEO_OUTPUT</CODE
385></TD
386><TD
387>0x00000002</TD
388><TD
389>The device supports the <A
390HREF="x6831.htm"
391>Video Output</A
392> interface.</TD
393></TR
394><TR
395><TD
396><CODE
397CLASS="CONSTANT"
398>V4L2_CAP_VIDEO_OVERLAY</CODE
399></TD
400><TD
401>0x00000004</TD
402><TD
403>The device supports the <A
404HREF="x6570.htm"
405>Video Overlay</A
406> interface. A video overlay device
407typically stores captured images directly in the video memory of a
408graphics card, with hardware clipping and scaling.</TD
409></TR
410><TR
411><TD
412><CODE
413CLASS="CONSTANT"
414>V4L2_CAP_VBI_CAPTURE</CODE
415></TD
416><TD
417>0x00000010</TD
418><TD
419>The device supports the <A
420HREF="x7013.htm"
421>Raw
422VBI Capture</A
423> interface, providing Teletext and Closed Caption
424data.</TD
425></TR
426><TR
427><TD
428><CODE
429CLASS="CONSTANT"
430>V4L2_CAP_VBI_OUTPUT</CODE
431></TD
432><TD
433>0x00000020</TD
434><TD
435>The device supports the <A
436HREF="x7013.htm"
437>Raw VBI Output</A
438> interface.</TD
439></TR
440><TR
441><TD
442><CODE
443CLASS="CONSTANT"
444>V4L2_CAP_SLICED_VBI_CAPTURE</CODE
445></TD
446><TD
447>0x00000040</TD
448><TD
449>The device supports the <A
450HREF="x7236.htm"
451>Sliced VBI Capture</A
452> interface.</TD
453></TR
454><TR
455><TD
456><CODE
457CLASS="CONSTANT"
458>V4L2_CAP_SLICED_VBI_OUTPUT</CODE
459></TD
460><TD
461>0x00000080</TD
462><TD
463>The device supports the <A
464HREF="x7236.htm"
465>Sliced VBI Output</A
466> interface.</TD
467></TR
468><TR
469><TD
470><CODE
471CLASS="CONSTANT"
472>V4L2_CAP_RDS_CAPTURE</CODE
473></TD
474><TD
475>0x00000100</TD
476><TD
477>[to be defined]</TD
478></TR
479><TR
480><TD
481><CODE
482CLASS="CONSTANT"
483>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</CODE
484></TD
485><TD
486>0x00000200</TD
487><TD
488>The device supports the <A
489HREF="x6909.htm"
490>Video
491Output Overlay</A
492> (OSD) interface. Unlike the <I
493CLASS="WORDASWORD"
494>Video
495Overlay</I
496> interface, this is a secondary function of video
497output devices and overlays an image onto an outgoing video signal.
498When the driver sets this flag, it must clear the
499<CODE
500CLASS="CONSTANT"
501>V4L2_CAP_VIDEO_OVERLAY</CODE
502> flag and vice
503versa.<A
504NAME="AEN13265"
505HREF="r13105.htm#FTN.AEN13265"
506><SPAN
507CLASS="footnote"
508>[a]</SPAN
509></A
510></TD
511></TR
512><TR
513><TD
514><CODE
515CLASS="CONSTANT"
516>V4L2_CAP_TUNER</CODE
517></TD
518><TD
519>0x00010000</TD
520><TD
521>The device has some sort of tuner or modulator to
522receive or emit RF-modulated video signals. For more information about
523tuner and modulator programming see
524<A
525HREF="x394.htm"
526>Section 1.6</A
527>.</TD
528></TR
529><TR
530><TD
531><CODE
532CLASS="CONSTANT"
533>V4L2_CAP_AUDIO</CODE
534></TD
535><TD
536>0x00020000</TD
537><TD
538>The device has audio inputs or outputs. It may or
539may not support audio recording or playback, in PCM or compressed
540formats. PCM audio support must be implemented as ALSA or OSS
541interface. For more information on audio inputs and outputs see <A
542HREF="x341.htm"
543>Section 1.5</A
544>.</TD
545></TR
546><TR
547><TD
548><CODE
549CLASS="CONSTANT"
550>V4L2_CAP_RADIO</CODE
551></TD
552><TD
553>0x00040000</TD
554><TD
555>This is a radio receiver.</TD
556></TR
557><TR
558><TD
559><CODE
560CLASS="CONSTANT"
561>V4L2_CAP_READWRITE</CODE
562></TD
563><TD
564>0x01000000</TD
565><TD
566>The device supports the <A
567HREF="c5742.htm#RW"
568>read()</A
569> and/or <A
570HREF="c5742.htm#RW"
571>write()</A
572>
573I/O methods.</TD
574></TR
575><TR
576><TD
577><CODE
578CLASS="CONSTANT"
579>V4L2_CAP_ASYNCIO</CODE
580></TD
581><TD
582>0x02000000</TD
583><TD
584>The device supports the <A
585HREF="x5950.htm"
586>asynchronous</A
587> I/O methods.</TD
588></TR
589><TR
590><TD
591><CODE
592CLASS="CONSTANT"
593>V4L2_CAP_STREAMING</CODE
594></TD
595><TD
596>0x04000000</TD
597><TD
598>The device supports the <A
599HREF="x5791.htm"
600>streaming</A
601> I/O method.</TD
602></TR
603></TBODY
604><TR
605><TD
606COLSPAN="3"
607>Notes:<BR><A
608NAME="FTN.AEN13265"
609>a. </A
610>The struct&nbsp;<A
611HREF="r10595.htm#V4L2-FRAMEBUFFER"
612>v4l2_framebuffer</A
613> lacks an
614enum&nbsp;<A
615HREF="x5953.htm#V4L2-BUF-TYPE"
616>v4l2_buf_type</A
617> field, therefore the type of overlay is implied by the
618driver capabilities.<BR></TD
619></TR
620></TABLE
621></DIV
622></DIV
623><DIV
624CLASS="REFSECT1"
625><A
626NAME="AEN13305"
627></A
628><H2
629>Return Value</H2
630><P
631>On success <SPAN
632CLASS="RETURNVALUE"
633>0</SPAN
634> is returned, on error <SPAN
635CLASS="RETURNVALUE"
636>-1</SPAN
637> and the <CODE
638CLASS="VARNAME"
639>errno</CODE
640> variable is set appropriately:</P
641><P
642></P
643><DIV
644CLASS="VARIABLELIST"
645><DL
646><DT
647><SPAN
648CLASS="ERRORCODE"
649>EINVAL</SPAN
650></DT
651><DD
652><P
653>The device is not compatible with this
654specification.</P
655></DD
656></DL
657></DIV
658></DIV
659><DIV
660CLASS="NAVFOOTER"
661><HR
662ALIGN="LEFT"
663WIDTH="100%"><TABLE
664SUMMARY="Footer navigation table"
665WIDTH="100%"
666BORDER="0"
667CELLPADDING="0"
668CELLSPACING="0"
669><TR
670><TD
671WIDTH="33%"
672ALIGN="left"
673VALIGN="top"
674><A
675HREF="r13022.htm"
676ACCESSKEY="P"
677>Prev</A
678></TD
679><TD
680WIDTH="34%"
681ALIGN="center"
682VALIGN="top"
683><A
684HREF="book1.htm"
685ACCESSKEY="H"
686>Home</A
687></TD
688><TD
689WIDTH="33%"
690ALIGN="right"
691VALIGN="top"
692><A
693HREF="r13317.htm"
694ACCESSKEY="N"
695>Next</A
696></TD
697></TR
698><TR
699><TD
700WIDTH="33%"
701ALIGN="left"
702VALIGN="top"
703>ioctl VIDIOC_QUERYBUF</TD
704><TD
705WIDTH="34%"
706ALIGN="center"
707VALIGN="top"
708><A
709HREF="r7624.htm"
710ACCESSKEY="U"
711>Up</A
712></TD
713><TD
714WIDTH="33%"
715ALIGN="right"
716VALIGN="top"
717>ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU</TD
718></TR
719></TABLE
720></DIV
721></BODY
722></HTML
723>
724