[phonon-gstreamer] gstreamer: Map gst equalizer name to the one used in pxine
Harald Sitter
sitter at kde.org
Tue Mar 1 00:23:37 CET 2011
Git commit b6b51f4e082451f88b97004ea1904940a8a05cc7 by Harald Sitter.
Committed on 01/03/2011 at 00:23.
Pushed by sitter into branch 'master'.
Map gst equalizer name to the one used in pxine
This allows API consumers such as Amarok to actually maintain a working
equalizer with phonon gstreamer, even though gstreamer uses a different
name for the EQ than phonon xine. This ought to be fixed in spitfire as
we are targetting an enum based identification system there. So, ideally
application developers can then check the available effects for
Effect::Equalizer and request that from the backend. Much more scalable
than the current name-based approach.
What I'd like to see meanwhile is amarok check for both KEqualizer and
equalizer-10bands in the EngineController. The manual mapping is very
ugly and should go away ASAP.
CCMAIL: amarok-devel at kde.org
M +5 -0 gstreamer/audioeffect.cpp
M +13 -0 gstreamer/effectmanager.cpp
http://commits.kde.org/phonon-gstreamer/b6b51f4e082451f88b97004ea1904940a8a05cc7
diff --git a/gstreamer/audioeffect.cpp b/gstreamer/audioeffect.cpp
index a196091..42f7dc7 100644
--- a/gstreamer/audioeffect.cpp
+++ b/gstreamer/audioeffect.cpp
@@ -38,6 +38,11 @@ AudioEffect::AudioEffect(Backend *backend, int effectId, QObject *parent)
QList<EffectInfo*> audioEffects = backend->effectManager()->audioEffects();
if (effectId >= 0 && effectId < audioEffects.size()) {
m_effectName = audioEffects[effectId]->name();
+ // Reverse mapped name back to GStreamer name, see effectmanager.cpp for
+ // more information on this.
+ if (m_effectName == QLatin1String("KEqualizer")) {
+ m_effectName = QString("equalizer-10bands");
+ }
init();
} else {
qWarning() << Q_FUNC_INFO << ": Effect ID (" << effectId << ") out of range (" << audioEffects.size() << ")!";
diff --git a/gstreamer/effectmanager.cpp b/gstreamer/effectmanager.cpp
index 4f59452..ff29b24 100644
--- a/gstreamer/effectmanager.cpp
+++ b/gstreamer/effectmanager.cpp
@@ -83,6 +83,19 @@ EffectManager::EffectManager(Backend *backend)
author = gst_element_factory_get_author (GST_ELEMENT_FACTORY(feature));
EffectInfo *effect = new EffectInfo(name, description, author);
m_audioEffectList.append(effect);
+
+#ifdef __GNUC__
+#warning TODO 4.5 - get rid of equalizer name mapping (also see audioeffect.cpp)
+#endif
+ // Map the GStreamer name to the name used by Xine, to allow
+ // API consumers that think KEqualizer is a persistant name
+ // to have a working equalizer with GStreamer too (e.g. Amarok).
+ if (name == QLatin1String("equalizer-10bands")) {
+ m_audioEffectList.append(new EffectInfo(
+ QLatin1String("KEqualizer"),
+ QLatin1String("Compatibility effect. Do not use in new software!"),
+ author));
+ }
}
}
}
More information about the Amarok-devel
mailing list