aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2018-03-31 15:50:53 +0200
committerPaul B Mahol <onemda@gmail.com>2018-04-01 15:40:01 +0200
commite4cfb2c669993f01011e940de30e5da11a191b01 (patch)
tree15344ede19d107e6b3c8c0e88b431686da55cfc8
parent4152413dde1cf851c4556459e3e1b3a5669f3a5e (diff)
downloadffmpeg-e4cfb2c669993f01011e940de30e5da11a191b01.tar.gz
avfilter/showvolume : move width test for draw volume to the start of the loop
-rw-r--r--libavfilter/avf_showvolume.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index 92dfc24435..4f31cebc7b 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -358,18 +358,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
return AVERROR(ENOMEM);
av_frame_make_writable(out);
- for (c = 0; c < inlink->channels && s->draw_volume; c++) {
+ for (c = 0; c < inlink->channels && s->h >= 8 && s->draw_volume; c++) {
char buf[16];
if (s->orientation) {
- if (s->h >= 8) {
snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1);
- }
} else {
- if (s->h >= 8) {
+
snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0);
- }
}
}