Commit 094673ff authored by Michael Niedermayer's avatar Michael Niedermayer

eval: support 3 parameter functions.

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 43b1943a
...@@ -145,7 +145,7 @@ struct AVExpr { ...@@ -145,7 +145,7 @@ struct AVExpr {
double (*func1)(void *, double); double (*func1)(void *, double);
double (*func2)(void *, double, double); double (*func2)(void *, double, double);
} a; } a;
struct AVExpr *param[2]; struct AVExpr *param[3];
double *var; double *var;
}; };
...@@ -229,6 +229,7 @@ void av_expr_free(AVExpr *e) ...@@ -229,6 +229,7 @@ void av_expr_free(AVExpr *e)
if (!e) return; if (!e) return;
av_expr_free(e->param[0]); av_expr_free(e->param[0]);
av_expr_free(e->param[1]); av_expr_free(e->param[1]);
av_expr_free(e->param[2]);
av_freep(&e->var); av_freep(&e->var);
av_freep(&e); av_freep(&e);
} }
...@@ -301,6 +302,10 @@ static int parse_primary(AVExpr **e, Parser *p) ...@@ -301,6 +302,10 @@ static int parse_primary(AVExpr **e, Parser *p)
p->s++; // "," p->s++; // ","
parse_expr(&d->param[1], p); parse_expr(&d->param[1], p);
} }
if (p->s[0]== ',') {
p->s++; // ","
parse_expr(&d->param[2], p);
}
if (p->s[0] != ')') { if (p->s[0] != ')') {
av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0); av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0);
av_expr_free(d); av_expr_free(d);
...@@ -517,8 +522,8 @@ static int verify_expr(AVExpr *e) ...@@ -517,8 +522,8 @@ static int verify_expr(AVExpr *e)
case e_sqrt: case e_sqrt:
case e_not: case e_not:
case e_random: case e_random:
return verify_expr(e->param[0]); return verify_expr(e->param[0]) && !e->param[2];
default: return verify_expr(e->param[0]) && verify_expr(e->param[1]); default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment