diff mbox series

[FFmpeg-devel,05/10] avfilter/af_loudnorm: Simplify setting common samplerates

Message ID AM7PR03MB66604FB4E8AF674BB33FFC4B8FF89@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,1/3] avfilter/avfilter: Fix leaks upon filter creation error
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 11, 2021, 1:17 a.m. UTC
This filter has only one input and output, so what it does
can be more easily achieved by using ff_set_common_samplerates().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/af_loudnorm.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 54a58bb9a1..8bfb5ccc74 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -684,9 +684,6 @@  static int request_frame(AVFilterLink *outlink)
 static int query_formats(AVFilterContext *ctx)
 {
     LoudNormContext *s = ctx->priv;
-    AVFilterFormats *formats;
-    AVFilterLink *inlink = ctx->inputs[0];
-    AVFilterLink *outlink = ctx->outputs[0];
     static const int input_srate[] = {192000, -1};
     static const enum AVSampleFormat sample_fmts[] = {
         AV_SAMPLE_FMT_DBL,
@@ -701,13 +698,7 @@  static int query_formats(AVFilterContext *ctx)
         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);
+        ret = ff_set_common_samplerates_from_list(ctx, input_srate);
         if (ret < 0)
             return ret;
     }