[FFmpeg-devel] [PATCH] Add get_audio_buffer_ref to lavfi audio framework

S.N. Hemanth Meenakshisundaram smeenaks
Mon Sep 27 06:01:23 CEST 2010

 On 09/25/2010 08:19 PM, Michael Niedermayer wrote:
> On Wed, Sep 22, 2010 at 11:01:23AM -0700, S.N. Hemanth Meenakshisundaram wrote:
>>  Fixed a bug found during testing of af_afifo filter.
>>  avfilter.c |   20 ++++++++++++++++++++
>>  avfilter.h |   34 ++++++++++++++++++++++++++++++++++
>>  defaults.c |   42 ++++++++++++++++++++++++++++--------------
>>  3 files changed, 82 insertions(+), 14 deletions(-)
>> dc7a6178731a77f31f69bfc2518541c429fbb59d  0001-Add-get_audio_buffer_ref-to-lavfi-audio-framework.patch
> i do not understand why such convoluted buffer handling would be needed
> [...]

The problem is that the current AVFilterBufferRef creation functions for
both audio and video allocate their own buffer, then set up pointers to
each channel's/plane's data & step sizes within this buffer.

So a memcpy at the start of lavfi is unavoidable.

get_audio_buffer_ref uses an existing buffer and builds a
AVFilterBufferRef struct around it. Sets up pointers within the given
buffer to each channel's data as well as step sizes to get to next
sample of same channel. This avoids the memcpy while still allowing
filters to operate on a channel by channel basis if required.

Is there some specific part of the buffer handling that feels too


More information about the ffmpeg-devel mailing list