InputPlugin: allow init() to soft-fail

Add enum InputResult which is a tri-state.  Input plugins may now fail
and just become unavailable.
This commit is contained in:
Max Kellermann
2014-03-02 00:17:32 +01:00
parent 7453c26ec4
commit 2bf2f34b12
6 changed files with 65 additions and 16 deletions

View File

@@ -69,7 +69,7 @@ input_ffmpeg_supported(void)
return avio_enum_protocols(&opaque, 0) != nullptr;
}
static bool
static InputPlugin::InitResult
input_ffmpeg_init(gcc_unused const config_param &param,
Error &error)
{
@@ -78,10 +78,10 @@ input_ffmpeg_init(gcc_unused const config_param &param,
/* disable this plugin if there's no registered protocol */
if (!input_ffmpeg_supported()) {
error.Set(ffmpeg_domain, "No protocol");
return false;
return InputPlugin::InitResult::UNAVAILABLE;
}
return true;
return InputPlugin::InitResult::SUCCESS;
}
static InputStream *