[FFmpeg-devel] [RFC] Channel layouts

Peter Ross pross
Mon Sep 8 02:10:42 CEST 2008


On Fri, Aug 29, 2008 at 03:19:41PM +0200, Michael Niedermayer wrote:
> On Fri, Aug 29, 2008 at 04:28:00PM +1000, 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.
> > 
> 
> This suggestion has a few problems.
> 1. it is limited to 32 (or 64) fixed channel "positions", 18 are already used
>    in this initial patch, that is more than a 1/4 of the available space
>    is alraedy used up. This reminds me a little of a famous quote of how
>    much memory will always be enough for everyone ...
> 2. It breaks down once x,y,z positions of ideal speakers are available
>    instead of "front left" vs "back center"
> 3. When audio is returned by decoders as samples of all channels interleaved,
>    like it is done currently, then a fixed order means the user app must
>    reorder unless the destination (SDL, OSS, ALSA, ...) and finally and most
>    importabtly the hardware can handle our order. This of course is irrelevant
>    for planar audio which may be what many decoders will output in the future.

For info:

OSS: provides SNDCTL_DSP_GET_CHNORDER ioctl. It returns a 64-bit integer
   describing the "speaker ID" associated with each each logical channel.
   There are only eight speaker IDs defined: L,R,C,LFE,SL,SR,RL,RR.
   http://manuals.opensound.com/developer/SNDCTL_DSP_GET_CHNORDER.html

ALSA has standardised on these layouts
   quad:   FL|FR|RL|RR
   4.1:    FL|FR|RL|RR|LFE
   5.0:    FL|FR|RL|RR|C
   5.1:    FL|FR|RL|RR|C|LFE
   7.1:    FL|FR|RL|RR|C|LFE|SL|SR

SDL supports quad and 5.1, using these layouts
   quad:   FL|FR|RL|RR
   5.1:    FL|FR|RL|RR|C|LFE

Win32: uses the dwChannelMasks concept, as proposed in the patch.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080908/0e0ebf08/attachment.pgp>



More information about the ffmpeg-devel mailing list