changeset 228:ef1967a3cd28 trunk

[svn] New-style VFS probe function. If you want an #ifdef feel free to bolt some on.
author chainsaw
date Mon, 06 Nov 2006 14:11:04 -0800
parents fd4cba2fe99b
children 5783d6281431
files ChangeLog src/sexypsf/xmms.c
diffstat 2 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 06 13:30:44 2006 -0800
+++ b/ChangeLog	Mon Nov 06 14:11:04 2006 -0800
@@ -1,3 +1,10 @@
+2006-11-06 21:30:44 +0000  Jonathan Schleifer <js@h3c.de>
+  revision [454]
+  Fixed missing header
+  trunk/src/mplayer/common.c |    1 +
+  1 file changed, 1 insertion(+)
+
+
 2006-11-05 21:14:06 +0000  William Pitcock <nenolod@nenolod.net>
   revision [452]
   - only penalize for bad frames on fixed streams
--- a/src/sexypsf/xmms.c	Mon Nov 06 13:30:44 2006 -0800
+++ b/src/sexypsf/xmms.c	Mon Nov 06 14:11:04 2006 -0800
@@ -52,8 +52,7 @@
          return &sexypsf_ip;
       }
 
-static int is_our_file(gchar *filename) {
-	VFSFile *file;
+static int is_our_fd(gchar *filename, VFSFile *file) {
 	gchar magic[4];
 	
 	// Filter out psflib [we use them, but we can't play them]
@@ -65,15 +64,12 @@
 		if (!strcasecmp(tmps, teststr))
 		return 0;
 	}
-	if ((file = vfs_fopen(filename,"rb"))) {
-		vfs_fread(magic,1,4,file);
-		//Only allow PSF1 for now.
-		if (!strncmp(magic,"PSF\x01",4)) {
-			vfs_fclose(file);
-			return 1;
-		}
-		vfs_fclose(file);
-	}
+	if (vfs_ftell(file) != 0)
+		vfs_fseek(file, 0, SEEK_SET);
+	vfs_fread(magic,1,4,file);
+	//Only allow PSF1 for now.
+	if (!strncmp(magic,"PSF\x01",4))
+		return 1;
 	return 0;
 }
 
@@ -270,7 +266,7 @@
 	0,
 	0,
 	0,
-	is_our_file,
+	0,
 	0,
 	sexypsf_xmms_play,
 	sexypsf_xmms_stop,
@@ -288,5 +284,8 @@
 	sexypsf_xmms_getsonginfo,
 	0,
 	0,
-	get_tuple_psf
+	get_tuple_psf,
+	0,
+	0,
+	is_our_fd,
 };