Revision 5d4890d7

View differences:

ffmpeg.c
368 368

  
369 369
    if(avfilter_request_frame(ctx->inputs[0]))
370 370
        return -1;
371
    if(!(pic = ctx->inputs[0]->cur_pic))
371
    if(!(pic = ctx->inputs[0]->cur_buf))
372 372
        return -1;
373 373
    *picref = pic;
374
    ctx->inputs[0]->cur_pic = NULL;
374
    ctx->inputs[0]->cur_buf = NULL;
375 375

  
376 376
    *pts          = pic->pts;
377 377

  
ffplay.c
1745 1745

  
1746 1746
    if(avfilter_request_frame(ctx->inputs[0]))
1747 1747
        return -1;
1748
    if(!(pic = ctx->inputs[0]->cur_pic))
1748
    if(!(pic = ctx->inputs[0]->cur_buf))
1749 1749
        return -1;
1750
    ctx->inputs[0]->cur_pic = NULL;
1750
    ctx->inputs[0]->cur_buf = NULL;
1751 1751

  
1752 1752
    frame->opaque = pic;
1753 1753
    *pts          = pic->pts;
libavfilter/avfilter.c
262 262
                link_dpad(link).min_perms, link_dpad(link).rej_perms);
263 263
        */
264 264

  
265
        link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
266
        link->srcpic = picref;
267
        avfilter_copy_buffer_ref_props(link->cur_pic, link->srcpic);
265
        link->cur_buf = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
266
        link->src_buf = picref;
267
        avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);
268 268
    }
269 269
    else
270
        link->cur_pic = picref;
270
        link->cur_buf = picref;
271 271

  
272
    start_frame(link, link->cur_pic);
272
    start_frame(link, link->cur_buf);
273 273
}
274 274

  
275 275
void avfilter_end_frame(AVFilterLink *link)
......
283 283

  
284 284
    /* unreference the source picture if we're feeding the destination filter
285 285
     * a copied version dues to permission issues */
286
    if(link->srcpic) {
287
        avfilter_unref_buffer(link->srcpic);
288
        link->srcpic = NULL;
286
    if(link->src_buf) {
287
        avfilter_unref_buffer(link->src_buf);
288
        link->src_buf = NULL;
289 289
    }
290 290

  
291 291
}
......
299 299
    FF_DPRINTF_START(NULL, draw_slice); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
300 300

  
301 301
    /* copy the slice if needed for permission reasons */
302
    if(link->srcpic) {
302
    if(link->src_buf) {
303 303
        vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
304 304

  
305 305
        for(i = 0; i < 4; i ++) {
306
            if(link->srcpic->data[i]) {
307
                src[i] = link->srcpic-> data[i] +
308
                    (y >> (i==0 ? 0 : vsub)) * link->srcpic-> linesize[i];
309
                dst[i] = link->cur_pic->data[i] +
310
                    (y >> (i==0 ? 0 : vsub)) * link->cur_pic->linesize[i];
306
            if(link->src_buf->data[i]) {
307
                src[i] = link->src_buf-> data[i] +
308
                    (y >> (i==0 ? 0 : vsub)) * link->src_buf-> linesize[i];
309
                dst[i] = link->cur_buf->data[i] +
310
                    (y >> (i==0 ? 0 : vsub)) * link->cur_buf->linesize[i];
311 311
            } else
312 312
                src[i] = dst[i] = NULL;
313 313
        }
314 314

  
315 315
        for(i = 0; i < 4; i ++) {
316 316
            int planew =
317
                ff_get_plane_bytewidth(link->format, link->cur_pic->w, i);
317
                ff_get_plane_bytewidth(link->format, link->cur_buf->w, i);
318 318

  
319 319
            if(!src[i]) continue;
320 320

  
321 321
            for(j = 0; j < h >> (i==0 ? 0 : vsub); j ++) {
322 322
                memcpy(dst[i], src[i], planew);
323
                src[i] += link->srcpic ->linesize[i];
324
                dst[i] += link->cur_pic->linesize[i];
323
                src[i] += link->src_buf ->linesize[i];
324
                dst[i] += link->cur_buf->linesize[i];
325 325
            }
326 326
        }
327 327
    }
libavfilter/avfilter.h
25 25
#include "libavutil/avutil.h"
26 26

  
27 27
#define LIBAVFILTER_VERSION_MAJOR  1
28
#define LIBAVFILTER_VERSION_MINOR 30
28
#define LIBAVFILTER_VERSION_MINOR 31
29 29
#define LIBAVFILTER_VERSION_MICRO  0
30 30

  
31 31
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
530 530
     * for the destination. This should not be accessed directly by the
531 531
     * filters.
532 532
     */
533
    AVFilterBufferRef *srcpic;
533
    AVFilterBufferRef *src_buf;
534 534

  
535
    AVFilterBufferRef *cur_pic;
536
    AVFilterBufferRef *outpic;
535
    AVFilterBufferRef *cur_buf;
536
    AVFilterBufferRef *out_buf;
537 537
};
538 538

  
539 539
/**
libavfilter/defaults.c
73 73
        out = link->dst->outputs[0];
74 74

  
75 75
    if(out) {
76
        out->outpic      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
77
        avfilter_copy_buffer_ref_props(out->outpic, picref);
78
        avfilter_start_frame(out, avfilter_ref_buffer(out->outpic, ~0));
76
        out->out_buf      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
77
        avfilter_copy_buffer_ref_props(out->out_buf, picref);
78
        avfilter_start_frame(out, avfilter_ref_buffer(out->out_buf, ~0));
79 79
    }
80 80
}
81 81

  
......
97 97
    if(link->dst->output_count)
98 98
        out = link->dst->outputs[0];
99 99

  
100
    avfilter_unref_buffer(link->cur_pic);
101
    link->cur_pic = NULL;
100
    avfilter_unref_buffer(link->cur_buf);
101
    link->cur_buf = NULL;
102 102

  
103 103
    if(out) {
104
        if(out->outpic) {
105
            avfilter_unref_buffer(out->outpic);
106
            out->outpic = NULL;
104
        if(out->out_buf) {
105
            avfilter_unref_buffer(out->out_buf);
106
            out->out_buf = NULL;
107 107
        }
108 108
        avfilter_end_frame(out);
109 109
    }
libavfilter/vf_pad.c
247 247
    AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
248 248
    int plane;
249 249

  
250
    inlink->dst->outputs[0]->outpic = outpicref;
250
    inlink->dst->outputs[0]->out_buf = outpicref;
251 251

  
252 252
    for (plane = 0; plane < 4 && outpicref->data[plane]; plane++) {
253 253
        int hsub = (plane == 1 || plane == 2) ? pad->hsub : 0;
......
263 263
static void end_frame(AVFilterLink *link)
264 264
{
265 265
    avfilter_end_frame(link->dst->outputs[0]);
266
    avfilter_unref_buffer(link->cur_pic);
266
    avfilter_unref_buffer(link->cur_buf);
267 267
}
268 268

  
269 269
static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
......
282 282
    }
283 283

  
284 284
    if (bar_h) {
285
        draw_rectangle(link->dst->outputs[0]->outpic,
285
        draw_rectangle(link->dst->outputs[0]->out_buf,
286 286
                       pad->line, pad->line_step, pad->hsub, pad->vsub,
287 287
                       0, bar_y, pad->w, bar_h);
288 288
        avfilter_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir);
......
292 292
static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
293 293
{
294 294
    PadContext *pad = link->dst->priv;
295
    AVFilterBufferRef *outpic = link->dst->outputs[0]->outpic;
295
    AVFilterBufferRef *outpic = link->dst->outputs[0]->out_buf;
296 296

  
297 297
    y += pad->y;
298 298

  
libavfilter/vf_pixdesctest.c
55 55
    AVFilterBufferRef *outpicref;
56 56
    int i;
57 57

  
58
    outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
58
    outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
59 59
                                                outlink->w, outlink->h);
60
    outpicref = outlink->outpic;
60
    outpicref = outlink->out_buf;
61 61
    avfilter_copy_buffer_ref_props(outpicref, picref);
62 62

  
63 63
    for (i = 0; i < 4; i++) {
......
80 80
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
81 81
{
82 82
    PixdescTestContext *priv = inlink->dst->priv;
83
    AVFilterBufferRef *inpic    = inlink->cur_pic;
84
    AVFilterBufferRef *outpic   = inlink->dst->outputs[0]->outpic;
83
    AVFilterBufferRef *inpic    = inlink->cur_buf;
84
    AVFilterBufferRef *outpic   = inlink->dst->outputs[0]->out_buf;
85 85
    int i, c, w = inlink->w;
86 86

  
87 87
    for (c = 0; c < priv->pix_desc->nb_components; c++) {
libavfilter/vf_scale.c
154 154
    outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
155 155
    avfilter_copy_buffer_ref_props(outpicref, picref);
156 156

  
157
    outlink->outpic = outpicref;
157
    outlink->out_buf = outpicref;
158 158

  
159 159
    av_reduce(&outpicref->pixel_aspect.num, &outpicref->pixel_aspect.den,
160 160
              (int64_t)picref->pixel_aspect.num * outlink->h * link->w,
......
169 169
{
170 170
    ScaleContext *scale = link->dst->priv;
171 171
    int out_h;
172
    AVFilterBufferRef *cur_pic = link->cur_pic;
172
    AVFilterBufferRef *cur_pic = link->cur_buf;
173 173
    const uint8_t *data[4];
174 174

  
175 175
    if (scale->slice_y == 0 && slice_dir == -1)
......
183 183
    data[3] = cur_pic->data[3] +  y               * cur_pic->linesize[3];
184 184

  
185 185
    out_h = sws_scale(scale->sws, data, cur_pic->linesize, y, h,
186
                      link->dst->outputs[0]->outpic->data,
187
                      link->dst->outputs[0]->outpic->linesize);
186
                      link->dst->outputs[0]->out_buf->data,
187
                      link->dst->outputs[0]->out_buf->linesize);
188 188

  
189 189
    if (slice_dir == -1)
190 190
        scale->slice_y -= out_h;
libavfilter/vf_unsharp.c
195 195
static void end_frame(AVFilterLink *link)
196 196
{
197 197
    UnsharpContext *unsharp = link->dst->priv;
198
    AVFilterBufferRef *in  = link->cur_pic;
199
    AVFilterBufferRef *out = link->dst->outputs[0]->outpic;
198
    AVFilterBufferRef *in  = link->cur_buf;
199
    AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
200 200

  
201 201
    unsharpen(out->data[0], in->data[0], out->linesize[0], in->linesize[0], link->w,            link->h,             &unsharp->luma);
202 202
    unsharpen(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma);

Also available in: Unified diff