[FFmpeg-devel] [PATCH] ffprobe: add -show_compact_data option
Stefano Sabatini
stefasab at gmail.com
Sun Sep 4 19:24:31 EEST 2016
This is meant to slightly reduce the output size.
---
ffprobe.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
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, },
};
--
1.9.1
More information about the ffmpeg-devel
mailing list