demux: make ALBUM replaygain tags optional

IF they're missing, use the TRACK ones instead. See #3405.
This commit is contained in:
wm4 2016-08-13 15:06:45 +02:00
parent 78d808c5bd
commit e392d6610d
1 changed files with 7 additions and 3 deletions

View File

@ -975,10 +975,14 @@ static struct replaygain_data *decode_rgain(struct mp_log *log,
struct replaygain_data rg = {0};
if (!decode_gain(log, tags, "REPLAYGAIN_TRACK_GAIN", &rg.track_gain) &&
!decode_peak(log, tags, "REPLAYGAIN_TRACK_PEAK", &rg.track_peak) &&
!decode_gain(log, tags, "REPLAYGAIN_ALBUM_GAIN", &rg.album_gain) &&
!decode_peak(log, tags, "REPLAYGAIN_ALBUM_PEAK", &rg.album_peak))
!decode_peak(log, tags, "REPLAYGAIN_TRACK_PEAK", &rg.track_peak))
{
if (!(!decode_gain(log, tags, "REPLAYGAIN_ALBUM_GAIN", &rg.album_gain) &&
!decode_peak(log, tags, "REPLAYGAIN_ALBUM_PEAK", &rg.album_peak)))
{
rg.album_gain = rg.track_gain;
rg.album_peak = rg.track_peak;
}
return talloc_memdup(NULL, &rg, sizeof(rg));
}