aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/sidplay_decoder_plugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/sidplay_decoder_plugin.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/decoder/sidplay_decoder_plugin.cxx b/src/decoder/sidplay_decoder_plugin.cxx
index 6fceeb30f..5d162f179 100644
--- a/src/decoder/sidplay_decoder_plugin.cxx
+++ b/src/decoder/sidplay_decoder_plugin.cxx
@@ -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 @@
extern "C" {
#include "../decoder_api.h"
+#include "tag_handler.h"
}
#include <errno.h>
@@ -200,7 +201,6 @@ get_song_length(const char *path_fs)
static void
sidplay_file_decode(struct decoder *decoder, const char *path_fs)
{
- int ret;
int channels;
/* load the tune */
@@ -336,8 +336,9 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
} while (cmd != DECODE_COMMAND_STOP);
}
-static struct tag *
-sidplay_tag_dup(const char *path_fs)
+static bool
+sidplay_scan_file(const char *path_fs,
+ const struct tag_handler *handler, void *handler_ctx)
{
int song_num=get_song_num(path_fs);
char *path_container=get_container_name(path_fs);
@@ -345,10 +346,9 @@ sidplay_tag_dup(const char *path_fs)
SidTune tune(path_container, NULL, true);
g_free(path_container);
if (!tune)
- return NULL;
+ return false;
const SidTuneInfo &info = tune.getInfo();
- struct tag *tag = tag_new();
/* title */
const char *title;
@@ -360,25 +360,28 @@ sidplay_tag_dup(const char *path_fs)
if(info.songs>1) {
char *tag_title=g_strdup_printf("%s (%d/%d)",
title, song_num, info.songs);
- tag_add_item(tag, TAG_TITLE, tag_title);
+ tag_handler_invoke_tag(handler, handler_ctx,
+ TAG_TITLE, tag_title);
g_free(tag_title);
} else
- tag_add_item(tag, TAG_TITLE, title);
+ tag_handler_invoke_tag(handler, handler_ctx, TAG_TITLE, title);
/* artist */
if (info.numberOfInfoStrings > 1 && info.infoString[1] != NULL)
- tag_add_item(tag, TAG_ARTIST, info.infoString[1]);
+ tag_handler_invoke_tag(handler, handler_ctx, TAG_ARTIST,
+ info.infoString[1]);
/* track */
char *track=g_strdup_printf("%d", song_num);
- tag_add_item(tag, TAG_TRACK, track);
+ tag_handler_invoke_tag(handler, handler_ctx, TAG_TRACK, track);
g_free(track);
/* time */
int song_len=get_song_length(path_fs);
- if(song_len!=-1) tag->time=song_len;
+ if (song_len >= 0)
+ tag_handler_invoke_duration(handler, handler_ctx, song_len);
- return tag;
+ return true;
}
static char *
@@ -421,7 +424,7 @@ const struct decoder_plugin sidplay_decoder_plugin = {
sidplay_finish,
NULL, /* stream_decode() */
sidplay_file_decode,
- sidplay_tag_dup,
+ sidplay_scan_file,
NULL, /* stream_tag() */
sidplay_container_scan,
sidplay_suffixes,