Commit cd7a7204 authored by Max Kellermann's avatar Max Kellermann

ffmpeg: simplified mpdurl_read()

The function mpdurl_read() is too complicated, and uses the wrong data types.
parent 964442c5
...@@ -82,22 +82,20 @@ static int mpdurl_open(URLContext *h, const char *filename, ...@@ -82,22 +82,20 @@ static int mpdurl_open(URLContext *h, const char *filename,
static int mpdurl_read(URLContext *h, unsigned char *buf, int size) static int mpdurl_read(URLContext *h, unsigned char *buf, int size)
{ {
int ret;
FopsHelper *base = (FopsHelper *) h->priv_data; FopsHelper *base = (FopsHelper *) h->priv_data;
while (true) { while (true) {
ret = input_stream_read(base->input, (void *)buf, size); size_t ret = input_stream_read(base->input, (void *)buf, size);
if (ret == 0) { if (ret > 0)
return ret;
if (input_stream_eof(base->input) || if (input_stream_eof(base->input) ||
(base->decoder && (base->decoder &&
decoder_get_command(base->decoder) != DECODE_COMMAND_NONE)) decoder_get_command(base->decoder) != DECODE_COMMAND_NONE))
return ret; return 0;
else
my_usleep(10000); my_usleep(10000);
} else {
break;
} }
}
return ret;
} }
static int64_t mpdurl_seek(URLContext *h, int64_t pos, int whence) static int64_t mpdurl_seek(URLContext *h, int64_t pos, int whence)
......
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