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
465 return ret;465 return ret;
466 }466 }
467 467
468 layer->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM;468 ret = av_channel_layout_custom_init(&layer->ch_layout, output_channel_count);
469 layer->ch_layout.nb_channels = output_channel_count;469 if (ret < 0)
470 layer->ch_layout.u.map = av_calloc(output_channel_count, sizeof(*layer->ch_layout.u.map));470 return ret;
471 if (!layer->ch_layout.u.map)
472 return AVERROR(ENOMEM);
473 471
474 for (int i = 0; i < output_channel_count; i++)472 for (int i = 0; i < output_channel_count; i++)
475 layer->ch_layout.u.map[i].id = avio_r8(pb) + AV_CHAN_AMBISONIC_BASE;473 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;
476 } else {478 } else {
477 int coupled_substream_count = avio_r8(pb); // M479 int coupled_substream_count = avio_r8(pb); // M
478 int nb_demixing_matrix = substream_count + coupled_substream_count;480 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