summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcamerasession.mm
diff options
context:
space:
mode:
authorLudger Krämer <kraemer@dem-gmbh.de>2014-09-09 13:46:20 +0200
committerYoann Lopes <yoann.lopes@digia.com>2014-09-12 17:57:52 +0200
commit762ff94f67a58df6c7c6315268ea64a2d2151f95 (patch)
tree7f446cf1ddfd1a67336af320d846578e92351c5d /src/plugins/avfoundation/camera/avfcamerasession.mm
parent9267a7833c6c30ccd4cbda3d087f0f901fb462eb (diff)
implement QVideoProbe for iOS camera
This commit allows to use QVideoProbe for QCamera on iOS. The logic for the implementation is taken from the Android plugin. [ChangeLog][Platform Specific Changes][iOS] QVideoProbe support is implemented for QCamera on iOS Change-Id: I1db50defa8518287c4f1f3cc6602881702a95849 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcamerasession.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcamerasession.mm27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm
index a72ef5041..3c58c25d6 100644
--- a/src/plugins/avfoundation/camera/avfcamerasession.mm
+++ b/src/plugins/avfoundation/camera/avfcamerasession.mm
@@ -46,6 +46,7 @@
#include "avfvideorenderercontrol.h"
#include "avfvideodevicecontrol.h"
#include "avfaudioinputselectorcontrol.h"
+#include "avfmediavideoprobecontrol.h"
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
@@ -371,4 +372,30 @@ void AVFCameraSession::attachInputDevices()
}
}
+void AVFCameraSession::addProbe(AVFMediaVideoProbeControl *probe)
+{
+ m_videoProbesMutex.lock();
+ if (probe)
+ m_videoProbes << probe;
+ m_videoProbesMutex.unlock();
+}
+
+void AVFCameraSession::removeProbe(AVFMediaVideoProbeControl *probe)
+{
+ m_videoProbesMutex.lock();
+ m_videoProbes.remove(probe);
+ m_videoProbesMutex.unlock();
+}
+
+void AVFCameraSession::onCameraFrameFetched(const QVideoFrame &frame)
+{
+ m_videoProbesMutex.lock();
+ QSet<AVFMediaVideoProbeControl *>::const_iterator i = m_videoProbes.constBegin();
+ while (i != m_videoProbes.constEnd()) {
+ (*i)->newFrameProbed(frame);
+ ++i;
+ }
+ m_videoProbesMutex.unlock();
+}
+
#include "moc_avfcamerasession.cpp"