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:
@@ -199,15 +199,7 @@ static const char *const mod_suffixes[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin modplug_decoder_plugin = {
|
||||
"modplug",
|
||||
modplug_decoder_init,
|
||||
nullptr,
|
||||
mod_decode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
modplug_scan_stream,
|
||||
nullptr,
|
||||
mod_suffixes,
|
||||
nullptr,
|
||||
};
|
||||
constexpr DecoderPlugin modplug_decoder_plugin =
|
||||
DecoderPlugin("modplug", mod_decode, modplug_scan_stream)
|
||||
.WithInit(modplug_decoder_init)
|
||||
.WithSuffixes(mod_suffixes);
|
||||
|
||||
Reference in New Issue
Block a user