History

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.

James Almer committed 1 year ago

Commit 13e81db1 parent 9b5abbf1 file · +7 −5Browse files

Unified · Split

libavformat/iamf_parse.c+7−5
@@ -465,14 +465,16 @@ static int ambisonics_config(void *s, AVIOContext *pb, · 464 unmodified lines
465465 return ret;
466466 }
467467
468− layer->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM;
469− layer->ch_layout.nb_channels = output_channel_count;
470− layer->ch_layout.u.map = av_calloc(output_channel_count, sizeof(*layer->ch_layout.u.map));
471− if (!layer->ch_layout.u.map)
472− return AVERROR(ENOMEM);
468+ ret = av_channel_layout_custom_init(&layer->ch_layout, output_channel_count);
469+ if (ret < 0)
470+ return ret;
473471
474472 for (int i = 0; i < output_channel_count; i++)
475473 layer->ch_layout.u.map[i].id = avio_r8(pb) + AV_CHAN_AMBISONIC_BASE;
474+
475+ ret = av_channel_layout_retype(&layer->ch_layout, AV_CHANNEL_ORDER_AMBISONIC, 0);
476+ if (ret < 0 && ret != AVERROR(ENOSYS))
477+ return ret;
476478 } else {
477479 int coupled_substream_count = avio_r8(pb); // M
478480 int nb_demixing_matrix = substream_count + coupled_substream_count;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t