[FFmpeg-devel] [PATCH] lavfi/drawtext: ignore final LF of textfile.

Gyan Doshi ffmpeg at gyani.pro
Mon Nov 30 20:40:36 EET 2020



On 01-12-2020 12:08 am, Nicolas George wrote:
> A standard text file ends with a final LF.
> Without this change, it is interpreted as an empty final line,
> and visible with the box option.
> The current behavior can be achieved by actually having
> an empty line at the end of the file.
>
> Fix trac ticket #7948.
>
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>   libavfilter/vf_drawtext.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index abe1ca6c35..0cc47e84a9 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -583,6 +583,8 @@ static int load_textfile(AVFilterContext *ctx)
>           return err;
>       }
>   
> +    if (textbuf_size > 0 && textbuf[textbuf_size - 1] == '\n')

Isn't it better to use   is_newline()

Regards,
Gyan


More information about the ffmpeg-devel mailing list