ffmpeg: fixed AVSEEK_SIZE

With whence==AVSEEK_SIZE, the seek function should return the file
size, not the current offset.  Check the return value of
input_stream_seek().
This commit is contained in:
Max Kellermann 2008-11-16 20:25:31 +01:00
parent 9c4e97a61b
commit 8882f06200

View File

@ -89,9 +89,15 @@ static int mpd_ffmpeg_read(URLContext *h, unsigned char *buf, int size)
static int64_t mpd_ffmpeg_seek(URLContext *h, int64_t pos, int whence)
{
struct ffmpeg_stream *stream = (struct ffmpeg_stream *) h->priv_data;
if (whence != AVSEEK_SIZE) { //only ftell
(void) input_stream_seek(stream->input, pos, whence);
}
bool ret;
if (whence == AVSEEK_SIZE)
return stream->input->size;
ret = input_stream_seek(stream->input, pos, whence);
if (!ret)
return -1;
return stream->input->offset;
}