typedef struct AudioDelayContext {
const AVClass *class;
+ int all;
char *delays;
ChanDelay *chandelay;
int nb_delays;
static const AVOption adelay_options[] = {
{ "delays", "set list of delays for each channel", OFFSET(delays), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
+ { "all", "use last available delay for remained channels", OFFSET(all), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ NULL }
};
ret = av_sscanf(arg, "%d%c", &d->delay, &type);
if (ret != 2 || type != 'S') {
div = type == 's' ? 1.0 : 1000.0;
- av_sscanf(arg, "%f", &delay);
+ if (av_sscanf(arg, "%f", &delay) != 1) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid syntax for delay.\n");
+ return AVERROR(EINVAL);
+ }
d->delay = delay * inlink->sample_rate / div;
}
}
}
+ if (s->all && i) {
+ for (int j = i; j < s->nb_delays; j++)
+ s->chandelay[j].delay = s->chandelay[i-1].delay;
+ }
+
s->padding = s->chandelay[0].delay;
for (i = 1; i < s->nb_delays; i++) {
ChanDelay *d = &s->chandelay[i];