aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/faad_decoder_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/faad_decoder_plugin.c')
-rw-r--r--src/decoder/faad_decoder_plugin.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/decoder/faad_decoder_plugin.c b/src/decoder/faad_decoder_plugin.c
index 8f932ad58..911f033b8 100644
--- a/src/decoder/faad_decoder_plugin.c
+++ b/src/decoder/faad_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
@@ -21,6 +21,7 @@
#include "decoder_api.h"
#include "decoder_buffer.h"
#include "audio_check.h"
+#include "tag_handler.h"
#define AAC_MAX_CHANNELS 6
@@ -205,7 +206,7 @@ faad_song_duration(struct decoder_buffer *buffer, struct input_stream *is)
/* obtain the duration from the ADTS header */
float song_length = adts_song_duration(buffer);
- input_stream_seek(is, tagsize, SEEK_SET, NULL);
+ input_stream_lock_seek(is, tagsize, SEEK_SET, NULL);
data = decoder_buffer_read(buffer, &length);
if (data != NULL)
@@ -406,7 +407,7 @@ faad_stream_decode(struct decoder *mpd_decoder, struct input_stream *is)
faacDecSetConfiguration(decoder, config);
while (!decoder_buffer_is_full(buffer) &&
- !input_stream_eof(is) &&
+ !input_stream_lock_eof(is) &&
decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE) {
adts_find_frame(buffer);
decoder_buffer_fill(buffer);
@@ -487,18 +488,17 @@ faad_stream_decode(struct decoder *mpd_decoder, struct input_stream *is)
faacDecClose(decoder);
}
-static struct tag *
-faad_stream_tag(struct input_stream *is)
+static bool
+faad_scan_stream(struct input_stream *is,
+ const struct tag_handler *handler, void *handler_ctx)
{
int file_time = faad_get_file_time(is);
- struct tag *tag;
if (file_time < 0)
- return NULL;
+ return false;
- tag = tag_new();
- tag->time = file_time;
- return tag;
+ tag_handler_invoke_duration(handler, handler_ctx, file_time);
+ return true;
}
static const char *const faad_suffixes[] = { "aac", NULL };
@@ -509,7 +509,7 @@ static const char *const faad_mime_types[] = {
const struct decoder_plugin faad_decoder_plugin = {
.name = "faad",
.stream_decode = faad_stream_decode,
- .stream_tag = faad_stream_tag,
+ .scan_stream = faad_scan_stream,
.suffixes = faad_suffixes,
.mime_types = faad_mime_types,
};