Mercurial > audlegacy
diff src/audacious/input.c @ 3127:c92070f10148 trunk
Use ProbeResult (try 1)
| author | William Pitcock <nenolod@atheme-project.org> |
|---|---|
| date | Fri, 20 Jul 2007 19:37:11 -0500 |
| parents | f1c756f39e6c |
| children | 343504d43afc |
line wrap: on
line diff
--- a/src/audacious/input.c Fri Jul 20 18:55:15 2007 -0500 +++ b/src/audacious/input.c Fri Jul 20 19:37:11 2007 -0500 @@ -324,8 +324,12 @@ * Adapted to use the mimetype system. * * --nenolod, Jul 9 2007 + * + * Adapted to return ProbeResult structure. + * + * --nenolod, Jul 20 2007 */ -InputPlugin * +ProbeResult * input_check_file(const gchar * filename, gboolean show_warning) { VFSFile *fd; @@ -336,6 +340,7 @@ gchar *ext, *tmp, *tmp_uri; gboolean use_ext_filter; gchar *mimetype; + ProbeResult *pr = NULL; filename_proxy = g_strdup(filename); @@ -399,7 +404,23 @@ continue; } - if (fd && ip->is_our_file_from_vfs != NULL) + if (fd && 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; + + return pr; + } + } + else if (fd && ip->is_our_file_from_vfs != NULL) { ret = ip->is_our_file_from_vfs(filename_proxy, fd); @@ -407,7 +428,11 @@ { g_free(filename_proxy); vfs_fclose(fd); - return ip; + + pr = g_new0(ProbeResult, 1); + pr->ip = ip; + + return pr; } } else if (ip->is_our_file != NULL) @@ -418,7 +443,11 @@ { g_free(filename_proxy); vfs_fclose(fd); - return ip; + + pr = g_new0(ProbeResult, 1); + pr->ip = ip; + + return pr; } } @@ -454,6 +483,7 @@ BmpTitleInput *input; gchar *tmp = NULL, *ext; gchar *filename_proxy; + ProbeResult *pr; g_return_if_fail(filename != NULL); g_return_if_fail(title != NULL); @@ -461,7 +491,14 @@ filename_proxy = g_strdup(filename); - ip = input_check_file(filename_proxy, FALSE); + pr = input_check_file(filename_proxy, FALSE); + + if (!pr) + return; + + ip = pr->ip; + + g_free(pr); if (ip && ip->get_song_info) { ip->get_song_info(filename_proxy, &tmp, length); @@ -503,13 +540,21 @@ TitleInput *input; gchar *ext = NULL; gchar *filename_proxy; + ProbeResult *pr; if (filename == NULL) return NULL; filename_proxy = g_strdup(filename); - ip = input_check_file(filename_proxy, FALSE); + pr = input_check_file(filename_proxy, FALSE); + + if (!pr) + return; + + ip = pr->ip; + + g_free(pr); if (ip && ip->get_song_tuple) input = ip->get_song_tuple(filename_proxy); @@ -613,10 +658,18 @@ { InputPlugin *ip; gchar *filename_proxy; + ProbeResult *pr; filename_proxy = g_strdup(filename); - ip = input_check_file(filename_proxy, FALSE); + pr = input_check_file(filename_proxy, FALSE); + + if (!pr) + return; + + ip = pr->ip; + + g_free(pr); if (ip->file_info_box) ip->file_info_box(filename_proxy);
