[FFmpeg-devel] [PATCH] cmdutils: make show_usage() use av_log()

Stefano Sabatini stefasab at gmail.com
Fri Jan 6 19:13:48 CET 2012


Avoid printing on stdout when show_usage is used in an error message.
---
 avconv.c  |    6 +++---
 ffmpeg.c  |    6 +++---
 ffplay.c  |    6 +++---
 ffprobe.c |    6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/avconv.c b/avconv.c
index e02139d..92a5257 100644
--- a/avconv.c
+++ b/avconv.c
@@ -4187,9 +4187,9 @@ static int opt_audio_qscale(OptionsContext *o, const char *opt, const char *arg)
 
 static void show_usage(void)
 {
-    printf("Hyper fast Audio and Video encoder\n");
-    printf("usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
-    printf("\n");
+    av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n");
+    av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
+    av_log(NULL, AV_LOG_INFO, printf("\n");
 }
 
 static int opt_help(const char *opt, const char *arg)
diff --git a/ffmpeg.c b/ffmpeg.c
index 5bef906..bba1a3b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4593,9 +4593,9 @@ static int opt_audio_qscale(OptionsContext *o, const char *opt, const char *arg)
 
 static void show_usage(void)
 {
-    printf("Hyper fast Audio and Video encoder\n");
-    printf("usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
-    printf("\n");
+    av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n");
+    av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
+    av_log(NULL, AV_LOG_INFO, "\n");
 }
 
 static int opt_help(const char *opt, const char *arg)
diff --git a/ffplay.c b/ffplay.c
index 1a1b3f7..1c4289c 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3105,9 +3105,9 @@ static const OptionDef options[] = {
 
 static void show_usage(void)
 {
-    printf("Simple media player\n");
-    printf("usage: %s [options] input_file\n", program_name);
-    printf("\n");
+    av_log(NULL, AV_LOG_INFO, "Simple media player\n");
+    av_log(NULL, AV_LOG_INFO, "usage: %s [options] input_file\n", program_name);
+    av_log(NULL, AV_LOG_INFO, "\n");
 }
 
 static int opt_help(const char *opt, const char *arg)
diff --git a/ffprobe.c b/ffprobe.c
index eea3d2c..22fdf5f 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1410,9 +1410,9 @@ static int probe_file(WriterContext *wctx, const char *filename)
 
 static void show_usage(void)
 {
-    printf("Simple multimedia streams analyzer\n");
-    printf("usage: %s [OPTIONS] [INPUT_FILE]\n", program_name);
-    printf("\n");
+    av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
+    av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] [INPUT_FILE]\n", program_name);
+    av_log(NULL, AV_LOG_INFO, "\n");
 }
 
 static int opt_format(const char *opt, const char *arg)
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list