aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/wavpack_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-11 19:12:02 +0100
committerMax Kellermann <max@duempel.org>2012-02-11 17:04:29 +0100
commit5d73215a8dad922c8e383f3837f3ec9e26503389 (patch)
tree8fc4b96d93a907054a05d3250f97bf4f68c6df85 /src/decoder/wavpack_decoder_plugin.c
parentb7356bc526dbbd6fa00d40caff2addec10ae7c7e (diff)
downloadmpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.gz
mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.xz
mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.zip
decoder_plugin: scan tags with callback table
Pass a callback table to scan_file() and scan_stream(), instead of returning a tag object.
Diffstat (limited to '')
-rw-r--r--src/decoder/wavpack_decoder_plugin.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c
index 4945b75ce..794b969c4 100644
--- a/src/decoder/wavpack_decoder_plugin.c
+++ b/src/decoder/wavpack_decoder_plugin.c
@@ -22,6 +22,7 @@
#include "audio_check.h"
#include "path.h"
#include "utils.h"
+#include "tag_handler.h"
#include <wavpack/wavpack.h>
#include <glib.h>
@@ -275,11 +276,11 @@ wavpack_replaygain(struct replay_gain_info *replay_gain_info,
/*
* Reads metainfo from the specified file.
*/
-static struct tag *
-wavpack_tagdup(const char *fname)
+static bool
+wavpack_scan_file(const char *fname,
+ const struct tag_handler *handler, void *handler_ctx)
{
WavpackContext *wpc;
- struct tag *tag;
char error[ERRORLEN];
char *s;
int size, allocated_size;
@@ -290,12 +291,12 @@ wavpack_tagdup(const char *fname)
"failed to open WavPack file \"%s\": %s\n",
fname, error
);
- return NULL;
+ return false;
}
- tag = tag_new();
- tag->time = WavpackGetNumSamples(wpc);
- tag->time /= WavpackGetSampleRate(wpc);
+ tag_handler_invoke_duration(handler, handler_ctx,
+ WavpackGetNumSamples(wpc) /
+ WavpackGetSampleRate(wpc));
allocated_size = 0;
s = NULL;
@@ -315,7 +316,8 @@ wavpack_tagdup(const char *fname)
}
WavpackGetTagItem(wpc, tagtypes[i].name, s, size);
- tag_add_item(tag, tagtypes[i].type, s);
+ tag_handler_invoke_tag(handler, handler_ctx,
+ tagtypes[i].type, s);
}
}
@@ -323,7 +325,7 @@ wavpack_tagdup(const char *fname)
WavpackCloseFile(wpc);
- return tag;
+ return true;
}
/*
@@ -576,7 +578,7 @@ const struct decoder_plugin wavpack_decoder_plugin = {
.name = "wavpack",
.stream_decode = wavpack_streamdecode,
.file_decode = wavpack_filedecode,
- .tag_dup = wavpack_tagdup,
+ .scan_file = wavpack_scan_file,
.suffixes = wavpack_suffixes,
.mime_types = wavpack_mime_types
};