ReplayGainInfo: move more code to a function
This commit is contained in:
parent
b6243a9945
commit
9270829b5b
@ -146,6 +146,15 @@ ImportMpcdecReplayGain(mpc_uint16_t gain, mpc_uint16_t peak) noexcept
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr ReplayGainInfo
|
||||||
|
ImportMpcdecReplayGain(const mpc_streaminfo &info) noexcept
|
||||||
|
{
|
||||||
|
auto rgi = ReplayGainInfo::Undefined();
|
||||||
|
rgi.album = ImportMpcdecReplayGain(info.gain_album, info.peak_album);
|
||||||
|
rgi.track = ImportMpcdecReplayGain(info.gain_title, info.peak_title);
|
||||||
|
return rgi;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mpcdec_decode(DecoderClient &client, InputStream &is)
|
mpcdec_decode(DecoderClient &client, InputStream &is)
|
||||||
{
|
{
|
||||||
@ -176,12 +185,10 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
|
|||||||
mpcdec_sample_format,
|
mpcdec_sample_format,
|
||||||
info.channels);
|
info.channels);
|
||||||
|
|
||||||
ReplayGainInfo rgi;
|
{
|
||||||
rgi.Clear();
|
const auto rgi = ImportMpcdecReplayGain(info);
|
||||||
rgi.album = ImportMpcdecReplayGain(info.gain_album, info.peak_album);
|
client.SubmitReplayGain(&rgi);
|
||||||
rgi.track = ImportMpcdecReplayGain(info.gain_title, info.peak_title);
|
}
|
||||||
|
|
||||||
client.SubmitReplayGain(&rgi);
|
|
||||||
|
|
||||||
client.Ready(audio_format, is.IsSeekable(),
|
client.Ready(audio_format, is.IsSeekable(),
|
||||||
SongTime::FromS(mpc_streaminfo_get_length(&info)));
|
SongTime::FromS(mpc_streaminfo_get_length(&info)));
|
||||||
|
Loading…
Reference in New Issue
Block a user