# HG changeset patch # User arpi # Date 1026496996 0 # Node ID 1cd03b5da35dd479cfa18961b486966f6017cca8 # Parent 180e27f21ff29d06083a332b15b8f59eee5fbbf6 fix for interlaced (2 fields) mpeg2 streams: - accept frame skip caused by the codec - do timer correction after calculating frame skip/dup count diff -r 180e27f21ff2 -r 1cd03b5da35d mencoder.c --- a/mencoder.c Fri Jul 12 17:49:04 2002 +0000 +++ b/mencoder.c Fri Jul 12 18:03:16 2002 +0000 @@ -953,8 +953,6 @@ if(in_size<0){ at_eof=1; break; } sh_video->timer+=frame_time; ++decoded_frameno; - v_timer_corr-=frame_time-(float)mux_v->h.dwScale/mux_v->h.dwRate; - if(demuxer2){ // 3-pass encoding, read control file (frameno.avi) // find our frame: while(next_frameno=(float)mux_v->h.dwScale/mux_v->h.dwRate && (skip_limit<0 || skip_flagh.dwScale/mux_v->h.dwRate; @@ -1006,6 +1006,8 @@ } // demuxer2 +v_timer_corr-=frame_time-(float)mux_v->h.dwScale/mux_v->h.dwRate; + ptimer_start = GetTimerMS(); switch(mux_v->codec){ @@ -1020,8 +1022,16 @@ default: // decode_video will callback down to ve_*.c encoders, through the video filters blit_frame=decode_video(sh_video,start,in_size,(skip_flag>0)?1:0); - if(skip_flag>0) break; - if(!blit_frame) aviwrite_write_chunk(muxer,mux_v,muxer_f,0,0); // empty. + if(!blit_frame && skip_flag<=0){ + // unwanted skipping of a frame, what to do? + if(skip_limit==0){ + // skipping not allowed -> write empty frame: + aviwrite_write_chunk(muxer,mux_v,muxer_f,0,0); + } else { + // skipping allowed -> skip it and distriubute timer error: + v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate; + } + } } videosamples++;