From 2724d0bb55298d5a3a66914bfd8d5b449090fc83 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 1 Jul 2005 21:00:02 +0000 Subject: [PATCH] Pause correctly while seeking. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6975 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index c133e46bee..70cb36341b 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -470,6 +470,12 @@ static bool rebuffer_and_seek(int newpos) mutex_unlock(&mutex_bufferfill); + while (cur_ti->available == 0 && cur_ti->filerem > 0) { + yield(); + if (ci.stop_codec) + return false; + } + return true; } @@ -1415,10 +1421,21 @@ void audio_prev(void) void audio_ff_rewind(int newpos) { + int counter; + logf("rewind: %d", newpos); - /* Does not work yet. */ - if (playing) + /* Keep playback paused until seek is complete. */ + if (playing) { ci.seek_time = newpos+1; + counter = 30; + pcm_flush_audio(); + while (ci.seek_time) { + sleep(10); + if (counter-- == 0) + break ; + } + pcm_play_stop(); + } } void audio_flush_and_reload_tracks(void)