Around 10/05/2011 03:14 PM, Georgi Chorbadzhiyski scribbled:
> Around 10/05/2011 03:03 PM, Diego Biurrun scribbled:
>>> --- a/cmdutils.c
>>> +++ b/cmdutils.c
>>> @@ -474,13 +474,35 @@ static void print_all_libs_info(int flags, int level)
>>>  
>>>      av_log(NULL, AV_LOG_VERBOSE, "  configuration: " LIBAV_CONFIGURATION 
>>> "\n");
>>> +    av_log(NULL, AV_LOG_VERBOSE, "  parameters   :");
>>> +    for (i=1; i<argc; i++) {
>>
>> Please give the operators some space to breathe, more instances below.
> 
> Done.

Dammit I'm blind today...

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
>From e0ce3ae192732061df400ea6ec1f70582f7b8649 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 |   24 +++++++++++++++++++++++-
 cmdutils.h |    2 +-
 ffmpeg.c   |    2 +-
 7 files changed, 29 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..6652070 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -474,13 +474,35 @@ 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++) {
+        int r, have_spaces = 0, have_quotes = 0, len = strlen(argv[i]);
+        for (r = 0; r < len; r++) {
+            if (isspace(argv[i][r]))
+                have_spaces = 1;
+            if (argv[i][r] == '"')
+                have_quotes = 1;
+        }
+        if (!have_quotes) {
+            av_log(NULL, AV_LOG_VERBOSE, have_spaces ? " \"%s\"" : " %s", 
argv[i]);
+        } else {
+            av_log(NULL, AV_LOG_VERBOSE, have_spaces ? " \"" : " ");
+            for (r = 0; r < len; r++)
+                av_log(NULL, AV_LOG_VERBOSE, argv[i][r] == '"' ? "\\%c" : 
"%c", argv[i][r]);
+            if (have_spaces)
+                av_log(NULL, AV_LOG_VERBOSE, "\"");
+        }
+    }
+    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

Reply via email to