diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-04-14 13:38:47 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-04-14 13:38:47 +0300 |
commit | 10a68ccd58318c00c7872081a0518acec7ebe6c3 (patch) | |
tree | a8596acab8ab29e0d23234064553c5637d6cf4fc /libavfilter | |
parent | ce24b1def0268ad2fdc220a8f5ce26b1dd6cfb79 (diff) |
avfilter/af_amix: use av_strtod() for weights
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_amix.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index af8ad58262..78b7a7c83d 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -34,6 +34,7 @@ #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/common.h" +#include "libavutil/eval.h" #include "libavutil/float_dsp.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" @@ -506,9 +507,9 @@ static int activate(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx) { MixContext *s = ctx->priv; - char *p, *arg, *saveptr = NULL; float last_weight = 1.f; int i, ret; + char *p; for (i = 0; i < s->nb_inputs; i++) { AVFilterPad pad = { 0 }; @@ -534,13 +535,13 @@ static av_cold int init(AVFilterContext *ctx) p = s->weights_str; for (i = 0; i < s->nb_inputs; i++) { - if (!(arg = av_strtok(p, " ", &saveptr))) - break; - - p = NULL; - sscanf(arg, "%f", &last_weight); + last_weight = av_strtod(p, &p); s->weights[i] = last_weight; s->weight_sum += FFABS(last_weight); + if (p && *p) + p++; + else + break; } for (; i < s->nb_inputs; i++) { |