aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-20 18:32:34 +0200
committerMax Kellermann <max@duempel.org>2010-07-20 23:05:24 +0200
commitdea5601e79fd64de8a1190f4fc785b65241b11c9 (patch)
tree7c041752a33fa31a15761a32e60613a6b1b71271 /src
parent43a840552f085af15af3f058c62035b9468cd730 (diff)
downloadmpd-dea5601e79fd64de8a1190f4fc785b65241b11c9.tar.gz
mpd-dea5601e79fd64de8a1190f4fc785b65241b11c9.tar.xz
mpd-dea5601e79fd64de8a1190f4fc785b65241b11c9.zip
tag_rva2: move code to rva2_apply_data()
Diffstat (limited to '')
-rw-r--r--src/tag_rva2.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/tag_rva2.c b/src/tag_rva2.c
index 95f1b5464..35f12118f 100644
--- a/src/tag_rva2.c
+++ b/src/tag_rva2.c
@@ -71,6 +71,21 @@ rva2_float_volume_adjustment(const struct rva2_data *data)
return (float)rva2_fixed_volume_adjustment(data) / (float)512;
}
+static inline bool
+rva2_apply_data(struct replay_gain_info *replay_gain_info,
+ const struct rva2_data *data)
+{
+ if (data->type != CHANNEL_MASTER_VOLUME)
+ return false;
+
+ float volume_adjustment = rva2_float_volume_adjustment(data);
+
+ replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
+ replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
+
+ return true;
+}
+
bool
tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
{
@@ -110,18 +125,8 @@ tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
if (4 + peak_bytes > length)
break;
- if (d->type == CHANNEL_MASTER_VOLUME) {
- double voladj_float = rva2_float_volume_adjustment(d);
-
- replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = voladj_float;
- replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = voladj_float;
-
- g_debug("parseRVA2: Relative Volume "
- "%+.1f dB adjustment (%s)\n",
- voladj_float, id);
-
+ if (rva2_apply_data(replay_gain_info, d))
return true;
- }
data += 4 + peak_bytes;
length -= 4 + peak_bytes;