summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--src/imports/multimedia/CMakeLists.txt1
-rw-r--r--src/imports/multimedia/multimedia.cpp3
-rw-r--r--src/imports/multimedia/multimedia.pro2
-rw-r--r--src/imports/multimedia/qdeclarativecamera.cpp95
-rw-r--r--src/imports/multimedia/qdeclarativecamera_p.h10
-rw-r--r--src/imports/multimedia/qdeclarativecameraviewfinder.cpp125
-rw-r--r--src/imports/multimedia/qdeclarativecameraviewfinder_p.h96
-rw-r--r--src/multimedia/CMakeLists.txt2
-rw-r--r--src/multimedia/camera/camera.pri2
-rw-r--r--src/multimedia/camera/qcamera.cpp229
-rw-r--r--src/multimedia/camera/qcamera.h50
-rw-r--r--src/multimedia/camera/qcameraviewfindersettings.cpp309
-rw-r--r--src/multimedia/camera/qcameraviewfindersettings.h104
-rw-r--r--src/multimedia/controls/qcameracontrol.h6
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/camera.cpp14
-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
-rw-r--r--tests/auto/unit/mockbackend/mockcameracontrol.h60
-rw-r--r--tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp580
40 files changed, 59 insertions, 2569 deletions
diff --git a/src/imports/multimedia/CMakeLists.txt b/src/imports/multimedia/CMakeLists.txt
index ec3ef3f19..55b1234a9 100644
--- a/src/imports/multimedia/CMakeLists.txt
+++ b/src/imports/multimedia/CMakeLists.txt
@@ -19,7 +19,6 @@ qt_internal_add_qml_module(declarative_multimedia
qdeclarativecameraimageprocessing.cpp qdeclarativecameraimageprocessing_p.h
qdeclarativecamerapreviewprovider.cpp qdeclarativecamerapreviewprovider_p.h
qdeclarativecamerarecorder.cpp qdeclarativecamerarecorder_p.h
- qdeclarativecameraviewfinder.cpp qdeclarativecameraviewfinder_p.h
qdeclarativemediametadata_p.h
qdeclarativemultimediaglobal.cpp qdeclarativemultimediaglobal_p.h
qdeclarativeplaylist.cpp qdeclarativeplaylist_p.h
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index 1f91182bf..94efe2c5f 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -56,7 +56,6 @@
#include "qdeclarativecameraflash_p.h"
#include "qdeclarativecamerafocus_p.h"
#include "qdeclarativecameraimageprocessing_p.h"
-#include "qdeclarativecameraviewfinder_p.h"
#include "qdeclarativetorch_p.h"
#include <QAbstractVideoSurface>
@@ -112,8 +111,6 @@ public:
// 5.4 types
qmlRegisterSingletonType<QDeclarativeMultimediaGlobal>(uri, 5, 4, "QtMultimedia", multimedia_global_object);
qmlRegisterType<QDeclarativeCamera, 1>(uri, 5, 4, "Camera");
- qmlRegisterUncreatableType<QDeclarativeCameraViewfinder>(uri, 5, 4, "CameraViewfinder",
- tr("CameraViewfinder is provided by Camera"));
// 5.5 types
qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing, 1>(uri, 5, 5, "CameraImageProcessing", tr("CameraImageProcessing is provided by Camera"));
diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro
index 076d13b09..990ae40f1 100644
--- a/src/imports/multimedia/multimedia.pro
+++ b/src/imports/multimedia/multimedia.pro
@@ -18,7 +18,6 @@ HEADERS += \
qdeclarativecameraimageprocessing_p.h \
qdeclarativecamerapreviewprovider_p.h \
qdeclarativetorch_p.h \
- qdeclarativecameraviewfinder_p.h \
qdeclarativemultimediaglobal_p.h
SOURCES += \
@@ -34,7 +33,6 @@ SOURCES += \
qdeclarativecameraimageprocessing.cpp \
qdeclarativecamerapreviewprovider.cpp \
qdeclarativetorch.cpp \
- qdeclarativecameraviewfinder.cpp \
qdeclarativemultimediaglobal.cpp
QML_FILES += \
diff --git a/src/imports/multimedia/qdeclarativecamera.cpp b/src/imports/multimedia/qdeclarativecamera.cpp
index 9c4004ef6..8b90d99c6 100644
--- a/src/imports/multimedia/qdeclarativecamera.cpp
+++ b/src/imports/multimedia/qdeclarativecamera.cpp
@@ -44,7 +44,6 @@
#include "qdeclarativecameraflash_p.h"
#include "qdeclarativecamerafocus_p.h"
#include "qdeclarativecameraimageprocessing_p.h"
-#include "qdeclarativecameraviewfinder_p.h"
#include "qdeclarativemediametadata_p.h"
@@ -184,7 +183,6 @@ QDeclarativeCamera::QDeclarativeCamera(QObject *parent) :
m_flash = new QDeclarativeCameraFlash(m_camera);
m_focus = new QDeclarativeCameraFocus(m_camera);
m_imageProcessing = new QDeclarativeCameraImageProcessing(m_camera);
- m_viewfinder = new QDeclarativeCameraViewfinder(m_camera);
connect(m_camera, SIGNAL(captureModeChanged(QCamera::CaptureModes)),
this, SIGNAL(captureModeChanged()));
@@ -217,7 +215,6 @@ QDeclarativeCamera::~QDeclarativeCamera()
delete m_focus;
delete m_imageProcessing;
delete m_metaData;
- delete m_viewfinder;
delete m_camera;
}
@@ -849,44 +846,6 @@ QDeclarativeMediaMetaData *QDeclarativeCamera::metaData()
}
/*!
- \qmlpropertygroup QtMultimedia::Camera::viewfinder
- \qmlproperty size QtMultimedia::Camera::viewfinder.resolution
- \qmlproperty real QtMultimedia::Camera::viewfinder.minimumFrameRate
- \qmlproperty real QtMultimedia::Camera::viewfinder.maximumFrameRate
-
- These properties hold the viewfinder settings.
-
- \c viewfinder.resolution holds the resolution of the camera viewfinder. If no
- resolution is given or if it is empty, the backend uses a default value.
-
- \c viewfinder.minimumFrameRate holds the minimum frame rate for the viewfinder in
- frames per second. If no value is given or if set to \c 0, the backend uses a default value.
-
- \c viewfinder.maximumFrameRate holds the maximum frame rate for the viewfinder in
- frames per second. If no value is given or if set to \c 0, the backend uses a default value.
-
- If \c viewfinder.minimumFrameRate is equal to \c viewfinder.maximumFrameRate, the frame rate is
- fixed. If not, the actual frame rate fluctuates between the two values.
-
- Changing the viewfinder settings while the camera is in the \c Camera.ActiveState state may
- cause the camera to be restarted.
-
- If the camera is used to capture videos or images, the viewfinder settings might be
- ignored if they conflict with the capture settings. You can check the actual viewfinder settings
- once the camera is in the \c Camera.ActiveStatus status.
-
- Supported values can be retrieved with supportedViewfinderResolutions() and
- supportedViewfinderFrameRateRanges().
-
- \since 5.4
- */
-
-QDeclarativeCameraViewfinder *QDeclarativeCamera::viewfinder()
-{
- return m_viewfinder;
-}
-
-/*!
\qmlmethod list<size> QtMultimedia::Camera::supportedViewfinderResolutions(real minimumFrameRate, real maximumFrameRate)
Returns a list of supported viewfinder resolutions.
@@ -901,19 +860,23 @@ QDeclarativeCameraViewfinder *QDeclarativeCamera::viewfinder()
\since 5.5
*/
-QJSValue QDeclarativeCamera::supportedViewfinderResolutions(qreal minimumFrameRate, qreal maximumFrameRate)
+QJSValue QDeclarativeCamera::supportedResolutions(qreal minimumFrameRate, qreal maximumFrameRate)
{
QQmlEngine *engine = qmlEngine(this);
- QCameraViewfinderSettings settings;
- settings.setMinimumFrameRate(minimumFrameRate);
- settings.setMaximumFrameRate(maximumFrameRate);
- const QList<QSize> resolutions = m_camera->supportedViewfinderResolutions(settings);
+ QCameraInfo info = m_camera->cameraInfo();
- QJSValue supportedResolutions = engine->newArray(resolutions.count());
+ const auto formats = info.videoFormats();
+ QJSValue supportedResolutions = engine->newArray(formats.count());
int i = 0;
- for (const QSize &resolution : resolutions) {
+ for (const auto &f : formats) {
+ if (maximumFrameRate >= 0) {
+ if (f.maxFrameRate() < minimumFrameRate ||
+ f.minFrameRate() > maximumFrameRate)
+ continue;
+ }
QJSValue size = engine->newObject();
+ QSize resolution = f.resolution();
size.setProperty(QStringLiteral("width"), resolution.width());
size.setProperty(QStringLiteral("height"), resolution.height());
supportedResolutions.setProperty(i++, size);
@@ -939,28 +902,40 @@ QJSValue QDeclarativeCamera::supportedViewfinderResolutions(qreal minimumFrameRa
\since 5.5
*/
-QJSValue QDeclarativeCamera::supportedViewfinderFrameRateRanges(const QJSValue &resolution)
+QJSValue QDeclarativeCamera::supportedFrameRateRanges(const QJSValue &resolution)
{
QQmlEngine *engine = qmlEngine(this);
- QCameraViewfinderSettings settings;
+ QSize res;
if (!resolution.isUndefined()) {
QJSValue width = resolution.property(QStringLiteral("width"));
QJSValue height = resolution.property(QStringLiteral("height"));
if (width.isNumber() && height.isNumber())
- settings.setResolution(width.toInt(), height.toInt());
+ res = QSize(width.toInt(), height.toInt());
}
- const QList<QCamera::FrameRateRange> frameRateRanges = m_camera->supportedViewfinderFrameRateRanges(settings);
-
- QJSValue supportedFrameRateRanges = engine->newArray(frameRateRanges.count());
- int i = 0;
- for (const QCamera::FrameRateRange &frameRateRange : frameRateRanges) {
- QJSValue range = engine->newObject();
- range.setProperty(QStringLiteral("minimumFrameRate"), frameRateRange.minimumFrameRate);
- range.setProperty(QStringLiteral("maximumFrameRate"), frameRateRange.maximumFrameRate);
- supportedFrameRateRanges.setProperty(i++, range);
+ QCameraInfo info = m_camera->cameraInfo();
+
+ float min = 0.;
+ float max = 1.e6;
+ const auto formats = info.videoFormats();
+ QJSValue supportedResolutions = engine->newArray(formats.count());
+ for (const auto &f : formats) {
+ if (!res.isValid() || f.resolution() == res) {
+ min = qMin(min, f.minFrameRate());
+ max = qMin(max, f.maxFrameRate());
+ }
}
+ if (max == 1.e6)
+ min = max = 0.;
+
+ // ### change Qt 5 semantics and not return an array????
+ QJSValue supportedFrameRateRanges = engine->newArray(1);
+ QJSValue range = engine->newObject();
+ range.setProperty(QStringLiteral("minimumFrameRate"), min);
+ range.setProperty(QStringLiteral("maximumFrameRate"), max);
+ supportedFrameRateRanges.setProperty(0, range);
+
return supportedFrameRateRanges;
}
diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h
index 6faa461f6..20a7ce2e0 100644
--- a/src/imports/multimedia/qdeclarativecamera_p.h
+++ b/src/imports/multimedia/qdeclarativecamera_p.h
@@ -72,8 +72,6 @@ class QDeclarativeCameraFocus;
class QDeclarativeCameraFlash;
class QDeclarativeCameraImageProcessing;
class QDeclarativeMediaMetaData;
-class QDeclarativeCameraViewfinder;
-
class QDeclarativeCamera : public QObject, public QQmlParserStatus
{
Q_OBJECT
@@ -103,7 +101,6 @@ class QDeclarativeCamera : public QObject, public QQmlParserStatus
Q_PROPERTY(QDeclarativeCameraFocus* focus READ focus CONSTANT)
Q_PROPERTY(QDeclarativeCameraImageProcessing* imageProcessing READ imageProcessing CONSTANT)
Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT REVISION 1)
- Q_PROPERTY(QDeclarativeCameraViewfinder *viewfinder READ viewfinder CONSTANT REVISION 1)
Q_ENUMS(Position)
Q_ENUMS(CaptureMode)
@@ -128,7 +125,6 @@ public:
};
enum CaptureMode {
- CaptureViewfinder = QCamera::CaptureViewfinder,
CaptureStillImage = QCamera::CaptureStillImage,
CaptureVideo = QCamera::CaptureVideo
};
@@ -244,7 +240,6 @@ public:
QDeclarativeCameraFlash *flash() { return m_flash; }
QDeclarativeCameraFocus *focus() { return m_focus; }
QDeclarativeCameraImageProcessing *imageProcessing() { return m_imageProcessing; }
- QDeclarativeCameraViewfinder *viewfinder();
QDeclarativeMediaMetaData *metaData();
@@ -287,10 +282,10 @@ public Q_SLOTS:
void setOpticalZoom(qreal);
void setDigitalZoom(qreal);
- Q_REVISION(2) QJSValue supportedViewfinderResolutions(qreal minimumFrameRate = 0.0,
+ Q_REVISION(2) QJSValue supportedResolutions(qreal minimumFrameRate = 0.0,
qreal maximumFrameRate = 0.0);
- Q_REVISION(2) QJSValue supportedViewfinderFrameRateRanges(const QJSValue &resolution = QJSValue());
+ Q_REVISION(2) QJSValue supportedFrameRateRanges(const QJSValue &resolution = QJSValue());
Q_SIGNALS:
void errorChanged();
@@ -335,7 +330,6 @@ private:
QDeclarativeCameraFocus *m_focus;
QDeclarativeCameraImageProcessing *m_imageProcessing;
QDeclarativeMediaMetaData *m_metaData;
- QDeclarativeCameraViewfinder *m_viewfinder;
State m_pendingState;
bool m_componentComplete;
diff --git a/src/imports/multimedia/qdeclarativecameraviewfinder.cpp b/src/imports/multimedia/qdeclarativecameraviewfinder.cpp
deleted file mode 100644
index 26945e69a..000000000
--- a/src/imports/multimedia/qdeclarativecameraviewfinder.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 "qdeclarativecamera_p.h"
-#include "qdeclarativecameraviewfinder_p.h"
-
-#include <QtMultimedia/qcameracontrol.h>
-
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeCameraViewfinder::QDeclarativeCameraViewfinder(QCamera *camera, QObject *parent)
- : QObject(parent)
- , m_camera(camera)
-{
- connect(m_camera, &QCamera::statusChanged,
- this, &QDeclarativeCameraViewfinder::_q_cameraStatusChanged);
-}
-
-QDeclarativeCameraViewfinder::~QDeclarativeCameraViewfinder()
-{
-}
-
-QSize QDeclarativeCameraViewfinder::resolution() const
-{
- return m_settings.resolution();
-}
-
-void QDeclarativeCameraViewfinder::setResolution(const QSize &res)
-{
- if (res != m_settings.resolution()) {
- m_settings = m_camera->viewfinderSettings();
- m_settings.setResolution(res);
- m_camera->setViewfinderSettings(m_settings);
- emit resolutionChanged();
- }
-}
-
-qreal QDeclarativeCameraViewfinder::minimumFrameRate() const
-{
- return m_settings.minimumFrameRate();
-}
-
-void QDeclarativeCameraViewfinder::setMinimumFrameRate(qreal frameRate)
-{
- if (frameRate != minimumFrameRate()) {
- m_settings = m_camera->viewfinderSettings();
- m_settings.setMinimumFrameRate(frameRate);
- m_camera->setViewfinderSettings(m_settings);
- emit minimumFrameRateChanged();
- }
-}
-
-qreal QDeclarativeCameraViewfinder::maximumFrameRate() const
-{
- return m_settings.maximumFrameRate();
-}
-
-void QDeclarativeCameraViewfinder::setMaximumFrameRate(qreal frameRate)
-{
- if (frameRate != maximumFrameRate()) {
- m_settings = m_camera->viewfinderSettings();
- m_settings.setMaximumFrameRate(frameRate);
- m_camera->setViewfinderSettings(m_settings);
- emit maximumFrameRateChanged();
- }
-}
-
-void QDeclarativeCameraViewfinder::_q_cameraStatusChanged(QCamera::Status status)
-{
- // Settings values might change when the camera starts, for example if the settings are
- // undefined, if unsupported values were set or if the settings conflict with capture settings.
- // They might also change on LoadedStatus, for example reverting to values that were set by the
- // user.
- if (status == QCamera::ActiveStatus || status == QCamera::LoadedStatus) {
- QCameraViewfinderSettings oldSettings = m_settings;
- m_settings = m_camera->viewfinderSettings();
- if (oldSettings.resolution() != m_settings.resolution())
- emit resolutionChanged();
- if (oldSettings.minimumFrameRate() != m_settings.minimumFrameRate())
- emit minimumFrameRateChanged();
- if (oldSettings.maximumFrameRate() != m_settings.maximumFrameRate())
- emit maximumFrameRateChanged();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraviewfinder_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraviewfinder_p.h b/src/imports/multimedia/qdeclarativecameraviewfinder_p.h
deleted file mode 100644
index 1b1090432..000000000
--- a/src/imports/multimedia/qdeclarativecameraviewfinder_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 QDECLARATIVECAMERAVIEWFINDER_P_H
-#define QDECLARATIVECAMERAVIEWFINDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcamera.h>
-#include <qmediarecorder.h>
-#include <qmediaencodersettings.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraViewfinder : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
- Q_PROPERTY(qreal minimumFrameRate READ minimumFrameRate WRITE setMinimumFrameRate NOTIFY minimumFrameRateChanged)
- Q_PROPERTY(qreal maximumFrameRate READ maximumFrameRate WRITE setMaximumFrameRate NOTIFY maximumFrameRateChanged)
-public:
- QDeclarativeCameraViewfinder(QCamera *camera, QObject *parent = 0);
- ~QDeclarativeCameraViewfinder();
-
- QSize resolution() const;
- void setResolution(const QSize &resolution);
-
- qreal minimumFrameRate() const;
- void setMinimumFrameRate(qreal frameRate);
-
- qreal maximumFrameRate() const;
- void setMaximumFrameRate(qreal frameRate);
-
-Q_SIGNALS:
- void resolutionChanged();
- void minimumFrameRateChanged();
- void maximumFrameRateChanged();
-
-private Q_SLOTS:
- void _q_cameraStatusChanged(QCamera::Status status);
-
-private:
- QCamera *m_camera;
- QCameraViewfinderSettings m_settings;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt
index 7f7d573e4..284063276 100644
--- a/src/multimedia/CMakeLists.txt
+++ b/src/multimedia/CMakeLists.txt
@@ -30,7 +30,6 @@ qt_internal_add_module(Multimedia
camera/qcameraimagecapture.cpp camera/qcameraimagecapture.h
camera/qcameraimageprocessing.cpp camera/qcameraimageprocessing.h
camera/qcamerainfo.cpp camera/qcamerainfo.h camera/qcamerainfo_p.h
- camera/qcameraviewfindersettings.cpp camera/qcameraviewfindersettings.h
controls/qaudiodecodercontrol.cpp controls/qaudiodecodercontrol.h
controls/qaudioencodersettingscontrol.cpp controls/qaudioencodersettingscontrol.h
controls/qcameracontrol.cpp controls/qcameracontrol.h
@@ -521,7 +520,6 @@ qt_internal_extend_target(Multimedia CONDITION QNX
platform/qnx/camera/bbcameraservice.cpp platform/qnx/camera/bbcameraservice_p.h
platform/qnx/camera/bbcamerasession.cpp platform/qnx/camera/bbcamerasession_p.h
platform/qnx/camera/bbcameravideoencodersettingscontrol.cpp platform/qnx/camera/bbcameravideoencodersettingscontrol_p.h
- platform/qnx/camera/bbcameraviewfindersettingscontrol.cpp platform/qnx/camera/bbcameraviewfindersettingscontrol_p.h
platform/qnx/camera/bbimageencodercontrol.cpp platform/qnx/camera/bbimageencodercontrol_p.h
platform/qnx/camera/bbmediastoragelocation.cpp platform/qnx/camera/bbmediastoragelocation_p.h
platform/qnx/camera/bbvideorenderercontrol.cpp platform/qnx/camera/bbvideorenderercontrol_p.h
diff --git a/src/multimedia/camera/camera.pri b/src/multimedia/camera/camera.pri
index ad19dc167..f88b08df7 100644
--- a/src/multimedia/camera/camera.pri
+++ b/src/multimedia/camera/camera.pri
@@ -11,7 +11,6 @@ PUBLIC_HEADERS += \
camera/qcamerafocus.h \
camera/qcameraimageprocessing.h \
camera/qcamerainfo.h \
- camera/qcameraviewfindersettings.h
SOURCES += \
camera/qcamera.cpp \
@@ -20,4 +19,3 @@ SOURCES += \
camera/qcameraimageprocessing.cpp \
camera/qcameraimagecapture.cpp \
camera/qcamerainfo.cpp \
- camera/qcameraviewfindersettings.cpp
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp
index bc158969f..a418704e5 100644
--- a/src/multimedia/camera/qcamera.cpp
+++ b/src/multimedia/camera/qcamera.cpp
@@ -68,17 +68,6 @@ static void qRegisterCameraMetaTypes()
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraMetaTypes)
-Q_DECL_CONSTEXPR static bool qt_sizeLessThan(const QSize &s1, const QSize &s2) Q_DECL_NOTHROW
-{
- return (s1.width() * s1.height()) < (s2.width() * s2.height());
-}
-
-Q_DECL_CONSTEXPR static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2) Q_DECL_NOTHROW
-{
- return qFuzzyCompare(s1.maximumFrameRate, s2.maximumFrameRate) ? (s1.minimumFrameRate < s2.minimumFrameRate)
- : (s1.maximumFrameRate < s2.maximumFrameRate);
-}
-
/*!
\class QCamera
@@ -425,185 +414,6 @@ void QCamera::setViewfinder(QAbstractVideoSurface *surface)
}
/*!
- Returns the viewfinder settings being used by the camera.
-
- Settings may change when the camera is started, for example if the viewfinder settings
- are undefined or if unsupported values are set.
-
- If viewfinder settings are not supported by the camera, it always returns a null
- QCameraViewfinderSettings object.
-
- \sa setViewfinderSettings()
-
- \since 5.5
-*/
-QCameraViewfinderSettings QCamera::viewfinderSettings() const
-{
- Q_D(const QCamera);
-
- if (d->control)
- return d->control->viewfinderSettings();
-
- return QCameraViewfinderSettings();
-}
-
-/*!
- Sets the viewfinder \a settings.
-
- If some parameters are not specified, or null settings are passed, the camera will choose
- default values.
-
- If the camera is used to capture videos or images, the viewfinder settings might be
- ignored if they conflict with the capture settings. You can check the actual viewfinder settings
- once the camera is in the \c QCamera::ActiveStatus status.
-
- Changing the viewfinder settings while the camera is in the QCamera::ActiveState state may
- cause the camera to be restarted.
-
- \sa viewfinderSettings(), supportedViewfinderResolutions(), supportedViewfinderFrameRateRanges(),
- supportedViewfinderPixelFormats()
-
- \since 5.5
-*/
-void QCamera::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- Q_D(QCamera);
-
- if (!d->control)
- return;
-
- d->_q_preparePropertyChange(QCameraControl::ViewfinderSettings);
- d->control->setViewfinderSettings(settings);
-}
-
-/*!
- Returns a list of supported viewfinder settings.
-
- The list is ordered by preference; preferred settings come first.
-
- The optional \a settings argument can be used to conveniently filter the results.
- If \a settings is non null, the returned list is reduced to settings matching the given partial
- \a settings.
-
- The status of the camera must be LoadedStatus before calling this function, otherwise the returned list
- is empty.
-
- \sa setViewfinderSettings(), supportedViewfinderResolutions(), supportedViewfinderFrameRateRanges(),
- supportedViewfinderPixelFormats()
-
- \since 5.5
-*/
-QList<QCameraViewfinderSettings> QCamera::supportedViewfinderSettings(const QCameraViewfinderSettings &settings) const
-{
- Q_D(const QCamera);
-
- if (!d->control)
- return QList<QCameraViewfinderSettings>();
-
- if (settings.isNull())
- return d->control->supportedViewfinderSettings();
-
- QList<QCameraViewfinderSettings> results;
- const QList<QCameraViewfinderSettings> supported = d->control->supportedViewfinderSettings();
- for (const QCameraViewfinderSettings &s : supported) {
- if ((settings.resolution().isEmpty() || settings.resolution() == s.resolution())
- && (qFuzzyIsNull(settings.minimumFrameRate()) || qFuzzyCompare((float)settings.minimumFrameRate(), (float)s.minimumFrameRate()))
- && (qFuzzyIsNull(settings.maximumFrameRate()) || qFuzzyCompare((float)settings.maximumFrameRate(), (float)s.maximumFrameRate()))
- && (settings.pixelFormat() == QVideoFrame::Format_Invalid || settings.pixelFormat() == s.pixelFormat())
- && (settings.pixelAspectRatio().isEmpty() || settings.pixelAspectRatio() == s.pixelAspectRatio())) {
- results.append(s);
- }
- }
-
- return results;
-}
-
-/*!
- Returns a list of supported viewfinder resolutions.
-
- This is a convenience function which retrieves unique resolutions from the supported settings.
-
- If non null viewfinder \a settings are passed, the returned list is reduced to resolutions
- supported with partial \a settings applied.
-
- The camera must be loaded before calling this function, otherwise the returned list
- is empty.
-
- \sa QCameraViewfinderSettings::resolution(), setViewfinderSettings()
-
- \since 5.5
-*/
-QList<QSize> QCamera::supportedViewfinderResolutions(const QCameraViewfinderSettings &settings) const
-{
- QList<QSize> resolutions;
- const QList<QCameraViewfinderSettings> capabilities = supportedViewfinderSettings(settings);
- for (const QCameraViewfinderSettings &s : capabilities) {
- if (!resolutions.contains(s.resolution()))
- resolutions.append(s.resolution());
- }
- std::sort(resolutions.begin(), resolutions.end(), qt_sizeLessThan);
-
- return resolutions;
-}
-
-/*!
- Returns a list of supported viewfinder frame rate ranges.
-
- This is a convenience function which retrieves unique frame rate ranges from the supported settings.
-
- If non null viewfinder \a settings are passed, the returned list is reduced to frame rate ranges
- supported with partial \a settings applied.
-
- The camera must be loaded before calling this function, otherwise the returned list
- is empty.
-
- \sa QCameraViewfinderSettings::minimumFrameRate(), QCameraViewfinderSettings::maximumFrameRate(),
- setViewfinderSettings()
-
- \since 5.5
-*/
-QList<QCamera::FrameRateRange> QCamera::supportedViewfinderFrameRateRanges(const QCameraViewfinderSettings &settings) const
-{
- QList<QCamera::FrameRateRange> frameRateRanges;
- const QList<QCameraViewfinderSettings> capabilities = supportedViewfinderSettings(settings);
- for (const QCameraViewfinderSettings &s : capabilities) {
- QCamera::FrameRateRange range(s.minimumFrameRate(), s.maximumFrameRate());
- if (!frameRateRanges.contains(range))
- frameRateRanges.append(range);
- }
- std::sort(frameRateRanges.begin(), frameRateRanges.end(), qt_frameRateRangeLessThan);
-
- return frameRateRanges;
-}
-
-/*!
- Returns a list of supported viewfinder pixel formats.
-
- This is a convenience function which retrieves unique pixel formats from the supported settings.
-
- If non null viewfinder \a settings are passed, the returned list is reduced to pixel formats
- supported with partial \a settings applied.
-
- The camera must be loaded before calling this function, otherwise the returned list
- is empty.
-
- \sa QCameraViewfinderSettings::pixelFormat(), setViewfinderSettings()
-
- \since 5.5
-*/
-QList<QVideoFrame::PixelFormat> QCamera::supportedViewfinderPixelFormats(const QCameraViewfinderSettings &settings) const
-{
- QList<QVideoFrame::PixelFormat> pixelFormats;
- const QList<QCameraViewfinderSettings> capabilities = supportedViewfinderSettings(settings);
- for (const QCameraViewfinderSettings &s : capabilities) {
- if (!pixelFormats.contains(s.pixelFormat()))
- pixelFormats.append(s.pixelFormat());
- }
-
- return pixelFormats;
-}
-
-/*!
Returns the error state of the object.
*/
@@ -880,45 +690,6 @@ void QCamera::unlock()
unlock(d_func()->requestedLocks);
}
-
-/*!
- \class QCamera::FrameRateRange
- \inmodule QtMultimedia
- \ingroup multimedia
- \ingroup multimedia_camera
- \since 5.5
-
- \brief A FrameRateRange represents a range of frame rates as minimum and maximum rate.
-
- If the minimum frame rate is equal to the maximum frame rate, the frame rate is fixed.
- If not, the actual frame rate fluctuates between the minimum and the maximum.
-
- \sa QCamera::supportedViewfinderFrameRateRanges(), QCameraViewfinderSettings
-*/
-
-/*!
- \fn QCamera::FrameRateRange::FrameRateRange()
-
- Constructs a null frame rate range, with both minimumFrameRate and maximumFrameRate
- equal to \c 0.0.
-*/
-
-/*!
- \fn QCamera::FrameRateRange::FrameRateRange(qreal minimum, qreal maximum)
-
- Constructs a frame rate range with the given \a minimum and \a maximum frame rates.
-*/
-
-/*!
- \variable QCamera::FrameRateRange::minimumFrameRate
- The minimum frame rate supported by the range, in frames per second.
-*/
-
-/*!
- \variable QCamera::FrameRateRange::maximumFrameRate
- The maximum frame rate supported by the range, in frames per second.
-*/
-
/*!
\enum QCamera::State
diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h
index 80ebe88eb..6bbb6609f 100644
--- a/src/multimedia/camera/qcamera.h
+++ b/src/multimedia/camera/qcamera.h
@@ -51,7 +51,6 @@
#include <QtMultimedia/qcameraexposure.h>
#include <QtMultimedia/qcamerafocus.h>
#include <QtMultimedia/qcameraimageprocessing.h>
-#include <QtMultimedia/qcameraviewfindersettings.h>
#include <QtMultimedia/qcamerainfo.h>
#include <QtMultimedia/qmediaenumdebug.h>
@@ -80,22 +79,6 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QMediaSource
Q_ENUMS(LockType)
Q_ENUMS(Position)
public:
- struct FrameRateRange
- {
- Q_DECL_CONSTEXPR FrameRateRange() Q_DECL_NOTHROW
- : minimumFrameRate(0)
- , maximumFrameRate(0)
- { }
-
- Q_DECL_CONSTEXPR FrameRateRange(qreal minimum, qreal maximum) Q_DECL_NOTHROW
- : minimumFrameRate(minimum)
- , maximumFrameRate(maximum)
- { }
-
- qreal minimumFrameRate;
- qreal maximumFrameRate;
- };
-
enum Status {
UnavailableStatus,
UnloadedStatus,
@@ -116,7 +99,6 @@ public:
enum CaptureMode
{
- CaptureViewfinder = 0,
CaptureStillImage = 0x01,
CaptureVideo = 0x02
};
@@ -175,21 +157,6 @@ public:
void setViewfinder(QMediaSink *viewfinder);
void setViewfinder(QAbstractVideoSurface *surface);
- QCameraViewfinderSettings viewfinderSettings() const;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings);
-
- QList<QCameraViewfinderSettings> supportedViewfinderSettings(
- const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;
-
- QList<QSize> supportedViewfinderResolutions(
- const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;
-
- QList<FrameRateRange> supportedViewfinderFrameRateRanges(
- const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;
-
- QList<QVideoFrame::PixelFormat> supportedViewfinderPixelFormats(
- const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;
-
Error error() const;
QString errorString() const;
@@ -240,23 +207,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QCamera::LockTypes)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-
-Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator==(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
-{
- return qFuzzyCompare(r1.minimumFrameRate, r2.minimumFrameRate)
- && qFuzzyCompare(r1.maximumFrameRate, r2.maximumFrameRate);
-}
-
-QT_WARNING_POP
-
-Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator!=(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
-{ return !(r1 == r2); }
-
-Q_DECLARE_TYPEINFO(QCamera::FrameRateRange, Q_PRIMITIVE_TYPE);
-
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QCamera::State)
diff --git a/src/multimedia/camera/qcameraviewfindersettings.cpp b/src/multimedia/camera/qcameraviewfindersettings.cpp
deleted file mode 100644
index 2d5eecbf5..000000000
--- a/src/multimedia/camera/qcameraviewfindersettings.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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 "qcameraviewfindersettings.h"
-
-QT_BEGIN_NAMESPACE
-
-static void qRegisterViewfinderSettingsMetaType()
-{
- qRegisterMetaType<QCameraViewfinderSettings>();
-}
-
-Q_CONSTRUCTOR_FUNCTION(qRegisterViewfinderSettingsMetaType)
-
-
-class QCameraViewfinderSettingsPrivate : public QSharedData
-{
-public:
- bool isNull = true;
- QSize resolution;
- qreal minimumFrameRate = 0.0;
- qreal maximumFrameRate = 0.0;
- QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid;
- QSize pixelAspectRatio;
-};
-
-
-/*!
- \class QCameraViewfinderSettings
- \since 5.5
- \brief The QCameraViewfinderSettings class provides a set of viewfinder settings.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \ingroup multimedia_camera
-
- A viewfinder settings object is used to specify the viewfinder settings used by QCamera.
- Viewfinder settings are selected by constructing a QCameraViewfinderSettings object,
- setting the desired properties and then passing it to a QCamera instance using the
- QCamera::setViewfinderSettings() function.
-
- \snippet multimedia-snippets/camera.cpp Camera viewfinder settings
-
- Different cameras may have different capabilities. The application should query the camera
- capabilities before setting parameters. For example, the application should call
- QCamera::supportedViewfinderResolutions() before calling setResolution().
-
- \sa QCamera
-*/
-
-/*!
- Constructs a null viewfinder settings object.
-*/
-QCameraViewfinderSettings::QCameraViewfinderSettings()
- : d(new QCameraViewfinderSettingsPrivate)
-{
-}
-
-/*!
- Constructs a copy of the viewfinder settings object \a other.
-*/
-QCameraViewfinderSettings::QCameraViewfinderSettings(const QCameraViewfinderSettings &other)
- : d(other.d)
-{
-
-}
-
-/*!
- Destroys a viewfinder settings object.
-*/
-QCameraViewfinderSettings::~QCameraViewfinderSettings()
-{
-
-}
-
-/*!
- Assigns the value of \a other to a viewfinder settings object.
-*/
-QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(const QCameraViewfinderSettings &other)
-{
- d = other.d;
- return *this;
-}
-
-/*! \fn QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(QCameraViewfinderSettings &&other)
-
- Moves \a other to this viewfinder settings object and returns a reference to this object.
-*/
-
-/*!
- \fn void QCameraViewfinderSettings::swap(QCameraViewfinderSettings &other)
-
- Swaps this viewfinder settings object with \a other. This
- function is very fast and never fails.
-*/
-
-/*!
- \relates QCameraViewfinderSettings
- \since 5.5
-
- Determines if \a lhs is of equal value to \a rhs.
-
- Returns true if the settings objects are of equal value, and false if they
- are not of equal value.
-*/
-bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
-{
- return (lhs.d == rhs.d) ||
- (lhs.d->isNull == rhs.d->isNull &&
- lhs.d->resolution == rhs.d->resolution &&
- lhs.d->minimumFrameRate == rhs.d->minimumFrameRate &&
- lhs.d->maximumFrameRate == rhs.d->maximumFrameRate &&
- lhs.d->pixelFormat == rhs.d->pixelFormat &&
- lhs.d->pixelAspectRatio == rhs.d->pixelAspectRatio);
-}
-
-/*!
- \fn bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs)
- \relates QCameraViewfinderSettings
- \since 5.5
-
- Determines if \a lhs is of equal value to \a rhs.
-
- Returns true if the settings objects are not of equal value, and false if
- they are of equal value.
-*/
-
-/*!
- Identifies if a viewfinder settings object is uninitalized.
-
- Returns true if the settings are null, and false if they are not.
-*/
-bool QCameraViewfinderSettings::isNull() const
-{
- return d->isNull;
-}
-
-/*!
- Returns the viewfinder resolution.
-*/
-QSize QCameraViewfinderSettings::resolution() const
-{
- return d->resolution;
-}
-
-/*!
- Sets the viewfinder \a resolution.
-
- If the given \a resolution is empty, the backend makes an optimal choice based on the
- supported resolutions and the other viewfinder settings.
-
- If the camera is used to capture videos or images, the viewfinder resolution might be
- ignored if it conflicts with the capture resolution.
-
- \sa QVideoEncoderSettings::setResolution(), QImageEncoderSettings::setResolution(),
- QCamera::supportedViewfinderResolutions()
-*/
-void QCameraViewfinderSettings::setResolution(const QSize &resolution)
-{
- d->isNull = false;
- d->resolution = resolution;
-}
-
-/*!
- \fn QCameraViewfinderSettings::setResolution(int width, int height)
-
- This is an overloaded function.
-
- Sets the \a width and \a height of the viewfinder resolution.
-*/
-
-/*!
- Returns the viewfinder minimum frame rate in frames per second.
-
- \sa maximumFrameRate()
-*/
-qreal QCameraViewfinderSettings::minimumFrameRate() const
-{
- return d->minimumFrameRate;
-}
-
-/*!
- Sets the viewfinder minimum frame \a rate in frames per second.
-
- If the minimum frame \a rate is equal to the maximum frame rate, the frame rate is fixed.
- If not, the actual frame rate fluctuates between the minimum and the maximum.
-
- If the given \a rate equals to \c 0, the backend makes an optimal choice based on the
- supported frame rates and the other viewfinder settings.
-
- \sa setMaximumFrameRate(), QCamera::supportedViewfinderFrameRateRanges()
-*/
-void QCameraViewfinderSettings::setMinimumFrameRate(qreal rate)
-{
- d->isNull = false;
- d->minimumFrameRate = rate;
-}
-
-/*!
- Returns the viewfinder maximum frame rate in frames per second.
-
- \sa minimumFrameRate()
-*/
-qreal QCameraViewfinderSettings::maximumFrameRate() const
-{
- return d->maximumFrameRate;
-}
-
-/*!
- Sets the viewfinder maximum frame \a rate in frames per second.
-
- If the maximum frame \a rate is equal to the minimum frame rate, the frame rate is fixed.
- If not, the actual frame rate fluctuates between the minimum and the maximum.
-
- If the given \a rate equals to \c 0, the backend makes an optimal choice based on the
- supported frame rates and the other viewfinder settings.
-
- \sa setMinimumFrameRate(), QCamera::supportedViewfinderFrameRateRanges()
-*/
-void QCameraViewfinderSettings::setMaximumFrameRate(qreal rate)
-{
- d->isNull = false;
- d->maximumFrameRate = rate;
-}
-
-/*!
- Returns the viewfinder pixel format.
-*/
-QVideoFrame::PixelFormat QCameraViewfinderSettings::pixelFormat() const
-{
- return d->pixelFormat;
-}
-
-/*!
- Sets the viewfinder pixel \a format.
-
- If the given \a format is equal to QVideoFrame::Format_Invalid, the backend uses the
- default format.
-
- \sa QCamera::supportedViewfinderPixelFormats()
-*/
-void QCameraViewfinderSettings::setPixelFormat(QVideoFrame::PixelFormat format)
-{
- d->isNull = false;
- d->pixelFormat = format;
-}
-
-/*!
- Returns the viewfinder pixel aspect ratio.
-*/
-QSize QCameraViewfinderSettings::pixelAspectRatio() const
-{
- return d->pixelAspectRatio;
-}
-
-/*!
- Sets the viewfinder pixel aspect \a ratio.
-*/
-void QCameraViewfinderSettings::setPixelAspectRatio(const QSize &ratio)
-{
- d->isNull = false;
- d->pixelAspectRatio = ratio;
-}
-
-/*!
- \fn QCameraViewfinderSettings::setPixelAspectRatio(int horizontal, int vertical)
-
- This is an overloaded function.
-
- Sets the \a horizontal and \a vertical elements of the viewfinder's pixel aspect ratio.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/camera/qcameraviewfindersettings.h b/src/multimedia/camera/qcameraviewfindersettings.h
deleted file mode 100644
index 432bdcf1f..000000000
--- a/src/multimedia/camera/qcameraviewfindersettings.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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 QCAMERAVIEWFINDERSETTINGS_H
-#define QCAMERAVIEWFINDERSETTINGS_H
-
-#include <QtMultimedia/qtmultimediaglobal.h>
-#include <QtMultimedia/qvideoframe.h>
-
-#include <QtCore/qshareddata.h>
-#include <QtCore/qsize.h>
-
-QT_BEGIN_NAMESPACE
-
-class QCameraViewfinderSettingsPrivate;
-
-class Q_MULTIMEDIA_EXPORT QCameraViewfinderSettings
-{
-public:
- QCameraViewfinderSettings();
- QCameraViewfinderSettings(const QCameraViewfinderSettings& other);
-
- ~QCameraViewfinderSettings();
-
- QCameraViewfinderSettings& operator=(const QCameraViewfinderSettings &other);
-#ifdef Q_COMPILER_RVALUE_REFS
- QCameraViewfinderSettings &operator=(QCameraViewfinderSettings &&other) Q_DECL_NOTHROW
- { swap(other); return *this; }
-#endif
-
- void swap(QCameraViewfinderSettings &other) Q_DECL_NOTHROW { d.swap(other.d); }
-
- friend Q_MULTIMEDIA_EXPORT bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW;
- bool isNull() const;
-
- QSize resolution() const;
- void setResolution(const QSize &);
- inline void setResolution(int width, int height)
- { setResolution(QSize(width, height)); }
-
- qreal minimumFrameRate() const;
- void setMinimumFrameRate(qreal rate);
-
- qreal maximumFrameRate() const;
- void setMaximumFrameRate(qreal rate);
-
- QVideoFrame::PixelFormat pixelFormat() const;
- void setPixelFormat(QVideoFrame::PixelFormat format);
-
- QSize pixelAspectRatio() const;
- void setPixelAspectRatio(const QSize &ratio);
- inline void setPixelAspectRatio(int horizontal, int vertical)
- { setPixelAspectRatio(QSize(horizontal, vertical)); }
-
-private:
- QSharedDataPointer<QCameraViewfinderSettingsPrivate> d;
-};
-Q_DECLARE_SHARED(QCameraViewfinderSettings)
-
-inline bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
-{ return !operator==(lhs, rhs); }
-
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraViewfinderSettings)
-
-#endif // QCAMERAVIEWFINDERSETTINGS_H
diff --git a/src/multimedia/controls/qcameracontrol.h b/src/multimedia/controls/qcameracontrol.h
index 3d28c3e6a..fd557a734 100644
--- a/src/multimedia/controls/qcameracontrol.h
+++ b/src/multimedia/controls/qcameracontrol.h
@@ -60,7 +60,6 @@ public:
ImageEncodingSettings = 2,
VideoEncodingSettings = 3,
Viewfinder = 4,
- ViewfinderSettings = 5
};
virtual QCamera::State state() const = 0;
@@ -83,11 +82,6 @@ public:
virtual void searchAndLock(QCamera::LockTypes locks) = 0;
virtual void unlock(QCamera::LockTypes locks) = 0;
- virtual QList<QCameraViewfinderSettings> supportedViewfinderSettings() const = 0;
-
- virtual QCameraViewfinderSettings viewfinderSettings() const = 0;
- virtual void setViewfinderSettings(const QCameraViewfinderSettings &settings) = 0;
-
Q_SIGNALS:
void stateChanged(QCamera::State);
void statusChanged(QCamera::Status);
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
index d6c6488d2..8b07eb633 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
@@ -41,8 +41,6 @@
#include "qcamera.h"
#include "qcamerainfo.h"
-#include "qcameraviewfinder.h"
-#include "qcameraviewfindersettings.h"
#include "qmediarecorder.h"
#include "qcameraimagecapture.h"
#include "qcameraimageprocessing.h"
@@ -280,15 +278,3 @@ void camerafocus()
}
//! [Camera focus zones]
}
-
-void camera_viewfindersettings()
-{
- //! [Camera viewfinder settings]
- QCameraViewfinderSettings viewfinderSettings;
- viewfinderSettings.setResolution(640, 480);
- viewfinderSettings.setMinimumFrameRate(15.0);
- viewfinderSettings.setMaximumFrameRate(30.0);
-
- camera->setViewfinderSettings(viewfinderSettings);
- //! [Camera viewfinder settings]
-}
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
diff --git a/tests/auto/unit/mockbackend/mockcameracontrol.h b/tests/auto/unit/mockbackend/mockcameracontrol.h
index cb48e8be7..5ca149391 100644
--- a/tests/auto/unit/mockbackend/mockcameracontrol.h
+++ b/tests/auto/unit/mockbackend/mockcameracontrol.h
@@ -45,48 +45,6 @@ public:
m_status(QCamera::UnloadedStatus),
m_propertyChangesSupported(false)
{
- QCameraViewfinderSettings s;
- s.setResolution(640, 480);
- s.setMinimumFrameRate(30);
- s.setMaximumFrameRate(30);
- s.setPixelFormat(QVideoFrame::Format_NV12);
- s.setPixelAspectRatio(1, 1);
- supportedSettings.append(s);
-
- s.setResolution(1280, 720);
- s.setMinimumFrameRate(10);
- s.setMaximumFrameRate(10);
- s.setPixelFormat(QVideoFrame::Format_NV12);
- s.setPixelAspectRatio(1, 1);
- supportedSettings.append(s);
-
- s.setResolution(1920, 1080);
- s.setMinimumFrameRate(5);
- s.setMaximumFrameRate(10);
- s.setPixelFormat(QVideoFrame::Format_BGR32);
- s.setPixelAspectRatio(2, 1);
- supportedSettings.append(s);
-
- s.setResolution(1280, 720);
- s.setMinimumFrameRate(10);
- s.setMaximumFrameRate(10);
- s.setPixelFormat(QVideoFrame::Format_YV12);
- s.setPixelAspectRatio(1, 1);
- supportedSettings.append(s);
-
- s.setResolution(1280, 720);
- s.setMinimumFrameRate(30);
- s.setMaximumFrameRate(30);
- s.setPixelFormat(QVideoFrame::Format_YV12);
- s.setPixelAspectRatio(1, 1);
- supportedSettings.append(s);
-
- s.setResolution(320, 240);
- s.setMinimumFrameRate(30);
- s.setMaximumFrameRate(30);
- s.setPixelFormat(QVideoFrame::Format_NV12);
- s.setPixelAspectRatio(1, 1);
- supportedSettings.append(s);
}
~MockCameraControl() {}
@@ -195,24 +153,6 @@ public:
}
}
- QCameraViewfinderSettings viewfinderSettings() const
- {
- return settings;
- }
-
- void setViewfinderSettings(const QCameraViewfinderSettings &s)
- {
- settings = s;
- }
-
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const
- {
- return supportedSettings;
- }
-
- QCameraViewfinderSettings settings;
- QList<QCameraViewfinderSettings> supportedSettings;
-
/* helper method to emit the signal with LockChangeReason */
void setLockChangeReason (QCamera::LockChangeReason lockChangeReason)
{
diff --git a/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp
index 4d064b0e6..9fa5045b9 100644
--- a/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp
+++ b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp
@@ -78,16 +78,6 @@ private slots:
void testCameraCapture();
void testCameraCaptureMetadata();
void testImageSettings();
- void testViewfinderSettings();
- void testViewfinderSettingsChange();
- void testSupportedViewfinderSettings_data();
- void testSupportedViewfinderSettings();
- void testSupportedViewfinderResolutions_data();
- void testSupportedViewfinderResolutions();
- void testSupportedViewfinderFrameRateRanges_data();
- void testSupportedViewfinderFrameRateRanges();
- void testSupportedViewfinderPixelFormats_data();
- void testSupportedViewfinderPixelFormats();
void testCameraLock();
void testCameraLockCancel();
void testCameraEncodingProperyChange();
@@ -157,11 +147,8 @@ private:
QMockIntegration *integration;
};
-Q_DECLARE_METATYPE(QCamera::FrameRateRange)
-
void tst_QCamera::initTestCase()
{
- qRegisterMetaType<QCamera::FrameRateRange>("FrameRateRange");
MockMediaRecorderService::simpleCamera = false;
}
@@ -787,573 +774,6 @@ void tst_QCamera::testImageSettings()
QVERIFY(settings1 != settings2);
}
-void tst_QCamera::testViewfinderSettings()
-{
- QCameraViewfinderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QCameraViewfinderSettings());
-
- QCOMPARE(settings.resolution(), QSize());
- settings.setResolution(QSize(640, 480));
- QCOMPARE(settings.resolution(), QSize(640, 480));
- settings.setResolution(1280, 720);
- QCOMPARE(settings.resolution(), QSize(1280, 720));
- QVERIFY(!settings.isNull());
- QVERIFY(settings != QCameraViewfinderSettings());
-
- settings = QCameraViewfinderSettings();
- QVERIFY(qFuzzyIsNull(settings.minimumFrameRate()));
- settings.setMinimumFrameRate(10.0);
- QVERIFY(qFuzzyCompare(settings.minimumFrameRate(), 10.0));
- QVERIFY(qFuzzyIsNull(settings.maximumFrameRate()));
- settings.setMaximumFrameRate(20.0);
- QVERIFY(qFuzzyCompare(settings.maximumFrameRate(), 20.0));
- QVERIFY(!settings.isNull());
-
- settings = QCameraViewfinderSettings();
- QCOMPARE(settings.pixelFormat(), QVideoFrame::Format_Invalid);
- settings.setPixelFormat(QVideoFrame::Format_RGB32);
- QCOMPARE(settings.pixelFormat(), QVideoFrame::Format_RGB32);
- QVERIFY(!settings.isNull());
-
- settings = QCameraViewfinderSettings();
- QCOMPARE(settings.pixelAspectRatio(), QSize());
- settings.setPixelAspectRatio(QSize(2, 1));
- QCOMPARE(settings.pixelAspectRatio(), QSize(2, 1));
- settings.setPixelAspectRatio(3, 2);
- QCOMPARE(settings.pixelAspectRatio(), QSize(3, 2));
- QVERIFY(!settings.isNull());
-
- settings = QCameraViewfinderSettings();
-
- {
- QCameraViewfinderSettings settings1;
- QCameraViewfinderSettings settings2;
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setResolution(800, 600);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- {
- QCameraViewfinderSettings settings1;
- QCameraViewfinderSettings settings2(settings1);
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setResolution(800, 600);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- QCameraViewfinderSettings settings1;
- QCameraViewfinderSettings settings2;
-
- settings1 = QCameraViewfinderSettings();
- settings1.setResolution(800,600);
- settings2 = QCameraViewfinderSettings();
- settings2.setResolution(QSize(800,600));
- QVERIFY(settings1 == settings2);
- settings2.setResolution(QSize(400,300));
- QVERIFY(settings1 != settings2);
-
- settings1 = QCameraViewfinderSettings();
- settings1.setMinimumFrameRate(10.0);
- settings2 = QCameraViewfinderSettings();
- settings2.setMinimumFrameRate(10.0);
- QVERIFY(settings1 == settings2);
- settings2.setMinimumFrameRate(15.0);
- QVERIFY(settings1 != settings2);
-
- settings1 = QCameraViewfinderSettings();
- settings1.setMaximumFrameRate(30.0);
- settings2 = QCameraViewfinderSettings();
- settings2.setMaximumFrameRate(30.0);
- QVERIFY(settings1 == settings2);
- settings2.setMaximumFrameRate(15.0);
- QVERIFY(settings1 != settings2);
-
- settings1 = QCameraViewfinderSettings();
- settings1.setPixelFormat(QVideoFrame::Format_YV12);
- settings2 = QCameraViewfinderSettings();
- settings2.setPixelFormat(QVideoFrame::Format_YV12);
- QVERIFY(settings1 == settings2);
- settings2.setPixelFormat(QVideoFrame::Format_NV21);
- QVERIFY(settings1 != settings2);
-
- settings1 = QCameraViewfinderSettings();
- settings1.setPixelAspectRatio(2,1);
- settings2 = QCameraViewfinderSettings();
- settings2.setPixelAspectRatio(QSize(2,1));
- QVERIFY(settings1 == settings2);
- settings2.setPixelAspectRatio(QSize(1,2));
- QVERIFY(settings1 != settings2);
-}
-
-void tst_QCamera::testViewfinderSettingsChange()
-{
- QCamera camera;
-
- QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
- QSignalSpy statusChangedSignal(&camera, SIGNAL(statusChanged(QCamera::Status)));
-
- camera.start();
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(stateChangedSignal.count(), 1);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start
- camera.setViewfinderSettings(QCameraViewfinderSettings());
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start only once
- camera.setViewfinderSettings(QCameraViewfinderSettings());
- camera.setViewfinderSettings(QCameraViewfinderSettings());
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
-}
-
-class ViewfinderSettingsBuilder
-{
-public:
- ViewfinderSettingsBuilder &setResolution(int width, int height) {
- m_settings.setResolution(width, height);
- return *this;
- }
-
- ViewfinderSettingsBuilder &setMinimumFrameRate(qreal r) {
- m_settings.setMinimumFrameRate(r);
- return *this;
- }
-
- ViewfinderSettingsBuilder &setMaximumFrameRate(qreal r) {
- m_settings.setMaximumFrameRate(r);
- return *this;
- }
-
- ViewfinderSettingsBuilder &setPixelFormat(QVideoFrame::PixelFormat f) {
- m_settings.setPixelFormat(f);
- return *this;
- }
-
- ViewfinderSettingsBuilder &setPixelAspectRatio(int h, int v) {
- m_settings.setPixelAspectRatio(h, v);
- return *this;
- }
-
- QCameraViewfinderSettings build() {
- QCameraViewfinderSettings s = m_settings;
- m_settings = QCameraViewfinderSettings();
- return s;
- }
-
-private:
- QCameraViewfinderSettings m_settings;
-};
-
-void tst_QCamera::testSupportedViewfinderSettings_data()
-{
- // see mockcameracontrol.h for expected values
-
- ViewfinderSettingsBuilder builder;
-
- QTest::addColumn<QCameraViewfinderSettings>("settings");
- QTest::addColumn< QList<int> >("expectedSupportedSettings");
-
- QTest::newRow("all supported settings") << QCameraViewfinderSettings()
- << (QList<int>() << 0 << 1 << 2 << 3 << 4 << 5);
-
- QTest::newRow("invalid resolution") << builder.setResolution(452472, 44453).build()
- << QList<int>();
-
- QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build()
- << (QList<int>() << 0);
-
- QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
- << (QList<int>() << 1 << 3 << 4);
-
- QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
- << QList<int>();
-
- QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
- << (QList<int>() << 2);
-
- QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
- << (QList<int>() << 1 << 3);
-
- QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build()
- << (QList<int>() << 0 << 4 << 5);
-
- QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
- << QList<int>();
-
- QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
- << (QList<int>() << 1 << 2 << 3);
-
- QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build()
- << (QList<int>() << 0 << 4 << 5);
-
- QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build()
- << QList<int>();
-
- QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
- << (QList<int>() << 2);
-
- QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build()
- << (QList<int>() << 3 << 4);
-
- QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
- << (QList<int>() << 0 << 1 << 5);
-
- QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(5, 3).build()
- << QList<int>();
-
- QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
- << (QList<int>() << 2);
-
- QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
- << (QList<int>() << 0 << 1 << 3 << 4 << 5);
-
- QTest::newRow("invalid multi settings") << builder.setResolution(640, 480)
- .setMinimumFrameRate(10)
- .setMaximumFrameRate(10)
- .build()
- << QList<int>();
-
- QTest::newRow("multi settings (1)") << builder.setResolution(640, 480)
- .setMinimumFrameRate(30)
- .setMaximumFrameRate(30)
- .build()
- << (QList<int>() << 0);
-
- QTest::newRow("multi settings (2)") << builder.setResolution(1280, 720)
- .setMinimumFrameRate(10)
- .setMaximumFrameRate(10)
- .build()
- << (QList<int>() << 1 << 3);
-
- QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12)
- .setMinimumFrameRate(30)
- .build()
- << (QList<int>() << 0 << 5);
-
- QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1)
- .setMaximumFrameRate(10)
- .build()
- << (QList<int>() << 1 << 3);
-}
-
-void tst_QCamera::testSupportedViewfinderSettings()
-{
- QFETCH(QCameraViewfinderSettings, settings);
- QFETCH(QList<int>, expectedSupportedSettings);
-
- QList<QCameraViewfinderSettings> actualSupportedSettings = QCamera().supportedViewfinderSettings(settings);
- auto *service = integration->lastCaptureService();
- QCOMPARE(actualSupportedSettings.size(), expectedSupportedSettings.size());
- for (int i = 0; i < expectedSupportedSettings.size(); ++i) {
- QCameraViewfinderSettings expectedSettings = service->mockCameraControl->supportedSettings.at(expectedSupportedSettings.at(i));
- QCOMPARE(actualSupportedSettings.at(i), expectedSettings);
- }
-}
-
-void tst_QCamera::testSupportedViewfinderResolutions_data()
-{
- // see mockcameracontrol.h for expected values
-
- using SizeList = QList<QSize>;
- ViewfinderSettingsBuilder builder;
-
- QTest::addColumn<QCameraViewfinderSettings>("settings");
- QTest::addColumn<SizeList>("expectedResolutions");
-
- QTest::newRow("empty settings") << QCameraViewfinderSettings()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480)
- << QSize(1280, 720)
- << QSize(1920, 1080));
-
- QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
- << SizeList();
-
- QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
- << (SizeList() << QSize(1920, 1080));
-
- QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
- << (SizeList() << QSize(1280, 720));
-
- QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480)
- << QSize(1280, 720));
-
- QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
- << SizeList();
-
- QTest::newRow("maximum frame rate") << builder.setMaximumFrameRate(10).build()
- << (SizeList() << QSize(1280, 720)
- << QSize(1920, 1080));
-
- QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build()
- << SizeList();
-
- QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
- << (SizeList() << QSize(1920, 1080));
-
- QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build()
- << (SizeList() << QSize(1280, 720));
-
- QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480)
- << QSize(1280, 720));
-
- QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(7, 2).build()
- << SizeList();
-
- QTest::newRow("pixel aspect ratio (1") << builder.setPixelAspectRatio(2, 1).build()
- << (SizeList() << QSize(1920, 1080));
-
- QTest::newRow("pixel aspect ratio (2") << builder.setPixelAspectRatio(1, 1).build()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480)
- << QSize(1280, 720));
-
- QTest::newRow("invalid multi settings (1)") << builder.setMinimumFrameRate(2)
- .setMaximumFrameRate(3)
- .build()
- << SizeList();
-
- QTest::newRow("invalid multi settings (2)") << builder.setMinimumFrameRate(5)
- .setMaximumFrameRate(11)
- .build()
- << SizeList();
-
- QTest::newRow("multi settings (1)") << builder.setMinimumFrameRate(10)
- .setMaximumFrameRate(10)
- .build()
- << (SizeList() << QSize(1280, 720));
-
- QTest::newRow("multi settings (2)") << builder.setMinimumFrameRate(30)
- .setMaximumFrameRate(30)
- .build()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480)
- << QSize(1280, 720));
-
- QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12)
- .setMinimumFrameRate(30)
- .build()
- << (SizeList() << QSize(320, 240)
- << QSize(640, 480));
-
- QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1)
- .setMaximumFrameRate(10)
- .build()
- << (SizeList() << QSize(1280, 720));
-}
-
-void tst_QCamera::testSupportedViewfinderResolutions()
-{
- QFETCH(QCameraViewfinderSettings, settings);
- QFETCH(QList<QSize>, expectedResolutions);
-
- QList<QSize> actualResolutions = QCamera().supportedViewfinderResolutions(settings);
- QCOMPARE(actualResolutions.size(), expectedResolutions.size());
- for (int i = 0; i < actualResolutions.size(); ++i)
- QCOMPARE(actualResolutions.at(i), expectedResolutions.at(i));
-}
-
-void tst_QCamera::testSupportedViewfinderFrameRateRanges_data()
-{
- // see mockcameracontrol.h for expected values
-
- using RangeList = QList<QCamera::FrameRateRange>;
- ViewfinderSettingsBuilder builder;
-
- QTest::addColumn<QCameraViewfinderSettings>("settings");
- QTest::addColumn<RangeList>("expectedFrameRateRanges");
-
- QTest::newRow("empty settings") << QCameraViewfinderSettings()
- << (RangeList() << QCamera::FrameRateRange(5, 10)
- << QCamera::FrameRateRange(10, 10)
- << QCamera::FrameRateRange(30, 30));
-
- QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build()
- << RangeList();
-
- QTest::newRow("resolution (1)") << builder.setResolution(320, 240).build()
- << (RangeList() << QCamera::FrameRateRange(30, 30));
-
- QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
- << (RangeList() << QCamera::FrameRateRange(10, 10)
- << QCamera::FrameRateRange(30, 30));
-
- QTest::newRow("resolution (3)") << builder.setResolution(1920, 1080).build()
- << (RangeList() << QCamera::FrameRateRange(5, 10));
-
- QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
- << RangeList();
-
- QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
- << (RangeList() << QCamera::FrameRateRange(5, 10));
-
- QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
- << (RangeList() << QCamera::FrameRateRange(10, 10));
-
- QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
- << RangeList();
-
- QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
- << (RangeList() << QCamera::FrameRateRange(5, 10)
- << QCamera::FrameRateRange(10, 10));
-
- QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build()
- << (RangeList() << QCamera::FrameRateRange(30, 30));
-
- QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_IMC1).build()
- << RangeList();
-
- QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
- << (RangeList() << QCamera::FrameRateRange(5, 10));
-
- QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
- << (RangeList() << QCamera::FrameRateRange(10, 10)
- << QCamera::FrameRateRange(30, 30));
-
- QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build()
- << RangeList();
-
- QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
- << (RangeList() << QCamera::FrameRateRange(5, 10));
-
- QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
- << (RangeList() << QCamera::FrameRateRange(10, 10)
- << QCamera::FrameRateRange(30, 30));
-}
-
-void tst_QCamera::testSupportedViewfinderFrameRateRanges()
-{
- QFETCH(QCameraViewfinderSettings, settings);
- QFETCH(QList<QCamera::FrameRateRange>, expectedFrameRateRanges);
-
- QList<QCamera::FrameRateRange> actualFrameRateRanges = QCamera().supportedViewfinderFrameRateRanges(settings);
- QCOMPARE(actualFrameRateRanges.size(), expectedFrameRateRanges.size());
- for (int i = 0; i < actualFrameRateRanges.size(); ++i)
- QCOMPARE(actualFrameRateRanges.at(i), expectedFrameRateRanges.at(i));
-}
-
-void tst_QCamera::testSupportedViewfinderPixelFormats_data()
-{
- // see mockcameracontrol.h for expected values
-
- using FormatList = QList<QVideoFrame::PixelFormat>;
- ViewfinderSettingsBuilder builder;
-
- QTest::addColumn<QCameraViewfinderSettings>("settings");
- QTest::addColumn<FormatList>("expectedPixelFormats");
-
- QTest::newRow("empty settings") << QCameraViewfinderSettings()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_BGR32
- << QVideoFrame::Format_YV12);
-
- QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build()
- << FormatList();
-
- QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build()
- << (FormatList() << QVideoFrame::Format_NV12);
-
- QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_YV12);
-
- QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
- << FormatList();
-
- QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
- << (FormatList() << QVideoFrame::Format_BGR32);
-
- QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_YV12);
-
- QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
- << FormatList();
-
- QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_BGR32
- << QVideoFrame::Format_YV12);
-
- QTest::newRow("maximum frame rate (2)") << builder.setMinimumFrameRate(30).build()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_YV12);
-
- QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build()
- << FormatList();
-
- QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
- << (FormatList() << QVideoFrame::Format_BGR32);
-
- QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
- << (FormatList() << QVideoFrame::Format_NV12
- << QVideoFrame::Format_YV12);
-}
-
-void tst_QCamera::testSupportedViewfinderPixelFormats()
-{
- QFETCH(QCameraViewfinderSettings, settings);
- QFETCH(QList<QVideoFrame::PixelFormat>, expectedPixelFormats);
-
- QList<QVideoFrame::PixelFormat> actualPixelFormats = QCamera().supportedViewfinderPixelFormats(settings);
- QCOMPARE(actualPixelFormats.size(), expectedPixelFormats.size());
- for (int i = 0; i < actualPixelFormats.size(); ++i)
- QCOMPARE(actualPixelFormats.at(i), expectedPixelFormats.at(i));
-}
-
void tst_QCamera::testCameraLock()
{
QCamera camera;