[FFmpeg-devel] [PATCH] Allow setting mode MONO in libmp3lame if the library is greater than 3.97

Tomas Härdin tomas.hardin
Fri Aug 13 09:00:03 CEST 2010


On Thu, 2010-08-12 at 22:33 -0700, Thierry Foucu wrote:
> Hi,
> 
> for a while we are using lame 3.97+ in mono and stereo mode in mencoder, and
> I noticed that ffmpeg sets always the mode to JOINT_STEREO.
> 
> The patch will check lame version and if greater then 3.97, it will set the
> mode to MONO or JOINT_STEREO
> 
> Index: libavcodec/libmp3lame.c
> ===================================================================
> --- libavcodec/libmp3lame.c (revision 24791)
> +++ libavcodec/libmp3lame.c (working copy)
> @@ -55,8 +55,18 @@
>      } else {
>          lame_set_quality(s->gfp, avctx->compression_level);
>      }
> -    /* lame 3.91 doesn't work in mono */
> -    lame_set_mode(s->gfp, JOINT_STEREO);
> +    lame_version_t lame_version;
> +    get_lame_version_numerical(&lame_version);
> +    if (lame_version.major <= 3 && lame_version.minor < 97) {
> +        /* lame 3.91 doesn't work in mono */
> +        lame_set_mode(s->gfp, JOINT_STEREO);

Don't mix functional and cosmetic changes. Do the indentation in a
separate patch.

> +    } else {
> +        if (s->stereo) {
> +          lame_set_mode(s->gfp, JOINT_STEREO);
> +        } else {
> +          lame_set_mode(s->gfp, MONO);
> +        }
> +    }
>      lame_set_brate(s->gfp, avctx->bit_rate/1000);
>      if(avctx->flags & CODEC_FLAG_QSCALE) {
>          lame_set_brate(s->gfp, 0);

Seems fine otherwise to me, but I'm not the maintainer. I suggest you
run "make test" as well, if you haven't already.

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100813/7a6e644a/attachment.pgp>



More information about the ffmpeg-devel mailing list