Commit f90b9868 authored by vitor's avatar vitor

The filter framework as is hangs with filters that

modify the input buffer, even if it asks for the right 
permission. This is a fix for that.
See "Box blurring with libavfilter" thread in libav-user.

Commited in SoC by Vitor Sessak on 2008-02-09 11:03:35


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12040 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8671200c
...@@ -213,10 +213,12 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref) ...@@ -213,10 +213,12 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
/* prepare to copy the picture if it has insufficient permissions */ /* prepare to copy the picture if it has insufficient permissions */
if((link_dpad(link).min_perms & picref->perms) != link_dpad(link).min_perms || if((link_dpad(link).min_perms & picref->perms) != link_dpad(link).min_perms ||
link_dpad(link).rej_perms & picref->perms) { link_dpad(link).rej_perms & picref->perms) {
/*
av_log(link->dst, AV_LOG_INFO, av_log(link->dst, AV_LOG_INFO,
"frame copy needed (have perms %x, need %x, reject %x)\n", "frame copy needed (have perms %x, need %x, reject %x)\n",
picref->perms, picref->perms,
link_dpad(link).min_perms, link_dpad(link).rej_perms); link_dpad(link).min_perms, link_dpad(link).rej_perms);
*/
link->cur_pic = avfilter_default_get_video_buffer(link, link_dpad(link).min_perms); link->cur_pic = avfilter_default_get_video_buffer(link, link_dpad(link).min_perms);
link->srcpic = picref; link->srcpic = picref;
...@@ -231,6 +233,11 @@ void avfilter_end_frame(AVFilterLink *link) ...@@ -231,6 +233,11 @@ void avfilter_end_frame(AVFilterLink *link)
{ {
void (*end_frame)(AVFilterLink *); 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 /* unreference the source picture if we're feeding the destination filter
* a copied version dues to permission issues */ * a copied version dues to permission issues */
if(link->srcpic) { if(link->srcpic) {
...@@ -238,10 +245,6 @@ void avfilter_end_frame(AVFilterLink *link) ...@@ -238,10 +245,6 @@ void avfilter_end_frame(AVFilterLink *link)
link->srcpic = NULL; link->srcpic = NULL;
} }
if(!(end_frame = link_dpad(link).end_frame))
end_frame = avfilter_default_end_frame;
end_frame(link);
} }
void avfilter_draw_slice(AVFilterLink *link, int y, int h) void avfilter_draw_slice(AVFilterLink *link, int y, int h)
...@@ -253,6 +256,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h) ...@@ -253,6 +256,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h)
if(link->srcpic) { if(link->srcpic) {
avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
link->cur_pic->pts = link->srcpic->pts;
src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0]; src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0];
dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0]; dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0];
for(i = 1; i < 4; i ++) { for(i = 1; i < 4; i ++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment