diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-09-29 16:13:53 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-10-20 12:51:28 +0000 |
commit | 038e22078b3ba665ae9519bf5c630b86064b301e (patch) | |
tree | 5f9669adb19b51737358f472d304b042f4123291 /src/plugins/avfoundation/camera/avfimagecapturecontrol.h | |
parent | 5b3cd2f8b132a8665d37ceabac3fe8828799788b (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/avfimagecapturecontrol.h')
-rw-r--r-- | src/plugins/avfoundation/camera/avfimagecapturecontrol.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/plugins/avfoundation/camera/avfimagecapturecontrol.h b/src/plugins/avfoundation/camera/avfimagecapturecontrol.h index 993725653..1fee8164c 100644 --- a/src/plugins/avfoundation/camera/avfimagecapturecontrol.h +++ b/src/plugins/avfoundation/camera/avfimagecapturecontrol.h @@ -36,19 +36,24 @@ #import <AVFoundation/AVFoundation.h> +#include <QtCore/qqueue.h> +#include <QtCore/qsemaphore.h> #include <QtMultimedia/qcameraimagecapturecontrol.h> +#include <private/qvideooutputorientationhandler_p.h> +#include "avfcamerasession.h" #include "avfstoragelocation.h" QT_BEGIN_NAMESPACE -class AVFCameraSession; -class AVFCameraService; -class AVFCameraControl; - class AVFImageCaptureControl : public QCameraImageCaptureControl { Q_OBJECT public: + struct CaptureRequest { + int captureId; + QSemaphore *previewReady; + }; + AVFImageCaptureControl(AVFCameraService *service, QObject *parent = 0); ~AVFImageCaptureControl(); @@ -64,8 +69,11 @@ public: private Q_SLOTS: void updateCaptureConnection(); void updateReadyStatus(); + void onNewViewfinderFrame(const QVideoFrame &frame); private: + void makeCapturePreview(CaptureRequest request, const QVideoFrame &frame, AVFCameraInfo cameraInfo, int screenOrientation); + AVFCameraSession *m_session; AVFCameraControl *m_cameraControl; bool m_ready; @@ -73,8 +81,14 @@ private: AVCaptureStillImageOutput *m_stillImageOutput; AVCaptureConnection *m_videoConnection; AVFStorageLocation m_storageLocation; + QVideoOutputOrientationHandler m_orientationHandler; + + QMutex m_requestsMutex; + QQueue<CaptureRequest> m_captureRequests; }; +Q_DECLARE_TYPEINFO(AVFImageCaptureControl::CaptureRequest, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif |