summaryrefslogtreecommitdiff
path: root/libavutil/eval.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-20 19:08:43 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-23 22:22:53 +0100
commit31cd1e20bbd55f3680e0417d8f3edcd8f7ac6a82 (patch)
treee72239be5cbf999bc98231e48051e276d648db7d /libavutil/eval.c
parent665f2d432ccdfef91d4b3fa640582160076b18eb (diff)
downloadffmpeg-31cd1e20bbd55f3680e0417d8f3edcd8f7ac6a82.tar.gz
eval: add function to access the current "wallclock" time.
Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/eval.c')
-rw-r--r--libavutil/eval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 6687b646f5..6ea7504ff1 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -32,6 +32,7 @@
#include "eval.h"
#include "log.h"
#include "mathematics.h"
+#include "time.h"
typedef struct Parser {
const AVClass *class;
@@ -156,6 +157,11 @@ struct AVExpr {
double *var;
};
+static double etime(double v)
+{
+ return av_gettime() * 0.000001;
+}
+
static double eval_expr(Parser *p, AVExpr *e)
{
switch (e->type) {
@@ -377,6 +383,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "exp" )) d->a.func0 = exp;
else if (strmatch(next, "log" )) d->a.func0 = log;
else if (strmatch(next, "abs" )) d->a.func0 = fabs;
+ else if (strmatch(next, "time" )) d->a.func0 = etime;
else if (strmatch(next, "squish")) d->type = e_squish;
else if (strmatch(next, "gauss" )) d->type = e_gauss;
else if (strmatch(next, "mod" )) d->type = e_mod;