tag/TagId3: add overload with InputStream& parameter

This commit is contained in:
Max Kellermann 2016-02-23 10:15:38 +01:00
parent 73307bf2e7
commit 779d73f94b
2 changed files with 30 additions and 0 deletions

View File

@ -343,6 +343,23 @@ tag_id3_import(struct id3_tag *tag)
: tag_builder.CommitNew();
}
bool
tag_id3_scan(InputStream &is,
const TagHandler &handler, void *handler_ctx)
{
UniqueId3Tag tag;
try {
tag = tag_id3_load(is);
} catch (const std::runtime_error &e) {
LogError(e);
return false;
}
scan_id3_tag(tag.get(), handler, handler_ctx);
return true;
}
bool
tag_id3_scan(Path path_fs,
const TagHandler &handler, void *handler_ctx)

View File

@ -23,6 +23,7 @@
#include "check.h"
#include "Compiler.h"
class InputStream;
class Path;
struct TagHandler;
struct Tag;
@ -30,6 +31,10 @@ struct id3_tag;
#ifdef ENABLE_ID3TAG
bool
tag_id3_scan(InputStream &is,
const TagHandler &handler, void *handler_ctx);
bool
tag_id3_scan(Path path_fs,
const TagHandler &handler, void *handler_ctx);
@ -49,6 +54,14 @@ scan_id3_tag(id3_tag *tag,
#include "fs/Path.hxx"
static inline bool
tag_id3_scan(gcc_unused InputStream &is,
gcc_unused const TagHandler &handler,
gcc_unused void *handler_ctx)
{
return false;
}
static inline bool
tag_id3_scan(gcc_unused Path path_fs,
gcc_unused const TagHandler &handler,