From 9b15c99aa13acdbb3e86fbb3395ad107b436fdaa Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 12 Jul 2015 19:33:34 +0200 Subject: [PATCH] demux: handle Matroska-style replaygain tags as well Matroska doesn't follow the usual ReplayGain conventions, and doesn't distinguish between track/album values. Fixes #2128. --- demux/demux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/demux/demux.c b/demux/demux.c index 6f20795425..d936f51fd4 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -813,6 +813,14 @@ static void demux_export_replaygain(demuxer_t *demuxer) { apply_replaygain(demuxer, &rg); } + + if (!decode_gain(demuxer, "REPLAYGAIN_GAIN", &rg.track_gain) && + !decode_peak(demuxer, "REPLAYGAIN_PEAK", &rg.track_peak)) + { + rg.album_gain = rg.track_gain; + rg.album_peak = rg.track_peak; + apply_replaygain(demuxer, &rg); + } } // Copy all fields from src to dst, depending on event flags.