[MPlayer-dev-eng] [PATCH] Allow EDL's to work better with DVD's

Roger Pack rogerdpack2 at gmail.com
Wed Apr 18 18:39:08 CEST 2012


Currently EDL relies on mpctx->sh_video->pts which (as noted earlier)
can "reset" half way through a DVD, thus applying skips or mutes to
any segment past that mark doesn't work.  Patch to remedy this.

-roger-

https://github.com/rdp/mplayer-svn/commit/5ac533baf061a50809adbe6a3b0133b0e334ff8f

diff --git a/mplayer.c b/mplayer.c
index 3a5e38a..38f023c 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2608,7 +2608,8 @@ static void edl_update(MPContext *mpctx)
         edl_records     = NULL;
         return;
     }
-
+	
+    double pts = demuxer_get_current_time(mpctx->demuxer);	
     // This indicates that we need to reset next EDL record according
     // to new PTS due to seek or other condition
     if (edl_needs_reset) {
@@ -2619,19 +2620,19 @@ static void edl_update(MPContext *mpctx)
         // Find next record, also skip immediately if we are already
         // inside any record
         while (next_edl_record) {
-            if (next_edl_record->start_sec > mpctx->sh_video->pts)
+            if (next_edl_record->start_sec > pts)
                 break;
-            if (next_edl_record->stop_sec >= mpctx->sh_video->pts) {
+            if (next_edl_record->stop_sec >= pts) {
                 if (edl_backward) {
                     mpctx->osd_function = OSD_REW;
                     edl_decision  = 1;
                     abs_seek_pos  = 0;
-                    rel_seek_secs = -(mpctx->sh_video->pts -
+                    rel_seek_secs = -(pts -
                                       next_edl_record->start_sec +
                                       edl_backward_delay);
                     mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_SKIP: pts [%f], "
                                                     "offset [%f],
start [%f], stop [%f], length [%f]\n",
-                           mpctx->sh_video->pts, rel_seek_secs,
+                           pts, rel_seek_secs,
                            next_edl_record->start_sec,
next_edl_record->stop_sec,
                            next_edl_record->length_sec);
                     return;
@@ -2649,15 +2650,15 @@ static void edl_update(MPContext *mpctx)
     }

     if (next_edl_record &&
-        mpctx->sh_video->pts >= next_edl_record->start_sec) {
+        pts >= next_edl_record->start_sec) {
         if (next_edl_record->action == EDL_SKIP) {
             mpctx->osd_function = OSD_FFW;
             edl_decision  = 1;
             abs_seek_pos  = 0;
-            rel_seek_secs = next_edl_record->stop_sec - mpctx->sh_video->pts;
+            rel_seek_secs = next_edl_record->stop_sec - pts;
             mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_SKIP: pts [%f], offset [%f], "
                                             "start [%f], stop [%f],
length [%f]\n",
-                   mpctx->sh_video->pts, rel_seek_secs,
+                   pts, rel_seek_secs,
                    next_edl_record->start_sec, next_edl_record->stop_sec,
                    next_edl_record->length_sec);
         } else if (next_edl_record->action == EDL_MUTE) {


More information about the MPlayer-dev-eng mailing list