From 222b777552b9ac813aec456872573cca7036f39d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 23 Feb 2016 10:42:41 +0100 Subject: [PATCH] tag/ApeReplayGain: add overload with InputStream& parameter --- src/tag/ApeReplayGain.cxx | 17 +++++++++++++++++ src/tag/ApeReplayGain.hxx | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/src/tag/ApeReplayGain.cxx b/src/tag/ApeReplayGain.cxx index 883885369..bfad3b07d 100644 --- a/src/tag/ApeReplayGain.cxx +++ b/src/tag/ApeReplayGain.cxx @@ -47,6 +47,23 @@ replay_gain_ape_callback(unsigned long flags, const char *key, return ParseReplayGainTag(info, key, value); } +bool +replay_gain_ape_read(InputStream &is, ReplayGainInfo &info) +{ + bool found = false; + + auto callback = [&info, &found] + (unsigned long flags, const char *key, + StringView value) { + found |= replay_gain_ape_callback(flags, key, + value, + info); + return true; + }; + + return tag_ape_scan(is, callback) && found; +} + bool replay_gain_ape_read(Path path_fs, ReplayGainInfo &info) { diff --git a/src/tag/ApeReplayGain.hxx b/src/tag/ApeReplayGain.hxx index faf68f0e3..0150aae3b 100644 --- a/src/tag/ApeReplayGain.hxx +++ b/src/tag/ApeReplayGain.hxx @@ -22,9 +22,13 @@ #include "check.h" +class InputStream; class Path; struct ReplayGainInfo; +bool +replay_gain_ape_read(InputStream &is, ReplayGainInfo &info); + bool replay_gain_ape_read(Path path_fs, ReplayGainInfo &info);