Blackberry: Fix case of setting multiple media files
Abort the singleshot timer when the media is changed, as otherwise continueLoadMedia() was called multiple times. Also, don't use a singleshot timer when setting a null media. Change-Id: I19d4838c9c70e7fcaa790c223cb19ac3e0246e6b Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
committed by
Qt by Nokia
parent
93823c2251
commit
dfb2493aa2
@@ -45,7 +45,6 @@
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qtimer.h>
|
||||
#include <QtCore/quuid.h>
|
||||
#include <mm/renderer.h>
|
||||
#include <bps/mmrenderer.h>
|
||||
@@ -84,6 +83,9 @@ BbMediaPlayerControl::BbMediaPlayerControl(QObject *parent)
|
||||
m_stopEventsToIgnore(0),
|
||||
m_bufferStatus(0)
|
||||
{
|
||||
m_loadingTimer.setSingleShot(true);
|
||||
m_loadingTimer.setInterval(0);
|
||||
connect(&m_loadingTimer, SIGNAL(timeout()), this, SLOT(continueLoadMedia()));
|
||||
QCoreApplication::eventDispatcher()->installNativeEventFilter(this);
|
||||
openConnection();
|
||||
}
|
||||
@@ -221,6 +223,7 @@ void BbMediaPlayerControl::detach()
|
||||
QFile::remove(m_tempMediaFileName);
|
||||
m_tempMediaFileName.clear();
|
||||
}
|
||||
m_loadingTimer.stop();
|
||||
}
|
||||
|
||||
QMediaPlayer::State BbMediaPlayerControl::state() const
|
||||
@@ -423,8 +426,12 @@ void BbMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *strea
|
||||
// canvas is ready.
|
||||
// The mmrenderer doesn't allow to attach video outputs after playing has started, otherwise
|
||||
// this would be unnecessary.
|
||||
if (!m_media.isNull()) {
|
||||
setMediaStatus(QMediaPlayer::LoadingMedia);
|
||||
QTimer::singleShot(0, this, SLOT(continueLoadMedia()));
|
||||
m_loadingTimer.start(); // singleshot timer to continueLoadMedia()
|
||||
} else {
|
||||
continueLoadMedia(); // still needed, as it will update the media status and clear metadata
|
||||
}
|
||||
}
|
||||
|
||||
void BbMediaPlayerControl::continueLoadMedia()
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <qmediaplayercontrol.h>
|
||||
#include <QtCore/qabstractnativeeventfilter.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtCore/qtimer.h>
|
||||
|
||||
struct bps_event_t;
|
||||
typedef struct mmr_connection mmr_connection_t;
|
||||
@@ -145,6 +146,7 @@ private:
|
||||
int m_stopEventsToIgnore;
|
||||
int m_bufferStatus;
|
||||
QString m_tempMediaFileName;
|
||||
QTimer m_loadingTimer;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user