From: softworkz <softwo...@hotmail.com>

This commit adds two logging flags: 'timing' and 'datetiming'.

Usage:

ffmpeg -loglevel +timing

or

ffmpeg -loglevel +datetiming

Setting av_log_set_flags(0) in term_exit in ffmpeg.c prevents
timing to be printed when exiting.

Signed-off-by: softworkz <softwo...@hotmail.com>
---
 fftools/ffmpeg.c     |  1 +
 fftools/opt_common.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index dc321fb4a2..f4c717afaa 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -130,6 +130,7 @@ static void term_exit_sigsafe(void)
 
 void term_exit(void)
 {
+    av_log_set_flags(0);
     av_log(NULL, AV_LOG_QUIET, "%s", "");
     term_exit_sigsafe();
 }
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 34da2cee7d..94e9dae8b6 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, "timing", &arg)) {
+            if (cmd == '-') {
+                flags &= ~AV_LOG_PRINT_TIME;
+            } else {
+                flags |= AV_LOG_PRINT_TIME;
+            }
+        } else if (av_strstart(token, "datetiming", &arg)) {
+            if (cmd == '-') {
+                flags &= ~AV_LOG_PRINT_DATETIME;
+            } else {
+                flags |= AV_LOG_PRINT_DATETIME;
+            }
         } else {
             break;
         }
-- 
ffmpeg-codebot

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to