changeset 1746:b3decbd3051b

Cleanup the probing.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Sep 2007 05:16:22 +0300
parents 68312d3b39a8
children 29d0e4435e0e
files src/sid/xmms-sid.c src/sid/xmms-sid.h src/sid/xs_init.c
diffstat 3 files changed, 44 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/sid/xmms-sid.c	Wed Sep 19 03:10:54 2007 +0300
+++ b/src/sid/xmms-sid.c	Wed Sep 19 05:16:22 2007 +0300
@@ -283,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
  */
@@ -604,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)
 {
@@ -671,10 +657,10 @@
 	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) {
@@ -691,19 +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	Wed Sep 19 03:10:54 2007 +0300
+++ b/src/sid/xmms-sid.h	Wed Sep 19 05:16:22 2007 +0300
@@ -170,7 +170,6 @@
 void	xs_init(void);
 void	xs_reinit(void);
 void	xs_close(void);
-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	Wed Sep 19 03:10:54 2007 +0300
+++ b/src/sid/xs_init.c	Wed Sep 19 05:16:22 2007 +0300
@@ -43,7 +43,6 @@
 	.file_info_box = xs_fileinfo,		/* Show file-information dialog */
 
 	.get_song_tuple = xs_get_song_tuple,		/* Get Tuple */
-	.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
 };