aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/audiofile_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/audiofile_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/audiofile_decoder_plugin.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/decoder/audiofile_decoder_plugin.c b/src/decoder/audiofile_decoder_plugin.c
index 8d6236a57..7db7c7517 100644
--- a/src/decoder/audiofile_decoder_plugin.c
+++ b/src/decoder/audiofile_decoder_plugin.c
@@ -20,6 +20,7 @@
#include "config.h"
#include "decoder_api.h"
#include "audio_check.h"
+#include "tag_handler.h"
#include <audiofile.h>
#include <af_vfs.h>
@@ -222,20 +223,20 @@ audiofile_stream_decode(struct decoder *decoder, struct input_stream *is)
afCloseFile(af_fp);
}
-static struct tag *audiofile_tag_dup(const char *file)
+static bool
+audiofile_scan_file(const char *file,
+ const struct tag_handler *handler, void *handler_ctx)
{
- struct tag *ret = NULL;
int total_time = audiofile_get_duration(file);
- if (total_time >= 0) {
- ret = tag_new();
- ret->time = total_time;
- } else {
+ if (total_time < 0) {
g_debug("Failed to get total song time from: %s\n",
file);
+ return false;
}
- return ret;
+ tag_handler_invoke_duration(handler, handler_ctx, total_time);
+ return true;
}
static const char *const audiofile_suffixes[] = {
@@ -251,7 +252,7 @@ static const char *const audiofile_mime_types[] = {
const struct decoder_plugin audiofile_decoder_plugin = {
.name = "audiofile",
.stream_decode = audiofile_stream_decode,
- .tag_dup = audiofile_tag_dup,
+ .scan_file = audiofile_scan_file,
.suffixes = audiofile_suffixes,
.mime_types = audiofile_mime_types,
};