Since inputPlugin.c manages the list of registered decoders, we should
rename the source file.
---
src/Makefile.am | 4 -
src/decoder_list.c | 166 ++++++++++++++++++++++++++++++++++++++++
src/decoder_list.h | 46 +++++++++++
src/inputPlugin.c | 166 ----------------------------------------
src/inputPlugin.h | 46 -----------
src/inputPlugins/flac_plugin.c | 2
src/ls.h | 2
src/main.c | 2
src/song.c | 2
9 files changed, 218 insertions(+), 218 deletions(-)
create mode 100644 src/decoder_list.c
create mode 100644 src/decoder_list.h
delete mode 100644 src/inputPlugin.c
delete mode 100644 src/inputPlugin.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 5d5375f..216261a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,7 +44,7 @@ mpd_headers = \
decoder_internal.h \
directory.h \
gcc.h \
- inputPlugin.h \
+ decoder_list.h \
inputPlugins/_flac_common.h \
inputPlugins/_ogg_common.h \
inputStream.h \
@@ -106,7 +106,7 @@ mpd_SOURCES = \
decode.c \
decoder_api.c \
directory.c \
- inputPlugin.c \
+ decoder_list.c \
inputStream.c \
inputStream_file.c \
inputStream_http.c \
diff --git a/src/decoder_list.c b/src/decoder_list.c
new file mode 100644
index 0000000..5906fd3
--- /dev/null
+++ b/src/decoder_list.c
@@ -0,0 +1,166 @@
+/* the Music Player Daemon (MPD)
+ * Copyright (C) 2003-2007 by Warren Dukes ([EMAIL PROTECTED])
+ * This project's homepage is: http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "decoder_list.h"
+#include "decoder_api.h"
+
+extern struct decoder_plugin mp3Plugin;
+extern struct decoder_plugin oggvorbisPlugin;
+extern struct decoder_plugin flacPlugin;
+extern struct decoder_plugin oggflacPlugin;
+extern struct decoder_plugin audiofilePlugin;
+extern struct decoder_plugin mp4Plugin;
+extern struct decoder_plugin aacPlugin;
+extern struct decoder_plugin mpcPlugin;
+extern struct decoder_plugin wavpackPlugin;
+extern struct decoder_plugin modPlugin;
+
+static List *inputPlugin_list;
+
+void loadInputPlugin(struct decoder_plugin * inputPlugin)
+{
+ if (!inputPlugin)
+ return;
+ if (!inputPlugin->name)
+ return;
+
+ if (inputPlugin->initFunc && inputPlugin->initFunc() < 0)
+ return;
+
+ insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
+}
+
+void unloadInputPlugin(struct decoder_plugin * inputPlugin)
+{
+ if (inputPlugin->finishFunc)
+ inputPlugin->finishFunc();
+ deleteFromList(inputPlugin_list, inputPlugin->name);
+}
+
+static int stringFoundInStringArray(const char *const*array, const char
*suffix)
+{
+ while (array && *array) {
+ if (strcasecmp(*array, suffix) == 0)
+ return 1;
+ array++;
+ }
+
+ return 0;
+}
+
+struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned
int next)
+{
+ static ListNode *pos;
+ ListNode *node;
+ struct decoder_plugin *plugin;
+
+ if (suffix == NULL)
+ return NULL;
+
+ if (next) {
+ if (pos)
+ node = pos;
+ else
+ return NULL;
+ } else
+ node = inputPlugin_list->firstNode;
+
+ while (node != NULL) {
+ plugin = node->data;
+ if (stringFoundInStringArray(plugin->suffixes, suffix)) {
+ pos = node->nextNode;
+ return plugin;
+ }
+ node = node->nextNode;
+ }
+
+ return NULL;
+}
+
+struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType,
unsigned int next)
+{
+ static ListNode *pos;
+ ListNode *node;
+ struct decoder_plugin *plugin;
+
+ if (mimeType == NULL)
+ return NULL;
+
+ node = (next && pos) ? pos : inputPlugin_list->firstNode;
+
+ while (node != NULL) {
+ plugin = node->data;
+ if (stringFoundInStringArray(plugin->mimeTypes, mimeType)) {
+ pos = node->nextNode;
+ return plugin;
+ }
+ node = node->nextNode;
+ }
+
+ return NULL;
+}
+
+struct decoder_plugin *getInputPluginFromName(const char *name)
+{
+ void *plugin = NULL;
+
+ findInList(inputPlugin_list, name, &plugin);
+
+ return (struct decoder_plugin *) plugin;
+}
+
+void printAllInputPluginSuffixes(FILE * fp)
+{
+ ListNode *node = inputPlugin_list->firstNode;
+ struct decoder_plugin *plugin;
+ const char *const*suffixes;
+
+ while (node) {
+ plugin = (struct decoder_plugin *) node->data;
+ suffixes = plugin->suffixes;
+ while (suffixes && *suffixes) {
+ fprintf(fp, "%s ", *suffixes);
+ suffixes++;
+ }
+ node = node->nextNode;
+ }
+ fprintf(fp, "\n");
+ fflush(fp);
+}
+
+void initInputPlugins(void)
+{
+ inputPlugin_list = makeList(NULL, 1);
+
+ /* load plugins here */
+ loadInputPlugin(&mp3Plugin);
+ loadInputPlugin(&oggvorbisPlugin);
+ loadInputPlugin(&oggflacPlugin);
+ loadInputPlugin(&flacPlugin);
+ loadInputPlugin(&audiofilePlugin);
+ loadInputPlugin(&mp4Plugin);
+ loadInputPlugin(&aacPlugin);
+ loadInputPlugin(&mpcPlugin);
+ loadInputPlugin(&wavpackPlugin);
+ loadInputPlugin(&modPlugin);
+}
+
+void finishInputPlugins(void)
+{
+ freeList(inputPlugin_list);
+}
diff --git a/src/decoder_list.h b/src/decoder_list.h
new file mode 100644
index 0000000..4f3bf35
--- /dev/null
+++ b/src/decoder_list.h
@@ -0,0 +1,46 @@
+/* the Music Player Daemon (MPD)
+ * Copyright (C) 2003-2007 by Warren Dukes ([EMAIL PROTECTED])
+ * This project's homepage is: http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef INPUT_PLUGIN_H
+#define INPUT_PLUGIN_H
+
+#include "os_compat.h"
+
+struct decoder_plugin;
+
+/* individual functions to load/unload plugins */
+void loadInputPlugin(struct decoder_plugin * inputPlugin);
+void unloadInputPlugin(struct decoder_plugin * inputPlugin);
+
+/* interface for using plugins */
+
+struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned
int next);
+
+struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType,
unsigned int next);
+
+struct decoder_plugin *getInputPluginFromName(const char *name);
+
+void printAllInputPluginSuffixes(FILE * fp);
+
+/* this is where we "load" all the "plugins" ;-) */
+void initInputPlugins(void);
+
+/* this is where we "unload" all the "plugins" */
+void finishInputPlugins(void);
+
+#endif
diff --git a/src/inputPlugin.c b/src/inputPlugin.c
deleted file mode 100644
index 4df445a..0000000
--- a/src/inputPlugin.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* the Music Player Daemon (MPD)
- * Copyright (C) 2003-2007 by Warren Dukes ([EMAIL PROTECTED])
- * This project's homepage is: http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "inputPlugin.h"
-#include "decoder_api.h"
-
-extern struct decoder_plugin mp3Plugin;
-extern struct decoder_plugin oggvorbisPlugin;
-extern struct decoder_plugin flacPlugin;
-extern struct decoder_plugin oggflacPlugin;
-extern struct decoder_plugin audiofilePlugin;
-extern struct decoder_plugin mp4Plugin;
-extern struct decoder_plugin aacPlugin;
-extern struct decoder_plugin mpcPlugin;
-extern struct decoder_plugin wavpackPlugin;
-extern struct decoder_plugin modPlugin;
-
-static List *inputPlugin_list;
-
-void loadInputPlugin(struct decoder_plugin * inputPlugin)
-{
- if (!inputPlugin)
- return;
- if (!inputPlugin->name)
- return;
-
- if (inputPlugin->initFunc && inputPlugin->initFunc() < 0)
- return;
-
- insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
-}
-
-void unloadInputPlugin(struct decoder_plugin * inputPlugin)
-{
- if (inputPlugin->finishFunc)
- inputPlugin->finishFunc();
- deleteFromList(inputPlugin_list, inputPlugin->name);
-}
-
-static int stringFoundInStringArray(const char *const*array, const char
*suffix)
-{
- while (array && *array) {
- if (strcasecmp(*array, suffix) == 0)
- return 1;
- array++;
- }
-
- return 0;
-}
-
-struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned
int next)
-{
- static ListNode *pos;
- ListNode *node;
- struct decoder_plugin *plugin;
-
- if (suffix == NULL)
- return NULL;
-
- if (next) {
- if (pos)
- node = pos;
- else
- return NULL;
- } else
- node = inputPlugin_list->firstNode;
-
- while (node != NULL) {
- plugin = node->data;
- if (stringFoundInStringArray(plugin->suffixes, suffix)) {
- pos = node->nextNode;
- return plugin;
- }
- node = node->nextNode;
- }
-
- return NULL;
-}
-
-struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType,
unsigned int next)
-{
- static ListNode *pos;
- ListNode *node;
- struct decoder_plugin *plugin;
-
- if (mimeType == NULL)
- return NULL;
-
- node = (next && pos) ? pos : inputPlugin_list->firstNode;
-
- while (node != NULL) {
- plugin = node->data;
- if (stringFoundInStringArray(plugin->mimeTypes, mimeType)) {
- pos = node->nextNode;
- return plugin;
- }
- node = node->nextNode;
- }
-
- return NULL;
-}
-
-struct decoder_plugin *getInputPluginFromName(const char *name)
-{
- void *plugin = NULL;
-
- findInList(inputPlugin_list, name, &plugin);
-
- return (struct decoder_plugin *) plugin;
-}
-
-void printAllInputPluginSuffixes(FILE * fp)
-{
- ListNode *node = inputPlugin_list->firstNode;
- struct decoder_plugin *plugin;
- const char *const*suffixes;
-
- while (node) {
- plugin = (struct decoder_plugin *) node->data;
- suffixes = plugin->suffixes;
- while (suffixes && *suffixes) {
- fprintf(fp, "%s ", *suffixes);
- suffixes++;
- }
- node = node->nextNode;
- }
- fprintf(fp, "\n");
- fflush(fp);
-}
-
-void initInputPlugins(void)
-{
- inputPlugin_list = makeList(NULL, 1);
-
- /* load plugins here */
- loadInputPlugin(&mp3Plugin);
- loadInputPlugin(&oggvorbisPlugin);
- loadInputPlugin(&oggflacPlugin);
- loadInputPlugin(&flacPlugin);
- loadInputPlugin(&audiofilePlugin);
- loadInputPlugin(&mp4Plugin);
- loadInputPlugin(&aacPlugin);
- loadInputPlugin(&mpcPlugin);
- loadInputPlugin(&wavpackPlugin);
- loadInputPlugin(&modPlugin);
-}
-
-void finishInputPlugins(void)
-{
- freeList(inputPlugin_list);
-}
diff --git a/src/inputPlugin.h b/src/inputPlugin.h
deleted file mode 100644
index 4f3bf35..0000000
--- a/src/inputPlugin.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* the Music Player Daemon (MPD)
- * Copyright (C) 2003-2007 by Warren Dukes ([EMAIL PROTECTED])
- * This project's homepage is: http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef INPUT_PLUGIN_H
-#define INPUT_PLUGIN_H
-
-#include "os_compat.h"
-
-struct decoder_plugin;
-
-/* individual functions to load/unload plugins */
-void loadInputPlugin(struct decoder_plugin * inputPlugin);
-void unloadInputPlugin(struct decoder_plugin * inputPlugin);
-
-/* interface for using plugins */
-
-struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned
int next);
-
-struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType,
unsigned int next);
-
-struct decoder_plugin *getInputPluginFromName(const char *name);
-
-void printAllInputPluginSuffixes(FILE * fp);
-
-/* this is where we "load" all the "plugins" ;-) */
-void initInputPlugins(void);
-
-/* this is where we "unload" all the "plugins" */
-void finishInputPlugins(void);
-
-#endif
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 2af9d17..68caaf5 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -22,7 +22,7 @@
#include "../utils.h"
#include "../log.h"
-#include "../inputPlugin.h"
+#include "../decoder_list.h"
/* this code was based on flac123, from flac-tools */
diff --git a/src/ls.h b/src/ls.h
index cbf37bd..bb8b113 100644
--- a/src/ls.h
+++ b/src/ls.h
@@ -19,7 +19,7 @@
#ifndef LS_H
#define LS_H
-#include "inputPlugin.h"
+#include "decoder_list.h"
int lsPlaylists(int fd, const char *utf8path);
diff --git a/src/main.c b/src/main.c
index 4b98916..baa0ba3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,7 +32,7 @@
#include "log.h"
#include "permission.h"
#include "replayGain.h"
-#include "inputPlugin.h"
+#include "decoder_list.h"
#include "audioOutput.h"
#include "inputStream.h"
#include "state_file.h"
diff --git a/src/song.c b/src/song.c
index 920bf23..42d9d8c 100644
--- a/src/song.c
+++ b/src/song.c
@@ -24,7 +24,7 @@
#include "log.h"
#include "path.h"
#include "playlist.h"
-#include "inputPlugin.h"
+#include "decoder_list.h"
#include "decoder_api.h"
#include "myfprintf.h"
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team