aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-01-01 16:42:35 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-01-06 10:43:30 +0100
commit9ac58ba1332d882964649c69686091e04f27dd26 (patch)
tree43c824cbdc84d712d8d524ca5cfa5638338e35dc /cmdutils.c
parent3edff185abfdd089b88ecc5770e5f6a963055a97 (diff)
downloadffmpeg-9ac58ba1332d882964649c69686091e04f27dd26.tar.gz
cmdutils: add print_program_info() used in both show_banner() and show_version()
This also make -version show program configuration and compilation information, which was previously shown only in the banner.
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/cmdutils.c b/cmdutils.c
index e86f8455ec..0ab98e85b7 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -569,6 +569,7 @@ static int warned_cfg = 0;
#define INDENT 1
#define SHOW_VERSION 2
#define SHOW_CONFIG 4
+#define SHOW_COPYRIGHT 8
#define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
if (CONFIG_##LIBNAME) { \
@@ -609,25 +610,34 @@ static void print_all_libs_info(int flags, int level)
PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
}
+static void print_program_info(int flags, int level)
+{
+ const char *indent = flags & INDENT? " " : "";
+
+ av_log(NULL, level, "%s version " FFMPEG_VERSION, program_name);
+ if (flags & SHOW_COPYRIGHT)
+ av_log(NULL, level, " Copyright (c) %d-%d the FFmpeg developers",
+ program_birth_year, this_year);
+ av_log(NULL, level, "\n");
+ av_log(NULL, level, "%sbuilt on %s %s with %s %s\n",
+ indent, __DATE__, __TIME__, CC_TYPE, CC_VERSION);
+ av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent);
+}
+
void show_banner(int argc, char **argv, const OptionDef *options)
{
int idx = locate_option(argc, argv, options, "version");
if (idx)
return;
- av_log(NULL, AV_LOG_INFO,
- "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n",
- program_name, program_birth_year, this_year);
- av_log(NULL, AV_LOG_INFO, " built on %s %s with %s %s\n",
- __DATE__, __TIME__, CC_TYPE, CC_VERSION);
- av_log(NULL, AV_LOG_INFO, " configuration: " FFMPEG_CONFIGURATION "\n");
+ print_program_info (INDENT|SHOW_COPYRIGHT, AV_LOG_INFO);
print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_INFO);
print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO);
}
int opt_version(const char *opt, const char *arg) {
av_log_set_callback(log_callback_help);
- printf("%s " FFMPEG_VERSION "\n", program_name);
+ print_program_info (0 , AV_LOG_INFO);
print_all_libs_info(SHOW_VERSION, AV_LOG_INFO);
return 0;
}