decoder/Control: make ReplayGainConfig const

This commit is contained in:
Max Kellermann 2016-12-03 13:05:25 +01:00
parent 3000b9dcde
commit 6cc1ff5eeb
3 changed files with 8 additions and 6 deletions

View File

@ -27,8 +27,10 @@
#include <assert.h>
DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond)
:mutex(_mutex), client_cond(_client_cond) {}
DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond,
const ReplayGainConfig &_replay_gain_config)
:mutex(_mutex), client_cond(_client_cond),
replay_gain_config(_replay_gain_config) {}
DecoderControl::~DecoderControl()
{

View File

@ -158,7 +158,7 @@ struct DecoderControl {
*/
MusicPipe *pipe;
ReplayGainConfig replay_gain_config;
const ReplayGainConfig replay_gain_config;
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
float replay_gain_db = 0;
@ -170,7 +170,8 @@ struct DecoderControl {
* @param _mutex see #mutex
* @param _client_cond see #client_cond
*/
DecoderControl(Mutex &_mutex, Cond &_client_cond);
DecoderControl(Mutex &_mutex, Cond &_client_cond,
const ReplayGainConfig &_replay_gain_config);
~DecoderControl();
/**

View File

@ -345,7 +345,6 @@ Player::StartDecoder(MusicPipe &_pipe)
{
/* copy ReplayGain parameters to the decoder */
const ScopeLock protect(pc.mutex);
dc.replay_gain_config = pc.replay_gain_config;
dc.replay_gain_mode = pc.replay_gain_mode;
}
@ -1164,7 +1163,7 @@ player_task(void *arg)
SetThreadName("player");
DecoderControl dc(pc.mutex, pc.cond);
DecoderControl dc(pc.mutex, pc.cond, pc.replay_gain_config);
decoder_thread_start(dc);
MusicBuffer buffer(pc.buffer_chunks);