summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-26 21:45:50 +0200
committerwm4 <wm4@nowhere>2017-04-26 21:45:55 +0200
commitf1c4d20e6577f32018e20efc4ab9da7d4e1ab4ac (patch)
treeb9c6c26faefce976496c527d524cd2e09a96b29f /options
parent010c7d499258c1064189b2d149ae6eca859d9ae1 (diff)
downloadmpv-f1c4d20e6577f32018e20efc4ab9da7d4e1ab4ac.tar.bz2
mpv-f1c4d20e6577f32018e20efc4ab9da7d4e1ab4ac.tar.xz
audio: move replaygain control to top-level options
af_volume is deprecated, and so are its replaygain sub-options. To make it possible to use replaygain without deprecated options (and of course to make it available at all after af_volume is dropped), reintroduce them as top-level options. This also means that they are easily changeable at runtime by using them as properties. Change the "volume" property to use the new update mechanism as well. We don't actually bother sharing the implementation between new and deprecated mechanisms, as the deprecated one will simply be deleted. For the from_dB() functions, we mention anders' copyright, although I'm not sure if a mere formula is copyrightable. This will have to be determined later. This whole change is mostly untested. Our distributed human CI will take care of it.
Diffstat (limited to 'options')
-rw-r--r--options/m_option.h3
-rw-r--r--options/options.c9
-rw-r--r--options/options.h5
3 files changed, 14 insertions, 3 deletions
diff --git a/options/m_option.h b/options/m_option.h
index 064b7f83b1..d4a795a834 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -395,7 +395,8 @@ struct m_option {
#define UPDATE_AUDIO (1 << 14) // --audio-channels etc.
#define UPDATE_PRIORITY (1 << 15) // --priority (Windows-only)
#define UPDATE_SCREENSAVER (1 << 16) // --stop-screensaver
-#define UPDATE_OPT_LAST (1 << 16)
+#define UPDATE_VOL (1 << 17) // softvol related options
+#define UPDATE_OPT_LAST (1 << 17)
// All bits between _FIRST and _LAST (inclusive)
#define UPDATE_OPTS_MASK \
diff --git a/options/options.c b/options/options.c
index 229f328af1..42c4828b56 100644
--- a/options/options.c
+++ b/options/options.c
@@ -545,11 +545,16 @@ const m_option_t mp_opts[] = {
"as if --softvol=yes is always set"),
OPT_FLOATRANGE("volume-max", softvol_max, 0, 100, 1000),
// values <0 for volume and mute are legacy and ignored
- OPT_FLOATRANGE("volume", softvol_volume, 0, -1, 1000),
- OPT_CHOICE("mute", softvol_mute, 0,
+ OPT_FLOATRANGE("volume", softvol_volume, UPDATE_VOL, -1, 1000),
+ OPT_CHOICE("mute", softvol_mute, UPDATE_VOL,
({"no", 0},
{"auto", 0},
{"yes", 1})),
+ OPT_FLAG("replaygain-track", rgain_track, UPDATE_VOL),
+ OPT_FLAG("replaygain-album", rgain_album, UPDATE_VOL),
+ OPT_FLOATRANGE("replaygain-preamp", rgain_preamp, UPDATE_VOL, -15, 15),
+ OPT_FLAG("replaygain-clip", rgain_clip, UPDATE_VOL),
+ OPT_FLOATRANGE("replaygain-fallback", rgain_fallback, UPDATE_VOL, -200, 60),
OPT_CHOICE("gapless-audio", gapless_audio, 0,
({"no", 0},
{"yes", 1},
diff --git a/options/options.h b/options/options.h
index 82f0c15aec..0d288be586 100644
--- a/options/options.h
+++ b/options/options.h
@@ -101,6 +101,11 @@ typedef struct MPOpts {
int force_vo;
int softvol;
float softvol_volume;
+ int rgain_track; // Enable/disable track based replaygain
+ int rgain_album; // Enable/disable album based replaygain
+ float rgain_preamp; // Set replaygain pre-amplification
+ int rgain_clip; // Enable/disable clipping prevention
+ float rgain_fallback;
float balance;
int softvol_mute;
float softvol_max;