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>
... | ... |
@@ -633,6 +633,12 @@ Prefer track gain, if present. |
633 | 633 |
@item album |
634 | 634 |
Prefer album gain, if present. |
635 | 635 |
@end table |
636 |
+ |
|
637 |
+@item replaygain_preamp |
|
638 |
+Pre-amplification gain in dB to apply to the selected replaygain gain. |
|
639 |
+ |
|
640 |
+Default value for @var{replaygain_preamp} is 0.0. |
|
641 |
+ |
|
636 | 642 |
@end table |
637 | 643 |
|
638 | 644 |
@subsection Examples |
... | ... |
@@ -59,6 +59,8 @@ static const AVOption options[] = { |
59 | 59 |
{ "ignore", "replaygain side data is ignored", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_IGNORE }, 0, 0, A, "replaygain" }, |
60 | 60 |
{ "track", "track gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_TRACK }, 0, 0, A, "replaygain" }, |
61 | 61 |
{ "album", "album gain is preferred", 0, AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_ALBUM }, 0, 0, A, "replaygain" }, |
62 |
+ { "replaygain_preamp", "Apply replaygain pre-amplification", |
|
63 |
+ OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, -15.0, 15.0, A }, |
|
62 | 64 |
{ NULL }, |
63 | 65 |
}; |
64 | 66 |
|
... | ... |
@@ -262,7 +264,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) |
262 | 262 |
av_log(inlink->dst, AV_LOG_VERBOSE, |
263 | 263 |
"Using gain %f dB from replaygain side data.\n", g); |
264 | 264 |
|
265 |
- vol->volume = pow(10, g / 20); |
|
265 |
+ vol->volume = pow(10, (g + vol->replaygain_preamp) / 20); |
|
266 | 266 |
vol->volume_i = (int)(vol->volume * 256 + 0.5); |
267 | 267 |
|
268 | 268 |
volume_init(vol); |