[FFmpeg-devel] [RFC] Channel layouts

Benjamin Larsson banan
Fri Aug 29 09:52:55 CEST 2008


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.
>   e.g. CHANNEL_FRONT_LEFT=0, CHANNEL_FRONT_RIGHT=1, CHANNEL_BACK_CENTER=9
>
> * Channel Layout: An ORing together of Channel IDs.
>   e.g. ((1<<CHANNEL_FRONT_LEFT)|(1<<CHANNEL_FRONT_RIGHT))
>   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 ?


> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
>   
> ------------------------------------------------------------------------
>
> +#define CHANNEL_LAYOUT_MONO     (1<<CHANNEL_FRONT_CENTER)
> +#define CHANNEL_LAYOUT_STEREO   ((1<<CHANNEL_FRONT_LEFT)|(1<<CHANNEL_FRONT_RIGHT))
> +#define CHANNEL_LAYOUT_QUAD     ((1<<CHANNEL_FRONT_LEFT)|(1<<CHANNEL_FRONT_RIGHT)| \
> +                                 (1<<CHANNEL_BACK_LEFT)|(1<<CHANNEL_BACK_RIGHT))
> +#define CHANNEL_LAYOUT_5POINT1  ((1<<CHANNEL_FRONT_LEFT)|(1<<CHANNEL_FRONT_RIGHT)| \
> +                                 (1<<CHANNEL_FRONT_CENTER)|(1<<CHANNEL_LOW_FREQUENCY)| \
> +                                 (1<<CHANNEL_BACK_LEFT)|(1<<CHANNEL_BACK_RIGHT))
>   

We will need alot more defines to cover all the cases available. DCA has 
alot of layouts. Anyway I think the codec should have the definitions 
for all possible layouts.


MvH
Benjamin Larsson






More information about the ffmpeg-devel mailing list