# HG changeset patch # User William Pitcock # Date 1185228652 18000 # Node ID e0a2ea93f98fc724b2860e8a27eb2593e389eaa8 # Parent c9471f83944ccd02b9b98f59d4e02b177927eb2f New threading model for playback. Playback code should now *block*. diff -r c9471f83944c -r e0a2ea93f98f src/audacious/playback.c --- 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; }