diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-08-14 18:35:50 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-08-17 18:26:38 +0200 |
commit | e54e30c88940fc090409cc60df4e452af6ef178d (patch) | |
tree | 0aa4a121ecba6b28fe26e87c79cc6dd582d69f54 /libavfilter/audio.c | |
parent | cc8104b9086d2951a8c47601117275fadc70bc02 (diff) | |
download | ffmpeg-e54e30c88940fc090409cc60df4e452af6ef178d.tar.gz |
lavfi: grant all permissions on mallocated audio buffers.
The permissions not requested by the filter that created
the buffer may be useful for a later filter and avoid a copy.
Diffstat (limited to 'libavfilter/audio.c')
-rw-r--r-- | libavfilter/audio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavfilter/audio.c b/libavfilter/audio.c index aa87488f5f..525b471065 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -42,6 +42,10 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms, int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout); int planes = planar ? nb_channels : 1; int linesize; + 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 (!(data = av_mallocz(sizeof(*data) * planes))) goto fail; @@ -49,7 +53,7 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms, if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0) goto fail; - samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, perms, + samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, full_perms, nb_samples, link->format, link->channel_layout); if (!samplesref) |