[FFmpeg-cvslog] cmdutils: remove list_fmts(), simplify

Stefano Sabatini git at videolan.org
Sat Mar 26 15:03:28 CET 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sat Mar 12 12:44:22 2011 +0100| [0c55c6d30e0aa07b47645fafc6a817dfbfa2e85b] | committer: Stefano Sabatini

cmdutils: remove list_fmts(), simplify

The function was only used in opt_sample_fmt() for listing the sample
formats. Move list_fmts() functionality directly into
opt_sample_fmt().

Als fix the warning:
ffmpeg.c: In function ‘opt_audio_sample_fmt’:
ffmpeg.c:2877: warning: passing argument 1 of ‘list_fmts’ from incompatible pointer type
cmdutils.h:163: note: expected ‘void (*)(char *, int,  int)’ but argument is of type ‘char * (*)(char *, int,  enum AVSampleFormat)’

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

 cmdutils.c |   10 ----------
 cmdutils.h |    2 --
 ffmpeg.c   |    5 ++++-
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index d44aa9e..5b7b508 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -508,16 +508,6 @@ void show_license(void)
     );
 }
 
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
-{
-    int i;
-    char fmt_str[128];
-    for (i=-1; i < nb_fmts; i++) {
-        get_fmt_string (fmt_str, sizeof(fmt_str), i);
-        fprintf(stdout, "%s\n", fmt_str);
-    }
-}
-
 void show_formats(void)
 {
     AVInputFormat *ifmt=NULL;
diff --git a/cmdutils.h b/cmdutils.h
index adc4403..db84f55 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -161,8 +161,6 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
  */
 void print_error(const char *filename, int err);
 
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
-
 /**
  * Print the program banner to stderr. The banner contents depend on the
  * current version of the repository and of the libav* libraries used by
diff --git a/ffmpeg.c b/ffmpeg.c
index 6f74e61..a8d0dcf 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2850,7 +2850,10 @@ static void opt_audio_sample_fmt(const char *arg)
             ffmpeg_exit(1);
         }
     } else {
-        list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
+        int i;
+        char fmt_str[128];
+        for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
+            printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
         ffmpeg_exit(0);
     }
 }




More information about the ffmpeg-cvslog mailing list