input/Plugin: remove InitResult::UNAVAILABLE, throw PluginUnavailable instead

This commit is contained in:
Max Kellermann
2016-09-09 15:11:52 +02:00
parent e7d327226a
commit a73688a2be
7 changed files with 57 additions and 34 deletions

View File

@@ -27,6 +27,7 @@
#include "lib/ffmpeg/Error.hxx"
#include "../InputStream.hxx"
#include "../InputPlugin.hxx"
#include "PluginUnavailable.hxx"
#include "util/StringCompare.hxx"
#include "util/Error.hxx"
@@ -73,15 +74,13 @@ input_ffmpeg_supported(void)
static InputPlugin::InitResult
input_ffmpeg_init(gcc_unused const ConfigBlock &block,
Error &error)
gcc_unused Error &error)
{
FfmpegInit();
/* disable this plugin if there's no registered protocol */
if (!input_ffmpeg_supported()) {
error.Set(ffmpeg_domain, "No protocol");
return InputPlugin::InitResult::UNAVAILABLE;
}
if (!input_ffmpeg_supported())
throw PluginUnavailable("No protocol");
return InputPlugin::InitResult::SUCCESS;
}