Patch attached.
From 95efe0d6d7e6fe5e29e6372f2da38cfbc4453a83 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <[email protected]>
Date: Sun, 29 Jan 2023 20:46:50 +0100
Subject: [PATCH] fftools/ffmpeg: fix clearing previous output

Signed-off-by: Paul B Mahol <[email protected]>
---
 fftools/ffmpeg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9884e0c6c6..e39260ee90 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1539,6 +1539,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
     static int64_t last_time = -1;
     static int first_report = 1;
     static int qp_histogram[52];
+    static int prev_buf_len = -1;
     int hours, mins, secs, us;
     const char *hours_sign;
     int ret;
@@ -1696,11 +1697,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
 
     if (print_stats || is_last_report) {
         const char end = is_last_report ? '\n' : '\r';
+        if (prev_buf_len < 0)
+            prev_buf_len = buf.len;
         if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {
             fprintf(stderr, "%s    %c", buf.str, end);
         } else
-            av_log(NULL, AV_LOG_INFO, "%s    %c", buf.str, end);
+            av_log(NULL, AV_LOG_INFO, "%s%*c%c", buf.str, -FFMAX(0, buf.len - prev_buf_len), ' ', end);
 
+        prev_buf_len = buf.len;
         fflush(stderr);
     }
     av_bprint_finalize(&buf, NULL);
-- 
2.39.1

_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to