summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--examples/multimedia/spectrum/app/engine.cpp6
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp21
-rw-r--r--src/multimedia/playback/qmediaplayer.h1
-rw-r--r--src/multimedia/qmediaserviceprovider.cpp6
-rw-r--r--src/multimedia/video/qvideoframe.cpp8
-rw-r--r--src/multimedia/video/qvideoframe.h2
-rw-r--r--src/multimedia/video/qvideosurfaces.cpp92
-rw-r--r--src/multimedia/video/qvideosurfaces_p.h (renamed from src/multimedia/video/qvideoframe_p.h)30
-rw-r--r--src/multimedia/video/video.pri7
-rw-r--r--src/multimediawidgets/qvideowidget.cpp4
-rw-r--r--src/multimediawidgets/qvideowidget_p.h45
-rw-r--r--src/plugins/android/src/mediacapture/qandroidcamerasession.cpp3
-rw-r--r--src/plugins/avfoundation/camera/avfimagecapturecontrol.mm3
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp3
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.cpp32
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.h4
-rw-r--r--src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp7
-rw-r--r--tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp5
-rw-r--r--tests/auto/integration/qmediaplayerbackend/BLACKLIST1
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp28
-rw-r--r--tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp6
-rw-r--r--tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp6
-rw-r--r--tests/auto/unit/qvideoframe/tst_qvideoframe.cpp171
24 files changed, 417 insertions, 76 deletions
diff --git a/.qmake.conf b/.qmake.conf
index f6895bb09..b3c7403c2 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.14.0
+MODULE_VERSION = 5.15.0
diff --git a/examples/multimedia/spectrum/app/engine.cpp b/examples/multimedia/spectrum/app/engine.cpp
index fd977785b..d188259dc 100644
--- a/examples/multimedia/spectrum/app/engine.cpp
+++ b/examples/multimedia/spectrum/app/engine.cpp
@@ -569,15 +569,17 @@ bool Engine::selectFormat()
sampleRatesList += m_audioInputDevice.supportedSampleRates();
sampleRatesList += m_audioOutputDevice.supportedSampleRates();
- sampleRatesList = sampleRatesList.toSet().toList(); // remove duplicates
std::sort(sampleRatesList.begin(), sampleRatesList.end());
+ const auto uniqueRatesEnd = std::unique(sampleRatesList.begin(), sampleRatesList.end());
+ sampleRatesList.erase(uniqueRatesEnd, sampleRatesList.end());
ENGINE_DEBUG << "Engine::initialize frequenciesList" << sampleRatesList;
QList<int> channelsList;
channelsList += m_audioInputDevice.supportedChannelCounts();
channelsList += m_audioOutputDevice.supportedChannelCounts();
- channelsList = channelsList.toSet().toList();
std::sort(channelsList.begin(), channelsList.end());
+ const auto uniqueChannelsEnd = std::unique(channelsList.begin(), channelsList.end());
+ channelsList.erase(uniqueChannelsEnd, channelsList.end());
ENGINE_DEBUG << "Engine::initialize channelsList" << channelsList;
QAudioFormat format;
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 48db0335e..9b51bcddf 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qmediaplayer.h"
+#include "qvideosurfaces_p.h"
#include "qvideosurfaceoutput_p.h"
#include "qmediaobject_p.h"
@@ -555,7 +556,7 @@ static QMediaService *playerService(QMediaPlayer::Flags flags)
{
QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
if (flags) {
- QMediaServiceProviderHint::Features features = 0;
+ QMediaServiceProviderHint::Features features;
if (flags & QMediaPlayer::LowLatency)
features |= QMediaServiceProviderHint::LowLatencyPlayback;
@@ -1168,6 +1169,24 @@ void QMediaPlayer::setVideoOutput(QAbstractVideoSurface *surface)
}
}
+/*!
+ \since 5.15
+ Sets multiple video surfaces as the video output of a media player.
+ This allows the media player to render video frames on different surfaces.
+
+ All video surfaces must support at least one shared \c QVideoFrame::PixelFormat.
+
+ If a video output has already been set on the media player the new surfaces
+ will replace it.
+
+ \sa QAbstractVideoSurface::supportedPixelFormats
+*/
+
+void QMediaPlayer::setVideoOutput(const QVector<QAbstractVideoSurface *> &surfaces)
+{
+ setVideoOutput(new QVideoSurfaces(surfaces, this));
+}
+
/*! \reimp */
QMultimedia::AvailabilityStatus QMediaPlayer::availability() const
{
diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h
index 5d9a393e1..7ebed84da 100644
--- a/src/multimedia/playback/qmediaplayer.h
+++ b/src/multimedia/playback/qmediaplayer.h
@@ -131,6 +131,7 @@ public:
void setVideoOutput(QVideoWidget *);
void setVideoOutput(QGraphicsVideoItem *);
void setVideoOutput(QAbstractVideoSurface *surface);
+ void setVideoOutput(const QVector<QAbstractVideoSurface *> &surfaces);
QMediaContent media() const;
const QIODevice *mediaStream() const;
diff --git a/src/multimedia/qmediaserviceprovider.cpp b/src/multimedia/qmediaserviceprovider.cpp
index d8ffe42ae..93b560d8c 100644
--- a/src/multimedia/qmediaserviceprovider.cpp
+++ b/src/multimedia/qmediaserviceprovider.cpp
@@ -56,7 +56,7 @@ class QMediaServiceProviderHintPrivate : public QSharedData
{
public:
QMediaServiceProviderHintPrivate(QMediaServiceProviderHint::Type type)
- :type(type), cameraPosition(QCamera::UnspecifiedPosition), features(nullptr)
+ : type(type)
{
}
@@ -77,7 +77,7 @@ public:
QMediaServiceProviderHint::Type type;
QByteArray device;
- QCamera::Position cameraPosition;
+ QCamera::Position cameraPosition = QCamera::UnspecifiedPosition;
QString mimeType;
QStringList codecs;
QMediaServiceProviderHint::Features features;
@@ -712,7 +712,7 @@ QMediaServiceProviderHint::Features QMediaServiceProvider::supportedFeatures(con
{
Q_UNUSED(service);
- return QMediaServiceProviderHint::Features(nullptr);
+ return {};
}
/*!
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 5e2d6df39..fd7b74075 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -39,7 +39,6 @@
#include "qvideoframe.h"
-#include "qvideoframe_p.h"
#include "qimagevideobuffer_p.h"
#include "qmemoryvideobuffer_p.h"
#include "qvideoframeconversionhelper_p.h"
@@ -1112,11 +1111,12 @@ static void qInitConvertFuncsAsm()
}
/*!
- \internal
+ Based on the pixel format converts current video frame to image.
+ \since 5.15
*/
-QImage qt_imageFromVideoFrame(const QVideoFrame &f)
+QImage QVideoFrame::image() const
{
- QVideoFrame &frame = const_cast<QVideoFrame&>(f);
+ QVideoFrame frame = *this;
QImage result;
if (!frame.isValid() || !frame.map(QAbstractVideoBuffer::ReadOnly))
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index 8fcf47fc4..d043442a3 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -166,6 +166,8 @@ public:
QVariant metaData(const QString &key) const;
void setMetaData(const QString &key, const QVariant &value);
+ QImage image() const;
+
static PixelFormat pixelFormatFromImageFormat(QImage::Format format);
static QImage::Format imageFormatFromPixelFormat(PixelFormat format);
diff --git a/src/multimedia/video/qvideosurfaces.cpp b/src/multimedia/video/qvideosurfaces.cpp
new file mode 100644
index 000000000..c7de5ea12
--- /dev/null
+++ b/src/multimedia/video/qvideosurfaces.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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 "qvideosurfaces_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QVideoSurfaces::QVideoSurfaces(const QVector<QAbstractVideoSurface *> &s, QObject *parent)
+ : QAbstractVideoSurface(parent)
+ , m_surfaces(s)
+{
+}
+
+QVideoSurfaces::~QVideoSurfaces()
+{
+}
+
+QList<QVideoFrame::PixelFormat> QVideoSurfaces::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
+{
+ QList<QVideoFrame::PixelFormat> result;
+ QMap<QVideoFrame::PixelFormat, int> formats;
+ for (auto &s : m_surfaces) {
+ for (auto &p : s->supportedPixelFormats(type)) {
+ if (++formats[p] == m_surfaces.size())
+ result << p;
+ }
+ }
+
+ return result;
+}
+
+bool QVideoSurfaces::start(const QVideoSurfaceFormat &format)
+{
+ bool result = true;
+ for (auto &s : m_surfaces)
+ result &= s->start(format);
+
+ return result;
+}
+
+void QVideoSurfaces::stop()
+{
+ for (auto &s : m_surfaces)
+ s->stop();
+}
+
+bool QVideoSurfaces::present(const QVideoFrame &frame)
+{
+ bool result = true;
+ for (auto &s : m_surfaces)
+ result &= s->present(frame);
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideoframe_p.h b/src/multimedia/video/qvideosurfaces_p.h
index d7b9dd348..67831e74e 100644
--- a/src/multimedia/video/qvideoframe_p.h
+++ b/src/multimedia/video/qvideosurfaces_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
@@ -37,10 +37,8 @@
**
****************************************************************************/
-#ifndef QVIDEOFRAME_P_H
-#define QVIDEOFRAME_P_H
-
-#include <QtMultimedia/qvideoframe.h>
+#ifndef QVIDEOSURFACES_P_H
+#define QVIDEOSURFACES_P_H
//
// W A R N I N G
@@ -53,11 +51,27 @@
// We mean it.
//
+#include <QAbstractVideoSurface>
+#include <QVector>
+
QT_BEGIN_NAMESPACE
-Q_MULTIMEDIA_EXPORT QImage qt_imageFromVideoFrame(const QVideoFrame &frame);
+class QVideoSurfaces : public QAbstractVideoSurface
+{
+public:
+ QVideoSurfaces(const QVector<QAbstractVideoSurface *> &surfaces, QObject *parent = nullptr);
+ ~QVideoSurfaces();
-QT_END_NAMESPACE
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const override;
+ bool start(const QVideoSurfaceFormat &format) override;
+ void stop() override;
+ bool present(const QVideoFrame &frame) override;
-#endif // QVIDEOFRAME_P_H
+private:
+ QVector<QAbstractVideoSurface *> m_surfaces;
+ Q_DISABLE_COPY(QVideoSurfaces)
+};
+
+QT_END_NAMESPACE
+#endif // QVIDEOSURFACES_P_H
diff --git a/src/multimedia/video/video.pri b/src/multimedia/video/video.pri
index e5fa697ce..a3668ba4a 100644
--- a/src/multimedia/video/video.pri
+++ b/src/multimedia/video/video.pri
@@ -15,8 +15,8 @@ PRIVATE_HEADERS += \
video/qmemoryvideobuffer_p.h \
video/qvideooutputorientationhandler_p.h \
video/qvideosurfaceoutput_p.h \
- video/qvideoframe_p.h \
- video/qvideoframeconversionhelper_p.h
+ video/qvideoframeconversionhelper_p.h \
+ video/qvideosurfaces_p.h
SOURCES += \
video/qabstractvideobuffer.cpp \
@@ -29,7 +29,8 @@ SOURCES += \
video/qvideosurfaceoutput.cpp \
video/qvideoprobe.cpp \
video/qabstractvideofilter.cpp \
- video/qvideoframeconversionhelper.cpp
+ video/qvideoframeconversionhelper.cpp \
+ video/qvideosurfaces.cpp
SSE2_SOURCES += video/qvideoframeconversionhelper_sse2.cpp
SSSE3_SOURCES += video/qvideoframeconversionhelper_ssse3.cpp
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
index a7d3665f8..5adc6c359 100644
--- a/src/multimediawidgets/qvideowidget.cpp
+++ b/src/multimediawidgets/qvideowidget.cpp
@@ -611,7 +611,7 @@ void QVideoWidgetPrivate::_q_dimensionsChanged()
The \a parent is passed to QWidget.
*/
QVideoWidget::QVideoWidget(QWidget *parent)
- : QWidget(parent, 0)
+ : QWidget(parent, {})
, d_ptr(new QVideoWidgetPrivate)
{
d_ptr->q_ptr = this;
@@ -621,7 +621,7 @@ QVideoWidget::QVideoWidget(QWidget *parent)
\internal
*/
QVideoWidget::QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent)
- : QWidget(parent, 0)
+ : QWidget(parent, {})
, d_ptr(&dd)
{
d_ptr->q_ptr = this;
diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h
index ef417b222..07912ee90 100644
--- a/src/multimediawidgets/qvideowidget_p.h
+++ b/src/multimediawidgets/qvideowidget_p.h
@@ -222,40 +222,21 @@ class QVideoWidgetPrivate
{
Q_DECLARE_PUBLIC(QVideoWidget)
public:
- QVideoWidgetPrivate()
- : q_ptr(0)
- , mediaObject(0)
- , service(0)
- , widgetBackend(0)
- , windowBackend(0)
- , rendererBackend(0)
- , currentControl(0)
- , currentBackend(0)
- , brightness(0)
- , contrast(0)
- , hue(0)
- , saturation(0)
- , aspectRatioMode(Qt::KeepAspectRatio)
- , nonFullScreenFlags(0)
- , wasFullScreen(false)
- {
- }
-
- QVideoWidget *q_ptr;
+ QVideoWidget *q_ptr = nullptr;
QPointer<QMediaObject> mediaObject;
- QMediaService *service;
- QVideoWidgetControlBackend *widgetBackend;
- QWindowVideoWidgetBackend *windowBackend;
- QRendererVideoWidgetBackend *rendererBackend;
- QVideoWidgetControlInterface *currentControl;
- QVideoWidgetBackend *currentBackend;
- int brightness;
- int contrast;
- int hue;
- int saturation;
- Qt::AspectRatioMode aspectRatioMode;
+ QMediaService *service = nullptr;
+ QVideoWidgetControlBackend *widgetBackend = nullptr;
+ QWindowVideoWidgetBackend *windowBackend = nullptr;
+ QRendererVideoWidgetBackend *rendererBackend = nullptr;
+ QVideoWidgetControlInterface *currentControl = nullptr;
+ QVideoWidgetBackend *currentBackend = nullptr;
+ int brightness = 0;
+ int contrast = 0;
+ int hue = 0;
+ int saturation = 0;
+ Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio;
Qt::WindowFlags nonFullScreenFlags;
- bool wasFullScreen;
+ bool wasFullScreen = false;
bool createWidgetBackend();
bool createWindowBackend();
diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
index f3ad84836..a0f809376 100644
--- a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
+++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
@@ -53,7 +53,6 @@
#include <qdebug.h>
#include <qvideoframe.h>
#include <private/qmemoryvideobuffer_p.h>
-#include <private/qvideoframe_p.h>
#include <QtCore/private/qjnihelpers_p.h>
QT_BEGIN_NAMESPACE
@@ -749,7 +748,7 @@ void QAndroidCameraSession::processPreviewImage(int id, const QVideoFrame &frame
transform.scale(-1, 1);
transform.rotate(rotation);
- emit imageCaptured(id, qt_imageFromVideoFrame(frame).transformed(transform));
+ emit imageCaptured(id, frame.image().transformed(transform));
}
void QAndroidCameraSession::onNewPreviewFrame(const QVideoFrame &frame)
diff --git a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm
index dbaf3ed41..55a20b1bd 100644
--- a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm
+++ b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm
@@ -48,7 +48,6 @@
#include <QtCore/qbuffer.h>
#include <QtConcurrent/qtconcurrentrun.h>
#include <QtGui/qimagereader.h>
-#include <private/qvideoframe_p.h>
QT_USE_NAMESPACE
@@ -214,7 +213,7 @@ void AVFImageCaptureControl::makeCapturePreview(CaptureRequest request,
QTransform transform;
transform.rotate(rotation);
- Q_EMIT imageCaptured(request.captureId, qt_imageFromVideoFrame(frame).transformed(transform));
+ Q_EMIT imageCaptured(request.captureId, frame.image().transformed(transform));
request.previewReady->release();
}
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
index a0c120816..cee3e9c56 100644
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ b/src/plugins/directshow/camera/dscamerasession.cpp
@@ -44,7 +44,6 @@
#include <QtMultimedia/qvideosurfaceformat.h>
#include <QtMultimedia/qcameraimagecapture.h>
#include <private/qmemoryvideobuffer_p.h>
-#include <private/qvideoframe_p.h>
#include "dscamerasession.h"
#include "dsvideorenderer.h"
@@ -637,7 +636,7 @@ void DSCameraSession::presentFrame()
if (m_capturedFrame.isValid()) {
- captureImage = qt_imageFromVideoFrame(m_capturedFrame);
+ captureImage = m_capturedFrame.image();
const bool needsVerticalMirroring = m_previewSurfaceFormat.scanLineDirection() != QVideoSurfaceFormat::TopToBottom;
captureImage = captureImage.mirrored(m_needsHorizontalMirroring, needsVerticalMirroring); // also causes a deep copy of the data
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp b/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
index bb3659493..401e13207 100644
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
@@ -51,7 +51,9 @@ CameraBinZoom::CameraBinZoom(CameraBinSession *session)
, m_requestedOpticalZoom(1.0)
, m_requestedDigitalZoom(1.0)
{
-
+ GstElement *camerabin = m_session->cameraBin();
+ g_signal_connect(G_OBJECT(camerabin), "notify::zoom", G_CALLBACK(updateZoom), this);
+ g_signal_connect(G_OBJECT(camerabin), "notify::max-zoom", G_CALLBACK(updateMaxZoom), this);
}
CameraBinZoom::~CameraBinZoom()
@@ -114,4 +116,32 @@ void CameraBinZoom::zoomTo(qreal optical, qreal digital)
emit currentDigitalZoomChanged(digital);
}
+void CameraBinZoom::updateZoom(GObject *o, GParamSpec *p, gpointer d)
+{
+ Q_UNUSED(p);
+
+ gfloat zoomFactor = 1.0;
+ g_object_get(o, ZOOM_PROPERTY, &zoomFactor, NULL);
+
+ CameraBinZoom *zoom = reinterpret_cast<CameraBinZoom *>(d);
+
+ QMetaObject::invokeMethod(zoom, "currentDigitalZoomChanged",
+ Qt::QueuedConnection,
+ Q_ARG(qreal, zoomFactor));
+}
+
+void CameraBinZoom::updateMaxZoom(GObject *o, GParamSpec *p, gpointer d)
+{
+ Q_UNUSED(p);
+
+ gfloat zoomFactor = 1.0;
+ g_object_get(o, MAX_ZOOM_PROPERTY, &zoomFactor, NULL);
+
+ CameraBinZoom *zoom = reinterpret_cast<CameraBinZoom *>(d);
+
+ QMetaObject::invokeMethod(zoom, "maximumDigitalZoomChanged",
+ Qt::QueuedConnection,
+ Q_ARG(qreal, zoomFactor));
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.h b/src/plugins/gstreamer/camerabin/camerabinzoom.h
index 8ad4764b2..858ada2da 100644
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.h
+++ b/src/plugins/gstreamer/camerabin/camerabinzoom.h
@@ -41,6 +41,7 @@
#define CAMERABINZOOMCONTROL_H
#include <qcamerazoomcontrol.h>
+#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -64,6 +65,9 @@ public:
void zoomTo(qreal optical, qreal digital) override;
private:
+ static void updateZoom(GObject *o, GParamSpec *p, gpointer d);
+ static void updateMaxZoom(GObject *o, GParamSpec *p, gpointer d);
+
CameraBinSession *m_session;
qreal m_requestedOpticalZoom;
qreal m_requestedDigitalZoom;
diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
index 863cefa4e..bdfa23dfb 100644
--- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
+++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
@@ -46,7 +46,6 @@
#include <QtCore/qloggingcategory.h>
#include <private/qmediapluginloader_p.h>
#include <private/qsgvideonode_p.h>
-#include <private/qvideoframe_p.h>
#include <QtGui/QOpenGLContext>
#include <QtQuick/QQuickWindow>
@@ -304,7 +303,7 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
if (!runnable)
continue;
- QVideoFilterRunnable::RunFlags flags = 0;
+ QVideoFilterRunnable::RunFlags flags;
if (i == m_filters.count() - 1)
flags |= QVideoFilterRunnable::LastInChain;
@@ -363,7 +362,7 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
videoNode->setTexturedRectGeometry(m_renderedRect, m_sourceTextureRect,
qNormalizedOrientation(q->orientation()));
if (m_frameChanged) {
- QSGVideoNode::FrameFlags flags = 0;
+ QSGVideoNode::FrameFlags flags;
if (isFrameModified)
flags |= QSGVideoNode::FrameFiltered;
videoNode->setCurrentFrame(m_frame, flags);
@@ -372,7 +371,7 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
|| q->flushMode() == QDeclarativeVideoOutput::LastFrame) {
m_frameOnFlush = m_surfaceFormat.handleType() == QAbstractVideoBuffer::NoHandle
? m_frame
- : qt_imageFromVideoFrame(m_frame);
+ : m_frame.image();
}
//don't keep the frame for more than really necessary
diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
index 894486230..27fc014aa 100644
--- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
+++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
@@ -49,7 +49,6 @@
#include <qcameraimagecapture.h>
#include <qvideorenderercontrol.h>
#include <private/qmediaserviceprovider_p.h>
-#include <private/qvideoframe_p.h>
QT_USE_NAMESPACE
@@ -451,7 +450,7 @@ void tst_QCameraBackend::testCaptureToBuffer()
QCOMPARE(imageAvailableSignal.first().first().toInt(), id);
QVideoFrame frame = imageAvailableSignal.first().last().value<QVideoFrame>();
- QVERIFY(!qt_imageFromVideoFrame(frame).isNull());
+ QVERIFY(!frame.image().isNull());
frame = QVideoFrame();
capturedSignal.clear();
@@ -509,7 +508,7 @@ void tst_QCameraBackend::testCaptureToBuffer()
QCOMPARE(imageAvailableSignal.first().first().toInt(), id);
frame = imageAvailableSignal.first().last().value<QVideoFrame>();
- QVERIFY(!qt_imageFromVideoFrame(frame).isNull());
+ QVERIFY(!frame.image().isNull());
QString fileName = savedSignal.first().last().toString();
QVERIFY(QFileInfo(fileName).exists());
diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
index c2833f1f7..e91f47755 100644
--- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST
+++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
@@ -5,6 +5,7 @@ windows-7
windows-7sp1
windows-10 msvc-2015
windows-10 msvc-2017
+windows-10 msvc-2019
# Media player plugin not built at the moment on this platform
opensuse-13.1 64bit
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index 9cd3b7fa9..f1be070e8 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -78,6 +78,7 @@ private slots:
void playlistObject();
void surfaceTest_data();
void surfaceTest();
+ void multipleSurfaces();
void metadata();
void playerStateAtEOS();
@@ -1393,6 +1394,33 @@ void tst_QMediaPlayerBackend::surfaceTest()
QVERIFY2(surface.m_totalFrames >= 25, qPrintable(QString("Expected >= 25, got %1").arg(surface.m_totalFrames)));
}
+void tst_QMediaPlayerBackend::multipleSurfaces()
+{
+ if (localVideoFile.isNull())
+ QSKIP("No supported video file");
+
+ QList<QVideoFrame::PixelFormat> formats1;
+ formats1 << QVideoFrame::Format_RGB32
+ << QVideoFrame::Format_ARGB32;
+ QList<QVideoFrame::PixelFormat> formats2;
+ formats2 << QVideoFrame::Format_YUV420P
+ << QVideoFrame::Format_RGB32;
+
+ TestVideoSurface surface1(false);
+ surface1.setSupportedFormats(formats1);
+ TestVideoSurface surface2(false);
+ surface2.setSupportedFormats(formats2);
+
+ QMediaPlayer player;
+ player.setVideoOutput(QVector<QAbstractVideoSurface *>() << &surface1 << &surface2);
+ player.setMedia(localVideoFile);
+ player.play();
+ QTRY_VERIFY(player.position() >= 1000);
+ QVERIFY2(surface1.m_totalFrames >= 25, qPrintable(QString("Expected >= 25, got %1").arg(surface1.m_totalFrames)));
+ QVERIFY2(surface2.m_totalFrames >= 25, qPrintable(QString("Expected >= 25, got %1").arg(surface2.m_totalFrames)));
+ QCOMPARE(surface1.m_totalFrames, surface2.m_totalFrames);
+}
+
void tst_QMediaPlayerBackend::metadata()
{
if (localFileWithMetadata.isNull())
diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp
index 66ace2045..4167b18ea 100644
--- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp
+++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp
@@ -75,10 +75,10 @@ public:
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
{
+ QMediaServiceProviderHint::Features result;
if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::LowLatencyPlayback;
- else
- return 0;
+ result |= QMediaServiceProviderHint::LowLatencyPlayback;
+ return result;
}
};
diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp
index 92707169c..6a7725fee 100644
--- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp
+++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp
@@ -75,10 +75,10 @@ public:
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
{
+ QMediaServiceProviderHint::Features result;
if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::StreamPlayback;
- else
- return 0;
+ result |= QMediaServiceProviderHint::StreamPlayback;
+ return result;
}
};
diff --git a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
index 6be039108..943051435 100644
--- a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
@@ -33,6 +33,7 @@
#include <qvideoframe.h>
#include <QtGui/QImage>
#include <QtCore/QPointer>
+#include <QtMultimedia/private/qtmultimedia-config_p.h>
// Adds an enum, and the stringized version
#define ADD_ENUM_TEST(x) \
@@ -85,6 +86,9 @@ private slots:
void isMapped();
void isReadable();
void isWritable();
+
+ void image_data();
+ void image();
};
Q_DECLARE_METATYPE(QImage::Format)
@@ -1128,6 +1132,173 @@ void tst_QVideoFrame::isWritable()
frame.unmap();
}
+void tst_QVideoFrame::image_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
+ QTest::addColumn<int>("bytes");
+ QTest::addColumn<int>("bytesPerLine");
+ QTest::addColumn<QImage::Format>("imageFormat");
+
+ QTest::newRow("64x64 ARGB32")
+ << QSize(64, 64)
+ << QVideoFrame::Format_ARGB32
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 ARGB32_Premultiplied")
+ << QSize(64, 64)
+ << QVideoFrame::Format_ARGB32_Premultiplied
+ << 16384
+ << 256
+ << QImage::Format_ARGB32_Premultiplied;
+
+ QTest::newRow("64x64 RGB32")
+ << QSize(64, 64)
+ << QVideoFrame::Format_RGB32
+ << 16384
+ << 256
+ << QImage::Format_RGB32;
+
+ QTest::newRow("64x64 RGB24")
+ << QSize(64, 64)
+ << QVideoFrame::Format_RGB24
+ << 16384
+ << 192
+ << QImage::Format_RGB888;
+
+ QTest::newRow("64x64 RGB565")
+ << QSize(64, 64)
+ << QVideoFrame::Format_RGB565
+ << 16384
+ << 128
+ << QImage::Format_RGB16;
+
+ QTest::newRow("64x64 RGB555")
+ << QSize(64, 64)
+ << QVideoFrame::Format_RGB555
+ << 16384
+ << 128
+ << QImage::Format_RGB555;
+
+ QTest::newRow("64x64 BGRA32")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGRA32
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 BGRA32_Premultiplied")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGRA32_Premultiplied
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 BGR32")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGR32
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 BGR24")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGR24
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 BGR565")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGR565
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 BGR555")
+ << QSize(64, 64)
+ << QVideoFrame::Format_BGR555
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+#if !QT_CONFIG(directshow)
+ QTest::newRow("64x64 AYUV444")
+ << QSize(64, 64)
+ << QVideoFrame::Format_AYUV444
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 YUV444")
+ << QSize(64, 64)
+ << QVideoFrame::Format_YUV444
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 YUV420P")
+ << QSize(64, 64)
+ << QVideoFrame::Format_YUV420P
+ << 13288
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 YV12")
+ << QSize(64, 64)
+ << QVideoFrame::Format_YV12
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 UYVY")
+ << QSize(64, 64)
+ << QVideoFrame::Format_UYVY
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 YUYV")
+ << QSize(64, 64)
+ << QVideoFrame::Format_YUYV
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 NV12")
+ << QSize(64, 64)
+ << QVideoFrame::Format_NV12
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+
+ QTest::newRow("64x64 NV21")
+ << QSize(64, 64)
+ << QVideoFrame::Format_NV21
+ << 16384
+ << 256
+ << QImage::Format_ARGB32;
+#endif
+}
+
+void tst_QVideoFrame::image()
+{
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrame::PixelFormat, pixelFormat);
+ QFETCH(int, bytes);
+ QFETCH(int, bytesPerLine);
+ QFETCH(QImage::Format, imageFormat);
+
+ QVideoFrame frame(bytes, size, bytesPerLine, pixelFormat);
+ QImage img = frame.image();
+
+ QVERIFY(!img.isNull());
+ QCOMPARE(img.format(), imageFormat);
+ QCOMPARE(img.size(), size);
+ QCOMPARE(img.bytesPerLine(), bytesPerLine);
+}
+
QTEST_MAIN(tst_QVideoFrame)
#include "tst_qvideoframe.moc"