From c88f95a2ea1d089501bed84c085acd7312f7dc2a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Dec 2009 23:55:40 +0100 Subject: input/rewind: new input_stream wrapper to allow stream rewinding This replaces the rewinding buffer code from the CURL input plugin. It is more generic, and allows rewinding even when the server sends Icy-Metadata (which would have been too difficult to implement within the CURL plugin). This is a rather complex patch for the stable branch (v0.15.x), but it fixes a serious problem: the "vorbis" decoder plugin was unable to play streams with Icy-Metadata, because it couldn't rewind the stream after detecting the codec (Vorbis vs. FLAC). --- src/input/curl_input_plugin.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/input/curl_input_plugin.c') diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index 95d269ce5..37d721d58 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -732,6 +732,18 @@ input_curl_easy_init(struct input_stream *is) return true; } +void +input_curl_reinit(struct input_stream *is) +{ + struct input_curl *c = is->data; + + assert(is->plugin == &input_plugin_curl); + assert(c->easy != NULL); + + curl_easy_setopt(c->easy, CURLOPT_WRITEHEADER, is); + curl_easy_setopt(c->easy, CURLOPT_WRITEDATA, is); +} + static bool input_curl_send_request(struct input_curl *c) { -- cgit v1.2.3