summaryrefslogtreecommitdiffstats
path: root/src/plugins/directshow/camera/dscamerasession.cpp
diff options
context:
space:
mode:
authorChristian Stromme <christian.stromme@qt.io>2016-12-06 18:25:24 +0100
committerChristian Stromme <christian.stromme@qt.io>2018-01-22 20:50:21 +0000
commite2bcf5d44e5f0217605c3fdf9b1e7c0b4a3bee73 (patch)
treeaec6f075971ab21bb99ab1f8abdc28fea0b4bec9 /src/plugins/directshow/camera/dscamerasession.cpp
parentc20d3fa8c42d3ea0a088f208b55dfc66b58f6674 (diff)
DirectShow: Add video probe support for the camera
This change makes it possible to use the QVideoProbe class with the camera. [ChangeLog][DirectShow] Added support for video probes in the camera. Change-Id: Ib353e80e68ea2dcc5b33fd81863f4b6613257e45 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/directshow/camera/dscamerasession.cpp')
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
index 82125d4f6..9b642872a 100644
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ b/src/plugins/directshow/camera/dscamerasession.cpp
@@ -51,6 +51,7 @@
#include "directshowcameraglobal.h"
#include "directshowmediatype.h"
#include "directshowutils.h"
+#include "directshowvideoprobecontrol.h"
QT_BEGIN_NAMESPACE
@@ -70,6 +71,7 @@ DSCameraSession::DSCameraSession(QObject *parent)
, m_imageIdCounter(0)
, m_currentImageId(-1)
, m_captureDestinations(QCameraImageCapture::CaptureToFile)
+ , m_videoProbeControl(nullptr)
, m_status(QCamera::UnloadedStatus)
{
connect(this, SIGNAL(statusChanged(QCamera::Status)),
@@ -374,6 +376,20 @@ void DSCameraSession::setCaptureDestination(QCameraImageCapture::CaptureDestinat
Q_EMIT captureDestinationChanged(m_captureDestinations);
}
+void DSCameraSession::addVideoProbe(DirectShowVideoProbeControl *probe)
+{
+ const QMutexLocker locker(&m_probeMutex);
+ m_videoProbeControl = probe;
+}
+
+void DSCameraSession::removeVideoProbe(DirectShowVideoProbeControl *probe)
+{
+ Q_UNUSED(probe);
+ Q_ASSERT(m_videoProbeControl == probe);
+ const QMutexLocker locker(&m_probeMutex);
+ m_videoProbeControl = nullptr;
+}
+
bool DSCameraSession::load()
{
unload();
@@ -567,6 +583,12 @@ void DSCameraSession::onFrameAvailable(double time, const QByteArray &data)
m_presentMutex.unlock();
+ {
+ const QMutexLocker locker(&m_probeMutex);
+ if (m_currentFrame.isValid() && m_videoProbeControl)
+ Q_EMIT m_videoProbeControl->videoFrameProbed(m_currentFrame);
+ }
+
// Image capture
QMutexLocker locker(&m_captureMutex);
if (m_currentImageId != -1 && !m_capturedFrame.isValid()) {