From 8882f062000ec6f86d932eee7c948d1369901c03 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 16 Nov 2008 20:25:31 +0100 Subject: 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(). --- src/decoder/ffmpeg_plugin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 46a11af59..e1505e884 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -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; } -- cgit v1.2.3