aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mad_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/mad_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 'src/decoder/mad_decoder_plugin.c')
-rw-r--r--src/decoder/mad_decoder_plugin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c
index 8bf3f6546..a69284be5 100644
--- a/src/decoder/mad_decoder_plugin.c
+++ b/src/decoder/mad_decoder_plugin.c
@@ -22,6 +22,7 @@
#include "conf.h"
#include "tag_id3.h"
#include "tag_rva2.h"
+#include "tag_handler.h"
#include "audio_check.h"
#include <assert.h>
@@ -1176,19 +1177,18 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
mp3_data_finish(&data);
}
-static struct tag *
-mad_decoder_stream_tag(struct input_stream *is)
+static bool
+mad_decoder_scan_stream(struct input_stream *is,
+ const struct tag_handler *handler, void *handler_ctx)
{
- struct tag *tag;
int total_time;
total_time = mad_decoder_total_file_time(is);
if (total_time < 0)
- return NULL;
+ return false;
- tag = tag_new();
- tag->time = total_time;
- return tag;
+ tag_handler_invoke_duration(handler, handler_ctx, total_time);
+ return true;
}
static const char *const mp3_suffixes[] = { "mp3", "mp2", NULL };
@@ -1198,7 +1198,7 @@ const struct decoder_plugin mad_decoder_plugin = {
.name = "mad",
.init = mp3_plugin_init,
.stream_decode = mp3_decode,
- .stream_tag = mad_decoder_stream_tag,
+ .scan_stream = mad_decoder_scan_stream,
.suffixes = mp3_suffixes,
.mime_types = mp3_mime_types
};