]> granicus.if.org Git - handbrake/commitdiff
sync: fix another issue with overlapping ssa subtitle translation to tx3g
authorjstebbins <jstebbins.hb@gmail.com>
Mon, 15 Dec 2014 23:54:15 +0000 (23:54 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Mon, 15 Dec 2014 23:54:15 +0000 (23:54 +0000)
It was failing if 3 or more subtitles overlapped simultaneously.

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@6601 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/sync.c

index 575e079ae1fdbb2ee93e5a51fed25023b0b8c138..5f7cbd4e6ecc7287bbac380b84438878b65e854e 100644 (file)
@@ -383,23 +383,31 @@ static hb_buffer_t * mergeSubtitles(subtitle_sanitizer_t *sanitizer, int end)
                         sanitizer->list_current = a;
                     }
 
-                    sanitizer->list_current = a->next;
-                    if (sanitizer->list_current == NULL)
-                        sanitizer->last = NULL;
                     a->next = NULL;
                     b->s.start = a->s.stop;
 
                     buf = merge_ssa(a, b);
                     hb_buffer_close(&a);
+                    a = buf;
+                    buf = NULL;
+                    sanitizer->list_current = a;
 
-                    if (b->s.stop != AV_NOPTS_VALUE && ABS(b->s.stop - b->s.start) <= 18000)
+                    if (b->s.stop != AV_NOPTS_VALUE &&
+                        ABS(b->s.stop - b->s.start) <= 18000)
                     {
                         // b and a completely overlap, remove b
-                        sanitizer->list_current = b->next;
-                        if (sanitizer->list_current == NULL)
-                            sanitizer->last = NULL;
+                        a->next = b->next;
+                        b->next = NULL;
+                        if (sanitizer->last == b)
+                        {
+                            sanitizer->last = a;
+                        }
                         hb_buffer_close(&b);
                     }
+                    else
+                    {
+                        a->next = b;
+                    }
                 }
                 else
                 {