diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-04-14 13:03:35 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-04-15 05:39:59 (GMT) |
commit | 468a0b27f8706e7d40f7b1c07f0cc0b50a48971b (patch) | |
tree | df806a733064bd3e5ced876d5d2b8d7f9e7fa502 /src | |
parent | dc2d0315fc18fdbad7686adaf5f4886252fe0e5a (diff) | |
download | Qt-468a0b27f8706e7d40f7b1c07f0cc0b50a48971b.zip Qt-468a0b27f8706e7d40f7b1c07f0cc0b50a48971b.tar.gz Qt-468a0b27f8706e7d40f7b1c07f0cc0b50a48971b.tar.bz2 |
Phonon MMF: Suppress intermediate stateChanged() signal
If MediaObject::play() is called while the object is in LoadingState,
playback will start once loading is completed. Previously, the
Symbian backend at this point emitted two stateChanged signals - first
to StoppedState and then to PlayingState.
The testPlayOnFinish step in tst_mediaobject requires that only one
state change occurs: directly from LoadingState to PlayingState.
Reviewed-by: Frans Englich
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 20 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractmediaplayer.h | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index a90131d..221443e 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -79,9 +79,7 @@ void MMF::AbstractMediaPlayer::play() case StoppedState: case PausedState: - doPlay(); - startPositionTimer(); - changeState(PlayingState); + startPlayback(); break; case PlayingState: @@ -441,6 +439,13 @@ void MMF::AbstractMediaPlayer::resetMarksIfRewound() m_aboutToFinishSent = false; } +void MMF::AbstractMediaPlayer::startPlayback() +{ + doPlay(); + startPositionTimer(); + changeState(PlayingState); +} + void MMF::AbstractMediaPlayer::bufferStatusTick() { emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); @@ -453,9 +458,6 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - // TODO: add some invariants to check that the transition is valid - AbstractPlayer::changeState(newState); - if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); @@ -465,8 +467,12 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) if (m_playPending) { TRACE_0("play was called while loading; starting playback now"); m_playPending = false; - play(); + startPlayback(); + } else { + AbstractPlayer::changeState(newState); } + } else { + AbstractPlayer::changeState(newState); } } diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 308b5af..f8f86af 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -70,7 +70,8 @@ protected: virtual int openUrl(const QString& url) = 0; virtual int bufferStatus() const = 0; virtual void close() = 0; - virtual void changeState(PrivateState newState); + + void changeState(PrivateState newState); void updateMetaData(); virtual int numberOfMetaDataEntries() const = 0; @@ -93,6 +94,7 @@ private: void doVolumeChanged(); void emitMarksIfReached(qint64 position); void resetMarksIfRewound(); + void startPlayback(); private Q_SLOTS: void positionTick(); |