summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-01 03:03:28 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-01 07:28:44 +0000
commita330616496cf14e53db344513889444c6d60e7de (patch)
tree8e2b88bfbadfacb3c684dc7dc2fd8b18321e81ba
parent48206ccc29154a2ebdbe14c549c84b2e590b6a06 (diff)
parent545959e45ec86c70617f4839d20d931297c30c20 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/multimedia/video/qvideoframe.h Change-Id: I8458c4138be05f661d6528116cbc6b18298f0a91
-rw-r--r--src/gsttools/qgstreamerplayercontrol.cpp48
-rw-r--r--src/gsttools/qgstreamerplayersession.cpp8
-rw-r--r--src/multimedia/playback/qmediaresource.cpp4
-rw-r--r--src/multimedia/playback/qmediaresource.h4
-rw-r--r--src/multimedia/video/qvideoframe.h4
-rw-r--r--src/plugins/directshow/common/directshowvideoprobecontrol.cpp12
-rw-r--r--src/plugins/directshow/common/directshowvideoprobecontrol.h3
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp9
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp2
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp4
10 files changed, 52 insertions, 46 deletions
diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp
index b49ec479f..bd4c90ac5 100644
--- a/src/gsttools/qgstreamerplayercontrol.cpp
+++ b/src/gsttools/qgstreamerplayercontrol.cpp
@@ -64,39 +64,27 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
m_resources = QMediaResourcePolicy::createResourceSet<QMediaPlayerResourceSetInterface>();
Q_ASSERT(m_resources);
- connect(m_session, SIGNAL(positionChanged(qint64)),
- this, SIGNAL(positionChanged(qint64)));
- connect(m_session, SIGNAL(durationChanged(qint64)),
- this, SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedStateChanged(bool)),
- this, SIGNAL(mutedChanged(bool)));
- connect(m_session, SIGNAL(volumeChanged(int)),
- this, SIGNAL(volumeChanged(int)));
- connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SLOT(updateSessionState(QMediaPlayer::State)));
- connect(m_session,SIGNAL(bufferingProgressChanged(int)),
- this, SLOT(setBufferProgress(int)));
- connect(m_session, SIGNAL(playbackFinished()),
- this, SLOT(processEOS()));
- connect(m_session, SIGNAL(audioAvailableChanged(bool)),
- this, SIGNAL(audioAvailableChanged(bool)));
- connect(m_session, SIGNAL(videoAvailableChanged(bool)),
- this, SIGNAL(videoAvailableChanged(bool)));
- connect(m_session, SIGNAL(seekableChanged(bool)),
- this, SIGNAL(seekableChanged(bool)));
- connect(m_session, SIGNAL(error(int,QString)),
- this, SIGNAL(error(int,QString)));
- connect(m_session, SIGNAL(invalidMedia()),
- this, SLOT(handleInvalidMedia()));
- connect(m_session, SIGNAL(playbackRateChanged(qreal)),
- this, SIGNAL(playbackRateChanged(qreal)));
-
- connect(m_resources, SIGNAL(resourcesGranted()), SLOT(handleResourcesGranted()));
+ connect(m_session, &QGstreamerPlayerSession::positionChanged, this, &QGstreamerPlayerControl::positionChanged);
+ connect(m_session, &QGstreamerPlayerSession::durationChanged, this, &QGstreamerPlayerControl::durationChanged);
+ connect(m_session, &QGstreamerPlayerSession::mutedStateChanged, this, &QGstreamerPlayerControl::mutedChanged);
+ connect(m_session, &QGstreamerPlayerSession::volumeChanged, this, &QGstreamerPlayerControl::volumeChanged);
+ connect(m_session, &QGstreamerPlayerSession::stateChanged, this, &QGstreamerPlayerControl::updateSessionState);
+ connect(m_session, &QGstreamerPlayerSession::bufferingProgressChanged, this, &QGstreamerPlayerControl::setBufferProgress);
+ connect(m_session, &QGstreamerPlayerSession::playbackFinished, this, &QGstreamerPlayerControl::processEOS);
+ connect(m_session, &QGstreamerPlayerSession::audioAvailableChanged, this, &QGstreamerPlayerControl::audioAvailableChanged);
+ connect(m_session, &QGstreamerPlayerSession::videoAvailableChanged, this, &QGstreamerPlayerControl::videoAvailableChanged);
+ connect(m_session, &QGstreamerPlayerSession::seekableChanged, this, &QGstreamerPlayerControl::seekableChanged);
+ connect(m_session, &QGstreamerPlayerSession::error, this, &QGstreamerPlayerControl::error);
+ connect(m_session, &QGstreamerPlayerSession::invalidMedia, this, &QGstreamerPlayerControl::handleInvalidMedia);
+ connect(m_session, &QGstreamerPlayerSession::playbackRateChanged, this, &QGstreamerPlayerControl::playbackRateChanged);
+
+ connect(m_resources, &QMediaPlayerResourceSetInterface::resourcesGranted, this, &QGstreamerPlayerControl::handleResourcesGranted);
//denied signal should be queued to have correct state update process,
//since in playOrPause, when acquire is call on resource set, it may trigger a resourcesDenied signal immediately,
//so handleResourcesDenied should be processed later, otherwise it will be overwritten by state update later in playOrPause.
- connect(m_resources, SIGNAL(resourcesDenied()), this, SLOT(handleResourcesDenied()), Qt::QueuedConnection);
- connect(m_resources, SIGNAL(resourcesLost()), SLOT(handleResourcesLost()));
+ connect(m_resources, &QMediaPlayerResourceSetInterface::resourcesDenied,
+ this, &QGstreamerPlayerControl::handleResourcesDenied, Qt::QueuedConnection);
+ connect(m_resources, &QMediaPlayerResourceSetInterface::resourcesLost, this, &QGstreamerPlayerControl::handleResourcesLost);
}
QGstreamerPlayerControl::~QGstreamerPlayerControl()
diff --git a/src/gsttools/qgstreamerplayersession.cpp b/src/gsttools/qgstreamerplayersession.cpp
index 891eecbb0..10e83342d 100644
--- a/src/gsttools/qgstreamerplayersession.cpp
+++ b/src/gsttools/qgstreamerplayersession.cpp
@@ -1155,10 +1155,10 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
#ifdef DEBUG_PLAYBIN
- QStringList states;
- states << QStringLiteral("GST_STATE_VOID_PENDING") << QStringLiteral("GST_STATE_NULL")
- << QStringLiteral("GST_STATE_READY") << QStringLiteral("GST_STATE_PAUSED")
- << QStringLiteral("GST_STATE_PLAYING");
+ static QStringList states = {
+ QStringLiteral("GST_STATE_VOID_PENDING"), QStringLiteral("GST_STATE_NULL"),
+ QStringLiteral("GST_STATE_READY"), QStringLiteral("GST_STATE_PAUSED"),
+ QStringLiteral("GST_STATE_PLAYING") };
qDebug() << QStringLiteral("state changed: old: %1 new: %2 pending: %3") \
.arg(states[oldState]) \
diff --git a/src/multimedia/playback/qmediaresource.cpp b/src/multimedia/playback/qmediaresource.cpp
index 181b37525..97d42bd0b 100644
--- a/src/multimedia/playback/qmediaresource.cpp
+++ b/src/multimedia/playback/qmediaresource.cpp
@@ -39,8 +39,6 @@
#include "qmediaresource.h"
-#if QT_DEPRECATED_SINCE(6, 0)
-
#include <QtCore/qsize.h>
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
@@ -420,5 +418,3 @@ void QMediaResource::setResolution(int width, int height)
values.remove(Resolution);
}
QT_END_NAMESPACE
-
-#endif // #if QT_DEPRECATED_SINCE(6, 0)
diff --git a/src/multimedia/playback/qmediaresource.h b/src/multimedia/playback/qmediaresource.h
index 8cded3128..9740166c6 100644
--- a/src/multimedia/playback/qmediaresource.h
+++ b/src/multimedia/playback/qmediaresource.h
@@ -46,8 +46,6 @@
#include <QtMultimedia/qtmultimediaglobal.h>
-#if QT_DEPRECATED_SINCE(6, 0)
-
QT_BEGIN_NAMESPACE
// Class forward declaration required for QDoc bug
@@ -126,6 +124,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QMediaResource)
Q_DECLARE_METATYPE(QMediaResourceList)
-#endif // #if QT_DEPRECATED_SINCE(6, 0)
-
#endif
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index 617b0a1d9..8fcf47fc4 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -75,7 +75,6 @@ public:
Format_ARGB8565_Premultiplied,
Format_BGRA32,
Format_BGRA32_Premultiplied,
- Format_ABGR32,
Format_BGR32,
Format_BGR24,
Format_BGR565,
@@ -102,7 +101,8 @@ public:
Format_CameraRaw,
Format_AdobeDng,
- Format_YUV422P, // ### Qt 6: reorder
+ Format_ABGR32, // ### Qt 6: reorder
+ Format_YUV422P,
#ifndef Q_QDOC
NPixelFormats,
diff --git a/src/plugins/directshow/common/directshowvideoprobecontrol.cpp b/src/plugins/directshow/common/directshowvideoprobecontrol.cpp
index 5ec1ff064..0e2e68864 100644
--- a/src/plugins/directshow/common/directshowvideoprobecontrol.cpp
+++ b/src/plugins/directshow/common/directshowvideoprobecontrol.cpp
@@ -54,4 +54,16 @@ DirectShowVideoProbeControl::~DirectShowVideoProbeControl()
qCWarning(qtDirectShowPlugin, "QVideoProbe control destroyed while it's still being referenced!!!");
}
+void DirectShowVideoProbeControl::probeVideoFrame(const QVideoFrame &frame)
+{
+ emit videoFrameProbed(frame);
+ m_frameProbed = true;
+}
+
+void DirectShowVideoProbeControl::flushVideoFrame()
+{
+ if (m_frameProbed)
+ emit flush();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/directshow/common/directshowvideoprobecontrol.h b/src/plugins/directshow/common/directshowvideoprobecontrol.h
index 458263234..57839f8d3 100644
--- a/src/plugins/directshow/common/directshowvideoprobecontrol.h
+++ b/src/plugins/directshow/common/directshowvideoprobecontrol.h
@@ -55,8 +55,11 @@ public:
bool ref() { return m_ref.ref(); }
bool deref() { return m_ref.deref(); }
+ void probeVideoFrame(const QVideoFrame &frame);
+ void flushVideoFrame();
private:
QAtomicInt m_ref;
+ bool m_frameProbed = false;
};
QT_END_NAMESPACE
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
index 42105c471..3cc42dc21 100644
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ b/src/plugins/directshow/player/directshowplayerservice.cpp
@@ -622,6 +622,9 @@ void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker)
void DirectShowPlayerService::releaseGraph()
{
+ if (m_videoProbeControl)
+ m_videoProbeControl->flushVideoFrame();
+
if (m_graph) {
if (m_executingTask != 0) {
// {8E1C39A1-DE53-11cf-AA63-0080C744528D}
@@ -999,6 +1002,8 @@ void DirectShowPlayerService::stop()
if ((m_executingTask | m_executedTasks) & (Play | Pause | Seek)) {
m_pendingTasks |= Stop;
+ if (m_videoProbeControl)
+ m_videoProbeControl->flushVideoFrame();
::SetEvent(m_taskHandle);
@@ -1431,6 +1436,8 @@ void DirectShowPlayerService::customEvent(QEvent *event)
m_playerControl->updateState(QMediaPlayer::StoppedState);
m_playerControl->updateStatus(QMediaPlayer::EndOfMedia);
m_playerControl->updatePosition(m_position);
+ if (m_videoProbeControl)
+ m_videoProbeControl->flushVideoFrame();
}
} else if (event->type() == QEvent::Type(PositionChange)) {
QMutexLocker locker(&m_mutex);
@@ -1539,7 +1546,7 @@ void DirectShowPlayerService::onVideoBufferAvailable(double time, const QByteArr
size,
format);
- Q_EMIT m_videoProbeControl->videoFrameProbed(frame);
+ m_videoProbeControl->probeVideoFrame(frame);
}
QT_WARNING_POP
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index f064c7c92..b96ba6792 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -732,7 +732,7 @@ static QList<QCameraViewfinderSettings> capsToViewfinderSettings(GstCaps *suppor
QList<QCameraViewfinderSettings> CameraBinSession::supportedViewfinderSettings() const
{
- if (m_status == QCamera::LoadedStatus && m_supportedViewfinderSettings.isEmpty()) {
+ if (m_status >= QCamera::LoadedStatus && m_supportedViewfinderSettings.isEmpty()) {
m_supportedViewfinderSettings =
capsToViewfinderSettings(supportedCaps(QCamera::CaptureViewfinder));
}
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index a61352a18..9ec26021f 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -39,6 +39,8 @@
#include "../shared/mediafileselector.h"
//TESTED_COMPONENT=src/multimedia
+#include <QtMultimedia/private/qtmultimedia-config_p.h>
+
QT_USE_NAMESPACE
/*
@@ -1358,8 +1360,10 @@ void tst_QMediaPlayerBackend::surfaceTest_data()
QTest::newRow("RGB formats")
<< formatsRGB;
+#if !QT_CONFIG(directshow)
QTest::newRow("YVU formats")
<< formatsYUV;
+#endif
QTest::newRow("RGB & YUV formats")
<< formatsRGB + formatsYUV;