Mercurial > audlegacy
changeset 3153:e0a2ea93f98f trunk
New threading model for playback. Playback code should now *block*.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Mon, 23 Jul 2007 17:10:52 -0500 |
parents | c9471f83944c |
children | 732cfad87116 |
files | src/audacious/playback.c |
diffstat | 1 files changed, 24 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/playback.c Mon Jul 23 16:42:30 2007 -0500 +++ b/src/audacious/playback.c Mon Jul 23 17:10:52 2007 -0500 @@ -226,10 +226,32 @@ gtk_widget_destroy(dialog); } +static gpointer +playback_monitor_thread(gpointer *data) +{ + PlaylistEntry *entry; + InputPlayback *playback; + + playback = g_new0(InputPlayback, 1); + + entry->decoder->output = &psuedo_output_plugin; + + playback->plugin = entry->decoder; + playback->output = &psuedo_output_plugin; + playback->filename = g_strdup(entry->filename); + + set_current_input_playback(playback); + + entry->decoder->play_file(playback); + + playback_eof(); + + return NULL; +} + gboolean playback_play_file(PlaylistEntry *entry) { - InputPlayback *playback; g_return_val_if_fail(entry != NULL, FALSE); if (!get_current_output_plugin()) { @@ -262,19 +284,8 @@ return FALSE; } - playback = g_new0(InputPlayback, 1); - - entry->decoder->output = &psuedo_output_plugin; - - playback->plugin = entry->decoder; - playback->output = &psuedo_output_plugin; - playback->filename = g_strdup(entry->filename); - - set_current_input_playback(playback); - - entry->decoder->play_file(playback); - ip_data.playing = TRUE; + g_thread_create(playback_monitor_thread, entry, TRUE, NULL); return TRUE; }