avfilter/showvolume : move width test for draw volume to the start of the loop
This commit is contained in:
committed by
Paul B Mahol
parent
4152413dde
commit
e4cfb2c669
@@ -358,20 +358,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
av_frame_make_writable(out);
|
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];
|
char buf[16];
|
||||||
if (s->orientation) {
|
if (s->orientation) {
|
||||||
if (s->h >= 8) {
|
|
||||||
snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
|
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);
|
drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (s->h >= 8) {
|
|
||||||
snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
|
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);
|
drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user