This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit b1f14cbd0e732b604ead20024186989908221b98 Author: Marton Balint <[email protected]> AuthorDate: Wed Jan 14 00:43:36 2026 +0100 Commit: Marton Balint <[email protected]> CommitDate: Wed Feb 4 21:46:30 2026 +0100 fftools/ffprobe: fatorize dumping hexdump as data dump Signed-off-by: Marton Balint <[email protected]> --- fftools/textformat/avtextformat.c | 34 +++++++++++++++++++++++----------- fftools/textformat/avtextformat.h | 6 ++++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index 04da8e7d3a..98f4656790 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -153,6 +153,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form tctx->use_byte_value_binary_prefix = options.use_byte_value_binary_prefix; tctx->use_value_sexagesimal_format = options.use_value_sexagesimal_format; tctx->show_optional_fields = options.show_optional_fields; + tctx->data_dump_format = options.data_dump_format; if (nb_sections > SECTION_MAX_NB_SECTIONS) { av_log(tctx, AV_LOG_ERROR, "The number of section definitions (%d) is larger than the maximum allowed (%d)\n", nb_sections, SECTION_MAX_NB_SECTIONS); @@ -513,31 +514,42 @@ void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int avtext_print_integer(tctx, key, ts, 0); } -void avtext_print_data(AVTextFormatContext *tctx, const char *key, - const uint8_t *data, int size) +static void print_data_xxd(AVBPrint *bp, const uint8_t *data, int size) { - AVBPrint bp; unsigned offset = 0; int i; - av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); - av_bprintf(&bp, "\n"); + av_bprintf(bp, "\n"); while (size) { - av_bprintf(&bp, "%08x: ", offset); + av_bprintf(bp, "%08x: ", offset); int l = FFMIN(size, 16); for (i = 0; i < l; i++) { - av_bprintf(&bp, "%02x", data[i]); + av_bprintf(bp, "%02x", data[i]); if (i & 1) - av_bprintf(&bp, " "); + av_bprintf(bp, " "); } - av_bprint_chars(&bp, ' ', 41 - 2 * i - i / 2); + 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"); + av_bprint_chars(bp, data[i] - 32U < 95 ? data[i] : '.', 1); + av_bprintf(bp, "\n"); offset += l; data += l; size -= l; } +} + +void avtext_print_data(AVTextFormatContext *tctx, const char *key, + const uint8_t *data, int size) +{ + AVBPrint bp; + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); + switch (tctx->data_dump_format) { + case AV_TEXTFORMAT_DATADUMP_XXD: + print_data_xxd(&bp, data, size); + break; + default: + av_unreachable("Invalid data dump type"); + } avtext_print_string(tctx, key, bp.str, 0); av_bprint_finalize(&bp, NULL); } diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index d3ed437b7e..0f8ccfed72 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -89,6 +89,10 @@ typedef enum { AV_TEXTFORMAT_LINKTYPE_MANYTOMANY = AV_TEXTFORMAT_LINKTYPE_NONDIR, } AVTextFormatLinkType; +typedef enum { + AV_TEXTFORMAT_DATADUMP_XXD, +} AVTextFormatDataDump; + typedef struct AVTextFormatter { const AVClass *priv_class; ///< private class of the formatter, if any int priv_size; ///< private size for the formatter context @@ -144,6 +148,7 @@ struct AVTextFormatContext { int use_value_prefix; int use_byte_value_binary_prefix; int use_value_sexagesimal_format; + AVTextFormatDataDump data_dump_format; struct AVHashContext *hash; @@ -159,6 +164,7 @@ typedef struct AVTextFormatOptions { int use_value_prefix; int use_byte_value_binary_prefix; int use_value_sexagesimal_format; + AVTextFormatDataDump data_dump_format; } AVTextFormatOptions; #define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL 1 _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
