[FFmpeg-devel] [PATCH] lavfi/super2xsai: switch to ff_filter_frame() API

Stefano Sabatini stefasab at gmail.com
Sun Dec 2 01:53:54 CET 2012


---
 libavfilter/vf_super2xsai.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c
index af4adff..d082761 100644
--- a/libavfilter/vf_super2xsai.c
+++ b/libavfilter/vf_super2xsai.c
@@ -30,6 +30,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avfilter.h"
 #include "formats.h"
+#include "internal.h"
 #include "video.h"
 
 typedef struct {
@@ -302,20 +303,20 @@ static int config_output(AVFilterLink *outlink)
     return 0;
 }
 
-static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { return 0; }
-
-static int end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inframe)
 {
     AVFilterLink *outlink = inlink->dst->outputs[0];
-    AVFilterBufferRef  *inpicref =  inlink->cur_buf;
-    AVFilterBufferRef *outpicref = outlink->out_buf;
-
-    super2xsai(inlink->dst, inpicref->data[0], inpicref->linesize[0],
-               outpicref->data[0], outpicref->linesize[0],
+    AVFilterBufferRef *outframe = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    if (!outframe) {
+        avfilter_unref_bufferp(&inframe);
+        return AVERROR(ENOMEM);
+    }
+    avfilter_copy_buffer_ref_props(outframe, inframe);
+    super2xsai(inlink->dst, inframe->data[0], inframe->linesize[0],
+               outframe->data[0], outframe->linesize[0],
                inlink->w, inlink->h);
 
-    ff_draw_slice(outlink, 0, outlink->h, 1);
-    return ff_end_frame(outlink);
+    return ff_filter_frame(outlink, outframe);
 }
 
 static const AVFilterPad super2xsai_inputs[] = {
@@ -323,8 +324,7 @@ static const AVFilterPad super2xsai_inputs[] = {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input,
-        .draw_slice   = null_draw_slice,
-        .end_frame    = end_frame,
+        .filter_frame = filter_frame,
         .min_perms    = AV_PERM_READ,
     },
     { NULL }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list