summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2009-10-18 08:16:18 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2009-10-18 08:16:18 +0000
commit0eb4ff9e37f2b44bcf143c9b503609cea5db13cb (patch)
tree9d4e1147fb92cb99fe7828d562c2990b5183ccce /libavfilter/avfilter.c
parent1f09ab5e6665d0cae34fe4b378f16268e712e748 (diff)
Make avfilter_get_video_buffer() recursive.
When called on a link with a filter whose destination pad has not a get_video_buffer callback defined, it will call avfilter_get_video_buffer() on the first output link of the destination filer, rather than use avfilter_default_get_buffer(), so the video buffer can be allocated forward in the filterchain. Also add the w and h parameters to avfilter_get_video_buffer(), as the minimum width and height requested by each filter in the filterchain may change, this allows for example a memcpy-less pad filter. This change breaks API / ABI backward compatibility. See the thread: "[PATCH] Implement recusive avfilter_get_video_buffer()". Originally committed as revision 20272 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 60880779ff..77c7571388 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -185,17 +185,20 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end)
#define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
-AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms)
+AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
AVFilterPicRef *ret = NULL;
- DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d\n", perms);
+ DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h);
if(link_dpad(link).get_video_buffer)
- ret = link_dpad(link).get_video_buffer(link, perms);
+ ret = link_dpad(link).get_video_buffer(link, perms, w, h);
+
+ if(!ret && link->dst->output_count)
+ ret = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
if(!ret)
- ret = avfilter_default_get_video_buffer(link, perms);
+ ret = avfilter_default_get_video_buffer(link, perms, w, h);
DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);
@@ -251,7 +254,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
link_dpad(link).min_perms, link_dpad(link).rej_perms);
*/
- link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms);
+ link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
link->srcpic = picref;
link->cur_pic->pts = link->srcpic->pts;
link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;