Commit 69cf626f authored by Stephen Hutchinson's avatar Stephen Hutchinson Committed by Michael Niedermayer

cmdutils: Add -buildconf option.

The output is formatted to display one option per line.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d5d29ae3
...@@ -1079,6 +1079,32 @@ static void print_program_info(int flags, int level) ...@@ -1079,6 +1079,32 @@ static void print_program_info(int flags, int level)
av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent); av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent);
} }
static void print_buildconf(int flags, int level)
{
const char *indent = flags & INDENT? " " : "";
char str[] = { FFMPEG_CONFIGURATION };
char *conflist, *remove_tilde, *splitconf;
// Change all the ' --' strings to '~--' so that
// they can be identified as tokens.
while( (conflist = strstr(str, " --")) != NULL ) {
strncpy(conflist, "~--", 3);
}
// Compensate for the weirdness this would cause
// when passing 'pkg-config --static'.
while( (remove_tilde = strstr(str, "pkg-config~")) != NULL ) {
strncpy(remove_tilde, "pkg-config ",11);
}
splitconf = strtok(str, "~");
av_log(NULL, level, "\n%sconfiguration:\n",indent);
while(splitconf != NULL) {
av_log(NULL, level, "%s%s%s\n", indent, indent, splitconf);
splitconf = strtok(NULL, "~");
}
}
void show_banner(int argc, char **argv, const OptionDef *options) void show_banner(int argc, char **argv, const OptionDef *options)
{ {
int idx = locate_option(argc, argv, options, "version"); int idx = locate_option(argc, argv, options, "version");
...@@ -1099,6 +1125,14 @@ int show_version(void *optctx, const char *opt, const char *arg) ...@@ -1099,6 +1125,14 @@ int show_version(void *optctx, const char *opt, const char *arg)
return 0; return 0;
} }
int show_buildconf(void *optctx, const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
print_buildconf (INDENT|0, AV_LOG_INFO);
return 0;
}
int show_license(void *optctx, const char *opt, const char *arg) int show_license(void *optctx, const char *opt, const char *arg)
{ {
#if CONFIG_NONFREE #if CONFIG_NONFREE
......
...@@ -414,6 +414,13 @@ void show_banner(int argc, char **argv, const OptionDef *options); ...@@ -414,6 +414,13 @@ void show_banner(int argc, char **argv, const OptionDef *options);
*/ */
int show_version(void *optctx, const char *opt, const char *arg); int show_version(void *optctx, const char *opt, const char *arg);
/**
* Print the build configuration of the program to stdout. The contents
* depend on the definition of FFMPEG_CONFIGURATION.
* This option processing function does not utilize the arguments.
*/
int show_buildconf(void *optctx, const char *opt, const char *arg);
/** /**
* Print the license of the program to stdout. The license depends on * Print the license of the program to stdout. The license depends on
* the license of the libraries compiled into the program. * the license of the libraries compiled into the program.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
{ "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, { "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, { "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "version" , OPT_EXIT, {.func_arg = show_version}, "show version" }, { "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
{ "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" },
{ "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" }, { "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
{ "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" }, { "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
{ "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" }, { "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment