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:
@@ -316,16 +316,7 @@ static const char *const mpg123_suffixes[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin mpg123_decoder_plugin = {
|
||||
"mpg123",
|
||||
mpd_mpg123_init,
|
||||
mpd_mpg123_finish,
|
||||
/* streaming not yet implemented */
|
||||
nullptr,
|
||||
mpd_mpg123_file_decode,
|
||||
mpd_mpg123_scan_file,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mpg123_suffixes,
|
||||
nullptr,
|
||||
};
|
||||
constexpr DecoderPlugin mpg123_decoder_plugin =
|
||||
DecoderPlugin("mpg123", mpd_mpg123_file_decode, mpd_mpg123_scan_file)
|
||||
.WithInit(mpd_mpg123_init, mpd_mpg123_finish)
|
||||
.WithSuffixes(mpg123_suffixes);
|
||||
|
Reference in New Issue
Block a user