[FFmpeg-devel] Channel layouts (was: [PATCH] lavfi: store and propagate number of channels information in audio buffer properties)
Nicolas George
nicolas.george at normalesup.org
Sun Nov 11 21:10:37 CET 2012
On 2012-11-11, I wrote:
<snip>
Short version:
For streams with strange channel layouts, we need an immediate workaround
and a long-term solution.
Immediate workaround I just thought of:
#define AV_CH_STRANGE_UNKNOWN 0x0000800000000000ULL
(this bit is far away from any other already defined channel)
With the rule: if this channel is set in a channel layout, then the channel
layout as a whole is "strange/unknown". If we need to define a n-channels
strange/unknown layout, we just make one using this bit and n-1 other bits
(using preferably unused bits).
Then we can have:
int av_fix_channel_layout(void *log, int count, uint64_t *layout)
{
if (count != av_get_channel_layout_nb_channels(*layout)) {
av_log(log, AV_LOG_WARNING, "...");
*layout = 0;
}
if (!*layout)
layout = av_make_strange_channel_layout(count);
}
and use it all over the place.
Clearly, it is a hack, but I believe it is a robust one that does not cause
any problem.
And it is not a long-term solution, since it can not express some
information that the demuxer or decoder can have, like "these 2 channels are
not stereo, they are mono/Japanese + mono/English". Looks like we will need
per-channel metadata, yay!
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121111/70c72872/attachment.asc>
More information about the ffmpeg-devel
mailing list