changeset 1747:29d0e4435e0e

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Sep 2007 05:48:38 +0300
parents b3decbd3051b (diff) 35f8a5fbd1b6 (current diff)
children 3d4a09dbaa17
files
diffstat 3 files changed, 46 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/sid/xmms-sid.c	Tue Sep 18 19:39:41 2007 -0500
+++ b/src/sid/xmms-sid.c	Wed Sep 19 05:48:38 2007 +0300
@@ -256,25 +256,6 @@
 /*
  * Check whether the given file is handled by this plugin
  */
-gint xs_is_our_file(gchar *pcFilename)
-{
-	gint result = 0;
-	t_xs_file *f;
-	assert(xs_status.sidPlayer);
-
-	/* Check the filename */
-	if (pcFilename == NULL)
-		return 0;
-
-	if ((f = xs_fopen(pcFilename, "rb")) != NULL) {
-		if (xs_status.sidPlayer->plrProbe(f))
-			result = 1;
-		xs_fclose(f);
-	}
-
-	return result;
-}
-
 static gchar * xs_has_tracknumber(gchar *pcFilename)
 {
 	gchar *tmpSep = xs_strrchr(pcFilename, '?');
@@ -302,21 +283,6 @@
 }
 
 
-gint xs_is_our_file_vfs(gchar *pcFilename, t_xs_file *f)
-{
-	assert(xs_status.sidPlayer);
-
-	/* Check the filename */
-	if (pcFilename == NULL)
-		return 0;
-	
-	if (xs_status.sidPlayer->plrProbe(f))
-		return 1;
-	else
-		return 0;
-}
-
-
 /*
  * Start playing the given file
  */
@@ -623,7 +589,8 @@
 }
 
 
-/* Return song information Tuple
+/*
+ * Return song information Tuple
  */
 void xs_get_song_tuple_info(Tuple *pResult, t_xs_tuneinfo *pInfo, gint subTune)
 {
@@ -684,15 +651,16 @@
 		tuple_associate_string(pResult, FIELD_FORMATTER, NULL, xs_cfg.titleFormat);
 }
 
+
 Tuple * xs_get_song_tuple(gchar *songFilename)
 {
 	Tuple *tmpResult;
 	gchar *tmpFilename;
 	t_xs_tuneinfo *tmpInfo;
-	gint subTune;
+	gint tmpTune;
 
 	/* Get information from URL */
-	xs_get_trackinfo(songFilename, &tmpFilename, &subTune);
+	xs_get_trackinfo(songFilename, &tmpFilename, &tmpTune);
 
 	tmpResult = tuple_new_from_filename(tmpFilename);
 	if (!tmpResult) {
@@ -709,18 +677,53 @@
 	if (!tmpInfo)
 		return tmpResult;
 	
-	xs_get_song_tuple_info(tmpResult, tmpInfo, subTune);
+	xs_get_song_tuple_info(tmpResult, tmpInfo, tmpTune);
 	xs_tuneinfo_free(tmpInfo);
 
 	return tmpResult;
 }
 
-Tuple *xs_probe_for_tuple(gchar *filename, t_xs_file *fd)
+
+Tuple *xs_probe_for_tuple(gchar *songFilename, t_xs_file *fd)
 {
-    if (!xs_is_our_file_vfs(filename, fd))
-        return NULL;
+	Tuple *tmpResult;
+	gchar *tmpFilename;
+	t_xs_tuneinfo *tmpInfo;
+	gint tmpTune;
+
+	assert(xs_status.sidPlayer);
+
+	if (songFilename == NULL)
+		return NULL;
+
+	XS_MUTEX_LOCK(xs_status);
+	if (!xs_status.sidPlayer->plrProbe(fd)) {
+		XS_MUTEX_UNLOCK(xs_status);
+		return NULL;
+	}
+	XS_MUTEX_UNLOCK(xs_status);
+
 
-    vfs_rewind(fd);
+	/* Get information from URL */
+	xs_get_trackinfo(songFilename, &tmpFilename, &tmpTune);
+
+	tmpResult = tuple_new_from_filename(tmpFilename);
+	if (!tmpResult) {
+		g_free(tmpFilename);
+		return NULL;
+	}
 
-    return xs_get_song_tuple(filename);
+	/* Get tune information from emulation engine */
+	XS_MUTEX_LOCK(xs_status);
+	tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename);
+	XS_MUTEX_UNLOCK(xs_status);
+	g_free(tmpFilename);
+
+	if (!tmpInfo)
+		return tmpResult;
+	
+	xs_get_song_tuple_info(tmpResult, tmpInfo, tmpTune);
+	xs_tuneinfo_free(tmpInfo);
+
+	return tmpResult;
 }
--- a/src/sid/xmms-sid.h	Tue Sep 18 19:39:41 2007 -0500
+++ b/src/sid/xmms-sid.h	Wed Sep 19 05:48:38 2007 +0300
@@ -170,8 +170,6 @@
 void	xs_init(void);
 void	xs_reinit(void);
 void	xs_close(void);
-gint	xs_is_our_file(gchar *);
-gint	xs_is_our_file_vfs(gchar *, t_xs_file *);
 void	xs_play_file(InputPlayback *);
 void	xs_stop(InputPlayback *);
 void	xs_pause(InputPlayback *, short);
--- a/src/sid/xs_init.c	Tue Sep 18 19:39:41 2007 -0500
+++ b/src/sid/xs_init.c	Wed Sep 19 05:48:38 2007 +0300
@@ -43,8 +43,6 @@
 	.file_info_box = xs_fileinfo,		/* Show file-information dialog */
 
 	.get_song_tuple = xs_get_song_tuple,		/* Get Tuple */
-	.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
 };