cmdline: consistent plugin listings

This commit is contained in:
Max Kellermann 2012-06-12 22:29:04 +02:00
parent eda7410f4c
commit ae70875f45
9 changed files with 37 additions and 75 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
ver 0.16.9 (2012/??/??)
* decoder:
- ffmpeg: support WebM
* improve --version output
* WIN32: fix renaming of stored playlists with non-ASCII names

View File

@ -72,19 +72,6 @@ archive_plugin_from_name(const char *name)
return NULL;
}
void archive_plugin_print_all_suffixes(FILE * fp)
{
archive_plugins_for_each(plugin) {
const char *const*suffixes = plugin->suffixes;
while (suffixes && *suffixes) {
fprintf(fp, "%s ", *suffixes);
suffixes++;
}
}
fprintf(fp, "\n");
fflush(fp);
}
void archive_plugin_init_all(void)
{
for (unsigned i = 0; archive_plugins[i] != NULL; ++i) {

View File

@ -20,8 +20,6 @@
#ifndef MPD_ARCHIVE_LIST_H
#define MPD_ARCHIVE_LIST_H
#include <stdio.h>
struct archive_plugin;
extern const struct archive_plugin *const archive_plugins[];
@ -40,8 +38,6 @@ archive_plugin_from_suffix(const char *suffix);
const struct archive_plugin *
archive_plugin_from_name(const char *name);
void archive_plugin_print_all_suffixes(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */
void archive_plugin_init_all(void);

View File

@ -25,6 +25,7 @@
#include "decoder_list.h"
#include "decoder_plugin.h"
#include "output_list.h"
#include "output_plugin.h"
#include "input_registry.h"
#include "input_plugin.h"
#include "playlist_list.h"
@ -35,10 +36,12 @@
#ifdef ENABLE_ENCODER
#include "encoder_list.h"
#include "encoder_plugin.h"
#endif
#ifdef ENABLE_ARCHIVE
#include "archive_list.h"
#include "archive_plugin.h"
#endif
#include <glib.h>
@ -59,24 +62,6 @@ cmdline_quark(void)
return g_quark_from_static_string("cmdline");
}
static void
print_all_decoders(FILE *fp)
{
decoder_plugins_for_each(plugin) {
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)
{
@ -87,25 +72,46 @@ static void version(void)
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"\n"
"* Decoders plugins:\n");
"Decoders plugins:");
print_all_decoders(stdout);
decoder_plugins_for_each(plugin) {
printf(" [%s]", plugin->name);
const char *const*suffixes = plugin->suffixes;
if (suffixes != NULL)
for (; *suffixes != NULL; ++suffixes)
printf(" %s", *suffixes);
puts("");
}
puts("\n"
"Output plugins:\n");
audio_output_plugin_print_all_types(stdout);
"Output plugins:");
audio_output_plugins_for_each(plugin)
printf(" %s", plugin->name);
puts("");
#ifdef ENABLE_ENCODER
puts("\n"
"Encoder plugins:\n");
encoder_plugin_print_all_types(stdout);
"Encoder plugins:");
encoder_plugins_for_each(plugin)
printf(" %s", plugin->name);
puts("");
#endif
#ifdef ENABLE_ARCHIVE
puts("\n"
"Archive plugins:\n");
archive_plugin_print_all_suffixes(stdout);
"Archive plugins:");
archive_plugins_for_each(plugin) {
printf(" [%s]", plugin->name);
const char *const*suffixes = plugin->suffixes;
if (suffixes != NULL)
for (; *suffixes != NULL; ++suffixes)
printf(" %s", *suffixes);
puts("");
}
#endif
puts("\n"
@ -119,7 +125,7 @@ static void version(void)
printf(" %s", plugin->name);
puts("\n\n"
"Protocols:\n");
"Protocols:");
print_supported_uri_schemes_to_fp(stdout);
exit(EXIT_SUCCESS);

View File

@ -59,13 +59,3 @@ encoder_plugin_get(const char *name)
return NULL;
}
void
encoder_plugin_print_all_types(FILE * fp)
{
encoder_plugins_for_each(plugin)
fprintf(fp, "%s ", plugin->name);
fprintf(fp, "\n");
fflush(fp);
}

View File

@ -20,8 +20,6 @@
#ifndef MPD_ENCODER_LIST_H
#define MPD_ENCODER_LIST_H
#include <stdio.h>
struct encoder_plugin;
extern const struct encoder_plugin *const encoder_plugins[];
@ -42,7 +40,4 @@ extern const struct encoder_plugin *const encoder_plugins[];
const struct encoder_plugin *
encoder_plugin_get(const char *name);
void
encoder_plugin_print_all_types(FILE * fp);
#endif

View File

@ -57,10 +57,10 @@ void print_supported_uri_schemes_to_fp(FILE *fp)
const char **prefixes = remoteUrlPrefixes;
#ifdef HAVE_UN
fprintf(fp, "file:// ");
fprintf(fp, " file://");
#endif
while (*prefixes) {
fprintf(fp, "%s ", *prefixes);
fprintf(fp, " %s", *prefixes);
prefixes++;
}
fprintf(fp,"\n");

View File

@ -101,12 +101,3 @@ audio_output_plugin_get(const char *name)
return NULL;
}
void audio_output_plugin_print_all_types(FILE * fp)
{
audio_output_plugins_for_each(plugin)
fprintf(fp, "%s ", plugin->name);
fprintf(fp, "\n");
fflush(fp);
}

View File

@ -20,15 +20,11 @@
#ifndef MPD_OUTPUT_LIST_H
#define MPD_OUTPUT_LIST_H
#include <stdio.h>
extern const struct audio_output_plugin *const audio_output_plugins[];
const struct audio_output_plugin *
audio_output_plugin_get(const char *name);
void audio_output_plugin_print_all_types(FILE * fp);
#define audio_output_plugins_for_each(plugin) \
for (const struct audio_output_plugin *plugin, \
*const*output_plugin_iterator = &audio_output_plugins[0]; \