[FFmpeg-devel] [PATCH] vf_pad: keep a reference to the output buffer.
Stefano Sabatini
stefasab at gmail.com
Thu Mar 8 11:56:51 CET 2012
On date Wednesday 2012-03-07 17:23:45 +0100, Nicolas George encoded:
> Once fixed, the end_frame function does exactly
> what the default does: remove it.
The text is pretty confusing, I'd say:
Pass a picture reference to avfilter_start_frame, and remove this
reference by using the default end_frame function.
This allows the filter to keep a reference to the ouput picture in
case it is unreferenced by the following filter, as it happens with
the settb filter.
>
> Fixes ticket #1038.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavfilter/vf_pad.c | 11 ++---------
> 1 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
> index e226a00..9b2d5cf 100644
> --- a/libavfilter/vf_pad.c
> +++ b/libavfilter/vf_pad.c
> @@ -335,13 +335,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
> outpicref->video->w = pad->w;
> outpicref->video->h = pad->h;
>
> - avfilter_start_frame(inlink->dst->outputs[0], outpicref);
> -}
> -
> -static void end_frame(AVFilterLink *link)
> -{
> - avfilter_end_frame(link->dst->outputs[0]);
> - avfilter_unref_buffer(link->cur_buf);
> + avfilter_start_frame(inlink->dst->outputs[0], avfilter_ref_buffer(outpicref, ~0));
> }
>
> static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
> @@ -417,8 +411,7 @@ AVFilter avfilter_vf_pad = {
> .config_props = config_input,
> .get_video_buffer = get_video_buffer,
> .start_frame = start_frame,
> - .draw_slice = draw_slice,
> - .end_frame = end_frame, },
> + .draw_slice = draw_slice, },
> { .name = NULL}},
>
> .outputs = (const AVFilterPad[]) {{ .name = "default",
Looks fine, assuming it passes FATE, and thanks.
--
FFmpeg = Fostering and Fast Mystic Puritan Enlightened God
More information about the ffmpeg-devel
mailing list