diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-02-18 16:58:02 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-07 17:21:47 +0000 |
commit | 63cff37741dca71f3db45ee06bc5bb06488c51f4 (patch) | |
tree | 4feeb36d8f95a24b5dc5dc12c99f471f824de38b /src/plugins/gstreamer/mediaplayer | |
parent | 4d17db19f895ddaa778120c346d8a6a33a710194 (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/gstreamer/mediaplayer')
-rw-r--r-- | src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp | 26 | ||||
-rw-r--r-- | src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h | 1 |
2 files changed, 0 insertions, 27 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index 8fc301a38..4846353a9 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -54,7 +54,6 @@ QT_BEGIN_NAMESPACE QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent) : QMediaPlayerControl(parent) - , m_ownStream(false) , m_session(session) , m_userRequestedState(QMediaPlayer::StoppedState) , m_currentState(QMediaPlayer::StoppedState) @@ -370,31 +369,6 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * emit bufferStatusChanged(0); } - if (m_stream && m_stream != stream) { - if (m_ownStream) - delete m_stream; - m_stream = 0; - m_ownStream = false; - } - - // If the canonical URL refers to a Qt resource, open with QFile and use - // the stream playback capability to play. - if (stream == 0 && content.canonicalUrl().scheme() == QLatin1String("qrc")) { - stream = new QFile(QLatin1Char(':') + content.canonicalUrl().path(), this); - if (!stream->open(QIODevice::ReadOnly)) { - delete stream; - m_mediaStatus = QMediaPlayer::InvalidMedia; - m_currentResource = content; - emit mediaChanged(m_currentResource); - emit error(QMediaPlayer::FormatError, tr("Attempting to play invalid Qt resource")); - if (m_currentState != QMediaPlayer::PlayingState) - m_resources->release(); - popAndNotifyState(); - return; - } - m_ownStream = true; - } - m_currentResource = content; m_stream = stream; diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h index 216885064..c9621b798 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h @@ -116,7 +116,6 @@ private: void pushState(); void popAndNotifyState(); - bool m_ownStream; QGstreamerPlayerSession *m_session; QMediaPlayer::State m_userRequestedState; QMediaPlayer::State m_currentState; |