From 7e350379f87e7f74420b4813170fe808e2313911 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 28 Nov 2012 08:41:07 +0100 Subject: lavfi: switch to AVFrame. Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it and use AVFrame instead. --- libavfilter/vf_copy.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libavfilter/vf_copy.c') diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c index 8ece5cf8c5..f53395932b 100644 --- a/libavfilter/vf_copy.c +++ b/libavfilter/vf_copy.c @@ -21,17 +21,35 @@ * copy video filter */ +#include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "avfilter.h" #include "internal.h" #include "video.h" +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFrame *out = ff_get_video_buffer(outlink, in->width, in->height); + + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + av_frame_copy_props(out, in); + av_image_copy(out->data, out->linesize, in->data, in->linesize, + in->format, in->width, in->height); + + av_frame_free(&in); + return ff_filter_frame(outlink, out); +} + static const AVFilterPad avfilter_vf_copy_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .get_video_buffer = ff_null_get_video_buffer, - .rej_perms = ~0 + .filter_frame = filter_frame, }, { NULL } }; -- cgit v1.2.3