diff options
author | Max Kellermann <max@duempel.org> | 2009-11-07 15:14:16 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-07 15:14:16 +0100 |
commit | 5d55b45654eacd479a93673f9ec9ad3627952a96 (patch) | |
tree | 4602220efc2da432bc1aac9a828f3694064a9af5 /src/decoder_thread.c | |
parent | e3da174fca30c493ec311e41ad3dc6795053757d (diff) | |
download | mpd-5d55b45654eacd479a93673f9ec9ad3627952a96.tar.gz mpd-5d55b45654eacd479a93673f9ec9ad3627952a96.tar.xz mpd-5d55b45654eacd479a93673f9ec9ad3627952a96.zip |
decoder_list: pass previous plugin pointer to lookup functions
Remove the static integer hack, that's not thread safe and sucks.
Diffstat (limited to '')
-rw-r--r-- | src/decoder_thread.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c index e39c7f98e..1e850a037 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -118,13 +118,12 @@ decoder_run_stream_suffix(struct decoder *decoder, struct input_stream *is, const char *uri) { const char *suffix = uri_get_suffix(uri); - const struct decoder_plugin *plugin; - unsigned int next = 0; + const struct decoder_plugin *plugin = NULL; if (suffix == NULL) return false; - while ((plugin = decoder_plugin_from_suffix(suffix, next++))) + while ((plugin = decoder_plugin_from_suffix(suffix, plugin)) != NULL) if (plugin->stream_decode != NULL && decoder_stream_decode(plugin, decoder, is)) return true; @@ -212,15 +211,14 @@ static bool decoder_run_file(struct decoder *decoder, const char *path_fs) { const char *suffix = uri_get_suffix(path_fs); - const struct decoder_plugin *plugin; - unsigned int next = 0; + const struct decoder_plugin *plugin = NULL; if (suffix == NULL) return false; decoder_unlock(decoder->dc); - while ((plugin = decoder_plugin_from_suffix(suffix, next++))) { + while ((plugin = decoder_plugin_from_suffix(suffix, plugin)) != NULL) { if (plugin->file_decode != NULL) { decoder_lock(decoder->dc); |