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



Rockbox mail archive

Subject: RE: ID3V2 genre
From: Jeremy Zoss (jzoss_at_satx.rr.com)
Date: 2003-06-23


> Regarding the function parsegenre() in id3.c, shouldn't the "if"
> statement begin like this:
>
> if( tag[ 0 ] == '(' && tag[ 1 ] != '(' ) {
> entry->genre = atoi( tag + 1 );

Yup. The changes made in "generalizing" invalidated the old index-method
(although it was valid pre-generalization).

Quick explanation (hope I don't screw anything up ;D) --
Here's what frame headers look like, out of the id3v2 specs:
  v2.2 -- "T??" $aa aa aa bb <text> (6-byte "hdr", 1 byte enc,
???-byte text)
  v2.3 -- "T???" $aa aa aa aa bb bb cc <text> (10-byte "hdr", 1 byte end,
???-byte text)
  v2.4 -- same as 2.3

IIRC, rockbox initially parses out the 6/10-byte header, but not the
encoding byte. In the previous implementation, most tags
(title/artist/album) were passed through unicode_munge, which handles the
encoding byte correctly. Even year/tracknum numeric tags were first passed
through unicode_munge (which "cleaned out" the encoding byte) and then
through atoi. The genre-parsing code did not use unicode_munge, so had to
skip an extra byte (thus the tag[1] and tag[2] references).

In the current (generalized) id3v2 code, all id3v2 tags are sent through
unicode_munge, before the postprocessing function is called. So, now the
encoding byte is "cleaned out" of the genre string. So the correct
references are tag[0] and tag[1].

Probably more information than warranted. But it was on the tip of my
tounge, as I'm workign on my id3editor, so it just begged to be released.
So there ya go. =)
  - Jeremy



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa