summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/id3.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/id3.c b/firmware/id3.c
index c7d8f762af..a4406616c3 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -402,6 +402,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
402 int chmode; 402 int chmode;
403 int bytecount; 403 int bytecount;
404 int bittable; /* which bitrate table to use */ 404 int bittable; /* which bitrate table to use */
405 bool header_found = false;
405 406
406 long bpf; 407 long bpf;
407 long tpf; 408 long tpf;
@@ -585,6 +586,8 @@ static int getsonglength(int fd, struct mp3entry *entry)
585 586
586 /* Make sure we skip this frame in playback */ 587 /* Make sure we skip this frame in playback */
587 bytecount += bpf; 588 bytecount += bpf;
589
590 header_found = true;
588 } 591 }
589 592
590 /* Is it a LAME Info frame? */ 593 /* Is it a LAME Info frame? */
@@ -595,6 +598,8 @@ static int getsonglength(int fd, struct mp3entry *entry)
595 { 598 {
596 /* Make sure we skip this frame in playback */ 599 /* Make sure we skip this frame in playback */
597 bytecount += bpf; 600 bytecount += bpf;
601
602 header_found = true;
598 } 603 }
599 604
600 605
@@ -613,7 +618,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
613 618
614 DEBUGF("Old ID3V2 length: %x\n", entry->id3v2len); 619 DEBUGF("Old ID3V2 length: %x\n", entry->id3v2len);
615 /* Adjust the tag length only if there is a tag present */ 620 /* Adjust the tag length only if there is a tag present */
616 if(entry->id3v2len) 621 if(entry->id3v2len || header_found)
617 entry->id3v2len = bytecount; 622 entry->id3v2len = bytecount;
618 DEBUGF("New ID3V2 length: %x\n", bytecount); 623 DEBUGF("New ID3V2 length: %x\n", bytecount);
619 624