Browse code

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

Based on patch by Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/11/29 02:07:51
Showing 1 changed files
... ...
@@ -965,23 +965,17 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
965 965
     return 0;
966 966
 }
967 967
 
968
-static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
969
-{
970
-    return 0;
971
-}
972
-
973
-static int end_frame(AVFilterLink *inlink)
968
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
974 969
 {
975 970
     AVFilterContext *ctx = inlink->dst;
976 971
     AVFilterLink *outlink = ctx->outputs[0];
977 972
     DrawTextContext *dtext = ctx->priv;
978
-    AVFilterBufferRef *picref = inlink->cur_buf;
979 973
     int ret;
980 974
 
981
-    dtext->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ?
982
-        NAN : picref->pts * av_q2d(inlink->time_base);
975
+    dtext->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
976
+        NAN : frame->pts * av_q2d(inlink->time_base);
983 977
 
984
-    draw_text(ctx, picref, picref->video->w, picref->video->h);
978
+    draw_text(ctx, frame, frame->video->w, frame->video->h);
985 979
 
986 980
     av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d\n",
987 981
            (int)dtext->var_values[VAR_N], dtext->var_values[VAR_T],
... ...
@@ -990,10 +984,7 @@ static int end_frame(AVFilterLink *inlink)
990 990
 
991 991
     dtext->var_values[VAR_N] += 1.0;
992 992
 
993
-    if ((ret = ff_draw_slice(outlink, 0, picref->video->h, 1)) < 0 ||
994
-        (ret = ff_end_frame(outlink)) < 0)
995
-        return ret;
996
-    return 0;
993
+    return ff_filter_frame(inlink->dst->outputs[0], frame);
997 994
 }
998 995
 
999 996
 static const AVFilterPad avfilter_vf_drawtext_inputs[] = {
... ...
@@ -1001,9 +992,7 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = {
1001 1001
         .name             = "default",
1002 1002
         .type             = AVMEDIA_TYPE_VIDEO,
1003 1003
         .get_video_buffer = ff_null_get_video_buffer,
1004
-        .start_frame      = ff_null_start_frame,
1005
-        .draw_slice       = null_draw_slice,
1006
-        .end_frame        = end_frame,
1004
+        .filter_frame     = filter_frame,
1007 1005
         .config_props     = config_input,
1008 1006
         .min_perms        = AV_PERM_WRITE |
1009 1007
                             AV_PERM_READ,