ReplayGainInfo: refactor to a class
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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.);
|
||||
|
@@ -283,7 +283,7 @@ inline DecoderCommand
|
||||
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
|
||||
{
|
||||
ReplayGainInfo rgi;
|
||||
replay_gain_info_init(&rgi);
|
||||
rgi.Clear();
|
||||
|
||||
TagBuilder tag_builder;
|
||||
|
||||
|
@@ -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"))) {
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user