diff options
author | Max Kellermann <max@duempel.org> | 2008-11-11 16:24:27 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-11 16:24:27 +0100 |
commit | 5ddde0aac790c57b75f20ce71e100f4379f1c653 (patch) | |
tree | b2e8ec4a99e032bf894002fd436c00e35e3cf5fd /src/decoder | |
parent | 5e686add91a7c2a89b886d04136983480793a26f (diff) | |
download | mpd-5ddde0aac790c57b75f20ce71e100f4379f1c653.tar.gz mpd-5ddde0aac790c57b75f20ce71e100f4379f1c653.tar.xz mpd-5ddde0aac790c57b75f20ce71e100f4379f1c653.zip |
replay_gain: converted struct replay_gain_info elements to an array
Having an array instead of individual variables allows the use of the
replay_gain_mode enum as an array index.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/_flac_common.c | 8 | ||||
-rw-r--r-- | src/decoder/mp3_plugin.c | 12 | ||||
-rw-r--r-- | src/decoder/mpc_plugin.c | 8 | ||||
-rw-r--r-- | src/decoder/oggvorbis_plugin.c | 8 | ||||
-rw-r--r-- | src/decoder/wavpack_plugin.c | 8 |
5 files changed, 22 insertions, 22 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c index 3df7d24e5..200b6fee6 100644 --- a/src/decoder/_flac_common.c +++ b/src/decoder/_flac_common.c @@ -75,13 +75,13 @@ static void flacParseReplayGain(const FLAC__StreamMetadata * block, data->replayGainInfo = replay_gain_info_new(); found |= flacFindVorbisCommentFloat(block, "replaygain_album_gain", - &data->replayGainInfo->album_gain); + &data->replayGainInfo->tuples[REPLAY_GAIN_ALBUM].gain); found |= flacFindVorbisCommentFloat(block, "replaygain_album_peak", - &data->replayGainInfo->album_peak); + &data->replayGainInfo->tuples[REPLAY_GAIN_ALBUM].peak); found |= flacFindVorbisCommentFloat(block, "replaygain_track_gain", - &data->replayGainInfo->track_gain); + &data->replayGainInfo->tuples[REPLAY_GAIN_TRACK].gain); found |= flacFindVorbisCommentFloat(block, "replaygain_track_peak", - &data->replayGainInfo->track_peak); + &data->replayGainInfo->tuples[REPLAY_GAIN_TRACK].peak); if (!found) { replay_gain_info_free(data->replayGainInfo); diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c index 602c9e2f9..4ae6cd744 100644 --- a/src/decoder/mp3_plugin.c +++ b/src/decoder/mp3_plugin.c @@ -228,16 +228,16 @@ parse_id3_replay_gain_info(struct id3_tag *tag) (&frame->fields[2])); if (strcasecmp(key, "replaygain_track_gain") == 0) { - replay_gain_info->track_gain = atof(value); + replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = atof(value); found = true; } else if (strcasecmp(key, "replaygain_album_gain") == 0) { - replay_gain_info->album_gain = atof(value); + replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = atof(value); found = true; } else if (strcasecmp(key, "replaygain_track_peak") == 0) { - replay_gain_info->track_peak = atof(value); + replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = atof(value); found = true; } else if (strcasecmp(key, "replaygain_album_peak") == 0) { - replay_gain_info->album_peak = atof(value); + replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = atof(value); found = true; } @@ -761,8 +761,8 @@ mp3_decode_first_frame(struct mp3_data *data, struct tag **tag, if (replay_gain_info_r && !*replay_gain_info_r && lame.track_gain) { *replay_gain_info_r = replay_gain_info_new(); - (*replay_gain_info_r)->track_gain = lame.track_gain; - (*replay_gain_info_r)->track_peak = lame.peak; + (*replay_gain_info_r)->tuples[REPLAY_GAIN_TRACK].gain = lame.track_gain; + (*replay_gain_info_r)->tuples[REPLAY_GAIN_TRACK].peak = lame.peak; } } } diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c index 6bb1d4f59..02b20a942 100644 --- a/src/decoder/mpc_plugin.c +++ b/src/decoder/mpc_plugin.c @@ -157,10 +157,10 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) audio_format.sample_rate = info.sample_freq; replayGainInfo = replay_gain_info_new(); - replayGainInfo->album_gain = info.gain_album * 0.01; - replayGainInfo->album_peak = info.peak_album / 32767.0; - replayGainInfo->track_gain = info.gain_title * 0.01; - replayGainInfo->track_peak = info.peak_title / 32767.0; + replayGainInfo->tuples[REPLAY_GAIN_ALBUM].gain = info.gain_album * 0.01; + replayGainInfo->tuples[REPLAY_GAIN_ALBUM].peak = info.peak_album / 32767.0; + replayGainInfo->tuples[REPLAY_GAIN_TRACK].gain = info.gain_title * 0.01; + replayGainInfo->tuples[REPLAY_GAIN_TRACK].peak = info.peak_title / 32767.0; decoder_initialized(mpd_decoder, &audio_format, inStream->seekable, diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c index 446151a73..e707c4013 100644 --- a/src/decoder/oggvorbis_plugin.c +++ b/src/decoder/oggvorbis_plugin.c @@ -105,19 +105,19 @@ ogg_getReplayGainInfo(char **comments) while (*comments) { if ((temp = ogg_parseComment(*comments, "replaygain_track_gain"))) { - rgi->track_gain = atof(temp); + rgi->tuples[REPLAY_GAIN_TRACK].gain = atof(temp); found = true; } else if ((temp = ogg_parseComment(*comments, "replaygain_album_gain"))) { - rgi->album_gain = atof(temp); + rgi->tuples[REPLAY_GAIN_ALBUM].gain = atof(temp); found = true; } else if ((temp = ogg_parseComment(*comments, "replaygain_track_peak"))) { - rgi->track_peak = atof(temp); + rgi->tuples[REPLAY_GAIN_TRACK].peak = atof(temp); found = true; } else if ((temp = ogg_parseComment(*comments, "replaygain_album_peak"))) { - rgi->album_peak = atof(temp); + rgi->tuples[REPLAY_GAIN_ALBUM].peak = atof(temp); found = true; } diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c index 10dd7fd02..67fa3fb44 100644 --- a/src/decoder/wavpack_plugin.c +++ b/src/decoder/wavpack_plugin.c @@ -240,16 +240,16 @@ wavpack_replaygain(WavpackContext *wpc) replay_gain_info = replay_gain_info_new(); found = wavpack_tag_float(wpc, "replaygain_track_gain", - &replay_gain_info->track_gain) + &replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain) || wavpack_tag_float(wpc, "replaygain_track_peak", - &replay_gain_info->track_peak) + &replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak) || wavpack_tag_float(wpc, "replaygain_album_gain", - &replay_gain_info->album_gain) + &replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain) || wavpack_tag_float(wpc, "replaygain_album_peak", - &replay_gain_info->album_peak); + &replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak); if (found) { return replay_gain_info; |