summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 13562190ce..a3fdf2188f 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -544,7 +544,7 @@ void IRQ6(void)
544#pragma interrupt 544#pragma interrupt
545void DEI3(void) 545void DEI3(void)
546{ 546{
547 if(playing) 547 if(playing && !paused)
548 { 548 {
549 int unplayed_space_left; 549 int unplayed_space_left;
550 int space_until_end_of_buffer; 550 int space_until_end_of_buffer;
@@ -665,13 +665,14 @@ static int new_file(int steps)
665 } 665 }
666 else 666 else
667 { 667 {
668 int new_tag_idx = tag_write_idx;
668 add_track_to_tag_list(trackname); 669 add_track_to_tag_list(trackname);
669 /* skip past id3v2 tag (to an even byte) */ 670 /* skip past id3v2 tag (to an even byte) */
670 lseek(mpeg_file, 671 lseek(mpeg_file,
671 id3tags[tag_read_idx]->id3.id3v2len & ~1, 672 id3tags[new_tag_idx]->id3.id3v2len & ~1,
672 SEEK_SET); 673 SEEK_SET);
673 id3tags[tag_read_idx]->id3.index = index; 674 id3tags[new_tag_idx]->id3.index = index;
674 id3tags[tag_read_idx]->id3.offset = 0; 675 id3tags[new_tag_idx]->id3.offset = 0;
675 } 676 }
676 } while ( mpeg_file < 0 ); 677 } while ( mpeg_file < 0 );
677 678
@@ -784,11 +785,14 @@ static void mpeg_thread(void)
784 case MPEG_RESUME: 785 case MPEG_RESUME:
785 DEBUGF("MPEG_RESUME\n"); 786 DEBUGF("MPEG_RESUME\n");
786 /* Continue the current stream */ 787 /* Continue the current stream */
788 paused = false;
789 if (!play_pending)
790 {
787 playing = true; 791 playing = true;
788 last_dma_tick += current_tick - pause_tick; 792 last_dma_tick += current_tick - pause_tick;
789 pause_tick = 0; 793 pause_tick = 0;
790 paused = false;
791 start_dma(); 794 start_dma();
795 }
792 break; 796 break;
793 797
794 case MPEG_NEXT: 798 case MPEG_NEXT:
@@ -976,6 +980,7 @@ static void mpeg_thread(void)
976 play_pending = true; 980 play_pending = true;
977 } 981 }
978 982
983 id3->offset = newpos;
979 id3->elapsed = newtime; 984 id3->elapsed = newtime;
980 985
981 break; 986 break;
@@ -1255,6 +1260,7 @@ void mpeg_pause(void)
1255 queue_post(&mpeg_queue, MPEG_PAUSE, NULL); 1260 queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
1256#else 1261#else
1257 playing = false; 1262 playing = false;
1263 paused = true;
1258#endif 1264#endif
1259} 1265}
1260 1266
@@ -1264,6 +1270,7 @@ void mpeg_resume(void)
1264 queue_post(&mpeg_queue, MPEG_RESUME, NULL); 1270 queue_post(&mpeg_queue, MPEG_RESUME, NULL);
1265#else 1271#else
1266 playing = true; 1272 playing = true;
1273 paused = false;
1267#endif 1274#endif
1268} 1275}
1269 1276
@@ -1302,7 +1309,7 @@ void mpeg_ff_rewind(int change)
1302 1309
1303bool mpeg_is_playing(void) 1310bool mpeg_is_playing(void)
1304{ 1311{
1305 return (playing || play_pending) && (!paused) ; 1312 return playing || play_pending || paused;
1306} 1313}
1307 1314
1308#ifndef SIMULATOR 1315#ifndef SIMULATOR