Commit ae37e254 authored by Max Kellermann's avatar Max Kellermann

TagArchive: add overload with ArchiveFile&

parent c4537fe6
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "tag/Generic.hxx" #include "tag/Generic.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx" #include "tag/TagBuilder.hxx"
#include "archive/ArchiveFile.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
...@@ -57,3 +58,15 @@ tag_archive_scan(Path path, TagBuilder &builder) ...@@ -57,3 +58,15 @@ tag_archive_scan(Path path, TagBuilder &builder)
IgnoreError())); IgnoreError()));
return is && tag_stream_scan(*is, builder); return is && tag_stream_scan(*is, builder);
} }
bool
tag_archive_scan(ArchiveFile &archive, const char *path_utf8,
TagBuilder &builder)
{
Mutex mutex;
Cond cond;
InputStreamPtr is(archive.OpenStream(path_utf8, mutex, cond,
IgnoreError()));
return is && tag_stream_scan(*is, builder);
}
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "check.h" #include "check.h"
class ArchiveFile;
class Path; class Path;
struct TagHandler; struct TagHandler;
class TagBuilder; class TagBuilder;
...@@ -48,4 +49,16 @@ tag_archive_scan(Path path, const TagHandler &handler, void *handler_ctx); ...@@ -48,4 +49,16 @@ tag_archive_scan(Path path, const TagHandler &handler, void *handler_ctx);
bool bool
tag_archive_scan(Path path, TagBuilder &builder); tag_archive_scan(Path path, TagBuilder &builder);
/**
* Scan the tags of a song file inside an archive. Invokes matching
* decoder plugins, and falls back to generic scanners (APE and ID3)
* if no tags were found (but the file was recognized).
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
tag_archive_scan(ArchiveFile &archive, const char *path_utf8,
TagBuilder &builder);
#endif #endif
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