diff options
-rw-r--r-- | firmware/mpeg.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 5969dca577..1f24ea7425 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -615,7 +615,7 @@ void IMIA1(void) | |||
615 | TSR1 &= ~0x01; | 615 | TSR1 &= ~0x01; |
616 | } | 616 | } |
617 | 617 | ||
618 | static void add_track_to_tag_list(char *filename) | 618 | static int add_track_to_tag_list(char *filename) |
619 | { | 619 | { |
620 | struct id3tag *t = NULL; | 620 | struct id3tag *t = NULL; |
621 | int i; | 621 | int i; |
@@ -631,7 +631,7 @@ static void add_track_to_tag_list(char *filename) | |||
631 | if(mp3info(&(t->id3), filename)) | 631 | if(mp3info(&(t->id3), filename)) |
632 | { | 632 | { |
633 | DEBUGF("Bad mp3\n"); | 633 | DEBUGF("Bad mp3\n"); |
634 | return; | 634 | return -1; |
635 | } | 635 | } |
636 | t->mempos = mp3buf_write; | 636 | t->mempos = mp3buf_write; |
637 | t->id3.elapsed = 0; | 637 | t->id3.elapsed = 0; |
@@ -646,6 +646,7 @@ static void add_track_to_tag_list(char *filename) | |||
646 | { | 646 | { |
647 | DEBUGF("No memory available for id3 tag"); | 647 | DEBUGF("No memory available for id3 tag"); |
648 | } | 648 | } |
649 | return 0; | ||
649 | } | 650 | } |
650 | 651 | ||
651 | /* If next_track is true, opens the next track, if false, opens prev track */ | 652 | /* If next_track is true, opens the next track, if false, opens prev track */ |
@@ -672,13 +673,22 @@ static int new_file(int steps) | |||
672 | 673 | ||
673 | index = playlist_next(steps); | 674 | index = playlist_next(steps); |
674 | 675 | ||
675 | add_track_to_tag_list(trackname); | 676 | if(add_track_to_tag_list(trackname)) |
676 | /* skip past id3v2 tag (to an even byte) */ | 677 | { |
677 | lseek(mpeg_file, | 678 | /* Bad mp3 file */ |
678 | id3tags[new_tag_idx]->id3.id3v2len & ~1, | 679 | steps++; |
679 | SEEK_SET); | 680 | close(mpeg_file); |
680 | id3tags[new_tag_idx]->id3.index = index; | 681 | mpeg_file = -1; |
681 | id3tags[new_tag_idx]->id3.offset = 0; | 682 | } |
683 | else | ||
684 | { | ||
685 | /* skip past id3v2 tag (to an even byte) */ | ||
686 | lseek(mpeg_file, | ||
687 | id3tags[new_tag_idx]->id3.id3v2len & ~1, | ||
688 | SEEK_SET); | ||
689 | id3tags[new_tag_idx]->id3.index = index; | ||
690 | id3tags[new_tag_idx]->id3.offset = 0; | ||
691 | } | ||
682 | } | 692 | } |
683 | } while ( mpeg_file < 0 ); | 693 | } while ( mpeg_file < 0 ); |
684 | 694 | ||