aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mpcdec_decoder_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/mpcdec_decoder_plugin.c')
-rw-r--r--src/decoder/mpcdec_decoder_plugin.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/decoder/mpcdec_decoder_plugin.c b/src/decoder/mpcdec_decoder_plugin.c
index eaf470a40..d4768b35b 100644
--- a/src/decoder/mpcdec_decoder_plugin.c
+++ b/src/decoder/mpcdec_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
@@ -20,6 +20,7 @@
#include "config.h"
#include "decoder_api.h"
#include "audio_check.h"
+#include "tag_handler.h"
#ifdef MPC_IS_OLD_API
#include <mpcdec/mpcdec.h>
@@ -61,7 +62,7 @@ mpc_seek_cb(cb_first_arg, mpc_int32_t offset)
{
struct mpc_decoder_data *data = (struct mpc_decoder_data *) cb_data;
- return input_stream_seek(data->is, offset, SEEK_SET, NULL);
+ return input_stream_lock_seek(data->is, offset, SEEK_SET, NULL);
}
static mpc_int32_t
@@ -323,18 +324,17 @@ mpcdec_get_file_duration(struct input_stream *is)
return total_time;
}
-static struct tag *
-mpcdec_stream_tag(struct input_stream *is)
+static bool
+mpcdec_scan_stream(struct input_stream *is,
+ const struct tag_handler *handler, void *handler_ctx)
{
float total_time = mpcdec_get_file_duration(is);
- struct tag *tag;
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 mpcdec_suffixes[] = { "mpc", NULL };
@@ -342,6 +342,6 @@ static const char *const mpcdec_suffixes[] = { "mpc", NULL };
const struct decoder_plugin mpcdec_decoder_plugin = {
.name = "mpcdec",
.stream_decode = mpcdec_decode,
- .stream_tag = mpcdec_stream_tag,
+ .scan_stream = mpcdec_scan_stream,
.suffixes = mpcdec_suffixes,
};