diff mbox series

[FFmpeg-devel,2/2] avfilter/formats: Remove unused functions

Message ID 20200821135600.24359-2-andreas.rheinhardt@gmail.com
State Accepted
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:56 p.m. UTC
This commit removes ff_parse_sample_format(), ff_parse_time_base() and
ff_query_formats_all_layouts() from libavfilter/formats.c. All of these
functions were completely unused. ff_parse_time_base() has not been used
at all since it had been added in 3448404a707b6e236a2ffa7b0453b3300de41b7b;
the last caller of ff_parse_sample_format has been removed in commit
d1c49bcae9b7fd41df5c6804ac7f6a5c271a7c2e. And the one and only caller of
ff_query_formats_all_layouts() (the asyncts filter) has been removed in
commit a8fe8d6b4a35c95aa94fccde5f001041278d197c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/formats.c  | 42 ++----------------------------------------
 libavfilter/formats.h  |  8 --------
 libavfilter/internal.h | 22 ----------------------
 3 files changed, 2 insertions(+), 70 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 8918118b8e..d2edf832e9 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -24,7 +24,6 @@ 
 #include "libavutil/common.h"
 #include "libavutil/eval.h"
 #include "libavutil/pixdesc.h"
-#include "libavutil/parseutils.h"
 #include "avfilter.h"
 #include "internal.h"
 #include "formats.h"
@@ -604,8 +603,7 @@  int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
                        ff_formats_ref, ff_formats_unref, formats);
 }
 
-static int default_query_formats_common(AVFilterContext *ctx,
-                                        AVFilterChannelLayouts *(layouts)(void))
+int ff_default_query_formats(AVFilterContext *ctx)
 {
     int ret;
     enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :
@@ -616,7 +614,7 @@  static int default_query_formats_common(AVFilterContext *ctx,
     if (ret < 0)
         return ret;
     if (type == AVMEDIA_TYPE_AUDIO) {
-        ret = ff_set_common_channel_layouts(ctx, layouts());
+        ret = ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
         if (ret < 0)
             return ret;
         ret = ff_set_common_samplerates(ctx, ff_all_samplerates());
@@ -627,16 +625,6 @@  static int default_query_formats_common(AVFilterContext *ctx,
     return 0;
 }
 
-int ff_default_query_formats(AVFilterContext *ctx)
-{
-    return default_query_formats_common(ctx, ff_all_channel_counts);
-}
-
-int ff_query_formats_all_layouts(AVFilterContext *ctx)
-{
-    return default_query_formats_common(ctx, ff_all_channel_layouts);
-}
-
 /* internal functions for parsing audio format arguments */
 
 int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
@@ -654,32 +642,6 @@  int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ct
     return 0;
 }
 
-int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx)
-{
-    char *tail;
-    int sfmt = av_get_sample_fmt(arg);
-    if (sfmt == AV_SAMPLE_FMT_NONE) {
-        sfmt = strtol(arg, &tail, 0);
-        if (*tail || av_get_bytes_per_sample(sfmt)<=0) {
-            av_log(log_ctx, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
-            return AVERROR(EINVAL);
-        }
-    }
-    *ret = sfmt;
-    return 0;
-}
-
-int ff_parse_time_base(AVRational *ret, const char *arg, void *log_ctx)
-{
-    AVRational r;
-    if(av_parse_ratio(&r, arg, INT_MAX, 0, log_ctx) < 0 ||r.num<=0  ||r.den<=0) {
-        av_log(log_ctx, AV_LOG_ERROR, "Invalid time base '%s'\n", arg);
-        return AVERROR(EINVAL);
-    }
-    *ret = r;
-    return 0;
-}
-
 int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
 {
     char *tail;
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index dd0cbca6d5..a06e88722e 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -202,14 +202,6 @@  void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
 av_warn_unused_result
 int ff_default_query_formats(AVFilterContext *ctx);
 
- /**
- * Set the formats list to all known channel layouts. This function behaves
- * like ff_default_query_formats(), except it only accepts known channel
- * layouts. It should only be used with audio filters.
- */
-av_warn_unused_result
-int ff_query_formats_all_layouts(AVFilterContext *ctx);
-
 /**
  * Create a list of supported formats. This is intended for use in
  * AVFilter->query_formats().
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index cc208f8e3a..183215d152 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -171,28 +171,6 @@  int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ct
 av_warn_unused_result
 int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx);
 
-/**
- * Parse a time base.
- *
- * @param ret unsigned AVRational pointer to where the value should be written
- * @param arg string to parse
- * @param log_ctx log context
- * @return >= 0 in case of success, a negative AVERROR code on error
- */
-av_warn_unused_result
-int ff_parse_time_base(AVRational *ret, const char *arg, void *log_ctx);
-
-/**
- * Parse a sample format name or a corresponding integer representation.
- *
- * @param ret integer pointer to where the value should be written
- * @param arg string to parse
- * @param log_ctx log context
- * @return >= 0 in case of success, a negative AVERROR code on error
- */
-av_warn_unused_result
-int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx);
-
 /**
  * Parse a channel layout or a corresponding integer representation.
  *