diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-08-01 14:23:48 +0400 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-08-01 14:23:48 +0400 |
commit | f952b23ed4b720b4544d520713458ea28e12c2d6 (patch) | |
tree | 30a48effc7768f4cc97c3e26d6b55b73feb57ded | |
parent | 7ddf082f0425ef40bc679d4fae901a1d73463d1c (diff) |
vf_tile: fix output buffer ownership.
There is no need to start_frame immediately on the output link
since the rest is only done with the last frame of the tile.
link->out_buf is now automatically dereferenced; since we give
it away it must be cleared.
Fix an assert failure; found by Clément Bœsch.
-rw-r--r-- | libavfilter/vf_tile.c | 14 |
1 files changed, 8 insertions, 6 deletions
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; } |