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:
@@ -434,15 +434,8 @@ static const char *const vorbis_mime_types[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin vorbis_decoder_plugin = {
|
||||
"vorbis",
|
||||
vorbis_init,
|
||||
nullptr,
|
||||
vorbis_stream_decode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
vorbis_scan_stream,
|
||||
nullptr,
|
||||
vorbis_suffixes,
|
||||
vorbis_mime_types
|
||||
};
|
||||
constexpr DecoderPlugin vorbis_decoder_plugin =
|
||||
DecoderPlugin("vorbis", vorbis_stream_decode, vorbis_scan_stream)
|
||||
.WithInit(vorbis_init)
|
||||
.WithSuffixes(vorbis_suffixes)
|
||||
.WithMimeTypes(vorbis_mime_types);
|
||||
|
Reference in New Issue
Block a user