aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_stream.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-02 20:45:50 +0100
committerMax Kellermann <max@duempel.org>2009-03-02 20:45:50 +0100
commit9a350acf0497acd19e05b77e6aa985552c13a94a (patch)
tree985bfbbc95a518a7b94351d2f1262be2daa08a62 /src/input_stream.c
parent36d24fb7eae3a7a761cb1659d10464f65ecdddf9 (diff)
downloadmpd-9a350acf0497acd19e05b77e6aa985552c13a94a.tar.gz
mpd-9a350acf0497acd19e05b77e6aa985552c13a94a.tar.xz
mpd-9a350acf0497acd19e05b77e6aa985552c13a94a.zip
input_plugin: added methods init(), finish()
Instead of hard-coding the plugin global initialization in input_stream_global_init(), make it walk the plugin list and initialize all plugins.
Diffstat (limited to '')
-rw-r--r--src/input_stream.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/input_stream.c b/src/input_stream.c
index 73c7acc2a..8896415bb 100644
--- a/src/input_stream.c
+++ b/src/input_stream.c
@@ -49,21 +49,24 @@ static const struct input_plugin *const input_plugins[] = {
#endif
};
+static bool input_plugins_enabled[G_N_ELEMENTS(input_plugins)];
+
static const unsigned num_input_plugins =
sizeof(input_plugins) / sizeof(input_plugins[0]);
void input_stream_global_init(void)
{
-#ifdef HAVE_CURL
- input_curl_global_init();
-#endif
+ for (unsigned i = 0; i < num_input_plugins; ++i)
+ if (input_plugins[i]->init == NULL || input_plugins[i]->init())
+ input_plugins_enabled[i] = true;
}
void input_stream_global_finish(void)
{
-#ifdef HAVE_CURL
- input_curl_global_finish();
-#endif
+ for (unsigned i = 0; i < num_input_plugins; ++i)
+ if (input_plugins_enabled[i] &&
+ input_plugins[i]->finish != NULL)
+ input_plugins[i]->finish();
}
bool