[FFmpeg-devel] [RFC] Channel layouts

Robert Swain robert.swain
Fri Aug 29 10:04:18 CEST 2008

2008/8/29 Benjamin Larsson <banan at ludd.ltu.se>:
> Peter Ross wrote:
>> Hi.
>> This patch adds the notion of channel layouts to libavcodec.
>> Summary of new concepts:
>> * Channel IDs: We give each speaker a notional bit index.
>> * Channel Layout: An ORing together of Channel IDs.
>>   The resulting layout is identical to the dwChannelMask value found in
>>   WAVEFORMATEXTENSIBLE. A channel layout of zero implies 'no statement'.
>> * Chanels are stored with the FFmpeg 'samples' array according to ID order
>>   e.g. left comes before right.
>> * Encoders will indicate their supported channel layouts in AVCodec, in the
>>   same way we do for pixel and sample formats.
> Will this solve the channel order also ? So that transcode from 5.1 dca
> to ac3 will work ?

I assume it's insisted that the channels be order as they are in the
channel mask and the convention is suggested by the third bullet point
though I think it should be clarified. It sounds like the internal
channel order is defined by channel mask reading from the least
significant bit upwards.


>> +                                 (1<<CHANNEL_FRONT_CENTER)|(1<<CHANNEL_LOW_FREQUENCY)| \
>> +                                 (1<<CHANNEL_BACK_LEFT)|(1<<CHANNEL_BACK_RIGHT))

Would be [FL][FR][C][LFE][SL][SR] in the output samples array.

Is there any benefit to doing all the bit shifting of the flags or can
we just do the usual 0x1, 0x2, 0x4, 0x8, 0x10, 0x20... that we use for
other bit mask flags?


More information about the ffmpeg-devel mailing list