[FFmpeg-devel] [PATCH 01/10] lavfi: add avfilter_get_audio_buffer_ref_from_arrays_channels.

Stefano Sabatini stefasab at gmail.com
Tue Jan 1 18:47:41 CET 2013

On date Monday 2012-12-31 20:03:16 -0500, Derek Buitenhuis encoded:
> On 31/12/2012 7:47 PM, Nicolas George wrote:
> > Sorry, I thought that part was rhetoric:
> > 
> >      * For planar audio, each channel has a separate data pointer, and
> >      * linesize[0] contains the size of each channel buffer.
> >      * For packed audio, there is just one data pointer, and linesize[0]
> >      * contains the total size of the buffer for all channels.
> > 
> > I am about to push the patch with Stefano's comments.

> So what it really is, is the size of one audio channel's buffer ("planes", which
> is also a hideous abuse of the word.).

packed audio -> planar audio -> planes

seems perfectly semantically and lexically consistent

> FWIW I think audio "planes" and "linesize" are abominations which have sprung
> up from reusing AVFrame for audio, using video-specific fields. I have no idea
> how anyone outside of FFmpeg/Libav could understand this...

At the begin it was AVFrame.data/linesize, which was containing only
video data. At some point AVFrame was extended and the decode/encode
API for audio/video was unified, which was a good from the point of
view of usability.

lavfi was alreading doing something similar (but with a silly
limitation on the number of channels), thus probably (can't say
because I didn't design that) lavc mimiced that and extended the
data/linesize used by AVFrame to contain audio data but also relying
on extended_data, which was then ported to lavfi.

The fact that libav* uses the same fields to represent both audio and
video buffers is arguable but is justified by the "philosophic" view
that audio and video are generically considered as "data".

Also since audio is "monodimensional" using the term "line" to
indicate a "line" of samples is a bit strained but not completely
> Is the above at least documented somewhere public?

avcodec.h, avfilter.h, where you'd expect them to be documented.
FFmpeg = Frenzy and Fast Mega Purposeless Exuberant Game

More information about the ffmpeg-devel mailing list