summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/phonon/mmf/abstractmediaplayer.cpp')
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index af2c31e..f2efaa0 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -318,7 +318,8 @@ void MMF::AbstractMediaPlayer::doVolumeChanged()
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 +360,27 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds
return in.Int64() / 1000;
}
-void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
+//-----------------------------------------------------------------------------
+// Slots
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractMediaPlayer::tick()
{
- TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal);
- TRACE_ENTRY("state %d newState %d", privateState(), newState);
+ // For the MWC compiler, we need to qualify the base class.
+ emit MMF::AbstractPlayer::tick(currentTime());
+}
- // TODO: add some invariants to check that the transition is valid
+void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
+{
+ 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,18 +392,28 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
play();
}
}
-
- TRACE_EXIT_0();
}
-//-----------------------------------------------------------------------------
-// Slots
-//-----------------------------------------------------------------------------
-
-void MMF::AbstractMediaPlayer::tick()
+void MMF::AbstractMediaPlayer::updateMetaData()
{
- // For the MWC compiler, we need to qualify the base class.
- emit MMF::AbstractPlayer::tick(currentTime());
+ TRACE_CONTEXT(AbstractMediaPlayer::updateMetaData, EAudioInternal);
+ TRACE_ENTRY_0();
+
+ m_metaData.clear();
+
+ const int numberOfEntries = numberOfMetaDataEntries();
+ for(int i=0; i<numberOfEntries; ++i) {
+ const QPair<QString, QString> 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();
}
QT_END_NAMESPACE