summaryrefslogtreecommitdiff
path: root/test/dump_rva2.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-11-24 17:17:08 +0100
committerMax Kellermann <max@musicpd.org>2016-11-24 17:17:30 +0100
commit85c2b396cee92f0cc93f4c1101111994b6d2d412 (patch)
tree84e408d2bea580b78d8077de29e03b6720796c60 /test/dump_rva2.cxx
parent0759d721085478f94d84f1e9ee1ecf6f7d8e85a0 (diff)
test/FakeDecoderAPI: move code to DumpReplayGainTuple()
Diffstat (limited to 'test/dump_rva2.cxx')
-rw-r--r--test/dump_rva2.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/dump_rva2.cxx b/test/dump_rva2.cxx
index c4408b1b5..603d96e7b 100644
--- a/test/dump_rva2.cxx
+++ b/test/dump_rva2.cxx
@@ -45,6 +45,21 @@ config_get_string(gcc_unused enum ConfigOption option,
return default_value;
}
+static void
+DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple)
+{
+ if (tuple.IsDefined())
+ fprintf(stderr, "replay_gain[%s]: gain=%f peak=%f\n",
+ name, tuple.gain, tuple.peak);
+}
+
+static void
+DumpReplayGainInfo(const ReplayGainInfo &info)
+{
+ DumpReplayGainTuple("album", info.tuples[REPLAY_GAIN_ALBUM]);
+ DumpReplayGainTuple("track", info.tuples[REPLAY_GAIN_TRACK]);
+}
+
int main(int argc, char **argv)
try {
#ifdef HAVE_LOCALE_H
@@ -79,15 +94,7 @@ try {
return EXIT_FAILURE;
}
- const ReplayGainTuple *tuple = &replay_gain.tuples[REPLAY_GAIN_ALBUM];
- if (tuple->IsDefined())
- fprintf(stderr, "replay_gain[album]: gain=%f peak=%f\n",
- tuple->gain, tuple->peak);
-
- tuple = &replay_gain.tuples[REPLAY_GAIN_TRACK];
- if (tuple->IsDefined())
- fprintf(stderr, "replay_gain[track]: gain=%f peak=%f\n",
- tuple->gain, tuple->peak);
+ DumpReplayGainInfo(replay_gain);
return EXIT_SUCCESS;
} catch (const std::exception &e) {