diff mencoder.c @ 12337:6f1b4c989914

soft skipping for mencoder. rather than skipping decoding/filtering frames that will be skipped, mencoded tells vf_softskip (if present) that it should drop the next frame. this allows filters that need to see every input frame (inverse telecine, denoise3d, ...) to see skipped frames before they get dropped. in principle, a smarter softskip filter could be written that would buffer frames and choose to drop the one with least change, rather than strictly dropping the next one.
author rfelker
date Wed, 28 Apr 2004 04:29:17 +0000
parents eeddcef4fb08
children 0db4a3a5b01d
line wrap: on
line diff
--- a/mencoder.c	Wed Apr 28 04:19:47 2004 +0000
+++ b/mencoder.c	Wed Apr 28 04:29:17 2004 +0000
@@ -1289,14 +1289,16 @@
     break;
 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);
+    blit_frame=decode_video(sh_video,start,in_size,
+      skip_flag>0 && vf_next_control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE);
     if(!blit_frame){
       badframes++;
       if(skip_flag<=0){
 	// unwanted skipping of a frame, what to do?
 	if(skip_limit==0){
 	    // skipping not allowed -> write empty frame:
-	    muxer_write_chunk(mux_v,0,0);
+	    if (!encode_duplicates || vf_next_control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
+	      muxer_write_chunk(mux_v,0,0);
 	} else {
 	    // skipping allowed -> skip it and distriubute timer error:
 	    v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate;