changeset 30992:bf1afb0fa07d

Make ASS processing work with both subtitle formats, the MKV one and the "standard" one FFmpeg uses.
author reimar
date Mon, 12 Apr 2010 21:04:17 +0000
parents cdafae519605
children d3143f6ec4b3
files mpcommon.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpcommon.c	Mon Apr 12 20:03:26 2010 +0000
+++ b/mpcommon.c	Mon Apr 12 21:04:17 2010 +0000
@@ -202,6 +202,9 @@
                 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 @@
                 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? */