summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-08-07 22:44:43 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-08-07 22:44:43 +0000
commit445f17eda471e2a4f49e78afdbd2f7c258316185 (patch)
tree4bafb33852e3c63270185dbdf320b2858da1f0ec
parentc1d9b156076b9c3789611cd96fda8cb10cc57fe4 (diff)
downloadrockbox-445f17eda471e2a4f49e78afdbd2f7c258316185.zip
rockbox-445f17eda471e2a4f49e78afdbd2f7c258316185.tar.gz
rockbox-445f17eda471e2a4f49e78afdbd2f7c258316185.tar.bz2
rockbox-445f17eda471e2a4f49e78afdbd2f7c258316185.tar.xz
If next track is in ram, don't load from disk
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1604 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 9470986..4ef00d9 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -713,26 +713,38 @@ static void mpeg_thread(void)
playing = false;
stop_dma();
- reset_mp3_buffer();
- remove_all_tags();
+ /* is next track in ram? */
+ if ( num_tracks_in_memory() > 1 ) {
+ int track_offset = (tag_read_idx+1) & MAX_ID3_TAGS_MASK;
+ mp3buf_read = id3tags[track_offset]->mempos;
+ playing = true;
+ last_dma_tick = current_tick;
+ init_dma();
+ start_dma();
+ queue_post(&mpeg_queue, MPEG_TRACK_CHANGE, 0);
+ }
+ else {
+ reset_mp3_buffer();
+ remove_all_tags();
- /* Open the next file */
- if (mpeg_file >= 0)
- close(mpeg_file);
-
- if (new_file(true) < 0) {
- DEBUGF("No more files to play\n");
- filling = false;
- } else {
- /* Make it read more data */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
- /* Tell the file loading code that we want to start playing
- as soon as we have some data */
- play_pending = true;
+ /* Open the next file */
+ if (mpeg_file >= 0)
+ close(mpeg_file);
+
+ if (new_file(true) < 0) {
+ DEBUGF("No more files to play\n");
+ filling = false;
+ } else {
+ /* Make it read more data */
+ filling = true;
+ queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
+
+ /* Tell the file loading code that we want to start playing
+ as soon as we have some data */
+ play_pending = true;
- current_track_counter++;
+ current_track_counter++;
+ }
}
break;