From b14bee292837f8da4241ff29ecc3c454c948c0df Mon Sep 17 00:00:00 2001 From: nicodvb Date: Sun, 4 Mar 2007 16:23:18 +0000 Subject: when seeking consider stream->start_pos instead of 0 as initial position; patch by Zuxy Meng approved by Michael git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22458 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 12906d56de..bb45cc9d36 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -134,7 +134,9 @@ static offset_t mp_seek(URLContext *h, offset_t pos, int whence){ pos +=stream_tell(stream); else if(whence == SEEK_END) pos += stream->end_pos; - else if(whence != SEEK_SET) + else if(whence == SEEK_SET) + pos += stream->start_pos; + else return -1; if(posend_pos && stream->eof) @@ -142,7 +144,7 @@ static offset_t mp_seek(URLContext *h, offset_t pos, int whence){ if(stream_seek(stream, pos)==0) return -1; - return pos; + return pos - stream->start_pos; } static int mp_close(URLContext *h){ -- cgit v1.2.3