[FFmpeg-devel] [PATCH] lavfi/drawtext: allow controling expression output
Paul B Mahol
onemda at gmail.com
Mon Jul 15 01:37:46 CEST 2013
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
Now fix it so it does not crash.
---
libavfilter/vf_drawtext.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 69124a9..4f4a7e5 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -669,6 +669,8 @@ static int func_eval_expr(AVFilterContext *ctx, AVBPrint *bp,
av_log(ctx, AV_LOG_ERROR,
"Expression '%s' for the expr text expansion function is not valid\n",
argv[0]);
+ else if (argv[1])
+ av_bprintf(bp, argv[1], res);
else
av_bprintf(bp, "%f", res);
@@ -681,8 +683,8 @@ static const struct drawtext_function {
int tag; /**< opaque argument to func */
int (*func)(AVFilterContext *, AVBPrint *, char *, unsigned, char **, int);
} functions[] = {
- { "expr", 1, 1, 0, func_eval_expr },
- { "e", 1, 1, 0, func_eval_expr },
+ { "expr", 1, 2, 0, func_eval_expr },
+ { "e", 1, 2, 0, func_eval_expr },
{ "pict_type", 0, 0, 0, func_pict_type },
{ "pts", 0, 0, 0, func_pts },
{ "gmtime", 0, 1, 'G', func_strftime },
--
1.7.11.2
More information about the ffmpeg-devel
mailing list