aboutsummaryrefslogtreecommitdiffhomepage
path: root/demux/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index f02f9b77aa..a8b392d74e 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1946,12 +1946,17 @@ static struct replaygain_data *decode_rgain(struct mp_log *log,
{
struct replaygain_data rg = {0};
+ // Set values in *rg, using track gain as a fallback for album gain if the
+ // latter is not present. This behavior matches that in demux/demux_lavf.c's
+ // export_replaygain; if you change this, please make equivalent changes
+ // there too.
if (decode_gain(log, tags, "REPLAYGAIN_TRACK_GAIN", &rg.track_gain) >= 0 &&
decode_peak(log, tags, "REPLAYGAIN_TRACK_PEAK", &rg.track_peak) >= 0)
{
if (decode_gain(log, tags, "REPLAYGAIN_ALBUM_GAIN", &rg.album_gain) < 0 ||
decode_peak(log, tags, "REPLAYGAIN_ALBUM_PEAK", &rg.album_peak) < 0)
{
+ // Album gain is undefined; fall back to track gain.
rg.album_gain = rg.track_gain;
rg.album_peak = rg.track_peak;
}