summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2012-07-26 16:02:57 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-28 17:21:43 +0200
commitdfb2493aa2a5295e03b8517583f9ff31b64484aa (patch)
tree2a5fae6c61cabcfac462925a4d732f2d7fa648be /src/plugins
parent93823c2251c1a83c233351f8901243715a8ac9e9 (diff)
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/blackberry/bbmediaplayercontrol.cpp13
-rw-r--r--src/plugins/blackberry/bbmediaplayercontrol.h2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/blackberry/bbmediaplayercontrol.cpp b/src/plugins/blackberry/bbmediaplayercontrol.cpp
index 63437fcf1..3a84149ec 100644
--- a/src/plugins/blackberry/bbmediaplayercontrol.cpp
+++ b/src/plugins/blackberry/bbmediaplayercontrol.cpp
@@ -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.
- setMediaStatus(QMediaPlayer::LoadingMedia);
- QTimer::singleShot(0, this, SLOT(continueLoadMedia()));
+ if (!m_media.isNull()) {
+ setMediaStatus(QMediaPlayer::LoadingMedia);
+ m_loadingTimer.start(); // singleshot timer to continueLoadMedia()
+ } else {
+ continueLoadMedia(); // still needed, as it will update the media status and clear metadata
+ }
}
void BbMediaPlayerControl::continueLoadMedia()
diff --git a/src/plugins/blackberry/bbmediaplayercontrol.h b/src/plugins/blackberry/bbmediaplayercontrol.h
index 519a43555..e8a9ed828 100644
--- a/src/plugins/blackberry/bbmediaplayercontrol.h
+++ b/src/plugins/blackberry/bbmediaplayercontrol.h
@@ -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