summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2009-11-04 10:38:41 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2009-11-04 10:48:49 (GMT)
commitf4f6012d181cf60fd04fc5bf69b21786977f0de0 (patch)
tree601cd20b8b070d79ebf61540d4c58af13a1f4937
parentd319fccebfd5f2e7175945275ffc3e73240d766c (diff)
downloadQt-f4f6012d181cf60fd04fc5bf69b21786977f0de0.zip
Qt-f4f6012d181cf60fd04fc5bf69b21786977f0de0.tar.gz
Qt-f4f6012d181cf60fd04fc5bf69b21786977f0de0.tar.bz2
Implemented metadata handling in Phonon MMF backend
Task-number: QTBUG-4662 Reviewed-by: Frans Englich
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp21
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h6
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h3
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp21
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h4
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp1
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.cpp13
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.h4
-rw-r--r--src/plugins/phonon/mmf/plugin/plugin.pro11
9 files changed, 77 insertions, 7 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index b443194..f2efaa0 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -392,7 +392,28 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
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<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
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
index 1ea236b..cff7bab 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -73,6 +73,10 @@ protected:
virtual void close() = 0;
virtual void changeState(PrivateState newState);
+ void updateMetaData();
+ virtual int numberOfMetaDataEntries() const = 0;
+ virtual QPair<QString, QString> metaDataEntry(int index) const = 0;
+
protected:
bool tickTimerRunning() const;
void startTickTimer();
@@ -105,6 +109,8 @@ private:
MediaSource m_source;
MediaSource m_nextSource;
+ QMultiMap<QString, QString> m_metaData;
+
};
}
}
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 1c4ea02..66496cc 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -97,13 +97,14 @@ public:
const QString &errorMessage = QString());
Phonon::State state() const;
+
Q_SIGNALS:
void totalTimeChanged(qint64 length);
void finished();
void tick(qint64 time);
void stateChanged(Phonon::State oldState,
Phonon::State newState);
-
+ void metaDataChanged(const QMultiMap<QString, QString>& metaData);
protected:
/**
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index 1d259a8..8fccfe6 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -182,8 +182,8 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError,
if (KErrNone == aError) {
maxVolumeChanged(m_player->MaxVolume());
-
emit totalTimeChanged(totalTime());
+ updateMetaData();
changeState(StoppedState);
} else {
// TODO: set different error states according to value of aError?
@@ -251,5 +251,24 @@ void MMF::AudioPlayer::MaloLoadingComplete()
#endif // QT_PHONON_MMF_AUDIO_DRM
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+int MMF::AudioPlayer::numberOfMetaDataEntries() const
+{
+ int numberOfEntries = 0;
+ m_player->GetNumberOfMetaDataEntries(numberOfEntries); // ignoring return code
+ return numberOfEntries;
+}
+
+QPair<QString, QString> MMF::AudioPlayer::metaDataEntry(int index) const
+{
+ CMMFMetaDataEntry *entry = 0;
+ QT_TRAP_THROWING(entry = m_player->GetMetaDataEntryL(index));
+ return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value()));
+}
+
+
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
index 60ef436..bc60076 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.h
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -94,6 +94,10 @@ public:
private:
void construct();
+ // AbstractMediaPlayer
+ virtual int numberOfMetaDataEntries() const;
+ virtual QPair<QString, QString> metaDataEntry(int index) const;
+
private:
/**
* Using CPlayerType typedef in order to be able to easily switch between
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 74aaa58..f004fd7 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -322,6 +322,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State)));
connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished()));
connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
+ connect(m_player.data(), SIGNAL(metaDataChanged(const QMultiMap<QString, QString>&)), SIGNAL(metaDataChanged(const QMultiMap<QString, QString>&)));
// We need to call setError() after doing the connects, otherwise the
// error won't be received.
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
index fe469cf..ba7d005 100644
--- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
@@ -490,6 +490,19 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles()
TRACE_RETURN("changed %d", changed);
}
+int MMF::VideoPlayer::numberOfMetaDataEntries() const
+{
+ int numberOfEntries = 0;
+ TRAP_IGNORE(numberOfEntries = m_player->NumberOfMetaDataEntriesL());
+ return numberOfEntries;
+}
+
+QPair<QString, QString> MMF::VideoPlayer::metaDataEntry(int index) const
+{
+ CMMFMetaDataEntry *entry = 0;
+ QT_TRAP_THROWING(entry = m_player->MetaDataEntryL(index));
+ return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value()));
+}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
index 8072404..fa4e59b 100644
--- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
@@ -86,6 +86,10 @@ private:
void updateMmfOutput();
+ // AbstractMediaPlayer
+ virtual int numberOfMetaDataEntries() const;
+ virtual QPair<QString, QString> metaDataEntry(int index) const;
+
private:
QScopedPointer<CVideoPlayerUtility> m_player;
diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro
index 793c307..8a7de98 100644
--- a/src/plugins/phonon/mmf/plugin/plugin.pro
+++ b/src/plugins/phonon/mmf/plugin/plugin.pro
@@ -69,11 +69,12 @@ debug {
LIBS += -lhal
}
-LIBS += -lmediaclientvideo # For CVideoPlayerUtility
-LIBS += -lcone # For CCoeEnv
-LIBS += -lws32 # For RWindow
-LIBS += -lefsrv # For file server
-LIBS += -lapgrfx -lapmime # For recognizer
+LIBS += -lmediaclientvideo # For CVideoPlayerUtility
+LIBS += -lcone # For CCoeEnv
+LIBS += -lws32 # For RWindow
+LIBS += -lefsrv # For file server
+LIBS += -lapgrfx -lapmime # For recognizer
+LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry
# These are for effects.
LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect