[MPlayer-dev-eng] fix for using -hr-edl-seek and -ovc copy with mencoder

Trent Piepho xyzzy at speakeasy.org
Thu Feb 1 07:45:27 CET 2007


If you try to use -hr-edl-seek and the EDL list with mencoder and -ovc copy,
mencoder will hang at the end of a edl region.

The problem is in the slowseek() function in mencoder.c.  In copy mode, it
will try to wait until it reaches a key-frame to break out of the seek
loop.

If it has reached the end of the edl region, it sets
frame_data->already_read to 1.  If already_read is 1, it doesn't read a new
frame at the start of the loop.  The effect is that when it reaches the end
of the EDL region, it stops reading new frames and tests the same frame
over and over waiting for it to become a keyframe.

I'm attaching a patch to fix it.  All that needs to be done is not set
already_read until seeking is really done.  The point of already_read
appears to be to tell the rest of mencoder not to read a new frame, but to
use the last frame that the edl seek code read.
-------------- next part --------------
Index: mencoder.c
===================================================================
--- mencoder.c	(revision 22100)
+++ mencoder.c	(working copy)
@@ -1684,8 +1684,11 @@
         a_pts = forward_audio(sh_video->pts - frame_data->frame_time + audio_delay, d_audio, mux_a);
 
         if (done) {
-            frame_data->already_read = 1;
-            if (!framecopy || (sh_video->ds->flags & 1)) return 1;
+	    /* In copy mode, wait for a keyframe before stopping */
+            if (!framecopy || (sh_video->ds->flags & 1)) {
+		frame_data->already_read = 1;
+		return 1;
+	    }
         }
         if (sh_video->pts >= end_pts) done = 1;
 


More information about the MPlayer-dev-eng mailing list