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

Stefano Sabatini stefasab at gmail.com
Fri Jan 25 19:34:41 CET 2013


On date Friday 2013-01-25 16:19:00 +0100, Michael Niedermayer encoded:
> 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")) {

nit++: if_(

> +        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;

Missing documentation and micro bump.

[...]
-- 
FFmpeg = Fast Freak Mega Power Elitarian Gorilla


More information about the ffmpeg-devel mailing list