|
|
@ -398,8 +398,22 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx, |
|
|
|
ret = AVERROR_INVALIDDATA; |
|
|
|
ret = AVERROR_INVALIDDATA; |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} |
|
|
|
layout.order = AV_CHANNEL_ORDER_UNSPEC; |
|
|
|
|
|
|
|
layout.nb_channels = channels; |
|
|
|
layout.nb_channels = channels; |
|
|
|
|
|
|
|
if (channels == (ambisonic_order + 1) * (ambisonic_order + 1)) { |
|
|
|
|
|
|
|
layout.order = AV_CHANNEL_ORDER_AMBISONIC; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
layout.order = AV_CHANNEL_ORDER_CUSTOM; |
|
|
|
|
|
|
|
layout.u.map = av_calloc(channels, sizeof(*layout.u.map)); |
|
|
|
|
|
|
|
if (!layout.u.map) { |
|
|
|
|
|
|
|
ret = AVERROR(ENOMEM); |
|
|
|
|
|
|
|
goto fail; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (i = 0; i < channels - 2; i++) |
|
|
|
|
|
|
|
layout.u.map[i].id = AV_CHAN_AMBISONIC_BASE + i; |
|
|
|
|
|
|
|
layout.u.map[channels - 2].id = AV_CHAN_FRONT_LEFT; |
|
|
|
|
|
|
|
layout.u.map[channels - 1].id = AV_CHAN_FRONT_RIGHT; |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
layout.order = AV_CHANNEL_ORDER_UNSPEC; |
|
|
|
layout.order = AV_CHANNEL_ORDER_UNSPEC; |
|
|
|
layout.nb_channels = channels; |
|
|
|
layout.nb_channels = channels; |
|
|
@ -450,8 +464,10 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
av_channel_layout_uninit(&avctx->ch_layout); |
|
|
|
ret = av_channel_layout_copy(&avctx->ch_layout, &layout); |
|
|
|
avctx->ch_layout = layout; |
|
|
|
if (ret < 0) |
|
|
|
|
|
|
|
goto fail; |
|
|
|
|
|
|
|
|
|
|
|
s->nb_streams = streams; |
|
|
|
s->nb_streams = streams; |
|
|
|
s->nb_stereo_streams = stereo_streams; |
|
|
|
s->nb_stereo_streams = stereo_streams; |
|
|
|
|
|
|
|
|
|
|
|