#include <QtCore/qset.h>
#include <QtCore/qstringlist.h>
#include <qaudioformat.h>
+#include <QtCore/qelapsedtimer.h>
#ifdef USE_V4L
# include <private/qcore_unix_p.h>
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;
}
if (!devices.isEmpty() || !hasVideoSource) {
+ camerasCacheAgeTimer.restart();
return devices;
}
}
}
qt_safe_close(fd);
}
+ camerasCacheAgeTimer.restart();
#endif // USE_V4L
return devices;