changeset 611:a751d2b85a7d

Merge in Tuple changes from Audacious-SID.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Sep 2007 14:43:05 +0000
parents 88bc61a2914f
children 32fc27395220
files src/xs_support.h src/xs_title.c src/xs_title.h
diffstat 3 files changed, 36 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_support.h	Sat Sep 01 14:43:01 2007 +0000
+++ b/src/xs_support.h	Sat Sep 01 14:43:05 2007 +0000
@@ -15,10 +15,13 @@
 #ifdef AUDACIOUS_PLUGIN
 #include <audacious/plugin.h>
 #include <audacious/output.h>
-#include <audacious/util.h>  
+#include <audacious/util.h>
+#include <audacious/tuple.h>
+#define HAVE_MEMSET
 #else
 #include <xmms/plugin.h>
 #include <xmms/util.h>
+#include <xmms/titlestring.h>
 #endif
 
 #ifdef HAVE_ASSERT_H
@@ -40,6 +43,13 @@
 #endif
 
 
+/* Metadata structures */
+#ifdef AUDACIOUS_PLUGIN
+#define t_xs_tuple Tuple
+#else
+#define t_xs_tuple TitleInput
+#endif
+
 /* VFS replacement functions
  */
 #ifdef __AUDACIOUS_NEWVFS__
--- a/src/xs_title.c	Sat Sep 01 14:43:01 2007 +0000
+++ b/src/xs_title.c	Sat Sep 01 14:43:05 2007 +0000
@@ -23,12 +23,6 @@
 #include "xs_title.h"
 #include "xs_support.h"
 #include "xs_config.h"
-#ifdef AUDACIOUS_PLUGIN
-#include <audacious/titlestring.h>
-#else
-#include <xmms/titlestring.h>
-#endif
-
 
 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt)
 {
@@ -57,18 +51,25 @@
 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN)
 /* Tuple support
  */
-static TitleInput * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath,
+static t_xs_tuple * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath,
 	gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune)
 {
-	TitleInput *pResult;
-	
+	t_xs_tuple *pResult;
+
 #ifdef AUDACIOUS_PLUGIN
-	pResult = bmp_title_input_new();
+	pResult = tuple_new();
+	tuple_associate_string(pResult, "title", p->sidName);
+	tuple_associate_string(pResult, "artist", p->sidComposer);
+	tuple_associate_string(pResult, "file-name", tmpFilename);
+	tuple_associate_string(pResult, "file-ext", tmpFileExt);
+	tuple_associate_string(pResult, "file-path", tmpFilePath);
+	tuple_associate_int(pResult, "track-number", subTune);
+	tuple_associate_string(pResult, "genre", "SID-tune");
+	tuple_associate_string(pResult, "comment", p->sidCopyright);
 #else
 	pResult = (TitleInput *) g_malloc0(sizeof(TitleInput));
 	pResult->__size = XMMS_TITLEINPUT_SIZE;
 	pResult->__version = XMMS_TITLEINPUT_VERSION;
-#endif
 
 	/* Create the input fields */
 	pResult->file_name = tmpFilename;
@@ -84,12 +85,12 @@
 	pResult->year = 0;
 	pResult->genre = g_strdup("SID-tune");
 	pResult->comment = g_strdup(p->sidCopyright);
-	
+#endif	
 	return pResult;
 }
 
 #ifdef AUDACIOUS_PLUGIN
-TitleInput * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune)
+t_xs_tuple * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune)
 {
 	gchar *tmpFilename, *tmpFilePath, *tmpFileExt;
 
@@ -137,9 +138,16 @@
 
 
 	/* Check if the titles are overridden or not */
-#if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN)
+#if defined(AUDACIOUS_PLUGIN)
 	if (!xs_cfg.titleOverride) {
-		TitleInput *pTuple = xs_get_titletuple(
+		t_xs_tuple *pTuple = xs_get_titletuple(
+			tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
+		pcResult = tuple_formatter_make_title_string(pTuple, get_gentitle_format());
+		tuple_free(pTuple);
+	} else
+#elif defined(HAVE_XMMSEXTRA)
+	if (!xs_cfg.titleOverride) {
+		t_xs_tuple *pTuple = xs_get_titletuple(
 			tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
 		
 		pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple);
@@ -151,7 +159,7 @@
 		g_free(pTuple->genre);
 		g_free(pTuple->comment);
 		g_free(pTuple);
-	} else 
+	} else
 #endif
 	{
 		/* Create the string */
--- a/src/xs_title.h	Sat Sep 01 14:43:01 2007 +0000
+++ b/src/xs_title.h	Sat Sep 01 14:43:05 2007 +0000
@@ -9,7 +9,7 @@
 
 gchar *xs_make_titlestring(t_xs_tuneinfo *, gint);
 #ifdef AUDACIOUS_PLUGIN
-TitleInput * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune);
+t_xs_tuple *xs_make_titletuple(t_xs_tuneinfo *p, gint subTune);
 #endif
 
 #ifdef __cplusplus