aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-03 07:30:42 +0100
committerMax Kellermann <max@duempel.org>2008-11-03 07:30:42 +0100
commitbb15c3bd4586fd58b82aa8006a2d658b88511a65 (patch)
tree06fa392e428c0a1cb5642e680b4f322487135fa8 /src/decoder
parent79d70f124d1116cf5c3a39b64a63a9dd81c224c1 (diff)
downloadmpd-bb15c3bd4586fd58b82aa8006a2d658b88511a65.tar.gz
mpd-bb15c3bd4586fd58b82aa8006a2d658b88511a65.tar.xz
mpd-bb15c3bd4586fd58b82aa8006a2d658b88511a65.zip
mod: always initialize libmikmod
The "mod" decoder plugin was being initialized lazily, but was deinitialized unconditionally. That led to segmentation faults. Convert mod_initMikMod() to be the global module initialization method. The MPD core should care about lazy initialization.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/mod_plugin.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c
index 3575fdf56..3fb4c5610 100644
--- a/src/decoder/mod_plugin.c
+++ b/src/decoder/mod_plugin.c
@@ -181,9 +181,6 @@ mod_decode(struct decoder *decoder, const char *path)
float secPerByte;
enum decoder_command cmd = DECODE_COMMAND_NONE;
- if (!mod_initMikMod())
- return false;
-
if (!(data = mod_open(path))) {
ERROR("failed to open mod: %s\n", path);
MikMod_Exit();
@@ -222,11 +219,6 @@ static struct tag *modTagDup(const char *file)
MODULE *moduleHandle;
char *title;
- if (!mod_initMikMod()) {
- DEBUG("modTagDup: Failed to initialize MikMod\n");
- return NULL;
- }
-
path2 = g_strdup(file);
moduleHandle = Player_Load(path2, 128, 0);
g_free(path2);
@@ -275,6 +267,7 @@ static const char *const modSuffixes[] = {
const struct decoder_plugin modPlugin = {
.name = "mod",
+ .init = mod_initMikMod,
.finish = mod_finishMikMod,
.file_decode = mod_decode,
.tag_dup = modTagDup,