From 17ace95268c93188891e85105eb51f0640526d66 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 23 Feb 2016 10:07:47 +0100 Subject: [PATCH] tag/Generic: add overload with InputStream& parameter --- src/tag/Generic.cxx | 17 +++++++++++++++++ src/tag/Generic.hxx | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/src/tag/Generic.cxx b/src/tag/Generic.cxx index 27fd34684..a731fbe38 100644 --- a/src/tag/Generic.cxx +++ b/src/tag/Generic.cxx @@ -22,6 +22,23 @@ #include "TagId3.hxx" #include "ApeTag.hxx" #include "fs/Path.hxx" +#include "input/InputStream.hxx" +#include "util/Error.hxx" + +/** + * Attempts to scan APE or ID3 tags from the specified file. + */ +bool +ScanGenericTags(InputStream &is, const TagHandler &handler, void *ctx) +{ + if (tag_ape_scan2(is, handler, ctx)) + return true; + + if (!is.Rewind(IgnoreError())) + return false; + + return tag_id3_scan(is, handler, ctx); +} /** * Attempts to scan APE or ID3 tags from the specified file. diff --git a/src/tag/Generic.hxx b/src/tag/Generic.hxx index 5bd9cc7cb..36473aa47 100644 --- a/src/tag/Generic.hxx +++ b/src/tag/Generic.hxx @@ -23,8 +23,15 @@ #include "check.h" struct TagHandler; +class InputStream; class Path; +/** + * Attempts to scan APE or ID3 tags from the specified file. + */ +bool +ScanGenericTags(InputStream &is, const TagHandler &handler, void *ctx); + /** * Attempts to scan APE or ID3 tags from the specified file. */