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:
@@ -568,15 +568,8 @@ static const char *const sidplay_suffixes[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin sidplay_decoder_plugin = {
|
||||
"sidplay",
|
||||
sidplay_init,
|
||||
sidplay_finish,
|
||||
nullptr, /* stream_decode() */
|
||||
sidplay_file_decode,
|
||||
sidplay_scan_file,
|
||||
nullptr, /* stream_tag() */
|
||||
sidplay_container_scan,
|
||||
sidplay_suffixes,
|
||||
nullptr, /* mime_types */
|
||||
};
|
||||
constexpr DecoderPlugin sidplay_decoder_plugin =
|
||||
DecoderPlugin("sidplay", sidplay_file_decode, sidplay_scan_file)
|
||||
.WithInit(sidplay_init, sidplay_finish)
|
||||
.WithContainer(sidplay_container_scan)
|
||||
.WithSuffixes(sidplay_suffixes);
|
||||
|
Reference in New Issue
Block a user