changeset 1741:f86ddc8e543b

branch merge
author Ralf Ertzinger <ralf@skytale.net>
date Wed, 19 Sep 2007 12:06:35 +0200
parents 8feacd004f50 (current diff) 5092ba62a566 (diff)
children 4f4634573e41
files src/neon/neon.c
diffstat 9 files changed, 60 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/src/console/Audacious_Driver.cxx	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/console/Audacious_Driver.cxx	Wed Sep 19 12:06:35 2007 +0200
@@ -110,7 +110,7 @@
 		*args = '\0';
 		// TODO: use func with better error reporting, and perhaps don't
 		// truncate path if there is no number after ?
-		track = atoi( args + 1 );
+		track = atoi( args + 1 ) - 1;
 		track_specified = true;
 	}
 
@@ -217,7 +217,9 @@
 		if ( info.track_count > 1 )
 		{
 			tuple_associate_int(ti, FIELD_TRACK_NUMBER, NULL, track + 1);
-			tuple_associate_int(ti, -1, "subsong", track);
+			tuple_associate_int(ti, -1, "subsong", track + 1);
+			tuple_associate_int(ti, FIELD_SUBSONG_ID, NULL, track + 1);
+			tuple_associate_int(ti, FIELD_SUBSONG_NUM, NULL, info.track_count);
 		}
 		tuple_associate_string(ti, FIELD_COPYRIGHT, NULL, info.copyright);
 		tuple_associate_string(ti, -1, "console", info.system);
@@ -444,6 +446,8 @@
 	File_Handler fh( path, fd, TRUE );
 	if ( fh.type )
 	{
+		result = 1;
+		/*
 		if ( fh.track_specified || fh.type->track_count == 1 )
 		{
 			// don't even need to read file if track is specified or
@@ -470,6 +474,7 @@
 				result = -1;
 			}
 		}
+		*/
 	}
 	else if (fh.track_specified)
 	{
@@ -479,6 +484,16 @@
 	return result;
 }
 
+static Tuple *probe_for_tuple(gchar *filename, VFSFile *fd)
+{
+	if (!is_our_file_from_vfs(filename, fd))
+		return NULL;
+
+	vfs_rewind(fd);
+
+	return get_song_tuple(filename);
+}
+
 // Setup
 
 static void console_init(void)
@@ -538,7 +553,9 @@
 	NULL,
 	NULL,
 	is_our_file_from_vfs,
-	(gchar **)gme_fmts
+	(gchar **)gme_fmts,
+	NULL,
+	probe_for_tuple
 };
 
 InputPlugin *console_iplist[] = { &console_ip, NULL };
--- a/src/cue/cuesheet.c	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/cue/cuesheet.c	Wed Sep 19 12:06:35 2007 +0200
@@ -47,7 +47,6 @@
 static void cue_pause(InputPlayback *data, short);
 static Tuple *get_tuple(gchar *uri);
 static Tuple *get_tuple_uri(gchar *uri);
-static void get_song_info(gchar *uri, gchar **title, gint *length);
 static void cue_init(void);
 static void cue_cleanup(void);
 static gpointer watchdog_func(gpointer data);
@@ -102,7 +101,6 @@
 	.seek = seek,
 	.get_time = get_time,
 	.cleanup = cue_cleanup,		/* cleanup */
-	.get_song_info = get_song_info,	/* XXX get_song_info iface */
 	.get_song_tuple = get_tuple,
 };
 
@@ -298,28 +296,6 @@
     return out;
 }
 
-static void get_song_info(gchar *uri, gchar **title, gint *length)
-{
-	Tuple *tuple;
-
-	/* this isn't a cue:// uri? */
-	if (strncasecmp("cue://", uri, 6))
-	{
-		gchar *tmp = g_strdup_printf("cue://%s?0", uri);
-		tuple = get_tuple_uri(tmp);
-		g_free(tmp);
-	}
-	else
-		tuple = get_tuple_uri(uri);
-
-	g_return_if_fail(tuple != NULL);
-
-	*title = tuple_formatter_make_title_string(tuple, get_gentitle_format());
-	*length = tuple_get_int(tuple, FIELD_LENGTH, NULL);
-
-	tuple_free(tuple);
-}
-
 static void seek(InputPlayback * data, gint time)
 {
     g_mutex_lock(cue_target_time_mutex);
@@ -458,11 +434,10 @@
 {
     gchar *path2 = g_strdup(uri + 6); // "cue://" is stripped.
     gchar *_path = strchr(path2, '?');
-	gint file_length = 0;
 	gint track = 0;
-	gchar *dummy = NULL;
 	ProbeResult *pr;
 	InputPlugin *real_ip_plugin;
+    Tuple *tuple = NULL;
 
 #ifdef DEBUG
     g_print("f: play_cue_uri\n");
@@ -532,10 +507,12 @@
 #ifdef DEBUG
         g_print("cue: play_cue_uri: target_time = %d\n", target_time);
 #endif
-		/* in some plugins, NULL as 2nd arg causes crash. */
-		real_ip->plugin->get_song_info(cue_file, &dummy, &file_length);
-		g_free(dummy);
-		cue_tracks[last_cue_track].index = file_length;
+
+        tuple = real_ip->plugin->get_song_tuple(cue_file);
+        if(tuple) {
+            cue_tracks[last_cue_track].index = tuple_get_int(tuple, FIELD_LENGTH, NULL);
+            tuple_free(tuple); tuple = NULL;
+        }
 
         /* kick watchdog thread */
         g_mutex_lock(cue_mutex);
--- a/src/madplug/Makefile	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/madplug/Makefile	Wed Sep 19 12:06:35 2007 +0200
@@ -20,6 +20,6 @@
 CFLAGS   += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(ARCH_DEFINES) $(SIMD_CFLAGS) -I../../intl -I../.. -Wall
 
 LDFLAGS += $(AUDLDFLAGS)
-LIBADD = -L/opt/local/lib -L$(plugindir) -laudid3tag -lmad $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
+LIBADD = -L/opt/local/lib -L$(libdir) -laudid3tag -lmad $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
 
 include ../../mk/objective.mk
--- a/src/madplug/plugin.c	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/madplug/plugin.c	Wed Sep 19 12:06:35 2007 +0200
@@ -520,10 +520,10 @@
             *title = g_strdup(tuple_get_string(myinfo.tuple, -1, "track-name"));
         else
             *title = g_strdup(url);
-        if(tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL) == -1)
+
+        *length = tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL);
+        if(*length == -1)
             *length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
-        else
-            *length = tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL);
     }
     else {
         *title = g_strdup(url);
@@ -553,10 +553,9 @@
     }
 
     if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) {
-        if(tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL) == -1)
+        *length = tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL);
+        if(*length == -1)
             *length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
-        else
-            *length = tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL);
     }
     else {
         *length = -1;
--- a/src/neon/neon.c	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/neon/neon.c	Wed Sep 19 12:06:35 2007 +0200
@@ -161,13 +161,15 @@
  * -----
  */
 
+#define TAGSIZE 4096
+
 static void parse_icy(struct icy_metadata* m, gchar* metadata, int len) {
 
     gchar* p;
     gchar* tstart;
     gchar* tend;
-    gchar name[4096];
-    gchar value[4096];
+    gchar name[TAGSIZE];
+    gchar value[TAGSIZE];
     int state;
     int pos;
 
@@ -191,7 +193,7 @@
                      * End of tag name.
                      */
                     *p = '\0';
-                    strcpy(name, tstart);
+                    g_strlcpy(name, tstart, TAGSIZE);
                     _DEBUG("Found tag name: %s", name);
                     state = 2;
                 } else {
@@ -220,7 +222,7 @@
                      * End of value
                      */
                     *p = '\0';
-                    strcpy(value, tstart);
+                    g_strlcpy(value, tstart, TAGSIZE);
                     _DEBUG("Found tag value: %s", value);
                     add_icy(m, name, value);
                     state = 4;
--- a/src/sid/xmms-sid.c	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/sid/xmms-sid.c	Wed Sep 19 12:06:35 2007 +0200
@@ -304,59 +304,16 @@
 
 gint xs_is_our_file_vfs(gchar *pcFilename, t_xs_file *f)
 {
-	gint tmpResult = 0, tmpDummy = 0;
 	assert(xs_status.sidPlayer);
 
 	/* Check the filename */
 	if (pcFilename == NULL)
 		return 0;
-
-#ifdef LULZ
-	/* FIXME! ATTENTION! Subtune addition is now temporarily disabled
-	 * again, due to following reason: the way it currently is "supposed"
-	 * to be done is horribly broken and causes an "infinite recursive
-	 * addition loop" in some cases. - ccr
-	 */
-	if (xs_has_tracknumber(pcFilename) != NULL)
+	
+	if (xs_status.sidPlayer->plrProbe(f))
 		return 1;
-#endif
-	
-	if (xs_status.sidPlayer->plrProbe(f)) {
-#ifdef LULZ
-		t_xs_tuneinfo *pInfo;
-		
-		pInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename);
-		
-		if (pInfo->nsubTunes > 1) {
-			gint i;
-			for (i = 1; i <= pInfo->nsubTunes; i++) {
-				gchar *tmpStr = g_strdup_printf("%s?%d", pcFilename, i);
-				gboolean doAdd = FALSE;
-					
-				if (xs_cfg.subAutoMinOnly) {
-					if (i == pInfo->startTune ||
-						pInfo->subTunes[i - 1].tuneLength >= xs_cfg.subAutoMinTime)
-						doAdd = TRUE;
-				} else
-					doAdd = TRUE;
-					
-				if (doAdd)
-					playlist_add_url(playlist_get_active(), tmpStr);
-
-				g_free(tmpStr);
-			}
-
-			tmpResult = -1;
-		} else
-			tmpResult = 1;
-			
-		xs_tuneinfo_free(pInfo);
-#else
-		tmpResult = 1;
-#endif
-	}
-		
-	return tmpResult;
+	else
+		return 0;
 }
 
 
@@ -677,6 +634,9 @@
 	tuple_associate_string(pResult, FIELD_GENRE, NULL, "SID-tune");
 	tuple_associate_string(pResult, FIELD_COPYRIGHT, NULL, pInfo->sidCopyright);
 
+	if (xs_cfg.subAutoEnable)
+		tuple_associate_int(pResult, FIELD_SUBSONG_NUM, NULL, pInfo->nsubTunes);
+
 	tuple_associate_int(pResult, -1, "subtunes", pInfo->nsubTunes);
 	tuple_associate_string(pResult, -1, "sid-format", pInfo->sidFormat);
 
@@ -717,6 +677,7 @@
 		subTune = 1;
 
 	tuple_associate_int(pResult, -1, "subtune", subTune);
+	tuple_associate_int(pResult, FIELD_SUBSONG_ID, NULL, subTune);
 	tuple_associate_int(pResult, FIELD_TRACK_NUMBER, NULL, subTune);
 
 	if (xs_cfg.titleOverride)
@@ -753,3 +714,13 @@
 
 	return tmpResult;
 }
+
+Tuple *xs_probe_for_tuple(gchar *filename, t_xs_file *fd)
+{
+    if (!xs_is_our_file_vfs(filename, fd))
+        return NULL;
+
+    vfs_rewind(fd);
+
+    return xs_get_song_tuple(filename);
+}
--- a/src/sid/xmms-sid.h	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/sid/xmms-sid.h	Wed Sep 19 12:06:35 2007 +0200
@@ -178,6 +178,7 @@
 void	xs_seek(InputPlayback *, gint);
 gint	xs_get_time(InputPlayback *);
 Tuple *	xs_get_song_tuple(gchar *);
+Tuple *	xs_probe_for_tuple(gchar *, t_xs_file *);
 void	xs_about(void);
 
 void	xs_error(const char *, ...);
--- a/src/sid/xs_init.c	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/sid/xs_init.c	Wed Sep 19 12:06:35 2007 +0200
@@ -46,6 +46,7 @@
 	.is_our_file = xs_is_our_file,			/* Check file */
 	.is_our_file_from_vfs = xs_is_our_file_vfs,	/* VFS */
 	.vfs_extensions = xs_sid_fmts,			/* File ext assist */
+	.probe_for_tuple = xs_probe_for_tuple
 };
 
 static InputPlugin *sid_iplist[] = { &xs_plugin_ip, NULL };
--- a/src/tta/Makefile	Wed Sep 19 12:04:12 2007 +0200
+++ b/src/tta/Makefile	Wed Sep 19 12:06:35 2007 +0200
@@ -12,6 +12,6 @@
 CFLAGS += -fPIC -DPIC $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I../../intl -I../..
 
 LDFLAGS += $(AUDLDFLAGS)
-LIBADD = -L$(plugindir) -laudid3tag $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
+LIBADD = -L$(libdir) -laudid3tag $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
 
 include ../../mk/objective.mk