renamed functions in decoder_list.h

InputPlugin to decoder_plugin, and no camelCase.
This commit is contained in:
Max Kellermann 2008-08-26 08:27:09 +02:00
parent 772d3da98a
commit e754ed01a7
6 changed files with 40 additions and 36 deletions

View File

@ -243,7 +243,7 @@ static void decodeStart(void)
unsigned int next = 0; unsigned int next = 0;
/* first we try mime types: */ /* first we try mime types: */
while (ret && (plugin = getInputPluginFromMimeType(inStream.mime, next++))) { while (ret && (plugin = decoder_plugin_from_mime_type(inStream.mime, next++))) {
if (!plugin->stream_decode_func) if (!plugin->stream_decode_func)
continue; continue;
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL)) if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
@ -259,7 +259,7 @@ static void decodeStart(void)
if (plugin == NULL) { if (plugin == NULL) {
const char *s = getSuffix(path_max_utf8); const char *s = getSuffix(path_max_utf8);
next = 0; next = 0;
while (ret && (plugin = getInputPluginFromSuffix(s, next++))) { while (ret && (plugin = decoder_plugin_from_suffix(s, next++))) {
if (!plugin->stream_decode_func) if (!plugin->stream_decode_func)
continue; continue;
if (!(plugin->stream_types & if (!(plugin->stream_types &
@ -280,7 +280,7 @@ static void decodeStart(void)
if (plugin == NULL) { if (plugin == NULL) {
/* we already know our mp3Plugin supports streams, no /* we already know our mp3Plugin supports streams, no
* need to check for stream{Types,DecodeFunc} */ * need to check for stream{Types,DecodeFunc} */
if ((plugin = getInputPluginFromName("mp3"))) { if ((plugin = decoder_plugin_from_name("mp3"))) {
decoder.plugin = plugin; decoder.plugin = plugin;
ret = plugin->stream_decode_func(&decoder, ret = plugin->stream_decode_func(&decoder,
&inStream); &inStream);
@ -289,7 +289,7 @@ static void decodeStart(void)
} else { } else {
unsigned int next = 0; unsigned int next = 0;
const char *s = getSuffix(path_max_utf8); const char *s = getSuffix(path_max_utf8);
while (ret && (plugin = getInputPluginFromSuffix(s, next++))) { while (ret && (plugin = decoder_plugin_from_suffix(s, next++))) {
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE) if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
continue; continue;

View File

@ -32,7 +32,7 @@ extern struct decoder_plugin modPlugin;
static List *inputPlugin_list; static List *inputPlugin_list;
void loadInputPlugin(struct decoder_plugin * inputPlugin) void decoder_plugin_load(struct decoder_plugin * inputPlugin)
{ {
if (!inputPlugin) if (!inputPlugin)
return; return;
@ -45,7 +45,7 @@ void loadInputPlugin(struct decoder_plugin * inputPlugin)
insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin); insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
} }
void unloadInputPlugin(struct decoder_plugin * inputPlugin) void decoder_plugin_unload(struct decoder_plugin * inputPlugin)
{ {
if (inputPlugin->finish_func) if (inputPlugin->finish_func)
inputPlugin->finish_func(); inputPlugin->finish_func();
@ -63,7 +63,8 @@ static int stringFoundInStringArray(const char *const*array, const char *suffix)
return 0; return 0;
} }
struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned int next) struct decoder_plugin *decoder_plugin_from_suffix(const char *suffix,
unsigned int next)
{ {
static ListNode *pos; static ListNode *pos;
ListNode *node; ListNode *node;
@ -92,7 +93,8 @@ struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned int
return NULL; return NULL;
} }
struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next) struct decoder_plugin *decoder_plugin_from_mime_type(const char *mimeType,
unsigned int next)
{ {
static ListNode *pos; static ListNode *pos;
ListNode *node; ListNode *node;
@ -115,7 +117,7 @@ struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType, unsigned
return NULL; return NULL;
} }
struct decoder_plugin *getInputPluginFromName(const char *name) struct decoder_plugin *decoder_plugin_from_name(const char *name)
{ {
void *plugin = NULL; void *plugin = NULL;
@ -124,7 +126,7 @@ struct decoder_plugin *getInputPluginFromName(const char *name)
return (struct decoder_plugin *) plugin; return (struct decoder_plugin *) plugin;
} }
void printAllInputPluginSuffixes(FILE * fp) void decoder_plugin_print_all_suffixes(FILE * fp)
{ {
ListNode *node = inputPlugin_list->firstNode; ListNode *node = inputPlugin_list->firstNode;
struct decoder_plugin *plugin; struct decoder_plugin *plugin;
@ -143,24 +145,24 @@ void printAllInputPluginSuffixes(FILE * fp)
fflush(fp); fflush(fp);
} }
void initInputPlugins(void) void decoder_plugin_init_all(void)
{ {
inputPlugin_list = makeList(NULL, 1); inputPlugin_list = makeList(NULL, 1);
/* load plugins here */ /* load plugins here */
loadInputPlugin(&mp3Plugin); decoder_plugin_load(&mp3Plugin);
loadInputPlugin(&oggvorbisPlugin); decoder_plugin_load(&oggvorbisPlugin);
loadInputPlugin(&oggflacPlugin); decoder_plugin_load(&oggflacPlugin);
loadInputPlugin(&flacPlugin); decoder_plugin_load(&flacPlugin);
loadInputPlugin(&audiofilePlugin); decoder_plugin_load(&audiofilePlugin);
loadInputPlugin(&mp4Plugin); decoder_plugin_load(&mp4Plugin);
loadInputPlugin(&aacPlugin); decoder_plugin_load(&aacPlugin);
loadInputPlugin(&mpcPlugin); decoder_plugin_load(&mpcPlugin);
loadInputPlugin(&wavpackPlugin); decoder_plugin_load(&wavpackPlugin);
loadInputPlugin(&modPlugin); decoder_plugin_load(&modPlugin);
} }
void finishInputPlugins(void) void decoder_plugin_deinit_all(void)
{ {
freeList(inputPlugin_list); freeList(inputPlugin_list);
} }

View File

@ -24,23 +24,25 @@
struct decoder_plugin; struct decoder_plugin;
/* individual functions to load/unload plugins */ /* individual functions to load/unload plugins */
void loadInputPlugin(struct decoder_plugin * inputPlugin); void decoder_plugin_load(struct decoder_plugin * inputPlugin);
void unloadInputPlugin(struct decoder_plugin * inputPlugin); void decoder_plugin_unload(struct decoder_plugin * inputPlugin);
/* interface for using plugins */ /* interface for using plugins */
struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned int next); struct decoder_plugin *decoder_plugin_from_suffix(const char *suffix,
unsigned int next);
struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next); struct decoder_plugin *decoder_plugin_from_mime_type(const char *mimeType,
unsigned int next);
struct decoder_plugin *getInputPluginFromName(const char *name); struct decoder_plugin *decoder_plugin_from_name(const char *name);
void printAllInputPluginSuffixes(FILE * fp); void decoder_plugin_print_all_suffixes(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */ /* this is where we "load" all the "plugins" ;-) */
void initInputPlugins(void); void decoder_plugin_init_all(void);
/* this is where we "unload" all the "plugins" */ /* this is where we "unload" all the "plugins" */
void finishInputPlugins(void); void decoder_plugin_deinit_all(void);
#endif #endif

View File

@ -533,7 +533,7 @@ static int flac_plugin_init(void)
INPUT_PLUGIN_STREAM_FILE; INPUT_PLUGIN_STREAM_FILE;
oggflacPlugin.suffixes = oggflac_suffixes; oggflacPlugin.suffixes = oggflac_suffixes;
oggflacPlugin.mime_types = oggflac_mime_types; oggflacPlugin.mime_types = oggflac_mime_types;
loadInputPlugin(&oggflacPlugin); decoder_plugin_load(&oggflacPlugin);
return 1; return 1;
} }

View File

@ -263,7 +263,7 @@ struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next)
const char *s = getSuffix(utf8file); const char *s = getSuffix(utf8file);
if (s) { if (s) {
ret = getInputPluginFromSuffix(s, next); ret = decoder_plugin_from_suffix(s, next);
} else { } else {
DEBUG("hasMusicSuffix: The file: %s has no valid suffix\n", DEBUG("hasMusicSuffix: The file: %s has no valid suffix\n",
utf8file); utf8file);

View File

@ -128,8 +128,8 @@ static void version(void)
LOG("\n"); LOG("\n");
LOG("Supported formats:\n"); LOG("Supported formats:\n");
initInputPlugins(); decoder_plugin_init_all();
printAllInputPluginSuffixes(stdout); decoder_plugin_print_all_suffixes(stdout);
LOG("\n"); LOG("\n");
LOG("Supported outputs:\n"); LOG("Supported outputs:\n");
@ -407,7 +407,7 @@ int main(int argc, char *argv[])
initPaths(); initPaths();
initPermissions(); initPermissions();
initPlaylist(); initPlaylist();
initInputPlugins(); decoder_plugin_init_all();
openDB(&options, argv[0]); openDB(&options, argv[0]);
@ -461,7 +461,7 @@ int main(int argc, char *argv[])
finishPaths(); finishPaths();
finishPermissions(); finishPermissions();
finishCommands(); finishCommands();
finishInputPlugins(); decoder_plugin_deinit_all();
cleanUpPidFile(); cleanUpPidFile();
finishConf(); finishConf();