diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-02-08 16:54:55 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-02-12 07:55:20 +0000 |
commit | 35725159cc193e1650c79f72dd08219de1a62fe8 (patch) | |
tree | 8b3c2d8deddef44686303bb878e6ce4416ea28a8 | |
parent | f62e7ba660b7214d609df30fe739e612584c1f32 (diff) |
Get rid of QImageEncoderControl
Fold the settings into QImageCaptureControl.
Change-Id: I9cf981dfa956b769167791bc830bbe1569004367
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
47 files changed, 210 insertions, 1038 deletions
diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt index 65c553b60..a13dd002e 100644 --- a/src/multimedia/CMakeLists.txt +++ b/src/multimedia/CMakeLists.txt @@ -36,7 +36,6 @@ qt_internal_add_module(Multimedia controls/qcamerafocuscontrol.cpp controls/qcamerafocuscontrol.h controls/qcameraimagecapturecontrol.cpp controls/qcameraimagecapturecontrol.h controls/qcameraimageprocessingcontrol.cpp controls/qcameraimageprocessingcontrol.h - controls/qimageencodercontrol.cpp controls/qimageencodercontrol.h controls/qmediaplayercontrol.cpp controls/qmediaplayercontrol.h controls/qmediarecordercontrol.cpp controls/qmediarecordercontrol.h controls/qmediastreamscontrol.cpp controls/qmediastreamscontrol.h @@ -266,7 +265,6 @@ qt_internal_extend_target(Multimedia CONDITION QT_FEATURE_gstreamer AND NOT use_ platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h platform/gstreamer/mediacapture/qgstreamercapturesession.cpp platform/gstreamer/mediacapture/qgstreamercapturesession_p.h platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol_p.h - platform/gstreamer/mediacapture/qgstreamerimageencode.cpp platform/gstreamer/mediacapture/qgstreamerimageencode_p.h platform/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp platform/gstreamer/mediacapture/qgstreamerrecordercontrol_p.h platform/gstreamer/mediacapture/qgstreamervideoinput.cpp platform/gstreamer/mediacapture/qgstreamervideoinput_p.h INCLUDE_DIRECTORIES @@ -343,7 +341,6 @@ qt_internal_extend_target(Multimedia CONDITION ANDROID platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp platform/android/mediacapture/qandroidcameravideorenderercontrol_p.h platform/android/mediacapture/qandroidcaptureservice.cpp platform/android/mediacapture/qandroidcaptureservice_p.h platform/android/mediacapture/qandroidcapturesession.cpp platform/android/mediacapture/qandroidcapturesession_p.h - platform/android/mediacapture/qandroidimageencodercontrol.cpp platform/android/mediacapture/qandroidimageencodercontrol_p.h platform/android/mediacapture/qandroidmediarecordercontrol.cpp platform/android/mediacapture/qandroidmediarecordercontrol_p.h platform/android/mediaplayer/qandroidmediaplayercontrol.cpp platform/android/mediaplayer/qandroidmediaplayercontrol_p.h platform/android/mediaplayer/qandroidmediaplayervideorenderercontrol.cpp platform/android/mediaplayer/qandroidmediaplayervideorenderercontrol_p.h @@ -440,7 +437,6 @@ qt_internal_extend_target(Multimedia CONDITION APPLE AND NOT TVOS AND NOT WATCHO platform/darwin/camera/avfcamerautility.mm platform/darwin/camera/avfcamerautility_p.h platform/darwin/camera/avfcamerawindowcontrol.mm platform/darwin/camera/avfcamerawindowcontrol_p.h platform/darwin/camera/avfimagecapturecontrol.mm platform/darwin/camera/avfimagecapturecontrol_p.h - platform/darwin/camera/avfimageencodercontrol.mm platform/darwin/camera/avfimageencodercontrol_p.h platform/darwin/camera/avfstoragelocation.mm platform/darwin/camera/avfstoragelocation_p.h ) @@ -502,7 +498,6 @@ qt_internal_extend_target(Multimedia CONDITION QNX platform/qnx/camera/bbcameraservice.cpp platform/qnx/camera/bbcameraservice_p.h platform/qnx/camera/bbcamerasession.cpp platform/qnx/camera/bbcamerasession_p.h platform/qnx/camera/bbcameravideoencodersettingscontrol.cpp platform/qnx/camera/bbcameravideoencodersettingscontrol_p.h - platform/qnx/camera/bbimageencodercontrol.cpp platform/qnx/camera/bbimageencodercontrol_p.h platform/qnx/camera/bbmediastoragelocation.cpp platform/qnx/camera/bbmediastoragelocation_p.h platform/qnx/camera/bbvideorenderercontrol.cpp platform/qnx/camera/bbvideorenderercontrol_p.h platform/qnx/common/windowgrabber.cpp platform/qnx/common/windowgrabber_p.h diff --git a/src/multimedia/camera/qcameraimagecapture.cpp b/src/multimedia/camera/qcameraimagecapture.cpp index 9e6462efb..844555aa6 100644 --- a/src/multimedia/camera/qcameraimagecapture.cpp +++ b/src/multimedia/camera/qcameraimagecapture.cpp @@ -40,7 +40,6 @@ #include <qcameraimagecapturecontrol.h> #include <qmediaencodersettings.h> -#include <qimageencodercontrol.h> #include "qmediasource_p.h" #include <qmediaservice.h> #include <qcamera.h> @@ -79,16 +78,6 @@ QT_BEGIN_NAMESPACE \value CaptureToBuffer Capture the image to a buffer for further processing. */ -static void qRegisterCameraImageCaptureMetaTypes() -{ - qRegisterMetaType<QCameraImageCapture::Error>("QCameraImageCapture::Error"); - qRegisterMetaType<QCameraImageCapture::CaptureDestination>("QCameraImageCapture::CaptureDestination"); - qRegisterMetaType<QCameraImageCapture::CaptureDestinations>("QCameraImageCapture::CaptureDestinations"); -} - -Q_CONSTRUCTOR_FUNCTION(qRegisterCameraImageCaptureMetaTypes) - - class QCameraImageCapturePrivate { Q_DECLARE_NON_CONST_PUBLIC(QCameraImageCapture) @@ -96,7 +85,6 @@ public: QCamera *camera = nullptr; QCameraImageCaptureControl *control = nullptr; - QImageEncoderControl *encoderControl = nullptr; QCameraImageCapture::Error error = QCameraImageCapture::NoError; QString errorString; @@ -130,7 +118,6 @@ void QCameraImageCapturePrivate::_q_serviceDestroyed() { camera = nullptr; control = nullptr; - encoderControl = nullptr; } /*! @@ -153,8 +140,6 @@ QCameraImageCapture::QCameraImageCapture(QCamera *camera) d->control = qobject_cast<QCameraImageCaptureControl*>(service->requestControl(QCameraImageCaptureControl_iid)); if (d->control) { - d->encoderControl = qobject_cast<QImageEncoderControl *>(service->requestControl(QImageEncoderControl_iid)); - connect(d->control, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int))); connect(d->control, SIGNAL(imageCaptured(int,QImage)), @@ -179,7 +164,6 @@ QCameraImageCapture::QCameraImageCapture(QCamera *camera) // without QCameraImageCaptureControl discard the camera d->camera = nullptr; d->control = nullptr; - d->encoderControl = nullptr; } /*! @@ -247,8 +231,8 @@ QString QCameraImageCapture::errorString() const QImageEncoderSettings QCameraImageCapture::encodingSettings() const { - return d_func()->encoderControl ? - d_func()->encoderControl->imageSettings() : QImageEncoderSettings(); + return d_func()->control ? + d_func()->control->imageSettings() : QImageEncoderSettings(); } /*! @@ -264,7 +248,7 @@ void QCameraImageCapture::setEncodingSettings(const QImageEncoderSettings &setti { Q_D(QCameraImageCapture); - if (d->encoderControl) { + if (d->control) { QCamera *camera = qobject_cast<QCamera*>(d->camera); if (camera && camera->captureMode() == QCamera::CaptureStillImage) { QMetaObject::invokeMethod(camera, @@ -273,7 +257,7 @@ void QCameraImageCapture::setEncodingSettings(const QImageEncoderSettings &setti Q_ARG(int, QCameraControl::ImageEncodingSettings)); } - d->encoderControl->setImageSettings(settings); + d->control->setImageSettings(settings); } } diff --git a/src/multimedia/controls/controls.pri b/src/multimedia/controls/controls.pri index f196894cb..403ee895c 100644 --- a/src/multimedia/controls/controls.pri +++ b/src/multimedia/controls/controls.pri @@ -8,7 +8,6 @@ PUBLIC_HEADERS += \ controls/qcamerafocuscontrol.h \ controls/qcameraimagecapturecontrol.h \ controls/qcameraimageprocessingcontrol.h \ - controls/qimageencodercontrol.h \ controls/qmediaplayercontrol.h \ controls/qmediarecordercontrol.h \ controls/qmediastreamscontrol.h \ @@ -23,7 +22,6 @@ SOURCES += \ controls/qcamerafocuscontrol.cpp \ controls/qcameraimagecapturecontrol.cpp \ controls/qcameraimageprocessingcontrol.cpp \ - controls/qimageencodercontrol.cpp \ controls/qmediaplayercontrol.cpp \ controls/qmediarecordercontrol.cpp \ controls/qmediastreamscontrol.cpp \ diff --git a/src/multimedia/controls/qcameraimagecapturecontrol.cpp b/src/multimedia/controls/qcameraimagecapturecontrol.cpp index 2586925b0..f0b40002e 100644 --- a/src/multimedia/controls/qcameraimagecapturecontrol.cpp +++ b/src/multimedia/controls/qcameraimagecapturecontrol.cpp @@ -162,6 +162,21 @@ QCameraImageCaptureControl::QCameraImageCaptureControl(QObject *parent) */ /*! + \fn QCameraImageCaptureControl::imageSettings() const + + Returns the currently used image encoder settings. + + The returned value may be different than passed to setImageSettings() + if the settings contains defaulted or undefined parameters. +*/ + +/*! + \fn QCameraImageCaptureControl::setImageSettings(const QImageEncoderSettings &settings) + + Sets the selected image encoder \a settings. +*/ + +/*! \fn QCameraImageCaptureControl::error(int id, int error, const QString &errorString) Signals the capture request \a id failed with \a error code and message \a errorString. diff --git a/src/multimedia/controls/qcameraimagecapturecontrol.h b/src/multimedia/controls/qcameraimagecapturecontrol.h index 96d3af10b..ccebe8cc0 100644 --- a/src/multimedia/controls/qcameraimagecapturecontrol.h +++ b/src/multimedia/controls/qcameraimagecapturecontrol.h @@ -66,6 +66,9 @@ public: virtual QCameraImageCapture::CaptureDestinations captureDestination() const = 0; virtual void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) = 0; + virtual QImageEncoderSettings imageSettings() const = 0; + virtual void setImageSettings(const QImageEncoderSettings &settings) = 0; + Q_SIGNALS: void readyForCaptureChanged(bool ready); diff --git a/src/multimedia/controls/qimageencodercontrol.cpp b/src/multimedia/controls/qimageencodercontrol.cpp deleted file mode 100644 index 9c21a1951..000000000 --- a/src/multimedia/controls/qimageencodercontrol.cpp +++ /dev/null @@ -1,118 +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 "qimageencodercontrol.h" -#include <QtCore/qstringlist.h> - -QT_BEGIN_NAMESPACE - -/*! - \class QImageEncoderControl - \obsolete - - \inmodule QtMultimedia - - - \ingroup multimedia_control - - \brief The QImageEncoderControl class provides access to the settings of a media service that - performs image encoding. - - If a QMediaService supports encoding image data it will implement QImageEncoderControl. - This control allows to \l {setImageSettings()}{set image encoding settings} and - provides functions for quering supported image \l {supportedImageCodecs()}{codecs} and - \l {supportedResolutions()}{resolutions}. - - The interface name of QImageEncoderControl is \c org.qt-project.qt.imageencodercontrol/5.0 as - defined in QImageEncoderControl_iid. - - \sa QImageEncoderSettings, QMediaService::requestControl() -*/ - -/*! - \macro QImageEncoderControl_iid - - \c org.qt-project.qt.imageencodercontrol/5.0 - - Defines the interface name of the QImageEncoderControl class. - - \relates QImageEncoderControl -*/ - -/*! - Constructs a new image encoder control object with the given \a parent -*/ -QImageEncoderControl::QImageEncoderControl(QObject *parent) - :QObject(parent) -{ -} - -/*! - \fn QImageEncoderControl::supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(), - bool *continuous = 0) const - - Returns a list of supported resolutions. - - If non null image \a settings parameter is passed, - the returned list is reduced to resolutions supported with partial settings applied. - It can be used to query the list of resolutions, supported by specific image codec. - - If the encoder supports arbitrary resolutions within the supported resolutions range, - *\a continuous is set to true, otherwise *\a continuous is set to false. -*/ - -/*! - \fn QImageEncoderControl::imageSettings() const - - Returns the currently used image encoder settings. - - The returned value may be different tha passed to QImageEncoderControl::setImageSettings() - if the settings contains the default or undefined parameters. - In this case if the undefined parameters are already resolved, they should be returned. -*/ - -/*! - \fn QImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings) - - Sets the selected image encoder \a settings. -*/ - -QT_END_NAMESPACE - -#include "moc_qimageencodercontrol.cpp" diff --git a/src/multimedia/controls/qimageencodercontrol.h b/src/multimedia/controls/qimageencodercontrol.h deleted file mode 100644 index c67681305..000000000 --- a/src/multimedia/controls/qimageencodercontrol.h +++ /dev/null @@ -1,74 +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 QIMAGEENCODERCONTROL_H -#define QIMAGEENCODERCONTROL_H - -#include <QtMultimedia/qmediaservice.h> -#include <QtMultimedia/qmediarecorder.h> -#include <QtMultimedia/qmediaencodersettings.h> - -#include <QtCore/qsize.h> - -QT_BEGIN_NAMESPACE - -class QByteArray; -QT_END_NAMESPACE - -QT_BEGIN_NAMESPACE - -class Q_MULTIMEDIA_EXPORT QImageEncoderControl : public QObject -{ - Q_OBJECT - -public: - virtual QImageEncoderSettings imageSettings() const = 0; - virtual void setImageSettings(const QImageEncoderSettings &settings) = 0; - -protected: - explicit QImageEncoderControl(QObject *parent = nullptr); -}; - -#define QImageEncoderControl_iid "org.qt-project.qt.imageencodercontrol/5.0" -Q_MEDIA_DECLARE_CONTROL(QImageEncoderControl, QImageEncoderControl_iid) - -QT_END_NAMESPACE - - -#endif diff --git a/src/multimedia/platform/android/mediacapture/mediacapture.pri b/src/multimedia/platform/android/mediacapture/mediacapture.pri index 6d785d366..97083c284 100644 --- a/src/multimedia/platform/android/mediacapture/mediacapture.pri +++ b/src/multimedia/platform/android/mediacapture/mediacapture.pri @@ -6,7 +6,6 @@ SOURCES += \ $$PWD/qandroidcamerasession.cpp \ $$PWD/qandroidcameraexposurecontrol.cpp \ $$PWD/qandroidcameraimageprocessingcontrol.cpp \ - $$PWD/qandroidimageencodercontrol.cpp \ $$PWD/qandroidcameraimagecapturecontrol.cpp \ $$PWD/qandroidcamerafocuscontrol.cpp \ $$PWD/qandroidcapturesession.cpp \ @@ -19,7 +18,6 @@ HEADERS += \ $$PWD/qandroidcamerasession_p.h \ $$PWD/qandroidcameraexposurecontrol_p.h \ $$PWD/qandroidcameraimageprocessingcontrol_p.h \ - $$PWD/qandroidimageencodercontrol_p.h \ $$PWD/qandroidcameraimagecapturecontrol_p.h \ $$PWD/qandroidcamerafocuscontrol_p.h \ $$PWD/qandroidcapturesession_p.h \ diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol.cpp index bd3431755..9885be05b 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol.cpp @@ -81,4 +81,14 @@ void QAndroidCameraImageCaptureControl::setCaptureDestination(QCameraImageCaptur m_session->setCaptureDestination(destination); } +QImageEncoderSettings QAndroidCameraImageCaptureControl::imageSettings() const +{ + return m_session->imageSettings(); +} + +void QAndroidCameraImageCaptureControl::setImageSettings(const QImageEncoderSettings &settings) +{ + m_session->setImageSettings(settings); +} + QT_END_NAMESPACE diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol_p.h index f126efd82..58dc73e98 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol_p.h +++ b/src/multimedia/platform/android/mediacapture/qandroidcameraimagecapturecontrol_p.h @@ -71,6 +71,9 @@ public: QCameraImageCapture::CaptureDestinations captureDestination() const override; void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) override; + QImageEncoderSettings imageSettings() const override; + void setImageSettings(const QImageEncoderSettings &settings) override; + private: QAndroidCameraSession *m_session; }; diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp index 042f66078..a9d5b32e6 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp @@ -516,8 +516,8 @@ void QAndroidCameraSession::applyImageSettings() if (!m_camera) return; - if (m_actualImageSettings.codec().isEmpty()) - m_actualImageSettings.setCodec(QLatin1String("jpeg")); + // only supported format right now. + m_actualImageSettings.setFormat(QImageEncoderSettings::JPEG); const QSize requestedResolution = m_requestedImageSettings.resolution(); const QList<QSize> supportedResolutions = m_camera->getSupportedPictureSizes(); diff --git a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp index 9721229a6..f6d242cd7 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp @@ -45,7 +45,6 @@ #include "qandroidcameracontrol_p.h" #include "qandroidcamerasession_p.h" #include "qandroidcameravideorenderercontrol_p.h" -#include "qandroidimageencodercontrol_p.h" #include "qandroidcameraimagecapturecontrol_p.h" QT_BEGIN_NAMESPACE @@ -57,12 +56,10 @@ QAndroidCaptureService::QAndroidCaptureService(QMediaRecorder::CaptureMode mode) if (m_videoEnabled) { m_cameraSession = new QAndroidCameraSession; m_cameraControl = new QAndroidCameraControl(m_cameraSession); - m_imageEncoderControl = new QAndroidImageEncoderControl(m_cameraSession); m_imageCaptureControl = new QAndroidCameraImageCaptureControl(m_cameraSession); } else { m_cameraSession = 0; m_cameraControl = 0; - m_imageEncoderControl = 0; m_imageCaptureControl = 0; } @@ -76,7 +73,6 @@ QAndroidCaptureService::~QAndroidCaptureService() delete m_captureSession; delete m_cameraControl; delete m_videoRendererControl; - delete m_imageEncoderControl; delete m_imageCaptureControl; delete m_cameraSession; } @@ -89,9 +85,6 @@ QObject *QAndroidCaptureService::requestControl(const char *name) if (qstrcmp(name, QCameraControl_iid) == 0) return m_cameraControl; - if (qstrcmp(name, QImageEncoderControl_iid) == 0) - return m_imageEncoderControl; - if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0) return m_imageCaptureControl; diff --git a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice_p.h b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice_p.h index 0f0892a24..55d4f845e 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice_p.h +++ b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice_p.h @@ -63,7 +63,6 @@ class QAndroidCaptureSession; class QAndroidCameraControl; class QAndroidCameraSession; class QAndroidCameraVideoRendererControl; -class QAndroidImageEncoderControl; class QAndroidCameraImageCaptureControl; class QAndroidCaptureService : public QMediaPlatformCaptureInterface @@ -84,7 +83,6 @@ public: QAndroidCameraControl *m_cameraControl; QAndroidCameraSession *m_cameraSession; QAndroidCameraVideoRendererControl *m_videoRendererControl; - QAndroidImageEncoderControl *m_imageEncoderControl; QAndroidCameraImageCaptureControl *m_imageCaptureControl; }; diff --git a/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol.cpp deleted file mode 100644 index 7be520941..000000000 --- a/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol.cpp +++ /dev/null @@ -1,63 +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 "qandroidimageencodercontrol_p.h" - -#include "qandroidcamerasession_p.h" -#include "androidcamera_p.h" - -QT_BEGIN_NAMESPACE - -QAndroidImageEncoderControl::QAndroidImageEncoderControl(QAndroidCameraSession *session) - : QImageEncoderControl() - , m_session(session) -{ -} - -QImageEncoderSettings QAndroidImageEncoderControl::imageSettings() const -{ - return m_session->imageSettings(); -} - -void QAndroidImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings) -{ - m_session->setImageSettings(settings); -} - -QT_END_NAMESPACE diff --git a/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol_p.h deleted file mode 100644 index 19555879e..000000000 --- a/src/multimedia/platform/android/mediacapture/qandroidimageencodercontrol_p.h +++ /dev/null @@ -1,75 +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 QANDROIDIMAGEENCODERCONTROL_H -#define QANDROIDIMAGEENCODERCONTROL_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 <qimageencodercontrol.h> - -QT_BEGIN_NAMESPACE - -class QAndroidCameraSession; - -class QAndroidImageEncoderControl : public QImageEncoderControl -{ - Q_OBJECT -public: - explicit QAndroidImageEncoderControl(QAndroidCameraSession *session); - - QImageEncoderSettings imageSettings() const override; - void setImageSettings(const QImageEncoderSettings &settings) override; - -private: - QAndroidCameraSession *m_session; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDIMAGEENCODERCONTROL_H diff --git a/src/multimedia/platform/darwin/camera/avfcameraservice.mm b/src/multimedia/platform/darwin/camera/avfcameraservice.mm index 5a4a2b2de..b327c8d17 100644 --- a/src/multimedia/platform/darwin/camera/avfcameraservice.mm +++ b/src/multimedia/platform/darwin/camera/avfcameraservice.mm @@ -51,7 +51,6 @@ #include "avfimagecapturecontrol_p.h" #include "avfcamerafocuscontrol_p.h" #include "avfcameraexposurecontrol_p.h" -#include "avfimageencodercontrol_p.h" #include "avfcamerawindowcontrol_p.h" #ifdef Q_OS_IOS @@ -82,7 +81,6 @@ AVFCameraService::AVFCameraService() m_cameraExposureControl = new AVFCameraExposureControl(this); #endif - m_imageEncoderControl = new AVFImageEncoderControl(this); } AVFCameraService::~AVFCameraService() @@ -112,7 +110,6 @@ AVFCameraService::~AVFCameraService() delete m_cameraControl; delete m_cameraFocusControl; delete m_cameraExposureControl; - delete m_imageEncoderControl; delete m_session; } @@ -128,9 +125,6 @@ QObject *AVFCameraService::requestControl(const char *name) if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0) return m_imageCaptureControl; - if (qstrcmp(name, QImageEncoderControl_iid) == 0) - return m_imageEncoderControl; - if (!m_captureWindowControl) { if (qstrcmp(name, QVideoWindowControl_iid) == 0) { m_captureWindowControl = new AVFCameraWindowControl(this); diff --git a/src/multimedia/platform/darwin/camera/avfcameraservice_p.h b/src/multimedia/platform/darwin/camera/avfcameraservice_p.h index a848725b7..faa39fc21 100644 --- a/src/multimedia/platform/darwin/camera/avfcameraservice_p.h +++ b/src/multimedia/platform/darwin/camera/avfcameraservice_p.h @@ -67,7 +67,6 @@ class AVFImageCaptureControl; class AVFCameraSession; class AVFCameraFocusControl; class AVFCameraExposureControl; -class AVFImageEncoderControl; class AVFMediaRecorderControl; class AVFMediaRecorderControlIOS; class AVFCameraWindowControl; @@ -89,7 +88,6 @@ public: AVFCameraFocusControl *cameraFocusControl() const { return m_cameraFocusControl; } AVFCameraExposureControl *cameraExposureControl() const { return m_cameraExposureControl; } AVFCameraRendererControl *videoOutput() const { return m_videoOutput; } - AVFImageEncoderControl *imageEncoderControl() const { return m_imageEncoderControl; } private: AVFCameraSession *m_session; @@ -99,7 +97,6 @@ private: AVFImageCaptureControl *m_imageCaptureControl; AVFCameraFocusControl *m_cameraFocusControl; AVFCameraExposureControl *m_cameraExposureControl; - AVFImageEncoderControl *m_imageEncoderControl; AVFCameraWindowControl *m_captureWindowControl; }; diff --git a/src/multimedia/platform/darwin/camera/avfcamerasession.mm b/src/multimedia/platform/darwin/camera/avfcamerasession.mm index d1a5bcb29..ceee3412b 100644 --- a/src/multimedia/platform/darwin/camera/avfcamerasession.mm +++ b/src/multimedia/platform/darwin/camera/avfcamerasession.mm @@ -42,7 +42,7 @@ #include "avfcameraservice_p.h" #include "avfcameracontrol_p.h" #include "avfcamerarenderercontrol_p.h" -#include "avfimageencodercontrol_p.h" +#include "avfimagecapturecontrol_p.h" #include "avfcamerautility_p.h" #include "avfcamerawindowcontrol_p.h" @@ -351,7 +351,7 @@ void AVFCameraSession::attachVideoInputDevice() bool AVFCameraSession::applyImageEncoderSettings() { - if (AVFImageEncoderControl *control = m_service->imageEncoderControl()) + if (AVFImageCaptureControl *control = m_service->imageCaptureControl()) return control->applySettings(); return false; diff --git a/src/multimedia/platform/darwin/camera/avfimagecapturecontrol.mm b/src/multimedia/platform/darwin/camera/avfimagecapturecontrol.mm index ddcf693b5..79576b779 100644 --- a/src/multimedia/platform/darwin/camera/avfimagecapturecontrol.mm +++ b/src/multimedia/platform/darwin/camera/avfimagecapturecontrol.mm @@ -275,4 +275,122 @@ void AVFImageCaptureControl::updateCaptureConnection() } } + +QImageEncoderSettings AVFImageCaptureControl::imageSettings() const +{ + QImageEncoderSettings settings; + + if (!videoCaptureDeviceIsValid()) + return settings; + + AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); + if (!captureDevice.activeFormat) { + qDebugCamera() << Q_FUNC_INFO << "no active format"; + return settings; + } + + QSize res(qt_device_format_resolution(captureDevice.activeFormat)); +#ifdef Q_OS_IOS + if (!m_service->imageCaptureControl() || !m_service->imageCaptureControl()->stillImageOutput()) { + qDebugCamera() << Q_FUNC_INFO << "no still image output"; + return settings; + } + + AVCaptureStillImageOutput *stillImageOutput = m_service->imageCaptureControl()->stillImageOutput(); + if (stillImageOutput.highResolutionStillImageOutputEnabled) + res = qt_device_format_high_resolution(captureDevice.activeFormat); +#endif + if (res.isNull() || !res.isValid()) { + qDebugCamera() << Q_FUNC_INFO << "failed to exctract the image resolution"; + return settings; + } + + settings.setResolution(res); + settings.setFormat(QImageEncoderSettings::JPEG); + + return settings; +} + +void AVFImageCaptureControl::setImageSettings(const QImageEncoderSettings &settings) +{ + if (m_settings == settings) + return; + + m_settings = settings; + applySettings(); +} + +bool AVFImageCaptureControl::applySettings() +{ + if (!videoCaptureDeviceIsValid()) + return false; + + AVFCameraSession *session = m_service->session(); + if (!session || (session->state() != QCamera::ActiveState + && session->state() != QCamera::LoadedState) + || !m_service->cameraControl()->captureMode().testFlag(QCamera::CaptureStillImage)) { + return false; + } + + if (!m_service->imageCaptureControl() + || !m_service->imageCaptureControl()->stillImageOutput()) { + qDebugCamera() << Q_FUNC_INFO << "no still image output"; + return false; + } + + if (m_settings.format() != QImageEncoderSettings::UnspecifiedFormat && m_settings.format() != QImageEncoderSettings::JPEG) { + qDebugCamera() << Q_FUNC_INFO << "unsupported format:" << m_settings.format(); + return false; + } + + QSize res(m_settings.resolution()); + if (res.isNull()) { + qDebugCamera() << Q_FUNC_INFO << "invalid resolution:" << res; + return false; + } + + if (!res.isValid()) { + // Invalid == default value. + // Here we could choose the best format available, but + // activeFormat is already equal to 'preset high' by default, + // which is good enough, otherwise we can end in some format with low framerates. + return false; + } + + bool activeFormatChanged = false; + + AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); + AVCaptureDeviceFormat *match = qt_find_best_resolution_match(captureDevice, res, + m_service->session()->defaultCodec()); + + if (!match) { + qDebugCamera() << Q_FUNC_INFO << "unsupported resolution:" << res; + return false; + } + + activeFormatChanged = qt_set_active_format(captureDevice, match, true); + +#ifdef Q_OS_IOS + AVCaptureStillImageOutput *imageOutput = m_service->imageCaptureControl()->stillImageOutput(); + if (res == qt_device_format_high_resolution(captureDevice.activeFormat)) + imageOutput.highResolutionStillImageOutputEnabled = YES; + else + imageOutput.highResolutionStillImageOutputEnabled = NO; +#endif + + return activeFormatChanged; +} + +bool AVFImageCaptureControl::videoCaptureDeviceIsValid() const +{ + if (!m_service->session() || !m_service->session()->videoCaptureDevice()) + return false; + + AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); + if (!captureDevice.formats || !captureDevice.formats.count) + return false; + + return true; +} + #include "moc_avfimagecapturecontrol_p.cpp" diff --git a/src/multimedia/platform/darwin/camera/avfimagecapturecontrol_p.h b/src/multimedia/platform/darwin/camera/avfimagecapturecontrol_p.h index a426c0352..64cab6e2e 100644 --- a/src/multimedia/platform/darwin/camera/avfimagecapturecontrol_p.h +++ b/src/multimedia/platform/darwin/camera/avfimagecapturecontrol_p.h @@ -84,6 +84,10 @@ public: QCameraImageCapture::CaptureDestinations captureDestination() const override; void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) override; + QImageEncoderSettings imageSettings() const override; + void setImageSettings(const QImageEncoderSettings &settings) override; + bool applySettings(); + private Q_SLOTS: void updateCaptureConnection(); void updateReadyStatus(); @@ -91,6 +95,7 @@ private Q_SLOTS: private: void makeCapturePreview(CaptureRequest request, const QVideoFrame &frame, int rotation); + bool videoCaptureDeviceIsValid() const; AVFCameraService *m_service; AVFCameraSession *m_session; @@ -103,6 +108,7 @@ private: QMutex m_requestsMutex; QQueue<CaptureRequest> m_captureRequests; + QImageEncoderSettings m_settings; QCameraImageCapture::CaptureDestinations m_destination = QCameraImageCapture::CaptureToFile; }; diff --git a/src/multimedia/platform/darwin/camera/avfimageencodercontrol.mm b/src/multimedia/platform/darwin/camera/avfimageencodercontrol.mm deleted file mode 100644 index 95508abe5..000000000 --- a/src/multimedia/platform/darwin/camera/avfimageencodercontrol.mm +++ /dev/null @@ -1,188 +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 "avfimageencodercontrol_p.h" -#include "avfimagecapturecontrol_p.h" -#include "avfcamerautility_p.h" -#include "avfcamerasession_p.h" -#include "avfcameraservice_p.h" -#include "avfcameradebug_p.h" -#include "avfcameracontrol_p.h" - -#include <QtMultimedia/qmediaencodersettings.h> - -#include <QtCore/qdebug.h> - -#include <AVFoundation/AVFoundation.h> - -QT_BEGIN_NAMESPACE - -AVFImageEncoderControl::AVFImageEncoderControl(AVFCameraService *service) - : m_service(service) -{ - Q_ASSERT(service); -} - -QImageEncoderSettings AVFImageEncoderControl::requestedSettings() const -{ - return m_settings; -} - -QImageEncoderSettings AVFImageEncoderControl::imageSettings() const -{ - QImageEncoderSettings settings; - - if (!videoCaptureDeviceIsValid()) - return settings; - - AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); - if (!captureDevice.activeFormat) { - qDebugCamera() << Q_FUNC_INFO << "no active format"; - return settings; - } - - QSize res(qt_device_format_resolution(captureDevice.activeFormat)); -#ifdef Q_OS_IOS - if (!m_service->imageCaptureControl() || !m_service->imageCaptureControl()->stillImageOutput()) { - qDebugCamera() << Q_FUNC_INFO << "no still image output"; - return settings; - } - - AVCaptureStillImageOutput *stillImageOutput = m_service->imageCaptureControl()->stillImageOutput(); - if (stillImageOutput.highResolutionStillImageOutputEnabled) - res = qt_device_format_high_resolution(captureDevice.activeFormat); -#endif - if (res.isNull() || !res.isValid()) { - qDebugCamera() << Q_FUNC_INFO << "failed to exctract the image resolution"; - return settings; - } - - settings.setResolution(res); - - settings.setCodec(QLatin1String("jpeg")); - - return settings; -} - -void AVFImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings) -{ - if (m_settings == settings) - return; - - m_settings = settings; - applySettings(); -} - -bool AVFImageEncoderControl::applySettings() -{ - if (!videoCaptureDeviceIsValid()) - return false; - - AVFCameraSession *session = m_service->session(); - if (!session || (session->state() != QCamera::ActiveState - && session->state() != QCamera::LoadedState) - || !m_service->cameraControl()->captureMode().testFlag(QCamera::CaptureStillImage)) { - return false; - } - - if (!m_service->imageCaptureControl() - || !m_service->imageCaptureControl()->stillImageOutput()) { - qDebugCamera() << Q_FUNC_INFO << "no still image output"; - return false; - } - - if (m_settings.codec().size() - && m_settings.codec() != QLatin1String("jpeg")) { - qDebugCamera() << Q_FUNC_INFO << "unsupported codec:" << m_settings.codec(); - return false; - } - - QSize res(m_settings.resolution()); - if (res.isNull()) { - qDebugCamera() << Q_FUNC_INFO << "invalid resolution:" << res; - return false; - } - - if (!res.isValid()) { - // Invalid == default value. - // Here we could choose the best format available, but - // activeFormat is already equal to 'preset high' by default, - // which is good enough, otherwise we can end in some format with low framerates. - return false; - } - - bool activeFormatChanged = false; - - AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); - AVCaptureDeviceFormat *match = qt_find_best_resolution_match(captureDevice, res, - m_service->session()->defaultCodec()); - - if (!match) { - qDebugCamera() << Q_FUNC_INFO << "unsupported resolution:" << res; - return false; - } - - activeFormatChanged = qt_set_active_format(captureDevice, match, true); - -#ifdef Q_OS_IOS - AVCaptureStillImageOutput *imageOutput = m_service->imageCaptureControl()->stillImageOutput(); - if (res == qt_device_format_high_resolution(captureDevice.activeFormat)) - imageOutput.highResolutionStillImageOutputEnabled = YES; - else - imageOutput.highResolutionStillImageOutputEnabled = NO; -#endif - - return activeFormatChanged; -} - -bool AVFImageEncoderControl::videoCaptureDeviceIsValid() const -{ - if (!m_service->session() || !m_service->session()->videoCaptureDevice()) - return false; - - AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice(); - if (!captureDevice.formats || !captureDevice.formats.count) - return false; - - return true; -} - -QT_END_NAMESPACE - -#include "moc_avfimageencodercontrol_p.cpp" diff --git a/src/multimedia/platform/darwin/camera/avfimageencodercontrol_p.h b/src/multimedia/platform/darwin/camera/avfimageencodercontrol_p.h deleted file mode 100644 index 963ec5e5e..000000000 --- a/src/multimedia/platform/darwin/camera/avfimageencodercontrol_p.h +++ /dev/null @@ -1,94 +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 AVFIMAGEENCODERCONTROL_H -#define AVFIMAGEENCODERCONTROL_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 <QtMultimedia/qmediaencodersettings.h> -#include <QtMultimedia/qimageencodercontrol.h> - -#include <QtCore/qglobal.h> -#include <QtCore/qstring.h> -#include <QtCore/qlist.h> - -@class AVCaptureDeviceFormat; - -QT_BEGIN_NAMESPACE - -class AVFCameraService; - -class AVFImageEncoderControl : public QImageEncoderControl -{ - Q_OBJECT - - friend class AVFCameraSession; -public: - AVFImageEncoderControl(AVFCameraService *service); - - QStringList supportedImageCodecs() const override; - QString imageCodecDescription(const QString &codecName) const override; - QImageEncoderSettings imageSettings() const override; - void setImageSettings(const QImageEncoderSettings &settings) override; - - QImageEncoderSettings requestedSettings() const; - -private: - AVFCameraService *m_service; - QImageEncoderSettings m_settings; - - bool applySettings(); - bool videoCaptureDeviceIsValid() const; -}; - -QSize qt_image_high_resolution(AVCaptureDeviceFormat *fomat); - -QT_END_NAMESPACE - -#endif diff --git a/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri b/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri index 9dfea5ee6..5e8f76192 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri +++ b/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri @@ -6,7 +6,6 @@ HEADERS += $$PWD/qgstreamercaptureservice_p.h \ $$PWD/qgstreamercameracontrol_p.h \ $$PWD/qgstreamercapturemetadatacontrol_p.h \ $$PWD/qgstreamerimagecapturecontrol_p.h \ - $$PWD/qgstreamerimageencode_p.h \ $$PWD/qgstreamervideoinput_p.h SOURCES += $$PWD/qgstreamercaptureservice.cpp \ @@ -15,7 +14,6 @@ SOURCES += $$PWD/qgstreamercaptureservice.cpp \ $$PWD/qgstreamercameracontrol.cpp \ $$PWD/qgstreamercapturemetadatacontrol.cpp \ $$PWD/qgstreamerimagecapturecontrol.cpp \ - $$PWD/qgstreamerimageencode.cpp \ $$PWD/qgstreamervideoinput.cpp # Camera usage with gstreamer needs to have diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp index 32b1fd460..87d432b3e 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qgstreamercameracontrol_p.h" -#include "qgstreamerimageencode_p.h" +#include "qgstreamerimagecapturecontrol_p.h" #include "qgstreamervideoinput_p.h" #include <qcamerainfo.h> @@ -59,7 +59,7 @@ QGstreamerCameraControl::QGstreamerCameraControl(QGstreamerCaptureSession *sessi connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)), this, SLOT(updateStatus())); - connect(m_session->imageEncodeControl(), SIGNAL(settingsChanged()), + connect(m_session->imageCaptureControl(), SIGNAL(settingsChanged()), SLOT(reloadLater())); connect(m_session, SIGNAL(viewfinderChanged()), SLOT(reloadLater())); diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp index c57d1d7ff..191fb4575 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -40,7 +40,6 @@ #include "qgstreamercaptureservice_p.h" #include "qgstreamercapturesession_p.h" #include "qgstreamerrecordercontrol_p.h" -#include "qgstreamerimageencode_p.h" #include "qgstreamercameracontrol_p.h" #include <private/qgstreamerbushelper_p.h> #include "qgstreamercapturemetadatacontrol_p.h" @@ -78,8 +77,6 @@ QGstreamerCaptureService::QGstreamerCaptureService(QMediaRecorder::CaptureMode m delete m_videoWindow; m_videoWindow = 0; } - - m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession); } #endif } @@ -97,14 +94,11 @@ QObject *QGstreamerCaptureService::requestControl(const char *name) if (qstrcmp(name,QMediaRecorderControl_iid) == 0) return m_captureSession->recorderControl(); - if (qstrcmp(name,QImageEncoderControl_iid) == 0) - return m_captureSession->imageEncodeControl(); - if (qstrcmp(name,QCameraControl_iid) == 0) return m_cameraControl; if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0) - return m_imageCaptureControl; + return m_captureSession->imageCaptureControl(); if (!m_videoOutput) { if (qstrcmp(name, QVideoRendererControl_iid) == 0) { diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h index ba8b373e5..24eab3689 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h @@ -65,7 +65,6 @@ class QGstreamerBusHelper; class QGstreamerVideoRenderer; class QGstreamerVideoWindow; class QGstreamerElementFactory; -class QGstreamerImageCaptureControl; class QGstreamerVideoInput; class QGstreamerCaptureService : public QMediaPlatformCaptureInterface @@ -92,7 +91,6 @@ private: QGstreamerVideoRenderer *m_videoRenderer = nullptr; QGstreamerVideoWindow *m_videoWindow = nullptr; - QGstreamerImageCaptureControl *m_imageCaptureControl = nullptr; }; QT_END_NAMESPACE diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp index 871bf0f81..578e4d511 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -39,7 +39,7 @@ #include "qgstreamercapturesession_p.h" #include "qgstreamerrecordercontrol_p.h" -#include "qgstreamerimageencode_p.h" +#include "qgstreamerimagecapturecontrol_p.h" #include "qgstreamervideoinput_p.h" #include <qmediarecorder.h> #include <qmediadevicemanager.h> @@ -98,7 +98,7 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap m_busHelper = new QGstreamerBusHelper(m_bus, this); m_busHelper->installMessageFilter(this); - m_imageEncodeControl = new QGstreamerImageEncode(this); + m_imageCaptureControl = new QGstreamerImageCaptureControl(this); m_recorderControl = new QGstreamerRecorderControl(this); connect(m_recorderControl, &QGstreamerRecorderControl::error, [](int e, const QString &str) { qWarning() << QMediaRecorder::Error(e) << ":" << str.toLatin1().constData(); @@ -311,7 +311,7 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview() resolution = videoSettings.videoResolution(); frameRate = videoSettings.videoFrameRate(); } else if (m_captureMode & Image) { - resolution = m_imageEncodeControl->imageSettings().resolution(); + resolution = m_imageCaptureControl->imageSettings().resolution(); } GstCaps *caps = QGstUtils::videoFilterCaps(); diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h index 043e9dee9..fc16b1d6a 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE class QGstreamerMessage; class QGstreamerBusHelper; -class QGstreamerImageEncode; +class QGstreamerImageCaptureControl; class QGstreamerRecorderControl; class QGstreamerVideoRendererInterface; class QCameraInfo; @@ -111,7 +111,7 @@ public: QUrl outputLocation() const; bool setOutputLocation(const QUrl& sink); - QGstreamerImageEncode *imageEncodeControl() const { return m_imageEncodeControl; } + QGstreamerImageCaptureControl *imageCaptureControl() const { return m_imageCaptureControl; } QGstreamerRecorderControl *recorderControl() const { return m_recorderControl; } @@ -191,7 +191,7 @@ private: QObject *m_viewfinder; QGstreamerVideoRendererInterface *m_viewfinderInterface; - QGstreamerImageEncode *m_imageEncodeControl; + QGstreamerImageCaptureControl *m_imageCaptureControl; QGstreamerRecorderControl *m_recorderControl; QGstreamerBusHelper *m_busHelper; diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp index f89c30110..a5117b451 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp @@ -111,3 +111,16 @@ void QGstreamerImageCaptureControl::updateState() emit readyForCaptureChanged(m_ready = ready); } } + +QImageEncoderSettings QGstreamerImageCaptureControl::imageSettings() const +{ + return m_settings; +} + +void QGstreamerImageCaptureControl::setImageSettings(const QImageEncoderSettings &settings) +{ + if (m_settings != settings) { + m_settings = settings; + emit settingsChanged(); + } +} diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol_p.h index a9d2bd122..352965243 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimagecapturecontrol_p.h @@ -71,13 +71,20 @@ public: QCameraImageCapture::CaptureDestinations captureDestination() const override { return QCameraImageCapture::CaptureToBuffer; } virtual void setCaptureDestination(QCameraImageCapture::CaptureDestinations /*destination*/) override {} + QImageEncoderSettings imageSettings() const override; + void setImageSettings(const QImageEncoderSettings &settings) override; + private slots: void updateState(); +Q_SIGNALS: + void settingsChanged(); + private: QGstreamerCaptureSession *m_session; bool m_ready; int m_lastId; + QImageEncoderSettings m_settings; }; QT_END_NAMESPACE diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode.cpp deleted file mode 100644 index 01b2dbb93..000000000 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode.cpp +++ /dev/null @@ -1,67 +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 "qgstreamerimageencode_p.h" -#include "qgstreamercapturesession_p.h" - -#include <QtCore/qdebug.h> - -#include <math.h> - -QGstreamerImageEncode::QGstreamerImageEncode(QGstreamerCaptureSession *session) - :QImageEncoderControl(session), m_session(session) -{ -} - -QGstreamerImageEncode::~QGstreamerImageEncode() -{ -} - -QImageEncoderSettings QGstreamerImageEncode::imageSettings() const -{ - return m_settings; -} - -void QGstreamerImageEncode::setImageSettings(const QImageEncoderSettings &settings) -{ - if (m_settings != settings) { - m_settings = settings; - emit settingsChanged(); - } -} diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode_p.h deleted file mode 100644 index d9b330f0e..000000000 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamerimageencode_p.h +++ /dev/null @@ -1,86 +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 QGSTREAMERIMAGEENCODE_H -#define QGSTREAMERIMAGEENCODE_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 <qimageencodercontrol.h> - -#include <QtCore/qstringlist.h> -#include <QtCore/qmap.h> - -#include <gst/gst.h> - -QT_BEGIN_NAMESPACE - -class QGstreamerCaptureSession; - -class QGstreamerImageEncode : public QImageEncoderControl -{ - Q_OBJECT -public: - QGstreamerImageEncode(QGstreamerCaptureSession *session); - virtual ~QGstreamerImageEncode(); - - QImageEncoderSettings imageSettings() const override; - void setImageSettings(const QImageEncoderSettings &settings) override; - -Q_SIGNALS: - void settingsChanged(); - -private: - QImageEncoderSettings m_settings; - - QGstreamerCaptureSession *m_session; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol.cpp b/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol.cpp index 351630abe..151d7ac67 100644 --- a/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol.cpp +++ b/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol.cpp @@ -80,4 +80,14 @@ void BbCameraImageCaptureControl::setCaptureDestination(QCameraImageCapture::Cap m_session->setCaptureDestination(destination); } +QImageEncoderSettings BbCameraImageCaptureControl::imageSettings() const +{ + return m_session->imageSettings(); +} + +void BbCameraImageCaptureControl::setImageSettings(const QImageEncoderSettings &settings) +{ + m_session->setImageSettings(settings); +} + QT_END_NAMESPACE diff --git a/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol_p.h b/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol_p.h index f9b45672d..7cc5a38b9 100644 --- a/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol_p.h +++ b/src/multimedia/platform/qnx/camera/bbcameraimagecapturecontrol_p.h @@ -70,6 +70,9 @@ public: QCameraImageCapture::CaptureDestinations captureDestination() const override; void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) override; + QImageEncoderSettings imageSettings() const override; + void setImageSettings(const QImageEncoderSettings &settings) override; + private: BbCameraSession *m_session; }; diff --git a/src/multimedia/platform/qnx/camera/bbcameraservice.cpp b/src/multimedia/platform/qnx/camera/bbcameraservice.cpp index a5137c33e..4343bb5ad 100644 --- a/src/multimedia/platform/qnx/camera/bbcameraservice.cpp +++ b/src/multimedia/platform/qnx/camera/bbcameraservice.cpp @@ -47,7 +47,6 @@ #include "bbcameramediarecordercontrol_p.h" #include "bbcamerasession_p.h" #include "bbcameravideoencodersettingscontrol_p.h" -#include "bbimageencodercontrol_p.h" #include "bbvideorenderercontrol_p.h" #include <QDebug> @@ -66,7 +65,6 @@ BbCameraService::BbCameraService(QObject *parent) , m_cameraImageProcessingControl(new BbCameraImageProcessingControl(m_cameraSession, this)) , m_cameraMediaRecorderControl(new BbCameraMediaRecorderControl(m_cameraSession, this)) , m_cameraVideoEncoderSettingsControl(new BbCameraVideoEncoderSettingsControl(m_cameraSession, this)) - , m_imageEncoderControl(new BbImageEncoderControl(m_cameraSession, this)) , m_videoRendererControl(new BbVideoRendererControl(m_cameraSession, this)) { } @@ -93,8 +91,6 @@ QMediaControl* BbCameraService::requestControl(const char *name) return m_cameraMediaRecorderControl; else if (qstrcmp(name, QVideoEncoderSettingsControl_iid) == 0) return m_cameraVideoEncoderSettingsControl; - else if (qstrcmp(name, QImageEncoderControl_iid) == 0) - return m_imageEncoderControl; else if (qstrcmp(name, QVideoRendererControl_iid) == 0) return m_videoRendererControl; diff --git a/src/multimedia/platform/qnx/camera/bbcameraservice_p.h b/src/multimedia/platform/qnx/camera/bbcameraservice_p.h index e1a9016e1..0ecfb98c8 100644 --- a/src/multimedia/platform/qnx/camera/bbcameraservice_p.h +++ b/src/multimedia/platform/qnx/camera/bbcameraservice_p.h @@ -65,7 +65,6 @@ class BbCameraImageProcessingControl; class BbCameraMediaRecorderControl; class BbCameraSession; class BbCameraVideoEncoderSettingsControl; -class BbImageEncoderControl; class BbVideoRendererControl; class BbCameraService : public QMediaService @@ -90,7 +89,6 @@ private: BbCameraImageProcessingControl* m_cameraImageProcessingControl; BbCameraMediaRecorderControl* m_cameraMediaRecorderControl; BbCameraVideoEncoderSettingsControl* m_cameraVideoEncoderSettingsControl; - BbImageEncoderControl* m_imageEncoderControl; BbVideoRendererControl* m_videoRendererControl; }; diff --git a/src/multimedia/platform/qnx/camera/bbimageencodercontrol.cpp b/src/multimedia/platform/qnx/camera/bbimageencodercontrol.cpp deleted file mode 100644 index 65ebf2d63..000000000 --- a/src/multimedia/platform/qnx/camera/bbimageencodercontrol.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "bbimageencodercontrol_p.h" - -#include "bbcamerasession_p.h" - -QT_BEGIN_NAMESPACE - -BbImageEncoderControl::BbImageEncoderControl(BbCameraSession *session, QObject *parent) - : QImageEncoderControl(parent) - , m_session(session) -{ -} - -QImageEncoderSettings BbImageEncoderControl::imageSettings() const -{ - return m_session->imageSettings(); -} - -void BbImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings) -{ - m_session->setImageSettings(settings); -} - -QT_END_NAMESPACE diff --git a/src/multimedia/platform/qnx/camera/bbimageencodercontrol_p.h b/src/multimedia/platform/qnx/camera/bbimageencodercontrol_p.h deleted file mode 100644 index f7e4d4445..000000000 --- a/src/multimedia/platform/qnx/camera/bbimageencodercontrol_p.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef BBIMAGEENCODERCONTROL_H -#define BBIMAGEENCODERCONTROL_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 <qimageencodercontrol.h> - -QT_BEGIN_NAMESPACE - -class BbCameraSession; - -class BbImageEncoderControl : public QImageEncoderControl -{ - Q_OBJECT -public: - explicit BbImageEncoderControl(BbCameraSession *session, QObject *parent = 0); - - QImageEncoderSettings imageSettings() const override; - void setImageSettings(const QImageEncoderSettings &settings) override; - -private: - BbCameraSession *m_session; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index ccd799ef6..be061cce4 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -37,7 +37,6 @@ #include <qcameraexposurecontrol.h> #include <qcamerafocuscontrol.h> #include <qcameraimagecapturecontrol.h> -#include <qimageencodercontrol.h> #include <qcameraimageprocessingcontrol.h> #include <qmediaservice.h> #include <qcamera.h> @@ -45,6 +44,7 @@ #include <qcameraimagecapture.h> #include <qvideorenderercontrol.h> #include <qmediadevicemanager.h> +#include <qmediarecorder.h> QT_USE_NAMESPACE diff --git a/tests/auto/unit/mockbackend/CMakeLists.txt b/tests/auto/unit/mockbackend/CMakeLists.txt index 8c152cecf..a824459a5 100644 --- a/tests/auto/unit/mockbackend/CMakeLists.txt +++ b/tests/auto/unit/mockbackend/CMakeLists.txt @@ -20,7 +20,6 @@ target_sources(QtMultimediaMockBackend INTERFACE mockcamerafocuscontrol.h mockcameraimagecapturecontrol.h mockcameraimageprocessingcontrol.h - mockimageencodercontrol.h mockmediaplayercontrol.h mockmediaplayerservice.h mockmediarecordercontrol.h diff --git a/tests/auto/unit/mockbackend/capture.pri b/tests/auto/unit/mockbackend/capture.pri index 77e180c00..9ecaf944d 100644 --- a/tests/auto/unit/mockbackend/capture.pri +++ b/tests/auto/unit/mockbackend/capture.pri @@ -4,7 +4,6 @@ HEADERS *= \ $$PWD/mockcamerafocuscontrol.h \ $$PWD/mockcameraimagecapturecontrol.h \ $$PWD/mockcameraimageprocessingcontrol.h \ - $$PWD/mockimageencodercontrol.h \ $$PWD/mockmediarecordercontrol.h \ $$PWD/mockmediarecorderservice.h \ $$PWD/mockmetadatawritercontrol.h \ diff --git a/tests/auto/unit/mockbackend/mockcameraimagecapturecontrol.h b/tests/auto/unit/mockbackend/mockcameraimagecapturecontrol.h index d480b861a..6bb49a6bd 100644 --- a/tests/auto/unit/mockbackend/mockcameraimagecapturecontrol.h +++ b/tests/auto/unit/mockbackend/mockcameraimagecapturecontrol.h @@ -83,6 +83,9 @@ public: m_destination = destination; } + QImageEncoderSettings imageSettings() const { return m_settings; } + void setImageSettings(const QImageEncoderSettings &settings) { m_settings = settings; } + private Q_SLOTS: void captured() { @@ -121,6 +124,7 @@ private: bool m_ready; bool m_captureCanceled; QCameraImageCapture::CaptureDestinations m_destination; + QImageEncoderSettings m_settings; }; #endif // MOCKCAMERACAPTURECONTROL_H diff --git a/tests/auto/unit/mockbackend/mockimageencodercontrol.h b/tests/auto/unit/mockbackend/mockimageencodercontrol.h deleted file mode 100644 index 40f84b62d..000000000 --- a/tests/auto/unit/mockbackend/mockimageencodercontrol.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKIMAGEENCODERCONTROL_H -#define MOCKIMAGEENCODERCONTROL_H - -#include "qimageencodercontrol.h" - -class MockImageEncoderControl : public QImageEncoderControl -{ -public: - MockImageEncoderControl(QObject *parent = 0) - : QImageEncoderControl(parent) - { - m_settings = QImageEncoderSettings(); - } - - QImageEncoderSettings imageSettings() const { return m_settings; } - void setImageSettings(const QImageEncoderSettings &settings) { m_settings = settings; } - -private: - QImageEncoderSettings m_settings; -}; - - -#endif // MOCKIMAGEENCODERCONTROL_H diff --git a/tests/auto/unit/mockbackend/mockmediarecorderservice.h b/tests/auto/unit/mockbackend/mockmediarecorderservice.h index 803b7bab0..d061aae37 100644 --- a/tests/auto/unit/mockbackend/mockmediarecorderservice.h +++ b/tests/auto/unit/mockbackend/mockmediarecorderservice.h @@ -37,7 +37,6 @@ #include "mockcameraimageprocessingcontrol.h" #include "mockcameraimagecapturecontrol.h" #include "mockcameraexposurecontrol.h" -#include "mockimageencodercontrol.h" #include "mockcameracontrol.h" #include "mockvideorenderercontrol.h" #include "mockvideowindowcontrol.h" @@ -57,7 +56,6 @@ public: mockFocusControl = new MockCameraFocusControl(this); mockCaptureControl = new MockCaptureControl(mockCameraControl, this); mockImageProcessingControl = new MockImageProcessingControl(this); - mockImageEncoderControl = new MockImageEncoderControl(this); rendererControl = new MockVideoRendererControl(this); windowControl = new MockVideoWindowControl(this); rendererRef = 0; @@ -88,8 +86,6 @@ public: return mockCaptureControl; if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0) return mockImageProcessingControl; - if (qstrcmp(name, QImageEncoderControl_iid) == 0) - return mockImageEncoderControl; if (qstrcmp(name, QVideoRendererControl_iid) == 0) { if (rendererRef == 0) { @@ -122,7 +118,6 @@ public: MockCameraExposureControl *mockExposureControl; MockCameraFocusControl *mockFocusControl; MockImageProcessingControl *mockImageProcessingControl; - MockImageEncoderControl *mockImageEncoderControl; MockVideoRendererControl *rendererControl; MockVideoWindowControl *windowControl; int rendererRef; diff --git a/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp index d8ab32083..6a4ff377f 100644 --- a/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp +++ b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp @@ -36,7 +36,6 @@ #include <qcameraexposurecontrol.h> #include <qcamerafocuscontrol.h> #include <qcameraimagecapturecontrol.h> -#include <qimageencodercontrol.h> #include <qcameraimageprocessingcontrol.h> #include <qmediaservice.h> #include <qcamera.h> diff --git a/tests/auto/unit/multimedia/qcameraimagecapture/tst_qcameraimagecapture.cpp b/tests/auto/unit/multimedia/qcameraimagecapture/tst_qcameraimagecapture.cpp index d5b57747d..416885d23 100644 --- a/tests/auto/unit/multimedia/qcameraimagecapture/tst_qcameraimagecapture.cpp +++ b/tests/auto/unit/multimedia/qcameraimagecapture/tst_qcameraimagecapture.cpp @@ -43,7 +43,6 @@ Reviewer Name Date Coverage ( Full / Test Case IDs ). #include <qcameraexposurecontrol.h> #include <qcamerafocuscontrol.h> #include <qcameraimagecapturecontrol.h> -#include <qimageencodercontrol.h> #include <qcameraimageprocessingcontrol.h> #include <qmediaservice.h> #include <qcamera.h> diff --git a/tests/auto/unit/multimediawidgets/qcamerawidgets/tst_qcamerawidgets.cpp b/tests/auto/unit/multimediawidgets/qcamerawidgets/tst_qcamerawidgets.cpp index 768903447..f2f310365 100644 --- a/tests/auto/unit/multimediawidgets/qcamerawidgets/tst_qcamerawidgets.cpp +++ b/tests/auto/unit/multimediawidgets/qcamerawidgets/tst_qcamerawidgets.cpp @@ -36,7 +36,6 @@ #include <qcameraexposurecontrol.h> #include <qcamerafocuscontrol.h> #include <qcameraimagecapturecontrol.h> -#include <qimageencodercontrol.h> #include <qcameraimageprocessingcontrol.h> #include <qmediaservice.h> #include <qcamera.h> |