From 6224cdb16677cae7b65b0598eec3381a6fb6a4aa Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 16 Aug 2002 14:41:47 +0000 Subject: Added resume. Works in dirs and playlists, shuffled or not. Resumes mid-song, but press pause on players before you shutdown so they get a chance to store the position on disk. Recorders use RTC ram. Todo: Time display is wrong after mid-track resume and ffd/rew is not handled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1787 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'apps/wps.c') diff --git a/apps/wps.c b/apps/wps.c index 240bc96f07..5b30d2ba0e 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -34,6 +34,7 @@ #include "powermgmt.h" #include "status.h" #include "main_menu.h" +#include "ata.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" #include "widgets.h" @@ -462,6 +463,13 @@ int wps_show(void) { mpeg_pause(); status_set_playmode(STATUS_PAUSE); + if (global_settings.resume) { + status_draw(); + settings_save(); +#ifndef HAVE_RTC + ata_flush(); +#endif + } } else { @@ -577,7 +585,6 @@ int wps_show(void) mpeg_ff_rewind(ff_rewind_count); ff_rewind_count = 0; ff_rewind = false; - status_set_playmode(STATUS_PLAY); #ifdef HAVE_LCD_CHARCELLS draw_screen(id3); #endif @@ -589,7 +596,6 @@ int wps_show(void) #endif { mpeg_prev(); - status_set_playmode(STATUS_PLAY); } } #ifdef HAVE_PLAYER_KEYPAD @@ -612,7 +618,6 @@ int wps_show(void) mpeg_ff_rewind(ff_rewind_count); ff_rewind_count = 0; ff_rewind = false; - status_set_playmode(STATUS_PLAY); #ifdef HAVE_LCD_CHARCELLS draw_screen(id3); #endif @@ -624,7 +629,6 @@ int wps_show(void) #endif { mpeg_next(); - status_set_playmode(STATUS_PLAY); } } #ifdef HAVE_PLAYER_KEYPAD @@ -862,6 +866,16 @@ int wps_show(void) if (mpeg_is_playing() && id3) display_file_time(id3->elapsed, id3->length); + /* save resume data */ + if ( id3 && + global_settings.resume && + global_settings.resume_offset != id3->offset ) { + DEBUGF("R%X,%X (%X)\n",global_settings.resume_offset,id3->offset,id3); + global_settings.resume_index = id3->index; + global_settings.resume_offset = id3->offset; + settings_save(); + } + status_draw(); break; } -- cgit v1.2.3