diff options
author | Max Kellermann <max@musicpd.org> | 2019-09-13 19:49:41 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-09-13 19:50:49 +0200 |
commit | 9270829b5b8c02e2e3dba1d3cc41d983616f68d1 (patch) | |
tree | dd66b582e63f60a70fd0cc6b9e6e37df4c43f665 /src/decoder | |
parent | b6243a99450fcef7cd3a1bdea628a93719c1fc5f (diff) |
ReplayGainInfo: move more code to a function
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/MpcdecDecoderPlugin.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx index b7be3fd8e..f7f0870fd 100644 --- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx +++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx @@ -146,6 +146,15 @@ ImportMpcdecReplayGain(mpc_uint16_t gain, mpc_uint16_t peak) noexcept 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 mpcdec_decode(DecoderClient &client, InputStream &is) { @@ -176,12 +185,10 @@ mpcdec_decode(DecoderClient &client, InputStream &is) mpcdec_sample_format, info.channels); - ReplayGainInfo rgi; - rgi.Clear(); - rgi.album = ImportMpcdecReplayGain(info.gain_album, info.peak_album); - rgi.track = ImportMpcdecReplayGain(info.gain_title, info.peak_title); - - client.SubmitReplayGain(&rgi); + { + const auto rgi = ImportMpcdecReplayGain(info); + client.SubmitReplayGain(&rgi); + } client.Ready(audio_format, is.IsSeekable(), SongTime::FromS(mpc_streaminfo_get_length(&info))); |