changeset 19180:c5ee8c9808ef

fix 3 bugs in libmpdemux/demux_mf.c 1. Relative seek is seeking 1 frame too far. 2. Percent seek is seeking 1 frame too far (beyond EOF) at 100%. 3. Check for EOF is checking 1 frame too far. Patch by Paul-Francois Fontigny < pff AAA filmik PPP be> Original thread: Date: Jul 16, 2006 12:40 PM Subject: [MPlayer-dev-eng] [PATCH] bugfix for libmpdemux/demux_mf.c
author gpoirier
date Wed, 26 Jul 2006 09:30:43 +0000
parents 94dd11eb4dd9
children e40cf0305d4e
files libmpdemux/demux_mf.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mf.c	Tue Jul 25 08:54:48 2006 +0000
+++ b/libmpdemux/demux_mf.c	Wed Jul 26 09:30:43 2006 +0000
@@ -18,12 +18,12 @@
 static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
   mf_t * mf = (mf_t *)demuxer->priv;
   sh_video_t   * sh_video = demuxer->video->sh;
-  int newpos = (flags & 1)?0:mf->curr_frame;
+  int newpos = (flags & 1)?0:mf->curr_frame - 1;
   
-  if ( flags & 2 ) newpos+=rel_seek_secs*mf->nr_of_files;
+  if ( flags & 2 ) newpos+=rel_seek_secs*(mf->nr_of_files - 1);
    else newpos+=rel_seek_secs * sh_video->fps;
   if ( newpos < 0 ) newpos=0;
-  if( newpos > mf->nr_of_files) newpos=mf->nr_of_files;
+  if( newpos >= mf->nr_of_files) newpos=mf->nr_of_files - 1;
   mf->curr_frame=newpos;
 }