From 408f919293c06cca57dd488d1d4857095e0b4adc Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 22 Aug 2001 19:03:15 +0000 Subject: 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 --- demux_avi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'demux_avi.c') 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; -- cgit v1.2.3