[FFmpeg-devel] [PATCH] Allow setting mode MONO in libmp3lame if the library is greater than 3.97
Aurelien Jacobs
aurel
Fri Aug 13 15:07:21 CEST 2010
On Thu, Aug 12, 2010 at 10:33:02PM -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);
> + } else {
> + if (s->stereo) {
> + lame_set_mode(s->gfp, JOINT_STEREO);
> + } else {
> + lame_set_mode(s->gfp, MONO);
> + }
Inconsistent indentation, and it would be simpler this way:
lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
Aurel
More information about the ffmpeg-devel
mailing list