[FFmpeg-devel] [PATCH] lavfi/volume: add dynamic expression evaluation

Stefano Sabatini stefasab at gmail.com
Mon Dec 23 20:21:50 CET 2013


On date Monday 2013-12-23 20:15:25 +0100, Stefano Sabatini encoded:
> On date Monday 2013-12-23 19:48:25 +0100, Nicolas George encoded:
[...]
> > > +    if (vol->eval_mode == EVAL_MODE_INIT) {
> > 
> > > +        if ((ret = av_expr_parse(&vol->volume_pexpr, vol->volume_expr,
> > > +                                 var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) {
> > > +            av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n",
> > > +                   vol->volume_expr);
> > > +            return ret;
> > > +        }
> > 
> > It looks like duplicated code with set_expr().
> > 
> > > +
> > > +        vol->volume = av_expr_eval(vol->volume_pexpr, vol->var_values, NULL);
> > > +        if (isnan(vol->volume)) {
> > > +            av_log(ctx, AV_LOG_ERROR, "Invalid value NaN for volume\n");
> > > +            return AVERROR(EINVAL);
> > > +        }
> > > +
> > > +        set_volume(ctx);
> > 
> 
> > This bit could probably be factored out, that would make the patch with
> > command processing slightly shorter.
> 
> Correct. I also added the vol variable, which may be useful for
> example for doing interactive volume = vol/2.
> -- 
> FFmpeg = Friendly and Fabulous Magical Pacific Emblematic Geek

> From e5e9e86b131b9dd272457b311c0d745d3131752e Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sat, 23 Feb 2013 00:17:17 +0100
> Subject: [PATCH] lavfi/volume: support volume expression and per-frame
>  expression evaluation
> 
> The eval mode allows to evaluate the expression per-frame or just at
> init.
> 
> In particular, address ticket #3234.
> 
> TODO: bump micro
> ---
>  doc/filters.texi        |  57 +++++++++++++++-
>  libavfilter/af_volume.c | 169 +++++++++++++++++++++++++++++++++++++++++++-----
>  libavfilter/af_volume.h |  28 ++++++++
>  3 files changed, 235 insertions(+), 19 deletions(-)

Updated. Renamed eval=init -> eval=once, and vol variable to volume.
-- 
FFmpeg = Fanciful & Forgiving Mind-dumbing Pitiless Eretic Guru
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-volume-support-volume-expression-and-per-frame.patch
Type: text/x-diff
Size: 13402 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131223/e11a47c4/attachment.bin>


More information about the ffmpeg-devel mailing list