diff options
author | Max Kellermann <max@duempel.org> | 2008-10-30 19:02:01 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-30 19:02:01 +0100 |
commit | cd7a7204268167e8bd2d7c7678ce603096b2a4e2 (patch) | |
tree | c6fe655ac043b397be7764dbe0a6fca9a2760989 | |
parent | 964442c5adc24ac2c93eecec80bbecb65ab57ab6 (diff) | |
download | mpd-cd7a7204268167e8bd2d7c7678ce603096b2a4e2.tar.gz mpd-cd7a7204268167e8bd2d7c7678ce603096b2a4e2.tar.xz mpd-cd7a7204268167e8bd2d7c7678ce603096b2a4e2.zip |
ffmpeg: simplified mpdurl_read()
The function mpdurl_read() is too complicated, and uses the wrong data
types.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 6f8ad3a4a..7bb29fedc 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -82,22 +82,20 @@ static int mpdurl_open(URLContext *h, const char *filename, static int mpdurl_read(URLContext *h, unsigned char *buf, int size) { - int ret; FopsHelper *base = (FopsHelper *) h->priv_data; + while (true) { - ret = input_stream_read(base->input, (void *)buf, size); - if (ret == 0) { - if (input_stream_eof(base->input) || - (base->decoder && - decoder_get_command(base->decoder) != DECODE_COMMAND_NONE)) - return ret; - else - my_usleep(10000); - } else { - break; - } + size_t ret = input_stream_read(base->input, (void *)buf, size); + if (ret > 0) + return ret; + + if (input_stream_eof(base->input) || + (base->decoder && + decoder_get_command(base->decoder) != DECODE_COMMAND_NONE)) + return 0; + + my_usleep(10000); } - return ret; } static int64_t mpdurl_seek(URLContext *h, int64_t pos, int whence) |