diff options
author | James Almer <jamrial@gmail.com> | 2021-08-31 11:03:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:46 -0300 |
commit | 1f96db959c1235bb7079d354e09914a0a2608f62 (patch) | |
tree | 21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/af_silencedetect.c | |
parent | 8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff) |
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/af_silencedetect.c')
-rw-r--r-- | libavfilter/af_silencedetect.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 0ba76469de..6518283d9f 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -136,12 +136,12 @@ static void silencedetect_##name(SilenceDetectContext *s, AVFrame *insamples, int nb_samples, int64_t nb_samples_notify, \ AVRational time_base) \ { \ - const int channels = insamples->channels; \ + const int channels = insamples->ch_layout.nb_channels; \ const type noise = s->noise; \ \ nb_samples /= channels; \ for (int i = 0; i < nb_samples; i++) { \ - for (int ch = 0; ch < insamples->channels; ch++) { \ + for (int ch = 0; ch < insamples->ch_layout.nb_channels; ch++) { \ const type *p = (const type *)insamples->extended_data[ch]; \ update(s, insamples, p[i] < noise && p[i] > -noise, \ channels * i + ch, \ @@ -166,7 +166,7 @@ static int config_input(AVFilterLink *inlink) SilenceDetectContext *s = ctx->priv; int c; - s->channels = inlink->channels; + s->channels = inlink->ch_layout.nb_channels; s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); s->independent_channels = s->mono ? s->channels : 1; s->nb_null_samples = av_calloc(s->independent_channels, @@ -210,7 +210,7 @@ static int config_input(AVFilterLink *inlink) static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) { SilenceDetectContext *s = inlink->dst->priv; - const int nb_channels = inlink->channels; + const int nb_channels = inlink->ch_layout.nb_channels; const int srate = inlink->sample_rate; const int nb_samples = insamples->nb_samples * nb_channels; const int64_t nb_samples_notify = s->duration * (s->mono ? 1 : nb_channels); |