On Apr 24, 2013, at 10:43 AM, Brad O'Hearne wrote:

> 2. For planar data, what exactly is the expected structure of the data array? 
> 
> is it: 
> 
> data[0] -> plane 1
> data[1] -> plane 2
> 
> or is it
> 
> data[0] -> plane 1
> data[0 + plane_size] -> plane 2
> 

This seems quite clear in sampleformat.h:

 * For planar sample formats, each audio channel is in a separate data plane,
 * and linesize is the buffer size, in bytes, for a single plane. All data
 * planes must be the same size. For packed sample formats, only the first data
 * plane is used, and samples for each channel are interleaved. In this case,
 * linesize is the buffer size, in bytes, for the 1 plane.

I found adding support for planar data trivial. I use:

avcodec_decode_audio4 (audioCodecCtx, workingFrame, &bytesUsed, &packet);

Then for interleaved formats access the samples at:

(const void*)workingFrame->data[0]

and planar formats:

(const void*)workingFrame->data[i]          (where i is 0 - number channels, 
obviously)

I can read AAC format files with this method, although they have some weird 
quirks, like variable durations per packet, and sizes not being samples (I work 
mostly with integer PCM formats). Haven't tried saving them.

Bruce
_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to