aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-31 20:59:55 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-31 20:59:55 +0000
commitd9f5cca9b83831c89c8fe93c47100f86e1649fd7 (patch)
treef563b57b92b1bb17e9322615bef6b3623650f537 /src
parent2c1f5365ebbd7ffd9ffa660a39ebc052ef96e4d2 (diff)
downloadmpd-d9f5cca9b83831c89c8fe93c47100f86e1649fd7.tar.gz
mpd-d9f5cca9b83831c89c8fe93c47100f86e1649fd7.tar.xz
mpd-d9f5cca9b83831c89c8fe93c47100f86e1649fd7.zip
mod_plugin, just for tarzeau
git-svn-id: https://svn.musicpd.org/mpd/trunk@1263 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/inputPlugin.c6
-rw-r--r--src/inputPlugin.h6
-rw-r--r--src/inputPlugins/aac_plugin.c4
-rw-r--r--src/inputPlugins/flac_plugin.c4
-rw-r--r--src/inputPlugins/mp3_plugin.c4
-rw-r--r--src/inputPlugins/mp4_plugin.c4
-rw-r--r--src/inputPlugins/ogg_plugin.c4
8 files changed, 33 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ad1544e35..de55f202a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,8 @@ SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR) $(MP4FF_SUBDIR)
mpd_inputPlugins = inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c \
inputPlugins/flac_plugin.c inputPlugins/audiofile_plugin.c \
- inputPlugins/mp4_plugin.c inputPlugins/aac_plugin.c
+ inputPlugins/mp4_plugin.c inputPlugins/aac_plugin.c \
+ inputPlugins/mod_plugin.c
mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h \
diff --git a/src/inputPlugin.c b/src/inputPlugin.c
index bd317964f..72286d3f6 100644
--- a/src/inputPlugin.c
+++ b/src/inputPlugin.c
@@ -11,10 +11,13 @@ void loadInputPlugin(InputPlugin * inputPlugin) {
if(!inputPlugin) return;
if(!inputPlugin->name) return;
+ if(inputPlugin->initFunc && inputPlugin->initFunc() < 0) return;
+
insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
}
void unloadInputPlugin(InputPlugin * inputPlugin) {
+ if(inputPlugin->finishFunc) inputPlugin->finishFunc();
deleteFromList(inputPlugin_list, inputPlugin->name);
}
@@ -73,6 +76,7 @@ extern InputPlugin flacPlugin;
extern InputPlugin audiofilePlugin;
extern InputPlugin mp4Plugin;
extern InputPlugin aacPlugin;
+extern InputPlugin modPlugin;
void initInputPlugins() {
inputPlugin_list = makeList(NULL);
@@ -83,7 +87,7 @@ void initInputPlugins() {
loadInputPlugin(&flacPlugin);
loadInputPlugin(&audiofilePlugin);
loadInputPlugin(&mp4Plugin);
- loadInputPlugin(&aacPlugin);
+ loadInputPlugin(&modPlugin);
}
void finishInputPlugins() {
diff --git a/src/inputPlugin.h b/src/inputPlugin.h
index 9d77262c6..940789744 100644
--- a/src/inputPlugin.h
+++ b/src/inputPlugin.h
@@ -10,6 +10,10 @@
#define INPUT_PLUGIN_STREAM_FILE 0x01
#define INPUT_PLUGIN_STREAM_URL 0x02
+typedef int (* InputPlugin_initFunc) ();
+
+typedef void (* InputPlugin_finishFunc) ();
+
typedef int (* InputPlugin_streamDecodeFunc) (OutputBuffer *, DecoderControl *,
InputStream *);
@@ -21,6 +25,8 @@ typedef MpdTag * (* InputPlugin_tagDupFunc) (char * file);
typedef struct _InputPlugin {
char * name;
+ InputPlugin_initFunc initFunc;
+ InputPlugin_finishFunc finishFunc;
InputPlugin_streamDecodeFunc streamDecodeFunc;
InputPlugin_fileDecodeFunc fileDecodeFunc;
InputPlugin_tagDupFunc tagDupFunc;
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index 017aa7779..9f78fc2a1 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -415,6 +415,8 @@ InputPlugin aacPlugin =
{
"aac",
NULL,
+ NULL,
+ NULL,
aac_decode,
aacTagDup,
INPUT_PLUGIN_STREAM_FILE,
@@ -430,6 +432,8 @@ InputPlugin aacPlugin =
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
0,
NULL,
NULL,
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 67dc160ec..dc92b801b 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -555,6 +555,8 @@ InputPlugin flacPlugin =
{
"flac",
NULL,
+ NULL,
+ NULL,
flac_decode,
flacTagDup,
INPUT_PLUGIN_STREAM_FILE,
@@ -570,6 +572,8 @@ InputPlugin flacPlugin =
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
0,
NULL,
NULL,
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index de23b6c7b..8f57fb590 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -634,6 +634,8 @@ char * mp3_mimeTypes[] = {"audio/mpeg", NULL};
InputPlugin mp3Plugin =
{
"mp3",
+ NULL,
+ NULL,
mp3_decode,
NULL,
mp3_tagDup,
@@ -649,6 +651,8 @@ InputPlugin mp3Plugin =
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
0,
NULL,
NULL
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c
index f17b0b4ce..a8e0ec872 100644
--- a/src/inputPlugins/mp4_plugin.c
+++ b/src/inputPlugins/mp4_plugin.c
@@ -403,6 +403,8 @@ InputPlugin mp4Plugin =
{
"mp4",
NULL,
+ NULL,
+ NULL,
mp4_decode,
mp4TagDup,
INPUT_PLUGIN_STREAM_FILE,
@@ -417,6 +419,8 @@ InputPlugin mp4Plugin =
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
NULL,
0,
NULL,
diff --git a/src/inputPlugins/ogg_plugin.c b/src/inputPlugins/ogg_plugin.c
index 21b63b9dc..68f50a4c1 100644
--- a/src/inputPlugins/ogg_plugin.c
+++ b/src/inputPlugins/ogg_plugin.c
@@ -335,6 +335,8 @@ char * oggMimeTypes[] = {"application/ogg", NULL};
InputPlugin oggPlugin =
{
"ogg",
+ NULL,
+ NULL,
ogg_decode,
NULL,
oggTagDup,
@@ -348,6 +350,8 @@ InputPlugin oggPlugin =
InputPlugin oggPlugin =
{
NULL,
+ NULL,
+ NULL,
NULL,
NULL,
NULL,