[FFmpeg-devel] [PATCH v7 2/3] fftools/opt_common: add memaddresses log flag

softworkz ffmpegagent at gmail.com
Wed Apr 9 08:55:01 EEST 2025


From: softworkz <softworkz at hotmail.com>

This commit adds the memaddresses log flag.
When specifying this flag at the command line, context prefixes will
be printed with memory addresses like in earlier ffmpeg versions.

Example with memaddresses flag:

[hevc @ 0000018e72a89cc0] .....

without (new behavior):

[hevc] .....

Signed-off-by: softworkz <softworkz at hotmail.com>
---
 fftools/opt_common.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 2ac3fd4fb3..77f3554727 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1269,6 +1269,9 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
     int level = av_log_get_level();
     int cmd, i = 0;
 
+    // libavutil has this enabled by default, fftools sets this off by default
+    flags &= ~AV_LOG_PRINT_MEMADDRESSES;
+
     av_assert0(arg);
     while (*arg) {
         token = arg;
@@ -1304,6 +1307,12 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
             } else {
                 flags |= AV_LOG_PRINT_DATETIME;
             }
+        } else if (av_strstart(token, "memaddresses", &arg)) {
+            if (cmd == '-') {
+                flags &= ~AV_LOG_PRINT_MEMADDRESSES;
+            } else {
+                flags |= AV_LOG_PRINT_MEMADDRESSES;
+            }
         } else {
             break;
         }
@@ -1315,6 +1324,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
         arg++;
     } else if (!i) {
         flags = av_log_get_flags();  /* level value without prefix, reset flags */
+        flags &= ~AV_LOG_PRINT_MEMADDRESSES;
     }
 
     for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
-- 
ffmpeg-codebot



More information about the ffmpeg-devel mailing list