]> git.sesse.net Git - ffmpeg/commitdiff
lavc/movtextenc: fix unclosed style records
authorJohn Stebbins <jstebbins@jetheaddev.com>
Sat, 4 Apr 2020 20:52:00 +0000 (14:52 -0600)
committerPhilip Langdale <philipl@overt.org>
Fri, 10 Apr 2020 16:32:13 +0000 (09:32 -0700)
The last record at the end of each dialog was never closed

Signed-off-by: Philip Langdale <philipl@overt.org>
libavcodec/movtextenc.c

index 05532cd54435658c6df5cc68e6e284188c65bba5..d3891114194c02a3b52db3ed717ab4ea17dcfa22 100644 (file)
@@ -309,6 +309,12 @@ static void mov_text_color_cb(void *priv, unsigned int color, unsigned int color
      */
 }
 
+static void mov_text_end_cb(void *priv)
+{
+    // End of text, close any open style record
+    mov_text_style_start((MovTextContext*)priv);
+}
+
 static uint16_t utf8_strlen(const char *text, int len)
 {
     uint16_t i = 0, ret = 0;
@@ -352,6 +358,7 @@ static const ASSCodesCallbacks mov_text_callbacks = {
     .new_line = mov_text_new_line_cb,
     .style    = mov_text_style_cb,
     .color    = mov_text_color_cb,
+    .end      = mov_text_end_cb,
 };
 
 static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,