[FFmpeg-cvslog] avformat/iamf_parse: try to retype the channel layout for ambisonics_mode == 0
James Almer
git at videolan.org
Tue Jun 24 20:44:52 EEST 2025
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Jun 16 19:33:57 2025 -0300| [13e81dbd2724eff09d1042e32cee795bba62d7a5] | committer: James Almer
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13e81dbd2724eff09d1042e32cee795bba62d7a5
---
libavformat/iamf_parse.c | 12 +++++++-----
1 file 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;
More information about the ffmpeg-cvslog
mailing list