diff mbox series

[FFmpeg-devel,15/23] lavc/movtextenc: fix unclosed style records

Message ID 20200406175218.1299994-16-jstebbins@jetheaddev.com
State Accepted
Commit a129cc9e2942d9185a23726fd88b074e453e859a
Headers show
Series [FFmpeg-devel,01/23] lavc/movtextdec: fix ass header colors | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork warning Failed to apply patch

Commit Message

John Stebbins April 6, 2020, 5:52 p.m. UTC
The last record at the end of each dialog was never closed
---
 libavcodec/movtextenc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Philip Langdale April 7, 2020, 7:10 p.m. UTC | #1
On Mon, 6 Apr 2020 11:52:10 -0600
John Stebbins <jstebbins@jetheaddev.com> wrote:

> The last record at the end of each dialog was never closed
> ---
>  libavcodec/movtextenc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
> index 05532cd544..d389111419 100644
> --- a/libavcodec/movtextenc.c
> +++ b/libavcodec/movtextenc.c
> @@ -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,

LGTM


--phil
diff mbox series

Patch

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 05532cd544..d389111419 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -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,