avfilter/adynamicequalizer_template: refactor and improve output

This commit is contained in:
Paul B Mahol
2023-07-05 01:11:22 +02:00
parent 9ff834c2a0
commit 8622dcb39b
2 changed files with 20 additions and 38 deletions

View File

@@ -96,26 +96,16 @@ static int config_input(AVFilterLink *inlink)
AudioDynamicEqualizerContext *s = ctx->priv;
s->format = inlink->format;
s->state = ff_get_audio_buffer(inlink, 8);
s->state = ff_get_audio_buffer(inlink, 16);
if (!s->state)
return AVERROR(ENOMEM);
switch (s->format) {
case AV_SAMPLE_FMT_DBLP:
for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
double *state = (double *)s->state->extended_data[ch];
state[4] = 1.;
}
s->filter_prepare = filter_prepare_double;
s->filter_channels = filter_channels_double;
break;
case AV_SAMPLE_FMT_FLTP:
for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
float *state = (float *)s->state->extended_data[ch];
state[4] = 1.;
}
s->filter_prepare = filter_prepare_float;
s->filter_channels = filter_channels_float;
break;