Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: Bad Recorded MP3s - may not be (solely) a DAC issue

Re: Bad Recorded MP3s - may not be (solely) a DAC issue

From: Frederic Devernay <frederic.devernay_at_m4x.org>
Date: Sun, 06 Nov 2005 18:05:04 +0100

Linus Nielsen Feltzing a écrit :
> Bluechip wrote:
>
>> 1. Why does RB append a blank 4K ID3v2 header to the start of every file?
>
>
> It's there for convenience, so that the file can be updated with a valid
> tag without rewriting the entire file.
>

That's the main flaw of id3v2, and yet another reason to switch to APEv2
;-) I'm just kidding of course, I know id3v2 is more widely supported,
but it gives me an occasion to remind you that APEv2 support for mp3 is
just a 10-lines patch that doesn't break anything...

fred


Index: apps/metadata.c
===================================================================
RCS file: /cvsroot/rockbox/apps/metadata.c,v
retrieving revision 1.33
diff -u -r1.33 metadata.c
--- apps/metadata.c 5 Nov 2005 13:58:08 -0000 1.33
+++ apps/metadata.c 6 Nov 2005 17:04:08 -0000
_at__at_ -401,11 +401,11 _at__at_
 /* Read the items in an APEV2 tag. Only looks for a tag at the end of a
  * file. Returns true if a tag was found and fully read, false otherwise.
  */
-static bool read_ape_tags(int fd, struct mp3entry* id3)
+static bool read_ape_tags(int fd, struct mp3entry* id3, int offset)
 {
     struct apetag_header header;
 
- if ((lseek(fd, -APETAG_HEADER_LENGTH, SEEK_END) < 0)
+ if ((lseek(fd, -APETAG_HEADER_LENGTH + offset, SEEK_END) < 0)
         || (read(fd, &header, APETAG_HEADER_LENGTH) != APETAG_HEADER_LENGTH)
         || (memcmp(header.id, "APETAGEX", sizeof(header.id))))
     {
_at__at_ -424,7 +424,7 _at__at_
         unsigned int tag_remaining = header.length - APETAG_HEADER_LENGTH;
         int i;
         
- if (lseek(fd, -header.length, SEEK_END) < 0)
+ if (lseek(fd, -header.length + offset, SEEK_END) < 0)
         {
             return false;
         }
_at__at_ -1375,6 +1375,12 _at__at_
         {
             return false;
         }
+ if (track->id3.id3version <= ID3_VER_1_1)
+ {
+ /* An id3v1 tag may hide an APEv2 tag... */
+ /* use any apetag info we find */
+ read_ape_tags(fd, &track->id3, -track->id3.id3v1len);
+ }
 
         break;
 
_at__at_ -1389,7 +1395,7 _at__at_
     case AFMT_MPC:
         if (!get_musepack_metadata(fd, &(track->id3)))
             return false;
- read_ape_tags(fd, &(track->id3));
+ read_ape_tags(fd, &(track->id3), 0);
         break;
     
     case AFMT_OGG_VORBIS:
_at__at_ -1452,7 +1458,7 _at__at_
             track->id3.bitrate = filesize (fd) / (track->id3.length / 8);
         }
 
- read_ape_tags(fd, &track->id3); /* use any apetag info we find */
+ read_ape_tags(fd, &track->id3, 0); /* use any apetag info we find */
         break;
 
     case AFMT_A52:
Received on 2005-11-06

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy