From a4970c66ef836badd95141bd3f9d3424a1dacdf2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Nov 2009 00:11:36 +0100 Subject: playlist_list: rewind the stream before opening the playlist If one plugin has failed to open the playlist, it may have consumed a part of the stream already. This may lead to a failure in all following plugins. Fix: rewind the stream before each open() call. --- src/playlist_list.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/playlist_list.c') diff --git a/src/playlist_list.c b/src/playlist_list.c index f8d2839d6..c5c436f04 100644 --- a/src/playlist_list.c +++ b/src/playlist_list.c @@ -34,6 +34,7 @@ #include #include +#include static const struct playlist_plugin *const playlist_plugins[] = { &m3u_playlist_plugin, @@ -141,6 +142,10 @@ playlist_list_open_stream_mime(struct input_stream *is) if (playlist_plugins_enabled[i] && stringFoundInStringArray(plugin->mime_types, is->mime)) { + /* rewind the stream, so each plugin gets a + fresh start */ + input_stream_seek(is, 0, SEEK_SET); + playlist = playlist_plugin_open_stream(plugin, is); if (playlist != NULL) return playlist; @@ -163,6 +168,10 @@ playlist_list_open_stream_suffix(struct input_stream *is, const char *suffix) if (playlist_plugins_enabled[i] && stringFoundInStringArray(plugin->suffixes, suffix)) { + /* rewind the stream, so each plugin gets a + fresh start */ + input_stream_seek(is, 0, SEEK_SET); + playlist = playlist_plugin_open_stream(plugin, is); if (playlist != NULL) return playlist; -- cgit v1.2.3