diff mbox series

[FFmpeg-devel,1/2] avfilter/audio: Remove unused array, move used-only-once array

Message ID 20200821135600.24359-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 2e0fd50319583afaa546a20222b885b304912f98
Headers show
Series [FFmpeg-devel,1/2] avfilter/audio: Remove unused array, move used-only-once array | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 21, 2020, 1:55 p.m. UTC
ff_planar_sample_fmts_array is unused (and was unused since it was added
in 4d4098da009c8340997b8d1abedbf2062e4aa991) and therefore this commit
removes it; ff_packed_sample_fmts_array meanwhile is used only once (in
the amerge filter) and therefore it has been moved to this place.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/af_amerge.c | 10 +++++++++-
 libavfilter/audio.h     | 18 ------------------
 2 files changed, 9 insertions(+), 19 deletions(-)

Comments

Paul B Mahol Aug. 21, 2020, 2:02 p.m. UTC | #1
On 8/21/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> ff_planar_sample_fmts_array is unused (and was unused since it was added
> in 4d4098da009c8340997b8d1abedbf2062e4aa991) and therefore this commit
> removes it; ff_packed_sample_fmts_array meanwhile is used only once (in
> the amerge filter) and therefore it has been moved to this place.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/af_amerge.c | 10 +++++++++-
>  libavfilter/audio.h     | 18 ------------------
>  2 files changed, 9 insertions(+), 19 deletions(-)
>

LGTM, but please wait for others comments.

> diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
> index 567f25982d..ca94a224af 100644
> --- a/libavfilter/af_amerge.c
> +++ b/libavfilter/af_amerge.c
> @@ -69,6 +69,14 @@ static av_cold void uninit(AVFilterContext *ctx)
>
>  static int query_formats(AVFilterContext *ctx)
>  {
> +    static const enum AVSampleFormat packed_sample_fmts[] = {
> +        AV_SAMPLE_FMT_U8,
> +        AV_SAMPLE_FMT_S16,
> +        AV_SAMPLE_FMT_S32,
> +        AV_SAMPLE_FMT_FLT,
> +        AV_SAMPLE_FMT_DBL,
> +        AV_SAMPLE_FMT_NONE
> +    };
>      AMergeContext *s = ctx->priv;
>      int64_t inlayout[SWR_CH_MAX], outlayout = 0;
>      AVFilterFormats *formats;
> @@ -124,7 +132,7 @@ static int query_formats(AVFilterContext *ctx)
>                  if ((inlayout[i] >> c) & 1)
>                      *(route[i]++) = out_ch_number++;
>      }
> -    formats = ff_make_format_list(ff_packed_sample_fmts_array);
> +    formats = ff_make_format_list(packed_sample_fmts);
>      if ((ret = ff_set_common_formats(ctx, formats)) < 0)
>          return ret;
>      for (i = 0; i < s->nb_inputs; i++) {
> diff --git a/libavfilter/audio.h b/libavfilter/audio.h
> index 6adc82dc81..6bbe6ee9ef 100644
> --- a/libavfilter/audio.h
> +++ b/libavfilter/audio.h
> @@ -25,24 +25,6 @@
>  #include "avfilter.h"
>  #include "internal.h"
>
> -static const enum AVSampleFormat ff_packed_sample_fmts_array[] = {
> -    AV_SAMPLE_FMT_U8,
> -    AV_SAMPLE_FMT_S16,
> -    AV_SAMPLE_FMT_S32,
> -    AV_SAMPLE_FMT_FLT,
> -    AV_SAMPLE_FMT_DBL,
> -    AV_SAMPLE_FMT_NONE
> -};
> -
> -static const enum AVSampleFormat ff_planar_sample_fmts_array[] = {
> -    AV_SAMPLE_FMT_U8P,
> -    AV_SAMPLE_FMT_S16P,
> -    AV_SAMPLE_FMT_S32P,
> -    AV_SAMPLE_FMT_FLTP,
> -    AV_SAMPLE_FMT_DBLP,
> -    AV_SAMPLE_FMT_NONE
> -};
> -
>  /** default handler for get_audio_buffer() for audio inputs */
>  AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples);
>
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Nicolas George Aug. 21, 2020, 3:37 p.m. UTC | #2
Andreas Rheinhardt (12020-08-21):
> ff_planar_sample_fmts_array is unused (and was unused since it was added
> in 4d4098da009c8340997b8d1abedbf2062e4aa991) and therefore this commit
> removes it; ff_packed_sample_fmts_array meanwhile is used only once (in
> the amerge filter) and therefore it has been moved to this place.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/af_amerge.c | 10 +++++++++-
>  libavfilter/audio.h     | 18 ------------------
>  2 files changed, 9 insertions(+), 19 deletions(-)

LGTM to both, thanks.

Regards,
diff mbox series

Patch

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 567f25982d..ca94a224af 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -69,6 +69,14 @@  static av_cold void uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
+    static const enum AVSampleFormat packed_sample_fmts[] = {
+        AV_SAMPLE_FMT_U8,
+        AV_SAMPLE_FMT_S16,
+        AV_SAMPLE_FMT_S32,
+        AV_SAMPLE_FMT_FLT,
+        AV_SAMPLE_FMT_DBL,
+        AV_SAMPLE_FMT_NONE
+    };
     AMergeContext *s = ctx->priv;
     int64_t inlayout[SWR_CH_MAX], outlayout = 0;
     AVFilterFormats *formats;
@@ -124,7 +132,7 @@  static int query_formats(AVFilterContext *ctx)
                 if ((inlayout[i] >> c) & 1)
                     *(route[i]++) = out_ch_number++;
     }
-    formats = ff_make_format_list(ff_packed_sample_fmts_array);
+    formats = ff_make_format_list(packed_sample_fmts);
     if ((ret = ff_set_common_formats(ctx, formats)) < 0)
         return ret;
     for (i = 0; i < s->nb_inputs; i++) {
diff --git a/libavfilter/audio.h b/libavfilter/audio.h
index 6adc82dc81..6bbe6ee9ef 100644
--- a/libavfilter/audio.h
+++ b/libavfilter/audio.h
@@ -25,24 +25,6 @@ 
 #include "avfilter.h"
 #include "internal.h"
 
-static const enum AVSampleFormat ff_packed_sample_fmts_array[] = {
-    AV_SAMPLE_FMT_U8,
-    AV_SAMPLE_FMT_S16,
-    AV_SAMPLE_FMT_S32,
-    AV_SAMPLE_FMT_FLT,
-    AV_SAMPLE_FMT_DBL,
-    AV_SAMPLE_FMT_NONE
-};
-
-static const enum AVSampleFormat ff_planar_sample_fmts_array[] = {
-    AV_SAMPLE_FMT_U8P,
-    AV_SAMPLE_FMT_S16P,
-    AV_SAMPLE_FMT_S32P,
-    AV_SAMPLE_FMT_FLTP,
-    AV_SAMPLE_FMT_DBLP,
-    AV_SAMPLE_FMT_NONE
-};
-
 /** default handler for get_audio_buffer() for audio inputs */
 AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples);