aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/modplug_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-31 18:20:08 +0100
committerMax Kellermann <max@duempel.org>2009-12-31 18:32:09 +0100
commit05cde5810accc64b4f57a106ad41ba46dfd99bbd (patch)
tree401baa007b179882fe242fb0641f30ccd89a1b3d /src/decoder/modplug_plugin.c
parent6b96f5d566a6a36bfcdb70c8a27771717eb3d038 (diff)
downloadmpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.tar.gz
mpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.tar.xz
mpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.zip
decoder: switch a bunch of plugins to stream_tag()
This patch changes the following decoder plugins to implement stream_tag() instead of tag_dup(): faad, ffmpeg, mad, modplug, mp4ff, mpcdec, oggflac This simplifies their code, because they do not need to take care of opening/closing the stream.
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,
};