diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2015-01-28 17:51:19 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-03-02 12:44:29 +0000 |
commit | 0d783b730372ffaeebc22e882a3c65d83445932f (patch) | |
tree | 2d388856787e2e335b645e57f8320246561184ab /src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm | |
parent | d27f493df06fb19125f5cd8010831a33b7f35ba8 (diff) | |
download | qtmultimedia-0d783b730372ffaeebc22e882a3c65d83445932f.tar.gz |
Viewfinder settings control (2) - version for iOS/OS X
QCameraViewfinderSettingsControl2 - version for AV foundation plugin
(the new settings control interface implemented).
Change-Id: I3fbfb87925e57c914d43eb711fa5422e26981207
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm')
-rw-r--r-- | src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm index 05edd0a91..87bfeb82a 100644 --- a/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm +++ b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm @@ -31,6 +31,7 @@ ** ****************************************************************************/ +#include "avfcameraviewfindersettingscontrol.h" #include "avfcamerarenderercontrol.h" #include "avfcamerasession.h" #include "avfcameraservice.h" @@ -129,7 +130,17 @@ private: int height = CVPixelBufferGetHeight(imageBuffer); QAbstractVideoBuffer *buffer = new CVPixelBufferVideoBuffer(imageBuffer); - QVideoFrame frame(buffer, QSize(width, height), QVideoFrame::Format_RGB32); + + QVideoFrame::PixelFormat format = QVideoFrame::Format_RGB32; + if ([captureOutput isKindOfClass:[AVCaptureVideoDataOutput class]]) { + NSDictionary *settings = ((AVCaptureVideoDataOutput *)captureOutput).videoSettings; + if (settings && [settings objectForKey:(id)kCVPixelBufferPixelFormatTypeKey]) { + NSNumber *avf = [settings objectForKey:(id)kCVPixelBufferPixelFormatTypeKey]; + format = AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat([avf unsignedIntValue]); + } + } + + QVideoFrame frame(buffer, QSize(width, height), format); m_renderer->syncHandleViewfinderFrame(frame); } @end @@ -236,6 +247,11 @@ void AVFCameraRendererControl::syncHandleViewfinderFrame(const QVideoFrame &fram m_cameraSession->onCameraFrameFetched(m_lastViewfinderFrame); } +AVCaptureVideoDataOutput *AVFCameraRendererControl::videoDataOutput() const +{ + return m_videoDataOutput; +} + void AVFCameraRendererControl::handleViewfinderFrame() { QVideoFrame frame; |