summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-01-26 17:30:39 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-29 08:54:04 +0000
commit5cf5e1e95ac7b01df4235475c2a1cdc9a4078b21 (patch)
treeff087bf819da2665c196e800d318cac81e6f2da4 /src/multimedia/platform
parent2fb1e26a780c4caf0ae6aef40fd6852275dc5765 (diff)
Get rid of QCameraViewFinderSettings
The outputs should control the camera settings that are required. Before one could define resolutions and framerates in several places, not it's the requested outputs that define it. Change-Id: Iab76abac84480e6200b9fc5b058fc2a02b0a8ce0 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/platform')
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp36
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h4
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp78
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h7
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp6
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcapturesession_p.h2
-rw-r--r--src/multimedia/platform/darwin/camera/avfcameracontrol.mm305
-rw-r--r--src/multimedia/platform/darwin/camera/avfcameracontrol_p.h15
-rw-r--r--src/multimedia/platform/darwin/camera/avfcamerasession.mm37
-rw-r--r--src/multimedia/platform/darwin/camera/avfcamerasession_p.h1
-rw-r--r--src/multimedia/platform/gstreamer/camerabin/camerabincontrol.cpp16
-rw-r--r--src/multimedia/platform/gstreamer/camerabin/camerabincontrol_p.h5
-rw-r--r--src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp72
-rw-r--r--src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h19
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp1
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol_p.h6
-rw-r--r--src/multimedia/platform/qnx/camera/bbcameraservice.cpp4
-rw-r--r--src/multimedia/platform/qnx/camera/bbcameraservice_p.h2
-rw-r--r--src/multimedia/platform/qnx/camera/bbcamerasession.cpp1
-rw-r--r--src/multimedia/platform/qnx/camera/bbcamerasession_p.h1
-rw-r--r--src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol.cpp245
-rw-r--r--src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol_p.h75
-rw-r--r--src/multimedia/platform/qnx/camera/camera.pri2
23 files changed, 22 insertions, 918 deletions
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
index 8bbf70d6f..62a548830 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
@@ -320,40 +320,4 @@ void QAndroidCameraControl::setExposureLockStatus(QCamera::LockStatus status, QC
emit lockStatusChanged(QCamera::LockExposure, m_exposureLockStatus, reason);
}
-QList<QCameraViewfinderSettings> QAndroidCameraControl::supportedViewfinderSettings() const
-{
- QList<QCameraViewfinderSettings> viewfinderSettings;
-
- const QList<QSize> previewSizes = m_cameraSession->getSupportedPreviewSizes();
- const QList<QVideoFrame::PixelFormat> pixelFormats = m_cameraSession->getSupportedPixelFormats();
- const QList<AndroidCamera::FpsRange> fpsRanges = m_cameraSession->getSupportedPreviewFpsRange();
-
- viewfinderSettings.reserve(previewSizes.size() * pixelFormats.size() * fpsRanges.size());
-
- for (const QSize& size : previewSizes) {
- for (QVideoFrame::PixelFormat pixelFormat : pixelFormats) {
- for (const AndroidCamera::FpsRange& fpsRange : fpsRanges) {
- QCameraViewfinderSettings s;
- s.setResolution(size);
- s.setPixelAspectRatio(QSize(1, 1));
- s.setPixelFormat(pixelFormat);
- s.setMinimumFrameRate(fpsRange.getMinReal());
- s.setMaximumFrameRate(fpsRange.getMaxReal());
- viewfinderSettings << s;
- }
- }
- }
- return viewfinderSettings;
-}
-
-QCameraViewfinderSettings QAndroidCameraControl::viewfinderSettings() const
-{
- return m_cameraSession->viewfinderSettings();
-}
-
-void QAndroidCameraControl::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- m_cameraSession->setViewfinderSettings(settings);
-}
-
QT_END_NAMESPACE
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
index bc913a2fa..77bcbf7ff 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
+++ b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
@@ -83,10 +83,6 @@ public:
void searchAndLock(QCamera::LockTypes locks) override;
void unlock(QCamera::LockTypes locks) override;
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override;
- QCameraViewfinderSettings viewfinderSettings() const override;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) override;
-
private Q_SLOTS:
void onCameraOpened();
void onCameraAutoFocusComplete(bool success);
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
index 3172ba7fd..280182281 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
@@ -103,7 +103,7 @@ void QAndroidCameraSession::setCaptureMode(QCamera::CaptureModes mode)
emit captureModeChanged(m_captureMode);
if (m_previewStarted && m_captureMode.testFlag(QCamera::CaptureStillImage))
- applyViewfinderSettings(m_actualImageSettings.resolution());
+ applyResolution(m_actualImageSettings.resolution());
}
bool QAndroidCameraSession::isCaptureModeSupported(QCamera::CaptureModes mode) const
@@ -229,7 +229,6 @@ void QAndroidCameraSession::close()
m_currentImageCaptureId = -1;
m_currentImageCaptureFileName.clear();
m_actualImageSettings = m_requestedImageSettings;
- m_actualViewfinderSettings = m_requestedViewfinderSettings;
m_camera->release();
delete m_camera;
@@ -257,18 +256,7 @@ void QAndroidCameraSession::setVideoOutput(QAndroidVideoOutput *output)
}
}
-void QAndroidCameraSession::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- if (m_requestedViewfinderSettings == settings)
- return;
-
- m_requestedViewfinderSettings = m_actualViewfinderSettings = settings;
-
- if (m_readyForCapture)
- applyViewfinderSettings();
-}
-
-void QAndroidCameraSession::applyViewfinderSettings(const QSize &captureSize, bool restartPreview)
+void QAndroidCameraSession::applyResolution(const QSize &captureSize, bool restartPreview)
{
if (!m_camera)
return;
@@ -293,12 +281,7 @@ void QAndroidCameraSession::applyViewfinderSettings(const QSize &captureSize, bo
const QList<QSize> previewSizes = m_camera->getSupportedPreviewSizes();
- const QSize vfRes = m_requestedViewfinderSettings.resolution();
- if (vfRes.width() > 0 && vfRes.height() > 0
- && (!validCaptureSize || qAbs(captureAspectRatio - (qreal(vfRes.width()) / vfRes.height())) < 0.01)
- && previewSizes.contains(vfRes)) {
- adjustedViewfinderResolution = vfRes;
- } else if (validCaptureSize) {
+ if (validCaptureSize) {
// search for viewfinder resolution with the same aspect ratio
qreal minAspectDiff = 1;
QSize closestResolution;
@@ -326,42 +309,14 @@ void QAndroidCameraSession::applyViewfinderSettings(const QSize &captureSize, bo
adjustedViewfinderResolution = previewSizes.last();
}
}
- m_actualViewfinderSettings.setResolution(adjustedViewfinderResolution);
// -- adjust pixel format
AndroidCamera::ImageFormat adjustedPreviewFormat = AndroidCamera::NV21;
- if (m_requestedViewfinderSettings.pixelFormat() != QVideoFrame::Format_Invalid) {
- const AndroidCamera::ImageFormat f = AndroidImageFormatFromQtPixelFormat(m_requestedViewfinderSettings.pixelFormat());
- if (f == AndroidCamera::UnknownImageFormat || !m_camera->getSupportedPreviewFormats().contains(f))
- qWarning("Unsupported viewfinder pixel format");
- else
- adjustedPreviewFormat = f;
- }
- m_actualViewfinderSettings.setPixelFormat(QtPixelFormatFromAndroidImageFormat(adjustedPreviewFormat));
// -- adjust FPS
AndroidCamera::FpsRange adjustedFps = currentFpsRange;
- const AndroidCamera::FpsRange requestedFpsRange = AndroidCamera::FpsRange::makeFromQReal(m_requestedViewfinderSettings.minimumFrameRate(),
- m_requestedViewfinderSettings.maximumFrameRate());
- if (requestedFpsRange.min > 0 || requestedFpsRange.max > 0) {
- int minDist = INT_MAX;
- const QList<AndroidCamera::FpsRange> supportedFpsRanges = m_camera->getSupportedPreviewFpsRange();
- auto it = supportedFpsRanges.rbegin(), end = supportedFpsRanges.rend();
- for (; it != end; ++it) {
- int dist = (requestedFpsRange.min > 0 ? qAbs(requestedFpsRange.min - it->min) : 0)
- + (requestedFpsRange.max > 0 ? qAbs(requestedFpsRange.max - it->max) : 0);
- if (dist < minDist) {
- minDist = dist;
- adjustedFps = *it;
- if (minDist == 0)
- break; // exact match
- }
- }
- }
- m_actualViewfinderSettings.setMinimumFrameRate(adjustedFps.getMinReal());
- m_actualViewfinderSettings.setMaximumFrameRate(adjustedFps.getMaxReal());
// -- Set values on camera
@@ -462,8 +417,8 @@ bool QAndroidCameraSession::startPreview()
emit statusChanged(m_status);
applyImageSettings();
- applyViewfinderSettings(m_captureMode.testFlag(QCamera::CaptureStillImage) ? m_actualImageSettings.resolution()
- : QSize());
+ if (m_captureMode.testFlag(QCamera::CaptureStillImage))
+ applyResolution(m_actualImageSettings.resolution());
AndroidMultimediaUtils::enableOrientationListener(true);
@@ -510,7 +465,7 @@ void QAndroidCameraSession::setImageSettings(const QImageEncoderSettings &settin
applyImageSettings();
if (m_readyForCapture && m_captureMode.testFlag(QCamera::CaptureStillImage))
- applyViewfinderSettings(m_actualImageSettings.resolution());
+ applyResolution(m_actualImageSettings.resolution());
}
int QAndroidCameraSession::currentCameraRotation() const
@@ -557,23 +512,8 @@ void QAndroidCameraSession::applyImageSettings()
const QSize requestedResolution = m_requestedImageSettings.resolution();
const QList<QSize> supportedResolutions = m_camera->getSupportedPictureSizes();
if (!requestedResolution.isValid()) {
- // if the viewfinder resolution is explicitly set, pick the highest available capture
- // resolution with the same aspect ratio
- if (m_requestedViewfinderSettings.resolution().isValid()) {
- const QSize vfResolution = m_actualViewfinderSettings.resolution();
- const qreal vfAspectRatio = qreal(vfResolution.width()) / vfResolution.height();
-
- auto it = supportedResolutions.rbegin(), end = supportedResolutions.rend();
- for (; it != end; ++it) {
- if (qAbs(vfAspectRatio - (qreal(it->width()) / it->height())) < 0.01) {
- m_actualImageSettings.setResolution(*it);
- break;
- }
- }
- } else {
- // otherwise, use the highest supported one
- m_actualImageSettings.setResolution(supportedResolutions.last());
- }
+ // use the highest supported one
+ m_actualImageSettings.setResolution(supportedResolutions.last());
} else if (!supportedResolutions.contains(requestedResolution)) {
// if the requested resolution is not supported, find the closest one
int reqPixelCount = requestedResolution.width() * requestedResolution.height();
@@ -664,7 +604,7 @@ int QAndroidCameraSession::capture(const QString &fileName)
m_currentImageCaptureFileName = fileName;
applyImageSettings();
- applyViewfinderSettings(m_actualImageSettings.resolution());
+ applyResolution(m_actualImageSettings.resolution());
// adjust picture rotation depending on the device orientation
m_camera->setRotation(currentCameraRotation());
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
index cd2382987..a946f535f 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
+++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
@@ -85,9 +85,7 @@ public:
void setCaptureMode(QCamera::CaptureModes mode);
bool isCaptureModeSupported(QCamera::CaptureModes mode) const;
- QCameraViewfinderSettings viewfinderSettings() const { return m_actualViewfinderSettings; }
- void setViewfinderSettings(const QCameraViewfinderSettings &settings);
- void applyViewfinderSettings(const QSize &captureSize = QSize(), bool restartPreview = true);
+ void applyResolution(const QSize &captureSize = QSize(), bool restartPreview = true);
QAndroidVideoOutput *videoOutput() const { return m_videoOutput; }
void setVideoOutput(QAndroidVideoOutput *output);
@@ -186,9 +184,6 @@ private:
QCamera::Status m_status;
bool m_previewStarted;
- QCameraViewfinderSettings m_requestedViewfinderSettings;
- QCameraViewfinderSettings m_actualViewfinderSettings;
-
QImageEncoderSettings m_requestedImageSettings;
QImageEncoderSettings m_actualImageSettings;
QCameraImageCapture::CaptureDestinations m_captureDestination;
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp
index 67f748994..64969a064 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp
@@ -221,7 +221,7 @@ void QAndroidCaptureSession::start()
// Set audio/video sources
if (m_cameraSession) {
- updateViewfinder();
+ updateResolution();
m_cameraSession->camera()->unlock();
m_mediaRecorder->setCamera(m_cameraSession->camera());
m_mediaRecorder->setAudioSource(AndroidMediaRecorder::Camcorder);
@@ -474,10 +474,10 @@ void QAndroidCaptureSession::applySettings()
}
}
-void QAndroidCaptureSession::updateViewfinder()
+void QAndroidCaptureSession::updateResolution()
{
m_cameraSession->camera()->stopPreviewSynchronous();
- m_cameraSession->applyViewfinderSettings(m_videoSettings.resolution(), false);
+ m_cameraSession->applyResolution(m_videoSettings.resolution(), false);
}
void QAndroidCaptureSession::restartViewfinder()
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcapturesession_p.h b/src/multimedia/platform/android/mediacapture/qandroidcapturesession_p.h
index 7ea469334..8e0067e93 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcapturesession_p.h
+++ b/src/multimedia/platform/android/mediacapture/qandroidcapturesession_p.h
@@ -151,7 +151,7 @@ private:
void setStatus(QMediaRecorder::Status status);
- void updateViewfinder();
+ void updateResolution();
void restartViewfinder();
AndroidMediaRecorder *m_mediaRecorder;
diff --git a/src/multimedia/platform/darwin/camera/avfcameracontrol.mm b/src/multimedia/platform/darwin/camera/avfcameracontrol.mm
index d340696f2..1a8051c46 100644
--- a/src/multimedia/platform/darwin/camera/avfcameracontrol.mm
+++ b/src/multimedia/platform/darwin/camera/avfcameracontrol.mm
@@ -154,140 +154,6 @@ void AVFCameraControl::unlock(QCamera::LockTypes locks)
Q_UNUSED(locks);
}
-
-namespace {
-
-bool qt_framerates_sane(const QCameraViewfinderSettings &settings)
-{
- const qreal minFPS = settings.minimumFrameRate();
- const qreal maxFPS = settings.maximumFrameRate();
-
- if (minFPS < 0. || maxFPS < 0.)
- return false;
-
- return !maxFPS || maxFPS >= minFPS;
-}
-
-}
-
-QList<QCameraViewfinderSettings> AVFCameraControl::supportedViewfinderSettings() const
-{
- QList<QCameraViewfinderSettings> supportedSettings;
-
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- if (!captureDevice) {
- qDebugCamera() << Q_FUNC_INFO << "no capture device found";
- return supportedSettings;
- }
-
- QVector<AVFPSRange> framerates;
-
- QVector<QVideoFrame::PixelFormat> pixelFormats(viewfinderPixelFormats());
-
- if (!pixelFormats.size())
- pixelFormats << QVideoFrame::Format_Invalid; // The default value.
-
- if (!captureDevice.formats || !captureDevice.formats.count) {
- qDebugCamera() << Q_FUNC_INFO << "no capture device formats found";
- return supportedSettings;
- }
-
- const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(captureDevice,
- m_service->session()->defaultCodec()));
- for (int i = 0; i < formats.size(); ++i) {
- AVCaptureDeviceFormat *format = formats[i];
-
- const QSize res(qt_device_format_resolution(format));
- if (res.isNull() || !res.isValid())
- continue;
- const QSize par(qt_device_format_pixel_aspect_ratio(format));
- if (par.isNull() || !par.isValid())
- continue;
-
- framerates = qt_device_format_framerates(format);
- if (!framerates.size())
- framerates << AVFPSRange(); // The default value.
-
- for (int i = 0; i < pixelFormats.size(); ++i) {
- for (int j = 0; j < framerates.size(); ++j) {
- QCameraViewfinderSettings newSet;
- newSet.setResolution(res);
- newSet.setPixelAspectRatio(par);
- newSet.setPixelFormat(pixelFormats[i]);
- newSet.setMinimumFrameRate(framerates[j].first);
- newSet.setMaximumFrameRate(framerates[j].second);
- supportedSettings << newSet;
- }
- }
- }
-
- return supportedSettings;
-}
-
-QCameraViewfinderSettings AVFCameraControl::viewfinderSettings() const
-{
- QCameraViewfinderSettings settings = m_settings;
-
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- if (!captureDevice) {
- qDebugCamera() << Q_FUNC_INFO << "no capture device found";
- return settings;
- }
-
- if (m_service->session()->state() != QCamera::LoadedState &&
- m_service->session()->state() != QCamera::ActiveState) {
- return settings;
- }
-
- if (!captureDevice.activeFormat) {
- qDebugCamera() << Q_FUNC_INFO << "no active capture device format";
- return settings;
- }
-
- const QSize res(qt_device_format_resolution(captureDevice.activeFormat));
- const QSize par(qt_device_format_pixel_aspect_ratio(captureDevice.activeFormat));
- if (res.isNull() || !res.isValid() || par.isNull() || !par.isValid()) {
- qDebugCamera() << Q_FUNC_INFO << "failed to obtain resolution/pixel aspect ratio";
- return settings;
- }
-
- settings.setResolution(res);
- settings.setPixelAspectRatio(par);
-
- const AVFPSRange fps = qt_current_framerates(captureDevice, videoConnection());
- settings.setMinimumFrameRate(fps.first);
- settings.setMaximumFrameRate(fps.second);
-
- AVCaptureVideoDataOutput *videoOutput = m_service->videoOutput() ? m_service->videoOutput()->videoDataOutput() : nullptr;
- if (videoOutput) {
- NSObject *obj = [videoOutput.videoSettings objectForKey:(id)kCVPixelBufferPixelFormatTypeKey];
- if (obj && [obj isKindOfClass:[NSNumber class]]) {
- NSNumber *nsNum = static_cast<NSNumber *>(obj);
- settings.setPixelFormat(QtPixelFormatFromCVFormat([nsNum unsignedIntValue]));
- }
- }
-
- return settings;
-}
-
-void AVFCameraControl::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- if (m_settings == settings)
- return;
-
- m_settings = settings;
-#if defined(Q_OS_IOS)
- bool active = m_service->session()->state() == QCamera::ActiveState;
- if (active)
- [m_service->session()->captureSession() beginConfiguration];
- applySettings(m_settings);
- if (active)
- [m_service->session()->captureSession() commitConfiguration];
-#else
- applySettings(m_settings);
-#endif
-}
-
QVideoFrame::PixelFormat AVFCameraControl::QtPixelFormatFromCVFormat(unsigned avPixelFormat)
{
// BGRA <-> ARGB "swap" is intentional:
@@ -356,177 +222,6 @@ bool AVFCameraControl::CVPixelFormatFromQtFormat(QVideoFrame::PixelFormat qtForm
return true;
}
-AVCaptureDeviceFormat *AVFCameraControl::findBestFormatMatch(const QCameraViewfinderSettings &settings) const
-{
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- if (!captureDevice || settings.isNull())
- return nil;
-
- const QSize &resolution = settings.resolution();
- if (!resolution.isNull() && resolution.isValid()) {
- // Either the exact match (including high resolution for images on iOS)
- // or a format with a resolution close to the requested one.
- return qt_find_best_resolution_match(captureDevice, resolution,
- m_service->session()->defaultCodec(), false);
- }
-
- // No resolution requested, what about framerates?
- if (!qt_framerates_sane(settings)) {
- qDebugCamera() << Q_FUNC_INFO << "invalid framerate requested (min/max):"
- << settings.minimumFrameRate() << settings.maximumFrameRate();
- return nil;
- }
-
- const qreal minFPS(settings.minimumFrameRate());
- const qreal maxFPS(settings.maximumFrameRate());
- if (minFPS || maxFPS)
- return qt_find_best_framerate_match(captureDevice,
- m_service->session()->defaultCodec(),
- maxFPS ? maxFPS : minFPS);
- // Ignore PAR for the moment (PAR without resolution can
- // pick a format with really bad resolution).
- // No need to test pixel format, just return settings.
-
- return nil;
-}
-
-QVector<QVideoFrame::PixelFormat> AVFCameraControl::viewfinderPixelFormats() const
-{
- QVector<QVideoFrame::PixelFormat> qtFormats;
-
- AVCaptureVideoDataOutput *videoOutput = m_service->videoOutput() ? m_service->videoOutput()->videoDataOutput() : nullptr;
- if (!videoOutput) {
- qDebugCamera() << Q_FUNC_INFO << "no video output found";
- return qtFormats;
- }
-
- NSArray *pixelFormats = [videoOutput availableVideoCVPixelFormatTypes];
-
- for (NSObject *obj in pixelFormats) {
- if (![obj isKindOfClass:[NSNumber class]])
- continue;
-
- NSNumber *formatAsNSNumber = static_cast<NSNumber *>(obj);
- // It's actually FourCharCode (== UInt32):
- const QVideoFrame::PixelFormat qtFormat(QtPixelFormatFromCVFormat([formatAsNSNumber unsignedIntValue]));
- if (qtFormat != QVideoFrame::Format_Invalid
- && !qtFormats.contains(qtFormat)) { // Can happen, for example, with 8BiPlanar existing in video/full range.
- qtFormats << qtFormat;
- }
- }
-
- return qtFormats;
-}
-
-bool AVFCameraControl::convertPixelFormatIfSupported(QVideoFrame::PixelFormat qtFormat,
- unsigned &avfFormat)const
-{
- AVCaptureVideoDataOutput *videoOutput = m_service->videoOutput() ? m_service->videoOutput()->videoDataOutput() : nullptr;
- if (!videoOutput)
- return false;
-
- unsigned conv = 0;
- if (!CVPixelFormatFromQtFormat(qtFormat, conv))
- return false;
-
- NSArray *formats = [videoOutput availableVideoCVPixelFormatTypes];
- if (!formats || !formats.count)
- return false;
-
- if (m_service->videoOutput()->surface()) {
- const QAbstractVideoSurface *surface = m_service->videoOutput()->surface();
- QAbstractVideoBuffer::HandleType h = m_service->videoOutput()->supportsTextures()
- ? QAbstractVideoBuffer::GLTextureHandle
- : QAbstractVideoBuffer::NoHandle;
- if (!surface->supportedPixelFormats(h).contains(qtFormat))
- return false;
- }
-
- bool found = false;
- for (NSObject *obj in formats) {
- if (![obj isKindOfClass:[NSNumber class]])
- continue;
-
- NSNumber *nsNum = static_cast<NSNumber *>(obj);
- if ([nsNum unsignedIntValue] == conv) {
- avfFormat = conv;
- found = true;
- }
- }
-
- return found;
-}
-
-bool AVFCameraControl::applySettings(const QCameraViewfinderSettings &settings)
-{
- if (m_service->session()->state() != QCamera::LoadedState &&
- m_service->session()->state() != QCamera::ActiveState) {
- return false;
- }
-
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- if (!captureDevice)
- return false;
-
- bool activeFormatChanged = false;
-
- AVCaptureDeviceFormat *match = findBestFormatMatch(settings);
- if (match) {
- activeFormatChanged = qt_set_active_format(captureDevice, match, false);
- } else {
- qDebugCamera() << Q_FUNC_INFO << "matching device format not found";
- // We still can update the pixel format at least.
- }
-
- AVCaptureVideoDataOutput *videoOutput = m_service->videoOutput() ? m_service->videoOutput()->videoDataOutput() : nullptr;
- if (videoOutput) {
- unsigned avfPixelFormat = 0;
- if (!convertPixelFormatIfSupported(settings.pixelFormat(), avfPixelFormat)) {
- // If the the pixel format is not specified or invalid, pick the preferred video surface
- // format, or if no surface is set, the preferred capture device format
-
- const QVector<QVideoFrame::PixelFormat> deviceFormats = viewfinderPixelFormats();
- QAbstractVideoSurface *surface = m_service->videoOutput()->surface();
- QVideoFrame::PixelFormat pickedFormat = deviceFormats.first();
- if (surface) {
- pickedFormat = QVideoFrame::Format_Invalid;
- QAbstractVideoBuffer::HandleType h = m_service->videoOutput()->supportsTextures()
- ? QAbstractVideoBuffer::GLTextureHandle
- : QAbstractVideoBuffer::NoHandle;
- QList<QVideoFrame::PixelFormat> surfaceFormats = surface->supportedPixelFormats(h);
- for (int i = 0; i < surfaceFormats.count(); ++i) {
- const QVideoFrame::PixelFormat surfaceFormat = surfaceFormats.at(i);
- if (deviceFormats.contains(surfaceFormat)) {
- pickedFormat = surfaceFormat;
- break;
- }
- }
- }
-
- CVPixelFormatFromQtFormat(pickedFormat, avfPixelFormat);
- }
-
- NSMutableDictionary *videoSettings = [NSMutableDictionary dictionaryWithCapacity:1];
- [videoSettings setObject:[NSNumber numberWithUnsignedInt:avfPixelFormat]
- forKey:(id)kCVPixelBufferPixelFormatTypeKey];
-
- const AVFConfigurationLock lock(captureDevice);
- if (!lock)
- qWarning("Failed to set active format (lock failed)");
-
- videoOutput.videoSettings = videoSettings;
- }
-
- qt_set_framerate_limits(captureDevice, videoConnection(), settings.minimumFrameRate(), settings.maximumFrameRate());
-
- return activeFormatChanged;
-}
-
-QCameraViewfinderSettings AVFCameraControl::requestedSettings() const
-{
- return m_settings;
-}
-
AVCaptureConnection *AVFCameraControl::videoConnection() const
{
if (!m_service->videoOutput() || !m_service->videoOutput()->videoDataOutput())
diff --git a/src/multimedia/platform/darwin/camera/avfcameracontrol_p.h b/src/multimedia/platform/darwin/camera/avfcameracontrol_p.h
index cc7c9418b..8a66e0579 100644
--- a/src/multimedia/platform/darwin/camera/avfcameracontrol_p.h
+++ b/src/multimedia/platform/darwin/camera/avfcameracontrol_p.h
@@ -89,24 +89,10 @@ public:
void searchAndLock(QCamera::LockTypes locks) override;
void unlock(QCamera::LockTypes locks) override;
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override;
- QCameraViewfinderSettings viewfinderSettings() const override;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) override;
-
// "Converters":
static QVideoFrame::PixelFormat QtPixelFormatFromCVFormat(unsigned avPixelFormat);
static bool CVPixelFormatFromQtFormat(QVideoFrame::PixelFormat qtFormat, unsigned &conv);
-private:
- void setResolution(const QSize &resolution);
- void setFramerate(qreal minFPS, qreal maxFPS, bool useActive);
- void setPixelFormat(QVideoFrame::PixelFormat newFormat);
- AVCaptureDeviceFormat *findBestFormatMatch(const QCameraViewfinderSettings &settings) const;
- QList<QVideoFrame::PixelFormat> viewfinderPixelFormats() const;
- bool convertPixelFormatIfSupported(QVideoFrame::PixelFormat format, unsigned &avfFormat) const;
- bool applySettings(const QCameraViewfinderSettings &settings);
- QCameraViewfinderSettings requestedSettings() const;
-
AVCaptureConnection *videoConnection() const;
private Q_SLOTS:
@@ -116,7 +102,6 @@ private:
friend class AVFCameraSession;
AVFCameraSession *m_session;
AVFCameraService *m_service;
- QCameraViewfinderSettings m_settings;
QCamera::State m_state;
QCamera::Status m_lastStatus;
diff --git a/src/multimedia/platform/darwin/camera/avfcamerasession.mm b/src/multimedia/platform/darwin/camera/avfcamerasession.mm
index aef0321f5..d1a5bcb29 100644
--- a/src/multimedia/platform/darwin/camera/avfcamerasession.mm
+++ b/src/multimedia/platform/darwin/camera/avfcamerasession.mm
@@ -202,9 +202,9 @@ void AVFCameraSession::setCapturePreviewOutput(AVFCameraWindowControl *output)
if (m_capturePreviewWindowOutput) {
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:m_captureSession];
m_capturePreviewWindowOutput->setLayer(previewLayer);
- if (auto *camera = m_service->cameraControl()) {
- m_capturePreviewWindowOutput->setNativeSize(camera->viewfinderSettings().resolution());
- }
+// if (auto *camera = m_service->cameraControl()) {
+// m_capturePreviewWindowOutput->setNativeSize(camera->viewfinderSettings().resolution());
+// }
}
}
@@ -243,8 +243,7 @@ void AVFCameraSession::setState(QCamera::State newState)
m_defaultCodec = 0;
defaultCodec();
- bool activeFormatSet = applyImageEncoderSettings()
- | applyViewfinderSettings();
+ bool activeFormatSet = applyImageEncoderSettings();
[m_captureSession commitConfiguration];
@@ -300,10 +299,8 @@ void AVFCameraSession::onCaptureModeChanged(QCamera::CaptureModes mode)
Q_UNUSED(mode);
const QCamera::State s = state();
- if (s == QCamera::LoadedState || s == QCamera::ActiveState) {
+ if (s == QCamera::LoadedState || s == QCamera::ActiveState)
applyImageEncoderSettings();
- applyViewfinderSettings();
- }
}
AVCaptureDevice *AVFCameraSession::createCaptureDevice()
@@ -360,30 +357,6 @@ bool AVFCameraSession::applyImageEncoderSettings()
return false;
}
-bool AVFCameraSession::applyViewfinderSettings()
-{
- if (auto *camera = m_service->cameraControl()) {
- QCamera::CaptureModes currentMode = m_service->cameraControl()->captureMode();
- QCameraViewfinderSettings vfSettings(camera->requestedSettings());
- // Viewfinder and image capture solutions must be the same, if an image capture
- // resolution is set, it takes precedence over the viewfinder resolution.
- if (currentMode.testFlag(QCamera::CaptureStillImage)) {
- const QSize imageResolution(m_service->imageEncoderControl()->requestedSettings().resolution());
- if (!imageResolution.isNull() && imageResolution.isValid())
- vfSettings.setResolution(imageResolution);
- }
-
- camera->applySettings(vfSettings);
-
- if (m_capturePreviewWindowOutput)
- m_capturePreviewWindowOutput->setNativeSize(camera->viewfinderSettings().resolution());
-
- return !vfSettings.isNull();
- }
-
- return false;
-}
-
FourCharCode AVFCameraSession::defaultCodec()
{
if (!m_defaultCodec) {
diff --git a/src/multimedia/platform/darwin/camera/avfcamerasession_p.h b/src/multimedia/platform/darwin/camera/avfcamerasession_p.h
index d1a61ee81..b3153c626 100644
--- a/src/multimedia/platform/darwin/camera/avfcamerasession_p.h
+++ b/src/multimedia/platform/darwin/camera/avfcamerasession_p.h
@@ -121,7 +121,6 @@ private:
AVCaptureDevice *createCaptureDevice();
void attachVideoInputDevice();
bool applyImageEncoderSettings();
- bool applyViewfinderSettings();
static int m_defaultCameraIndex;
QCameraInfo m_activeCameraInfo;
diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabincontrol.cpp b/src/multimedia/platform/gstreamer/camerabin/camerabincontrol.cpp
index 1cd1b1318..8abf38ce8 100644
--- a/src/multimedia/platform/gstreamer/camerabin/camerabincontrol.cpp
+++ b/src/multimedia/platform/gstreamer/camerabin/camerabincontrol.cpp
@@ -214,7 +214,6 @@ bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera:
case QCameraControl::CaptureMode:
case QCameraControl::ImageEncodingSettings:
case QCameraControl::VideoEncodingSettings:
- case QCameraControl::ViewfinderSettings:
default:
return status != QCamera::ActiveStatus;
}
@@ -421,19 +420,4 @@ void CameraBinControl::unlockWhiteBalance(
emit lockStatusChanged(QCamera::LockWhiteBalance, status, reason);
}
-QList<QCameraViewfinderSettings> CameraBinControl::supportedViewfinderSettings() const
-{
- return m_session->supportedViewfinderSettings();
-}
-
-QCameraViewfinderSettings CameraBinControl::viewfinderSettings() const
-{
- return m_session->viewfinderSettings();
-}
-
-void CameraBinControl::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- m_session->setViewfinderSettings(settings);
-}
-
QT_END_NAMESPACE
diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabincontrol_p.h b/src/multimedia/platform/gstreamer/camerabin/camerabincontrol_p.h
index 164a3e7f1..46f0a2934 100644
--- a/src/multimedia/platform/gstreamer/camerabin/camerabincontrol_p.h
+++ b/src/multimedia/platform/gstreamer/camerabin/camerabincontrol_p.h
@@ -90,11 +90,6 @@ public:
void searchAndLock(QCamera::LockTypes locks) override;
void unlock(QCamera::LockTypes locks) override;
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override;
-
- QCameraViewfinderSettings viewfinderSettings() const override;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) override;
-
public slots:
void reloadLater();
void setViewfinderColorSpaceConversion(bool enabled);
diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp b/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp
index 84113ec85..2348bedd7 100644
--- a/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp
@@ -308,6 +308,7 @@ static GstCaps *resolutionToCaps(const QSize &resolution,
return caps;
}
+#if 0
void CameraBinSession::setupCaptureResolution()
{
QSize viewfinderResolution = m_viewfinderSettings.resolution();
@@ -404,6 +405,7 @@ void CameraBinSession::setupCaptureResolution()
if (m_videoEncoder)
m_videoEncodeControl->applySettings(m_videoEncoder);
}
+#endif
void CameraBinSession::setAudioCaptureCaps()
{
@@ -663,68 +665,6 @@ void CameraBinSession::setViewfinder(QObject *viewfinder)
}
}
-static QList<QCameraViewfinderSettings> capsToViewfinderSettings(GstCaps *supportedCaps)
-{
- QList<QCameraViewfinderSettings> settings;
-
- if (!supportedCaps)
- return settings;
-
- supportedCaps = qt_gst_caps_normalize(supportedCaps);
-
- // Convert caps to QCameraViewfinderSettings
- for (uint i = 0; i < gst_caps_get_size(supportedCaps); ++i) {
- const GstStructure *structure = gst_caps_get_structure(supportedCaps, i);
-
- QCameraViewfinderSettings s;
- s.setResolution(QGstUtils::structureResolution(structure));
- s.setPixelFormat(QGstUtils::structurePixelFormat(structure));
- s.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(structure));
-
- QPair<qreal, qreal> frameRateRange = QGstUtils::structureFrameRateRange(structure);
- s.setMinimumFrameRate(frameRateRange.first);
- s.setMaximumFrameRate(frameRateRange.second);
-
- if (!s.resolution().isEmpty()
- && s.pixelFormat() != QVideoFrame::Format_Invalid
- && !settings.contains(s)) {
- settings.append(s);
- }
- }
-
- gst_caps_unref(supportedCaps);
- return settings;
-}
-
-QList<QCameraViewfinderSettings> CameraBinSession::supportedViewfinderSettings() const
-{
- if (m_status >= QCamera::LoadedStatus && m_supportedViewfinderSettings.isEmpty()) {
- m_supportedViewfinderSettings =
- capsToViewfinderSettings(supportedCaps(QCamera::CaptureViewfinder));
- }
-
- return m_supportedViewfinderSettings;
-}
-
-QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const
-{
- return m_status == QCamera::ActiveStatus ? m_actualViewfinderSettings : m_viewfinderSettings;
-}
-
-void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps)
-{
- QGstreamerBufferProbe::probeCaps(caps);
-
- // Update actual viewfinder settings on viewfinder caps change
- const GstStructure *s = gst_caps_get_structure(caps, 0);
- const QPair<qreal, qreal> frameRate = QGstUtils::structureFrameRateRange(s);
- session->m_actualViewfinderSettings.setResolution(QGstUtils::structureResolution(s));
- session->m_actualViewfinderSettings.setMinimumFrameRate(frameRate.first);
- session->m_actualViewfinderSettings.setMaximumFrameRate(frameRate.second);
- session->m_actualViewfinderSettings.setPixelFormat(QGstUtils::structurePixelFormat(s));
- session->m_actualViewfinderSettings.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(s));
-}
-
void CameraBinSession::handleViewfinderChange()
{
//the viewfinder will be reloaded
@@ -849,8 +789,6 @@ void CameraBinSession::unload()
if (m_busy)
emit busyChanged(m_busy = false);
- m_supportedViewfinderSettings.clear();
-
setStatus(QCamera::UnloadedStatus);
}
@@ -863,7 +801,7 @@ void CameraBinSession::start()
setAudioCaptureCaps();
- setupCaptureResolution();
+// setupCaptureResolution();
gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
}
@@ -1090,9 +1028,6 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
setStatus(QCamera::UnloadedStatus);
break;
case GST_STATE_READY:
- if (oldState == GST_STATE_NULL)
- m_supportedViewfinderSettings.clear();
-
setMetaData(m_metaData);
setStatus(QCamera::LoadedStatus);
break;
@@ -1220,7 +1155,6 @@ GstCaps *CameraBinSession::supportedCaps(QCamera::CaptureModes mode) const
case QCamera::CaptureVideo:
prop = SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY;
break;
- case QCamera::CaptureViewfinder:
default:
prop = SUPPORTED_VIEWFINDER_CAPS_PROPERTY;
break;
diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h b/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h
index 27cedc59c..bb9abef72 100644
--- a/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h
+++ b/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h
@@ -148,10 +148,6 @@ public:
QObject *viewfinder() const { return m_viewfinder; }
void setViewfinder(QObject *viewfinder);
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const;
- QCameraViewfinderSettings viewfinderSettings() const;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) { m_viewfinderSettings = settings; }
-
void captureImage(int requestId, const QString &fileName);
QCamera::Status status() const;
@@ -231,9 +227,6 @@ private:
QGstreamerElementFactory *m_videoInputFactory;
QObject *m_viewfinder;
QGstreamerVideoRendererInterface *m_viewfinderInterface;
- mutable QList<QCameraViewfinderSettings> m_supportedViewfinderSettings;
- QCameraViewfinderSettings m_viewfinderSettings;
- QCameraViewfinderSettings m_actualViewfinderSettings;
CameraBinControl *m_cameraControl;
CameraBinAudioEncoder *m_audioEncodeControl;
@@ -258,18 +251,6 @@ private:
bool m_inputDeviceHasChanged;
bool m_usingWrapperCameraBinSrc;
- class ViewfinderProbe : public QGstreamerBufferProbe {
- public:
- ViewfinderProbe(CameraBinSession *s)
- : session(s)
- {}
-
- void probeCaps(GstCaps *caps) override;
-
- private:
- CameraBinSession * const session;
- } m_viewfinderProbe;
-
GstElement *m_audioSrc;
GstElement *m_audioConvert;
GstElement *m_capsFilter;
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp
index 34d1b7331..ef3e46f3f 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp
@@ -80,7 +80,6 @@ void QGstreamerCameraControl::setCaptureMode(QCamera::CaptureModes mode)
m_captureMode = mode;
switch (mode) {
- case QCamera::CaptureViewfinder:
case QCamera::CaptureStillImage:
m_session->setCaptureMode(QGstreamerCaptureSession::Image);
break;
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol_p.h
index 2e7e4ce29..618439b4c 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol_p.h
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol_p.h
@@ -91,12 +91,6 @@ public:
void searchAndLock(QCamera::LockTypes /*locks*/) override {}
void unlock(QCamera::LockTypes /*locks*/) override {}
-
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override { return {}; }
-
- QCameraViewfinderSettings viewfinderSettings() const override { return {}; }
- void setViewfinderSettings(const QCameraViewfinderSettings &/*settings*/) override {}
-
public slots:
void reloadLater();
diff --git a/src/multimedia/platform/qnx/camera/bbcameraservice.cpp b/src/multimedia/platform/qnx/camera/bbcameraservice.cpp
index bed555dc4..a5137c33e 100644
--- a/src/multimedia/platform/qnx/camera/bbcameraservice.cpp
+++ b/src/multimedia/platform/qnx/camera/bbcameraservice.cpp
@@ -47,7 +47,6 @@
#include "bbcameramediarecordercontrol_p.h"
#include "bbcamerasession_p.h"
#include "bbcameravideoencodersettingscontrol_p.h"
-#include "bbcameraviewfindersettingscontrol_p.h"
#include "bbimageencodercontrol_p.h"
#include "bbvideorenderercontrol_p.h"
@@ -67,7 +66,6 @@ BbCameraService::BbCameraService(QObject *parent)
, m_cameraImageProcessingControl(new BbCameraImageProcessingControl(m_cameraSession, this))
, m_cameraMediaRecorderControl(new BbCameraMediaRecorderControl(m_cameraSession, this))
, m_cameraVideoEncoderSettingsControl(new BbCameraVideoEncoderSettingsControl(m_cameraSession, this))
- , m_cameraViewfinderSettingsControl(new BbCameraViewfinderSettingsControl(m_cameraSession, this))
, m_imageEncoderControl(new BbImageEncoderControl(m_cameraSession, this))
, m_videoRendererControl(new BbVideoRendererControl(m_cameraSession, this))
{
@@ -95,8 +93,6 @@ QMediaControl* BbCameraService::requestControl(const char *name)
return m_cameraMediaRecorderControl;
else if (qstrcmp(name, QVideoEncoderSettingsControl_iid) == 0)
return m_cameraVideoEncoderSettingsControl;
- else if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
- return m_cameraViewfinderSettingsControl;
else if (qstrcmp(name, QImageEncoderControl_iid) == 0)
return m_imageEncoderControl;
else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
diff --git a/src/multimedia/platform/qnx/camera/bbcameraservice_p.h b/src/multimedia/platform/qnx/camera/bbcameraservice_p.h
index 548b85fce..e1a9016e1 100644
--- a/src/multimedia/platform/qnx/camera/bbcameraservice_p.h
+++ b/src/multimedia/platform/qnx/camera/bbcameraservice_p.h
@@ -65,7 +65,6 @@ class BbCameraImageProcessingControl;
class BbCameraMediaRecorderControl;
class BbCameraSession;
class BbCameraVideoEncoderSettingsControl;
-class BbCameraViewfinderSettingsControl;
class BbImageEncoderControl;
class BbVideoRendererControl;
@@ -91,7 +90,6 @@ private:
BbCameraImageProcessingControl* m_cameraImageProcessingControl;
BbCameraMediaRecorderControl* m_cameraMediaRecorderControl;
BbCameraVideoEncoderSettingsControl* m_cameraVideoEncoderSettingsControl;
- BbCameraViewfinderSettingsControl* m_cameraViewfinderSettingsControl;
BbImageEncoderControl* m_imageEncoderControl;
BbVideoRendererControl* m_videoRendererControl;
};
diff --git a/src/multimedia/platform/qnx/camera/bbcamerasession.cpp b/src/multimedia/platform/qnx/camera/bbcamerasession.cpp
index 866a9bb09..7c96d1898 100644
--- a/src/multimedia/platform/qnx/camera/bbcamerasession.cpp
+++ b/src/multimedia/platform/qnx/camera/bbcamerasession.cpp
@@ -39,7 +39,6 @@
#include "bbcamerasession_p.h"
#include "bbcameraorientationhandler_p.h"
-#include "bbcameraviewfindersettingscontrol_p.h"
#include "windowgrabber_p.h"
#include <QAbstractVideoSurface>
diff --git a/src/multimedia/platform/qnx/camera/bbcamerasession_p.h b/src/multimedia/platform/qnx/camera/bbcamerasession_p.h
index e49951141..fea041071 100644
--- a/src/multimedia/platform/qnx/camera/bbcamerasession_p.h
+++ b/src/multimedia/platform/qnx/camera/bbcamerasession_p.h
@@ -54,7 +54,6 @@
#include <QCamera>
#include <QCameraImageCapture>
-#include <QCameraViewfinderSettingsControl>
#include <QElapsedTimer>
#include <QMediaRecorder>
#include <QMutex>
diff --git a/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol.cpp b/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol.cpp
deleted file mode 100644
index ada52ab6b..000000000
--- a/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "bbcameraviewfindersettingscontrol_p.h"
-
-#include "bbcamerasession_p.h"
-
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-BbCameraViewfinderSettingsControl::BbCameraViewfinderSettingsControl(BbCameraSession *session, QObject *parent)
- : QCameraViewfinderSettingsControl(parent)
- , m_session(session)
-{
-}
-
-bool BbCameraViewfinderSettingsControl::isViewfinderParameterSupported(ViewfinderParameter parameter) const
-{
- switch (parameter) {
- case QCameraViewfinderSettingsControl::Resolution:
- return true;
- case QCameraViewfinderSettingsControl::PixelAspectRatio:
- return false;
- case QCameraViewfinderSettingsControl::MinimumFrameRate:
- return true;
- case QCameraViewfinderSettingsControl::MaximumFrameRate:
- return true;
- case QCameraViewfinderSettingsControl::PixelFormat:
- return true;
- default:
- return false;
- }
-}
-
-QVariant BbCameraViewfinderSettingsControl::viewfinderParameter(ViewfinderParameter parameter) const
-{
- if (parameter == QCameraViewfinderSettingsControl::Resolution) {
- camera_error_t result = CAMERA_EOK;
- unsigned int width = 0;
- unsigned int height = 0;
-
- if (m_session->captureMode() & QCamera::CaptureStillImage) {
- result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, &width,
- CAMERA_IMGPROP_HEIGHT, &height);
- } else if (m_session->captureMode() & QCamera::CaptureVideo) {
- result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, &width,
- CAMERA_IMGPROP_HEIGHT, &height);
- }
-
- if (result != CAMERA_EOK) {
- qWarning() << "Unable to retrieve resolution of viewfinder:" << result;
- return QVariant();
- }
-
- return QSize(width, height);
-
- } else if (parameter == QCameraViewfinderSettingsControl::MinimumFrameRate) {
- camera_error_t result = CAMERA_EOK;
- double minimumFrameRate = 0;
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, &minimumFrameRate);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, &minimumFrameRate);
-
- if (result != CAMERA_EOK) {
- qWarning() << "Unable to retrieve minimum framerate of viewfinder:" << result;
- return QVariant();
- }
-
- return QVariant(static_cast<qreal>(minimumFrameRate));
-
- } else if (parameter == QCameraViewfinderSettingsControl::MaximumFrameRate) {
- camera_error_t result = CAMERA_EOK;
- double maximumFrameRate = 0;
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, &maximumFrameRate);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, &maximumFrameRate);
-
- if (result != CAMERA_EOK) {
- qWarning() << "Unable to retrieve maximum framerate of viewfinder:" << result;
- return QVariant();
- }
-
- return QVariant(static_cast<qreal>(maximumFrameRate));
- } else if (parameter == QCameraViewfinderSettingsControl::PixelFormat) {
- camera_error_t result = CAMERA_EOK;
- camera_frametype_t format = CAMERA_FRAMETYPE_UNSPECIFIED;
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, &format);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, &format);
-
- if (result != CAMERA_EOK) {
- qWarning() << "Unable to retrieve pixel format of viewfinder:" << result;
- return QVariant();
- }
-
- switch (format) {
- case CAMERA_FRAMETYPE_UNSPECIFIED:
- return QVideoFrame::Format_Invalid;
- case CAMERA_FRAMETYPE_NV12:
- return QVideoFrame::Format_NV12;
- case CAMERA_FRAMETYPE_RGB8888:
- return QVideoFrame::Format_ARGB32;
- case CAMERA_FRAMETYPE_RGB888:
- return QVideoFrame::Format_RGB24;
- case CAMERA_FRAMETYPE_JPEG:
- return QVideoFrame::Format_Jpeg;
- case CAMERA_FRAMETYPE_GRAY8:
- return QVideoFrame::Format_Y8;
- case CAMERA_FRAMETYPE_METADATA:
- return QVideoFrame::Format_Invalid;
- case CAMERA_FRAMETYPE_BAYER:
- return QVideoFrame::Format_Invalid;
- case CAMERA_FRAMETYPE_CBYCRY:
- return QVideoFrame::Format_Invalid;
- case CAMERA_FRAMETYPE_COMPRESSEDVIDEO:
- return QVideoFrame::Format_Invalid;
- case CAMERA_FRAMETYPE_COMPRESSEDAUDIO:
- return QVideoFrame::Format_Invalid;
- default:
- return QVideoFrame::Format_Invalid;
- }
- }
-
- return QVariant();
-}
-
-void BbCameraViewfinderSettingsControl::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value)
-{
- if (parameter == QCameraViewfinderSettingsControl::Resolution) {
- camera_error_t result = CAMERA_EOK;
- const QSize size = value.toSize();
-
- if (m_session->captureMode() & QCamera::CaptureStillImage) {
- result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, size.width(),
- CAMERA_IMGPROP_HEIGHT, size.height());
- } else if (m_session->captureMode() & QCamera::CaptureVideo) {
- result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, size.width(),
- CAMERA_IMGPROP_HEIGHT, size.height());
- }
-
- if (result != CAMERA_EOK)
- qWarning() << "Unable to set resolution of viewfinder:" << result;
-
- } else if (parameter == QCameraViewfinderSettingsControl::MinimumFrameRate) {
- camera_error_t result = CAMERA_EOK;
- const double minimumFrameRate = value.toReal();
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, minimumFrameRate);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, minimumFrameRate);
-
- if (result != CAMERA_EOK)
- qWarning() << "Unable to set minimum framerate of viewfinder:" << result;
-
- } else if (parameter == QCameraViewfinderSettingsControl::MaximumFrameRate) {
- camera_error_t result = CAMERA_EOK;
- const double maximumFrameRate = value.toReal();
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, maximumFrameRate);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, maximumFrameRate);
-
- if (result != CAMERA_EOK)
- qWarning() << "Unable to set maximum framerate of viewfinder:" << result;
-
- } else if (parameter == QCameraViewfinderSettingsControl::PixelFormat) {
- camera_error_t result = CAMERA_EOK;
- camera_frametype_t format = CAMERA_FRAMETYPE_UNSPECIFIED;
-
- switch (value.value<QVideoFrame::PixelFormat>()) {
- case QVideoFrame::Format_NV12:
- format = CAMERA_FRAMETYPE_NV12;
- break;
- case QVideoFrame::Format_ARGB32:
- format = CAMERA_FRAMETYPE_RGB8888;
- break;
- case QVideoFrame::Format_RGB24:
- format = CAMERA_FRAMETYPE_RGB888;
- break;
- case QVideoFrame::Format_Jpeg:
- format = CAMERA_FRAMETYPE_JPEG;
- break;
- case QVideoFrame::Format_Y8:
- format = CAMERA_FRAMETYPE_GRAY8;
- break;
- default:
- format = CAMERA_FRAMETYPE_UNSPECIFIED;
- break;
- }
-
- if (m_session->captureMode() & QCamera::CaptureStillImage)
- result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, format);
- else if (m_session->captureMode() & QCamera::CaptureVideo)
- result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, format);
-
- if (result != CAMERA_EOK)
- qWarning() << "Unable to set pixel format of viewfinder:" << result;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol_p.h b/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol_p.h
deleted file mode 100644
index a41ff3001..000000000
--- a/src/multimedia/platform/qnx/camera/bbcameraviewfindersettingscontrol_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef BBCAMERAVIEWVINDERSETTINGSCONTROL_H
-#define BBCAMERAVIEWVINDERSETTINGSCONTROL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcameraviewfindersettingscontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class BbCameraSession;
-
-class BbCameraViewfinderSettingsControl : public QCameraViewfinderSettingsControl
-{
- Q_OBJECT
-public:
- explicit BbCameraViewfinderSettingsControl(BbCameraSession *session, QObject *parent = 0);
-
- bool isViewfinderParameterSupported(ViewfinderParameter parameter) const override;
- QVariant viewfinderParameter(ViewfinderParameter parameter) const override;
- void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value) override;
-
-private:
- BbCameraSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/multimedia/platform/qnx/camera/camera.pri b/src/multimedia/platform/qnx/camera/camera.pri
index 2bbe764bd..49dc5b778 100644
--- a/src/multimedia/platform/qnx/camera/camera.pri
+++ b/src/multimedia/platform/qnx/camera/camera.pri
@@ -12,7 +12,6 @@ HEADERS += \
$$PWD/bbcameraservice_p.h \
$$PWD/bbcamerasession_p.h \
$$PWD/bbcameravideoencodersettingscontrol_p.h \
- $$PWD/bbcameraviewfindersettingscontrol_p.h \
$$PWD/bbimageencodercontrol_p.h \
$$PWD/bbmediastoragelocation_p.h \
$$PWD/bbvideorenderercontrol_p.h
@@ -29,7 +28,6 @@ SOURCES += \
$$PWD/bbcameraservice.cpp \
$$PWD/bbcamerasession.cpp \
$$PWD/bbcameravideoencodersettingscontrol.cpp \
- $$PWD/bbcameraviewfindersettingscontrol.cpp \
$$PWD/bbimageencodercontrol.cpp \
$$PWD/bbmediastoragelocation.cpp \
$$PWD/bbvideorenderercontrol.cpp