summaryrefslogtreecommitdiffstats
path: root/src/plugins/qnx/mediaplayer
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-02-18 16:58:02 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-07 17:21:47 +0000
commit63cff37741dca71f3db45ee06bc5bb06488c51f4 (patch)
tree4feeb36d8f95a24b5dc5dc12c99f471f824de38b /src/plugins/qnx/mediaplayer
parent4d17db19f895ddaa778120c346d8a6a33a710194 (diff)
QMediaPlayer: handle resource files in a cross-platform way.
It was the backend's responsibility to handle resource files in an appropriate way. In practice, it was either not handled at all, or implemented in an almost identical manner in every backend that does handle it. This is now dealt with in QMediaPlayer, always passing to the backend something it will be able to play. If the backend has the StreamPlayback capability, we pass a QFile from which it streams the data. If it doesn't, we copy the resource to a temporary file and pass its path to the backend. Task-number: QTBUG-36175 Task-number: QTBUG-42263 Task-number: QTBUG-43839 Change-Id: I57b355c72692d02661baeaf74e66581ca0a0bd1d Reviewed-by: Andrew Knight <qt@panimo.net> Reviewed-by: Peng Wu <peng.wu@intopalo.com> Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/qnx/mediaplayer')
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp22
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h1
2 files changed, 1 insertions, 22 deletions
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
index 30524106e..3ba640cd6 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
@@ -162,22 +162,6 @@ QByteArray MmRendererMediaPlayerControl::resourcePathForUrl(const QUrl &url)
const QFileInfo fileInfo(relativeFilePath);
return QFile::encodeName(QStringLiteral("file://") + fileInfo.absoluteFilePath());
- // QRC, copy to temporary file, as mmrenderer does not support resource files
- } else if (url.scheme() == QStringLiteral("qrc")) {
- const QString qrcPath = ':' + url.path();
- const QFileInfo resourceFileInfo(qrcPath);
- m_tempMediaFileName = QDir::tempPath() + QStringLiteral("/qtmedia_") +
- QUuid::createUuid().toString() + QStringLiteral(".") +
- resourceFileInfo.suffix();
- if (!QFile::copy(qrcPath, m_tempMediaFileName)) {
- const QString errorMsg = QString("Failed to copy resource file to temporary file "
- "%1 for playback").arg(m_tempMediaFileName);
- qDebug() << errorMsg;
- emit error(0, errorMsg);
- return QByteArray();
- }
- return QFile::encodeName(m_tempMediaFileName);
-
// HTTP or similar URL
} else {
return url.toEncoded();
@@ -187,7 +171,7 @@ QByteArray MmRendererMediaPlayerControl::resourcePathForUrl(const QUrl &url)
void MmRendererMediaPlayerControl::attach()
{
// Should only be called in detached state
- Q_ASSERT(m_audioId == -1 && !m_inputAttached && m_tempMediaFileName.isEmpty());
+ Q_ASSERT(m_audioId == -1 && !m_inputAttached);
if (m_media.isNull() || !m_context) {
setMediaStatus(QMediaPlayer::NoMedia);
@@ -251,10 +235,6 @@ void MmRendererMediaPlayerControl::detach()
}
}
- if (!m_tempMediaFileName.isEmpty()) {
- QFile::remove(m_tempMediaFileName);
- m_tempMediaFileName.clear();
- }
m_loadingTimer.stop();
}
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
index d4ddf3633..79fc9be0b 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
@@ -156,7 +156,6 @@ private:
bool m_inputAttached;
int m_stopEventsToIgnore;
int m_bufferLevel;
- QString m_tempMediaFileName;
QTimer m_loadingTimer;
};