1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avformat/iamf_parse: try to retype the channel layout for ambisonics_mode == 0

In most cases, the channel ids will match the standard Ambisonic Order, saving us the
need to use a custom order layout.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-06-16 19:33:57 -03:00
parent 9b5abbf387
commit 13e81dbd27

View File

@ -465,14 +465,16 @@ static int ambisonics_config(void *s, AVIOContext *pb,
return ret;
}
layer->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM;
layer->ch_layout.nb_channels = output_channel_count;
layer->ch_layout.u.map = av_calloc(output_channel_count, sizeof(*layer->ch_layout.u.map));
if (!layer->ch_layout.u.map)
return AVERROR(ENOMEM);
ret = av_channel_layout_custom_init(&layer->ch_layout, output_channel_count);
if (ret < 0)
return ret;
for (int i = 0; i < output_channel_count; i++)
layer->ch_layout.u.map[i].id = avio_r8(pb) + AV_CHAN_AMBISONIC_BASE;
ret = av_channel_layout_retype(&layer->ch_layout, AV_CHANNEL_ORDER_AMBISONIC, 0);
if (ret < 0 && ret != AVERROR(ENOSYS))
return ret;
} else {
int coupled_substream_count = avio_r8(pb); // M
int nb_demixing_matrix = substream_count + coupled_substream_count;