[FFmpeg-cvslog] eval: add function to access the current "wallclock" time.
Michael Niedermayer
git at videolan.org
Wed Jan 23 22:50:07 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 20 19:08:43 2013 +0100| [31cd1e20bbd55f3680e0417d8f3edcd8f7ac6a82] | committer: Michael Niedermayer
eval: add function to access the current "wallclock" time.
Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31cd1e20bbd55f3680e0417d8f3edcd8f7ac6a82
---
doc/eval.texi | 3 +++
libavutil/eval.c | 7 +++++++
libavutil/version.h | 2 +-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/doc/eval.texi b/doc/eval.texi
index 1ea89d6..a1faff6 100644
--- a/doc/eval.texi
+++ b/doc/eval.texi
@@ -163,6 +163,9 @@ note, when you have the derivatives at y instead of 0
taylor(expr, x-y) can be used
When the series does not converge the results are undefined.
+ at item time(0)
+The the current (wallclock) time in seconds
+
@item root(expr, max)
Finds x where f(x)=0 in the interval 0..max.
f() must be continuous or the result is undefined.
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 6687b64..6ea7504 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;
diff --git a/libavutil/version.h b/libavutil/version.h
index c0c8fca..6fb7943 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -76,7 +76,7 @@
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 15
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list