# HG changeset patch # User reimar # Date 1271106257 0 # Node ID bf1afb0fa07d0e967150df679cc255566d10796e # Parent cdafae519605d7aecd3d002b2fa4df62a371470e Make ASS processing work with both subtitle formats, the MKV one and the "standard" one FFmpeg uses. diff -r cdafae519605 -r bf1afb0fa07d mpcommon.c --- 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? */