Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-03-09 00:04:57 +0300
committerPaul B Mahol <onemda@gmail.com>2016-03-09 00:04:57 +0300
commit209cff2d9ca1e76ca3a4b1033b9242d765d7650e (patch)
tree2244a48ffc73aada02a52aa5a2caaa96082dff69 /libavfilter/vf_waveform.c
parent8ca2c872b650182958f733db8b1d99c061dd3bf9 (diff)
avfilter/vf_waveform: make sure that x/y for text position is positive
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/vf_waveform.c')
-rw-r--r--libavfilter/vf_waveform.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 3e14d509ee..99a0c25e3b 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -1369,9 +1369,12 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
}
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]) && (s->flags & 1); l++) {
- const int x = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) - 10;
+ int x = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) - 10;
char text[16];
+ if (x < 0)
+ x = 4;
+
snprintf(text, sizeof(text), "%d", lines[c][l]);
draw_vtext(out, x, 2, o1, o2, text, green_yuva_color);
}
@@ -1403,9 +1406,12 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
}
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]) && (s->flags & 1); l++) {
- const int x = offset + (s->mirror ? s->size - 1 - lines[c][l] * mult : lines[c][l] * mult) - 10;
+ int x = offset + (s->mirror ? s->size - 1 - lines[c][l] * mult : lines[c][l] * mult) - 10;
char text[16];
+ if (x < 0)
+ x = 4;
+
snprintf(text, sizeof(text), "%d", lines[c][l] * mult);
draw_vtext16(out, x, 2, mult, o1, o2, text, green_yuva_color);
}
@@ -1436,12 +1442,14 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
}
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]) && (s->flags & 1); l++) {
- const int y = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) - 10;
+ int y = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) - 10;
char text[16];
+ if (y < 0)
+ y = 4;
+
snprintf(text, sizeof(text), "%d", lines[c][l]);
- draw_htext(out, 2, y,
- o1, o2, text, green_yuva_color);
+ draw_htext(out, 2, y, o1, o2, text, green_yuva_color);
}
offset += 256 * s->display;
@@ -1471,12 +1479,14 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
}
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]) && (s->flags & 1); l++) {
- const int y = offset + (s->mirror ? s->size - 1 - lines[c][l] * mult : lines[c][l] * mult) - 10;
+ int y = offset + (s->mirror ? s->size - 1 - lines[c][l] * mult : lines[c][l] * mult) - 10;
char text[16];
+ if (y < 0)
+ y = 4;
+
snprintf(text, sizeof(text), "%d", lines[c][l] * mult);
- draw_htext16(out, 2, y,
- mult, o1, o2, text, green_yuva_color);
+ draw_htext16(out, 2, y, mult, o1, o2, text, green_yuva_color);
}
offset += s->size * s->display;