aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/modplug_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/modplug_plugin.c')
-rw-r--r--src/decoder/modplug_plugin.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/decoder/modplug_plugin.c b/src/decoder/modplug_plugin.c
index 05c9ef2d7..242983518 100644
--- a/src/decoder/modplug_plugin.c
+++ b/src/decoder/modplug_plugin.c
@@ -149,31 +149,23 @@ mod_decode(struct decoder *decoder, struct input_stream *is)
ModPlug_Unload(f);
}
-static struct tag *mod_tagdup(const char *file)
+static struct tag *
+modplug_stream_tag(struct input_stream *is)
{
ModPlugFile *f;
struct tag *ret = NULL;
GByteArray *bdatas;
char *title;
- struct input_stream is;
- if (!input_stream_open(&is, file, NULL)) {
- g_warning("cant open file %s\n", file);
+ bdatas = mod_loadfile(NULL, is);
+ if (!bdatas)
return NULL;
- }
-
- bdatas = mod_loadfile(NULL, &is);
- if (!bdatas) {
- g_warning("cant load file %s\n", file);
- return NULL;
- }
f = ModPlug_Load(bdatas->data, bdatas->len);
g_byte_array_free(bdatas, TRUE);
- if (!f) {
- g_warning("could not decode file %s\n", file);
+ if (f == NULL)
return NULL;
- }
+
ret = tag_new();
ret->time = ModPlug_GetLength(f) / 1000;
@@ -184,8 +176,6 @@ static struct tag *mod_tagdup(const char *file)
ModPlug_Unload(f);
- input_stream_close(&is);
-
return ret;
}
@@ -199,6 +189,6 @@ static const char *const mod_suffixes[] = {
const struct decoder_plugin modplug_decoder_plugin = {
.name = "modplug",
.stream_decode = mod_decode,
- .tag_dup = mod_tagdup,
+ .stream_tag = modplug_stream_tag,
.suffixes = mod_suffixes,
};