Commit 862566a2 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

avicap32: Verify v4l devices can capture before returning them.

/dev/video* device nodes aren't all capture devices, and returning those that aren't results in devenum reporting them to applications, which will later fail when opening them with IMoniker::BindToObject(). avicap32 already tries to call VIDIOC_QUERYCAP to check whether it's dealing with a v4l device, but it does not check a successful result any further. Get it to verify the device supports the V4L2_CAP_VIDEO_CAPTURE flag, like we do in qcap/v4l.c. Signed-off-by: 's avatarDamjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2e9a036f
......@@ -128,11 +128,18 @@ static BOOL query_video_device(int devnum, char *name, int namesize, char *versi
memset(&caps, 0, sizeof(caps));
if (xioctl(fd, VIDIOC_QUERYCAP, &caps) != -1) {
lstrcpynA(name, (char *)caps.card, namesize);
snprintf(version, versionsize, "%s v%u.%u.%u", (char *)caps.driver, (caps.version >> 16) & 0xFF,
BOOL isCaptureDevice;
if (caps.capabilities & V4L2_CAP_DEVICE_CAPS)
isCaptureDevice = caps.device_caps & V4L2_CAP_VIDEO_CAPTURE;
else
isCaptureDevice = caps.capabilities & V4L2_CAP_VIDEO_CAPTURE;
if (isCaptureDevice) {
lstrcpynA(name, (char *)caps.card, namesize);
snprintf(version, versionsize, "%s v%u.%u.%u", (char *)caps.driver, (caps.version >> 16) & 0xFF,
(caps.version >> 8) & 0xFF, caps.version & 0xFF);
}
close(fd);
return TRUE;
return isCaptureDevice;
}
if (errno != EINVAL && errno != 515)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment