[FFmpeg-cvslog] avfilter/af_loudnorm: simplify query_formats even more

Paul B Mahol git at videolan.org
Fri May 12 23:46:10 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri May 12 17:49:42 2023 +0200| [e65f03ca1349b3e05ab6b7ab26e3f9a35933ea38] | committer: Paul B Mahol

avfilter/af_loudnorm: simplify query_formats even more

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e65f03ca1349b3e05ab6b7ab26e3f9a35933ea38
---

 libavfilter/af_loudnorm.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 609eae797c..c99d2f11e6 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -730,26 +730,24 @@ static int activate(AVFilterContext *ctx)
 static int query_formats(AVFilterContext *ctx)
 {
     LoudNormContext *s = ctx->priv;
-    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_add_format(&formats, AV_SAMPLE_FMT_DBL);
-    if (ret)
-        return ret;
-    ret = ff_set_common_formats(ctx, formats);
-    if (ret)
+    ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+    if (ret < 0)
         return ret;
 
-    if (s->frame_type != LINEAR_MODE) {
-        formats = ff_make_format_list(input_srate);
+    if (s->frame_type == LINEAR_MODE) {
+        return ff_set_common_all_samplerates(ctx);
     } else {
-        formats = ff_all_samplerates();
+        return ff_set_common_samplerates_from_list(ctx, input_srate);
     }
-
-    return ff_set_common_samplerates(ctx, formats);
 }
 
 static int config_input(AVFilterLink *inlink)



More information about the ffmpeg-cvslog mailing list