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.
This commit is contained in:
parent
3546d931a1
commit
4624dfcb30
@ -22,6 +22,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "decoder_list.h"
|
#include "decoder_list.h"
|
||||||
|
#include "decoder_plugin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "output_list.h"
|
#include "output_list.h"
|
||||||
#include "ls.h"
|
#include "ls.h"
|
||||||
@ -44,6 +45,25 @@ cmdline_quark(void)
|
|||||||
return g_quark_from_static_string("cmdline");
|
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
|
G_GNUC_NORETURN
|
||||||
static void version(void)
|
static void version(void)
|
||||||
{
|
{
|
||||||
@ -56,8 +76,7 @@ static void version(void)
|
|||||||
"\n"
|
"\n"
|
||||||
"Supported decoders:\n");
|
"Supported decoders:\n");
|
||||||
|
|
||||||
decoder_plugin_init_all();
|
print_all_decoders(stdout);
|
||||||
decoder_plugin_print_all_decoders(stdout);
|
|
||||||
|
|
||||||
puts("\n"
|
puts("\n"
|
||||||
"Supported outputs:\n");
|
"Supported outputs:\n");
|
||||||
|
@ -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 fluidsynth_decoder_plugin;
|
||||||
extern const struct decoder_plugin ffmpeg_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
|
#ifdef HAVE_MAD
|
||||||
&mad_decoder_plugin,
|
&mad_decoder_plugin,
|
||||||
#endif
|
#endif
|
||||||
@ -105,7 +105,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** which plugins have been initialized successfully? */
|
/** which plugins have been initialized successfully? */
|
||||||
static bool decoder_plugins_enabled[num_decoder_plugins];
|
bool decoder_plugins_enabled[num_decoder_plugins];
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
decoder_plugin_index(const struct decoder_plugin *plugin)
|
decoder_plugin_index(const struct decoder_plugin *plugin)
|
||||||
@ -179,27 +179,6 @@ decoder_plugin_from_name(const char *name)
|
|||||||
return NULL;
|
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.
|
* Find the "decoder" configuration block for the specified plugin.
|
||||||
*
|
*
|
||||||
|
@ -20,10 +20,13 @@
|
|||||||
#ifndef MPD_DECODER_LIST_H
|
#ifndef MPD_DECODER_LIST_H
|
||||||
#define MPD_DECODER_LIST_H
|
#define MPD_DECODER_LIST_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct decoder_plugin;
|
struct decoder_plugin;
|
||||||
|
|
||||||
|
extern const struct decoder_plugin *const decoder_plugins[];
|
||||||
|
extern bool decoder_plugins_enabled[];
|
||||||
|
|
||||||
/* interface for using plugins */
|
/* interface for using plugins */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,8 +46,6 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next);
|
|||||||
const struct decoder_plugin *
|
const struct decoder_plugin *
|
||||||
decoder_plugin_from_name(const char *name);
|
decoder_plugin_from_name(const char *name);
|
||||||
|
|
||||||
void decoder_plugin_print_all_decoders(FILE * fp);
|
|
||||||
|
|
||||||
/* this is where we "load" all the "plugins" ;-) */
|
/* this is where we "load" all the "plugins" ;-) */
|
||||||
void decoder_plugin_init_all(void);
|
void decoder_plugin_init_all(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user