summaryrefslogtreecommitdiffstats
path: root/demux_avi.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-22 19:03:15 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-22 19:03:15 +0000
commit408f919293c06cca57dd488d1d4857095e0b4adc (patch)
treea074b8f6176f3689ac6f54d639487c5d5c7a93eb /demux_avi.c
parentaa2a852dea8870b744dc07d25601044401f90c90 (diff)
downloadmpv-408f919293c06cca57dd488d1d4857095e0b4adc.tar.bz2
mpv-408f919293c06cca57dd488d1d4857095e0b4adc.tar.xz
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1629 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'demux_avi.c')
-rw-r--r--demux_avi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/demux_avi.c b/demux_avi.c
index 34dff21ecd..7b968ea157 100644
--- a/demux_avi.c
+++ b/demux_avi.c
@@ -488,6 +488,25 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
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;