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:
@@ -384,15 +384,8 @@ static const char *const opus_mime_types[] = {
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
const struct DecoderPlugin opus_decoder_plugin = {
|
||||
"opus",
|
||||
mpd_opus_init,
|
||||
nullptr,
|
||||
mpd_opus_stream_decode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mpd_opus_scan_stream,
|
||||
nullptr,
|
||||
opus_suffixes,
|
||||
opus_mime_types,
|
||||
};
|
||||
constexpr DecoderPlugin opus_decoder_plugin =
|
||||
DecoderPlugin("opus", mpd_opus_stream_decode, mpd_opus_scan_stream)
|
||||
.WithInit(mpd_opus_init)
|
||||
.WithSuffixes(opus_suffixes)
|
||||
.WithMimeTypes(opus_mime_types);
|
||||
|
Reference in New Issue
Block a user