From ab57025e33febd268c43c605b084a62c0ae86fa7 Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Fri, 7 Apr 2006 18:18:36 +0000 Subject: This makes seeking work for me git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9552 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'apps/playback.c') diff --git a/apps/playback.c b/apps/playback.c index cab7d35f08..4d8d9b0de7 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -94,7 +94,9 @@ enum { Q_AUDIO_STOP, Q_AUDIO_PAUSE, Q_AUDIO_SKIP, + Q_AUDIO_PRE_FF_REWIND, Q_AUDIO_FF_REWIND, + Q_AUDIO_SEEK_COMPLETE, Q_AUDIO_FLUSH_RELOAD, Q_AUDIO_CODEC_DONE, Q_AUDIO_FLUSH, @@ -684,15 +686,8 @@ off_t codec_mp3_get_filepos_callback(int newtime) void codec_seek_complete_callback(void) { - /* assume we're called from non-voice codec, as they shouldn't seek */ - if (pcm_is_paused()) { - /* If this is not a seamless seek, clear the buffer */ - pcmbuf_play_stop(); - /* If playback was not 'deliberately' paused, unpause now */ - if (!paused) - pcmbuf_pause(false); - } ci.seek_time = 0; + queue_post(&audio_queue, Q_AUDIO_SEEK_COMPLETE, 0); } bool codec_seek_buffer_callback(size_t newpos) @@ -1877,12 +1872,28 @@ void audio_thread(void) initiate_track_change((long)ev.data); break; + case Q_AUDIO_PRE_FF_REWIND: + if (!playing) + break; + pcmbuf_pause(true); + break; + case Q_AUDIO_FF_REWIND: if (!playing) break ; ci.seek_time = (long)ev.data+1; break ; + case Q_AUDIO_SEEK_COMPLETE: + if (pcm_is_paused()) { + /* If this is not a seamless seek, clear the buffer */ + pcmbuf_play_stop(); + /* If playback was not 'deliberately' paused, unpause now */ + if (!paused) + pcmbuf_pause(false); + } + break; + case Q_AUDIO_DIR_SKIP: logf("audio_dir_skip"); playlist_end = false; @@ -2237,7 +2248,7 @@ void audio_prev_dir(void) void audio_pre_ff_rewind(void) { logf("pre ff/rewind"); - pcmbuf_pause(true); + queue_post(&audio_queue, Q_AUDIO_PRE_FF_REWIND, 0); } void audio_ff_rewind(long newpos) -- cgit v1.2.3