diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-05-07 07:20:32 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:39 -0300 |
commit | 494760f971a41851630d7940abe914cd1115737e (patch) | |
tree | 33e017519b761fc8e6776fdc15b5fca627d02f68 /libavcodec/aacenc.c | |
parent | 2350a50bed6bd71c67947604f117a4dff73ebe35 (diff) | |
download | ffmpeg-494760f971a41851630d7940abe914cd1115737e.tar.gz |
aac: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r-- | libavcodec/aacenc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index a1004c3e98..be157bb709 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -962,11 +962,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120; /* Channel map and unspecified bitrate guessing */ - s->channels = avctx->channels; + s->channels = avctx->ch_layout.nb_channels; s->needs_pce = 1; for (i = 0; i < FF_ARRAY_ELEMS(aac_normal_chan_layouts); i++) { - if (avctx->channel_layout == aac_normal_chan_layouts[i]) { + if (!av_channel_layout_compare(&avctx->ch_layout, &aac_normal_chan_layouts[i])) { s->needs_pce = s->options.pce; break; } @@ -975,10 +975,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if (s->needs_pce) { char buf[64]; for (i = 0; i < FF_ARRAY_ELEMS(aac_pce_configs); i++) - if (avctx->channel_layout == aac_pce_configs[i].layout) + if (!av_channel_layout_compare(&avctx->ch_layout, &aac_pce_configs[i].layout)) break; - av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); - ERROR_IF(i == FF_ARRAY_ELEMS(aac_pce_configs), "Unsupported channel layout \"%s\"\n", buf); + av_channel_layout_describe(&avctx->ch_layout, buf, sizeof(buf)); + if (i == FF_ARRAY_ELEMS(aac_pce_configs)) { + av_log(avctx, AV_LOG_ERROR, "Unsupported channel layout \"%s\"\n", buf); + return AVERROR(EINVAL); + } av_log(avctx, AV_LOG_INFO, "Using a PCE to encode channel layout \"%s\"\n", buf); s->pce = aac_pce_configs[i]; s->reorder_map = s->pce.reorder_map; |