aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/ffmpeg_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-16 20:25:31 +0100
committerMax Kellermann <max@duempel.org>2008-11-16 20:25:31 +0100
commit8882f062000ec6f86d932eee7c948d1369901c03 (patch)
tree3fead978c89f4a79775876012e6d077f7817a216 /src/decoder/ffmpeg_plugin.c
parent9c4e97a61b59105c9b539faca272305bbb234c17 (diff)
downloadmpd-8882f062000ec6f86d932eee7c948d1369901c03.tar.gz
mpd-8882f062000ec6f86d932eee7c948d1369901c03.tar.xz
mpd-8882f062000ec6f86d932eee7c948d1369901c03.zip
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().
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_plugin.c12
1 files 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;
}