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:
@@ -488,15 +488,8 @@ static const char *const dsdiff_mime_types[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin dsdiff_decoder_plugin = {
|
||||
"dsdiff",
|
||||
dsdiff_init,
|
||||
nullptr,
|
||||
dsdiff_stream_decode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
dsdiff_scan_stream,
|
||||
nullptr,
|
||||
dsdiff_suffixes,
|
||||
dsdiff_mime_types,
|
||||
};
|
||||
constexpr DecoderPlugin dsdiff_decoder_plugin =
|
||||
DecoderPlugin("dsdiff", dsdiff_stream_decode, dsdiff_scan_stream)
|
||||
.WithInit(dsdiff_init)
|
||||
.WithSuffixes(dsdiff_suffixes)
|
||||
.WithMimeTypes(dsdiff_mime_types);
|
||||
|
||||
Reference in New Issue
Block a user