[FFmpeg-devel] per-codec default channel layout

Justin Ruggles justin.ruggles
Fri Apr 10 23:50:41 CEST 2009


Hi,

When I was working on a patch to add correct channel layout handling and
ordering to the AC-3 encoder, I came upon something I'm a bit unsure about.

In libavcodec/audioconvert.[ch] there is a function called:
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID
codec_id, const char *fmt_name)

Right now it is only used by ffmpeg.c to display the channel layout, but
is the intent for codecs to also use this to set their default channel
layout for a certain number of channels?  Until I noticed the function,
I had just put a table in the AC-3 encoder which was used to set
avctx.channel_layout at the time of init() if it is not already set.
Should each codec instead be added to this function in one big nested
switch statement?

-Justin



More information about the ffmpeg-devel mailing list