aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/VorbisComments.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-24 20:54:20 +0200
committerMax Kellermann <max@duempel.org>2014-09-24 22:21:13 +0200
commit441f9cc2ee1e62be0d5869c247aecff78c2ca3c6 (patch)
treef3da3a635c38e2feaddde27d41fb80c4bab46ddd /src/decoder/plugins/VorbisComments.cxx
parent9f4fc8ad33470d2f82faafb96d5db41967faa151 (diff)
downloadmpd-441f9cc2ee1e62be0d5869c247aecff78c2ca3c6.tar.gz
mpd-441f9cc2ee1e62be0d5869c247aecff78c2ca3c6.tar.xz
mpd-441f9cc2ee1e62be0d5869c247aecff78c2ca3c6.zip
tag/ReplayGain: add VorbisComment parser
Move code from the Vorbis and FLAC decoder plugins.
Diffstat (limited to 'src/decoder/plugins/VorbisComments.cxx')
-rw-r--r--src/decoder/plugins/VorbisComments.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/decoder/plugins/VorbisComments.cxx b/src/decoder/plugins/VorbisComments.cxx
index f1dcdc1b0..062f46acf 100644
--- a/src/decoder/plugins/VorbisComments.cxx
+++ b/src/decoder/plugins/VorbisComments.cxx
@@ -24,6 +24,7 @@
#include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/VorbisComment.hxx"
+#include "tag/ReplayGain.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include "util/SplitString.hxx"
@@ -36,27 +37,11 @@ vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments)
{
rgi.Clear();
- const char *temp;
bool found = false;
while (*comments) {
- if ((temp =
- vorbis_comment_value(*comments, "replaygain_track_gain"))) {
- rgi.tuples[REPLAY_GAIN_TRACK].gain = atof(temp);
+ if (ParseReplayGainVorbis(rgi, *comments))
found = true;
- } else if ((temp = vorbis_comment_value(*comments,
- "replaygain_album_gain"))) {
- rgi.tuples[REPLAY_GAIN_ALBUM].gain = atof(temp);
- found = true;
- } else if ((temp = vorbis_comment_value(*comments,
- "replaygain_track_peak"))) {
- rgi.tuples[REPLAY_GAIN_TRACK].peak = atof(temp);
- found = true;
- } else if ((temp = vorbis_comment_value(*comments,
- "replaygain_album_peak"))) {
- rgi.tuples[REPLAY_GAIN_ALBUM].peak = atof(temp);
- found = true;
- }
comments++;
}