diff -r 56cd8111b7f7 -r 41300fa6a67c src/3rdparty/phonon/mmf/abstractmediaplayer.cpp --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp Tue Jan 26 12:42:25 2010 +0200 +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp Tue Feb 02 00:43:10 2010 +0200 @@ -109,12 +109,12 @@ case GroundState: case LoadingState: case PausedState: - case ErrorState: // Do nothing break; case StoppedState: case PlayingState: + case ErrorState: case BufferingState: doPause(); stopTickTimer(); @@ -289,10 +289,6 @@ } -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) { TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal); @@ -318,7 +314,8 @@ case PausedState: case PlayingState: case BufferingState: { - const int err = setDeviceVolume(m_volume * m_mmfMaxVolume); + const qreal volume = (m_volume * m_mmfMaxVolume) + 0.5; + const int err = setDeviceVolume(volume); if (KErrNone != err) { setError(NormalError); @@ -359,26 +356,27 @@ return in.Int64() / 1000; } +//----------------------------------------------------------------------------- +// Slots +//----------------------------------------------------------------------------- + +void MMF::AbstractMediaPlayer::tick() +{ + // For the MWC compiler, we need to qualify the base class. + emit MMF::AbstractPlayer::tick(currentTime()); +} + void MMF::AbstractMediaPlayer::changeState(PrivateState newState) { - TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal); - TRACE_ENTRY("state %d newState %d", privateState(), newState); - - // TODO: add some invariants to check that the transition is valid + TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - if (oldPhononState != newPhononState) { - TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState); - emit stateChanged(newPhononState, oldPhononState); - } - setState(newState); + // TODO: add some invariants to check that the transition is valid + AbstractPlayer::changeState(newState); - if ( - LoadingState == oldPhononState - and StoppedState == newPhononState - ) { + if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); @@ -390,19 +388,29 @@ play(); } } +} + +void MMF::AbstractMediaPlayer::updateMetaData() +{ + TRACE_CONTEXT(AbstractMediaPlayer::updateMetaData, EAudioInternal); + TRACE_ENTRY_0(); + + m_metaData.clear(); + + const int numberOfEntries = numberOfMetaDataEntries(); + for(int i=0; i entry = metaDataEntry(i); + + // Note that we capitalize the key, as required by the Ogg Vorbis + // metadata standard to which Phonon adheres: + // http://xiph.org/vorbis/doc/v-comment.html + m_metaData.insert(entry.first.toUpper(), entry.second); + } + + emit metaDataChanged(m_metaData); TRACE_EXIT_0(); } -//----------------------------------------------------------------------------- -// Slots -//----------------------------------------------------------------------------- - -void MMF::AbstractMediaPlayer::tick() -{ - // For the MWC compiler, we need to qualify the base class. - emit MMF::AbstractPlayer::tick(currentTime()); -} - QT_END_NAMESPACE