aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:10 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:10 +0200
commit82ca4cf8ce421cbec87667f6c22b3e7165443016 (patch)
tree907eeb0f5f90446ffb5f05a4443e386cd0e12f63 /src/decode.c
parent6120635f06ecadcc1ab0d59a54b6842a78e11746 (diff)
downloadmpd-82ca4cf8ce421cbec87667f6c22b3e7165443016.tar.gz
mpd-82ca4cf8ce421cbec87667f6c22b3e7165443016.tar.xz
mpd-82ca4cf8ce421cbec87667f6c22b3e7165443016.zip
added InputStream.ready
The flag "ready" indicates whether the input stream is ready and it has parsed all meta data. Previously, it was impossible for decodeStart() to see the content type of HTTP input streams, because at that time, the HTTP response wasn't parsed yet.
Diffstat (limited to '')
-rw-r--r--src/decode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/decode.c b/src/decode.c
index 92f01a393..97896f67d 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -53,6 +53,18 @@ static void decodeStart(void)
dc.state = DECODE_STATE_START;
dc.command = DECODE_COMMAND_NONE;
+ /* wait for the input stream to become ready; its metadata
+ will be available then */
+
+ while (!inStream.ready) {
+ if (dc.command != DECODE_COMMAND_NONE)
+ goto stop;
+
+ ret = bufferInputStream(&inStream);
+ if (ret < 0)
+ goto stop;
+ }
+
/* for http streams, seekable is determined in bufferInputStream */
dc.seekable = inStream.seekable;