aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-02-15 21:59:47 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-02-15 21:59:47 +0000
commit4d62c9d377816676e095c034b687c5ca1211fc6f (patch)
tree8685e7772364cd1667f5d0a063003c99c82eea07
parentfc0f39c22265809b1efe9247740cdd6777912842 (diff)
downloadffmpeg-4d62c9d377816676e095c034b687c5ca1211fc6f.tar.gz
Track the permissions that have been given out to each picture.
This should make it easier to know what can be done to a buffer once it's been passed to your filter without falling back to copying it "just to be safe". Commited in SoC by Bobby Bingham on 2007-08-17 18:21:07 Originally committed as revision 12068 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavfilter/defaults.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index da739d9d97..50b13dc416 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -28,6 +28,13 @@ void avfilter_default_free_video_buffer(AVFilterPic *pic)
av_free(pic);
}
+AVFilterPicRef *avfilter_next_get_video_buffer(AVFilterLink *link, int perms)
+{
+ if(!link->dst->outputs[0])
+ return NULL;
+ return avfilter_get_video_buffer(link->dst->outputs[0], perms);
+}
+
/* 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. */
@@ -41,6 +48,9 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
ref->h = link->h;
ref->perms = perms;
+ /* we always give the destination filter read access by default */
+ avfilter_add_pic_perms(ref, link->dst, AV_PERM_READ);
+
pic->refcount = 1;
pic->format = link->format;
pic->free = avfilter_default_free_video_buffer;
@@ -62,7 +72,7 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
if(out) {
out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
out->outpic->pts = picref->pts;
- avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
+ avfilter_start_frame(out, avfilter_ref_pic(out->outpic, out->dst, ~0));
}
}