input/Plugin: migrate open() from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-09 15:37:06 +02:00
parent 63ab7767a3
commit fc7d3f64c0
44 changed files with 359 additions and 461 deletions

View File

@@ -26,7 +26,6 @@
#include "input/InputStream.hxx"
#include "fs/Path.hxx"
#include "AudioFormat.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
#include <stdexcept>
@@ -49,7 +48,6 @@ try {
const ScopeIOThread io_thread;
Error error;
input_stream_global_init();
decoder_plugin_init_all();
@@ -64,16 +62,7 @@ try {
plugin->FileDecode(decoder, Path::FromFS(uri));
} else if (plugin->stream_decode != nullptr) {
auto is = InputStream::OpenReady(uri, decoder.mutex,
decoder.cond, error);
if (!is) {
if (error.IsDefined())
LogError(error);
else
fprintf(stderr, "InputStream::Open() failed\n");
return EXIT_FAILURE;
}
decoder.cond);
plugin->StreamDecode(decoder, *is);
} else {
fprintf(stderr, "Decoder plugin is not usable\n");