summaryrefslogtreecommitdiff
path: root/libavfilter/vf_copy.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-28 08:41:07 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-08 07:37:18 +0100
commit7e350379f87e7f74420b4813170fe808e2313911 (patch)
tree031201839361d40af8b4c829f9c9f179e7d9f58d /libavfilter/vf_copy.c
parent77b2cd7b41d7ec8008b6fac753c04f77824c514c (diff)
lavfi: switch to AVFrame.
Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it and use AVFrame instead.
Diffstat (limited to 'libavfilter/vf_copy.c')
-rw-r--r--libavfilter/vf_copy.c20
1 files changed, 19 insertions, 1 deletions
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 }
};