diff options
Diffstat (limited to '')
-rw-r--r-- | src/decoder/flac_metadata.c | 2 | ||||
-rw-r--r-- | src/decoder_api.c | 1 | ||||
-rw-r--r-- | src/decoder_api.h | 2 | ||||
-rw-r--r-- | src/decoder_thread.c | 1 | ||||
-rw-r--r-- | src/replay_gain.c | 23 | ||||
-rw-r--r-- | src/replay_gain.h | 29 | ||||
-rw-r--r-- | src/replay_gain_info.c | 48 | ||||
-rw-r--r-- | src/replay_gain_info.h | 52 | ||||
-rw-r--r-- | src/replay_gain_state.h | 2 |
9 files changed, 108 insertions, 52 deletions
diff --git a/src/decoder/flac_metadata.c b/src/decoder/flac_metadata.c index f6f647893..b05dca3e5 100644 --- a/src/decoder/flac_metadata.c +++ b/src/decoder/flac_metadata.c @@ -19,7 +19,7 @@ #include "config.h" #include "flac_metadata.h" -#include "replay_gain.h" +#include "replay_gain_info.h" #include "tag.h" #include <glib.h> diff --git a/src/decoder_api.c b/src/decoder_api.c index 8e1e22f9d..0a4e1d12f 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -28,6 +28,7 @@ #include "pipe.h" #include "chunk.h" #include "replay_gain_state.h" +#include "replay_gain.h" #include <glib.h> diff --git a/src/decoder_api.h b/src/decoder_api.h index 39e7972d0..8fe9dd4e9 100644 --- a/src/decoder_api.h +++ b/src/decoder_api.h @@ -31,7 +31,7 @@ #include "decoder_command.h" #include "decoder_plugin.h" #include "input_stream.h" -#include "replay_gain.h" +#include "replay_gain_info.h" #include "tag.h" #include "audio_format.h" #include "conf.h" diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 625ec46cc..d2841436c 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -32,6 +32,7 @@ #include "path.h" #include "uri.h" #include "replay_gain_state.h" +#include "replay_gain.h" #include <glib.h> diff --git a/src/replay_gain.c b/src/replay_gain.c index 3537a96ed..d5ac55eba 100644 --- a/src/replay_gain.c +++ b/src/replay_gain.c @@ -127,26 +127,3 @@ void replay_gain_global_init(void) replay_gain_missing_preamp = pow(10, f / 20.0); } } - -struct replay_gain_info *replay_gain_info_new(void) -{ - struct replay_gain_info *ret = g_new(struct replay_gain_info, 1); - - for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) { - ret->tuples[i].gain = 0.0; - ret->tuples[i].peak = 0.0; - } - - return ret; -} - -struct replay_gain_info * -replay_gain_info_dup(const struct replay_gain_info *src) -{ - return g_memdup(src, sizeof(*src)); -} - -void replay_gain_info_free(struct replay_gain_info *info) -{ - g_free(info); -} diff --git a/src/replay_gain.h b/src/replay_gain.h index c27e2be06..8241aab8f 100644 --- a/src/replay_gain.h +++ b/src/replay_gain.h @@ -23,38 +23,15 @@ #ifndef MPD_REPLAY_GAIN_H #define MPD_REPLAY_GAIN_H -#include <stdbool.h> +#include "check.h" +#include "replay_gain_info.h" -enum replay_gain_mode { - REPLAY_GAIN_OFF = -1, - REPLAY_GAIN_ALBUM, - REPLAY_GAIN_TRACK, -}; +#include <stdbool.h> extern enum replay_gain_mode replay_gain_mode; extern float replay_gain_preamp; extern float replay_gain_missing_preamp; -struct replay_gain_tuple { - float gain; - float peak; -}; - -struct replay_gain_info { - struct replay_gain_tuple tuples[2]; -}; - -struct replay_gain_info * -replay_gain_info_new(void); - -/** - * Duplicate a #replay_gain_info object. - */ -struct replay_gain_info * -replay_gain_info_dup(const struct replay_gain_info *src); - -void replay_gain_info_free(struct replay_gain_info *info); - void replay_gain_global_init(void); /** diff --git a/src/replay_gain_info.c b/src/replay_gain_info.c new file mode 100644 index 000000000..676394c0f --- /dev/null +++ b/src/replay_gain_info.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2003-2010 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "replay_gain_info.h" + +#include <glib.h> + +struct replay_gain_info * +replay_gain_info_new(void) +{ + struct replay_gain_info *ret = g_new(struct replay_gain_info, 1); + + for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) { + ret->tuples[i].gain = 0.0; + ret->tuples[i].peak = 0.0; + } + + return ret; +} + +struct replay_gain_info * +replay_gain_info_dup(const struct replay_gain_info *src) +{ + return g_memdup(src, sizeof(*src)); +} + +void +replay_gain_info_free(struct replay_gain_info *info) +{ + g_free(info); +} diff --git a/src/replay_gain_info.h b/src/replay_gain_info.h new file mode 100644 index 000000000..51a167ce3 --- /dev/null +++ b/src/replay_gain_info.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2003-2010 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_REPLAY_GAIN_INFO_H +#define MPD_REPLAY_GAIN_INFO_H + +#include "check.h" + +enum replay_gain_mode { + REPLAY_GAIN_OFF = -1, + REPLAY_GAIN_ALBUM, + REPLAY_GAIN_TRACK, +}; + +struct replay_gain_tuple { + float gain; + float peak; +}; + +struct replay_gain_info { + struct replay_gain_tuple tuples[2]; +}; + +struct replay_gain_info * +replay_gain_info_new(void); + +/** + * Duplicate a #replay_gain_info object. + */ +struct replay_gain_info * +replay_gain_info_dup(const struct replay_gain_info *src); + +void +replay_gain_info_free(struct replay_gain_info *info); + +#endif diff --git a/src/replay_gain_state.h b/src/replay_gain_state.h index 7fa476095..bf687aa05 100644 --- a/src/replay_gain_state.h +++ b/src/replay_gain_state.h @@ -21,7 +21,7 @@ #define MPD_REPLAY_GAIN_STATE_H #include "check.h" -#include "replay_gain.h" +#include "replay_gain_info.h" #include <stddef.h> |