aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-04 20:43:19 +0100
committerMax Kellermann <max@duempel.org>2010-01-04 21:02:36 +0100
commit1330274ffc6f80d5dd768902b09849cf32f329d2 (patch)
treec0cb2e00efec3239e1976a212f6fbdeb62fe5b04
parent0e183d3fa1f216729725127d868d66268e1a35d4 (diff)
downloadmpd-1330274ffc6f80d5dd768902b09849cf32f329d2.tar.gz
mpd-1330274ffc6f80d5dd768902b09849cf32f329d2.tar.xz
mpd-1330274ffc6f80d5dd768902b09849cf32f329d2.zip
replay_gain: moved code to replay_gain_info.c
-rw-r--r--Makefile.am6
-rw-r--r--src/decoder/flac_metadata.c2
-rw-r--r--src/decoder_api.c1
-rw-r--r--src/decoder_api.h2
-rw-r--r--src/decoder_thread.c1
-rw-r--r--src/replay_gain.c23
-rw-r--r--src/replay_gain.h29
-rw-r--r--src/replay_gain_info.c48
-rw-r--r--src/replay_gain_info.h52
-rw-r--r--src/replay_gain_state.h2
10 files changed, 112 insertions, 54 deletions
diff --git a/Makefile.am b/Makefile.am
index 9137ece95..1ff1d8ec8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -169,6 +169,7 @@ mpd_headers = \
src/queue_print.h \
src/queue_save.h \
src/replay_gain.h \
+ src/replay_gain_info.h \
src/replay_gain_state.h \
src/sig_handlers.h \
src/song.h \
@@ -296,6 +297,7 @@ src_mpd_SOURCES = \
src/queue_print.c \
src/queue_save.c \
src/replay_gain.c \
+ src/replay_gain_info.c \
src/replay_gain_state.c \
src/sig_handlers.c \
src/song.c \
@@ -830,7 +832,7 @@ test_run_decoder_LDADD = $(MPD_LIBS) \
test_run_decoder_SOURCES = test/run_decoder.c \
src/conf.c src/tokenizer.c src/utils.c src/log.c \
src/tag.c src/tag_pool.c \
- src/replay_gain.c \
+ src/replay_gain_info.c \
src/uri.c \
src/fd_util.c \
src/audio_check.c \
@@ -853,7 +855,7 @@ test_read_tags_LDADD = $(MPD_LIBS) \
test_read_tags_SOURCES = test/read_tags.c \
src/conf.c src/tokenizer.c src/utils.c src/log.c \
src/tag.c src/tag_pool.c \
- src/replay_gain.c \
+ src/replay_gain_info.c \
src/uri.c \
src/fd_util.c \
src/audio_check.c \
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>