-/* XXX: should we do the duplicating of the picture ref here, instead of
- * forcing the source filter to do it? */
-void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
-{
- void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
- AVFilterPad *dst = &link_dpad(link);
-
- FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_picref(NULL, picref, 1);
-
- if(!(start_frame = dst->start_frame))
- start_frame = avfilter_default_start_frame;
-
- /* prepare to copy the picture if it has insufficient permissions */
- if((dst->min_perms & picref->perms) != dst->min_perms ||
- dst->rej_perms & picref->perms) {
- /*
- av_log(link->dst, AV_LOG_INFO,
- "frame copy needed (have perms %x, need %x, reject %x)\n",
- picref->perms,
- link_dpad(link).min_perms, link_dpad(link).rej_perms);
- */
-
- link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
- link->srcpic = picref;
- avfilter_copy_buffer_ref_props(link->cur_pic, link->srcpic);
- }
- else
- link->cur_pic = picref;
-
- start_frame(link, link->cur_pic);
-}
-
-void avfilter_end_frame(AVFilterLink *link)
-{
- void (*end_frame)(AVFilterLink *);
-
- if(!(end_frame = link_dpad(link).end_frame))
- end_frame = avfilter_default_end_frame;
-
- end_frame(link);
-
- /* unreference the source picture if we're feeding the destination filter
- * a copied version dues to permission issues */
- if(link->srcpic) {
- avfilter_unref_buffer(link->srcpic);
- link->srcpic = NULL;
- }
-
-}
-
-void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- uint8_t *src[4], *dst[4];
- int i, j, vsub;
- void (*draw_slice)(AVFilterLink *, int, int, int);
-
- 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);
-
- /* copy the slice if needed for permission reasons */
- if(link->srcpic) {
- vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
- for(i = 0; i < 4; i ++) {
- if(link->srcpic->data[i]) {
- src[i] = link->srcpic-> data[i] +
- (y >> (i==0 ? 0 : vsub)) * link->srcpic-> linesize[i];
- dst[i] = link->cur_pic->data[i] +
- (y >> (i==0 ? 0 : vsub)) * link->cur_pic->linesize[i];
- } else
- src[i] = dst[i] = NULL;
- }
-
- for(i = 0; i < 4; i ++) {
- int planew =
- ff_get_plane_bytewidth(link->format, link->cur_pic->w, i);
-
- if(!src[i]) continue;
-
- for(j = 0; j < h >> (i==0 ? 0 : vsub); j ++) {
- memcpy(dst[i], src[i], planew);
- src[i] += link->srcpic ->linesize[i];
- dst[i] += link->cur_pic->linesize[i];
- }
- }
- }
-
- if(!(draw_slice = link_dpad(link).draw_slice))
- draw_slice = avfilter_default_draw_slice;
- draw_slice(link, y, h, slice_dir);
-}
-