Skip to content

Commit ca56299

Browse files
committed
avfilter/af_astats: Only print header lines when values are to be printed
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 <t.rapp@noa-archive.com>
1 parent f531a1a commit ca56299

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libavfilter/af_astats.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,8 @@ static void print_stats(AVFilterContext *ctx)
705705
if (fabs(p->sigma_x) > fabs(max_sigma_x))
706706
max_sigma_x = p->sigma_x;
707707

708-
av_log(ctx, AV_LOG_INFO, "Channel: %d\n", c + 1);
708+
if (s->measure_perchannel != MEASURE_NONE)
709+
av_log(ctx, AV_LOG_INFO, "Channel: %d\n", c + 1);
709710
if (s->measure_perchannel & MEASURE_DC_OFFSET)
710711
av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", p->sigma_x / p->nb_samples);
711712
if (s->measure_perchannel & MEASURE_MIN_LEVEL)
@@ -757,7 +758,8 @@ static void print_stats(AVFilterContext *ctx)
757758
av_log(ctx, AV_LOG_INFO, "Number of denormals: %"PRId64"\n", p->nb_denormals);
758759
}
759760

760-
av_log(ctx, AV_LOG_INFO, "Overall\n");
761+
if (s->measure_overall != MEASURE_NONE)
762+
av_log(ctx, AV_LOG_INFO, "Overall\n");
761763
if (s->measure_overall & MEASURE_DC_OFFSET)
762764
av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", max_sigma_x / (nb_samples / s->nb_channels));
763765
if (s->measure_overall & MEASURE_MIN_LEVEL)

0 commit comments

Comments
 (0)