diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:08 +0200 |
commit | e41be362a1dc5691721d72b7f915e32d7f5272bb (patch) | |
tree | 296478ef28a6c2a9dbf54e39328b754223459cf2 | |
parent | cdaa26c81d692fefe5c9c2a4a01dcff633c99564 (diff) | |
download | mpd-e41be362a1dc5691721d72b7f915e32d7f5272bb.tar.gz mpd-e41be362a1dc5691721d72b7f915e32d7f5272bb.tar.xz mpd-e41be362a1dc5691721d72b7f915e32d7f5272bb.zip |
renamed InputPlugin to struct decoder_plugin
"decoder plugin" is a better name than "input plugin", since the
plugin does not actually do the input - InputStream does. Also don't
use typedef, so we can forward-declare it if required.
Diffstat (limited to '')
-rw-r--r-- | src/decode.c | 2 | ||||
-rw-r--r-- | src/decoder_api.h | 4 | ||||
-rw-r--r-- | src/decoder_internal.h | 2 | ||||
-rw-r--r-- | src/inputPlugin.c | 21 | ||||
-rw-r--r-- | src/inputPlugin.h | 34 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 4 | ||||
-rw-r--r-- | src/ls.c | 9 | ||||
-rw-r--r-- | src/ls.h | 5 | ||||
-rw-r--r-- | src/song.c | 5 |
18 files changed, 65 insertions, 59 deletions
diff --git a/src/decode.c b/src/decode.c index 7b9df996d..176eb6fb9 100644 --- a/src/decode.c +++ b/src/decode.c @@ -209,7 +209,7 @@ static void decodeStart(void) int ret; int close_instream = 1; InputStream inStream; - InputPlugin *plugin = NULL; + struct decoder_plugin *plugin = NULL; char path_max_fs[MPD_PATH_MAX]; char path_max_utf8[MPD_PATH_MAX]; diff --git a/src/decoder_api.h b/src/decoder_api.h index bb8517227..c82e01f7e 100644 --- a/src/decoder_api.h +++ b/src/decoder_api.h @@ -70,7 +70,7 @@ typedef int (*InputPlugin_fileDecodeFunc) (struct decoder *, * or read */ typedef MpdTag *(*InputPlugin_tagDupFunc) (char *file); -typedef struct _InputPlugin { +struct decoder_plugin { const char *name; InputPlugin_initFunc initFunc; InputPlugin_finishFunc finishFunc; @@ -85,7 +85,7 @@ typedef struct _InputPlugin { /* last element in these arrays must always be a NULL: */ const char *const*suffixes; const char *const*mimeTypes; -} InputPlugin; +}; /** diff --git a/src/decoder_internal.h b/src/decoder_internal.h index 2115990a8..37b7b65fa 100644 --- a/src/decoder_internal.h +++ b/src/decoder_internal.h @@ -23,7 +23,7 @@ #include "pcm_utils.h" struct decoder { - InputPlugin *plugin; + struct decoder_plugin *plugin; ConvState conv_state; }; diff --git a/src/inputPlugin.c b/src/inputPlugin.c index 1ab118ceb..5bf2bdaa7 100644 --- a/src/inputPlugin.c +++ b/src/inputPlugin.c @@ -17,10 +17,11 @@ */ #include "inputPlugin.h" +#include "decoder_api.h" static List *inputPlugin_list; -void loadInputPlugin(InputPlugin * inputPlugin) +void loadInputPlugin(struct decoder_plugin * inputPlugin) { if (!inputPlugin) return; @@ -33,7 +34,7 @@ void loadInputPlugin(InputPlugin * inputPlugin) insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin); } -void unloadInputPlugin(InputPlugin * inputPlugin) +void unloadInputPlugin(struct decoder_plugin * inputPlugin) { if (inputPlugin->finishFunc) inputPlugin->finishFunc(); @@ -51,11 +52,11 @@ static int stringFoundInStringArray(const char *const*array, const char *suffix) return 0; } -InputPlugin *getInputPluginFromSuffix(const char *suffix, unsigned int next) +struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned int next) { static ListNode *pos; ListNode *node; - InputPlugin *plugin; + struct decoder_plugin *plugin; if (suffix == NULL) return NULL; @@ -80,11 +81,11 @@ InputPlugin *getInputPluginFromSuffix(const char *suffix, unsigned int next) return NULL; } -InputPlugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next) +struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next) { static ListNode *pos; ListNode *node; - InputPlugin *plugin; + struct decoder_plugin *plugin; if (mimeType == NULL) return NULL; @@ -103,23 +104,23 @@ InputPlugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next) return NULL; } -InputPlugin *getInputPluginFromName(const char *name) +struct decoder_plugin *getInputPluginFromName(const char *name) { void *plugin = NULL; findInList(inputPlugin_list, name, &plugin); - return (InputPlugin *) plugin; + return (struct decoder_plugin *) plugin; } void printAllInputPluginSuffixes(FILE * fp) { ListNode *node = inputPlugin_list->firstNode; - InputPlugin *plugin; + struct decoder_plugin *plugin; const char *const*suffixes; while (node) { - plugin = (InputPlugin *) node->data; + plugin = (struct decoder_plugin *) node->data; suffixes = plugin->suffixes; while (suffixes && *suffixes) { fprintf(fp, "%s ", *suffixes); diff --git a/src/inputPlugin.h b/src/inputPlugin.h index f5418efdd..319c665c7 100644 --- a/src/inputPlugin.h +++ b/src/inputPlugin.h @@ -19,19 +19,21 @@ #ifndef INPUT_PLUGIN_H #define INPUT_PLUGIN_H -#include "decoder_api.h" +#include "os_compat.h" + +struct decoder_plugin; /* individual functions to load/unload plugins */ -void loadInputPlugin(InputPlugin * inputPlugin); -void unloadInputPlugin(InputPlugin * inputPlugin); +void loadInputPlugin(struct decoder_plugin * inputPlugin); +void unloadInputPlugin(struct decoder_plugin * inputPlugin); /* interface for using plugins */ -InputPlugin *getInputPluginFromSuffix(const char *suffix, unsigned int next); +struct decoder_plugin *getInputPluginFromSuffix(const char *suffix, unsigned int next); -InputPlugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next); +struct decoder_plugin *getInputPluginFromMimeType(const char *mimeType, unsigned int next); -InputPlugin *getInputPluginFromName(const char *name); +struct decoder_plugin *getInputPluginFromName(const char *name); void printAllInputPluginSuffixes(FILE * fp); @@ -41,15 +43,15 @@ void initInputPlugins(void); /* this is where we "unload" all the "plugins" */ void finishInputPlugins(void); -extern InputPlugin mp3Plugin; -extern InputPlugin oggvorbisPlugin; -extern InputPlugin flacPlugin; -extern InputPlugin oggflacPlugin; -extern InputPlugin audiofilePlugin; -extern InputPlugin mp4Plugin; -extern InputPlugin aacPlugin; -extern InputPlugin mpcPlugin; -extern InputPlugin wavpackPlugin; -extern InputPlugin modPlugin; +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; #endif diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 168e0de92..f352d0b88 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -433,7 +433,7 @@ static MpdTag *aacTagDup(char *file) static const char *aac_suffixes[] = { "aac", NULL }; static const char *aac_mimeTypes[] = { "audio/aac", "audio/aacp", NULL }; -InputPlugin aacPlugin = { +struct decoder_plugin aacPlugin = { "aac", NULL, NULL, @@ -448,6 +448,6 @@ InputPlugin aacPlugin = { #else -InputPlugin aacPlugin; +struct decoder_plugin aacPlugin; #endif /* HAVE_FAAD */ diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index f3c945455..2fbe580fa 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -137,7 +137,7 @@ static MpdTag *audiofileTagDup(char *file) static const char *audiofileSuffixes[] = { "wav", "au", "aiff", "aif", NULL }; -InputPlugin audiofilePlugin = { +struct decoder_plugin audiofilePlugin = { "audiofile", NULL, NULL, @@ -152,6 +152,6 @@ InputPlugin audiofilePlugin = { #else -InputPlugin audiofilePlugin; +struct decoder_plugin audiofilePlugin; #endif /* HAVE_AUDIOFILE */ diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index b76327dc1..2af9d17bc 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -469,7 +469,7 @@ static int flac_decode(struct decoder * decoder, InputStream * inStream) # define flac_plugin_init NULL #else /* FLAC_API_VERSION_CURRENT >= 7 */ /* some of this stuff is duplicated from oggflac_plugin.c */ -extern InputPlugin oggflacPlugin; +extern struct decoder_plugin oggflacPlugin; static MpdTag *oggflac_tag_dup(char *file) { @@ -544,7 +544,7 @@ static const char *flac_mime_types[] = { "audio/x-flac", "application/x-flac", NULL }; -InputPlugin flacPlugin = { +struct decoder_plugin flacPlugin = { "flac", flac_plugin_init, NULL, @@ -559,6 +559,6 @@ InputPlugin flacPlugin = { #else /* !HAVE_FLAC */ -InputPlugin flacPlugin; +struct decoder_plugin flacPlugin; #endif /* HAVE_FLAC */ diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 384381ea0..5e700016f 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -262,7 +262,7 @@ static const char *modSuffixes[] = { "amf", NULL }; -InputPlugin modPlugin = { +struct decoder_plugin modPlugin = { "mod", NULL, mod_finishMikMod, @@ -277,6 +277,6 @@ InputPlugin modPlugin = { #else -InputPlugin modPlugin; +struct decoder_plugin modPlugin; #endif /* HAVE_MIKMOD */ diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 3e7e0ea3f..2fbc61878 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -1110,7 +1110,7 @@ static MpdTag *mp3_tagDup(char *file) static const char *mp3_suffixes[] = { "mp3", "mp2", NULL }; static const char *mp3_mimeTypes[] = { "audio/mpeg", NULL }; -InputPlugin mp3Plugin = { +struct decoder_plugin mp3Plugin = { "mp3", mp3_plugin_init, NULL, @@ -1124,6 +1124,6 @@ InputPlugin mp3Plugin = { }; #else -InputPlugin mp3Plugin; +struct decoder_plugin mp3Plugin; #endif /* HAVE_MAD */ diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index a46be0d52..f8af07d2c 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -408,7 +408,7 @@ static MpdTag *mp4TagDup(char *file) static const char *mp4_suffixes[] = { "m4a", "mp4", NULL }; static const char *mp4_mimeTypes[] = { "audio/mp4", "audio/m4a", NULL }; -InputPlugin mp4Plugin = { +struct decoder_plugin mp4Plugin = { "mp4", NULL, NULL, @@ -423,6 +423,6 @@ InputPlugin mp4Plugin = { #else -InputPlugin mp4Plugin; +struct decoder_plugin mp4Plugin; #endif /* HAVE_FAAD */ diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 829f15c67..411373283 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -313,7 +313,7 @@ static MpdTag *mpcTagDup(char *file) static const char *mpcSuffixes[] = { "mpc", NULL }; -InputPlugin mpcPlugin = { +struct decoder_plugin mpcPlugin = { "mpc", NULL, NULL, @@ -328,6 +328,6 @@ InputPlugin mpcPlugin = { #else -InputPlugin mpcPlugin; +struct decoder_plugin mpcPlugin; #endif /* HAVE_MPCDEC */ diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 10acf75fe..8209c069a 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -391,7 +391,7 @@ static const char *oggflac_mime_types[] = { "audio/x-flac+ogg", "application/x-ogg", NULL }; -InputPlugin oggflacPlugin = { +struct decoder_plugin oggflacPlugin = { "oggflac", NULL, NULL, @@ -406,6 +406,6 @@ InputPlugin oggflacPlugin = { #else /* !HAVE_FLAC */ -InputPlugin oggflacPlugin; +struct decoder_plugin oggflacPlugin; #endif /* HAVE_OGGFLAC */ diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index f73b34842..1dd9f36e5 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -381,7 +381,7 @@ static const char *oggvorbis_MimeTypes[] = { "application/ogg", "application/x-ogg", NULL }; -InputPlugin oggvorbisPlugin = { +struct decoder_plugin oggvorbisPlugin = { "oggvorbis", NULL, NULL, @@ -396,6 +396,6 @@ InputPlugin oggvorbisPlugin = { #else /* !HAVE_OGGVORBIS */ -InputPlugin oggvorbisPlugin; +struct decoder_plugin oggvorbisPlugin; #endif /* HAVE_OGGVORBIS */ diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 76cb03d30..9085ff88a 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -577,7 +577,7 @@ static int wavpack_filedecode(struct decoder * decoder, char *fname) static char const *wavpackSuffixes[] = { "wv", NULL }; static char const *wavpackMimeTypes[] = { "audio/x-wavpack", NULL }; -InputPlugin wavpackPlugin = { +struct decoder_plugin wavpackPlugin = { "wavpack", NULL, NULL, @@ -592,6 +592,6 @@ InputPlugin wavpackPlugin = { #else /* !HAVE_WAVPACK */ -InputPlugin wavpackPlugin; +struct decoder_plugin wavpackPlugin; #endif /* !HAVE_WAVPACK */ @@ -257,9 +257,9 @@ int isDir(const char *utf8name) return 0; } -InputPlugin *hasMusicSuffix(const char *utf8file, unsigned int next) +struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next) { - InputPlugin *ret = NULL; + struct decoder_plugin *ret = NULL; const char *s = getSuffix(utf8file); if (s) { @@ -272,10 +272,11 @@ InputPlugin *hasMusicSuffix(const char *utf8file, unsigned int next) return ret; } -InputPlugin *isMusic(const char *utf8file, time_t * mtime, unsigned int next) +struct decoder_plugin *isMusic(const char *utf8file, time_t * mtime, + unsigned int next) { if (isFile(utf8file, mtime)) { - InputPlugin *plugin = hasMusicSuffix(utf8file, next); + struct decoder_plugin *plugin = hasMusicSuffix(utf8file, next); if (plugin != NULL) return plugin; } @@ -35,9 +35,10 @@ int isDir(const char *utf8name); int isPlaylist(const char *utf8file); -InputPlugin *hasMusicSuffix(const char *utf8file, unsigned int next); +struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next); -InputPlugin *isMusic(const char *utf8file, time_t * mtime, unsigned int next); +struct decoder_plugin *isMusic(const char *utf8file, time_t * mtime, + unsigned int next); int printRemoteUrlHandlers(int fd); diff --git a/src/song.c b/src/song.c index a8ab4284f..920bf23a6 100644 --- a/src/song.c +++ b/src/song.c @@ -25,6 +25,7 @@ #include "path.h" #include "playlist.h" #include "inputPlugin.h" +#include "decoder_api.h" #include "myfprintf.h" #define SONG_KEY "key: " @@ -62,7 +63,7 @@ Song *newSong(const char *url, int type, Directory * parentDir) assert(type == SONG_TYPE_URL || parentDir); if (song->type == SONG_TYPE_FILE) { - InputPlugin *plugin; + struct decoder_plugin *plugin; unsigned int next = 0; char path_max_tmp[MPD_PATH_MAX]; char *abs_path = rmp2amp_r(path_max_tmp, @@ -286,7 +287,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir) int updateSongInfo(Song * song) { if (song->type == SONG_TYPE_FILE) { - InputPlugin *plugin; + struct decoder_plugin *plugin; unsigned int next = 0; char path_max_tmp[MPD_PATH_MAX]; char abs_path[MPD_PATH_MAX]; |