[MPlayer-cvslog] r31034 - trunk/mpcommon.c

reimar subversion at mplayerhq.hu
Mon Apr 12 23:04:17 CEST 2010


Author: reimar
Date: Mon Apr 12 23:04:17 2010
New Revision: 31034

Log:
Make ASS processing work with both subtitle formats, the MKV one and the
"standard" one FFmpeg uses.

Modified:
   trunk/mpcommon.c

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	Mon Apr 12 22:03:26 2010	(r31033)
+++ trunk/mpcommon.c	Mon Apr 12 23:04:17 2010	(r31034)
@@ -202,6 +202,9 @@ void update_subtitles(sh_video_t *sh_vid
                 ass_track = sh ? sh->ass_track : NULL;
                 if (!ass_track) continue;
                 if (type == 'a') { // ssa/ass subs with libass
+                    if (len > 10 && memcmp(packet, "Dialogue: ", 10) == 0)
+                        ass_process_data(ass_track, packet, len);
+                    else
                     ass_process_chunk(ass_track, packet, len,
                                       (long long)(subpts*1000 + 0.5),
                                       (long long)((endpts-subpts)*1000 + 0.5));
@@ -225,7 +228,10 @@ void update_subtitles(sh_video_t *sh_vid
                 if (type == 'a') { // ssa/ass subs without libass => convert to plaintext
                     int i;
                     unsigned char* p = packet;
-                    for (i=0; i < 8 && *p != '\0'; p++)
+                    int skip_commas = 8;
+                    if (len > 10 && memcmp(packet, "Dialogue: ", 10) == 0)
+                        skip_commas = 9;
+                    for (i=0; i < skip_commas && *p != '\0'; p++)
                         if (*p == ',')
                             i++;
                     if (*p == '\0')  /* Broken line? */


More information about the MPlayer-cvslog mailing list