[MPlayer-dev-eng] fix braindamaged -edlout behavior

Reynaldo H. Verdejo Pinochet reynaldo at opendot.cl
Tue Jul 4 11:36:40 CEST 2006


Currently -edlout makes past-2-seconds skips for every 'i'
keystroke during playback, this is supposed to provide a
good starting point for the user to build up the desired
edl file. The aproach has several drawbacks and bugs, the
more important been:

1.- if you press i on time spans < 2 seconds mp writes
bad edl lines to the edlout file.

2.- user has to manually join the lines on the file to make
his edl file do what he wants, each edl mute/skip operation needs 
and start and an end not necesarily 2 seconds away of each other.

3.- we can do a lot better.

Attached patch modifies -edlout behavior to make it build
a working edl file with timespans delimited by each 'i' stroke.

an example:

I want to make an edl file to skip a crude sex scene and 2 comercials
to be able to watch a file with the folowing structure with my girls:

[.......[  CRUDESEX  ].....[  ADD1  ]............[  ADD2  ].....]

then i fire mplayer with -edlout myfile.edl and make the folowing
'i' keystrokes while its playing.

[......i[  CRUDESEX  ]i...i[  ADD1  ]i..........i[  ADD2  ]i....]


then, i fire mplayer file -edl myfile.edl and i got the following
movie with the useless and ofending chunks already chopped off
(provided the stream allows me to cut on that positions)

[.............................]


Hope you like it.

	Reynaldo
	
-------------- next part --------------
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 18884)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -304,7 +304,7 @@
 .IPs "r and t"
 Move subtitles up/down.
 .IPs "i (\-edlout mode only)"
-Set EDL mark.
+Set start or end of an EDL skip and write it out to the given file.
 .IPs "s (\-vf screenshot only)"
 Take a screenshot.
 .IPs "I"
@@ -727,9 +727,8 @@
 .
 .TP
 .B \-edlout <filename>
-Creates a new file and writes edit decision list (EDL) records to that file.
-During playback, when the user hits 'i', an entry to skip over the last two
-seconds of playback will be written to the file.
+Creates a new file and writes edit decision list (EDL) records to it.
+During playback, the user hits 'i' to mark the start or end of a skip block
 This provides a starting point from which the user can fine-tune EDL entries
 later.
 See DOCS/\:HTML/\:en/\:edl.html for details.
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 18893)
+++ mplayer.c	(working copy)
@@ -397,6 +397,7 @@
 short edl_muted  = 0; ///< Stores whether EDL is currently in muted mode.
 short edl_decision = 0; ///< 1 when an EDL operation has been made.
 FILE* edl_fd = NULL; ///< fd to write to when in -edlout mode.
+float begin_skip = 0; ///< start time of the current skip while on edlout mode
 
 static unsigned int inited_flags=0;
 #define INITED_VO 1
@@ -4216,11 +4217,25 @@
         free(tmp);
     } break;
     case MP_CMD_EDL_MARK:
-      if( edl_fd ) {
-	float v = sh_video ? sh_video->pts :
-	    playing_audio_pts(sh_audio, d_audio, audio_out);
-	fprintf( edl_fd, "%f %f %d\n", v-2, v, 0 );
-      }
+		if( edl_fd ) {
+			float v = sh_video ? sh_video->pts :
+			playing_audio_pts(sh_audio, d_audio, audio_out);
+
+			if( begin_skip == 0 )
+			{
+				begin_skip = v; 
+				mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutStartSkip);
+			}else{
+				if( begin_skip > v )
+				{
+					mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdloutBadStop);
+				}else{
+					fprintf( edl_fd, "%f %f %d\n", begin_skip, v, 0 );
+					mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutEndSkip);
+				}
+				begin_skip = 0;
+			}
+		}
       break;
     case MP_CMD_SWITCH_RATIO : {
       if (cmd->nargs == 0 || cmd->args[0].v.f == -1)
Index: help/help_mp-en.h
===================================================================
--- help/help_mp-en.h	(revision 18884)
+++ help/help_mp-en.h	(working copy)
@@ -198,6 +198,9 @@
 #define MSGTR_EdlBadLineOverlap "Last stop position was [%f]; next start is [%f].\n"\
 "Entries must be in chronological order, cannot overlap. Discarding.\n"
 #define MSGTR_EdlBadLineBadStop "Stop time has to be after start time.\n"
+#define MSGTR_EdloutBadStop "EDL skip canceled, last start > stop\n"
+#define MSGTR_EdloutStartSkip "EDL skip start, press 'i' again to end block.\n"
+#define MSGTR_EdloutEndSkip "EDL skip end, line written.\n"
 
 // mplayer.c OSD
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060704/186c01f8/attachment.pgp>


More information about the MPlayer-dev-eng mailing list