Mercurial > audlegacy
diff src/audacious/playlist.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/playlist.c Fri Jul 20 18:55:15 2007 -0500 +++ b/src/audacious/playlist.c Fri Jul 20 19:37:11 2007 -0500 @@ -189,6 +189,7 @@ playlist_entry_get_info(PlaylistEntry * entry) { TitleInput *tuple; + ProbeResult *pr = NULL; time_t modtime; g_return_val_if_fail(entry != NULL, FALSE); @@ -206,7 +207,10 @@ } if (entry->decoder == NULL) - entry->decoder = input_check_file(entry->filename, FALSE); + { + pr = input_check_file(entry->filename, FALSE); + entry->decoder = pr->ip; + } /* renew tuple if file mtime is newer than tuple mtime. */ if(entry->tuple){ @@ -218,9 +222,9 @@ } } - if (entry->decoder == NULL || entry->decoder->get_song_tuple == NULL) - tuple = input_get_song_tuple(entry->filename); - else + if (pr != NULL && pr->tuple != NULL) + tuple = pr->tuple; + else if (entry->decoder != NULL && entry->decoder->get_song_tuple != NULL) tuple = entry->decoder->get_song_tuple(entry->filename); if (tuple == NULL) @@ -234,6 +238,8 @@ entry->length = tuple->length; entry->tuple = tuple; + g_free(pr); + return TRUE; } @@ -698,7 +704,9 @@ gchar buf[64], *p; gint r; VFSFile *file; + ProbeResult *pr = NULL; InputPlugin *dec = NULL; + TitleInput *tuple = NULL; g_return_val_if_fail(playlist != NULL, FALSE); g_return_val_if_fail(filename != NULL, FALSE); @@ -714,11 +722,21 @@ dec = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, TRUE); + { + pr = input_check_file(filename, TRUE); + + if (pr) + { + dec = pr->ip; + tuple = pr->tuple; + } + + g_free(pr); + } if (cfg.playlist_detect == TRUE || playlist->loading_playlist == TRUE || (playlist->loading_playlist == FALSE && dec != NULL) || (playlist->loading_playlist == FALSE && !is_playlist_name(filename) && str_has_prefix_nocase(filename, "http"))) { - __playlist_ins(playlist, filename, pos, dec); + __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, dec); playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); return TRUE; @@ -822,6 +840,7 @@ GDir *dir; GList *list = NULL, *ilist; const gchar *dir_entry; + ProbeResult *pr = NULL; struct stat statbuf; DeviceInode *devino; @@ -878,8 +897,13 @@ } else if (cfg.playlist_detect == TRUE) list = g_list_prepend(list, filename); - else if (input_check_file(filename, TRUE)) + else if ((pr = input_check_file(filename, TRUE)) != NULL) + { list = g_list_prepend(list, filename); + + g_free(pr); + pr = NULL; + } else g_free(filename); @@ -1599,7 +1623,7 @@ { gchar *filename; gchar *tmp, *path; - InputPlugin *dec = NULL; /* for decoder cache */ + ProbeResult *pr = NULL; g_return_if_fail(filename_p != NULL); g_return_if_fail(playlist != NULL); @@ -1618,36 +1642,41 @@ else { if ((playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, FALSE); - - __playlist_ins_with_info(playlist, filename, pos, title, len, dec); + pr = input_check_file(filename, FALSE); + + __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL); + + g_free(pr); return; } tmp = g_build_filename(path, filename, NULL); if (playlist->loading_playlist == TRUE && cfg.playlist_detect == TRUE) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(tmp, "http://") && !str_has_prefix_nocase(tmp, "https://")) - dec = input_check_file(tmp, FALSE); - - __playlist_ins_with_info(playlist, tmp, pos, title, len, dec); + pr = input_check_file(tmp, FALSE); + + __playlist_ins_with_info(playlist, tmp, pos, title, len, dec, pr ? pr->ip : NULL); g_free(tmp); g_free(path); + g_free(pr); } else { if ((playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, FALSE); - - __playlist_ins_with_info(playlist, filename, pos, title, len, dec); + pr = input_check_file(filename, FALSE); + + __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL); + + g_free(pr); } g_free(filename); @@ -1662,7 +1691,7 @@ { gchar *filename; gchar *tmp, *path; - InputPlugin *dec = NULL; /* for decoder cache */ + ProbeResult *pr = NULL; /* for decoder cache */ g_return_if_fail(filename_p != NULL); g_return_if_fail(playlist_name != NULL); @@ -1681,37 +1710,41 @@ else { if ((playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, FALSE); - - __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, dec); + pr = input_check_file(filename, FALSE); + + __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL); + + g_free(pr); return; } tmp = g_build_filename(path, filename, NULL); if ((playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, FALSE); - - __playlist_ins_with_info_tuple(playlist, tmp, pos, tuple, dec); + pr = input_check_file(filename, FALSE); + + __playlist_ins_with_info_tuple(playlist, tmp, pos, tuple, pr ? pr->ip : NULL); g_free(tmp); g_free(path); + g_free(pr); } else { if ((playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)) - dec = NULL; + pr = NULL; else if (!str_has_prefix_nocase(filename, "http://") && !str_has_prefix_nocase(filename, "https://")) - dec = input_check_file(filename, FALSE); - - __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, dec); + pr = input_check_file(filename, FALSE); + + __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL); + g_free(pr); } g_free(filename); @@ -2347,6 +2380,7 @@ GList *node; PlaylistEntry *entry = NULL; TitleInput *tuple = NULL; + ProbeResult *pr = NULL; PLAYLIST_LOCK(playlist->mutex); @@ -2370,7 +2404,12 @@ if (tuple != NULL) { if (entry->decoder == NULL) - entry->decoder = input_check_file(entry->filename, FALSE); /* try to find a decoder */ + { + pr = input_check_file(entry->filename, FALSE); /* try to find a decoder */ + entry->decoder = pr ? pr->ip : NULL; + + g_free(pr); + } if (entry->decoder != NULL && entry->decoder->file_info_box == NULL) fileinfo_show_for_tuple(tuple);