summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-11 17:34:32 +0100
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-20 13:43:24 +0100
commitccde3b75e4ff53e711439e82e1c5640fac225d8e (patch)
tree2a4b4a5387af010ca1a3dd9c10b47a7a3626c7d4 /tests/auto
parent30034a140ca8aefa1986c9964ae1f30dcfef886e (diff)
AVF: Introduce adoption of AVAssetResourceLoaderDelegate protocol
AVAssetResourceLoaderDelegate allows to load custom resources. Implemented resourceLoader:shouldWaitForLoadingOfRequestedResource to read data from QIODevice. The device should be seekable, and already should have all data available. Since there is a need to know total size of the stream. So the media player will wait for QIODevice::readyRead before loading the resource. Also it requires to have url together with the stream: QMediaPlayer->setMedia(QUrl("does_not_matter.mp3"), buffer); Since the backend uses extension to determine type of the stream. Fixes: QTBUG-69101 Change-Id: I8ab0b69f668ccd67c42a8e5d5c1ad518d3306cce Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index f1be070e8..a2217afc8 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -81,6 +81,7 @@ private slots:
void multipleSurfaces();
void metadata();
void playerStateAtEOS();
+ void playFromBuffer();
private:
QMediaContent selectVideoFile(const QStringList& mediaCandidates);
@@ -1476,6 +1477,25 @@ void tst_QMediaPlayerBackend::playerStateAtEOS()
QVERIFY(endOfMediaReceived);
}
+void tst_QMediaPlayerBackend::playFromBuffer()
+{
+ if (localVideoFile.isNull())
+ QSKIP("No supported video file");
+
+ TestVideoSurface surface(false);
+ QMediaPlayer player;
+ player.setVideoOutput(&surface);
+ QFile file(localVideoFile.request().url().toLocalFile());
+ if (!file.open(QIODevice::ReadOnly))
+ QSKIP("Could not open file");
+ player.setMedia(localVideoFile, &file);
+ player.play();
+ QTRY_VERIFY(player.position() >= 1000);
+ if (surface.error() == QAbstractVideoSurface::UnsupportedFormatError)
+ QSKIP("None of the pixel formats is supported by the backend");
+ QVERIFY2(surface.m_totalFrames >= 25, qPrintable(QString("Expected >= 25, got %1").arg(surface.m_totalFrames)));
+}
+
TestVideoSurface::TestVideoSurface(bool storeFrames):
m_totalFrames(0),
m_storeFrames(storeFrames)