[FFmpeg-devel] [RFC] Channel layouts

Justin Ruggles justin.ruggles
Sat Aug 30 04:21:28 CEST 2008


Peter Ross 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.
> [...]

I think your solution works well for now.  I am not 100% clear about how
the encoders/decoders should handle unsupported or undefined layouts.
Firstly, is the channel layout is guessed by default?  If so, that would
eliminate it matching for some codecs.  Also, if the layout is
unspecified (and not guessed) I'm assuming an encoder or decoder can
decide whether to accept or reject it?  If it can accept it, then I
suppose it would be up to the encoder/decoder to make its own guess?

For the ffmpeg program, I think it should revert to undefined if
rejected once, then if the codec doesn't support undefined layout return
an error.

> +int64_t avcodec_guess_channel_layout(int nb_channels)
> +{
> +    switch(nb_channels) {
> +    case 1: return CHANNEL_LAYOUT_MONO;
> +    case 2: return CHANNEL_LAYOUT_STEREO;
> +    case 4: return CHANNEL_LAYOUT_QUAD;
> +    case 6: return CHANNEL_LAYOUT_5POINT1;
> +    case 8: return CHANNEL_LAYOUT_7POINT1;
> +    default: return 0;
> +    }
> +}

Why not add 3 and 5 to the list?  My vote would be for left/right/center
and 5.0.


More information about the ffmpeg-devel mailing list