summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-04-15 12:45:45 +0200
committerLars Knoll <lars.knoll@qt.io>2021-04-19 11:07:01 +0000
commit215deb5531426095239d7f7b3d2d609088ab085d (patch)
tree191ba12c4c98829a9da62106a3d4f48d22851daa /src/imports
parent0ca672235b097937f32d2960e4a8ca3e323074db (diff)
Convert the remaining QML APIs related to capture
Expose the C++ classes to QML instead of having all those wrapper classes. Change-Id: Id151a386a8f13da5c0eda3fa06a6e3b7032e0cb6 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/multimedia/CMakeLists.txt6
-rw-r--r--src/imports/multimedia/multimedia.cpp31
-rw-r--r--src/imports/multimedia/qdeclarativecamera.cpp632
-rw-r--r--src/imports/multimedia/qdeclarativecamera_p.h244
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure.cpp394
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure_p.h153
-rw-r--r--src/imports/multimedia/qdeclarativecameraflash.cpp183
-rw-r--r--src/imports/multimedia/qdeclarativecameraflash_p.h104
-rw-r--r--src/imports/multimedia/qdeclarativecamerarecorder.cpp582
-rw-r--r--src/imports/multimedia/qdeclarativecamerarecorder_p.h223
-rw-r--r--src/imports/multimedia/qdeclarativemultimediaglobal.cpp240
-rw-r--r--src/imports/multimedia/qdeclarativemultimediaglobal_p.h96
-rw-r--r--src/imports/multimedia/qdeclarativetorch.cpp172
-rw-r--r--src/imports/multimedia/qdeclarativetorch_p.h98
14 files changed, 1 insertions, 3157 deletions
diff --git a/src/imports/multimedia/CMakeLists.txt b/src/imports/multimedia/CMakeLists.txt
index 9ef27bab8..159cbccfd 100644
--- a/src/imports/multimedia/CMakeLists.txt
+++ b/src/imports/multimedia/CMakeLists.txt
@@ -10,13 +10,7 @@ qt_internal_add_qml_module(declarative_multimedia
CLASSNAME QMultimediaDeclarativeModule
SOURCES
multimedia.cpp
- qdeclarativecamera.cpp qdeclarativecamera_p.h
- qdeclarativecameraexposure.cpp qdeclarativecameraexposure_p.h
- qdeclarativecameraflash.cpp qdeclarativecameraflash_p.h
- qdeclarativecamerarecorder.cpp qdeclarativecamerarecorder_p.h
- qdeclarativemultimediaglobal.cpp qdeclarativemultimediaglobal_p.h
qdeclarativeplaylist.cpp qdeclarativeplaylist_p.h
- qdeclarativetorch.cpp qdeclarativetorch_p.h
PUBLIC_LIBRARIES
Qt::Core
Qt::Gui
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index a838dcf86..da1107871 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -49,28 +49,12 @@
#include "qmediaencoder.h"
#include <private/qdeclarativevideooutput_p.h>
+#include <private/qquickimagepreviewprovider_p.h>
-#include "qdeclarativemultimediaglobal_p.h"
#include "qdeclarativeplaylist_p.h"
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecameraexposure_p.h"
-#include "qdeclarativecameraflash_p.h"
-#include "qdeclarativetorch_p.h"
-
-#include "qquickimagepreviewprovider_p.h"
-
-QML_DECLARE_TYPE(QSoundEffect)
QT_BEGIN_NAMESPACE
-static QObject *multimedia_global_object(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
-{
- Q_UNUSED(qmlEngine);
- return new QDeclarativeMultimediaGlobal(jsEngine);
-}
-
-Q_DECLARE_METATYPE(QMediaMetaData)
-
class QMultimediaDeclarativeModule : public QQmlExtensionPlugin
{
Q_OBJECT
@@ -86,19 +70,6 @@ public:
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia"));
- // 6.0 types
- qmlRegisterType<QDeclarativeCamera>(uri, 6, 0, "Camera");
- qmlRegisterUncreatableType<QDeclarativeCameraRecorder>(uri, 6, 0, "CameraRecorder",
- tr("CameraRecorder is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraExposure>(uri, 6, 0, "CameraExposure",
- tr("CameraExposure is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraFlash>(uri, 6, 0, "CameraFlash",
- tr("CameraFlash is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeTorch>(uri, 6, 0, "CameraTorch",
- tr("CameraTorch is provided by Camera"));
-
- qmlRegisterSingletonType<QDeclarativeMultimediaGlobal>(uri, 6, 0, "QtMultimedia", multimedia_global_object);
-
qmlRegisterType<QDeclarativePlaylist>(uri, 6, 0, "Playlist");
qmlRegisterType<QDeclarativePlaylistItem>(uri, 6, 0, "PlaylistItem");
diff --git a/src/imports/multimedia/qdeclarativecamera.cpp b/src/imports/multimedia/qdeclarativecamera.cpp
deleted file mode 100644
index 282359efa..000000000
--- a/src/imports/multimedia/qdeclarativecamera.cpp
+++ /dev/null
@@ -1,632 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 "qdeclarativecameraexposure_p.h"
-#include "qdeclarativecameraflash_p.h"
-#include "qdeclarativetorch_p.h"
-
-#include <private/qplatformmediaplayer_p.h>
-#include <qobject.h>
-#include <QMediaDeviceManager>
-#include <QtQml/qqmlinfo.h>
-#include <QtQml/qqmlengine.h>
-
-#include <QtCore/QTimer>
-#include <QtGui/qevent.h>
-
-QT_BEGIN_NAMESPACE
-
-void QDeclarativeCamera::_q_errorOccurred(QCamera::Error errorCode)
-{
- emit errorOccurred(Error(errorCode), errorString());
- emit errorChanged();
-}
-
-/*!
- \qmltype Camera
- \instantiates QDeclarativeCamera
- \brief Access viewfinder frames, and take photos and movies.
- \ingroup multimedia_qml
- \ingroup camera_qml
- \inqmlmodule QtMultimedia
-
- \inherits QtObject
-
- You can use \c Camera to capture images and movies from a camera, and manipulate
- the capture and processing settings that get applied to the images. To display the
- viewfinder you can use \l VideoOutput with the Camera set as the source.
-
- \qml
- Item {
- width: 640
- height: 360
-
- Camera {
- id: camera
-
- imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
-
- exposure {
- exposureCompensation: -1.0
- exposureMode: Camera.ExposurePortrait
- }
-
- flash.mode: Camera.FlashOn
-
- imageCapture {
- onImageCaptured: {
- photoPreview.source = preview // Show the preview in an Image
- }
- }
- }
-
- VideoOutput {
- source: camera
- anchors.fill: parent
- focus : visible // to receive focus and capture key events when visible
- }
-
- Image {
- id: photoPreview
- }
- }
- \endqml
-
- If multiple cameras are available, you can select which one to use by setting the \l deviceId
- property to a value from
- \l{QtMultimedia::QtMultimedia::availableCameras}{QtMultimedia.availableCameras}.
- On a mobile device, you can conveniently switch between front-facing and back-facing cameras
- by setting the \l position property.
-
- The various settings and functionality of the Camera stack is spread
- across a few different child properties of Camera.
-
- \table
- \header \li Property \li Description
- \row \li \l {CameraCapture} {imageCapture}
- \li Methods and properties for capturing still images.
- \row \li \l {CameraRecorder} {videoRecorder}
- \li Methods and properties for capturing movies.
- \row \li \l {CameraExposure} {exposure}
- \li Methods and properties for adjusting exposure (aperture, shutter speed etc).
- \row \li \l {CameraFocus} {focus}
- \li Methods and properties for adjusting focus and providing feedback on autofocus progress.
- \row \li \l {CameraFlash} {flash}
- \li Methods and properties for controlling the camera flash.
- \row \li \l {CameraImageProcessing} {imageProcessing}
- \li Methods and properties for adjusting camera image processing parameters.
- \endtable
-
- Basic camera state management, error reporting, and simple zoom properties are
- available in the Camera itself. For integration with C++ code, the
- \l mediaSource property allows you to
- access the standard Qt Multimedia camera controls.
-
- Many of the camera settings may take some time to apply, and might be limited
- to certain supported values depending on the hardware. Some camera settings may be
- set manually or automatically. These settings properties contain the current set value.
- For example, when autofocus is enabled the focus zones are exposed in the
- \l {CameraFocus}{focus} property.
-
- For additional information, read also the \l{Camera Overview}{camera overview}.
-*/
-
-/*!
- \class QDeclarativeCamera
- \internal
- \brief The QDeclarativeCamera class provides a camera item that you can add to a QQuickView.
-*/
-
-/*!
- Construct a declarative camera object using \a parent object.
- */
-QDeclarativeCamera::QDeclarativeCamera(QObject *parent) :
- QObject(parent),
- m_camera(nullptr),
- m_componentComplete(false)
-{
- m_currentCameraInfo = QMediaDeviceManager::defaultVideoInput();
- m_camera = new QCamera(m_currentCameraInfo);
-
- m_videoRecorder = new QDeclarativeCameraRecorder(&captureSession);
- m_exposure = new QDeclarativeCameraExposure(m_camera);
- m_flash = new QDeclarativeCameraFlash(m_camera);
- m_torch = new QDeclarativeTorch(m_camera);
-
- connect(m_camera, &QCamera::activeChanged, this, &QDeclarativeCamera::activeChanged);
- connect(m_camera, SIGNAL(statusChanged(QCamera::Status)), this, SIGNAL(cameraStatusChanged()));
- connect(m_camera, SIGNAL(errorOccurred(QCamera::Error)), this, SLOT(_q_errorOccurred(QCamera::Error)));
-}
-
-/*! Destructor, clean up memory */
-QDeclarativeCamera::~QDeclarativeCamera()
-{
- // These must be deleted before QCamera
- delete m_videoRecorder;
- delete m_exposure;
- delete m_flash;
-
- delete m_camera;
-}
-
-void QDeclarativeCamera::classBegin()
-{
-}
-
-void QDeclarativeCamera::componentComplete()
-{
- m_componentComplete = true;
- setActive(pendingActive);
-}
-
-/*!
- \qmlproperty string QtMultimedia::Camera::deviceId
-
- This property holds the unique identifier for the camera device being used. It may not be human-readable.
-
- You can get all available device IDs from \l{QtMultimedia::QtMultimedia::availableCameras}{QtMultimedia.availableCameras}.
- If no value is provided or if set to an empty string, the system's default camera will be used.
-
- If possible, \l cameraState and other camera parameters are
- preserved when changing the camera device.
-
- \sa displayName, position
- \since 5.4
-*/
-
-QString QDeclarativeCamera::deviceId() const
-{
- return QString::fromLatin1(m_currentCameraInfo.id());
-}
-
-void QDeclarativeCamera::setDeviceId(const QString &name)
-{
- auto id = name.toLatin1();
- if (id == m_currentCameraInfo.id())
- return;
-
- setupDevice(name);
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::Camera::position
-
- This property holds the physical position of the camera on the hardware system.
-
- On a mobile device, this property can be used to easily choose between
- front-facing and back-facing cameras. If this property is set to
- \c Camera.UnspecifiedPosition, the system's default camera is used.
-
- If possible, \l cameraState and other camera
- parameters are preserved when changing the camera device.
-
- \value Camera.UnspecifiedPosition
- The camera position is unspecified or unknown.
- \value Camera.BackFace
- The camera is on the back face of the system hardware. For example,
- on a mobile device, it is on side opposite from the screen.
- \value Camera.FrontFace
- The camera is on the front face of the system hardware. For example,
- on a mobile device, it means it is on the same side as the screen.
- Viewfinder frames of front-facing cameras are mirrored horizontally,
- so the users can see themselves as looking into a mirror. Captured
- images or videos are not mirrored.
-
- \sa deviceId
- \since 5.4
-*/
-
-QDeclarativeCamera::Position QDeclarativeCamera::position() const
-{
- return QDeclarativeCamera::Position(m_currentCameraInfo.position());
-}
-
-void QDeclarativeCamera::setPosition(Position position)
-{
- QCameraInfo::Position pos = QCameraInfo::Position(position);
- if (pos == m_currentCameraInfo.position())
- return;
-
- QByteArray id;
-
- if (pos != QCameraInfo::UnspecifiedPosition) {
- const QList<QCameraInfo> cameras = QMediaDeviceManager::videoInputs();
- for (auto c : cameras) {
- if (c.position() == pos) {
- id = c.id();
- break;
- }
- }
- }
- if (id.isEmpty())
- id = QMediaDeviceManager::defaultVideoInput().id();
-
- if (!id.isEmpty())
- setupDevice(QString::fromLatin1(id));
-}
-
-/*!
- \qmlproperty string QtMultimedia::Camera::displayName
-
- This property holds the human-readable name of the camera.
-
- You can use this property to display the name of the camera in a user interface.
-
- \readonly
- \sa deviceId
- \since 5.4
-*/
-
-QString QDeclarativeCamera::displayName() const
-{
- return m_currentCameraInfo.description();
-}
-
-/*!
- \qmlproperty int QtMultimedia::Camera::orientation
-
- This property holds the physical orientation of the camera sensor.
-
- The value is the orientation angle (clockwise, in steps of 90 degrees) of the camera sensor in
- relation to the display in its natural orientation.
-
- For example, suppose a mobile device which is naturally in portrait orientation. The back-facing
- camera is mounted in landscape. If the top side of the camera sensor is aligned with the right
- edge of the screen in natural orientation, \c orientation returns \c 270. If the top side of a
- front-facing camera sensor is aligned with the right edge of the screen, \c orientation
- returns \c 90.
-
- \readonly
- \sa VideoOutput::orientation
- \since 5.4
-*/
-
-void QDeclarativeCamera::setupDevice(const QString &deviceName)
-{
- QCameraInfo oldCameraInfo = m_currentCameraInfo;
-
- auto cameras = QMediaDeviceManager::videoInputs();
- QByteArray id = deviceName.toUtf8();
- QCameraInfo info;
- for (const auto &c : cameras) {
- if (c.id() == id) {
- info = c;
- break;
- }
- }
- m_currentCameraInfo = info;
- m_camera->setCameraInfo(info);
-
- emit deviceIdChanged();
- if (oldCameraInfo.description() != m_currentCameraInfo.description())
- emit displayNameChanged();
- if (oldCameraInfo.position() != m_currentCameraInfo.position())
- emit positionChanged();
-}
-
-/*!
- Returns any camera error.
- \sa QDeclarativeCameraError::Error
-*/
-QDeclarativeCamera::Error QDeclarativeCamera::errorCode() const
-{
- return QDeclarativeCamera::Error(m_camera->error());
-}
-
-/*!
- \qmlproperty string QtMultimedia::Camera::errorString
-
- This property holds the last error string, if any.
-
- \sa errorOccurred, errorCode
-*/
-QString QDeclarativeCamera::errorString() const
-{
- return m_camera->errorString();
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::Camera::isAvailable
-
- This property returns the availability of the camera.
- */
-bool QDeclarativeCamera::isAvailable() const
-{
- return m_camera->isAvailable();
-}
-
-/*!
- \qmlproperty bool QtMultimedia::Camera::active
-
- This property holds the camera object's current state. By default, the default
- camera is inactive.
-*/
-bool QDeclarativeCamera::isActive() const
-{
- return m_componentComplete ? m_camera->isActive() : pendingActive;
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::Camera::cameraStatus
-
- This property holds the camera object's current status.
-
- \value Camera.ActiveStatus
- The camera has been started and can produce data,
- viewfinder displays video frames.
- Depending on backend, changing camera settings such as
- capture mode, codecs, or resolution in \c {Camera.ActiveState} may
- lead to changing the status to \c LoadedStatus and \c StartingStatus
- while the settings are applied, and back to \c ActiveStatus when
- the camera is ready.
- \value Camera.StartingStatus
- The camera is transitioning to \c {Camera.ActiveState}. The camera
- service is not ready to capture yet.
- \value Camera.StoppingStatus
- The camera is transitioning from \c {Camera.ActiveState} to
- \c {Camera.InactiveState}.
- \value Camera.InactiveStatus
- The camera is inactive.
- \value Camera.UnavailableStatus
- The camera is not available.
-*/
-QDeclarativeCamera::Status QDeclarativeCamera::cameraStatus() const
-{
- return QDeclarativeCamera::Status(m_camera->status());
-}
-
-void QDeclarativeCamera::setActive(bool active)
-{
- if (!m_componentComplete) {
- pendingActive = active;
- return;
- }
-
- m_camera->setActive(active);
-}
-
-/*!
- \qmlmethod QtMultimedia::Camera::start()
-
- Starts the camera. Viewfinder frames will
- be available and image or movie capture will
- be possible.
-*/
-
-/*!
- \qmlmethod QtMultimedia::Camera::stop()
-
- Stops the camera, but leaves the camera
- stack loaded.
-
- In this state, the camera still consumes power.
-*/
-
-/*!
- \qmlproperty variant QtMultimedia::Camera::mediaSource
-
- This property holds the native media object for the camera.
-
- It can be used to get a pointer to a QCamera object in order to integrate with C++ code.
-
- \code
- QObject *qmlCamera; // The QML Camera object
- QCamera *camera = qvariant_cast<QCamera *>(qmlCamera->property("mediaSource"));
- \endcode
-
- \note This property is not accessible from QML.
-*/
-
-/*!
- \qmlproperty enumeration QtMultimedia::Camera::errorCode
-
- This property holds the last error code.
-
- \value Camera.NoError
- No errors have occurred.
- \value Camera.CameraError
- An error has occurred.
-
- \sa errorOccurred, errorString
-*/
-
-/*!
- \qmlsignal QtMultimedia::Camera::error(errorCode, errorString)
- \obsolete
-
- Use errorOccurred() instead.
-*/
-
-/*!
- \qmlsignal QtMultimedia::Camera::errorOccurred(errorCode, errorString)
- \since 5.15
-
- This signal is emitted when an error specified by \a errorCode occurs.
- A descriptive string value is available in \a errorString.
-
- The corresponding handler is \c onError.
-
- \sa errorCode, errorString
-*/
-
-/*!
- \qmlsignal Camera::activeChanged(active)
-
- This signal is emitted when the camera state has changed to \a active. Since the
- state changes may take some time to occur this signal may arrive sometime
- after the state change has been requested.
-
- The corresponding handler is \c onActiveChanged.
-*/
-
-/*!
- \qmlsignal Camera::opticalZoomChanged(zoom)
-
- This signal is emitted when the optical zoom setting has changed to \a zoom.
-
- The corresponding handler is \c onOpticalZoomChanged.
-*/
-
-/*!
- \qmlsignal Camera::digitalZoomChanged(zoom)
-
- This signal is emitted when the digital zoom setting has changed to \a zoom.
-
- The corresponding handler is \c onDigitalZoomChanged.
-*/
-
-/*!
- \qmlsignal Camera::maximumOpticalZoomChanged(zoom)
-
- This signal is emitted when the maximum optical zoom setting has
- changed to \a zoom. This can occur when you change between video
- and still image capture modes, or the capture settings are changed.
-
- The corresponding handler is \c onMaximumOpticalZoomChanged.
-*/
-
-/*!
- \qmlsignal Camera::maximumDigitalZoomChanged(zoom)
-
- This signal is emitted when the maximum digital zoom setting has
- changed to \a zoom. This can occur when you change between video
- and still image capture modes, or the capture settings are changed.
-
- The corresponding handler is \c onMaximumDigitalZoomChanged.
-*/
-
-/*!
- \qmlmethod list<size> QtMultimedia::Camera::supportedViewfinderResolutions(real minimumFrameRate, real maximumFrameRate)
-
- Returns a list of supported viewfinder resolutions.
-
- If both optional parameters \a minimumFrameRate and \a maximumFrameRate are specified, the
- returned list is reduced to resolutions supported for the given frame rate range.
-
- The camera must be loaded before calling this function, otherwise the returned list
- is empty.
-
- \sa {QtMultimedia::Camera::viewfinder}{viewfinder}
-
- \since 5.5
-*/
-QJSValue QDeclarativeCamera::supportedResolutions(qreal minimumFrameRate, qreal maximumFrameRate)
-{
- QQmlEngine *engine = qmlEngine(this);
-
- QCameraInfo info = m_camera->cameraInfo();
-
- const auto formats = info.videoFormats();
- QJSValue supportedResolutions = engine->newArray(formats.count());
- int i = 0;
- 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);
- }
-
- return supportedResolutions;
-}
-
-/*!
- \qmlmethod list<object> QtMultimedia::Camera::supportedViewfinderFrameRateRanges(size resolution)
-
- Returns a list of supported viewfinder frame rate ranges.
-
- Each range object in the list has the \c minimumFrameRate and \c maximumFrameRate properties.
-
- If the optional parameter \a resolution is specified, the returned list is reduced to frame rate
- ranges supported for the given \a resolution.
-
- The camera must be loaded before calling this function, otherwise the returned list
- is empty.
-
- \sa {QtMultimedia::Camera::viewfinder}{viewfinder}
-
- \since 5.5
-*/
-QJSValue QDeclarativeCamera::supportedFrameRateRanges(const QJSValue &resolution)
-{
- QQmlEngine *engine = qmlEngine(this);
-
- QSize res;
- if (!resolution.isUndefined()) {
- QJSValue width = resolution.property(QStringLiteral("width"));
- QJSValue height = resolution.property(QStringLiteral("height"));
- if (width.isNumber() && height.isNumber())
- res = QSize(width.toInt(), height.toInt());
- }
- 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;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecamera_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h
deleted file mode 100644
index 425c60ddf..000000000
--- a/src/imports/multimedia/qdeclarativecamera_p.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 QDECLARATIVECAMERA_H
-#define QDECLARATIVECAMERA_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 "qdeclarativecamerarecorder_p.h"
-
-#include <qcamera.h>
-#include <qcamerainfo.h>
-#include <qcameraimageprocessing.h>
-#include <qmediacapturesession.h>
-
-#include <QtCore/qbasictimer.h>
-#include <QtCore/qdatetime.h>
-#include <QtQml/qqmlparserstatus.h>
-#include <QtQml/qqml.h>
-#include <QtQml/qjsvalue.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCameraExposure;
-class QDeclarativeCameraFlash;
-class QDeclarativeTorch;
-class QDeclarativeCamera : public QObject, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
-
- Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged REVISION 1)
- Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged REVISION 1)
- Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged REVISION 1)
-
- Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
- Q_PROPERTY(Status cameraStatus READ cameraStatus NOTIFY cameraStatusChanged)
- Q_PROPERTY(Error errorCode READ errorCode NOTIFY errorChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
-
- Q_PROPERTY(QDeclarativeCameraRecorder* videoRecorder READ videoRecorder CONSTANT)
- Q_PROPERTY(QDeclarativeCameraExposure* exposure READ exposure CONSTANT)
- Q_PROPERTY(QDeclarativeCameraFlash* flash READ flash CONSTANT)
- Q_PROPERTY(QDeclarativeTorch* torch READ torch CONSTANT)
- Q_PROPERTY(QCameraFocus* focus READ focus CONSTANT)
- Q_PROPERTY(QCameraImageProcessing* imageProcessing READ imageProcessing CONSTANT)
-
- Q_ENUMS(Position)
- Q_ENUMS(State)
- Q_ENUMS(Status)
- Q_ENUMS(Error)
-
- Q_ENUMS(FlashMode)
- Q_ENUMS(ExposureMode)
-
- Q_ENUMS(FocusMode)
-
-public:
- enum Position {
- UnspecifiedPosition = QCameraInfo::UnspecifiedPosition,
- BackFace = QCameraInfo::BackFace,
- FrontFace = QCameraInfo::FrontFace
- };
-
- enum Status
- {
- UnavailableStatus = QCamera::UnavailableStatus,
- InactiveStatus = QCamera::InactiveStatus,
- StartingStatus = QCamera::StartingStatus,
- StoppingStatus = QCamera::StoppingStatus,
- ActiveStatus = QCamera::ActiveStatus
- };
-
- enum Error
- {
- NoError = QCamera::NoError,
- CameraError = QCamera::CameraError
- };
-
- enum FlashMode {
- FlashAuto = QCameraExposure::FlashAuto,
- FlashOff = QCameraExposure::FlashOff,
- FlashOn = QCameraExposure::FlashOn,
- };
-
- enum ExposureMode {
- ExposureAuto = QCameraExposure::ExposureAuto,
- ExposureManual = QCameraExposure::ExposureManual,
- ExposurePortrait = QCameraExposure::ExposurePortrait,
- ExposureNight = QCameraExposure::ExposureNight,
- ExposureSports = QCameraExposure::ExposureSports,
- ExposureSnow = QCameraExposure::ExposureSnow,
- ExposureBeach = QCameraExposure::ExposureBeach,
- ExposureAction = QCameraExposure::ExposureAction,
- ExposureLandscape = QCameraExposure::ExposureLandscape,
- ExposureNightPortrait = QCameraExposure::ExposureNightPortrait,
- ExposureTheatre = QCameraExposure::ExposureTheatre,
- ExposureSunset = QCameraExposure::ExposureSunset,
- ExposureSteadyPhoto = QCameraExposure::ExposureSteadyPhoto,
- ExposureFireworks = QCameraExposure::ExposureFireworks,
- ExposureParty = QCameraExposure::ExposureParty,
- ExposureCandlelight = QCameraExposure::ExposureCandlelight,
- ExposureBarcode = QCameraExposure::ExposureBarcode,
- };
-
- enum FocusMode {
- FocusModeAuto = QCameraFocus::FocusModeAuto,
- FocusModeAutoNear = QCameraFocus::FocusModeAutoNear,
- FocusModeAutoFar = QCameraFocus::FocusModeAutoFar,
- FocusModeHyperfocal = QCameraFocus::FocusModeHyperfocal,
- FocusModeInfinity = QCameraFocus::FocusModeInfinity,
- FocusModeManual = QCameraFocus::FocusModeManual
-#if 1 // QT_DEPRECATED
- , FocusContinuous = FocusModeAuto,
- FocusAuto = FocusModeAuto,
- FocusMacro = FocusModeAutoNear,
- FocusHyperfocal = FocusModeHyperfocal,
- FocusInfinity = FocusModeInfinity,
- FocusManual = FocusModeManual
-#endif
- };
-
- QDeclarativeCamera(QObject *parent = 0);
- ~QDeclarativeCamera();
-
- QDeclarativeCameraRecorder *videoRecorder() { return m_videoRecorder; }
- QDeclarativeCameraExposure *exposure() { return m_exposure; }
- QDeclarativeCameraFlash *flash() { return m_flash; }
- QDeclarativeTorch *torch() { return m_torch; }
- QCameraFocus *focus() { return m_camera->focus(); }
- QCameraImageProcessing *imageProcessing() { return m_camera->imageProcessing(); }
-
- QString deviceId() const;
- void setDeviceId(const QString &name);
-
- Position position() const;
- void setPosition(Position position);
-
- QString displayName() const;
-
- bool isActive() const;
- Status cameraStatus() const;
-
- Error errorCode() const;
- QString errorString() const;
-
- bool isAvailable() const;
-
-public Q_SLOTS:
- void start() { setActive(true); }
- void stop() { setActive(false); }
-
- void setActive(bool active);
-
- Q_REVISION(2) QJSValue supportedResolutions(qreal minimumFrameRate = 0.0,
- qreal maximumFrameRate = 0.0);
-
- Q_REVISION(2) QJSValue supportedFrameRateRanges(const QJSValue &resolution = QJSValue());
-
-Q_SIGNALS:
- void errorChanged();
- Q_REVISION(15) void errorOccurred(QDeclarativeCamera::Error errorCode, const QString &errorString);
-
- Q_REVISION(1) void deviceIdChanged();
- Q_REVISION(1) void positionChanged();
- Q_REVISION(1) void displayNameChanged();
-
- void activeChanged();
- void cameraStatusChanged();
-
-private Q_SLOTS:
- void _q_errorOccurred(QCamera::Error);
-
-protected:
- void classBegin() override;
- void componentComplete() override;
-
-private:
- Q_DISABLE_COPY(QDeclarativeCamera)
- void setupDevice(const QString &deviceName);
-
- QMediaCaptureSession captureSession;
- QCamera *m_camera;
- QCameraInfo m_currentCameraInfo;
-
- QDeclarativeCameraRecorder *m_videoRecorder;
- QDeclarativeCameraExposure *m_exposure;
- QDeclarativeCameraFlash *m_flash;
- QDeclarativeTorch *m_torch;
-
- bool m_componentComplete;
- bool pendingActive = false;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCamera))
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp
deleted file mode 100644
index cca388243..000000000
--- a/src/imports/multimedia/qdeclarativecameraexposure.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 "qdeclarativecameraexposure_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CameraExposure
- \instantiates QDeclarativeCameraExposure
- \brief An interface for exposure related camera settings.
- \ingroup multimedia_qml
- \ingroup camera_qml
- \inqmlmodule QtMultimedia
-
- CameraExposure allows you to adjust exposure related settings
- like aperture and shutter speed and ISO speed.
-
- It should not be constructed separately, instead the
- \c exposure property of the a \l Camera should be used.
-
- \qml
-
- Camera {
- id: camera
-
- exposure.exposureCompensation: -1.0
- exposure.exposureMode: Camera.ExposurePortrait
- }
-
- \endqml
-
- Several settings have both an automatic and a manual mode. In
- the automatic modes the camera software itself will decide what
- a reasonable setting is, but in most cases these settings can
- be overridden with a specific manual setting.
-
- For example, to select automatic shutter speed selection:
-
- \code
- camera.exposure.setAutoShutterSpeed()
- \endcode
-
- Or for a specific shutter speed:
-
- \code
- camera.exposure.manualShutterSpeed = 0.01 // 10ms
- \endcode
-
- You can only choose one or the other mode.
-*/
-
-/*!
- \internal
- \class QDeclarativeCameraExposure
- \brief The CameraExposure provides interface for exposure related camera settings.
-
-*/
-
-/*!
- Construct a declarative camera exposure object using \a parent object.
- */
-QDeclarativeCameraExposure::QDeclarativeCameraExposure(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_exposure = camera->exposure();
-
- connect(m_exposure, SIGNAL(isoSensitivityChanged(int)), this, SIGNAL(isoSensitivityChanged(int)));
- connect(m_exposure, SIGNAL(apertureChanged(qreal)), this, SIGNAL(apertureChanged(qreal)));
- connect(m_exposure, SIGNAL(shutterSpeedChanged(qreal)), this, SIGNAL(shutterSpeedChanged(qreal)));
-
- connect(m_exposure, SIGNAL(exposureCompensationChanged(qreal)), this, SIGNAL(exposureCompensationChanged(qreal)));
- connect(camera, &QCamera::statusChanged, [this](QCamera::Status status) {
- if (status != QCamera::InactiveStatus && status != QCamera::ActiveStatus)
- return;
-
- emit supportedExposureModesChanged();
- });
-}
-
-QDeclarativeCameraExposure::~QDeclarativeCameraExposure() = default;
-/*!
- \property QDeclarativeCameraExposure::exposureCompensation
-
- This property holds the adjustment value for the automatically calculated exposure. The value is in EV units.
- */
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::exposureCompensation
-
- This property holds the adjustment value for the automatically calculated exposure. The value is
- in EV units.
- */
-qreal QDeclarativeCameraExposure::exposureCompensation() const
-{
- return m_exposure->exposureCompensation();
-}
-
-void QDeclarativeCameraExposure::setExposureCompensation(qreal ev)
-{
- m_exposure->setExposureCompensation(ev);
-}
-/*!
- \property QDeclarativeCameraExposure::iso
-
- This property holds the sensor's ISO sensitivity value.
- */
-/*!
- \qmlproperty int QtMultimedia::CameraExposure::iso
-
- This property holds the sensor's ISO sensitivity value.
- */
-int QDeclarativeCameraExposure::isoSensitivity() const
-{
- return m_exposure->isoSensitivity();
-}
-/*!
- \property QDeclarativeCameraExposure::shutterSpeed
-
- This property holds the camera's shutter speed value in seconds.
- To affect the shutter speed you can use the \l manualShutterSpeed
- property and \l setAutoShutterSpeed().
-
-*/
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::shutterSpeed
-
- This property holds the camera's current shutter speed value in seconds.
- To affect the shutter speed you can use the \l manualShutterSpeed
- property and \l setAutoShutterSpeed().
-
-*/
-qreal QDeclarativeCameraExposure::shutterSpeed() const
-{
- return m_exposure->shutterSpeed();
-}
-/*!
- \property QDeclarativeCameraExposure::aperture
-
- This property holds the current lens aperture as an F number (the ratio of the focal length to effective aperture diameter).
-
- \sa manualAperture, setAutoAperture()
-*/
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::aperture
-
- This property holds the current lens aperture as an F number (the ratio of
- the focal length to effective aperture diameter).
-
- \sa manualAperture, setAutoAperture()
-*/
-qreal QDeclarativeCameraExposure::aperture() const
-{
- return m_exposure->aperture();
-}
-/*!
- \property QDeclarativeCameraExposure::manualIso
-
- This property holds the ISO settings for capturing photos.
-
- If the value is negative, the camera will
- automatically determine an appropriate value.
-
- \sa iso, setAutoIsoSensitivity()
-*/
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::manualIso
-
- This property holds the ISO settings for capturing photos.
-
- If a negative value is specified, the camera will
- automatically determine an appropriate value.
-
- \sa iso, setAutoIsoSensitivity()
-*/
-
-int QDeclarativeCameraExposure::manualIsoSensitivity() const
-{
- return m_manualIso;
-}
-
-void QDeclarativeCameraExposure::setManualIsoSensitivity(int iso)
-{
- m_manualIso = iso;
- if (iso > 0)
- m_exposure->setManualIsoSensitivity(iso);
- else
- m_exposure->setAutoIsoSensitivity();
-
- emit manualIsoSensitivityChanged(iso);
-}
-/*!
- \property QDeclarativeCameraExposure::manualShutterSpeed
-
- This property holds the shutter speed value (in seconds).
- If the value is less than zero, the camera automatically
- determines an appropriate shutter speed.
-
- \l shutterSpeed, setAutoShutterSpeed()
-*/
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::manualShutterSpeed
-
- This property holds the shutter speed value (in seconds).
- If the value is less than zero, the camera automatically
- determines an appropriate shutter speed.
-
- \l shutterSpeed, setAutoShutterSpeed()
-*/
-qreal QDeclarativeCameraExposure::manualShutterSpeed() const
-{
- return m_manualShutterSpeed;
-}
-
-void QDeclarativeCameraExposure::setManualShutterSpeed(qreal speed)
-{
- m_manualShutterSpeed = speed;
- if (speed > 0)
- m_exposure->setManualShutterSpeed(speed);
- else
- m_exposure->setAutoShutterSpeed();
-
- emit manualShutterSpeedChanged(speed);
-}
-/*!
- \property QDeclarativeCameraExposure::manualAperture
-
- This property holds aperture (F number) value
- for capturing photos.
-
- If the value is less than zero,
- the camera automatically determines an appropriate aperture value.
-
- \l aperture, setAutoAperture()
-*/
-/*!
- \qmlproperty real QtMultimedia::CameraExposure::manualAperture
-
- This property holds the aperture (F number) value
- for capturing photos.
-
- If the value is less than zero, the camera automatically
- determines an appropriate aperture value.
-
- \l aperture, setAutoAperture()
-*/
-qreal QDeclarativeCameraExposure::manualAperture() const
-{
- return m_manualAperture;
-}
-
-void QDeclarativeCameraExposure::setManualAperture(qreal aperture)
-{
- m_manualAperture = aperture;
- if (aperture > 0)
- m_exposure->setManualAperture(aperture);
- else
- m_exposure->setAutoAperture();
-
- emit manualApertureChanged(aperture);
-}
-
-/*!
- \qmlmethod QtMultimedia::CameraExposure::setAutoAperture()
- Turn on auto aperture selection. The manual aperture value is reset to -1.0
- */
-void QDeclarativeCameraExposure::setAutoAperture()
-{
- setManualAperture(-1.0);
-}
-
-/*!
- \qmlmethod QtMultimedia::CameraExposure::setAutoShutterSpeed()
- Turn on auto shutter speed selection. The manual shutter speed value is reset to -1.0
- */
-void QDeclarativeCameraExposure::setAutoShutterSpeed()
-{
- setManualShutterSpeed(-1.0);
-}
-
-/*!
- \qmlmethod QtMultimedia::CameraExposure::setAutoIsoSensitivity()
- Turn on auto ISO sensitivity selection. The manual ISO value is reset to -1.
- */
-void QDeclarativeCameraExposure::setAutoIsoSensitivity()
-{
- setManualIsoSensitivity(-1);
-}
-/*!
- \property QDeclarativeCameraExposure::exposureMode
-
- This property holds the camera exposure mode. The mode can one of the values in \l QCameraExposure::ExposureMode.
-*/
-/*!
- \qmlproperty enumeration QtMultimedia::CameraExposure::exposureMode
-
- This property holds the camera exposure mode.
-
- The mode can be one of the following:
-
- \table
- \header \li Value \li Description
- \row \li Camera.ExposureManual \li Manual mode.
- \row \li Camera.ExposureAuto \li Automatic mode.
- \row \li Camera.ExposureNight \li Night mode.
- \row \li Camera.ExposureSports \li Spots exposure mode.
- \row \li Camera.ExposureSnow \li Snow exposure mode.
- \row \li Camera.ExposureBeach \li Beach exposure mode.
- \row \li Camera.ExposurePortrait \li Portrait exposure mode.
- \row \li Camera.ExposureAction \li Action exposure mode. Since 5.5
- \row \li Camera.ExposureLandscape \li Landscape exposure mode. Since 5.5
- \row \li Camera.ExposureNightPortrait \li Night portrait exposure mode. Since 5.5
- \row \li Camera.ExposureTheatre \li Theatre exposure mode. Since 5.5
- \row \li Camera.ExposureSunset \li Sunset exposure mode. Since 5.5
- \row \li Camera.ExposureSteadyPhoto \li Steady photo exposure mode. Since 5.5
- \row \li Camera.ExposureFireworks \li Fireworks exposure mode. Since 5.5
- \row \li Camera.ExposureParty \li Party exposure mode. Since 5.5
- \row \li Camera.ExposureCandlelight \li Candlelight exposure mode. Since 5.5
- \row \li Camera.ExposureBarcode \li Barcode exposure mode. Since 5.5
- \endtable
-*/
-
-QDeclarativeCameraExposure::ExposureMode QDeclarativeCameraExposure::exposureMode() const
-{
- return QDeclarativeCameraExposure::ExposureMode(m_exposure->exposureMode());
-}
-
-void QDeclarativeCameraExposure::setExposureMode(QDeclarativeCameraExposure::ExposureMode mode)
-{
- if (exposureMode() != mode) {
- m_exposure->setExposureMode(QCameraExposure::ExposureMode(mode));
- emit exposureModeChanged(exposureMode());
- }
-}
-
-/*!
- \qmlproperty list<ExposureMode> QtMultimedia::CameraExposure::supportedExposureModes
-
- This property holds the supported exposure modes of the camera.
-
- \since 5.11
- \sa exposureMode
- */
-QVariantList QDeclarativeCameraExposure::supportedExposureModes() const
-{
- QVariantList supportedModes;
-
- for (int i = int(ExposureAuto); i <= int(QCameraExposure::ExposureBarcode); ++i) {
- if (m_exposure->isExposureModeSupported((QCameraExposure::ExposureMode) i))
- supportedModes.append(QVariant(i));
- }
-
- return supportedModes;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraexposure_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h
deleted file mode 100644
index 5471eefa7..000000000
--- a/src/imports/multimedia/qdeclarativecameraexposure_p.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 QDECLARATIVECAMERAEXPOSURE_H
-#define QDECLARATIVECAMERAEXPOSURE_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 "qdeclarativecamera_p.h"
-#include <qcamera.h>
-#include <qcameraexposure.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraExposure : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged)
-
- Q_PROPERTY(int iso READ isoSensitivity NOTIFY isoSensitivityChanged)
- Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged)
- Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged)
-
- Q_PROPERTY(qreal manualShutterSpeed READ manualShutterSpeed WRITE setManualShutterSpeed NOTIFY manualShutterSpeedChanged)
- Q_PROPERTY(qreal manualAperture READ manualAperture WRITE setManualAperture NOTIFY manualApertureChanged)
- Q_PROPERTY(qreal manualIso READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged)
-
- Q_PROPERTY(ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged)
- Q_PROPERTY(QVariantList supportedExposureModes READ supportedExposureModes NOTIFY supportedExposureModesChanged REVISION 1)
-
- Q_ENUMS(ExposureMode)
-public:
- enum ExposureMode {
- ExposureAuto = QCameraExposure::ExposureAuto,
- ExposureManual = QCameraExposure::ExposureManual,
- ExposurePortrait = QCameraExposure::ExposurePortrait,
- ExposureNight = QCameraExposure::ExposureNight,
- ExposureSports = QCameraExposure::ExposureSports,
- ExposureSnow = QCameraExposure::ExposureSnow,
- ExposureBeach = QCameraExposure::ExposureBeach,
- ExposureAction = QCameraExposure::ExposureAction,
- ExposureLandscape = QCameraExposure::ExposureLandscape,
- ExposureNightPortrait = QCameraExposure::ExposureNightPortrait,
- ExposureTheatre = QCameraExposure::ExposureTheatre,
- ExposureSunset = QCameraExposure::ExposureSunset,
- ExposureSteadyPhoto = QCameraExposure::ExposureSteadyPhoto,
- ExposureFireworks = QCameraExposure::ExposureFireworks,
- ExposureParty = QCameraExposure::ExposureParty,
- ExposureCandlelight = QCameraExposure::ExposureCandlelight,
- ExposureBarcode = QCameraExposure::ExposureBarcode,
- };
-
- ~QDeclarativeCameraExposure();
-
- ExposureMode exposureMode() const;
- QVariantList supportedExposureModes() const;
- qreal exposureCompensation() const;
-
- int isoSensitivity() const;
- qreal shutterSpeed() const;
- qreal aperture() const;
-
- int manualIsoSensitivity() const;
- qreal manualShutterSpeed() const;
- qreal manualAperture() const;
-
-public Q_SLOTS:
- void setExposureMode(ExposureMode);
- void setExposureCompensation(qreal ev);
-
- void setManualAperture(qreal);
- void setManualShutterSpeed(qreal);
- void setManualIsoSensitivity(int iso);
-
- void setAutoAperture();
- void setAutoShutterSpeed();
- void setAutoIsoSensitivity();
-
-Q_SIGNALS:
- void isoSensitivityChanged(int);
- void apertureChanged(qreal);
- void shutterSpeedChanged(qreal);
-
- void manualIsoSensitivityChanged(int);
- void manualApertureChanged(qreal);
- void manualShutterSpeedChanged(qreal);
-
- void exposureCompensationChanged(qreal);
- void exposureModeChanged(ExposureMode);
- void supportedExposureModesChanged();
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraExposure(QCamera *camera, QObject *parent = 0);
-
- QCameraExposure *m_exposure;
- int m_manualIso;
- qreal m_manualAperture;
- qreal m_manualShutterSpeed;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure))
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameraflash.cpp b/src/imports/multimedia/qdeclarativecameraflash.cpp
deleted file mode 100644
index dd2255393..000000000
--- a/src/imports/multimedia/qdeclarativecameraflash.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 "qdeclarativecameraflash_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CameraFlash
- \instantiates QDeclarativeCameraFlash
- \inqmlmodule QtMultimedia
- \brief An interface for flash related camera settings.
- \ingroup multimedia_qml
- \ingroup camera_qml
-
- This type allows you to operate the camera flash
- hardware and control the flash mode used. Not all cameras have
- flash hardware (and in some cases it is shared with the
- \l {Torch}{torch} hardware).
-
- It should not be constructed separately, instead the
- \c flash property of a \l Camera should be used.
-
- \qml
-
- Camera {
- id: camera
-
- exposure.exposureCompensation: -1.0
- flash.mode: Camera.FlashRedEyeReduction
- }
-
- \endqml
-*/
-
-/*!
- Construct a declarative camera flash object using \a parent object.
- */
-QDeclarativeCameraFlash::QDeclarativeCameraFlash(QCamera *camera, QObject *parent)
- : QObject(parent)
-{
- m_exposure = camera->exposure();
- connect(m_exposure, SIGNAL(flashReady(bool)), this, SIGNAL(flashReady(bool)));
- connect(camera, SIGNAL(statusChanged(QCamera::Status)),
- this, SLOT(_q_cameraStatusChanged(QCamera::Status)));
-}
-
-QDeclarativeCameraFlash::~QDeclarativeCameraFlash() = default;
-
-/*!
- \qmlproperty bool QtMultimedia::CameraFlash::ready
-
- This property indicates whether the flash is charged.
-*/
-bool QDeclarativeCameraFlash::isFlashReady() const
-{
- return m_exposure->isFlashReady();
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraFlash::mode
-
- This property holds the camera flash mode.
-
- The mode can be one of the following:
- \table
- \header \li Value \li Description
- \row \li Camera.FlashOff \li Flash is Off.
- \row \li Camera.FlashOn \li Flash is On.
- \row \li Camera.FlashAuto \li Automatic flash.
- \endtable
-
-*/
-QDeclarativeCameraFlash::FlashMode QDeclarativeCameraFlash::flashMode() const
-{
- return QDeclarativeCameraFlash::FlashMode(int(m_exposure->flashMode()));
-}
-
-void QDeclarativeCameraFlash::setFlashMode(QDeclarativeCameraFlash::FlashMode mode)
-{
- if (flashMode() != mode) {
- m_exposure->setFlashMode(QCameraExposure::FlashMode(mode));
- emit flashModeChanged(mode);
- }
-}
-
-void QDeclarativeCameraFlash::_q_cameraStatusChanged(QCamera::Status status)
-{
- if (status != QCamera::InactiveStatus && status != QCamera::ActiveStatus)
- return;
-
- emit supportedModesChanged();
-}
-
-/*!
- \qmlproperty list<FlashMode> QtMultimedia::CameraFlash::supportedModes
-
- This property holds the supported flash modes of the camera. If the list
- only contains Camera.FlashOff, no flash is supported.
-
- \code
- Camera {
- id: camera
- flash {
- onSupportedModesChanged {
- if (flash.supportedModes.length == 1) {
- // no flash supported
- } else {
- // some flash is supported
- }
- }
- }
- }
- \endcode
-
- \since 5.9
- \sa mode
- */
-QVariantList QDeclarativeCameraFlash::supportedModes() const
-{
- QVariantList supportedModes;
-
- for (int i = 0; i <= QCameraExposure::FlashAuto; ++i) {
- if (m_exposure->isFlashModeSupported((QCameraExposure::FlashMode) i))
- supportedModes.append(QVariant(i));
- }
-
- return supportedModes;
-}
-
-/*!
- \qmlsignal QtMultimedia::CameraFlash::flashModeChanged()
- This signal is emitted when the \c flashMode property is changed.
- The corresponding handler is \c onFlashModeChanged.
-*/
-
-/*!
- \qmlsignal QtMultimedia::CameraFlash::flashReady()
- This signal is emitted when QCameraExposure indicates that
- the flash is ready to use.
- The corresponding handler is \c onFlashReadyChanged.
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraflash_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraflash_p.h b/src/imports/multimedia/qdeclarativecameraflash_p.h
deleted file mode 100644
index 3894cfbe3..000000000
--- a/src/imports/multimedia/qdeclarativecameraflash_p.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 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 QDECLARATIVECAMERAFLASH_H
-#define QDECLARATIVECAMERAFLASH_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 <qcameraexposure.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraFlash : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool ready READ isFlashReady NOTIFY flashReady)
- Q_PROPERTY(FlashMode mode READ flashMode WRITE setFlashMode NOTIFY flashModeChanged)
- Q_PROPERTY(QVariantList supportedModes READ supportedModes NOTIFY supportedModesChanged REVISION 1)
-
- Q_ENUMS(FlashMode)
-public:
- enum FlashMode {
- FlashAuto = QCameraExposure::FlashAuto,
- FlashOff = QCameraExposure::FlashOff,
- FlashOn = QCameraExposure::FlashOn,
- };
-
- ~QDeclarativeCameraFlash();
-
- FlashMode flashMode() const;
- bool isFlashReady() const;
- QVariantList supportedModes() const;
-
-public Q_SLOTS:
- void setFlashMode(FlashMode);
-
-Q_SIGNALS:
- void flashReady(bool status);
- void flashModeChanged(FlashMode);
- void supportedModesChanged();
-
-private slots:
- void _q_cameraStatusChanged(QCamera::Status status);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraFlash(QCamera *camera, QObject *parent = 0);
-
- QCameraExposure *m_exposure;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFlash))
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecamerarecorder.cpp b/src/imports/multimedia/qdeclarativecamerarecorder.cpp
deleted file mode 100644
index 61446a11d..000000000
--- a/src/imports/multimedia/qdeclarativecamerarecorder.cpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 "qdeclarativecamerarecorder_p.h"
-
-#include <QtCore/qurl.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CameraRecorder
- \instantiates QDeclarativeCameraRecorder
- \inqmlmodule QtMultimedia
- \brief Controls video recording with the Camera.
- \ingroup multimedia_qml
- \ingroup camera_qml
-
- CameraRecorder allows recording camera streams to files, and adjusting recording
- settings and metadata for videos.
-
- It should not be constructed separately, instead the
- \c videoRecorder property of a \l Camera should be used.
-
- \qml
- Camera {
- videoRecorder.audioEncodingMode: CameraRecorder.ConstantBitrateEncoding;
- videoRecorder.audioBitRate: 128000
- videoRecorder.mediaContainer: "mp4"
- // ...
- }
- \endqml
-
- There are many different settings for each part of the recording process (audio,
- video, and output formats), as well as control over muting and where to store
- the output file.
-
- \sa QAudioEncoderSettings, QVideoEncoderSettings
-*/
-
-QDeclarativeCameraRecorder::QDeclarativeCameraRecorder(QMediaCaptureSession *session, QObject *parent)
- : QObject(parent),
- m_captureSession(session)
-{
- m_encoder = new QMediaEncoder(this);
- session->setEncoder(m_encoder);
- connect(m_encoder, SIGNAL(stateChanged(QMediaEncoder::State)),
- SLOT(updateRecorderState(QMediaEncoder::State)));
- connect(m_encoder, SIGNAL(statusChanged(QMediaEncoder::Status)),
- SIGNAL(recorderStatusChanged()));
- connect(m_encoder, SIGNAL(error(QMediaEncoder::Error)),
- SLOT(updateRecorderError(QMediaEncoder::Error)));
- connect(m_encoder, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(m_encoder, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_encoder, SIGNAL(actualLocationChanged(QUrl)),
- SLOT(updateActualLocation(QUrl)));
-}
-
-QDeclarativeCameraRecorder::~QDeclarativeCameraRecorder()
-{
-}
-
-/*!
- \qmlproperty size QtMultimedia::CameraRecorder::resolution
-
- This property holds the video frame dimensions to be used for video capture.
-*/
-QSize QDeclarativeCameraRecorder::captureResolution()
-{
- return m_encoderSettings.videoResolution();
-}
-
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::audioCodec
-
- This property holds the audio codec to be used for recording video.
- Typically this is \c aac or \c amr-wb.
-
- \sa {QtMultimedia::CameraImageProcessing::whiteBalanceMode}{whileBalanceMode}
-*/
-QMediaFormat::AudioCodec QDeclarativeCameraRecorder::audioCodec() const
-{
- return m_encoderSettings.audioCodec();
-}
-
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::videoCodec
-
- This property holds the video codec to be used for recording video.
- Typically this is \c h264.
-*/
-QMediaFormat::VideoCodec QDeclarativeCameraRecorder::videoCodec() const
-{
- return m_encoderSettings.videoCodec();
-}
-
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::mediaContainer
-
- This property holds the media container to be used for recording video.
- Typically this is \c mp4.
-*/
-QMediaFormat::FileFormat QDeclarativeCameraRecorder::mediaContainer() const
-{
- return m_encoderSettings.format();
-}
-
-void QDeclarativeCameraRecorder::setCaptureResolution(const QSize &resolution)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (resolution != captureResolution()) {
- m_encoderSettings.setVideoResolution(resolution);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit captureResolutionChanged(resolution);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioCodec(QMediaFormat::AudioCodec codec)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (codec != audioCodec()) {
- m_encoderSettings.setAudioCodec(codec);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit audioCodecChanged();
- }
-}
-
-void QDeclarativeCameraRecorder::setVideoCodec(QMediaFormat::VideoCodec codec)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (codec != videoCodec()) {
- m_encoderSettings.setVideoCodec(codec);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit videoCodecChanged();
- }
-}
-
-void QDeclarativeCameraRecorder::setMediaContainer(QMediaFormat::FileFormat container)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (container != m_encoderSettings.format()) {
- m_encoderSettings.setFormat(container);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit mediaContainerChanged();
- }
-}
-
-/*!
- \qmlproperty qreal QtMultimedia::CameraRecorder::frameRate
-
- This property holds the framerate (in frames per second) to be used for recording video.
-*/
-qreal QDeclarativeCameraRecorder::frameRate() const
-{
- return m_encoderSettings.videoFrameRate();
-}
-
-/*!
- \qmlproperty int QtMultimedia::CameraRecorder::videoBitRate
-
- This property holds the bit rate (in bits per second) to be used for recording video.
-*/
-int QDeclarativeCameraRecorder::videoBitRate() const
-{
- return m_encoderSettings.videoBitRate();
-}
-
-/*!
- \qmlproperty int QtMultimedia::CameraRecorder::audioBitRate
-
- This property holds the audio bit rate (in bits per second) to be used for recording video.
-*/
-int QDeclarativeCameraRecorder::audioBitRate() const
-{
- return m_encoderSettings.audioBitRate();
-}
-
-/*!
- \qmlproperty int QtMultimedia::CameraRecorder::audioChannels
-
- This property indicates the number of audio channels to be encoded while
- recording video (1 is mono, 2 is stereo).
-*/
-int QDeclarativeCameraRecorder::audioChannels() const
-{
- return m_encoderSettings.audioChannelCount();
-}
-
-/*!
- \qmlproperty int QtMultimedia::CameraRecorder::audioSampleRate
-
- This property holds the sample rate to be used to encode audio while recording video.
-*/
-int QDeclarativeCameraRecorder::audioSampleRate() const
-{
- return m_encoderSettings.audioSampleRate();
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraRecorder::videoEncodingMode
-
- This property holds the type of encoding method to be used for recording video.
-
- The following are the different encoding methods used:
-
- \table
- \header \li Value \li Description
- \row \li ConstantQualityEncoding
- \li Encoding will aim to have a constant quality, adjusting bitrate to fit.
- This is the default. The bitrate setting will be ignored.
- \row \li ConstantBitRateEncoding
- \li Encoding will use a constant bit rate, adjust quality to fit. This is
- appropriate if you are trying to optimize for space.
- \row \li AverageBitRateEncoding
- \li Encoding will try to keep an average bitrate setting, but will use
- more or less as needed.
- \endtable
-
-*/
-QDeclarativeCameraRecorder::EncodingMode QDeclarativeCameraRecorder::videoEncodingMode() const
-{
- return EncodingMode(m_encoderSettings.encodingMode());
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraRecorder::audioEncodingMode
-
- The type of encoding method to use when recording audio.
-
- \table
- \header \li Value \li Description
- \row \li ConstantQualityEncoding
- \li Encoding will aim to have a constant quality, adjusting bitrate to fit.
- This is the default. The bitrate setting will be ignored.
- \row \li ConstantBitRateEncoding
- \li Encoding will use a constant bit rate, adjust quality to fit. This is
- appropriate if you are trying to optimize for space.
- \row \li AverageBitRateEncoding
- \li Encoding will try to keep an average bitrate setting, but will use
- more or less as needed.
- \endtable
-*/
-QDeclarativeCameraRecorder::EncodingMode QDeclarativeCameraRecorder::audioEncodingMode() const
-{
- return EncodingMode(m_encoderSettings.encodingMode());
-}
-
-void QDeclarativeCameraRecorder::setFrameRate(qreal frameRate)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (!qFuzzyCompare(m_encoderSettings.videoFrameRate(),frameRate)) {
- m_encoderSettings.setVideoFrameRate(frameRate);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit frameRateChanged(frameRate);
- }
-}
-
-void QDeclarativeCameraRecorder::setVideoBitRate(int rate)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.videoBitRate() != rate) {
- m_encoderSettings.setVideoBitRate(rate);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit videoBitRateChanged(rate);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioBitRate(int rate)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.audioBitRate() != rate) {
- m_encoderSettings.setAudioBitRate(rate);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit audioBitRateChanged(rate);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioChannels(int channels)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.audioChannelCount() != channels) {
- m_encoderSettings.setAudioChannelCount(channels);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit audioChannelsChanged(channels);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioSampleRate(int rate)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.audioSampleRate() != rate) {
- m_encoderSettings.setAudioSampleRate(rate);
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit audioSampleRateChanged(rate);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioEncodingMode(QDeclarativeCameraRecorder::EncodingMode encodingMode)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.encodingMode() != QMediaEncoderSettings::EncodingMode(encodingMode)) {
- m_encoderSettings.setEncodingMode(QMediaEncoderSettings::EncodingMode(encodingMode));
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit audioEncodingModeChanged(encodingMode);
- }
-}
-
-void QDeclarativeCameraRecorder::setVideoEncodingMode(QDeclarativeCameraRecorder::EncodingMode encodingMode)
-{
- m_encoderSettings = m_encoder->encoderSettings();
- if (m_encoderSettings.encodingMode() != QMediaEncoderSettings::EncodingMode(encodingMode)) {
- m_encoderSettings.setEncodingMode(QMediaEncoderSettings::EncodingMode(encodingMode));
- m_encoder->setEncoderSettings(m_encoderSettings);
- emit videoEncodingModeChanged(encodingMode);
- }
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraRecorder::errorCode
-
- This property holds the last error code.
-
- \table
- \header \li Value \li Description
- \row \li NoError
- \li No Errors
-
- \row \li ResourceError
- \li Device is not ready or not available.
-
- \row \li FormatError
- \li Current format is not supported.
-
- \row \li OutOfSpaceError
- \li No space left on device.
-
- \endtable
-*/
-QDeclarativeCameraRecorder::Error QDeclarativeCameraRecorder::errorCode() const
-{
- return QDeclarativeCameraRecorder::Error(m_encoder->error());
-}
-
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::errorString
-
- This property holds the description of the last error.
-*/
-QString QDeclarativeCameraRecorder::errorString() const
-{
- return m_encoder->errorString();
-}
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraRecorder::recorderState
-
- This property holds the current state of the camera recorder object.
-
- The state can be one of these two:
-
- \table
- \header \li Value \li Description
- \row \li StoppedState
- \li The camera is not recording video.
-
- \row \li RecordingState
- \li The camera is recording video.
- \endtable
-*/
-QDeclarativeCameraRecorder::RecorderState QDeclarativeCameraRecorder::recorderState() const
-{
- //paused state is not supported for camera
- QMediaEncoder::State state = m_encoder->state();
-
- if (state == QMediaEncoder::PausedState)
- state = QMediaEncoder::StoppedState;
-
- return RecorderState(state);
-}
-
-
-/*!
- \qmlproperty enumeration QtMultimedia::CameraRecorder::recorderStatus
-
- This property holds the current status of media recording.
-
- \table
- \header \li Value \li Description
- \row \li UnavailableStatus
- \li Recording is not supported by the camera.
- \row \li UnloadedStatus
- \li The recorder is available but not loaded.
- \row \li LoadingStatus
- \li The recorder is initializing.
- \row \li LoadedStatus
- \li The recorder is initialized and ready to record media.
- \row \li StartingStatus
- \li Recording is requested but not active yet.
- \row \li RecordingStatus
- \li Recording is active.
- \row \li PausedStatus
- \li Recording is paused.
- \row \li FinalizingStatus
- \li Recording is stopped with media being finalized.
- \endtable
-*/
-
-QDeclarativeCameraRecorder::RecorderStatus QDeclarativeCameraRecorder::recorderStatus() const
-{
- return RecorderStatus(m_encoder->status());
-}
-
-/*!
- \qmlmethod QtMultimedia::CameraRecorder::record()
-
- Starts recording.
-*/
-void QDeclarativeCameraRecorder::record()
-{
- setRecorderState(RecordingState);
-}
-
-/*!
- \qmlmethod QtMultimedia::CameraRecorder::stop()
-
- Stops recording.
-*/
-void QDeclarativeCameraRecorder::stop()
-{
- setRecorderState(StoppedState);
-}
-
-void QDeclarativeCameraRecorder::setRecorderState(QDeclarativeCameraRecorder::RecorderState state)
-{
- if (!m_encoder)
- return;
-
- switch (state) {
- case QDeclarativeCameraRecorder::RecordingState:
- m_encoder->record();
- break;
- case QDeclarativeCameraRecorder::StoppedState:
- m_encoder->stop();
- break;
- }
-}
-/*!
- \property QDeclarativeCameraRecorder::outputLocation
-
- This property holds the destination location of the media content. If it is empty,
- the recorder uses the system-specific place and file naming scheme.
-*/
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::outputLocation
-
- This property holds the destination location of the media content. If the location is empty,
- the recorder uses the system-specific place and file naming scheme.
-*/
-
-QString QDeclarativeCameraRecorder::outputLocation() const
-{
- return m_encoder->outputLocation().toString();
-}
-/*!
- \property QDeclarativeCameraRecorder::actualLocation
-
- This property holds the absolute location to the last saved media content.
- The location is usually available after recording starts, and reset when
- new location is set or new recording starts.
-*/
-/*!
- \qmlproperty string QtMultimedia::CameraRecorder::actualLocation
-
- This property holds the actual location of the last saved media content. The actual location is
- usually available after the recording starts, and reset when new location is set or the new recording starts.
-*/
-
-QString QDeclarativeCameraRecorder::actualLocation() const
-{
- return m_encoder->actualLocation().toString();
-}
-
-void QDeclarativeCameraRecorder::setOutputLocation(const QString &location)
-{
- if (outputLocation() != location) {
- m_encoder->setOutputLocation(location);
- emit outputLocationChanged(outputLocation());
- }
-}
-/*!
- \property QDeclarativeCameraRecorder::duration
-
- This property holds the duration (in miliseconds) of the last recording.
-*/
-/*!
- \qmlproperty int QtMultimedia::CameraRecorder::duration
-
- This property holds the duration (in miliseconds) of the last recording.
-*/
-qint64 QDeclarativeCameraRecorder::duration() const
-{
- return m_encoder->duration();
-}
-/*!
- \property QDeclarativeCameraRecorder::muted
-
- This property indicates whether the audio input is muted during
- recording.
-*/
-/*!
- \qmlproperty bool QtMultimedia::CameraRecorder::muted
-
- This property indicates whether the audio input is muted during recording.
-*/
-bool QDeclarativeCameraRecorder::isMuted() const
-{
- return m_captureSession->isMuted();
-}
-
-void QDeclarativeCameraRecorder::setMuted(bool muted)
-{
- m_captureSession->setMuted(muted);
-}
-
-void QDeclarativeCameraRecorder::updateRecorderState(QMediaEncoder::State state)
-{
- if (state == QMediaEncoder::PausedState)
- state = QMediaEncoder::StoppedState;
-
- emit recorderStateChanged(RecorderState(state));
-}
-
-void QDeclarativeCameraRecorder::updateRecorderError(QMediaEncoder::Error errorCode)
-{
- qWarning() << "QMediaEncoder error:" << errorString();
- emit error(Error(errorCode), errorString());
-}
-
-void QDeclarativeCameraRecorder::updateActualLocation(const QUrl &url)
-{
- emit actualLocationChanged(url.toString());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecamerarecorder_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecamerarecorder_p.h b/src/imports/multimedia/qdeclarativecamerarecorder_p.h
deleted file mode 100644
index 467cc304d..000000000
--- a/src/imports/multimedia/qdeclarativecamerarecorder_p.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 QDECLARATIVECAMERARECORDER_H
-#define QDECLARATIVECAMERARECORDER_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 <qmediaencoder.h>
-#include <qmediaencodersettings.h>
-#include <qmediaformat.h>
-
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraRecorder : public QObject
-{
- Q_OBJECT
- Q_ENUMS(RecorderState)
- Q_ENUMS(RecorderStatus)
- Q_ENUMS(EncodingMode)
- Q_ENUMS(Error)
-
- Q_PROPERTY(RecorderState recorderState READ recorderState WRITE setRecorderState NOTIFY recorderStateChanged)
- Q_PROPERTY(RecorderStatus recorderStatus READ recorderStatus NOTIFY recorderStatusChanged)
-
- Q_PROPERTY(QMediaFormat::VideoCodec videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
- Q_PROPERTY(QSize resolution READ captureResolution WRITE setCaptureResolution NOTIFY captureResolutionChanged)
- Q_PROPERTY(qreal frameRate READ frameRate WRITE setFrameRate NOTIFY frameRateChanged)
- Q_PROPERTY(int videoBitRate READ videoBitRate WRITE setVideoBitRate NOTIFY videoBitRateChanged)
- Q_PROPERTY(EncodingMode videoEncodingMode READ videoEncodingMode WRITE setVideoEncodingMode NOTIFY videoEncodingModeChanged)
-
- Q_PROPERTY(QMediaFormat::AudioCodec audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged)
- Q_PROPERTY(int audioBitRate READ audioBitRate WRITE setAudioBitRate NOTIFY audioBitRateChanged)
- Q_PROPERTY(int audioChannels READ audioChannels WRITE setAudioChannels NOTIFY audioChannelsChanged)
- Q_PROPERTY(int audioSampleRate READ audioSampleRate WRITE setAudioSampleRate NOTIFY audioSampleRateChanged)
- Q_PROPERTY(EncodingMode audioEncodingMode READ audioEncodingMode WRITE setAudioEncodingMode NOTIFY audioEncodingModeChanged)
-
- Q_PROPERTY(QMediaFormat::FileFormat mediaContainer READ mediaContainer WRITE setMediaContainer NOTIFY mediaContainerChanged)
-
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(QString outputLocation READ outputLocation WRITE setOutputLocation NOTIFY outputLocationChanged)
- Q_PROPERTY(QString actualLocation READ actualLocation NOTIFY actualLocationChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY error)
- Q_PROPERTY(Error errorCode READ errorCode NOTIFY error)
-// Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT)
-public:
- enum RecorderState
- {
- StoppedState = QMediaEncoder::StoppedState,
- RecordingState = QMediaEncoder::RecordingState
- };
-
- enum RecorderStatus
- {
- UnavailableStatus = QMediaEncoder::UnavailableStatus,
- StoppedStatus = QMediaEncoder::StoppedStatus,
- StartingStatus = QMediaEncoder::StartingStatus,
- RecordingStatus = QMediaEncoder::RecordingStatus,
- PausedStatus = QMediaEncoder::PausedStatus,
- FinalizingStatus = QMediaEncoder::FinalizingStatus
- };
-
- enum EncodingMode
- {
- ConstantQualityEncoding = QMediaEncoderSettings::ConstantQualityEncoding,
- ConstantBitRateEncoding = QMediaEncoderSettings::ConstantBitRateEncoding,
- AverageBitRateEncoding = QMediaEncoderSettings::AverageBitRateEncoding
- };
-
- enum Error {
- NoError = QMediaEncoder::NoError,
- ResourceError = QMediaEncoder::ResourceError,
- FormatError = QMediaEncoder::FormatError,
- OutOfSpaceError = QMediaEncoder::OutOfSpaceError
- };
-
- ~QDeclarativeCameraRecorder();
-
- RecorderState recorderState() const;
- RecorderStatus recorderStatus() const;
-
- QSize captureResolution();
-
- QString outputLocation() const;
- QString actualLocation() const;
-
- qint64 duration() const;
- bool isMuted() const;
-
- QMediaFormat::AudioCodec audioCodec() const;
- QMediaFormat::VideoCodec videoCodec() const;
- QMediaFormat::FileFormat mediaContainer() const;
-
- Error errorCode() const;
- QString errorString() const;
-
- qreal frameRate() const;
- int videoBitRate() const;
- int audioBitRate() const;
- int audioChannels() const;
- int audioSampleRate() const;
-
- EncodingMode videoEncodingMode() const;
- EncodingMode audioEncodingMode() const;
-
-public Q_SLOTS:
- void setOutputLocation(const QString &location);
-
- void record();
- void stop();
- void setRecorderState(QDeclarativeCameraRecorder::RecorderState state);
-
- void setMuted(bool muted);
-
- void setCaptureResolution(const QSize &resolution);
- void setAudioCodec(QMediaFormat::AudioCodec codec);
- void setVideoCodec(QMediaFormat::VideoCodec codec);
- void setMediaContainer(QMediaFormat::FileFormat container);
-
- void setFrameRate(qreal frameRate);
- void setVideoBitRate(int rate);
- void setAudioBitRate(int rate);
- void setAudioChannels(int channels);
- void setAudioSampleRate(int rate);
-
- void setVideoEncodingMode(EncodingMode encodingMode);
- void setAudioEncodingMode(EncodingMode encodingMode);
-
-Q_SIGNALS:
- void recorderStateChanged(QDeclarativeCameraRecorder::RecorderState state);
- void recorderStatusChanged();
- void durationChanged(qint64 duration);
- void mutedChanged(bool muted);
- void outputLocationChanged(const QString &location);
- void actualLocationChanged(const QString &location);
-
- void error(QDeclarativeCameraRecorder::Error errorCode, const QString &errorString);
-
- void captureResolutionChanged(const QSize &);
- void audioCodecChanged();
- void videoCodecChanged();
- void mediaContainerChanged();
-
- void frameRateChanged(qreal arg);
- void videoBitRateChanged(int arg);
- void audioBitRateChanged(int arg);
- void audioChannelsChanged(int arg);
- void audioSampleRateChanged(int arg);
-
- void audioEncodingModeChanged(EncodingMode encodingMode);
- void videoEncodingModeChanged(EncodingMode encodingMode);
-
-private slots:
- void updateRecorderState(QMediaEncoder::State);
- void updateRecorderError(QMediaEncoder::Error);
- void updateActualLocation(const QUrl&);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraRecorder(QMediaCaptureSession *session, QObject *parent = 0);
-
- QMediaCaptureSession *m_captureSession = nullptr;
- QMediaEncoder *m_encoder = nullptr;
-
- QMediaEncoderSettings m_encoderSettings;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraRecorder))
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativemultimediaglobal.cpp b/src/imports/multimedia/qdeclarativemultimediaglobal.cpp
deleted file mode 100644
index d678e07dc..000000000
--- a/src/imports/multimedia/qdeclarativemultimediaglobal.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 "qdeclarativemultimediaglobal_p.h"
-
-#include <qcamerainfo.h>
-#include <qjsengine.h>
-#include <qmediadevicemanager.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
-\qmltype QtMultimedia
-\inqmlmodule QtMultimedia
-\ingroup multimedia_qml
-\since 5.4
-\brief Provides a global object with useful functions from Qt Multimedia.
-
-The \c QtMultimedia object is a global object with utility functions and properties.
-
-It is not instantiable; to use it, call the members of the global \c QtMultimedia object directly.
-For example:
-
-\qml
-Camera {
- deviceId: QtMultimedia.defaultCamera.deviceId
-}
-\endqml
-
-*/
-
-/*!
- \qmlproperty object QtMultimedia::QtMultimedia::defaultCamera
- \readonly
-
- The \c defaultCamera object provides information about the default camera on the system.
-
- Its properties are \c deviceId, \c displayName, \c position and \c orientation. See
- \l{QtMultimedia::QtMultimedia::availableCameras}{availableCameras} for a description of each
- of them.
-
- If there is no default camera, \c defaultCamera.deviceId will contain an empty string.
-
- \note This property is static; it is not updated if the system's default camera changes after the
- application started.
-*/
-
-/*!
- \qmlproperty list<object> QtMultimedia::QtMultimedia::availableCameras
- \readonly
-
- This property provides information about the cameras available on the system.
-
- Each object in the list has the following properties:
-
- \table
- \row
- \li \c deviceId
- \li
- This read-only property holds the unique identifier of the camera.
-
- You can choose which device to use with a \l Camera object by setting its
- \l{Camera::deviceId}{deviceId} property to this value.
-
- \row
- \li \c displayName
- \li
- This read-only property holds the human-readable name of the camera.
- You can use this property to display the name of the camera in a user interface.
-
- \row
- \li \c position
- \li
- This read-only property holds the physical position of the camera on the hardware system.
- Please see \l{Camera::position}{Camera.position} for more information.
-
- \row
- \li \c orientation
- \li
- This read-only property holds the physical orientation of the camera sensor.
- Please see \l{Camera::orientation}{Camera.orientation} for more information.
-
- \endtable
-
- \note This property is static; it is not updated when cameras are added or removed from
- the system, like USB cameras on a desktop platform.
-
- The following example shows how to display a list of available cameras. The user can change
- the active camera by selecting one of the items in the list.
-
- \qml
- Item {
-
- Camera {
- id: camera
- }
-
- VideoOutput {
- anchors.fill: parent
- source: camera
- }
-
- ListView {
- anchors.fill: parent
-
- model: QtMultimedia.availableCameras
- delegate: Text {
- text: modelData.displayName
-
- MouseArea {
- anchors.fill: parent
- onClicked: camera.deviceId = modelData.deviceId
- }
- }
- }
- }
-
- \endqml
-*/
-
-static QJSValue cameraInfoToJSValue(QJSEngine *jsEngine, const QCameraInfo &camera)
-{
- QJSValue o = jsEngine->newObject();
- o.setProperty(QStringLiteral("deviceId"), QString::fromLatin1(camera.id()));
- o.setProperty(QStringLiteral("displayName"), camera.description());
- o.setProperty(QStringLiteral("position"), int(camera.position()));
- // ### Add resolutions and framerates
- return o;
-}
-
-QDeclarativeMultimediaGlobal::QDeclarativeMultimediaGlobal(QJSEngine *engine, QObject *parent)
- : QObject(parent)
- , m_engine(engine)
-{
-}
-
-QJSValue QDeclarativeMultimediaGlobal::defaultCamera() const
-{
- return cameraInfoToJSValue(m_engine, QMediaDeviceManager::defaultVideoInput());
-}
-
-QJSValue QDeclarativeMultimediaGlobal::availableCameras() const
-{
- QList<QCameraInfo> cameras = QMediaDeviceManager::videoInputs();
- QJSValue availableCameras = m_engine->newArray(cameras.count());
- for (int i = 0; i < cameras.count(); ++i)
- availableCameras.setProperty(i, cameraInfoToJSValue(m_engine, cameras.at(i)));
- return availableCameras;
-}
-
-/*!
- \qmlmethod real QtMultimedia::QtMultimedia::convertVolume(real volume, VolumeScale from, VolumeScale to)
-
- Converts an audio \a volume \a from a volume scale \a to another, and returns the result.
-
- Depending on the context, different scales are used to represent audio volume. All Qt Multimedia
- classes that have an audio volume use a linear scale, the reason is that the loudness of a
- speaker is controlled by modulating its voltage on a linear scale. The human ear on the other
- hand, perceives loudness in a logarithmic way. Using a logarithmic scale for volume controls
- is therefore appropriate in most applications. The decibel scale is logarithmic by nature and
- is commonly used to define sound levels, it is usually used for UI volume controls in
- professional audio applications. The cubic scale is a computationally cheap approximation of a
- logarithmic scale, it provides more control over lower volume levels.
-
- Valid values for \a from and \a to are:
- \list
- \li QtMultimedia.LinearVolumeScale - Linear scale. \c 0.0 (0%) is silence and \c 1.0 (100%) is
- full volume. All Qt Multimedia types that have an audio volume use a linear scale.
- \li QtMultimedia.CubicVolumeScale - Cubic scale. \c 0.0 (0%) is silence and \c 1.0 (100%) is full
- volume.
- \li QtMultimedia.LogarithmicVolumeScale - Logarithmic scale. \c 0.0 (0%) is silence and \c 1.0
- (100%) is full volume. UI volume controls should usually use a logarithmic scale.
- \li QtMultimedia.DecibelVolumeScale - Decibel (dB, amplitude) logarithmic scale. \c -200 is
- silence and \c 0 is full volume.
- \endlist
-
- The following example shows how the volume value from a UI volume control can be converted so
- that the perceived increase in loudness is the same when increasing the volume control from 0.2
- to 0.3 as it is from 0.5 to 0.6:
-
- \code
- Slider {
- id: volumeSlider
-
- property real volume: QtMultimedia.convertVolume(volumeSlider.value,
- QtMultimedia.LogarithmicVolumeScale,
- QtMultimedia.LinearVolumeScale)
- }
-
- MediaPlayer {
- volume: volumeSlider.volume
- }
- \endcode
-
- \since 5.8
-*/
-qreal QDeclarativeMultimediaGlobal::convertVolume(qreal volume,
- QDeclarativeMultimediaGlobal::VolumeScale from,
- QDeclarativeMultimediaGlobal::VolumeScale to) const
-{
- return QAudio::convertVolume(volume, QAudio::VolumeScale(from), QAudio::VolumeScale(to));
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h b/src/imports/multimedia/qdeclarativemultimediaglobal_p.h
deleted file mode 100644
index 101bd899a..000000000
--- a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company 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 QDECLARATIVEMULTIMEDIAGLOBAL_P_H
-#define QDECLARATIVEMULTIMEDIAGLOBAL_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 <QtQml/qqml.h>
-#include <QtQml/qjsvalue.h>
-#include <QtMultimedia/qaudio.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeMultimediaGlobal : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QJSValue defaultCamera READ defaultCamera NOTIFY defaultCameraChanged)
- Q_PROPERTY(QJSValue availableCameras READ availableCameras NOTIFY availableCamerasChanged)
-
- Q_ENUMS(VolumeScale)
-
-public:
- enum VolumeScale {
- LinearVolumeScale = QAudio::LinearVolumeScale,
- CubicVolumeScale = QAudio::CubicVolumeScale,
- LogarithmicVolumeScale = QAudio::LogarithmicVolumeScale,
- DecibelVolumeScale = QAudio::DecibelVolumeScale
- };
-
- explicit QDeclarativeMultimediaGlobal(QJSEngine *engine, QObject *parent = 0);
-
- QJSValue defaultCamera() const;
- QJSValue availableCameras() const;
-
- Q_INVOKABLE qreal convertVolume(qreal volume, VolumeScale from, VolumeScale to) const;
-
-Q_SIGNALS:
- // Unused at the moment. QCameraInfo doesn't notify when cameras are added or removed,
- // but it might change in the future.
- void defaultCameraChanged();
- void availableCamerasChanged();
-
-private:
- QJSEngine *m_engine;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVEMULTIMEDIAGLOBAL_P_H
diff --git a/src/imports/multimedia/qdeclarativetorch.cpp b/src/imports/multimedia/qdeclarativetorch.cpp
deleted file mode 100644
index ef2feb276..000000000
--- a/src/imports/multimedia/qdeclarativetorch.cpp
+++ /dev/null
@@ -1,172 +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 <QDebug>
-#include <private/qplatformmediacapture_p.h>
-#include <private/qplatformcamera_p.h>
-#include <qmediacapturesession.h>
-
-#include "qdeclarativetorch_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Torch
- \instantiates QDeclarativeTorch
- \inqmlmodule QtMultimedia
- \brief Simple control over torch functionality.
-
- \ingroup multimedia_qml
-
- In many cases the torch hardware is shared with camera flash functionality,
- and might be automatically controlled by the device. You have control over
- the power level (of course, higher power levels are brighter but reduce
- battery life significantly).
-
- \qml
-
- Torch {
- power: 75 // 75% of full power
- enabled: true // On
- }
-
- \endqml
-*/
-QDeclarativeTorch::QDeclarativeTorch(QCamera *camera)
- : QObject(camera),
- m_camera(camera)
-{
- if (!camera)
- return;
- auto *service = m_camera->captureSession()->platformSession();
- m_exposure = service->addCamera()->exposureControl();
-
- if (m_exposure)
- connect(m_exposure, SIGNAL(actualValueChanged(int)), SLOT(parameterChanged(int)));
-
- // XXX There's no signal for flash mode changed
-}
-
-QDeclarativeTorch::~QDeclarativeTorch()
-= default;
-
-/*!
- \qmlproperty bool QtMultimedia::Torch::enabled
-
- This property indicates whether the torch is enabled. If the torch functionality is shared
- with the camera flash hardware, the camera will take priority
- over torch settings and the torch is disabled.
-*/
-/*!
- \property QDeclarativeTorch::enabled
-
- This property indicates whether the torch is enabled. If the torch functionality
- is shared with the camera flash hardware, the camera will take
- priority and the torch is disabled.
- */
-bool QDeclarativeTorch::enabled() const
-{
- if (!m_exposure)
- return false;
-
- return m_exposure->torchMode() == QCameraExposure::TorchOn;
-}
-
-
-/*!
- If \a on is true, attempt to turn on the torch.
- If the torch hardware is already in use by the camera, this will
- be ignored.
-*/
-void QDeclarativeTorch::setEnabled(bool on)
-{
- if (!m_exposure)
- return;
-
- if (enabled() == on)
- return;
-
- m_exposure->setTorchMode(QCameraExposure::TorchOn);
- emit enabledChanged();
-}
-
-/*!
- \qmlproperty int QtMultimedia::Torch::power
-
- This property holds the current torch power setting, as a percentage of full power.
-
- In some cases this setting may change automatically as a result
- of temperature or battery conditions.
-*/
-/*!
- \property QDeclarativeTorch::power
-
- This property holds the current torch power settings, as a percentage of full power.
-*/
-int QDeclarativeTorch::power() const
-{
- if (!m_exposure)
- return 0;
-
- return m_exposure->requestedValue(QPlatformCameraExposure::TorchPower).toInt();
-}
-
-/*!
- Sets the current torch power setting to \a power, as a percentage of
- full power.
-*/
-void QDeclarativeTorch::setPower(int power)
-{
- if (!m_exposure)
- return;
-
- power = qBound(0, power, 100);
- if (this->power() != power)
- m_exposure->setValue(QPlatformCameraExposure::TorchPower, power);
-}
-
-/* Check for changes in flash power */
-void QDeclarativeTorch::parameterChanged(int parameter)
-{
- if (parameter == QPlatformCameraExposure::TorchPower)
- emit powerChanged();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/multimedia/qdeclarativetorch_p.h b/src/imports/multimedia/qdeclarativetorch_p.h
deleted file mode 100644
index 8c8f8b088..000000000
--- a/src/imports/multimedia/qdeclarativetorch_p.h
+++ /dev/null
@@ -1,98 +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 QDECLARATIVETORCH_P_H
-#define QDECLARATIVETORCH_P_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 <QtCore/QObject>
-#include <QtQml/qqml.h>
-#include <qcamera.h>
-#include <private/qplatformcameraexposure_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeTorch : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(int power READ power WRITE setPower NOTIFY powerChanged)
-
- // Errors?
-
-public:
- explicit QDeclarativeTorch(QCamera *parent = 0);
- ~QDeclarativeTorch();
-
- bool enabled() const;
- void setEnabled(bool enabled);
-
- int power() const;
- void setPower(int power);
-
-signals:
- void enabledChanged();
- void powerChanged();
-
-private slots:
- void parameterChanged(int parameter);
-
-private:
- QCamera *m_camera = nullptr;
- QPlatformCameraExposure *m_exposure = nullptr;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeTorch))
-
-#endif // QDECLARATIVETORCH_P_H