diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index a6c7e7a3ef..52d53ebcc1 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -109,7 +109,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) avfilter_copy_buffer_ref_props(outlink->out_buf, picref); outlink->out_buf->video->w = outlink->w; outlink->out_buf->video->h = outlink->h; - return ff_start_frame(outlink, outlink->out_buf); + return 0; } static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) @@ -129,16 +129,15 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) return 0; } -static void draw_blank_frame(AVFilterContext *ctx) +static void draw_blank_frame(AVFilterContext *ctx, AVFilterBufferRef *out_buf) { TileContext *tile = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; unsigned x0 = inlink->w * (tile->current % tile->w); unsigned y0 = inlink->h * (tile->current / tile->w); ff_fill_rectangle(&tile->draw, &tile->blank, - outlink->out_buf->data, outlink->out_buf->linesize, + out_buf->data, out_buf->linesize, x0, y0, inlink->w, inlink->h); tile->current++; } @@ -146,10 +145,13 @@ static void end_last_frame(AVFilterContext *ctx) { TileContext *tile = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; + AVFilterBufferRef *out_buf = outlink->out_buf; + outlink->out_buf = NULL; + ff_start_frame(outlink, out_buf); while (tile->current < tile->w * tile->h) - draw_blank_frame(ctx); - ff_draw_slice(outlink, 0, outlink->out_buf->video->h, 1); + draw_blank_frame(ctx, out_buf); + ff_draw_slice(outlink, 0, out_buf->video->h, 1); ff_end_frame(outlink); tile->current = 0; }