diff options
author | James Almer <jamrial@gmail.com> | 2025-06-16 19:33:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2025-06-24 14:41:43 -0300 |
commit | 13e81dbd2724eff09d1042e32cee795bba62d7a5 (patch) | |
tree | ff871f6433821ca5da69e7e431c0fa13ee7eb23a /libavformat/iamf_parse.c | |
parent | 9b5abbf387267584504e7c15fa19e8b8507d99a3 (diff) | |
download | ffmpeg-13e81dbd2724eff09d1042e32cee795bba62d7a5.tar.gz |
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>
Diffstat (limited to 'libavformat/iamf_parse.c')
-rw-r--r-- | libavformat/iamf_parse.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 46a74ea679..756671f7bf 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -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; |