summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/mpeg.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 947098639a..4ef00d9c29 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -713,26 +713,38 @@ static void mpeg_thread(void)
713 playing = false; 713 playing = false;
714 stop_dma(); 714 stop_dma();
715 715
716 reset_mp3_buffer(); 716 /* is next track in ram? */
717 remove_all_tags(); 717 if ( num_tracks_in_memory() > 1 ) {
718 int track_offset = (tag_read_idx+1) & MAX_ID3_TAGS_MASK;
719 mp3buf_read = id3tags[track_offset]->mempos;
720 playing = true;
721 last_dma_tick = current_tick;
722 init_dma();
723 start_dma();
724 queue_post(&mpeg_queue, MPEG_TRACK_CHANGE, 0);
725 }
726 else {
727 reset_mp3_buffer();
728 remove_all_tags();
718 729
719 /* Open the next file */ 730 /* Open the next file */
720 if (mpeg_file >= 0) 731 if (mpeg_file >= 0)
721 close(mpeg_file); 732 close(mpeg_file);
722 733
723 if (new_file(true) < 0) { 734 if (new_file(true) < 0) {
724 DEBUGF("No more files to play\n"); 735 DEBUGF("No more files to play\n");
725 filling = false; 736 filling = false;
726 } else { 737 } else {
727 /* Make it read more data */ 738 /* Make it read more data */
728 filling = true; 739 filling = true;
729 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); 740 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
730 741
731 /* Tell the file loading code that we want to start playing 742 /* Tell the file loading code that we want to start playing
732 as soon as we have some data */ 743 as soon as we have some data */
733 play_pending = true; 744 play_pending = true;
734 745
735 current_track_counter++; 746 current_track_counter++;
747 }
736 } 748 }
737 break; 749 break;
738 750