[FFmpeg-devel] ffprobe: add -show_compact_data option

Submitted by Stefano Sabatini on Sept. 4, 2016, 4:24 p.m.

Details

Message ID 1473006271-16114-1-git-send-email-stefasab@gmail.com
State New
Headers show

Commit Message

Stefano Sabatini Sept. 4, 2016, 4:24 p.m.
This is meant to slightly reduce the output size.
---
 ffprobe.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Sept. 4, 2016, 9:29 p.m.
On Sun, Sep 04, 2016 at 06:24:31PM +0200, Stefano Sabatini wrote:
> This is meant to slightly reduce the output size.
> ---
>  ffprobe.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

LGTM

thx

[...]
Michael Niedermayer Jan. 22, 2017, 12:16 a.m.
On Sun, Sep 04, 2016 at 11:29:31PM +0200, Michael Niedermayer wrote:
> On Sun, Sep 04, 2016 at 06:24:31PM +0200, Stefano Sabatini wrote:
> > This is meant to slightly reduce the output size.
> > ---
> >  ffprobe.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> LGTM

this has not been applied, is there a different plan ?
iam asking as its still listed as NEW in
https://patchwork.ffmpeg.org/patch/413/

[...]

Patch hide | download patch | download mbox

diff --git a/ffprobe.c b/ffprobe.c
index 42a8d8e..f2c542a 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -99,6 +99,7 @@  static int use_byte_value_binary_prefix = 0;
 static int use_value_sexagesimal_format = 0;
 static int show_private_data            = 1;
 static int show_headers_first           = 0;
+static int show_compact_data            = 0;
 
 static char *print_format;
 static char *stream_specifier;
@@ -723,16 +724,19 @@  static void writer_print_data(WriterContext *wctx, const char *name,
     av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
     av_bprintf(&bp, "\n");
     while (size) {
+        if (!show_compact_data)
         av_bprintf(&bp, "%08x: ", offset);
-        l = FFMIN(size, 16);
+        l = FFMIN(size, show_compact_data ? 40 : 16);
         for (i = 0; i < l; i++) {
             av_bprintf(&bp, "%02x", data[i]);
-            if (i & 1)
+            if (!show_compact_data && (i & 1))
                 av_bprintf(&bp, " ");
         }
+        if (!show_compact_data) {
         av_bprint_chars(&bp, ' ', 41 - 2 * i - i / 2);
         for (i = 0; i < l; i++)
             av_bprint_chars(&bp, data[i] - 32U < 95 ? data[i] : '.', 1);
+        }
         av_bprintf(&bp, "\n");
         offset += l;
         data   += l;
@@ -3235,6 +3239,7 @@  static const OptionDef real_options[] = {
     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
     { "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
     { "show_headers_first", OPT_BOOL, {&show_headers_first}, "show headers before the packets/frames" },
+    { "show_compact_data", OPT_BOOL, {&show_compact_data}, "show packet data in a compact format" },
     { NULL, },
 };