decoder/Plugin: allow scan_{file,stream}() to throw
Bug #915 is about an I/O exception thrown where none was allowed, leading to crash via std::terminate(). However, instead of catching and logging the error inside the decoder plugin, it should be able to propagate the I/O error to the MPD core, so MPD can avoid trying other decoder plugins. Closes https://github.com/MusicPlayerDaemon/MPD/issues/915
This commit is contained in:
@@ -47,11 +47,11 @@ public:
|
||||
handler(_handler),
|
||||
is(nullptr) {}
|
||||
|
||||
bool ScanFile(const DecoderPlugin &plugin) noexcept {
|
||||
bool ScanFile(const DecoderPlugin &plugin) {
|
||||
return plugin.ScanFile(path_fs, handler);
|
||||
}
|
||||
|
||||
bool ScanStream(const DecoderPlugin &plugin) noexcept {
|
||||
bool ScanStream(const DecoderPlugin &plugin) {
|
||||
if (plugin.scan_stream == nullptr)
|
||||
return false;
|
||||
|
||||
@@ -73,14 +73,14 @@ public:
|
||||
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 +100,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);
|
||||
|
||||
|
Reference in New Issue
Block a user