summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcamerasession.mm
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-09-29 16:13:53 +0200
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-10-20 12:51:28 +0000
commit038e22078b3ba665ae9519bf5c630b86064b301e (patch)
tree5f9669adb19b51737358f472d304b042f4123291 /src/plugins/avfoundation/camera/avfcamerasession.mm
parent5b3cd2f8b132a8665d37ceabac3fe8828799788b (diff)
AVFoundation: fix camera capture previews.
Generate the preview from a viewfinder frame and not from the final JPG image. In addition, the preview is now rotated to always be in the same orientation as the device at the time of capture. Task-number: QTBUG-46971 Change-Id: I48851225738e50fbd89c2f94904bac366303a9ad Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcamerasession.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcamerasession.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm
index 83f8c0ed3..66dc43d81 100644
--- a/src/plugins/avfoundation/camera/avfcamerasession.mm
+++ b/src/plugins/avfoundation/camera/avfcamerasession.mm
@@ -333,6 +333,7 @@ void AVFCameraSession::attachVideoInputDevice()
[m_captureSession removeInput:m_videoInput];
[m_videoInput release];
m_videoInput = 0;
+ m_activeCameraInfo = AVFCameraInfo();
}
AVCaptureDevice *videoDevice = m_service->videoDeviceControl()->createCaptureDevice();
@@ -346,6 +347,7 @@ void AVFCameraSession::attachVideoInputDevice()
qWarning() << "Failed to create video device input";
} else {
if ([m_captureSession canAddInput:m_videoInput]) {
+ m_activeCameraInfo = m_cameraDevices.at(m_service->videoDeviceControl()->selectedDevice());
[m_videoInput retain];
[m_captureSession addInput:m_videoInput];
} else {
@@ -414,6 +416,8 @@ FourCharCode AVFCameraSession::defaultCodec()
void AVFCameraSession::onCameraFrameFetched(const QVideoFrame &frame)
{
+ Q_EMIT newViewfinderFrame(frame);
+
m_videoProbesMutex.lock();
QSet<AVFMediaVideoProbeControl *>::const_iterator i = m_videoProbes.constBegin();
while (i != m_videoProbes.constEnd()) {