summaryrefslogtreecommitdiff
path: root/libavfilter/af_compensationdelay.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/af_compensationdelay.c')
-rw-r--r--libavfilter/af_compensationdelay.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavfilter/af_compensationdelay.c b/libavfilter/af_compensationdelay.c
index 90c2d13c00..c59ebdca91 100644
--- a/libavfilter/af_compensationdelay.c
+++ b/libavfilter/af_compensationdelay.c
@@ -68,6 +68,7 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
CompensationDelayContext *s = ctx->priv;
unsigned min_size, new_size = 1;
+ int ret;
s->delay = (s->distance_m * 100. + s->distance_cm * 1. + s->distance_mm * .1) *
COMP_DELAY_SOUND_FRONT_DELAY(s->temp) * inlink->sample_rate;
@@ -83,8 +84,14 @@ static int config_input(AVFilterLink *inlink)
s->buf_size = new_size;
s->delay_frame->format = inlink->format;
s->delay_frame->nb_samples = new_size;
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
s->delay_frame->channel_layout = inlink->channel_layout;
- s->delay_frame->channels = inlink->channels;
+ s->delay_frame->channels = inlink->ch_layout.nb_channels;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ if ((ret = av_channel_layout_copy(&s->delay_frame->ch_layout, &inlink->ch_layout)) < 0)
+ return ret;
return av_frame_get_buffer(s->delay_frame, 0);
}
@@ -110,7 +117,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
av_frame_copy_props(out, in);
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
const double *src = (const double *)in->extended_data[ch];
double *dst = (double *)out->extended_data[ch];
double *buffer = (double *)s->delay_frame->extended_data[ch];