From 09b41d0cfb09c01f9325ab0a65fa607c6537a5c6 Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Mon, 2 Oct 2017 14:45:04 +0200 Subject: GStreamer: Fix V4L input query The last ioctl argument expect a pointer to an integer, not the integer value itself. Also, the ioctl call will return 0 on success, or ENOTTY if the input can't be select, both indicating that the device is a camera. Task-number: QTBUG-62245 Change-Id: Ifcf2d30b11ae204036b43daae664f917aaed83ed Reviewed-by: Christian Stromme --- src/gsttools/qgstutils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index 96bd09f86..06181403e 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -642,7 +642,8 @@ QVector QGstUtils::enumerateCameras(GstElementFactory *fa memset(&input, 0, sizeof(input)); for (; ::ioctl(fd, VIDIOC_ENUMINPUT, &input) >= 0; ++input.index) { if (input.type == V4L2_INPUT_TYPE_CAMERA || input.type == 0) { - isCamera = ::ioctl(fd, VIDIOC_S_INPUT, input.index) != 0; + const int ret = ::ioctl(fd, VIDIOC_S_INPUT, &input.index); + isCamera = (ret == 0 || errno == ENOTTY); break; } } -- cgit v1.2.3