mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavfi: grant all permissions on mallocated video buffers.
The permissions not requested by the filter that created the buffer may be useful for a later filter and avoid a copy.
This commit is contained in:
parent
fa3fde168b
commit
046eb21c72
@ -43,6 +43,10 @@ AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, in
|
|||||||
int i;
|
int i;
|
||||||
AVFilterBufferRef *picref = NULL;
|
AVFilterBufferRef *picref = NULL;
|
||||||
AVFilterPool *pool = link->pool;
|
AVFilterPool *pool = link->pool;
|
||||||
|
int full_perms = AV_PERM_READ | AV_PERM_WRITE | AV_PERM_PRESERVE |
|
||||||
|
AV_PERM_REUSE | AV_PERM_REUSE2 | AV_PERM_ALIGN;
|
||||||
|
|
||||||
|
av_assert1(!(perms & ~(full_perms | AV_PERM_NEG_LINESIZES)));
|
||||||
|
|
||||||
if (pool) {
|
if (pool) {
|
||||||
for (i = 0; i < POOL_SIZE; i++) {
|
for (i = 0; i < POOL_SIZE; i++) {
|
||||||
@ -53,7 +57,7 @@ AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, in
|
|||||||
pool->count--;
|
pool->count--;
|
||||||
picref->video->w = w;
|
picref->video->w = w;
|
||||||
picref->video->h = h;
|
picref->video->h = h;
|
||||||
picref->perms = perms | AV_PERM_READ;
|
picref->perms = full_perms;
|
||||||
picref->format = link->format;
|
picref->format = link->format;
|
||||||
pic->refcount = 1;
|
pic->refcount = 1;
|
||||||
memcpy(picref->data, pic->data, sizeof(picref->data));
|
memcpy(picref->data, pic->data, sizeof(picref->data));
|
||||||
@ -72,7 +76,7 @@ AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, in
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
|
picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
|
||||||
perms, w, h, link->format);
|
full_perms, w, h, link->format);
|
||||||
if (!picref) {
|
if (!picref) {
|
||||||
av_free(data[0]);
|
av_free(data[0]);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user