[Ffmpeg-devel] channel ordering and downmixing

Baptiste Coudurier baptiste.coudurier
Thu Apr 5 11:17:08 CEST 2007

Justin Ruggles wrote:
> Hi,
> Justin Ruggles wrote:
>> I need some advice on a channel ordering and downmixing framework.  I've
>> been trying to figure out the best solution for a while and keep running
>> into road blocks.
> After spending too much time just pondering different ideas, I decided
> to give it a go and try one out.
> The attached patch isn't really meant to be a working patch, but more of
> a conceptual sketch of a basic design.  I want to get ideas and comments
> before taking the time to implement it in full.
> The general concept is:
>  - add an AVChannelLayout struct to AVCodecContext
>  - have the muxer set its preferred channel layout in read_header()

demuxer sets codec->channel_layout, yes.
It seems at least one audio frame will need to be decoded to fetch
channel layout.

>  - have the decoder override the channel layout if it wants to

sounds ok, permitting user to override it seems an interesting feature.

>  - user-level API: av_channel_mix_init(), av_channel_mix(),
>                    av_channel_mix_close()
>  - the encoder can set the channel layout in encode_init or just set the
>    number of channels and set the mask to CHANNEL_MASK_NONE to let the
>    muxer decide
>  - if avctx->channel_layout.mask is CHANNEL_MASK_NONE, the muxer should
>    set the channel layout

How can muxer decide ? Muxer should only write codec->channel_layout,
that should not break stream copy.

> [...]
> +struct AVChannelLayout;
> +

can that dummy declaration be avoided ?

> [...]
> +
> +#define FF_MAX_CHANNELS 32



Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312

More information about the ffmpeg-devel mailing list