[FFmpeg-cvslog] lavfi/field: switch to filter_frame API

Stefano Sabatini git at videolan.org
Thu Dec 6 13:52:27 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Dec  6 13:50:27 2012 +0100| [c3fa6add58288dda34c88a6c0c9e0cc79f29169b] | committer: Stefano Sabatini

lavfi/field: switch to filter_frame API

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

 libavfilter/vf_field.c |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/libavfilter/vf_field.c b/libavfilter/vf_field.c
index c9ac42b..67c0025 100644
--- a/libavfilter/vf_field.c
+++ b/libavfilter/vf_field.c
@@ -82,33 +82,21 @@ static int config_props_output(AVFilterLink *outlink)
     return 0;
 }
 
-static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
 {
     FieldContext *field = inlink->dst->priv;
-    AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
     AVFilterLink *outlink = inlink->dst->outputs[0];
     int i;
 
-    if (!outpicref)
-        return AVERROR(ENOMEM);
-
-    outpicref->video->h = outlink->h;
-    outpicref->video->interlaced = 0;
+    inpicref->video->h = outlink->h;
+    inpicref->video->interlaced = 0;
 
     for (i = 0; i < field->nb_planes; i++) {
         if (field->type == FIELD_TYPE_BOTTOM)
-            outpicref->data[i] = inpicref->data[i] + inpicref->linesize[i];
-        outpicref->linesize[i] = 2 * inpicref->linesize[i];
+            inpicref->data[i] = inpicref->data[i] + inpicref->linesize[i];
+        inpicref->linesize[i] = 2 * inpicref->linesize[i];
     }
-    return ff_start_frame(outlink, outpicref);
-}
-
-static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
-    FieldContext *field = inlink->dst->priv;
-    int y1 = (y + (field->type == FIELD_TYPE_TOP)) / 2;
-    int h1 = (h + (field->type == FIELD_TYPE_TOP)) / 2;
-    return ff_draw_slice(inlink->dst->outputs[0], y1, h1, slice_dir);
+    return ff_filter_frame(outlink, inpicref);
 }
 
 static const AVFilterPad field_inputs[] = {
@@ -116,9 +104,7 @@ static const AVFilterPad field_inputs[] = {
         .name             = "default",
         .type             = AVMEDIA_TYPE_VIDEO,
         .get_video_buffer = ff_null_get_video_buffer,
-        .start_frame      = start_frame,
-        .draw_slice       = draw_slice,
-        .end_frame        = ff_null_end_frame,
+        .filter_frame     = filter_frame,
     },
     { NULL }
 };



More information about the ffmpeg-cvslog mailing list