lavfi: unref AVFilterLink.cur_buf in ff_end_frame().

This reduces code duplication and prevents stale pointers from remaining
on the link.
pull/28/head
Anton Khirnov 13 years ago
parent 533fd5b5b4
commit 07bad27810
  1. 1
      libavfilter/fifo.c
  2. 2
      libavfilter/split.c
  3. 1
      libavfilter/vf_crop.c
  4. 1
      libavfilter/vf_delogo.c
  5. 1
      libavfilter/vf_drawtext.c
  6. 1
      libavfilter/vf_fieldorder.c
  7. 1
      libavfilter/vf_fps.c
  8. 1
      libavfilter/vf_frei0r.c
  9. 1
      libavfilter/vf_gradfun.c
  10. 1
      libavfilter/vf_hqdn3d.c
  11. 1
      libavfilter/vf_libopencv.c
  12. 1
      libavfilter/vf_overlay.c
  13. 1
      libavfilter/vf_pad.c
  14. 2
      libavfilter/vf_select.c
  15. 1
      libavfilter/vf_transpose.c
  16. 1
      libavfilter/vf_unsharp.c
  17. 7
      libavfilter/video.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)

@ -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 = {

@ -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]);
}

@ -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);
}

@ -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 = {

@ -213,7 +213,6 @@ static void end_frame(AVFilterLink *inlink)
}
ff_end_frame(outlink);
avfilter_unref_buffer(inpicref);
avfilter_unref_bufferp(&outlink->out_buf);
}

@ -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) {

@ -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);

@ -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);
}

@ -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);
}

@ -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);

@ -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) { }

@ -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)

@ -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)

@ -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);

@ -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);

@ -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)

Loading…
Cancel
Save