diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-03-16 06:52:46 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2006-03-16 06:52:46 +0000 |
commit | 69635022133488e6b19569fb59b16c4658a244eb (patch) | |
tree | a7149e6a5a82017ae3821c801433c8794f796aec /src/inputPlugin.c | |
parent | d7e846bdc2d848525ebd4251c4c5d9c5fe0d2705 (diff) | |
download | mpd-69635022133488e6b19569fb59b16c4658a244eb.tar.gz mpd-69635022133488e6b19569fb59b16c4658a244eb.tar.xz mpd-69635022133488e6b19569fb59b16c4658a244eb.zip |
merge with mpd/trunk up to r3925
git-svn-id: https://svn.musicpd.org/mpd/trunk@3926 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugin.c')
-rw-r--r-- | src/inputPlugin.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/inputPlugin.c b/src/inputPlugin.c index 2fe20f5fc..5c08b265f 100644 --- a/src/inputPlugin.c +++ b/src/inputPlugin.c @@ -49,15 +49,23 @@ static int stringFoundInStringArray(char ** array, char * suffix) { return 0; } -InputPlugin * getInputPluginFromSuffix(char * suffix) { - ListNode * node = inputPlugin_list->firstNode; - InputPlugin * plugin = NULL; +InputPlugin * getInputPluginFromSuffix(char * suffix, unsigned int next) { + static ListNode * pos = NULL; + ListNode * node; + InputPlugin * 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; @@ -66,15 +74,19 @@ InputPlugin * getInputPluginFromSuffix(char * suffix) { return NULL; } -InputPlugin * getInputPluginFromMimeType(char * mimeType) { - ListNode * node = inputPlugin_list->firstNode; - InputPlugin * plugin = NULL; +InputPlugin * getInputPluginFromMimeType(char * mimeType, unsigned int next) { + static ListNode * pos = NULL; + ListNode * node; + InputPlugin * 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; @@ -109,8 +121,9 @@ void printAllInputPluginSuffixes(FILE * fp) { } extern InputPlugin mp3Plugin; -extern InputPlugin oggPlugin; +extern InputPlugin oggvorbisPlugin; extern InputPlugin flacPlugin; +extern InputPlugin oggflacPlugin; extern InputPlugin audiofilePlugin; extern InputPlugin mp4Plugin; extern InputPlugin mpcPlugin; @@ -122,7 +135,8 @@ void initInputPlugins() { /* load plugins here */ loadInputPlugin(&mp3Plugin); - loadInputPlugin(&oggPlugin); + loadInputPlugin(&oggvorbisPlugin); + loadInputPlugin(&oggflacPlugin); loadInputPlugin(&flacPlugin); loadInputPlugin(&audiofilePlugin); loadInputPlugin(&mp4Plugin); |