changeset 3013:a5f606b01038 trunk

Use mimetype system to accelerate detection of network streams.
author William Pitcock <nenolod@atheme-project.org>
date Mon, 09 Jul 2007 05:13:41 -0500
parents 2897d744d87a
children 034d16dfdd44
files src/audacious/input.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Mon Jul 09 03:18:40 2007 -0500
+++ b/src/audacious/input.c	Mon Jul 09 05:13:41 2007 -0500
@@ -317,6 +317,10 @@
  * Adapted to use the NewVFS extension probing system if enabled.
  *
  * --nenolod, Dec 12 2006
+ *
+ * Adapted to use the mimetype system.
+ *
+ * --nenolod, Jul  9 2007
  */
 InputPlugin *
 input_check_file(const gchar * filename, gboolean show_warning)
@@ -328,6 +332,7 @@
     gint ret = 1;
     gchar *ext, *tmp, *tmp_uri;
     gboolean use_ext_filter;
+    gchar *mimetype;
 
     filename_proxy = g_strdup(filename);
 
@@ -348,6 +353,14 @@
         (fd != NULL && (!g_strncasecmp(filename, "/", 1) ||
                         !g_strncasecmp(filename, "file://", 7))) ? TRUE : FALSE;
 
+    mimetype = vfs_get_metadata(fd, "content-type");
+    if ((ip = mime_get_plugin(mimetype)) != NULL)
+    {
+        g_free(filename_proxy);
+        vfs_fclose(fd);
+        return ip;
+    }
+
     for (node = get_input_list(); node != NULL; node = g_list_next(node))
     {
         ip = INPUT_PLUGIN(node->data);