aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mad_decoder_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/mad_decoder_plugin.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c
index 2c2906c5c..a69284be5 100644
--- a/src/decoder/mad_decoder_plugin.c
+++ b/src/decoder/mad_decoder_plugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -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>
@@ -168,7 +169,7 @@ mp3_data_init(struct mp3_data *data, struct decoder *decoder,
static bool mp3_seek(struct mp3_data *data, long offset)
{
- if (!input_stream_seek(data->input_stream, offset, SEEK_SET, NULL))
+ if (!input_stream_lock_seek(data->input_stream, offset, SEEK_SET, NULL))
return false;
mad_stream_buffer(&data->stream, data->input_buffer, 0);
@@ -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
};