decoder/Plugin: simplify compile-time initialization

Add a `constexpr` constructor and several `constexpr` methods to
construct a DecoderPlugin at compile time, in a way which allows
adding new methods later without having to edit each plugin.
This commit is contained in:
Max Kellermann
2019-06-15 14:44:37 +02:00
parent aebb1baad8
commit 527642a90b
23 changed files with 171 additions and 286 deletions

View File

@@ -266,17 +266,9 @@ static const char *const hybrid_dsd_suffixes[] = {
nullptr
};
const struct DecoderPlugin hybrid_dsd_decoder_plugin = {
"hybrid_dsd",
InitHybridDsdDecoder,
nullptr,
HybridDsdDecode,
nullptr,
nullptr,
constexpr DecoderPlugin hybrid_dsd_decoder_plugin =
/* no scan method here; the FFmpeg plugin will do that for us,
and we only do the decoding */
nullptr,
nullptr,
hybrid_dsd_suffixes,
nullptr,
};
DecoderPlugin("hybrid_dsd", HybridDsdDecode, nullptr)
.WithInit(InitHybridDsdDecoder)
.WithSuffixes(hybrid_dsd_suffixes);