[FFmpeg-cvslog] avtools: fix show_foo() signatures.

Anton Khirnov git at videolan.org
Mon Aug 20 15:51:39 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 11 16:13:54 2012 +0200| [f617135bc94df0eff6bc5228f6a6430ce160162a] | committer: Anton Khirnov

avtools: fix show_foo() signatures.

show_foo() functions are declared as void show_foo(void), but called as
int show_foo(const char*, const char*).

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

 avconv_opt.c           |    3 ++-
 avplay.c               |    6 ++++--
 avprobe.c              |    3 ++-
 cmdutils.c             |   27 +++++++++++++++++++--------
 cmdutils.h             |   16 ++++++++--------
 cmdutils_common_opts.h |   32 ++++++++++++++++----------------
 6 files changed, 51 insertions(+), 36 deletions(-)

diff --git a/avconv_opt.c b/avconv_opt.c
index dc44986..97ae0a4 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1760,7 +1760,7 @@ static int opt_filter_complex(const char *opt, const char *arg)
     return 0;
 }
 
-static void show_help(void)
+static int show_help(const char *opt, const char *arg)
 {
     int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
     av_log_set_callback(log_callback_help);
@@ -1792,6 +1792,7 @@ static void show_help(void)
     show_help_children(avcodec_get_class(), flags);
     show_help_children(avformat_get_class(), flags);
     show_help_children(sws_get_class(), flags);
+    return 0;
 }
 
 void show_usage(void)
diff --git a/avplay.c b/avplay.c
index 3f2c425..593b38a 100644
--- a/avplay.c
+++ b/avplay.c
@@ -224,7 +224,7 @@ typedef struct VideoState {
     int refresh;
 } VideoState;
 
-static void show_help(void);
+static int show_help(const char *opt, const char *arg);
 
 /* options specified by the user */
 static AVInputFormat *file_iformat;
@@ -2922,7 +2922,7 @@ static void show_usage(void)
     printf("\n");
 }
 
-static void show_help(void)
+static int show_help(const char *opt, const char *arg)
 {
     av_log_set_callback(log_callback_help);
     show_usage();
@@ -2949,6 +2949,8 @@ static void show_help(void)
            "down/up             seek backward/forward 1 minute\n"
            "mouse click         seek to percentage in file corresponding to fraction of width\n"
            );
+
+    return 0;
 }
 
 static void opt_input_file(void *optctx, const char *filename)
diff --git a/avprobe.c b/avprobe.c
index 270bacc..996a138 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -868,13 +868,14 @@ static void opt_input_file(void *optctx, const char *arg)
     input_filename = arg;
 }
 
-static void show_help(void)
+static int show_help(const char *opt, const char *arg)
 {
     av_log_set_callback(log_callback_help);
     show_usage();
     show_help_options(options, "Main options:\n", 0, 0);
     printf("\n");
     show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
+    return 0;
 }
 
 static void opt_pretty(void)
diff --git a/cmdutils.c b/cmdutils.c
index b017490..3b8ab3f 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -510,13 +510,16 @@ void show_banner(void)
     print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE);
 }
 
-void show_version(void) {
+int show_version(const char *opt, const char *arg)
+{
     av_log_set_callback(log_callback_help);
     printf("%s " LIBAV_VERSION "\n", program_name);
     print_all_libs_info(SHOW_VERSION, AV_LOG_INFO);
+
+    return 0;
 }
 
-void show_license(void)
+int show_license(const char *opt, const char *arg)
 {
     printf(
 #if CONFIG_NONFREE
@@ -583,9 +586,11 @@ void show_license(void)
     program_name, program_name, program_name
 #endif
     );
+
+    return 0;
 }
 
-void show_formats(void)
+int show_formats(const char *opt, const char *arg)
 {
     AVInputFormat *ifmt  = NULL;
     AVOutputFormat *ofmt = NULL;
@@ -630,6 +635,7 @@ void show_formats(void)
                name,
             long_name ? long_name:" ");
     }
+    return 0;
 }
 
 static char get_media_type_char(enum AVMediaType type)
@@ -665,7 +671,7 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder)
     printf(")");
 }
 
-void show_codecs(void)
+int show_codecs(const char *opt, const char *arg)
 {
     const AVCodecDescriptor *desc = NULL;
 
@@ -706,6 +712,7 @@ void show_codecs(void)
 
         printf("\n");
     }
+    return 0;
 }
 
 static void print_codecs(int encoder)
@@ -751,7 +758,7 @@ int show_encoders(const char *opt, const char *arg)
     return 0;
 }
 
-void show_bsfs(void)
+int show_bsfs(const char *opt, const char *arg)
 {
     AVBitStreamFilter *bsf = NULL;
 
@@ -759,9 +766,10 @@ void show_bsfs(void)
     while ((bsf = av_bitstream_filter_next(bsf)))
         printf("%s\n", bsf->name);
     printf("\n");
+    return 0;
 }
 
-void show_protocols(void)
+int show_protocols(const char *opt, const char *arg)
 {
     void *opaque = NULL;
     const char *name;
@@ -773,9 +781,10 @@ void show_protocols(void)
     printf("Output:\n");
     while ((name = avio_enum_protocols(&opaque, 1)))
         printf("%s\n", name);
+    return 0;
 }
 
-void show_filters(void)
+int show_filters(const char *opt, const char *arg)
 {
     AVFilter av_unused(**filter) = NULL;
 
@@ -784,9 +793,10 @@ void show_filters(void)
     while ((filter = av_filter_next(filter)) && *filter)
         printf("%-16s %s\n", (*filter)->name, (*filter)->description);
 #endif
+    return 0;
 }
 
-void show_pix_fmts(void)
+int show_pix_fmts(const char *opt, const char *arg)
 {
     enum PixelFormat pix_fmt;
 
@@ -816,6 +826,7 @@ void show_pix_fmts(void)
                pix_desc->nb_components,
                av_get_bits_per_pixel(pix_desc));
     }
+    return 0;
 }
 
 int show_sample_fmts(const char *opt, const char *arg)
diff --git a/cmdutils.h b/cmdutils.h
index d787496..a02d19d 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -258,25 +258,25 @@ void show_banner(void);
  * depends on the current versions of the repository and of the libav*
  * libraries.
  */
-void show_version(void);
+int show_version(const char *opt, const char *arg);
 
 /**
  * Print the license of the program to stdout. The license depends on
  * the license of the libraries compiled into the program.
  */
-void show_license(void);
+int show_license(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the formats supported by the
  * program.
  */
-void show_formats(void);
+int show_formats(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the codecs supported by the
  * program.
  */
-void show_codecs(void);
+int show_codecs(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the decoders supported by the
@@ -294,25 +294,25 @@ int show_encoders(const char *opt, const char *arg);
  * Print a listing containing all the filters supported by the
  * program.
  */
-void show_filters(void);
+int show_filters(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the bit stream filters supported by the
  * program.
  */
-void show_bsfs(void);
+int show_bsfs(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the protocols supported by the
  * program.
  */
-void show_protocols(void);
+int show_protocols(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the pixel formats supported by the
  * program.
  */
-void show_pix_fmts(void);
+int show_pix_fmts(const char *opt, const char *arg);
 
 /**
  * Print a listing containing all the sample formats supported by the
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
index d9a09c0..d66a82e 100644
--- a/cmdutils_common_opts.h
+++ b/cmdutils_common_opts.h
@@ -1,17 +1,17 @@
-    { "L", OPT_EXIT, {(void*)show_license}, "show license" },
-    { "h", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "?", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "help", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "-help", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "version", OPT_EXIT, {(void*)show_version}, "show version" },
-    { "formats"  , OPT_EXIT, {(void*)show_formats  }, "show available formats" },
-    { "codecs"   , OPT_EXIT, {(void*)show_codecs   }, "show available codecs" },
-    { "decoders" , OPT_EXIT, {(void*)show_decoders }, "show available decoders" },
-    { "encoders" , OPT_EXIT, {(void*)show_encoders }, "show available encoders" },
-    { "bsfs"     , OPT_EXIT, {(void*)show_bsfs     }, "show available bit stream filters" },
-    { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
-    { "filters",   OPT_EXIT, {(void*)show_filters  }, "show available filters" },
-    { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
+    { "L"          , OPT_EXIT, {.func_arg = show_license},      "show license" },
+    { "h"          , OPT_EXIT, {.func_arg = show_help},         "show help" },
+    { "?"          , OPT_EXIT, {.func_arg = show_help},         "show help" },
+    { "help"       , OPT_EXIT, {.func_arg = show_help},         "show help" },
+    { "-help"      , OPT_EXIT, {.func_arg = show_help},         "show help" },
+    { "version"    , OPT_EXIT, {.func_arg = show_version},      "show version" },
+    { "formats"    , OPT_EXIT, {.func_arg = show_formats  },    "show available formats" },
+    { "codecs"     , OPT_EXIT, {.func_arg = show_codecs   },    "show available codecs" },
+    { "decoders"   , OPT_EXIT, {.func_arg = show_decoders },    "show available decoders" },
+    { "encoders"   , OPT_EXIT, {.func_arg = show_encoders },    "show available encoders" },
+    { "bsfs"       , OPT_EXIT, {.func_arg = show_bsfs     },    "show available bit stream filters" },
+    { "protocols"  , OPT_EXIT, {.func_arg = show_protocols},    "show available protocols" },
+    { "filters"    , OPT_EXIT, {.func_arg = show_filters  },    "show available filters" },
+    { "pix_fmts"   , OPT_EXIT, {.func_arg = show_pix_fmts },    "show available pixel formats" },
     { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
-    { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
-    { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
+    { "loglevel"   , HAS_ARG,  {.func_arg = opt_loglevel},      "set libav* logging level", "loglevel" },
+    { "v",           HAS_ARG,  {.func_arg = opt_loglevel},      "set libav* logging level", "loglevel" },



More information about the ffmpeg-cvslog mailing list