changeset 3198:7628b2b7a688 trunk

Don't explicitly trust the mimetype, still do a probe.
author William Pitcock <nenolod@atheme-project.org>
date Wed, 01 Aug 2007 03:36:57 -0500
parents dcc92b58f06e
children 88b8338b8cf4
files src/audacious/input.c
diffstat 1 files changed, 48 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Fri Jul 27 19:44:14 2007 -0500
+++ b/src/audacious/input.c	Wed Aug 01 03:36:57 2007 -0500
@@ -412,13 +412,56 @@
     mimetype = vfs_get_metadata(fd, "content-type");
     if ((ip = mime_get_plugin(mimetype)) != NULL)
     {
-        g_free(filename_proxy);
-        vfs_fclose(fd);
+        if (!input_is_enabled(ip->filename))
+            break;
+
+        if (ip->probe_for_tuple != NULL)
+        {
+            TitleInput *tuple = ip->probe_for_tuple(filename_proxy, fd);
+
+            if (tuple != NULL)
+            {
+                g_free(filename_proxy);
+                vfs_fclose(fd);
+
+                pr = g_new0(ProbeResult, 1);
+                pr->ip = ip;
+                pr->tuple = tuple;
+                pr->tuple->mtime = input_get_mtime(filename_proxy);
+
+                return pr;
+            }
+        }
+        else if (fd && ip->is_our_file_from_vfs != NULL)
+        {
+            ret = ip->is_our_file_from_vfs(filename_proxy, fd);
 
-        pr = g_new0(ProbeResult, 1);
-        pr->ip = ip;
+            if (ret > 0)
+            {
+                g_free(filename_proxy);
+                vfs_fclose(fd);
+
+                pr = g_new0(ProbeResult, 1);
+                pr->ip = ip;
 
-        return pr;
+                return pr;
+            }
+        }
+        else if (ip->is_our_file != NULL)
+        {
+            ret = ip->is_our_file(filename_proxy);
+
+            if (ret > 0)
+            {
+                g_free(filename_proxy);
+                vfs_fclose(fd);
+
+                pr = g_new0(ProbeResult, 1);
+                pr->ip = ip;
+
+                return pr;
+            }
+        }
     }
 
     for (node = get_input_list(); node != NULL; node = g_list_next(node))