Browse code

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().

Also 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)’

Signed-off-by: Anton Khirnov <anton@khirnov.net>

Stefano Sabatini authored on 2011/03/12 20:44:22
Showing 3 changed files
... ...
@@ -571,16 +571,6 @@ void show_license(void)
571 571
     );
572 572
 }
573 573
 
574
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
575
-{
576
-    int i;
577
-    char fmt_str[128];
578
-    for (i=-1; i < nb_fmts; i++) {
579
-        get_fmt_string (fmt_str, sizeof(fmt_str), i);
580
-        fprintf(stdout, "%s\n", fmt_str);
581
-    }
582
-}
583
-
584 574
 void show_formats(void)
585 575
 {
586 576
     AVInputFormat *ifmt=NULL;
... ...
@@ -161,8 +161,6 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
161 161
  */
162 162
 void print_error(const char *filename, int err);
163 163
 
164
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
165
-
166 164
 /**
167 165
  * Print the program banner to stderr. The banner contents depend on the
168 166
  * current version of the repository and of the libav* libraries used by
... ...
@@ -2859,7 +2859,10 @@ static void opt_audio_sample_fmt(const char *arg)
2859 2859
             ffmpeg_exit(1);
2860 2860
         }
2861 2861
     } else {
2862
-        list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
2862
+        int i;
2863
+        char fmt_str[128];
2864
+        for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
2865
+            printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
2863 2866
         ffmpeg_exit(0);
2864 2867
     }
2865 2868
 }