aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/MadDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-26 14:19:34 +0200
committerMax Kellermann <max@duempel.org>2013-10-26 14:19:34 +0200
commit85ae7e9c9a8e31359834b3b4da3c358b941e8012 (patch)
treecadafa466a385107ba43f4c60664a064c7617550 /src/decoder/MadDecoderPlugin.cxx
parent2098b94b47a60f6265dd5afb61757e9f6b7f9a6e (diff)
downloadmpd-85ae7e9c9a8e31359834b3b4da3c358b941e8012.tar.gz
mpd-85ae7e9c9a8e31359834b3b4da3c358b941e8012.tar.xz
mpd-85ae7e9c9a8e31359834b3b4da3c358b941e8012.zip
DecoderControl: move code/attributes to new class MixRampInfo
Diffstat (limited to 'src/decoder/MadDecoderPlugin.cxx')
-rw-r--r--src/decoder/MadDecoderPlugin.cxx23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx
index c7ed8781d..9dd86c55f 100644
--- a/src/decoder/MadDecoderPlugin.cxx
+++ b/src/decoder/MadDecoderPlugin.cxx
@@ -298,18 +298,16 @@ parse_id3_replay_gain_info(ReplayGainInfo &rgi,
#endif
#ifdef HAVE_ID3TAG
-static bool
-parse_id3_mixramp(char **mixramp_start, char **mixramp_end,
- struct id3_tag *tag)
+gcc_pure
+static MixRampInfo
+parse_id3_mixramp(struct id3_tag *tag)
{
int i;
char *key;
char *value;
struct id3_frame *frame;
- bool found = false;
- *mixramp_start = nullptr;
- *mixramp_end = nullptr;
+ MixRampInfo result;
for (i = 0; (frame = id3_tag_findframe(tag, "TXXX", i)); i++) {
if (frame->nfields < 3)
@@ -323,18 +321,16 @@ parse_id3_mixramp(char **mixramp_start, char **mixramp_end,
(&frame->fields[2]));
if (StringEqualsCaseASCII(key, "mixramp_start")) {
- *mixramp_start = g_strdup(value);
- found = true;
+ result.SetStart(value);
} else if (StringEqualsCaseASCII(key, "mixramp_end")) {
- *mixramp_end = g_strdup(value);
- found = true;
+ result.SetEnd(value);
}
free(key);
free(value);
}
- return found;
+ return result;
}
#endif
@@ -393,16 +389,13 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
if (decoder != nullptr) {
ReplayGainInfo rgi;
- char *mixramp_start;
- char *mixramp_end;
if (parse_id3_replay_gain_info(rgi, id3_tag)) {
decoder_replay_gain(*decoder, &rgi);
found_replay_gain = true;
}
- if (parse_id3_mixramp(&mixramp_start, &mixramp_end, id3_tag))
- decoder_mixramp(*decoder, mixramp_start, mixramp_end);
+ decoder_mixramp(*decoder, parse_id3_mixramp(id3_tag));
}
id3_tag_delete(id3_tag);