This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 75f5d79f6a4c78198627ae48b8d0284402e77fa8
Author:     Marton Balint <[email protected]>
AuthorDate: Wed Jan 14 01:20:01 2026 +0100
Commit:     Marton Balint <[email protected]>
CommitDate: Wed Feb 4 21:46:30 2026 +0100

    fftools/ffprobe: add base64 data dump format
    
    Signed-off-by: Marton Balint <[email protected]>
---
 doc/ffprobe.texi                  |  8 +++++++-
 fftools/ffprobe.c                 | 16 ++++++++++++++++
 fftools/textformat/avtextformat.c | 17 +++++++++++++++++
 fftools/textformat/avtextformat.h |  1 +
 4 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
index 3be359f07a..41dbba4656 100644
--- a/doc/ffprobe.texi
+++ b/doc/ffprobe.texi
@@ -117,7 +117,8 @@ ffprobe -show_packets -select_streams v:1 INPUT
 @end example
 
 @item -show_data
-Show payload data, as a hexadecimal and ASCII dump. Coupled with
+Show payload data, as a hexadecimal and ASCII dump (other formats can be
+selected using @option{-data_dump_format}). Coupled with
 @option{-show_packets}, it will dump the packets' data. Coupled with
 @option{-show_streams}, it will dump the codec extradata.
 
@@ -127,6 +128,11 @@ The dump is printed as the "data" field. It may contain 
newlines.
 Show a hash of payload data, for packets with @option{-show_packets} and for
 codec extradata with @option{-show_streams}.
 
+@item -data_dump_format @var{format}
+Select a format used for the data dumps enabled with the @option{-show_data}
+option. The default is @code{xxd} which is a hexdump format compatible with the
+well-known @command{xxd} program. @code{base64} is also supported.
+
 @item -show_error
 Show information about the error found when trying to probe the input.
 
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 1d9c7052c1..aca427b6c7 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -144,6 +144,7 @@ static int show_optional_fields = SHOW_OPTIONAL_FIELDS_AUTO;
 static char *output_format;
 static char *stream_specifier;
 static char *show_data_hash;
+static char *data_dump_format;
 
 typedef struct ReadInterval {
     int id;             ///< identifier
@@ -3172,6 +3173,7 @@ static const OptionDef real_options[] = {
     { "of",                    OPT_TYPE_STRING,      0, { &output_format }, 
"alias for -output_format", "format" },
     { "select_streams",        OPT_TYPE_STRING,      0, { &stream_specifier }, 
"select the specified streams", "stream_specifier" },
     { "sections",              OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = 
opt_sections}, "print sections structure and section information, and exit" },
+    { "data_dump_format",      OPT_TYPE_STRING,      0, { &data_dump_format }, 
"set data dump format (available formats are: xxd, base64)" },
     { "show_data",             OPT_TYPE_BOOL,        0, { &do_show_data }, 
"show packets data" },
     { "show_data_hash",        OPT_TYPE_STRING,      0, { &show_data_hash }, 
"show packets data hash" },
     { "show_error",            OPT_TYPE_FUNC,        0, { .func_arg = 
&opt_show_error },  "show probing error" },
@@ -3236,6 +3238,7 @@ int main(int argc, char **argv)
     char *buf;
     char *f_name = NULL, *f_args = NULL;
     int ret, input_ret;
+    AVTextFormatDataDump data_dump_format_id;
 
     init_dynload();
 
@@ -3320,6 +3323,18 @@ int main(int argc, char **argv)
         goto end;
     }
 
+    if (data_dump_format) {
+        if (!strcmp(data_dump_format, "xxd")) {
+            data_dump_format_id = AV_TEXTFORMAT_DATADUMP_XXD;
+        } else if (!strcmp(data_dump_format, "base64")) {
+            data_dump_format_id = AV_TEXTFORMAT_DATADUMP_BASE64;
+        } else {
+            av_log(NULL, AV_LOG_ERROR, "Unknown data dump format with name 
'%s'\n", data_dump_format);
+            ret = AVERROR(EINVAL);
+            goto end;
+        }
+    }
+
     if (output_filename) {
         ret = avtextwriter_create_file(&wctx, output_filename);
     } else
@@ -3335,6 +3350,7 @@ int main(int argc, char **argv)
         .use_value_prefix = use_value_prefix,
         .use_byte_value_binary_prefix = use_byte_value_binary_prefix,
         .use_value_sexagesimal_format = use_value_sexagesimal_format,
+        .data_dump_format             = data_dump_format_id,
     };
 
     if ((ret = avtext_context_open(&tctx, f, wctx, f_args, sections, 
FF_ARRAY_ELEMS(sections), tf_options, show_data_hash)) >= 0) {
diff --git a/fftools/textformat/avtextformat.c 
b/fftools/textformat/avtextformat.c
index ca1039b67e..47ef6e518f 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -26,6 +26,7 @@
 
 #include "libavutil/mem.h"
 #include "libavutil/avassert.h"
+#include "libavutil/base64.h"
 #include "libavutil/bprint.h"
 #include "libavutil/error.h"
 #include "libavutil/hash.h"
@@ -532,6 +533,19 @@ static void print_data_xxd(AVBPrint *bp, const uint8_t 
*data, int size)
     }
 }
 
+static void print_data_base64(AVBPrint *bp, const uint8_t *data, int size)
+{
+    char buf[AV_BASE64_SIZE(60)];
+
+    av_bprintf(bp, "\n");
+    while (size) {
+        int l = FFMIN(size, 60);
+        av_base64_encode(buf, sizeof(buf), data, l);
+        av_bprintf(bp, "%s\n", buf);
+        data   += l;
+        size   -= l;
+    }
+}
 void avtext_print_data(AVTextFormatContext *tctx, const char *key,
                        const uint8_t *data, int size)
 {
@@ -541,6 +555,9 @@ void avtext_print_data(AVTextFormatContext *tctx, const 
char *key,
     case AV_TEXTFORMAT_DATADUMP_XXD:
         print_data_xxd(&bp, data, size);
         break;
+    case AV_TEXTFORMAT_DATADUMP_BASE64:
+        print_data_base64(&bp, data, size);
+        break;
     default:
         av_unreachable("Invalid data dump type");
     }
diff --git a/fftools/textformat/avtextformat.h 
b/fftools/textformat/avtextformat.h
index a86ce64dfe..edb292d42c 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -91,6 +91,7 @@ typedef enum {
 
 typedef enum {
     AV_TEXTFORMAT_DATADUMP_XXD,
+    AV_TEXTFORMAT_DATADUMP_BASE64,
 } AVTextFormatDataDump;
 
 typedef struct AVTextFormatter {

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to