From 0e161675e6014faeeaa490a9c73a62c1577c674e Mon Sep 17 00:00:00 2001 From: Libor Tomsik Date: Tue, 24 Feb 2015 13:51:34 +0100 Subject: Fixing camera enumeration on hotplug Emptying camera HW devices buffer when it becomes obsolete (500ms). Leaving the list filled was causing video cameras to keep on the list even when the camera was unplugged. Or vice versa, empty after the camera was plugged into the system. Change-Id: I3b38a0b327553cbb6e18dd5421cdde3ded1b7895 Reviewed-by: Yoann Lopes --- src/gsttools/qgstutils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index 1281d3fc5..465f43989 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef USE_V4L # include @@ -411,6 +412,10 @@ Q_GLOBAL_STATIC(FactoryCameraInfoMap, qt_camera_device_info); QVector QGstUtils::enumerateCameras(GstElementFactory *factory) { + static QElapsedTimer camerasCacheAgeTimer; + if (camerasCacheAgeTimer.isValid() && camerasCacheAgeTimer.elapsed() > 500) // ms + qt_camera_device_info()->clear(); + FactoryCameraInfoMap::const_iterator it = qt_camera_device_info()->constFind(factory); if (it != qt_camera_device_info()->constEnd()) return *it; @@ -469,6 +474,7 @@ QVector QGstUtils::enumerateCameras(GstElementFactory *fa } if (!devices.isEmpty() || !hasVideoSource) { + camerasCacheAgeTimer.restart(); return devices; } } @@ -527,6 +533,7 @@ QVector QGstUtils::enumerateCameras(GstElementFactory *fa } qt_safe_close(fd); } + camerasCacheAgeTimer.restart(); #endif // USE_V4L return devices; -- cgit v1.2.3 From f39d8b73ee36de7dea09c2acdc9853d821cb1f93 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 27 Feb 2015 00:31:59 +0100 Subject: Check for the quick module before adding the videonode plugin Change-Id: I050356086f5d82221968016754eb01c1b8f35490 Reviewed-by: Yoann Lopes --- src/plugins/plugins.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index aa28bdd1b..dc1979187 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -6,7 +6,11 @@ TEMPLATE = subdirs -SUBDIRS += m3u videonode +SUBDIRS += m3u + +qtHaveModule(quick) { + SUBDIRS += videonode +} android { SUBDIRS += android opensles -- cgit v1.2.3