diff options
author | Max Kellermann <max@duempel.org> | 2009-11-07 15:46:45 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-07 15:46:45 +0100 |
commit | 4624dfcb3077f9f45d49c4ce7a4ee1c98f7f8921 (patch) | |
tree | bf301f44dc574ac0c66b42aa9b90e2b057f9e9bc | |
parent | 3546d931a1bc153ba1416ca837b4c00f1495d7e5 (diff) | |
download | mpd-4624dfcb3077f9f45d49c4ce7a4ee1c98f7f8921.tar.gz mpd-4624dfcb3077f9f45d49c4ce7a4ee1c98f7f8921.tar.xz mpd-4624dfcb3077f9f45d49c4ce7a4ee1c98f7f8921.zip |
decoder_list: moved print_all_decoders() to cmdline.c
Export the decoder_plugins array. The function
decoder_plugin_print_all_decoders() it is UI specific and should not
live in this backend library.
-rw-r--r-- | src/cmdline.c | 23 | ||||
-rw-r--r-- | src/decoder_list.c | 25 | ||||
-rw-r--r-- | src/decoder_list.h | 7 |
3 files changed, 27 insertions, 28 deletions
diff --git a/src/cmdline.c b/src/cmdline.c index 5dd6b26d6..695857d54 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -22,6 +22,7 @@ #include "log.h" #include "conf.h" #include "decoder_list.h" +#include "decoder_plugin.h" #include "config.h" #include "output_list.h" #include "ls.h" @@ -44,6 +45,25 @@ cmdline_quark(void) return g_quark_from_static_string("cmdline"); } +static void +print_all_decoders(FILE *fp) +{ + for (unsigned i = 0; decoder_plugins[i] != NULL; ++i) { + const struct decoder_plugin *plugin = decoder_plugins[i]; + const char *const*suffixes; + + fprintf(fp, "[%s]", plugin->name); + + for (suffixes = plugin->suffixes; + suffixes != NULL && *suffixes != NULL; + ++suffixes) { + fprintf(fp, " %s", *suffixes); + } + + fprintf(fp, "\n"); + } +} + G_GNUC_NORETURN static void version(void) { @@ -56,8 +76,7 @@ static void version(void) "\n" "Supported decoders:\n"); - decoder_plugin_init_all(); - decoder_plugin_print_all_decoders(stdout); + print_all_decoders(stdout); puts("\n" "Supported outputs:\n"); diff --git a/src/decoder_list.c b/src/decoder_list.c index 53c882161..7ac9b5b3a 100644 --- a/src/decoder_list.c +++ b/src/decoder_list.c @@ -45,7 +45,7 @@ extern const struct decoder_plugin wildmidi_decoder_plugin; extern const struct decoder_plugin fluidsynth_decoder_plugin; extern const struct decoder_plugin ffmpeg_decoder_plugin; -static const struct decoder_plugin *const decoder_plugins[] = { +const struct decoder_plugin *const decoder_plugins[] = { #ifdef HAVE_MAD &mad_decoder_plugin, #endif @@ -105,7 +105,7 @@ enum { }; /** which plugins have been initialized successfully? */ -static bool decoder_plugins_enabled[num_decoder_plugins]; +bool decoder_plugins_enabled[num_decoder_plugins]; static unsigned decoder_plugin_index(const struct decoder_plugin *plugin) @@ -179,27 +179,6 @@ decoder_plugin_from_name(const char *name) return NULL; } -void decoder_plugin_print_all_decoders(FILE * fp) -{ - for (unsigned i = 0; decoder_plugins[i] != NULL; ++i) { - const struct decoder_plugin *plugin = decoder_plugins[i]; - const char *const*suffixes; - - if (!decoder_plugins_enabled[i]) - continue; - - fprintf(fp, "[%s]", plugin->name); - - for (suffixes = plugin->suffixes; - suffixes != NULL && *suffixes != NULL; - ++suffixes) { - fprintf(fp, " %s", *suffixes); - } - - fprintf(fp, "\n"); - } -} - /** * Find the "decoder" configuration block for the specified plugin. * diff --git a/src/decoder_list.h b/src/decoder_list.h index 3b3cfd040..a5fe6b99f 100644 --- a/src/decoder_list.h +++ b/src/decoder_list.h @@ -20,10 +20,13 @@ #ifndef MPD_DECODER_LIST_H #define MPD_DECODER_LIST_H -#include <stdio.h> +#include <stdbool.h> struct decoder_plugin; +extern const struct decoder_plugin *const decoder_plugins[]; +extern bool decoder_plugins_enabled[]; + /* interface for using plugins */ /** @@ -43,8 +46,6 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); const struct decoder_plugin * decoder_plugin_from_name(const char *name); -void decoder_plugin_print_all_decoders(FILE * fp); - /* this is where we "load" all the "plugins" ;-) */ void decoder_plugin_init_all(void); |