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

@@ -430,15 +430,7 @@ static const char *const faad_mime_types[] = {
"audio/aac", "audio/aacp", nullptr
};
const DecoderPlugin faad_decoder_plugin = {
"faad",
nullptr,
nullptr,
faad_stream_decode,
nullptr,
nullptr,
faad_scan_stream,
nullptr,
faad_suffixes,
faad_mime_types,
};
constexpr DecoderPlugin faad_decoder_plugin =
DecoderPlugin("faad", faad_stream_decode, faad_scan_stream)
.WithSuffixes(faad_suffixes)
.WithMimeTypes(faad_mime_types);