summaryrefslogtreecommitdiff
path: root/libavfilter/defaults.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/defaults.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/defaults.c')
-rw-r--r--libavfilter/defaults.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index dabb1d5bf0..1983672cd6 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -32,7 +32,7 @@ void avfilter_default_free_video_buffer(AVFilterPic *pic)
/* TODO: set the buffer's priv member to a context structure for the whole
* filter chain. This will allow for a buffer pool instead of the constant
* alloc & free cycle currently implemented. */
-AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
+AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
@@ -40,8 +40,8 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
char *buf;
ref->pic = pic;
- ref->w = pic->w = link->w;
- ref->h = pic->h = link->h;
+ ref->w = pic->w = w;
+ ref->h = pic->h = h;
/* make sure the buffer gets read permission or it's useless for output */
ref->perms = perms | AV_PERM_READ;
@@ -72,7 +72,7 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
out = link->dst->outputs[0];
if(out) {
- out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
+ out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE, link->w, link->h);
out->outpic->pts = picref->pts;
avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
}