Commit 92f74217 authored by Max Kellermann's avatar Max Kellermann

TagFile: allow ScanFileTags*() to throw

parent 6f1d5105
......@@ -51,36 +51,29 @@ public:
return plugin.ScanFile(path_fs, handler);
}
bool ScanStream(const DecoderPlugin &plugin) noexcept {
bool ScanStream(const DecoderPlugin &plugin) {
if (plugin.scan_stream == nullptr)
return false;
/* open the InputStream (if not already open) */
if (is == nullptr) {
try {
is = OpenLocalInputStream(path_fs, mutex);
} catch (...) {
return false;
}
} else {
try {
is->LockRewind();
} catch (...) {
}
}
/* now try the stream_tag() method */
return plugin.ScanStream(*is, handler);
}
bool Scan(const DecoderPlugin &plugin) noexcept {
bool Scan(const DecoderPlugin &plugin) {
return plugin.SupportsSuffix(suffix) &&
(ScanFile(plugin) || ScanStream(plugin));
}
};
bool
ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler) noexcept
ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler)
{
assert(!path_fs.IsNull());
......@@ -100,7 +93,7 @@ ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler) noexcept
bool
ScanFileTagsWithGeneric(Path path, TagBuilder &builder,
AudioFormat *audio_format) noexcept
AudioFormat *audio_format)
{
FullTagHandler h(builder, audio_format);
......
......@@ -30,22 +30,26 @@ class TagBuilder;
* but does not fall back to generic scanners (APE and ID3) if no tags
* were found (but the file was recognized).
*
* Throws on error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
ScanFileTagsNoGeneric(Path path, TagHandler &handler) noexcept;
ScanFileTagsNoGeneric(Path path, TagHandler &handler);
/**
* Scan the tags of a song file. Invokes matching decoder plugins,
* and falls back to generic scanners (APE and ID3) if no tags were
* found (but the file was recognized).
*
* Throws on error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
ScanFileTagsWithGeneric(Path path, TagBuilder &builder,
AudioFormat *audio_format=nullptr) noexcept;
AudioFormat *audio_format=nullptr);
#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