Unified · Split
| @@ -40,6 +40,7 @@ typedef struct { · 39 unmodified lines | ||
| 40 | 40 | unsigned nb_frames; |
| 41 | 41 | FFDrawContext draw; |
| 42 | 42 | FFDrawColor blank; |
| 43 | + AVFilterBufferRef *out_ref; | |
| 43 | 44 | } TileContext; |
| 44 | 45 | |
| 45 | 46 | #define REASONABLE_SIZE 1024 |
| @@ -153,10 +154,9 @@ static int end_last_frame(AVFilterContext *ctx) · 107 unmodified lines | ||
| 153 | 154 | { |
| 154 | 155 | TileContext *tile = ctx->priv; |
| 155 | 156 | AVFilterLink *outlink = ctx->outputs[0]; |
| 156 | − AVFilterBufferRef *out_buf = outlink->out_buf; | |
| 157 | + AVFilterBufferRef *out_buf = tile->out_ref; | |
| 157 | 158 | int ret; |
| 158 | 159 | |
| 159 | − outlink->out_buf = NULL; | |
| 160 | 160 | while (tile->current < tile->nb_frames) |
| 161 | 161 | draw_blank_frame(ctx, out_buf); |
| 162 | 162 | ret = ff_filter_frame(outlink, out_buf); |
| @@ -176,29 +176,29 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 13 unmodified lines | ||
| 176 | 176 | unsigned x0, y0; |
| 177 | 177 | |
| 178 | 178 | if (!tile->current) { |
| 179 | − outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 180 | − outlink->w, outlink->h); | |
| 181 | − if (!outlink->out_buf) | |
| 179 | + tile->out_ref = ff_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 180 | + outlink->w, outlink->h); | |
| 181 | + if (!tile->out_ref) | |
| 182 | 182 | return AVERROR(ENOMEM); |
| 183 | − avfilter_copy_buffer_ref_props(outlink->out_buf, picref); | |
| 184 | − outlink->out_buf->video->w = outlink->w; | |
| 185 | − outlink->out_buf->video->h = outlink->h; | |
| 183 | + avfilter_copy_buffer_ref_props(tile->out_ref, picref); | |
| 184 | + tile->out_ref->video->w = outlink->w; | |
| 185 | + tile->out_ref->video->h = outlink->h; | |
| 186 | 186 | |
| 187 | 187 | /* fill surface once for margin/padding */ |
| 188 | 188 | if (tile->margin || tile->padding) |
| 189 | 189 | ff_fill_rectangle(&tile->draw, &tile->blank, |
| 190 | − outlink->out_buf->data, | |
| 191 | − outlink->out_buf->linesize, | |
| 190 | + tile->out_ref->data, | |
| 191 | + tile->out_ref->linesize, | |
| 192 | 192 | 0, 0, outlink->w, outlink->h); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | get_current_tile_pos(ctx, &x0, &y0); |
| 196 | 196 | ff_copy_rectangle2(&tile->draw, |
| 197 | − outlink->out_buf->data, outlink->out_buf->linesize, | |
| 198 | − inlink ->cur_buf->data, inlink ->cur_buf->linesize, | |
| 197 | + tile->out_ref->data, tile->out_ref->linesize, | |
| 198 | + picref->data, picref->linesize, | |
| 199 | 199 | x0, y0, 0, 0, inlink->w, inlink->h); |
| 200 | 200 | |
| 201 | − avfilter_unref_bufferp(&inlink->cur_buf); | |
| 201 | + avfilter_unref_bufferp(&picref); | |
| 202 | 202 | if (++tile->current == tile->nb_frames) |
| 203 | 203 | return end_last_frame(ctx); |
| 204 | 204 | |