Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix clearing previous output
@ 2023-01-29 19:49 Paul B Mahol
  0 siblings, 0 replies; only message in thread
From: Paul B Mahol @ 2023-01-29 19:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

Patch attached.

[-- Attachment #2: 0001-fftools-ffmpeg-fix-clearing-previous-output.patch --]
[-- Type: text/x-patch, Size: 1486 bytes --]

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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 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


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

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

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-29 19:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 19:49 [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix clearing previous output Paul B Mahol

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git