[MPlayer-cvslog] r31293 - in trunk: libass/ass.c libass/ass.h mplayer.c

aurel subversion at mplayerhq.hu
Mon May 31 21:10:57 CEST 2010


Author: aurel
Date: Mon May 31 21:10:57 2010
New Revision: 31293

Log:
backport ass_flush_events() from upstream libass and make use of it

This fixes subtitles duplication when seeking back in ass stream formated
with the "standard" format FFmpeg uses.

Modified:
   trunk/libass/ass.c
   trunk/libass/ass.h
   trunk/mplayer.c

Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c	Mon May 31 19:12:27 2010	(r31292)
+++ trunk/libass/ass.c	Mon May 31 21:10:57 2010	(r31293)
@@ -909,6 +909,20 @@ void ass_process_chunk(ASS_Track *track,
     free(str);
 }
 
+/**
+ * \brief Flush buffered events.
+ * \param track track
+*/
+void ass_flush_events(ASS_Track *track)
+{
+    if (track->events) {
+        int eid;
+        for (eid = 0; eid < track->n_events; eid++)
+            ass_free_event(track, eid);
+        track->n_events = 0;
+    }
+}
+
 #ifdef CONFIG_ICONV
 /** \brief recode buffer to utf-8
  * constraint: codepage != 0

Modified: trunk/libass/ass.h
==============================================================================
--- trunk/libass/ass.h	Mon May 31 19:12:27 2010	(r31292)
+++ trunk/libass/ass.h	Mon May 31 21:10:57 2010	(r31293)
@@ -317,6 +317,12 @@ void ass_process_chunk(ASS_Track *track,
                        long long timecode, long long duration);
 
 /**
+ * \brief Flush buffered events.
+ * \param track track
+*/
+void ass_flush_events(ASS_Track *track);
+
+/**
  * \brief Read subtitles from file.
  * \param library library handle
  * \param fname file name

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Mon May 31 19:12:27 2010	(r31292)
+++ trunk/mplayer.c	Mon May 31 21:10:57 2010	(r31293)
@@ -2581,6 +2581,11 @@ static int seek(MPContext *mpctx, double
 	vobsub_seek(vo_vobsub, mpctx->sh_video->pts);
     }
 
+#ifdef CONFIG_ASS
+    if (ass_enabled && mpctx->d_sub->sh && ((sh_sub_t *)mpctx->d_sub->sh)->ass_track)
+        ass_flush_events(((sh_sub_t *)mpctx->d_sub->sh)->ass_track);
+#endif
+
     edl_seek_reset(mpctx);
 
     c_total = 0;


More information about the MPlayer-cvslog mailing list