[FFmpeg-cvslog] avfilter/af_loudnorm: simplify query_formats()
Paul B Mahol
git at videolan.org
Thu Nov 17 13:34:08 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov 17 10:55:31 2022 +0100| [24cd4c966116bf9b6a00628cdee7e680cb61e2f3] | committer: Paul B Mahol
avfilter/af_loudnorm: simplify query_formats()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24cd4c966116bf9b6a00628cdee7e680cb61e2f3
---
libavfilter/af_loudnorm.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 38a12d161d..609eae797c 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -730,35 +730,26 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
LoudNormContext *s = ctx->priv;
- AVFilterFormats *formats;
- AVFilterLink *inlink = ctx->inputs[0];
- AVFilterLink *outlink = ctx->outputs[0];
+ AVFilterFormats *formats = NULL;
static const int input_srate[] = {192000, -1};
- static const enum AVSampleFormat sample_fmts[] = {
- AV_SAMPLE_FMT_DBL,
- AV_SAMPLE_FMT_NONE
- };
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
- ret = ff_set_common_formats_from_list(ctx, sample_fmts);
- if (ret < 0)
+ ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL);
+ if (ret)
+ return ret;
+ ret = ff_set_common_formats(ctx, formats);
+ if (ret)
return ret;
if (s->frame_type != LINEAR_MODE) {
formats = ff_make_format_list(input_srate);
- if (!formats)
- return AVERROR(ENOMEM);
- ret = ff_formats_ref(formats, &inlink->outcfg.samplerates);
- if (ret < 0)
- return ret;
- ret = ff_formats_ref(formats, &outlink->incfg.samplerates);
- if (ret < 0)
- return ret;
+ } else {
+ formats = ff_all_samplerates();
}
- return 0;
+ return ff_set_common_samplerates(ctx, formats);
}
static int config_input(AVFilterLink *inlink)
More information about the ffmpeg-cvslog
mailing list