Fix a playback bug for mediaplayer windows media foundation backend
Task-number:QTMOBILITY-1606 Reviewed-by:Jonas Rabbe (cherry picked from commit d5426bf52e19c9c6a52837b423f48024979ea076) Change-Id: Ie7c1c90a8f5a64e77c435ffc1917d8f9638dfff3 Reviewed-on: http://codereview.qt-project.org/5499 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
@@ -72,7 +72,12 @@ MFPlayerControl::~MFPlayerControl()
|
||||
|
||||
void MFPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream)
|
||||
{
|
||||
stop();
|
||||
if (m_state != QMediaPlayer::StoppedState) {
|
||||
changeState(QMediaPlayer::StoppedState);
|
||||
m_session->stop(true);
|
||||
refreshState();
|
||||
}
|
||||
|
||||
m_media = media;
|
||||
m_stream = stream;
|
||||
resetAudioVideoAvailable();
|
||||
|
||||
@@ -681,12 +681,12 @@ IMFTopologyNode* MFPlayerSession::addOutputNode(IMFStreamDescriptor *streamDesc,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MFPlayerSession::stop()
|
||||
void MFPlayerSession::stop(bool immediate)
|
||||
{
|
||||
#ifdef DEBUG_MEDIAFOUNDATION
|
||||
qDebug() << "stop";
|
||||
#endif
|
||||
if (m_pendingState != NoPending) {
|
||||
if (!immediate && m_pendingState != NoPending) {
|
||||
m_request.setCommand(CmdStop);
|
||||
} else {
|
||||
if (m_state.command == CmdStop)
|
||||
@@ -1186,7 +1186,11 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
|
||||
if (m_status != QMediaPlayer::EndOfMedia) {
|
||||
m_varStart.vt = VT_I8;
|
||||
m_varStart.hVal.QuadPart = 0;
|
||||
changeStatus(QMediaPlayer::LoadedMedia);
|
||||
|
||||
//only change to loadedMedia when not loading a new media source
|
||||
if (m_status != QMediaPlayer::LoadingMedia) {
|
||||
changeStatus(QMediaPlayer::LoadedMedia);
|
||||
}
|
||||
}
|
||||
updatePendingCommands(CmdStop);
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
}
|
||||
|
||||
void load(const QMediaContent &media, QIODevice *stream);
|
||||
void stop();
|
||||
void stop(bool immediate = false);
|
||||
void start();
|
||||
void pause();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user