[FFmpeg-cvslog] lavfi/overlay: improve feedback in case of invalid expression

Stefano Sabatini git at videolan.org
Fri Apr 12 00:20:37 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Apr 12 00:06:52 2013 +0200| [9da369604ecf31d9dce2dee21ed214b8c43264c6] | committer: Stefano Sabatini

lavfi/overlay: improve feedback in case of invalid expression

Based on vf_hue.c code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9da369604ecf31d9dce2dee21ed214b8c43264c6
---

 libavfilter/vf_overlay.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index b5c3f6f..92ec258 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -167,7 +167,7 @@ static void eval_expr(AVFilterContext *ctx, enum EvalTarget eval_tgt)
     }
 }
 
-static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)
+static int set_expr(AVExpr **pexpr, const char *expr, const char *option, void *log_ctx)
 {
     int ret;
     AVExpr *old = NULL;
@@ -178,7 +178,8 @@ static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)
                         NULL, NULL, NULL, NULL, 0, log_ctx);
     if (ret < 0) {
         av_log(log_ctx, AV_LOG_ERROR,
-               "Error when evaluating the expression '%s'\n", expr);
+               "Error when evaluating the expression '%s' for %s\n",
+               expr, option);
         *pexpr = old;
         return ret;
     }
@@ -194,11 +195,11 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
     int ret;
 
     if      (!strcmp(cmd, "x"))
-        ret = set_expr(&over->x_pexpr, args, ctx);
+        ret = set_expr(&over->x_pexpr, args, cmd, ctx);
     else if (!strcmp(cmd, "y"))
-        ret = set_expr(&over->y_pexpr, args, ctx);
+        ret = set_expr(&over->y_pexpr, args, cmd, ctx);
     else if (!strcmp(cmd, "enable"))
-        ret = set_expr(&over->enable_pexpr, args, ctx);
+        ret = set_expr(&over->enable_pexpr, args, cmd, ctx);
     else
         ret = AVERROR(ENOSYS);
 
@@ -318,9 +319,9 @@ static int config_input_overlay(AVFilterLink *inlink)
     over->var_values[VAR_T]     = NAN;
     over->var_values[VAR_POS]   = NAN;
 
-    if ((ret = set_expr(&over->x_pexpr,      over->x_expr,      ctx)) < 0 ||
-        (ret = set_expr(&over->y_pexpr,      over->y_expr,      ctx)) < 0 ||
-        (ret = set_expr(&over->enable_pexpr, over->enable_expr, ctx)) < 0)
+    if ((ret = set_expr(&over->x_pexpr,      over->x_expr,      "x",      ctx)) < 0 ||
+        (ret = set_expr(&over->y_pexpr,      over->y_expr,      "y",      ctx)) < 0 ||
+        (ret = set_expr(&over->enable_pexpr, over->enable_expr, "enable", ctx)) < 0)
         return ret;
 
     over->overlay_is_packed_rgb =



More information about the ffmpeg-cvslog mailing list