diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-03-03 18:18:12 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-03-03 18:18:12 +0100 |
commit | b348c9e7b0896f4eda4453c53bfffd5219489cbb (patch) | |
tree | 2f383b223fd3ba1a8faac28c4576652ec61d34d9 /src/gsttools | |
parent | 33b27c3c15aaca611d5ed0164afa3cd2e9f891a7 (diff) | |
parent | f39d8b73ee36de7dea09c2acdc9853d821cb1f93 (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
src/gsttools/qgstutils.cpp
Change-Id: Ic54ab6c6560ded0db4b98f83256d997bee828083
Diffstat (limited to 'src/gsttools')
-rw-r--r-- | src/gsttools/qgstutils.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index 55a0be1e4..61ba09e76 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -42,6 +42,7 @@ #include <QtCore/qstringlist.h> #include <QtGui/qimage.h> #include <qaudioformat.h> +#include <QtCore/qelapsedtimer.h> #include <QtMultimedia/qvideosurfaceformat.h> #include <gst/audio/audio.h> @@ -510,6 +511,10 @@ Q_GLOBAL_STATIC(FactoryCameraInfoMap, qt_camera_device_info); QVector<QGstUtils::CameraInfo> 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; @@ -568,6 +573,7 @@ QVector<QGstUtils::CameraInfo> QGstUtils::enumerateCameras(GstElementFactory *fa } if (!devices.isEmpty() || !hasVideoSource) { + camerasCacheAgeTimer.restart(); return devices; } } @@ -626,6 +632,7 @@ QVector<QGstUtils::CameraInfo> QGstUtils::enumerateCameras(GstElementFactory *fa } qt_safe_close(fd); } + camerasCacheAgeTimer.restart(); #endif // USE_V4L return devices; |