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:
@@ -274,15 +274,9 @@ static const char *const audiofile_mime_types[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin audiofile_decoder_plugin = {
|
||||
"audiofile",
|
||||
audiofile_init,
|
||||
nullptr,
|
||||
audiofile_stream_decode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
audiofile_scan_stream,
|
||||
nullptr,
|
||||
audiofile_suffixes,
|
||||
audiofile_mime_types,
|
||||
};
|
||||
constexpr DecoderPlugin audiofile_decoder_plugin =
|
||||
DecoderPlugin("audiofile",
|
||||
audiofile_stream_decode, audiofile_scan_stream)
|
||||
.WithInit(audiofile_init)
|
||||
.WithSuffixes(audiofile_suffixes)
|
||||
.WithMimeTypes(audiofile_mime_types);
|
||||
|
||||
Reference in New Issue
Block a user