diff options
author | Max Kellermann <max@duempel.org> | 2013-10-25 19:05:49 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-25 19:12:46 +0200 |
commit | d6e28c42e5c2bdab73d3553b21a09fa28dabd037 (patch) | |
tree | 6b7e43d0b777b3be149c86e853debef3cbd49826 /src/decoder | |
parent | 6d475c40de567d778fa6f96c379687a8bf83f82b (diff) | |
download | mpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.tar.gz mpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.tar.xz mpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.zip |
ReplayGainInfo: refactor to a class
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/FlacMetadata.cxx | 5 | ||||
-rw-r--r-- | src/decoder/MadDecoderPlugin.cxx | 4 | ||||
-rw-r--r-- | src/decoder/MpcdecDecoderPlugin.cxx | 2 | ||||
-rw-r--r-- | src/decoder/OpusDecoderPlugin.cxx | 2 | ||||
-rw-r--r-- | src/decoder/VorbisComments.cxx | 4 | ||||
-rw-r--r-- | src/decoder/WavpackDecoderPlugin.cxx | 5 |
6 files changed, 10 insertions, 12 deletions
diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx index 783394982..917da7d87 100644 --- a/src/decoder/FlacMetadata.cxx +++ b/src/decoder/FlacMetadata.cxx @@ -64,10 +64,9 @@ bool flac_parse_replay_gain(ReplayGainInfo &rgi, const FLAC__StreamMetadata *block) { - bool found = false; - - replay_gain_info_init(&rgi); + rgi.Clear(); + bool found = false; if (flac_find_float_comment(block, "replaygain_album_gain", &rgi.tuples[REPLAY_GAIN_ALBUM].gain)) found = true; diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx index 085497504..c7ed8781d 100644 --- a/src/decoder/MadDecoderPlugin.cxx +++ b/src/decoder/MadDecoderPlugin.cxx @@ -260,7 +260,7 @@ parse_id3_replay_gain_info(ReplayGainInfo &rgi, struct id3_frame *frame; bool found = false; - replay_gain_info_init(&rgi); + rgi.Clear(); for (i = 0; (frame = id3_tag_findframe(tag, "TXXX", i)); i++) { if (frame->nfields < 3) @@ -872,7 +872,7 @@ MadDecoder::DecodeFirstFrame(Tag **tag) if (decoder != nullptr && !found_replay_gain && lame.track_gain) { ReplayGainInfo rgi; - replay_gain_info_init(&rgi); + rgi.Clear(); rgi.tuples[REPLAY_GAIN_TRACK].gain = lame.track_gain; rgi.tuples[REPLAY_GAIN_TRACK].peak = lame.peak; decoder_replay_gain(*decoder, &rgi); diff --git a/src/decoder/MpcdecDecoderPlugin.cxx b/src/decoder/MpcdecDecoderPlugin.cxx index 654feaaf1..dc258623c 100644 --- a/src/decoder/MpcdecDecoderPlugin.cxx +++ b/src/decoder/MpcdecDecoderPlugin.cxx @@ -169,7 +169,7 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is) } ReplayGainInfo rgi; - replay_gain_info_init(&rgi); + rgi.Clear(); rgi.tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.); rgi.tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767; rgi.tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.); diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx index c50f98a5b..887b33a64 100644 --- a/src/decoder/OpusDecoderPlugin.cxx +++ b/src/decoder/OpusDecoderPlugin.cxx @@ -283,7 +283,7 @@ inline DecoderCommand MPDOpusDecoder::HandleTags(const ogg_packet &packet) { ReplayGainInfo rgi; - replay_gain_info_init(&rgi); + rgi.Clear(); TagBuilder tag_builder; diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx index 9830e733e..8fd078ff4 100644 --- a/src/decoder/VorbisComments.cxx +++ b/src/decoder/VorbisComments.cxx @@ -49,11 +49,11 @@ vorbis_comment_value(const char *comment, const char *needle) bool vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) { + rgi.Clear(); + const char *temp; bool found = false; - replay_gain_info_init(&rgi); - while (*comments) { if ((temp = vorbis_comment_value(*comments, "replaygain_track_gain"))) { diff --git a/src/decoder/WavpackDecoderPlugin.cxx b/src/decoder/WavpackDecoderPlugin.cxx index 62934713f..98555c5e8 100644 --- a/src/decoder/WavpackDecoderPlugin.cxx +++ b/src/decoder/WavpackDecoderPlugin.cxx @@ -224,10 +224,9 @@ static bool wavpack_replaygain(ReplayGainInfo &rgi, WavpackContext *wpc) { - bool found = false; - - replay_gain_info_init(&rgi); + rgi.Clear(); + bool found = false; found |= wavpack_tag_float(wpc, "replaygain_track_gain", &rgi.tuples[REPLAY_GAIN_TRACK].gain); found |= wavpack_tag_float(wpc, "replaygain_track_peak", |