X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibtwolame.c;h=e28141022d617e95957ea2c09c81e537c0364c3f;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=030f88868fb5b30a3bd0ea6e140779afb878a0f0;hpb=1a8be90adbaf86faa3053ff98118004ad7711c8c;p=ffmpeg diff --git a/libavcodec/libtwolame.c b/libavcodec/libtwolame.c index 030f88868fb..e28141022d6 100644 --- a/libavcodec/libtwolame.c +++ b/libavcodec/libtwolame.c @@ -78,8 +78,12 @@ static av_cold int twolame_encode_init(AVCodecContext *avctx) twolame_set_in_samplerate(s->glopts, avctx->sample_rate); twolame_set_out_samplerate(s->glopts, avctx->sample_rate); - if (!avctx->bit_rate) - avctx->bit_rate = avctx->sample_rate < 28000 ? 160000 : 384000; + if (!avctx->bit_rate) { + if ((s->mode == TWOLAME_AUTO_MODE && avctx->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; + } if (avctx->flags & AV_CODEC_FLAG_QSCALE || !avctx->bit_rate) { twolame_set_VBR(s->glopts, TRUE); @@ -202,7 +206,7 @@ static const int twolame_samplerates[] = { 16000, 22050, 24000, 32000, 44100, 48000, 0 }; -AVCodec ff_libtwolame_encoder = { +const AVCodec ff_libtwolame_encoder = { .name = "libtwolame", .long_name = NULL_IF_CONFIG_SMALL("libtwolame MP2 (MPEG audio layer 2)"), .type = AVMEDIA_TYPE_AUDIO,