diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-07-14 09:25:33 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-07-22 09:14:05 +0200 |
commit | e9b992d035b58209d66115bd7d964741dd31d592 (patch) | |
tree | 6943fb7749c7930b1fde69fba8198d80a227f931 /libavfilter/vf_slicify.c | |
parent | ebc8d974817fe456a0afe6867fdeb22c761fb04f (diff) |
lavfi: add error handling to draw_slice().
Diffstat (limited to 'libavfilter/vf_slicify.c')
-rw-r--r-- | libavfilter/vf_slicify.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libavfilter/vf_slicify.c b/libavfilter/vf_slicify.c index 09994875ca..3c69cfd350 100644 --- a/libavfilter/vf_slicify.c +++ b/libavfilter/vf_slicify.c @@ -78,24 +78,31 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) return ff_start_frame(link->dst->outputs[0], picref); } -static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) +static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { SliceContext *slice = link->dst->priv; - int y2; + int y2, ret = 0; if (slice_dir == 1) { - for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) - ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir); + for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) { + ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir); + if (ret < 0) + return ret; + } if (y2 < y + h) - ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir); + return ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir); } else if (slice_dir == -1) { - for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) - ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir); + for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) { + ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir); + if (ret < 0) + return ret; + } if (y2 > y) - ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir); + return ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir); } + return 0; } AVFilter avfilter_vf_slicify = { |