[FFmpeg-cvslog] ffprobe: add print_section option to the compact writer

Stefano Sabatini git at videolan.org
Tue Sep 11 01:17:54 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Sep 10 13:36:27 2012 +0200| [0c71d5a077de20aee220fe30ea752862c9ca3f9c] | committer: Stefano Sabatini

ffprobe: add print_section option to the compact writer

Allow to skip section name at the begin of each line. Possibly simplify
output.

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

 doc/ffprobe.texi |    5 +++++
 ffprobe.c        |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
index cbe48a7..19b32ee 100644
--- a/doc/ffprobe.texi
+++ b/doc/ffprobe.texi
@@ -268,6 +268,11 @@ containing a newline ('\n'), a carriage return ('\r'), a double quote
 Perform no escaping.
 @end table
 
+ at item print_section, p
+Print the section name at the begin of each line if the value is
+ at code{1}, disable it with value set to @code{0}. Default value is
+ at code{1}.
+
 @end table
 
 @section csv
diff --git a/ffprobe.c b/ffprobe.c
index ce0183a..2edbd1c 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -593,6 +593,7 @@ typedef struct CompactContext {
     char *item_sep_str;
     char item_sep;
     int nokey;
+    int print_section;
     char *escape_mode_str;
     const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx);
 } CompactContext;
@@ -607,6 +608,8 @@ static const AVOption compact_options[]= {
     {"nk",       "force no key printing", OFFSET(nokey),           AV_OPT_TYPE_INT,    {.i64=0},    0,        1        },
     {"escape",   "set escape mode",       OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"},  CHAR_MIN, CHAR_MAX },
     {"e",        "set escape mode",       OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"},  CHAR_MIN, CHAR_MAX },
+    {"print_section", "print section name", OFFSET(print_section), AV_OPT_TYPE_INT,    {.i64=1},    0,        1        },
+    {"p",             "print section name", OFFSET(print_section), AV_OPT_TYPE_INT,    {.i64=1},    0,        1        },
     {NULL},
 };
 
@@ -653,7 +656,8 @@ static void compact_print_section_header(WriterContext *wctx, const char *sectio
 {
     CompactContext *compact = wctx->priv;
 
-    printf("%s%c", section, compact->item_sep);
+    if (compact->print_section)
+        printf("%s%c", section, compact->item_sep);
 }
 
 static void compact_print_section_footer(WriterContext *wctx, const char *section)



More information about the ffmpeg-cvslog mailing list