summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2005-07-04 22:50:57 +0000
committerHardeep Sidhu <dyp@pobox.com>2005-07-04 22:50:57 +0000
commit839dbcaed7ea135dcc0812de76f9ff5c1dc924f5 (patch)
tree2a9ea28b5da29ff2749f0b4bb3be059eafc98fa4 /firmware/mpeg.c
parent3fd775b7d15c9c5133c68ba45caf8bfc78cadfa1 (diff)
downloadrockbox-839dbcaed7ea135dcc0812de76f9ff5c1dc924f5.tar.gz
rockbox-839dbcaed7ea135dcc0812de76f9ff5c1dc924f5.zip
Moved resume info updating to the mpeg/playback threads so that it's saved even when not in the WPS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7018 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 9e61e02e00..db8994c3bc 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -92,7 +92,7 @@ extern char* playlist_peek(int steps);
92extern bool playlist_check(int steps); 92extern bool playlist_check(int steps);
93extern int playlist_next(int steps); 93extern int playlist_next(int steps);
94extern int playlist_amount(void); 94extern int playlist_amount(void);
95extern void update_file_pos( int id, int pos ); 95extern int playlist_update_resume_info(const struct mp3entry* id3);
96 96
97/* list of tracks in memory */ 97/* list of tracks in memory */
98#define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */ 98#define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */
@@ -872,6 +872,8 @@ static void update_playlist(void)
872 if (playlist_next(playlist_amount()) < 0) 872 if (playlist_next(playlist_amount()) < 0)
873 is_playing = false; 873 is_playing = false;
874 } 874 }
875
876 playlist_update_resume_info(audio_current_track());
875} 877}
876 878
877static void track_change(void) 879static void track_change(void)
@@ -1036,6 +1038,11 @@ static void mpeg_thread(void)
1036 { 1038 {
1037 queue_wait_w_tmo(&mpeg_queue, &ev, 0); 1039 queue_wait_w_tmo(&mpeg_queue, &ev, 0);
1038 } 1040 }
1041 else if (playing)
1042 {
1043 /* periodically update resume info */
1044 queue_wait_w_tmo(&mpeg_queue, &ev, HZ/2);
1045 }
1039 else 1046 else
1040 { 1047 {
1041 DEBUGF("S R:%x W:%x SW:%x\n", 1048 DEBUGF("S R:%x W:%x SW:%x\n",
@@ -1108,6 +1115,10 @@ static void mpeg_thread(void)
1108 DEBUGF("MPEG_STOP\n"); 1115 DEBUGF("MPEG_STOP\n");
1109 is_playing = false; 1116 is_playing = false;
1110 paused = false; 1117 paused = false;
1118
1119 if (playing)
1120 playlist_update_resume_info(audio_current_track());
1121
1111 stop_playing(); 1122 stop_playing();
1112 mpeg_stop_done = true; 1123 mpeg_stop_done = true;
1113 break; 1124 break;
@@ -1120,6 +1131,7 @@ static void mpeg_thread(void)
1120 pause_tick = current_tick; 1131 pause_tick = current_tick;
1121 pause_track = current_track_counter; 1132 pause_track = current_track_counter;
1122 mp3_play_pause(false); 1133 mp3_play_pause(false);
1134 playlist_update_resume_info(audio_current_track());
1123 break; 1135 break;
1124 1136
1125 case MPEG_RESUME: 1137 case MPEG_RESUME:
@@ -1564,6 +1576,11 @@ static void mpeg_thread(void)
1564 init_recording_done = true; 1576 init_recording_done = true;
1565 break; 1577 break;
1566#endif /* #if CONFIG_HWCODEC == MAS3587F */ 1578#endif /* #if CONFIG_HWCODEC == MAS3587F */
1579
1580 case SYS_TIMEOUT:
1581 if (playing)
1582 playlist_update_resume_info(audio_current_track());
1583 break;
1567 } 1584 }
1568#if CONFIG_HWCODEC == MAS3587F 1585#if CONFIG_HWCODEC == MAS3587F
1569 } 1586 }