Commit a4970c66 authored by Max Kellermann's avatar Max Kellermann

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.
parent 94528735
......@@ -34,6 +34,7 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment