summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm
index cf13635f0..1fa1df99e 100644
--- a/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm
+++ b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm
@@ -167,19 +167,13 @@ private:
int width = CVPixelBufferGetWidth(imageBuffer);
int height = CVPixelBufferGetHeight(imageBuffer);
+ QVideoFrame::PixelFormat format =
+ AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat(CVPixelBufferGetPixelFormatType(imageBuffer));
- QAbstractVideoBuffer *buffer = new CVPixelBufferVideoBuffer(imageBuffer);
-
- 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]);
- }
- }
+ if (format == QVideoFrame::Format_Invalid)
+ return;
- QVideoFrame frame(buffer, QSize(width, height), format);
+ QVideoFrame frame(new CVPixelBufferVideoBuffer(imageBuffer), QSize(width, height), format);
m_renderer->syncHandleViewfinderFrame(frame);
}
@end
@@ -229,12 +223,6 @@ void AVFCameraRendererControl::configureAVCaptureSession(AVFCameraSession *camer
queue:queue];
dispatch_release(queue);
- // Specify the pixel format
- m_videoDataOutput.videoSettings =
- [NSDictionary dictionaryWithObject:
- [NSNumber numberWithInt:kCVPixelFormatType_32BGRA]
- forKey:(id)kCVPixelBufferPixelFormatTypeKey];
-
[m_cameraSession->captureSession() addOutput:m_videoDataOutput];
}