From 5d73215a8dad922c8e383f3837f3ec9e26503389 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 11 Feb 2012 19:12:02 +0100 Subject: decoder_plugin: scan tags with callback table Pass a callback table to scan_file() and scan_stream(), instead of returning a tag object. --- src/decoder/mad_decoder_plugin.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/decoder/mad_decoder_plugin.c') 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 @@ -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 }; -- cgit v1.2.3