diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-07-08 19:29:42 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-07-22 11:14:04 +0400 |
commit | ebc8d974817fe456a0afe6867fdeb22c761fb04f (patch) | |
tree | d08864445a712ca289ef8a1b2a4fa4d7ff2e81e0 /libavfilter/vf_delogo.c | |
parent | 1470ce21cec5ee26e106e2a884c26bbf84e5aaea (diff) |
lavfi: add error handling to start_frame().
Diffstat (limited to 'libavfilter/vf_delogo.c')
-rw-r--r-- | libavfilter/vf_delogo.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index ffaaa22266..5f8f9ff6ff 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -214,22 +214,35 @@ static av_cold int init(AVFilterContext *ctx, const char *args) return 0; } -static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) +static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) { AVFilterLink *outlink = inlink->dst->outputs[0]; - AVFilterBufferRef *outpicref; + AVFilterBufferRef *outpicref = NULL; + int ret = 0; if (inpicref->perms & AV_PERM_PRESERVE) { outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + if (!outpicref) + return AVERROR(ENOMEM); + avfilter_copy_buffer_ref_props(outpicref, inpicref); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; - } else + } else { outpicref = avfilter_ref_buffer(inpicref, ~0); + if (!outpicref) + return AVERROR(ENOMEM); + } + + ret = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); + if (ret < 0) { + avfilter_unref_bufferp(&outpicref); + return ret; + } outlink->out_buf = outpicref; - ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); + return 0; } static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { } |