From patchwork Fri Mar 26 12:58:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Rapp X-Patchwork-Id: 26617 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 50F1944AC58 for ; Fri, 26 Mar 2021 14:58:16 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2CA1B68A817; Fri, 26 Mar 2021 14:58:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from server6.ceeqoo.com (server6.ceeqoo.com [178.77.101.243]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 269C5687FA1 for ; Fri, 26 Mar 2021 14:58:09 +0200 (EET) Received: from mailix (www.noaport.de [109.90.164.154]) by server6.ceeqoo.com (Postfix) with ESMTPA id F2D60B9FA9 for ; Fri, 26 Mar 2021 13:58:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noa-archive.com; s=default; t=1616763488; bh=Cu+69Ua0ZYGWCALoZ3YgC4wKFe0gvqEDqc9uX8b/T7M=; h=Received:From:To:Subject; b=x/oU/KFdHGssbTeyEWLKO8pt/89fN2HO/KKdcQ/db/4Kf8m+hbWwAdnmbP7C5WZ1g qQDQnMwvtuK+jljJaVIumI4ow0Ai+dggw/BLhxLlI2EpZmpCZD/A4FOIL2toauk/sO m1+B8bBrAb8Tza7QVgqa7qzpAuUcanm2tYy62WYA= Authentication-Results: server6.ceeqoo.com; spf=pass (sender IP is 109.90.164.154) smtp.mailfrom=t.rapp@noa-archive.com smtp.helo=mailix Received-SPF: pass (server6.ceeqoo.com: connection is authenticated) Received: from frogstar-a.kuhnle.local (frogstar-a.kuhnle.local [192.168.0.26]) by mailix with ESMTPA ; Fri, 26 Mar 2021 13:58:07 +0100 From: Tobias Rapp To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Mar 2021 13:58:06 +0100 Message-Id: <1616763487-10025-1-git-send-email-t.rapp@noa-archive.com> X-Mailer: git-send-email 2.7.4 X-PPP-Message-ID: <161676348829.28836.3898555716352143753@server6.ceeqoo.com> X-PPP-Vhost: noa-archive.com Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/af_astats: Only print header lines when values are to be printed X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Avoids empty "Channel" or "Overall" header lines added to log output when measurement is restricted to one scope using "measure_perchannel=none" or "measure_overall=none". Signed-off-by: Tobias Rapp --- libavfilter/af_astats.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index f50cbe1..c13df62 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -705,7 +705,8 @@ static void print_stats(AVFilterContext *ctx) if (fabs(p->sigma_x) > fabs(max_sigma_x)) max_sigma_x = p->sigma_x; - av_log(ctx, AV_LOG_INFO, "Channel: %d\n", c + 1); + if (s->measure_perchannel != MEASURE_NONE) + av_log(ctx, AV_LOG_INFO, "Channel: %d\n", c + 1); if (s->measure_perchannel & MEASURE_DC_OFFSET) av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", p->sigma_x / p->nb_samples); if (s->measure_perchannel & MEASURE_MIN_LEVEL) @@ -757,7 +758,8 @@ static void print_stats(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "Number of denormals: %"PRId64"\n", p->nb_denormals); } - av_log(ctx, AV_LOG_INFO, "Overall\n"); + if (s->measure_overall != MEASURE_NONE) + av_log(ctx, AV_LOG_INFO, "Overall\n"); if (s->measure_overall & MEASURE_DC_OFFSET) av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", max_sigma_x / (nb_samples / s->nb_channels)); if (s->measure_overall & MEASURE_MIN_LEVEL)