TagFile: allow ScanFileTags*() to throw
This commit is contained in:
parent
6f1d5105ee
commit
92f7421715
@ -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;
|
||||
}
|
||||
is = OpenLocalInputStream(path_fs, mutex);
|
||||
} else {
|
||||
try {
|
||||
is->LockRewind();
|
||||
} catch (...) {
|
||||
}
|
||||
is->LockRewind();
|
||||
}
|
||||
|
||||
/* 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
|
||||
|
Loading…
Reference in New Issue
Block a user