summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-28 12:23:15 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-11-06 09:50:28 +0100
commitcb8f5067a2fdf73f4f5b71ab3c7bcc65dc13c387 (patch)
tree7c4cb1985e23de597a7627d0a360d4a7ed30e130 /tests/auto
parent59d0683c999bec5612f6ba91867bde4d02185204 (diff)
Introduce rendering to multiple surfaces
QAbstractVideoSurface is used to retrieve and render video frames in particular pixel format. I.e. a backend takes one video surface which asks to provide video frames in one of the supported formats returned from QAbstractVideoSurface::supportedPixelFormats(). So currently there is one source of the video frames and only one video output possible. Introducing QMediaPlayer::setVideoOutput(const QVector<QAbstractVideoSurface *> &) This func takes a list of surfaces, that support at least one shared pixel format, and presents video frames to all of them at the same time. Several surfaces, which do not have any shared pixel formats, will fail to work. Task-number: QTBUG-32939 Change-Id: Ifbdaf692755353fbd5bf3ad74baba1820e3d0237 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp28
1 files changed, 28 insertions, 0 deletions
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())