[FFmpeg-devel] [RFC] Channel layouts

Robert Swain robert.swain
Mon Sep 8 10:02:37 CEST 2008


2008/9/7 M?ns Rullg?rd <mans at mansr.com>:
> Peter Ross <pross at xvid.org> writes:
>
>> On Fri, Aug 29, 2008 at 10:21:28PM -0400, Justin Ruggles wrote:
>>> 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
>>
>> At this stage, the guess function is used only for display purposes.
>>
>>> 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?
>>
>> If the decoder doesnt know the layout, then it should set layout to 0
>> (i.e. "no statement").
>>
>> Each encoder will publish a list of supported input layouts, and libavcodec
>> will provide transformation functions to convert(remix) between different
>> layouts. All encoders will be capable of accepting a layout of 0.
>>
>>> 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.
>>
>> Yes, that's doable. Eventually lavc will provide a layout transformation
>> (down/upmixing) function. My vision to have FFmpeg negociate the layout
>> in much the sample way it currently negociates different pixel and audio
>> formats.
>
> Don't forget that the channel layout must specify not only which
> components are present, but also their order.  Currently lavc tells
> you neither, making it practically useless for multi-channel audio.
>
>>> > +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.
>
> 2.1 and 4.1 are equally, if not more, likely.  I have such DVDs, but
> none with x.0 where x > 2.

I agree with M?ns on this one. 2.1 and 4.1 would be better choices in
my opinion.

Rob



More information about the ffmpeg-devel mailing list