diff demux_avi.c @ 1628:bd1ef18cdf33

seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
author arpi
date Wed, 22 Aug 2001 19:03:15 +0000
parents 5908dd344067
children 09284c9c2b49
line wrap: on
line diff
--- a/demux_avi.c	Wed Aug 22 19:02:28 2001 +0000
+++ b/demux_avi.c	Wed Aug 22 19:03:15 2001 +0000
@@ -488,6 +488,25 @@
     int rel_seek_frames=rel_seek_secs*sh_video->fps;
     int video_chunk_pos=d_video->pos;
     int i;
+
+      if(flags&1){
+	// seek absolute
+	video_chunk_pos=0;
+      }
+      
+      if(flags&2){
+        // float 0..1
+	int total=sh_video->video.dwLength;
+	if(total<=1){
+	    // bad video header, try to get it from audio
+	    total=sh_video->fps*sh_audio->audio.dwLength/sh_audio->wf->nAvgBytesPerSec;
+	    if(total<1){
+              mp_msg(MSGT_SEEK,MSGL_WARN,"Couldn't determine number of frames (for absoulte seek)  \n");
+	      total=0;
+	    }
+	}
+	rel_seek_frames=rel_seek_secs*total;
+      }
     
       priv->skip_video_frames=0;
       priv->avi_audio_pts=0;