From 429327075a2240113e678cdd23b8d0a23b3ebca2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 4 Jun 2019 17:48:34 +0200 Subject: libtwolame: convert to new channel layout API Signed-off-by: James Almer --- libavcodec/libtwolame.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libavcodec/libtwolame.c') diff --git a/libavcodec/libtwolame.c b/libavcodec/libtwolame.c index a71febc91f..c68e0301b3 100644 --- a/libavcodec/libtwolame.c +++ b/libavcodec/libtwolame.c @@ -76,12 +76,12 @@ static av_cold int twolame_encode_init(AVCodecContext *avctx) twolame_set_copyright(s->glopts, s->copyright); twolame_set_original(s->glopts, s->original); - twolame_set_num_channels(s->glopts, avctx->channels); + twolame_set_num_channels(s->glopts, avctx->ch_layout.nb_channels); twolame_set_in_samplerate(s->glopts, avctx->sample_rate); twolame_set_out_samplerate(s->glopts, avctx->sample_rate); if (!avctx->bit_rate) { - if ((s->mode == TWOLAME_AUTO_MODE && avctx->channels == 1) || s->mode == TWOLAME_MONO) + if ((s->mode == TWOLAME_AUTO_MODE && avctx->ch_layout.nb_channels == 1) || s->mode == TWOLAME_MONO) avctx->bit_rate = avctx->sample_rate < 28000 ? 80000 : 192000; else avctx->bit_rate = avctx->sample_rate < 28000 ? 160000 : 384000; @@ -227,10 +227,17 @@ const AVCodec ff_libtwolame_encoder = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }, +#if FF_API_OLD_CHANNEL_LAYOUT .channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, 0 }, +#endif + .ch_layouts = (const AVChannelLayout[]) { + AV_CHANNEL_LAYOUT_MONO, + AV_CHANNEL_LAYOUT_STEREO, + { 0 }, + }, .supported_samplerates = twolame_samplerates, .wrapper_name = "libtwolame", }; -- cgit v1.2.1