comparison 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
comparison
equal deleted inserted replaced
1627:eeaee1632340 1628:bd1ef18cdf33
486 //FIXME: OFF_T - Didn't check AVI case yet (avi files can't be >2G anyway?) 486 //FIXME: OFF_T - Didn't check AVI case yet (avi files can't be >2G anyway?)
487 //================= seek in AVI ========================== 487 //================= seek in AVI ==========================
488 int rel_seek_frames=rel_seek_secs*sh_video->fps; 488 int rel_seek_frames=rel_seek_secs*sh_video->fps;
489 int video_chunk_pos=d_video->pos; 489 int video_chunk_pos=d_video->pos;
490 int i; 490 int i;
491
492 if(flags&1){
493 // seek absolute
494 video_chunk_pos=0;
495 }
496
497 if(flags&2){
498 // float 0..1
499 int total=sh_video->video.dwLength;
500 if(total<=1){
501 // bad video header, try to get it from audio
502 total=sh_video->fps*sh_audio->audio.dwLength/sh_audio->wf->nAvgBytesPerSec;
503 if(total<1){
504 mp_msg(MSGT_SEEK,MSGL_WARN,"Couldn't determine number of frames (for absoulte seek) \n");
505 total=0;
506 }
507 }
508 rel_seek_frames=rel_seek_secs*total;
509 }
491 510
492 priv->skip_video_frames=0; 511 priv->skip_video_frames=0;
493 priv->avi_audio_pts=0; 512 priv->avi_audio_pts=0;
494 513
495 // ------------ STEP 1: find nearest video keyframe chunk ------------ 514 // ------------ STEP 1: find nearest video keyframe chunk ------------