[FFmpeg-cvslog] lavfi/smartblur: switch to filter_frame.

Clément Bœsch git at videolan.org
Thu Nov 29 12:53:40 CET 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Nov 29 12:49:03 2012 +0100| [ea3bad0e9e3e7253f3770946d61dfecc855244e5] | committer: Clément Bœsch

lavfi/smartblur: switch to filter_frame.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea3bad0e9e3e7253f3770946d61dfecc855244e5
---

 libavfilter/vf_smartblur.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
index 2a83cd0..54ab209 100644
--- a/libavfilter/vf_smartblur.c
+++ b/libavfilter/vf_smartblur.c
@@ -246,16 +246,21 @@ static void blur(uint8_t       *dst, const int dst_linesize,
     }
 }
 
-static int end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
 {
-    int ret;
     SmartblurContext  *sblur  = inlink->dst->priv;
-    AVFilterBufferRef *inpic  = inlink->cur_buf;
     AVFilterLink *outlink     = inlink->dst->outputs[0];
-    AVFilterBufferRef *outpic = outlink->out_buf;
+    AVFilterBufferRef *outpic;
     int cw = inlink->w >> sblur->hsub;
     int ch = inlink->h >> sblur->vsub;
 
+    outpic = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    if (!outpic) {
+        avfilter_unref_bufferp(&inpic);
+        return AVERROR(ENOMEM);
+    }
+    avfilter_copy_buffer_ref_props(outpic, inpic);
+
     blur(outpic->data[0], outpic->linesize[0],
          inpic->data[0],  inpic->linesize[0],
          inlink->w, inlink->h, sblur->luma.threshold,
@@ -272,16 +277,15 @@ static int end_frame(AVFilterLink *inlink)
              sblur->chroma.filter_context);
     }
 
-    if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0)
-        return ret;
-    return ff_end_frame(outlink);
+    avfilter_unref_bufferp(&inpic);
+    return ff_filter_frame(outlink, outpic);
 }
 
 static const AVFilterPad smartblur_inputs[] = {
     {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
-        .end_frame    = end_frame,
+        .filter_frame = filter_frame,
         .config_props = config_props,
         .min_perms    = AV_PERM_READ,
     },



More information about the ffmpeg-cvslog mailing list