diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-07-14 17:09:43 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-07-20 21:10:42 +0200 |
commit | 07bad27810cdd7d3171cbd542119aa051646377c (patch) | |
tree | 3bb780df53f6779185ea0fc78ba584a7296105b8 /libavfilter | |
parent | 533fd5b5b468131cfe164455783c351eb69af657 (diff) | |
download | ffmpeg-07bad27810cdd7d3171cbd542119aa051646377c.tar.gz |
lavfi: unref AVFilterLink.cur_buf in ff_end_frame().
This reduces code duplication and prevents stale pointers from remaining
on the link.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/fifo.c | 1 | ||||
-rw-r--r-- | libavfilter/split.c | 2 | ||||
-rw-r--r-- | libavfilter/vf_crop.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_delogo.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_drawtext.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_fieldorder.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_fps.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_frei0r.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_gradfun.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_hqdn3d.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_libopencv.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_overlay.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_pad.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_select.c | 2 | ||||
-rw-r--r-- | libavfilter/vf_transpose.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_unsharp.c | 1 | ||||
-rw-r--r-- | libavfilter/video.c | 7 |
17 files changed, 5 insertions, 20 deletions
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c index e09e3192ba..e1faf74855 100644 --- a/libavfilter/fifo.c +++ b/libavfilter/fifo.c @@ -91,6 +91,7 @@ static int add_to_queue(AVFilterLink *inlink, AVFilterBufferRef *buf) static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *buf) { add_to_queue(inlink, buf); + inlink->cur_buf = NULL; } static void queue_pop(FifoContext *s) diff --git a/libavfilter/split.c b/libavfilter/split.c index a3f6ef2337..33cb226b93 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -89,8 +89,6 @@ static void end_frame(AVFilterLink *inlink) for (i = 0; i < ctx->nb_outputs; i++) ff_end_frame(ctx->outputs[i]); - - avfilter_unref_buffer(inlink->cur_buf); } AVFilter avfilter_vf_split = { diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index 6d124c19d3..6988fcffa9 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -317,7 +317,6 @@ static void end_frame(AVFilterLink *link) CropContext *crop = link->dst->priv; crop->var_values[VAR_N] += 1.0; - avfilter_unref_buffer(link->cur_buf); ff_end_frame(link->dst->outputs[0]); } diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index 2f9e1f9cac..f9c5ad76be 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -260,7 +260,6 @@ static void end_frame(AVFilterLink *inlink) ff_draw_slice(outlink, 0, inlink->h, 1); ff_end_frame(outlink); - avfilter_unref_buffer(inpicref); avfilter_unref_buffer(outpicref); } diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index fd2ec8deae..eac7245bfb 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -868,7 +868,6 @@ static void end_frame(AVFilterLink *inlink) ff_draw_slice(outlink, 0, picref->video->h, 1); ff_end_frame(outlink); - avfilter_unref_buffer(inlink->cur_buf); } AVFilter avfilter_vf_drawtext = { diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c index b3cce19fcb..05882d13fe 100644 --- a/libavfilter/vf_fieldorder.c +++ b/libavfilter/vf_fieldorder.c @@ -213,7 +213,6 @@ static void end_frame(AVFilterLink *inlink) } ff_end_frame(outlink); - avfilter_unref_buffer(inpicref); avfilter_unref_bufferp(&outlink->out_buf); } diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index bcc6a69814..f78e008c7d 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -175,6 +175,7 @@ static void end_frame(AVFilterLink *inlink) int64_t delta; int i; + inlink->cur_buf = NULL; s->frames_in++; /* discard frames until we get the first timestamp */ if (s->pts == AV_NOPTS_VALUE) { diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index 93ec92afa6..87c9276e3e 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -352,7 +352,6 @@ static void end_frame(AVFilterLink *inlink) frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000, (const uint32_t *)inpicref->data[0], (uint32_t *)outpicref->data[0]); - avfilter_unref_buffer(inpicref); ff_draw_slice(outlink, 0, outlink->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpicref); diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 735bd503a0..b6583d7098 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -225,7 +225,6 @@ static void end_frame(AVFilterLink *inlink) ff_draw_slice(outlink, 0, inlink->h, 1); ff_end_frame(outlink); - avfilter_unref_buffer(inpic); avfilter_unref_buffer(outpic); } diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index af69d417c4..79adaea663 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -322,7 +322,6 @@ static void end_frame(AVFilterLink *inlink) ff_draw_slice(outlink, 0, inpic->video->h, 1); ff_end_frame(outlink); - avfilter_unref_buffer(inpic); avfilter_unref_buffer(outpic); } diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index ac892d948f..f04d4690b5 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -365,7 +365,6 @@ static void end_frame(AVFilterLink *inlink) ocv->end_frame_filter(ctx, &inimg, &outimg); fill_picref_from_iplimage(outpicref, &outimg, inlink->format); - avfilter_unref_buffer(inpicref); ff_draw_slice(outlink, 0, outlink->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpicref); diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index b9d64b9495..1230763e4e 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -339,7 +339,6 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) static void end_frame(AVFilterLink *inlink) { ff_end_frame(inlink->dst->outputs[0]); - avfilter_unref_buffer(inlink->cur_buf); } static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { } diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 037abd5d57..b0d5c5fb2f 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -348,7 +348,6 @@ static void end_frame(AVFilterLink *link) { ff_end_frame(link->dst->outputs[0]); avfilter_unref_buffer(link->dst->outputs[0]->out_buf); - avfilter_unref_buffer(link->cur_buf); } static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice) diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c index 719885e401..91d48f07da 100644 --- a/libavfilter/vf_select.c +++ b/libavfilter/vf_select.c @@ -258,14 +258,12 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) static void end_frame(AVFilterLink *inlink) { SelectContext *select = inlink->dst->priv; - AVFilterBufferRef *picref = inlink->cur_buf; if (select->select) { if (select->cache_frames) return; ff_end_frame(inlink->dst->outputs[0]); } - avfilter_unref_buffer(picref); } static int request_frame(AVFilterLink *outlink) diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index f78244e6bd..e772e8b119 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -192,7 +192,6 @@ static void end_frame(AVFilterLink *inlink) } } - avfilter_unref_buffer(inpic); ff_draw_slice(outlink, 0, outpic->video->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpic); diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index ddfbf2cd3c..3d28759ddf 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -225,7 +225,6 @@ static void end_frame(AVFilterLink *link) apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, &unsharp->chroma); apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, &unsharp->chroma); - avfilter_unref_buffer(in); ff_draw_slice(link->dst->outputs[0], 0, link->h, 1); ff_end_frame(link->dst->outputs[0]); avfilter_unref_buffer(out); diff --git a/libavfilter/video.c b/libavfilter/video.c index feaaebab86..e507f973b4 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -162,7 +162,8 @@ AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, int w, int void ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) { - ff_start_frame(link->dst->outputs[0], picref); + AVFilterBufferRef *buf_out = avfilter_ref_buffer(picref, ~0); + ff_start_frame(link->dst->outputs[0], buf_out); } static void default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) @@ -223,9 +224,6 @@ static void default_end_frame(AVFilterLink *inlink) if (inlink->dst->nb_outputs) outlink = inlink->dst->outputs[0]; - avfilter_unref_buffer(inlink->cur_buf); - inlink->cur_buf = NULL; - if (outlink) { if (outlink->out_buf) { avfilter_unref_buffer(outlink->out_buf); @@ -250,6 +248,7 @@ void ff_end_frame(AVFilterLink *link) avfilter_unref_buffer(link->src_buf); link->src_buf = NULL; } + avfilter_unref_bufferp(&link->cur_buf); } void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) |