[FFmpeg-devel] [PATCH] eval: add wallclock time at which the expression was parsed (inited)

Michael Niedermayer michaelni at gmx.at
Fri Jan 25 16:19:00 CET 2013


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/eval.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavutil/eval.c b/libavutil/eval.c
index 22b491f..cfddacb 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -49,6 +49,7 @@ typedef struct Parser {
     void *log_ctx;
 #define VARS 10
     double *var;
+    double inittime;
 } Parser;
 
 static const AVClass class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) };
@@ -331,6 +332,13 @@ static int parse_primary(AVExpr **e, Parser *p)
             return 0;
         }
     }
+    if(strmatch(p->s, "INITTIME")) {
+        p->s += strlen("INITTIME");
+        d->type = e_value;
+        d->value = p->inittime;
+        *e = d;
+        return 0;
+    }
 
     p->s= strchr(p->s, '(');
     if (p->s==NULL) {
@@ -640,6 +648,7 @@ int av_expr_parse(AVExpr **expr, const char *s,
     p.func2_names = func2_names;
     p.log_offset = log_offset;
     p.log_ctx    = log_ctx;
+    p.inittime   = av_gettime() * 0.000001;
 
     if ((ret = parse_expr(&e, &p)) < 0)
         goto end;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list