diff audacious/input.c @ 1951:c2a63f41d8c6 trunk

[svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take advantage of this. Non VFS-aware plugins (such as FLAC) won't be able to yet. To take advantage, just modify your probing function as described in plugin.h. - __AUDACIOUS_NEWVFS__ is defined to designate availability of this new probing layer.
author nenolod
date Sun, 05 Nov 2006 18:36:26 -0800
parents c186ee9524ed
children b067ca382dd0
line wrap: on
line diff
--- a/audacious/input.c	Sun Nov 05 18:00:14 2006 -0800
+++ b/audacious/input.c	Sun Nov 05 18:36:26 2006 -0800
@@ -1,4 +1,7 @@
-/*  BMP - Cross-platform multimedia player
+/*  Audacious
+ *  Copyright (C) 2005-2006  Audacious development team.
+ *
+ *  BMP - Cross-platform multimedia player
  *  Copyright (C) 2003-2004  BMP development team.
  *
  *  Based on XMMS:
@@ -401,18 +404,24 @@
 InputPlugin *
 input_check_file(const gchar * filename, gboolean show_warning)
 {
+    VFSFile *fd;
     GList *node;
     InputPlugin *ip;
     gchar *filename_proxy;
     gint ret = 1;
 
     filename_proxy = g_strdup(filename);
+    fd = vfs_fopen(filename, "rb");
 
     for (node = get_input_list(); node != NULL; node = g_list_next(node)) {
         ip = INPUT_PLUGIN(node->data);
         if (ip && input_is_enabled(ip->filename) &&
-            (ret = ip->is_our_file(filename_proxy)) > 0) {
+            (ip->is_our_file_from_vfs != NULL &&
+             (ret = ip->is_our_file_from_vfs(filename_proxy, fd) > 0) || 
+             (ip->is_our_file != NULL &&
+              (ret = ip->is_our_file(filename_proxy)) > 0))) {
             g_free(filename_proxy);
+            vfs_fclose(fd);
             return ip;
         }
 	else if (ret <= -1)
@@ -425,6 +434,8 @@
         input_file_not_playable(filename);
     }
 
+    vfs_fclose(fd);
+
     return NULL;
 }