aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_volume.c
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2014-04-04 18:42:09 +0200
committerAnton Khirnov <anton@khirnov.net>2014-04-04 18:53:05 +0200
commita49aa440c939e221194f8d95bf98673f8cf38a06 (patch)
treec643b5b59ea2486d8a01b640ad00227d72bf3c21 /libavfilter/af_volume.c
parentc74b86699c86bdf62e8570f41d8a38be5710baa3 (diff)
downloadffmpeg-a49aa440c939e221194f8d95bf98673f8cf38a06.tar.gz
af_volume: implement replaygain pre-amplification
This adds a new "replaygain_preamp" option to the filter, and simply adds its value to the replaygain gain value. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/af_volume.c')
-rw-r--r--libavfilter/af_volume.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 165624e9df..823fa15144 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -59,6 +59,8 @@ static const AVOption options[] = {
{ "ignore", "replaygain side data is ignored", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_IGNORE }, 0, 0, A, "replaygain" },
{ "track", "track gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_TRACK }, 0, 0, A, "replaygain" },
{ "album", "album gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_ALBUM }, 0, 0, A, "replaygain" },
+ { "replaygain_preamp", "Apply replaygain pre-amplification",
+ OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, -15.0, 15.0, A },
{ NULL },
};
@@ -262,7 +264,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
av_log(inlink->dst, AV_LOG_VERBOSE,
"Using gain %f dB from replaygain side data.\n", g);
- vol->volume = pow(10, g / 20);
+ vol->volume = pow(10, (g + vol->replaygain_preamp) / 20);
vol->volume_i = (int)(vol->volume * 256 + 0.5);
volume_init(vol);