ReplayGainInfo: refactor to a class

This commit is contained in:
Max Kellermann
2013-10-25 19:05:49 +02:00
parent 6d475c40de
commit d6e28c42e5
13 changed files with 65 additions and 68 deletions

View File

@@ -64,10 +64,9 @@ bool
flac_parse_replay_gain(ReplayGainInfo &rgi,
const FLAC__StreamMetadata *block)
{
rgi.Clear();
bool found = false;
replay_gain_info_init(&rgi);
if (flac_find_float_comment(block, "replaygain_album_gain",
&rgi.tuples[REPLAY_GAIN_ALBUM].gain))
found = true;

View File

@@ -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);

View File

@@ -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.);

View File

@@ -283,7 +283,7 @@ inline DecoderCommand
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
{
ReplayGainInfo rgi;
replay_gain_info_init(&rgi);
rgi.Clear();
TagBuilder tag_builder;

View File

@@ -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"))) {

View File

@@ -224,10 +224,9 @@ static bool
wavpack_replaygain(ReplayGainInfo &rgi,
WavpackContext *wpc)
{
rgi.Clear();
bool found = false;
replay_gain_info_init(&rgi);
found |= wavpack_tag_float(wpc, "replaygain_track_gain",
&rgi.tuples[REPLAY_GAIN_TRACK].gain);
found |= wavpack_tag_float(wpc, "replaygain_track_peak",