On Wed, 27 Jan 2010 17:34:10 +0100, Max Kellermann <m...@duempel.org> wrote: > On 2010/01/27 17:26, Tim Phipps <m...@phipps-hutton.freeserve.co.uk> wrote: >> Hi All, >> This bug is marked as fixed but the fix isn't in GIT trunk. Has it been >> forgotten? Can the patch be applied to GIT please? Below is a more up to >> date patch: > > D'oh, looks like it got lost during the v0.15.x -> master branch > merge. > >> -#include "replay_gain_info.h" >> +#include "replay_gain_config.h" >> + if (REPLAY_GAIN_ALBUM == replay_gain_mode) { > > A decoder shouldn't import this header, and shouldn't use this global > variable. The replay gain mode may change at any time, and the > decision to drop all of the replay gain info just because there's no > data for the current mode may become obsolete then. The decoder > should always supply all data it has, and the MPD core shall decide > the rest.
Well, that's a new one on me. I didn't know you could change it on the fly. Looking at the current code, the mode is set in the config file and not stored in the state file. Is that going to change? Anyway, The reason I put that global in there was for the case that you had only replaygain track tags and had selected track mode. I guess it will work just as well if I load in all the tags that are in the file and set found = true if any are found. Here's a patch that does that. Cheers, Tim. ============ diff --git a/src/decoder/flac_metadata.c b/src/decoder/flac_metadata.c index 2bfb1a6..d259074 100644 --- a/src/decoder/flac_metadata.c +++ b/src/decoder/flac_metadata.c @@ -64,14 +96,20 @@ flac_parse_replay_gain(const FLAC__StreamMetadata *block) rgi = replay_gain_info_new(); - found = flac_find_float_comment(block, "replaygain_album_gain", - &rgi->tuples[REPLAY_GAIN_ALBUM].gain) || - flac_find_float_comment(block, "replaygain_album_peak", - &rgi->tuples[REPLAY_GAIN_ALBUM].peak) || - flac_find_float_comment(block, "replaygain_track_gain", - &rgi->tuples[REPLAY_GAIN_TRACK].gain) || - flac_find_float_comment(block, "replaygain_track_peak", - &rgi->tuples[REPLAY_GAIN_TRACK].peak); + if (flac_find_float_comment(block, "replaygain_album_gain", + &rgi->tuples[REPLAY_GAIN_ALBUM].gain)) + found = true; + if (flac_find_float_comment(block, "replaygain_album_peak", + &rgi->tuples[REPLAY_GAIN_ALBUM].peak)) + found = true; + if (flac_find_float_comment(block, "replaygain_track_gain", + &rgi->tuples[REPLAY_GAIN_TRACK].gain)) + found = true; + if (flac_find_float_comment(block, "replaygain_track_peak", + &rgi->tuples[REPLAY_GAIN_TRACK].peak)) + found = true; + + if (!found) { replay_gain_info_free(rgi); rgi = NULL; @@ -80,6 +118,54 @@ flac_parse_replay_gain(const FLAC__StreamMetadata *block) return rgi; } ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team