From patchwork Sun Jan 29 19:49:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 40169 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp2927351pzj; Sun, 29 Jan 2023 11:49:39 -0800 (PST) X-Google-Smtp-Source: AK7set8JvnSTFNnB9JbjVqkXKY2MNI5zaH+vLM95CPXajwe7jnBPz6OBPn+et1EXPddVAG0mfdSY X-Received: by 2002:a05:6402:12ce:b0:4a2:2daf:adcd with SMTP id k14-20020a05640212ce00b004a22dafadcdmr6319430edx.27.1675021778647; Sun, 29 Jan 2023 11:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675021778; cv=none; d=google.com; s=arc-20160816; b=AZmD07u+qE2nD8UmfGCv45MgAQIIcZzSko8wSPtMPJqn0uF9VfHzG/tnE6UZBaBleZ xv/cUVU3mmS8GkZCetVbJR1Bb8x1sjAKKId9SjChe6B+6/HQmH1zAdpzSJzMKNeo0aSa LqaiZWo7hjkWZFtJQ28mlioypoEoxjnohaE7XIeDvWU8dPgNyf7/7b4gbgJaaQwBQeZ4 iEnYU4UaGfKrKn6h7LpBQp9sBfeGjUT7esvSFivDDKs2pEFpDKRVPojTQdy8106AVhOz iThJfBdlt/YUWlaZSJGosuDwyyV15V55odchVL5kr6OBbotvVfMZC21+ZdAFAdhiB/9r e3uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=z32wSSQOmtFiZqi091Hs8uJ4VawMuqig+G+FLnRAzSc=; b=SemzhLigiSfbDyw3Z1g9hT3wW8cHgsYvO4GTLPE6e9/YyHvChNG7HIJnt/JAWBW/rT lVZySnTAQU33Ym9hLMaY1uAx1X/TZ5rSTNC0iYf26O7fkaJLKQHvSyKFpJMLljw/eYXJ RBgQmPCTkY4NAwQ/YbY+EdFDXwqt6Gkn0me6+fhZrTJI9UJFEBVQYvz78U/+zmc9r9Uf N0nGCSzTl3swZPrtSjT5dJofAFjLCCHE4gndzGPQUXGO2d5Sbaj15m2Wxey7bHVNrZkh T9iDyj7duntSfBhomdKlt40pxaPAe0+2ix0LR7+LS2E4r1fUOJQV/anxm8LZPYJgjtg1 aBpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=XU7zeOru; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fi24-20020a056402551800b0049e07afe709si11636387edb.355.2023.01.29.11.49.38; Sun, 29 Jan 2023 11:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=XU7zeOru; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7938E68BB84; Sun, 29 Jan 2023 21:49:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 20B90680C30 for ; Sun, 29 Jan 2023 21:49:28 +0200 (EET) Received: by mail-vk1-f175.google.com with SMTP id az23so4826201vkb.8 for ; Sun, 29 Jan 2023 11:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=2hnszXMn5ZxFZf5383oEKuDicCV51dXOO86seD2MuN0=; b=XU7zeOruaEKnXcHB91pS5WJ4comLzK8YcqGuOjHLKzR0HlvqzXxq70+eTBO2/kCfdY zvNGgBMyIQyCHOtt+bK25vfIHtCOaAk7uSqQfZaeStyGYsnbDp3j5U6WFL9Jn6CJGge5 lWKOf6vsjEKytQSFLikYioxEMypTQDQnSF3CrUrSmAPtG+XoidC24FNp/nJ8VsqwMDoC CTWcsoPsUyoOWQw50U0B6Lyl+VwVcwN+RW4alDJWH4xEtDZgg9Ljm4VoK8vzAQvl29Wy ZiU0UPQp7hLm/4JR9QNW10NGxUSN9sGLXYTIMl61p1BEOLwfThTxDsRxPSc6XLMnwSEO DRrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2hnszXMn5ZxFZf5383oEKuDicCV51dXOO86seD2MuN0=; b=wnmRNWjobG88GBNywZExWeLeths3UO0gHG/L30qse5YYI3Kqk9j1Yc9P5fDZda5og3 Wj/p36we1HN1RmAp3FX2ugmuBWGpP/NmLY00XdkA58FvLjO965wHQ5f+SfG2s71W6hPM +CUSLFq/cUUzGz4eY2eEJU7872dQ5RO5LYIAbDGhJ5LRKsf9AmDnvoRxba9E/gFxiqZ4 ObT3eW01yio1z4aYd7JbVNfR2uAZ3y8jLXZ4xx9EbJoxM6ip4ZKbkYQy1jNqqIuDRsLN mkwPaWs+fCFRazm7DHnVUrBJQfOu/LUtlpXX8WVWy32DQwCBc4tr8E/UW4Bb4hnFdmrL oYPg== X-Gm-Message-State: AO0yUKWsrZWCQpVPBGO/4ViV9PBFxKHEU1EcjX8dCBeLLcjes/UC1VgX wD5ZQkDznAGGLtL/+M11YHGrVGdSFjpUM1tXodCBbbNn X-Received: by 2002:a1f:5f81:0:b0:3e5:a994:9fc8 with SMTP id t123-20020a1f5f81000000b003e5a9949fc8mr2316561vkb.3.1675021766579; Sun, 29 Jan 2023 11:49:26 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:612c:2428:b0:32a:5eaa:92e4 with HTTP; Sun, 29 Jan 2023 11:49:24 -0800 (PST) From: Paul B Mahol Date: Sun, 29 Jan 2023 20:49:24 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix clearing previous output X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: seBdCvy9VQCr Patch attached. From 95efe0d6d7e6fe5e29e6372f2da38cfbc4453a83 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 29 Jan 2023 20:46:50 +0100 Subject: [PATCH] fftools/ffmpeg: fix clearing previous output Signed-off-by: Paul B Mahol --- 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