Commit 779d73f9 authored by Max Kellermann's avatar Max Kellermann

tag/TagId3: add overload with InputStream& parameter

parent 73307bf2
...@@ -344,6 +344,23 @@ tag_id3_import(struct id3_tag *tag) ...@@ -344,6 +344,23 @@ tag_id3_import(struct id3_tag *tag)
} }
bool 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, tag_id3_scan(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx)
{ {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "check.h" #include "check.h"
#include "Compiler.h" #include "Compiler.h"
class InputStream;
class Path; class Path;
struct TagHandler; struct TagHandler;
struct Tag; struct Tag;
...@@ -31,6 +32,10 @@ struct id3_tag; ...@@ -31,6 +32,10 @@ struct id3_tag;
#ifdef ENABLE_ID3TAG #ifdef ENABLE_ID3TAG
bool bool
tag_id3_scan(InputStream &is,
const TagHandler &handler, void *handler_ctx);
bool
tag_id3_scan(Path path_fs, tag_id3_scan(Path path_fs,
const TagHandler &handler, void *handler_ctx); const TagHandler &handler, void *handler_ctx);
...@@ -50,6 +55,14 @@ scan_id3_tag(id3_tag *tag, ...@@ -50,6 +55,14 @@ scan_id3_tag(id3_tag *tag,
#include "fs/Path.hxx" #include "fs/Path.hxx"
static inline bool 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, tag_id3_scan(gcc_unused Path path_fs,
gcc_unused const TagHandler &handler, gcc_unused const TagHandler &handler,
gcc_unused void *handler_ctx) gcc_unused void *handler_ctx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment