File descriptor returned by
All V4L2 devices support the
VIDIOC_QUERYCAP ioctl. It is used to identify
kernel devices compatible with this specification and to obtain
information about driver and hardware capabilities. The ioctl takes a
pointer to a struct v4l2_capability which is filled by the driver. When the
driver is not compatible with this specification the ioctl returns an
EINVAL error code.
Table 1. struct
Name of the driver, a unique NUL-terminated
ASCII string. For example: "bttv". Driver specific applications can
use this information to verify the driver identity. It is also useful
to work around known bugs, or to identify drivers in error reports.
The driver version is stored in the
Storing strings in fixed sized arrays is bad practice but unavoidable here. Drivers and applications should take precautions to never read or write beyond the end of the array and to make sure the strings are properly NUL-terminated.
|__u8||Name of the device, a NUL-terminated ASCII string.
For example: "Yoyodyne TV/FM". One driver may support different brands
or models of video hardware. This information is intended for users,
for example in a menu of available devices. Since multiple TV cards of
the same brand may be installed which are supported by the same
driver, this name should be combined with the character device file
name (e. g. /dev/video2) or the
|__u8||Location of the device in the system, a
NUL-terminated ASCII string. For example: "PCI Slot 4". This
information is intended for users, to distinguish multiple
identical devices. If no such information is available the field may
simply count the devices controlled by the driver, or contain the
empty string (|
Version number of the driver. Together with
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) __u32 version = KERNEL_VERSION(0, 8, 1); printf ("Version: %u.%u.%u\n", (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
|__u32||Device capabilities, see Table 2.|
|__u32||Reserved for future extensions. Drivers must set this array to zero.|
Table 2. Device Capabilities Flags
|0x00000001||The device supports the Video Capture interface.|
|0x00000002||The device supports the Video Output interface.|
|0x00000004||The device supports the Video Overlay interface. A video overlay device typically stores captured images directly in the video memory of a graphics card, with hardware clipping and scaling.|
|0x00000010||The device supports the Raw VBI Capture interface, providing Teletext and Closed Caption data.|
|0x00000020||The device supports the Raw VBI Output interface.|
|0x00000040||The device supports the Sliced VBI Capture interface.|
|0x00000080||The device supports the Sliced VBI Output interface.|
|0x00000100||[to be defined]|
|0x00000200||The device supports the Video
Output Overlay (OSD) interface. Unlike the Video
Overlay interface, this is a secondary function of video
output devices and overlays an image onto an outgoing video signal.
When the driver sets this flag, it must clear the
|0x00010000||The device has some sort of tuner or modulator to receive or emit RF-modulated video signals. For more information about tuner and modulator programming see Section 1.6.|
|0x00020000||The device has audio inputs or outputs. It may or may not support audio recording or playback, in PCM or compressed formats. PCM audio support must be implemented as ALSA or OSS interface. For more information on audio inputs and outputs see Section 1.5.|
|0x00040000||This is a radio receiver.|
|0x01000000||The device supports the read() and/or write() I/O methods.|
|0x02000000||The device supports the asynchronous I/O methods.|
|0x04000000||The device supports the streaming I/O method.|
a. The struct v4l2_framebuffer lacks an enum v4l2_buf_type field, therefore the type of overlay is implied by the driver capabilities.
On success 0 is returned, on error -1 and the
errno variable is set appropriately:
The device is not compatible with this specification.