Commit 37af4871 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'a49aa440'

* commit 'a49aa440':
  af_volume: implement replaygain pre-amplification

Conflicts:
	doc/filters.texi
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 490d53e3 a49aa440
......@@ -1847,6 +1847,11 @@ Prefer track gain, if present.
Prefer album gain, if present.
@end table
@item replaygain_preamp
Pre-amplification gain in dB to apply to the selected replaygain gain.
Default value for @var{replaygain_preamp} is 0.0.
@item eval
Set when the volume expression is evaluated.
......
......@@ -79,6 +79,8 @@ static const AVOption volume_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 },
};
......@@ -358,7 +360,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);
......
......@@ -75,6 +75,7 @@ typedef struct VolumeContext {
double var_values[VAR_VARS_NB];
enum ReplayGainType replaygain;
double replaygain_preamp;
double volume;
int volume_i;
int channels;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment