[FFmpeg-cvslog] vf_libopencv: switch to filter_frame, this filter did not support slices

Anton Khirnov git at videolan.org
Wed Nov 28 20:26:41 CET 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Nov 28 20:10:51 2012 +0100| [1f94f86ab56076f9658c9706c0a373358fc2c7b8] | committer: Michael Niedermayer

vf_libopencv: switch to filter_frame, this filter did not support slices

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/vf_libopencv.c |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index 8192007..1b8a5dc 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -32,6 +32,7 @@
 #include "libavutil/file.h"
 #include "avfilter.h"
 #include "formats.h"
+#include "internal.h"
 #include "video.h"
 
 static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *picref, enum AVPixelFormat pixfmt)
@@ -68,11 +69,6 @@ static int query_formats(AVFilterContext *ctx)
     return 0;
 }
 
-static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    return 0;
-}
-
 typedef struct {
     const char *name;
     int (*init)(AVFilterContext *ctx, const char *args);
@@ -355,33 +351,36 @@ static av_cold void uninit(AVFilterContext *ctx)
     memset(ocv, 0, sizeof(*ocv));
 }
 
-static int end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
 {
     AVFilterContext *ctx = inlink->dst;
     OCVContext *ocv = ctx->priv;
     AVFilterLink *outlink= inlink->dst->outputs[0];
-    AVFilterBufferRef *inpicref  = inlink ->cur_buf;
-    AVFilterBufferRef *outpicref = outlink->out_buf;
+    AVFilterBufferRef *out;
     IplImage inimg, outimg;
-    int ret;
 
-    fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
-    fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
+    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    if (!out) {
+        avfilter_unref_bufferp(&in);
+        return AVERROR(ENOMEM);
+    }
+    avfilter_copy_buffer_ref_props(out, in);
+
+    fill_iplimage_from_picref(&inimg , in , inlink->format);
+    fill_iplimage_from_picref(&outimg, out, inlink->format);
     ocv->end_frame_filter(ctx, &inimg, &outimg);
-    fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
+    fill_picref_from_iplimage(out, &outimg, inlink->format);
 
-    if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
-        (ret = ff_end_frame(outlink)) < 0)
-        return ret;
-    return 0;
+    avfilter_unref_bufferp(&in);
+
+    return ff_filter_frame(outlink, out);
 }
 
 static const AVFilterPad avfilter_vf_ocv_inputs[] = {
     {
         .name       = "default",
         .type       = AVMEDIA_TYPE_VIDEO,
-        .draw_slice = null_draw_slice,
-        .end_frame  = end_frame,
+        .filter_frame = filter_frame,
         .min_perms  = AV_PERM_READ
     },
     { NULL }



More information about the ffmpeg-cvslog mailing list