summaryrefslogtreecommitdiff
path: root/libavcodec/libtwolame.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-04 17:48:34 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:43 -0300
commit429327075a2240113e678cdd23b8d0a23b3ebca2 (patch)
tree689681c081ae085598c22788a8ba808708aba8fc /libavcodec/libtwolame.c
parent97d9a3293854eda84f05c22e2eaefae7406ac969 (diff)
downloadffmpeg-429327075a2240113e678cdd23b8d0a23b3ebca2.tar.gz
libtwolame: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libtwolame.c')
-rw-r--r--libavcodec/libtwolame.c11
1 files changed, 9 insertions, 2 deletions
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",
};