return err;
}
+static inline int is_newline(uint32_t c)
+{
+ return c == '\n' || c == '\r' || c == '\f' || c == '\v';
+}
+
static int load_textfile(AVFilterContext *ctx)
{
DrawTextContext *s = ctx->priv;
return err;
}
+ if (textbuf_size > 0 && is_newline(textbuf[textbuf_size - 1]))
+ textbuf_size--;
if (textbuf_size > SIZE_MAX - 1 || !(tmp = av_realloc(s->text, textbuf_size + 1))) {
av_file_unmap(textbuf, textbuf_size);
return AVERROR(ENOMEM);
return 0;
}
-static inline int is_newline(uint32_t c)
-{
- return c == '\n' || c == '\r' || c == '\f' || c == '\v';
-}
-
#if CONFIG_LIBFRIBIDI
static int shape_text(AVFilterContext *ctx)
{
{ NULL }
};
-AVFilter ff_vf_drawtext = {
+const AVFilter ff_vf_drawtext = {
.name = "drawtext",
.description = NULL_IF_CONFIG_SMALL("Draw text on top of video frames using libfreetype library."),
.priv_size = sizeof(DrawTextContext),