diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-13 13:10:48 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-13 13:10:48 +0100 |
commit | f9014d136f504c6377d1329c822f11a8b58ccdbe (patch) | |
tree | 1c1a752d8ba6b5094b182305d65ca0d0101e1ed0 /src/plugins/directshow/dsserviceplugin.cpp | |
parent | bbfccc713546f9e7341fbe1af7482cafbdc4ea25 (diff) | |
parent | 06259f1dfbd9cb2ebd58bba59381a42dc8a758df (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I5575a4ba13212c9bfe73a3de3ef17c6528beafc3
Diffstat (limited to 'src/plugins/directshow/dsserviceplugin.cpp')
-rw-r--r-- | src/plugins/directshow/dsserviceplugin.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp index 9e2883fda..66c1b657f 100644 --- a/src/plugins/directshow/dsserviceplugin.cpp +++ b/src/plugins/directshow/dsserviceplugin.cpp @@ -39,6 +39,7 @@ #include "dsvideodevicecontrol.h" #ifdef QMEDIA_DIRECTSHOW_CAMERA +#include <QtCore/QElapsedTimer> #include <dshow.h> #include "dscameraservice.h" #endif @@ -121,8 +122,7 @@ QByteArray DSServicePlugin::defaultDevice(const QByteArray &service) const { #ifdef QMEDIA_DIRECTSHOW_CAMERA if (service == Q_MEDIASERVICE_CAMERA) { - if (m_cameraDevices.isEmpty()) - updateDevices(); + updateDevices(); return m_defaultCameraDevice; } @@ -135,8 +135,7 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const { #ifdef QMEDIA_DIRECTSHOW_CAMERA if (service == Q_MEDIASERVICE_CAMERA) { - if (m_cameraDevices.isEmpty()) - updateDevices(); + updateDevices(); return m_cameraDevices; } @@ -149,8 +148,7 @@ QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByt { #ifdef QMEDIA_DIRECTSHOW_CAMERA if (service == Q_MEDIASERVICE_CAMERA) { - if (m_cameraDevices.isEmpty()) - updateDevices(); + updateDevices(); for (int i=0; i<m_cameraDevices.count(); i++) if (m_cameraDevices[i] == device) @@ -164,6 +162,10 @@ QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByt void DSServicePlugin::updateDevices() const { + static QElapsedTimer timer; + if (timer.isValid() && timer.elapsed() < 500) // ms + return; + addRefCount(); m_defaultCameraDevice.clear(); @@ -176,6 +178,7 @@ void DSServicePlugin::updateDevices() const } releaseRefCount(); + timer.restart(); } #endif |