aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_agate.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-08-31 11:03:14 -0300
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:46 -0300
commit1f96db959c1235bb7079d354e09914a0a2608f62 (patch)
tree21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/af_agate.c
parent8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff)
downloadffmpeg-1f96db959c1235bb7079d354e09914a0a2608f62.tar.gz
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/af_agate.c')
-rw-r--r--libavfilter/af_agate.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c
index 682f17c7dd..8e93a3a82b 100644
--- a/libavfilter/af_agate.c
+++ b/libavfilter/af_agate.c
@@ -150,19 +150,19 @@ static void gate(AudioGateContext *s,
const double release_coeff = s->release_coeff;
int n, c;
- for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) {
+ for (n = 0; n < nb_samples; n++, src += inlink->ch_layout.nb_channels, dst += inlink->ch_layout.nb_channels, scsrc += sclink->ch_layout.nb_channels) {
double abs_sample = fabs(scsrc[0] * level_sc), gain = 1.0;
double factor;
int detected;
if (s->link == 1) {
- for (c = 1; c < sclink->channels; c++)
+ for (c = 1; c < sclink->ch_layout.nb_channels; c++)
abs_sample = FFMAX(fabs(scsrc[c] * level_sc), abs_sample);
} else {
- for (c = 1; c < sclink->channels; c++)
+ for (c = 1; c < sclink->ch_layout.nb_channels; c++)
abs_sample += fabs(scsrc[c] * level_sc);
- abs_sample /= sclink->channels;
+ abs_sample /= sclink->ch_layout.nb_channels;
}
if (s->detection)
@@ -181,7 +181,7 @@ static void gate(AudioGateContext *s,
s->range, s->mode);
factor = ctx->is_disabled ? 1.f : level_in * gain * makeup;
- for (c = 0; c < inlink->channels; c++)
+ for (c = 0; c < inlink->ch_layout.nb_channels; c++)
dst[c] = src[c] * factor;
}
}
@@ -344,8 +344,8 @@ static int scconfig_output(AVFilterLink *outlink)
outlink->time_base = ctx->inputs[0]->time_base;
- s->fifo[0] = av_audio_fifo_alloc(ctx->inputs[0]->format, ctx->inputs[0]->channels, 1024);
- s->fifo[1] = av_audio_fifo_alloc(ctx->inputs[1]->format, ctx->inputs[1]->channels, 1024);
+ s->fifo[0] = av_audio_fifo_alloc(ctx->inputs[0]->format, ctx->inputs[0]->ch_layout.nb_channels, 1024);
+ s->fifo[1] = av_audio_fifo_alloc(ctx->inputs[1]->format, ctx->inputs[1]->ch_layout.nb_channels, 1024);
if (!s->fifo[0] || !s->fifo[1])
return AVERROR(ENOMEM);