[FFmpeg-cvslog] ffprobe: move header and trailer print from probe_file() to main()

Stefano Sabatini git at videolan.org
Sat Jan 7 11:09:06 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Jan  6 18:45:08 2012 +0100| [9ecccd6e5a21e3d9091a9e8dd40221b6812cb17e] | committer: Stefano Sabatini

ffprobe: move header and trailer print from probe_file() to main()

Simplify printing from the main() context, in case probe_file() is not
called, as required by the pending -show_version option.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ecccd6e5a21e3d9091a9e8dd40221b6812cb17e
---

 ffprobe.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 08dc2a4..4a03dba 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1397,17 +1397,13 @@ static int probe_file(WriterContext *wctx, const char *filename)
     AVFormatContext *fmt_ctx;
     int ret;
 
-    writer_print_header(wctx);
     ret = open_input_file(&fmt_ctx, filename);
     if (ret >= 0) {
         PRINT_CHAPTER(packets);
         PRINT_CHAPTER(streams);
         PRINT_CHAPTER(format);
         avformat_close_input(&fmt_ctx);
-    } else if (do_show_error) {
-        show_error(wctx, ret);
     }
-    writer_print_footer(wctx);
 
     return ret;
 }
@@ -1520,14 +1516,20 @@ int main(int argc, char **argv)
     }
 
     if ((ret = writer_open(&wctx, w, w_args, NULL)) >= 0) {
+        writer_print_header(wctx);
+
         if (!input_filename) {
             show_usage();
             av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
             av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
             ret = AVERROR(EINVAL);
-        } else
+        } else {
             ret = probe_file(wctx, input_filename);
+            if (ret < 0 && do_show_error)
+                show_error(wctx, ret);
+        }
 
+        writer_print_footer(wctx);
         writer_close(&wctx);
     }
 



More information about the ffmpeg-cvslog mailing list