[FFmpeg-devel,1/2] lavc/libmp3lame: add support for cutoff

Submitted by Moritz Barsnick on Dec. 30, 2016, 5:08 p.m.

Details

Message ID a4961fcc3cea663659e2eca04ef5c3e4386468cb.1483105395.git.barsnick@gmx.net
State Accepted
Commit 6c442e1584599471d1d43df2880feb9bda215163
Headers show

Commit Message

Moritz Barsnick Dec. 30, 2016, 5:08 p.m.
Pass the cutoff option from lavc's avcodec_options[] to libmp3lame's
lowpass option, without allowing to adjust its default behavior.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 doc/encoders.texi       | 4 ++++
 libavcodec/libmp3lame.c | 4 ++++
 2 files changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/doc/encoders.texi b/doc/encoders.texi
index cbb8d8e..5e311cb 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -817,6 +817,10 @@  Set algorithm quality. Valid arguments are integers in the 0-9 range,
 with 0 meaning highest quality but slowest, and 9 meaning fastest
 while producing the worst quality.
 
+@item cutoff (@emph{--lowpass})
+Set lowpass cutoff frequency. If unspecified, the encoder dynamically
+adjusts the cutoff.
+
 @item reservoir
 Enable use of bit reservoir when set to 1. Default value is 1. LAME
 has this enabled by default, but can be overridden by use
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index e55aa85..5e26743 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -125,6 +125,10 @@  static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
         }
     }
 
+    /* lowpass cutoff frequency */
+    if (avctx->cutoff)
+        lame_set_lowpassfreq(s->gfp, avctx->cutoff);
+
     /* do not get a Xing VBR header frame from LAME */
     lame_set_bWriteVbrTag(s->gfp,0);