diff options
author | Benjamin Barenblat <bbaren@google.com> | 2018-12-18 15:15:09 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2018-12-18 15:22:36 -0500 |
commit | be90f2c8dd0431e252e43d5249e89446309113af (patch) | |
tree | 3898f110691af61d8a69e10f3afe81cf77897814 /demux/demux.c | |
parent | d6d6da4711ca1ad20e14386c4b29a955eb32322d (diff) |
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; } |