diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-28 21:07:51 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-28 21:07:51 +0400 |
commit | 7bfa2f25c02130344c576c523003e199fc5103c2 (patch) | |
tree | 810adc2dc962a4117e681eca3155d85d6a24915c /libavfilter/vf_drawtext.c | |
parent | 384641468b60f40e9bf9b1f887abd5e3c3a9be1c (diff) |
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>
Diffstat (limited to 'libavfilter/vf_drawtext.c')
-rw-r--r-- | libavfilter/vf_drawtext.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 509fbd22f5..5fff9bf16e 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -965,23 +965,17 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, return 0; } -static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) -{ - return 0; -} - -static int end_frame(AVFilterLink *inlink) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame) { AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; DrawTextContext *dtext = ctx->priv; - AVFilterBufferRef *picref = inlink->cur_buf; int ret; - dtext->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ? - NAN : picref->pts * av_q2d(inlink->time_base); + dtext->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ? + NAN : frame->pts * av_q2d(inlink->time_base); - draw_text(ctx, picref, picref->video->w, picref->video->h); + draw_text(ctx, frame, frame->video->w, frame->video->h); av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d\n", (int)dtext->var_values[VAR_N], dtext->var_values[VAR_T], @@ -990,10 +984,7 @@ static int end_frame(AVFilterLink *inlink) dtext->var_values[VAR_N] += 1.0; - if ((ret = ff_draw_slice(outlink, 0, picref->video->h, 1)) < 0 || - (ret = ff_end_frame(outlink)) < 0) - return ret; - return 0; + return ff_filter_frame(inlink->dst->outputs[0], frame); } static const AVFilterPad avfilter_vf_drawtext_inputs[] = { @@ -1001,9 +992,7 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .get_video_buffer = ff_null_get_video_buffer, - .start_frame = ff_null_start_frame, - .draw_slice = null_draw_slice, - .end_frame = end_frame, + .filter_frame = filter_frame, .config_props = config_input, .min_perms = AV_PERM_WRITE | AV_PERM_READ, |