diff options
author | Benjamin Barenblat <bbaren@google.com> | 2018-12-18 15:15:09 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-01-16 16:58:33 +0100 |
commit | 585f9ff42f3195c5b726101dd34c1ee72633f867 (patch) | |
tree | f08c88cbd7bfeda0f02f2ebc62d108c790b53a71 /demux/demux.c | |
parent | aab595f828c9e158cd08cadc48ccc6fe9725e464 (diff) | |
download | mpv-585f9ff42f3195c5b726101dd34c1ee72633f867.tar.bz2 mpv-585f9ff42f3195c5b726101dd34c1ee72633f867.tar.xz |
demux: make ALBUM ReplayGain tags optional when using libavformat
Commit e392d6610d1e35cc0190c794c151211b0aae83e6 modified the native
demuxer to use track gain as a fallback for album gain if the latter is
not present. This commit makes functionally equivalent changes in the
libavformat demuxer.
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 5 |
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; } |