[FFmpeg-devel] [RFC] Channel layouts

Peter Ross pross
Sun Sep 7 12:55:27 CEST 2008


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.

> > +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.

Deal.

-- 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/20080907/1f358016/attachment.pgp>



More information about the ffmpeg-devel mailing list