[FFmpeg-cvslog] fftools/opt_common: add time and datetime log flags

softworkz git at videolan.org
Mon Feb 17 03:35:13 EET 2025


ffmpeg | branch: master | softworkz <softworkz at hotmail.com> | Fri Feb  7 14:34:28 2025 +0000| [9fd23f712a99c75272f04fabf81bbd396bfe9862] | committer: Michael Niedermayer

fftools/opt_common: add time and datetime log flags

This commit adds two logging flags: 'time' and 'datetime'.

Usage:

ffmpeg -loglevel +time

or

ffmpeg -loglevel +datetime

Signed-off-by: softworkz <softworkz at hotmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fd23f712a99c75272f04fabf81bbd396bfe9862
---

 doc/fftools-common-opts.texi |  4 ++++
 fftools/opt_common.c         | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 8b0931a86d..f6d452c40e 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -226,6 +226,10 @@ and the "Last message repeated n times" line will be omitted.
 Indicates that log output should add a @code{[level]} prefix to each message
 line. This can be used as an alternative to log coloring, e.g. when dumping the
 log to file.
+ at item time
+Indicates that log lines should be prefixed with time information.
+ at item datetime
+Indicates that log lines should be prefixed with date and time information.
 @end table
 Flags can also be used alone by adding a '+'/'-' prefix to set/reset a single
 flag without affecting other @var{flags} or changing @var{loglevel}. When
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 34da2cee7d..317e8458c1 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1292,6 +1292,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
             } else {
                 flags |= AV_LOG_PRINT_LEVEL;
             }
+        } else if (av_strstart(token, "time", &arg)) {
+            if (cmd == '-') {
+                flags &= ~AV_LOG_PRINT_TIME;
+            } else {
+                flags |= AV_LOG_PRINT_TIME;
+            }
+        } else if (av_strstart(token, "datetime", &arg)) {
+            if (cmd == '-') {
+                flags &= ~AV_LOG_PRINT_DATETIME;
+            } else {
+                flags |= AV_LOG_PRINT_DATETIME;
+            }
         } else {
             break;
         }



More information about the ffmpeg-cvslog mailing list