diff options
author | Max Kellermann <max@duempel.org> | 2009-02-15 18:34:14 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-15 18:34:14 +0100 |
commit | dec5d48f80428575c7a1b9eeba961b0055156500 (patch) | |
tree | 2b13402d6e5bbf72a0ae658b546454a83538dc93 /src/decoder | |
parent | 900784bb4ebd6613223164e222f19abd3a312a93 (diff) | |
download | mpd-dec5d48f80428575c7a1b9eeba961b0055156500.tar.gz mpd-dec5d48f80428575c7a1b9eeba961b0055156500.tar.xz mpd-dec5d48f80428575c7a1b9eeba961b0055156500.zip |
decoder_plugin: pass struct config_param to init() method
Preparing for per-plugin configuration sections in mpd.conf.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 3 | ||||
-rw-r--r-- | src/decoder/flac_plugin.c | 2 | ||||
-rw-r--r-- | src/decoder/fluidsynth_plugin.c | 2 | ||||
-rw-r--r-- | src/decoder/mikmod_plugin.c | 3 | ||||
-rw-r--r-- | src/decoder/mp3_plugin.c | 3 | ||||
-rw-r--r-- | src/decoder/wildmidi_plugin.c | 2 | ||||
-rw-r--r-- | src/decoder_api.h | 1 | ||||
-rw-r--r-- | src/decoder_list.c | 2 | ||||
-rw-r--r-- | src/decoder_plugin.h | 10 |
9 files changed, 18 insertions, 10 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 8a379814f..8048b1c26 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -120,7 +120,8 @@ static URLProtocol mpd_ffmpeg_fileops = { .url_close = mpd_ffmpeg_close, }; -static bool ffmpeg_init(void) +static bool +ffmpeg_init(G_GNUC_UNUSED const struct config_param *param) { av_register_all(); register_protocol(&mpd_ffmpeg_fileops); diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 19f8d7fd4..ce056d298 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -383,7 +383,7 @@ flac_decode(struct decoder * decoder, struct input_stream *input_stream) #ifndef HAVE_OGGFLAC static bool -oggflac_init(void) +oggflac_init(G_GNUC_UNUSED const struct config_param *param) { #if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 return !!FLAC_API_SUPPORTS_OGG_FLAC; diff --git a/src/decoder/fluidsynth_plugin.c b/src/decoder/fluidsynth_plugin.c index 3a744d2f9..d9b0bd6b9 100644 --- a/src/decoder/fluidsynth_plugin.c +++ b/src/decoder/fluidsynth_plugin.c @@ -64,7 +64,7 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data) } static bool -fluidsynth_init(void) +fluidsynth_init(G_GNUC_UNUSED const struct config_param *param) { fluid_set_log_function(LAST_LOG_LEVEL, fluidsynth_mpd_log_function, NULL); diff --git a/src/decoder/mikmod_plugin.c b/src/decoder/mikmod_plugin.c index ad308dbe4..af715c0ca 100644 --- a/src/decoder/mikmod_plugin.c +++ b/src/decoder/mikmod_plugin.c @@ -90,7 +90,8 @@ static MDRIVER drv_mpd = { VC_VoiceRealVolume }; -static bool mod_initMikMod(void) +static bool +mod_initMikMod(G_GNUC_UNUSED const struct config_param *param) { static char params[] = ""; diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c index fda866133..9956435c9 100644 --- a/src/decoder/mp3_plugin.c +++ b/src/decoder/mp3_plugin.c @@ -91,7 +91,8 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth, } } -static bool mp3_plugin_init(void) +static bool +mp3_plugin_init(G_GNUC_UNUSED const struct config_param *param) { gapless_playback = config_get_bool(CONF_GAPLESS_MP3_PLAYBACK, DEFAULT_GAPLESS_MP3_PLAYBACK); diff --git a/src/decoder/wildmidi_plugin.c b/src/decoder/wildmidi_plugin.c index a045a6b1f..532ae9525 100644 --- a/src/decoder/wildmidi_plugin.c +++ b/src/decoder/wildmidi_plugin.c @@ -30,7 +30,7 @@ enum { }; static bool -wildmidi_init(void) +wildmidi_init(G_GNUC_UNUSED const struct config_param *param) { int ret; diff --git a/src/decoder_api.h b/src/decoder_api.h index caa61dcff..1005b549e 100644 --- a/src/decoder_api.h +++ b/src/decoder_api.h @@ -32,6 +32,7 @@ #include "replay_gain.h" #include "tag.h" #include "audio_format.h" +#include "conf.h" #include <stdbool.h> diff --git a/src/decoder_list.c b/src/decoder_list.c index ba179ee70..f0cf8625b 100644 --- a/src/decoder_list.c +++ b/src/decoder_list.c @@ -190,7 +190,7 @@ void decoder_plugin_init_all(void) for (unsigned i = 0; i < num_decoder_plugins; ++i) { const struct decoder_plugin *plugin = decoder_plugins[i]; - if (decoder_plugin_init(plugin)) + if (decoder_plugin_init(plugin, NULL)) decoder_plugins_enabled[i] = true; } } diff --git a/src/decoder_plugin.h b/src/decoder_plugin.h index 7034103ba..35a76bb38 100644 --- a/src/decoder_plugin.h +++ b/src/decoder_plugin.h @@ -22,6 +22,7 @@ #include <stdbool.h> #include <stddef.h> +struct config_param; struct input_stream; struct tag; @@ -39,7 +40,7 @@ struct decoder_plugin { * have/need one this must return < 0 if there is an error and * >= 0 otherwise */ - bool (*init)(void); + bool (*init)(const struct config_param *param); /** * optional, set this to NULL if the InputPlugin doesn't have/need one @@ -81,14 +82,17 @@ struct decoder_plugin { /** * Initialize a decoder plugin. * + * @param param a configuration block for this plugin, or NULL if none + * is configured * @return true if the plugin was initialized successfully, false if * the plugin is not available */ static inline bool -decoder_plugin_init(const struct decoder_plugin *plugin) +decoder_plugin_init(const struct decoder_plugin *plugin, + const struct config_param *param) { return plugin->init != NULL - ? plugin->init() + ? plugin->init(param) : true; } |