[FFmpeg-cvslog] eval: support 3 parameter functions.

Michael Niedermayer git at videolan.org
Wed Feb 22 23:19:54 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb 22 17:19:35 2012 +0100| [094673ff1b1a0f83584f3aeea76a3e9c9e3129bf] | committer: Michael Niedermayer

eval: support 3 parameter functions.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/eval.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavutil/eval.c b/libavutil/eval.c
index fda0997..cb4141a 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -145,7 +145,7 @@ struct AVExpr {
         double (*func1)(void *, double);
         double (*func2)(void *, double, double);
     } a;
-    struct AVExpr *param[2];
+    struct AVExpr *param[3];
     double *var;
 };
 
@@ -229,6 +229,7 @@ void av_expr_free(AVExpr *e)
     if (!e) return;
     av_expr_free(e->param[0]);
     av_expr_free(e->param[1]);
+    av_expr_free(e->param[2]);
     av_freep(&e->var);
     av_freep(&e);
 }
@@ -301,6 +302,10 @@ static int parse_primary(AVExpr **e, Parser *p)
         p->s++; // ","
         parse_expr(&d->param[1], p);
     }
+    if (p->s[0]== ',') {
+        p->s++; // ","
+        parse_expr(&d->param[2], p);
+    }
     if (p->s[0] != ')') {
         av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0);
         av_expr_free(d);
@@ -517,8 +522,8 @@ static int verify_expr(AVExpr *e)
         case e_sqrt:
         case e_not:
         case e_random:
-            return verify_expr(e->param[0]);
-        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]);
+            return verify_expr(e->param[0]) && !e->param[2];
+        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2];
     }
 }
 



More information about the ffmpeg-cvslog mailing list