summaryrefslogtreecommitdiff
path: root/libavfilter/af_afftfilt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/af_afftfilt.c')
-rw-r--r--libavfilter/af_afftfilt.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
index fc23eb0983..a5d3dfe307 100644
--- a/libavfilter/af_afftfilt.c
+++ b/libavfilter/af_afftfilt.c
@@ -109,7 +109,7 @@ static int config_input(AVFilterLink *inlink)
const char *last_expr = "1";
int buf_size;
- s->channels = inlink->channels;
+ s->channels = inlink->ch_layout.nb_channels;
ret = av_tx_init(&s->fft, &s->tx_fn, AV_TX_FLOAT_FFT, 0, s->fft_size, &scale, 0);
if (ret < 0)
return ret;
@@ -121,19 +121,19 @@ static int config_input(AVFilterLink *inlink)
s->window_size = s->fft_size;
buf_size = FFALIGN(s->window_size, av_cpu_max_align());
- s->fft_in = av_calloc(inlink->channels, sizeof(*s->fft_in));
+ s->fft_in = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_in));
if (!s->fft_in)
return AVERROR(ENOMEM);
- s->fft_out = av_calloc(inlink->channels, sizeof(*s->fft_out));
+ s->fft_out = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_out));
if (!s->fft_out)
return AVERROR(ENOMEM);
- s->fft_temp = av_calloc(inlink->channels, sizeof(*s->fft_temp));
+ s->fft_temp = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_temp));
if (!s->fft_temp)
return AVERROR(ENOMEM);
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
s->fft_in[ch] = av_calloc(buf_size, sizeof(**s->fft_in));
if (!s->fft_in[ch])
return AVERROR(ENOMEM);
@@ -147,11 +147,11 @@ static int config_input(AVFilterLink *inlink)
return AVERROR(ENOMEM);
}
- s->real = av_calloc(inlink->channels, sizeof(*s->real));
+ s->real = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->real));
if (!s->real)
return AVERROR(ENOMEM);
- s->imag = av_calloc(inlink->channels, sizeof(*s->imag));
+ s->imag = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->imag));
if (!s->imag)
return AVERROR(ENOMEM);
@@ -159,7 +159,7 @@ static int config_input(AVFilterLink *inlink)
if (!args)
return AVERROR(ENOMEM);
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
char *arg = av_strtok(ch == 0 ? args : NULL, "|", &saveptr);
ret = av_expr_parse(&s->real[ch], arg ? arg : last_expr, var_names,
@@ -179,7 +179,7 @@ static int config_input(AVFilterLink *inlink)
saveptr = NULL;
last_expr = "1";
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
char *arg = av_strtok(ch == 0 ? args : NULL, "|", &saveptr);
ret = av_expr_parse(&s->imag[ch], arg ? arg : last_expr, var_names,
@@ -232,7 +232,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int ch, n, ret, i;
AVFrame *out;
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
const int offset = s->window_size - s->hop_size;
float *src = (float *)s->window->extended_data[ch];
AVComplexFloat *fft_in = s->fft_in[ch];
@@ -250,16 +250,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
values[VAR_PTS] = in->pts;
values[VAR_SAMPLE_RATE] = inlink->sample_rate;
values[VAR_NBBINS] = window_size / 2;
- values[VAR_CHANNELS] = inlink->channels;
+ values[VAR_CHANNELS] = inlink->ch_layout.nb_channels;
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
AVComplexFloat *fft_in = s->fft_in[ch];
AVComplexFloat *fft_out = s->fft_out[ch];
s->tx_fn(s->fft, fft_out, fft_in, sizeof(float));
}
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
AVComplexFloat *fft_out = s->fft_out[ch];
AVComplexFloat *fft_temp = s->fft_temp[ch];
float *buf = (float *)s->buffer->extended_data[ch];
@@ -309,7 +309,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out->pts = in->pts;
out->nb_samples = in->nb_samples;
- for (ch = 0; ch < inlink->channels; ch++) {
+ for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
float *dst = (float *)out->extended_data[ch];
float *buf = (float *)s->buffer->extended_data[ch];