diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-08-16 14:41:47 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-08-16 14:41:47 +0000 |
commit | 6224cdb16677cae7b65b0598eec3381a6fb6a4aa (patch) | |
tree | 9ad9b39557492606c853e7f14c359bca5e0a3b65 /apps/wps.c | |
parent | 085e77467565aba251c31721e92bc7ebd7baa61f (diff) | |
download | rockbox-6224cdb16677cae7b65b0598eec3381a6fb6a4aa.tar.gz rockbox-6224cdb16677cae7b65b0598eec3381a6fb6a4aa.zip |
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
Diffstat (limited to 'apps/wps.c')
-rw-r--r-- | apps/wps.c | 22 |
1 files changed, 18 insertions, 4 deletions
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 @@ | |||
34 | #include "powermgmt.h" | 34 | #include "powermgmt.h" |
35 | #include "status.h" | 35 | #include "status.h" |
36 | #include "main_menu.h" | 36 | #include "main_menu.h" |
37 | #include "ata.h" | ||
37 | #ifdef HAVE_LCD_BITMAP | 38 | #ifdef HAVE_LCD_BITMAP |
38 | #include "icons.h" | 39 | #include "icons.h" |
39 | #include "widgets.h" | 40 | #include "widgets.h" |
@@ -462,6 +463,13 @@ int wps_show(void) | |||
462 | { | 463 | { |
463 | mpeg_pause(); | 464 | mpeg_pause(); |
464 | status_set_playmode(STATUS_PAUSE); | 465 | status_set_playmode(STATUS_PAUSE); |
466 | if (global_settings.resume) { | ||
467 | status_draw(); | ||
468 | settings_save(); | ||
469 | #ifndef HAVE_RTC | ||
470 | ata_flush(); | ||
471 | #endif | ||
472 | } | ||
465 | } | 473 | } |
466 | else | 474 | else |
467 | { | 475 | { |
@@ -577,7 +585,6 @@ int wps_show(void) | |||
577 | mpeg_ff_rewind(ff_rewind_count); | 585 | mpeg_ff_rewind(ff_rewind_count); |
578 | ff_rewind_count = 0; | 586 | ff_rewind_count = 0; |
579 | ff_rewind = false; | 587 | ff_rewind = false; |
580 | status_set_playmode(STATUS_PLAY); | ||
581 | #ifdef HAVE_LCD_CHARCELLS | 588 | #ifdef HAVE_LCD_CHARCELLS |
582 | draw_screen(id3); | 589 | draw_screen(id3); |
583 | #endif | 590 | #endif |
@@ -589,7 +596,6 @@ int wps_show(void) | |||
589 | #endif | 596 | #endif |
590 | { | 597 | { |
591 | mpeg_prev(); | 598 | mpeg_prev(); |
592 | status_set_playmode(STATUS_PLAY); | ||
593 | } | 599 | } |
594 | } | 600 | } |
595 | #ifdef HAVE_PLAYER_KEYPAD | 601 | #ifdef HAVE_PLAYER_KEYPAD |
@@ -612,7 +618,6 @@ int wps_show(void) | |||
612 | mpeg_ff_rewind(ff_rewind_count); | 618 | mpeg_ff_rewind(ff_rewind_count); |
613 | ff_rewind_count = 0; | 619 | ff_rewind_count = 0; |
614 | ff_rewind = false; | 620 | ff_rewind = false; |
615 | status_set_playmode(STATUS_PLAY); | ||
616 | #ifdef HAVE_LCD_CHARCELLS | 621 | #ifdef HAVE_LCD_CHARCELLS |
617 | draw_screen(id3); | 622 | draw_screen(id3); |
618 | #endif | 623 | #endif |
@@ -624,7 +629,6 @@ int wps_show(void) | |||
624 | #endif | 629 | #endif |
625 | { | 630 | { |
626 | mpeg_next(); | 631 | mpeg_next(); |
627 | status_set_playmode(STATUS_PLAY); | ||
628 | } | 632 | } |
629 | } | 633 | } |
630 | #ifdef HAVE_PLAYER_KEYPAD | 634 | #ifdef HAVE_PLAYER_KEYPAD |
@@ -862,6 +866,16 @@ int wps_show(void) | |||
862 | if (mpeg_is_playing() && id3) | 866 | if (mpeg_is_playing() && id3) |
863 | display_file_time(id3->elapsed, id3->length); | 867 | display_file_time(id3->elapsed, id3->length); |
864 | 868 | ||
869 | /* save resume data */ | ||
870 | if ( id3 && | ||
871 | global_settings.resume && | ||
872 | global_settings.resume_offset != id3->offset ) { | ||
873 | DEBUGF("R%X,%X (%X)\n",global_settings.resume_offset,id3->offset,id3); | ||
874 | global_settings.resume_index = id3->index; | ||
875 | global_settings.resume_offset = id3->offset; | ||
876 | settings_save(); | ||
877 | } | ||
878 | |||
865 | status_draw(); | 879 | status_draw(); |
866 | break; | 880 | break; |
867 | } | 881 | } |