# HG changeset patch # User nenolod # Date 1165307498 28800 # Node ID 409df027cc317fef7359d4e5c275884f0ae6ae99 # Parent a7fd7f5f8333f63b87940b32170538515f45f378 [svn] - rewrite input_check_file() - make similar functions use input_check_file() instead of probing by hand diff -r a7fd7f5f8333 -r 409df027cc31 ChangeLog --- a/ChangeLog Mon Dec 04 19:43:36 2006 -0800 +++ b/ChangeLog Tue Dec 05 00:31:38 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-05 03:43:36 +0000 William Pitcock + revision [3125] + - mainwinEjectY's default value should be 89, not 88. + + trunk/audacious/widgets/skin.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2006-12-05 03:24:14 +0000 William Pitcock revision [3123] - finish documenting the libaudacious API diff -r a7fd7f5f8333 -r 409df027cc31 audacious/input.c --- a/audacious/input.c Mon Dec 04 19:43:36 2006 -0800 +++ b/audacious/input.c Tue Dec 05 00:31:38 2006 -0800 @@ -399,6 +399,10 @@ * -- this can have very ugly effects performance wise on streams * * --nenolod, Dec 31 2005 + * + * Rewritten to use NewVFS probing, semantics are still basically the same. + * + * --nenolod, Dec 5 2006 */ InputPlugin * input_check_file(const gchar * filename, gboolean show_warning) @@ -412,28 +416,46 @@ filename_proxy = g_strdup(filename); fd = vfs_fopen(filename, "rb"); - for (node = get_input_list(); node != NULL; node = g_list_next(node)) { + for (node = get_input_list(); node != NULL; node = g_list_next(node)) + { ip = INPUT_PLUGIN(node->data); - if (ip && input_is_enabled(ip->filename) && - (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; + + if (!ip || !input_is_enabled(ip->filename)) + continue; + + vfs_fseek(fd, 0, SEEK_SET); + + if (ip->is_our_file_from_vfs != NULL) + { + ret = ip->is_our_file_from_vfs(filename_proxy, fd); + + if (ret > 0) + { + g_free(filename_proxy); + vfs_fclose(fd); + return ip; + } } - else if (ret == 0) - vfs_fseek(fd, 0, SEEK_SET); - else if (ret <= -1) + else if (ip->is_our_file != NULL) + { + ret = ip->is_our_file(filename_proxy); + + if (ret > 0) + { + g_free(filename_proxy); + vfs_fclose(fd); + return ip; + } + } + + if (ret <= -1) break; } g_free(filename_proxy); - if (show_warning && !(ret <= -1)) { + if (show_warning && ret != -1) input_file_not_playable(filename); - } vfs_fclose(fd); @@ -462,28 +484,14 @@ GList *node; gchar *tmp = NULL, *ext; gchar *filename_proxy; - VFSFile *fd; - gint ret = 1; g_return_if_fail(filename != NULL); g_return_if_fail(title != NULL); g_return_if_fail(length != NULL); 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) && - (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))) { - break; - } - } - - vfs_fclose(fd); + ip = input_check_file(filename_proxy, FALSE); if (ip && node && ip->get_song_info) { ip->get_song_info(filename_proxy, &tmp, length); @@ -526,28 +534,13 @@ GList *node; gchar *tmp = NULL, *ext; gchar *filename_proxy; - VFSFile *fd; - gint ret = 1; if (filename == NULL) return NULL; 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) && - (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); - break; - } - } - - vfs_fclose(fd); + ip = input_check_file(filename_proxy, FALSE); if (ip && node && ip->get_song_tuple) input = ip->get_song_tuple(filename_proxy); @@ -649,32 +642,16 @@ GList *node; InputPlugin *ip; gchar *filename_proxy; - VFSFile *fd; - gint ret = 1; filename_proxy = g_strdup(filename); - fd = vfs_fopen(filename, "rb"); + ip = input_check_file(filename_proxy, FALSE); - for (node = get_input_list(); node != NULL; node = g_list_next(node)) { - ip = INPUT_PLUGIN(node->data); - if (ip && input_is_enabled(ip->filename) && - (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))) { - if (ip->file_info_box) - ip->file_info_box(filename_proxy); - else - input_general_file_info_box(filename, ip); + if (ip->file_info_box) + ip->file_info_box(filename_proxy); + else + input_general_file_info_box(filename, ip); - vfs_fclose(fd); - g_free(filename_proxy); - return; - } - } - - vfs_fclose(fd); input_general_file_info_box(filename, NULL); g_free(filename_proxy); }