Mercurial > audlegacy
comparison libaudcore/playback.c @ 356:99928e1275a1 trunk
[svn] This commit reduces the amount of times we probe a source down to ONE
SINGLE TIME, using the cache I created earlier to provide all the
information we need!
author | nenolod |
---|---|
date | Thu, 29 Dec 2005 22:44:13 -0800 |
parents | 72dcd30156ca |
children | 0a19db762240 |
comparison
equal
deleted
inserted
replaced
355:1c701dfe5098 | 356:99928e1275a1 |
---|---|
81 } | 81 } |
82 | 82 |
83 void | 83 void |
84 bmp_playback_initiate(void) | 84 bmp_playback_initiate(void) |
85 { | 85 { |
86 const gchar *filename = NULL; | 86 const PlaylistEntry *entry; |
87 | 87 |
88 if (playlist_get_length() == 0) | 88 if (playlist_get_length() == 0) |
89 return; | 89 return; |
90 | 90 |
91 if (bmp_playback_get_playing()) | 91 if (bmp_playback_get_playing()) |
94 vis_clear_data(mainwin_vis); | 94 vis_clear_data(mainwin_vis); |
95 vis_clear_data(playlistwin_vis); | 95 vis_clear_data(playlistwin_vis); |
96 svis_clear_data(mainwin_svis); | 96 svis_clear_data(mainwin_svis); |
97 mainwin_disable_seekbar(); | 97 mainwin_disable_seekbar(); |
98 | 98 |
99 filename = playlist_get_filename_to_play(); | 99 entry = playlist_get_entry_to_play(); |
100 | 100 |
101 if (!filename) | 101 if (!entry) |
102 return; | 102 return; |
103 | 103 |
104 if (!bmp_playback_play_file(filename)) | 104 if (!bmp_playback_play_file(entry)) |
105 return; | 105 return; |
106 | 106 |
107 if (bmp_playback_get_time() != -1) { | 107 if (bmp_playback_get_time() != -1) { |
108 equalizerwin_load_auto_preset(filename); | 108 equalizerwin_load_auto_preset(entry->filename); |
109 input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, | 109 input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, |
110 cfg.equalizer_bands); | 110 cfg.equalizer_bands); |
111 output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, | 111 output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, |
112 cfg.equalizer_bands); | 112 cfg.equalizer_bands); |
113 } | 113 } |
199 gtk_dialog_run(GTK_DIALOG(dialog)); | 199 gtk_dialog_run(GTK_DIALOG(dialog)); |
200 gtk_widget_destroy(dialog); | 200 gtk_widget_destroy(dialog); |
201 } | 201 } |
202 | 202 |
203 gboolean | 203 gboolean |
204 bmp_playback_play_file(const gchar * filename) | 204 bmp_playback_play_file(const PlaylistEntry *entry) |
205 { | 205 { |
206 GList *node; | 206 g_return_val_if_fail(entry != NULL, FALSE); |
207 InputPlugin *ip; | |
208 gchar *filename_proxy; | |
209 | |
210 g_return_val_if_fail(filename != NULL, FALSE); | |
211 | 207 |
212 if (!get_current_output_plugin()) { | 208 if (!get_current_output_plugin()) { |
213 run_no_output_plugin_dialog(); | 209 run_no_output_plugin_dialog(); |
214 mainwin_stop_pushed(); | 210 mainwin_stop_pushed(); |
215 return FALSE; | 211 return FALSE; |
216 } | 212 } |
217 | 213 |
218 if (cfg.random_skin_on_play) | 214 if (cfg.random_skin_on_play) |
219 bmp_playback_set_random_skin(); | 215 bmp_playback_set_random_skin(); |
220 | 216 |
221 filename_proxy = g_strdup(filename); | 217 if (!entry->decoder || !input_is_enabled(entry->decoder->filename)) |
222 | 218 { |
223 node = get_input_list(); | 219 input_file_not_playable(entry->filename); |
224 node = g_list_first(node); | 220 |
225 | 221 set_current_input_plugin(NULL); |
226 while (node) { | 222 mainwin_set_info_text(); |
227 | 223 |
228 ip = node->data; | 224 return FALSE; |
229 | 225 } |
230 if (!ip) | 226 |
231 break; | 227 set_current_input_plugin(entry->decoder); |
232 | 228 entry->decoder->output = get_current_output_plugin(); |
233 if (ip && input_is_enabled(ip->filename) && | 229 entry->decoder->play_file(entry->filename); |
234 ip->is_our_file(filename_proxy)) { | 230 |
235 | 231 ip_data.playing = TRUE; |
236 | 232 |
237 set_current_input_plugin(ip); | 233 return TRUE; |
238 ip->output = get_current_output_plugin(); | |
239 ip->play_file(filename_proxy); | |
240 | |
241 /* FIXME: Why the hell (yes,hell!) doesn't the input | |
242 plugin set this itself???? -mderezynski */ | |
243 ip_data.playing = TRUE; | |
244 | |
245 g_free(filename_proxy); | |
246 return TRUE; | |
247 } | |
248 node = g_list_next(node); | |
249 } | |
250 | |
251 input_file_not_playable(filename); | |
252 set_current_input_plugin(NULL); | |
253 mainwin_set_info_text(); | |
254 | |
255 g_free(filename_proxy); | |
256 | |
257 return FALSE; | |
258 } | 234 } |
259 | 235 |
260 gboolean | 236 gboolean |
261 bmp_playback_get_playing(void) | 237 bmp_playback_get_playing(void) |
262 { | 238 { |