diff src/audacious/input.c @ 3979:67f01143e613

improve on-demand probing: - playlist which contains subtunes is loaded properly. - custom uri is handled properly. - playlist_load_ins_file_tuple() has been rewritten. (necessary to subtune fix.) - playlist_load_ins_file() became wrapper function of playlist_load_ins_file_tuple(). - __playlist_ins_with_info() has been removed.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Wed, 21 Nov 2007 00:46:54 +0900
parents 81b4e186765f
children 76da6fe8cb39
line wrap: on
line diff
--- a/src/audacious/input.c	Mon Nov 19 23:22:21 2007 +0100
+++ b/src/audacious/input.c	Wed Nov 21 00:46:54 2007 +0900
@@ -321,6 +321,7 @@
 
     /* some input plugins provide probe_for_tuple() only. */
     if ( (ip->probe_for_tuple && !ip->is_our_file_from_vfs && !ip->is_our_file) ||
+         (ip->probe_for_tuple && ip->have_subtune == TRUE) ||
          (ip->probe_for_tuple && (cfg.use_pl_metadata && (!loading || (loading && cfg.get_info_on_load)))) ) {
 
         Tuple *tuple = ip->probe_for_tuple(filename_proxy, fd);
@@ -418,27 +419,24 @@
     GList **list_hdr = NULL;
     extern GHashTable *ext_hash;
 
-    filename_proxy = g_strdup(filename);
-
-
     /* Some URIs will end in ?<subsong> to determine the subsong requested. */
     tmp_uri = g_strdup(filename);
     tmp = strrchr(tmp_uri, '?');
 
-    if (tmp != NULL && g_ascii_isdigit(*(tmp + 1)))
+    if (tmp && g_ascii_isdigit(*(tmp + 1)))
         *tmp = '\0';
 
+    filename_proxy = g_strdup(tmp_uri);
+    g_free(tmp_uri);
 
     /* Check for plugins with custom URI:// strings */
     /* cue:// cdda:// tone:// tact:// */
-    if ((ip = uri_get_plugin(filename)) != NULL && ip->enabled)
-    {
+    if ((ip = uri_get_plugin(filename_proxy)) != NULL && ip->enabled) {
         if (ip->is_our_file != NULL)
             ret = ip->is_our_file(filename_proxy);
         else
             ret = 0;
-        if (ret > 0)
-        {
+        if (ret > 0) {
             g_free(filename_proxy);
             pr = g_new0(ProbeResult, 1);
             pr->ip = ip;
@@ -450,8 +448,7 @@
 
 
     // open the file with vfs sub-system
-    fd = vfs_buffered_file_new_from_uri(tmp_uri);
-    g_free(tmp_uri);
+    fd = vfs_buffered_file_new_from_uri(filename_proxy);
 
     if (!fd) {
         printf("Unable to read from %s, giving up.\n", filename_proxy);
@@ -481,8 +478,8 @@
     // apply ext_hash check
     if(cfg.use_extension_probing) {
         use_ext_filter =
-            (fd != NULL && (!g_strncasecmp(filename, "/", 1) ||
-                            !g_strncasecmp(filename, "file://", 7))) ? TRUE : FALSE;
+            (fd && (!g_strncasecmp(filename_proxy, "/", 1) ||
+                    !g_strncasecmp(filename_proxy, "file://", 7))) ? TRUE : FALSE;
     }
 
     if(use_ext_filter) {