diff options
author | Max Kellermann <max@duempel.org> | 2013-01-05 00:05:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-05 02:40:33 +0100 |
commit | 1a8ef3cdab39234e91fe9d91dad2ae004e4537dc (patch) | |
tree | 128f25b72f61ff2e7a2a3fb1f292b57ad27b9061 /src/filter | |
parent | 7be33eba489825d3a36f3ccbb3571002fcc06c0b (diff) | |
download | mpd-1a8ef3cdab39234e91fe9d91dad2ae004e4537dc.tar.gz mpd-1a8ef3cdab39234e91fe9d91dad2ae004e4537dc.tar.xz mpd-1a8ef3cdab39234e91fe9d91dad2ae004e4537dc.zip |
filter/ReplayGain: add method _set_mode()
Push the new mode to the filter instead of accessing global variables
through replay_gain_get_real_mode().
Diffstat (limited to 'src/filter')
-rw-r--r-- | src/filter/replay_gain_filter_plugin.c | 28 | ||||
-rw-r--r-- | src/filter/replay_gain_filter_plugin.h | 3 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/filter/replay_gain_filter_plugin.c b/src/filter/replay_gain_filter_plugin.c index 583a09f90..9fd3cbc07 100644 --- a/src/filter/replay_gain_filter_plugin.c +++ b/src/filter/replay_gain_filter_plugin.c @@ -119,7 +119,7 @@ replay_gain_filter_init(G_GNUC_UNUSED const struct config_param *param, filter_init(&filter->filter, &replay_gain_filter_plugin); filter->mixer = NULL; - filter->mode = replay_gain_get_real_mode(); + filter->mode = REPLAY_GAIN_OFF; replay_gain_info_init(&filter->info); filter->volume = PCM_VOLUME_1; @@ -164,16 +164,6 @@ replay_gain_filter_filter(struct filter *_filter, (struct replay_gain_filter *)_filter; bool success; void *dest; - enum replay_gain_mode rg_mode; - - /* check if the mode has been changed since the last call */ - rg_mode = replay_gain_get_real_mode(); - - if (filter->mode != rg_mode) { - g_debug("replay gain mode has changed %d->%d\n", filter->mode, rg_mode); - filter->mode = rg_mode; - replay_gain_filter_update(filter); - } *dest_size_r = src_size; @@ -243,3 +233,19 @@ replay_gain_filter_set_info(struct filter *_filter, replay_gain_filter_update(filter); } + +void +replay_gain_filter_set_mode(struct filter *_filter, enum replay_gain_mode mode) +{ + struct replay_gain_filter *filter = + (struct replay_gain_filter *)_filter; + + if (mode == filter->mode) + /* no change */ + return; + + g_debug("replay gain mode has changed %d->%d\n", filter->mode, mode); + + filter->mode = mode; + replay_gain_filter_update(filter); +} diff --git a/src/filter/replay_gain_filter_plugin.h b/src/filter/replay_gain_filter_plugin.h index 45b738e40..da2df9d6a 100644 --- a/src/filter/replay_gain_filter_plugin.h +++ b/src/filter/replay_gain_filter_plugin.h @@ -47,4 +47,7 @@ void replay_gain_filter_set_info(struct filter *filter, const struct replay_gain_info *info); +void +replay_gain_filter_set_mode(struct filter *filter, enum replay_gain_mode mode); + #endif |