On 10/4/11 10:01 PM, Anton Khirnov wrote:
-void show_banner(void) +void show_banner(int argc, char **argv) { + char *params; + int i, argv_len = 0; + + for (i=1; i<argc; i++) + argv_len += strlen(argv[i]); + + params = av_mallocz(argv_len + argc + 1); + for (i=1; i<argc; i++) { + strcat(params, argv[i]); + strcat(params, " "); + } + if (strlen(params)) + params[strlen(params)-1] = '\0'; +Why all the copying? Why don't you just print them directly?
Umm...brain fart on my side. You are obviously correct, see the attached. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/
From 432acf9a78cb424374509a7b2fc75e08ba0eb615 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski <[email protected]> Date: Tue, 4 Oct 2011 15:45:22 +0300 Subject: [PATCH] Print command line parameters in show_banner(). When requesting debug info the user is already instructed to copy the full program output but in addition to that it needs to provide how the program was called. With this change all command line parameters that are used are shown in the output when verbose output is enabled. --- avconv.c | 2 +- avplay.c | 2 +- avprobe.c | 2 +- avserver.c | 2 +- cmdutils.c | 9 ++++++++- cmdutils.h | 2 +- ffmpeg.c | 2 +- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/avconv.c b/avconv.c index c418b7c..c91d85a 100644 --- a/avconv.c +++ b/avconv.c @@ -4071,7 +4071,7 @@ int main(int argc, char **argv) avio_set_interrupt_cb(decode_interrupt_cb); - show_banner(); + show_banner(argc, argv); /* parse options */ parse_options(&o, argc, argv, options, opt_output_file); diff --git a/avplay.c b/avplay.c index 2eea5d7..83f30ff 100644 --- a/avplay.c +++ b/avplay.c @@ -3064,7 +3064,7 @@ int main(int argc, char **argv) init_opts(); - show_banner(); + show_banner(argc, argv); parse_options(NULL, argc, argv, options, opt_input_file); diff --git a/avprobe.c b/avprobe.c index ae22dac..75de18c 100644 --- a/avprobe.c +++ b/avprobe.c @@ -406,7 +406,7 @@ int main(int argc, char **argv) avdevice_register_all(); #endif - show_banner(); + show_banner(argc, argv); parse_options(NULL, argc, argv, options, opt_input_file); if (!input_filename) { diff --git a/avserver.c b/avserver.c index 7b8bf13..e79fed3 100644 --- a/avserver.c +++ b/avserver.c @@ -4672,7 +4672,7 @@ int main(int argc, char **argv) parse_loglevel(argc, argv, options); av_register_all(); - show_banner(); + show_banner(argc, argv); my_program_name = argv[0]; my_program_dir = getcwd(0, 0); diff --git a/cmdutils.c b/cmdutils.c index 2c37880..eccafc7 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -474,13 +474,20 @@ static void print_all_libs_info(int flags, int level) PRINT_LIB_INFO(postproc, POSTPROC, flags, level); } -void show_banner(void) +void show_banner(int argc, char **argv) { + int i; + av_log(NULL, AV_LOG_INFO, "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav 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_VERBOSE, " configuration: " LIBAV_CONFIGURATION "\n"); + av_log(NULL, AV_LOG_VERBOSE, " parameters :"); + for (i=1; i<argc; i++) { + av_log(NULL, AV_LOG_VERBOSE, " %s", argv[i]); + } + av_log(NULL, AV_LOG_VERBOSE, "\n"); print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_VERBOSE); print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE); } diff --git a/cmdutils.h b/cmdutils.h index a20b779..ba3686e 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -231,7 +231,7 @@ void print_error(const char *filename, int err); * current version of the repository and of the libav* libraries used by * the program. */ -void show_banner(void); +void show_banner(int argc, char **argv); /** * Print the version of the program to stdout. The version message diff --git a/ffmpeg.c b/ffmpeg.c index 86b73b2..f880660 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -4372,7 +4372,7 @@ int main(int argc, char **argv) init_opts(); - show_banner(); + show_banner(argc, argv); av_log(NULL, AV_LOG_WARNING, "This program is not developed anymore and is only " "provided for compatibility. Use avconv instead " -- 1.7.5.1
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
