diff src/musepack/libmpc.cxx @ 254:cdf9756d1528 trunk

[svn] Port to NewVFS file probe.
author chainsaw
date Sat, 18 Nov 2006 11:00:22 -0800
parents 6c78d6d3cdb7
children 4f7b72c88319
line wrap: on
line diff
--- a/src/musepack/libmpc.cxx	Sat Nov 18 10:02:24 2006 -0800
+++ b/src/musepack/libmpc.cxx	Sat Nov 18 11:00:22 2006 -0800
@@ -15,7 +15,7 @@
     mpcOpenPlugin,  //Open Plugin               [CALLBACK]
     mpcAboutBox,    //Show About box            [CALLBACK]
     mpcConfigBox,   //Show Configure box        [CALLBACK]
-    mpcIsOurFile,   //Check if it's our file    [CALLBACK]
+    NULL,           //Check if it's our file    [DEPRECATED]
     NULL,           //Scan the directory        [UNUSED]
     mpcPlay,        //Play                      [CALLBACK]
     mpcStop,        //Stop                      [CALLBACK]
@@ -33,7 +33,10 @@
     mpcGetSongInfo, //Get Title String callback [CALLBACK]
     mpcFileInfoBox, //Show File Info Box        [CALLBACK]
     NULL,           //Output Plugin Handle      OutputPlugin output
-    mpcGetSongTuple,
+    mpcGetSongTuple,//Acquire tuple for song    [CALLBACK]
+    NULL,
+    NULL,
+    mpcIsOurFD,
 };
 
 extern "C"
@@ -271,19 +274,13 @@
     gtk_widget_destroy (widgets.configBox);
 }
 
-static int mpcIsOurFile(char* p_Filename)
+static int mpcIsOurFD(char* p_Filename, VFSFile* file)
 {
-   VFSFile *file;
-   gchar magic[3];
-   if ((file = vfs_fopen(p_Filename, "rb"))) {
-       vfs_fread(magic, 1, 3, file);
-       if (!strncmp(magic, "MP+", 3)) {
-            vfs_fclose(file);
-            return 1;
-       }
-       vfs_fclose(file);
-   }
-   return 0;
+    gchar magic[3];
+    vfs_fread(magic, 1, 3, file);
+    if (!strncmp(magic, "MP+", 3))
+        return 1;
+    return 0;
 }
 
 static void mpcPlay(char* p_Filename)