summaryrefslogtreecommitdiff
path: root/libavfilter/video.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-08-12 10:59:37 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-08-14 12:00:35 +0200
commit271ddb116c8a3e0f2a34cedbb906a2883b5289b1 (patch)
tree01713b5b7e337401957b7818874183fe8be12970 /libavfilter/video.c
parent67a804b9ac12efbb8e1c84c6716dec77c9120bd1 (diff)
downloadffmpeg-271ddb116c8a3e0f2a34cedbb906a2883b5289b1.tar.gz
lavfi: use min_perms and rej_perms for out pads.
There are several reasons for doing that: 1. It documents the code for the reader and helps find inconsistencies and bugs. 2. For rej_perms, it guarantees the change will be done even if the output reference can be created by several code paths. 3. It can be used to predict cases where a copy will, or will not happen and optimize buffer allocation (for example not request a rare direct-rendering buffer from a device sink if it will be copied anyway). Note that a filter is still allowed to manage the permissions on its own without using these fields.
Diffstat (limited to 'libavfilter/video.c')
-rw-r--r--libavfilter/video.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/video.c b/libavfilter/video.c
index eb92edd8f2..b7a8b86dad 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -232,8 +232,9 @@ static void clear_link(AVFilterLink *link)
int ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
{
int (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
+ AVFilterPad *src = link->srcpad;
AVFilterPad *dst = link->dstpad;
- int ret, perms = picref->perms;
+ int ret, perms;
AVFilterCommand *cmd= link->dst->command_queue;
int64_t pts;
@@ -242,6 +243,10 @@ int ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
if (!(start_frame = dst->start_frame))
start_frame = default_start_frame;
+ av_assert1((picref->perms & src->min_perms) == src->min_perms);
+ picref->perms &= ~ src->rej_perms;
+ perms = picref->perms;
+
if (picref->linesize[0] < 0)
perms |= AV_PERM_NEG_LINESIZES;
/* prepare to copy the picture if it has insufficient permissions */