Mercurial > audlegacy
diff src/audacious/playback.c @ 3696:418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
Add suggestions on how to improve produce_audio() API.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 06 Oct 2007 20:35:52 -0500 |
parents | 30ef1287da19 |
children | 38259e9394a2 |
line wrap: on
line diff
--- a/src/audacious/playback.c Sat Oct 06 16:36:47 2007 -0500 +++ b/src/audacious/playback.c Sat Oct 06 20:35:52 2007 -0500 @@ -94,6 +94,14 @@ return 0; } +static void +playback_set_pb_change(InputPlayback *playback) +{ + g_mutex_lock(playback->pb_change_mutex); + g_cond_signal(playback->pb_change_cond); + g_mutex_unlock(playback->pb_change_mutex); +} + void playback_eof(void) { @@ -245,6 +253,11 @@ ip_data.playing = FALSE; + /* TODO: i'm unsure if this will work. we might have to + signal the change in stop() (e.g. in the plugins + directly.) --nenolod */ + playback->set_pb_change(playback); + if (playback->plugin->stop) playback->plugin->stop(playback); @@ -368,7 +381,13 @@ playback->pb_ready_mutex = g_mutex_new(); playback->pb_ready_cond = g_cond_new(); playback->pb_ready_val = 0; + + playback->pb_change_mutex = g_mutex_new(); + playback->pb_change_cond = g_cond_new(); + + /* init vtable functors */ playback->set_pb_ready = playback_set_pb_ready; + playback->set_pb_change = playback_set_pb_change; set_current_input_playback(playback); @@ -415,6 +434,7 @@ } playback->plugin->seek(playback, time); + playback->set_pb_change(playback); free_vis_data(); if (restore_pause)