summaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorKyle Swanson <k@ylo.ph>2016-06-07 11:55:02 -0500
committerKyle Swanson <k@ylo.ph>2016-06-09 13:06:30 -0500
commit765703498aa52f38c88afb09754821b17cf60045 (patch)
tree182e1c36c11332d925985289234ffd915d959b8e /libavfilter
parent6826f16e4a3629c801396dca3ada8a78fc506e85 (diff)
downloadffmpeg-streaming-765703498aa52f38c88afb09754821b17cf60045.zip
ffmpeg-streaming-765703498aa52f38c88afb09754821b17cf60045.tar.gz
avfilter/af_loudnorm: add dual_mono option
Signed-off-by: Kyle Swanson <k@ylo.ph>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_loudnorm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 9d27c16..604697e 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -60,6 +60,7 @@ typedef struct LoudNormContext {
double measured_thresh;
double offset;
int linear;
+ int dual_mono;
enum PrintFormat print_format;
double *buf;
@@ -113,6 +114,7 @@ static const AVOption loudnorm_options[] = {
{ "measured_thresh", "measured threshold of input file", OFFSET(measured_thresh), AV_OPT_TYPE_DOUBLE, {.dbl = -70.}, -99., 0., FLAGS },
{ "offset", "set offset gain", OFFSET(offset), AV_OPT_TYPE_DOUBLE, {.dbl = 0.}, -99., 99., FLAGS },
{ "linear", "normalize linearly if possible", OFFSET(linear), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
+ { "dual_mono", "treat mono input as dual-mono", OFFSET(dual_mono), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ "print_format", "set print format for stats", OFFSET(print_format), AV_OPT_TYPE_INT, {.i64 = NONE}, NONE, PF_NB -1, FLAGS, "print_format" },
{ "none", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NONE}, 0, 0, FLAGS, "print_format" },
{ "json", 0, 0, AV_OPT_TYPE_CONST, {.i64 = JSON}, 0, 0, FLAGS, "print_format" },
@@ -731,6 +733,11 @@ static int config_input(AVFilterLink *inlink)
if (!s->r128_out)
return AVERROR(ENOMEM);
+ if (inlink->channels == 1 && s->dual_mono) {
+ ebur128_set_channel(s->r128_in, 0, EBUR128_DUAL_MONO);
+ ebur128_set_channel(s->r128_out, 0, EBUR128_DUAL_MONO);
+ }
+
s->buf_size = frame_size(inlink->sample_rate, 3000) * inlink->channels;
s->buf = av_malloc_array(s->buf_size, sizeof(*s->buf));
if (!s->buf)
OpenPOWER on IntegriCloud