ffmpeg: simplified mpdurl_read()

The function mpdurl_read() is too complicated, and uses the wrong data
types.
This commit is contained in:
Max Kellermann 2008-10-30 19:02:01 +01:00
parent 964442c5ad
commit cd7a720426
1 changed files with 11 additions and 13 deletions

View File

@ -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)