[mythtv] 0.17 blocker? MythMusic fix unicode handling for metadata - Question to All

Colin Guthrie myth at colin.guthr.ie
Tue Feb 8 22:00:33 UTC 2005


OK, I'm in a bit of a quandry and want advice from everyone/anyone.

Colin Guthrie wrote:
> It's calculating the length as 0x00 0x00 0x01 0x05 where as it should be
> 0x00 0x00 0x00 0x85.
> 
> Now, as I write these numbers down, I don't think it's a coincidence
> that 0x85 becomes 0x01 0x05 as it's basically overflowing a 16 bit value
>  and treating it as 8 bit. I'm guessing it's to do with signed vs.
> unsigned arithmatic....

The problem lies with libid3 using ID3v2.4 and not supporting ID3v2.3.

Incase you don't know, I believe v2.4 is not widely supported in media 
players (neither software nor hardware), so v2.3 is more desirable 
(someone mentioned this on the list when I first did the metaio stuff a 
while back).

Now, I implemented a hack in the metadata writer for ID3 tags to hack 
the version back down to 2.3 as I knew we weren't writing any crazy new 
frames to the ID3 tag.

I thought that libid3tag was calculating the size incorrectly and 
according to the v2.3 specs which I've just poured over, this is 
correct, HOWEVER, according to the 2.4 specs, the way the size is stored 
has changed and libid3tag is indeed calculating it correctly for a v2.4 tag.

<snip src="http://www.id3.org/id3v2.4.0-structure.txt">
   4.   ID3v2 frame overview

    All ID3v2 frames consists of one frame header followed by one or more
    fields containing the actual information. The header is always 10
    bytes and laid out as follows:

      Frame ID      $xx xx xx xx  (four characters)
      Size      4 * %0xxxxxxx
      Flags         $xx xx

    The frame ID is made out of the characters capital A-Z and 0-9.
    Identifiers beginning with "X", "Y" and "Z" are for experimental
    frames and free for everyone to use, without the need to set the
    experimental bit in the tag header. Bear in mind that someone else
    might have used the same identifier as you. All other identifiers are
    either used or reserved for future use.

    The frame ID is followed by a size descriptor containing the size of
    the data in the final frame, after encryption, compression and
    unsynchronisation. The size is excluding the frame header ('total
    frame size' - 10 bytes) and stored as a 32 bit synchsafe integer.
</snip>

So the question is: what should I do??

The way I see it there are 2 options.

1. Use ID3v2.4 tags. It's the new standard and why shouldn't we (other 
than crappy support in players)? There will probably be a tool that 
could be used to convert v2.4 -> v2.3 if you want to run this manually 
afterwards. This shouldn't take long as there is no need to write the 
whole file. This tool (I'm sure one exists) could be used prior to 
Syncing to a Personal Media Player but could cause problems when this 
feature is integrated into Myth directly!! (IMHO Best Option)

2. Disable Unicode (I know Hiro wont vote for this). This would still 
only permit 127 bytes of Title, Artist etc., but this is more than the 
63 bytes currently permitted. (IMHO Worst Option)

3. As I'm using the latest version of libid3tag 0.15.1b, we could 
implement an older version of libid3tag into mythmusic and use that 
rather than the system version. This older version would work natively 
in v2.3, although would still require the code in libid3_hack.c 
currently in mythmusic to write the tag properly (tho' the version hack 
could dissappear). CORRECTION: I can't find an older version of 
libid3tag that supports v2.3 tags... I checked 0.14.0b of mad but still 
no support there and 0.13 doesn't seem to have libid3tag at all. If 
anyone else can find one then let me know!

4. ???? Any other suggestions? I could be missing something in the ID3 
spec or for that matter in libid3tag, so please let me know if anyone 
thinks of anything.

If there is consensus, I'll bash out the changes needed tomorrow evening 
(basically in 24hrs from now).


Incidentally, having now read the specs fully, I realise I am storing 
the Genre incorrectly. If I use numbers a la ID3v1, then you need to put 
them in parenthasis for ID3v2.3/v2.4 or you can just use a free text 
Genre name a la Myth's Genres. Everyone happy I should make the 
necessary changes for the latter? I can preserve the numeral system as 
well if applicable if people want this (the specs outline this 
capability - Read the section on TCON if you are interested)


Sorry for this last minute hicup. I'll do my best to fix it ASAP.

Col.

-- 

+------------------------+
|     Colin Guthrie      |
+------------------------+
|   myth at colin.guthr.ie  |
| http://colin.guthr.ie/ |
+------------------------+


More information about the mythtv-dev mailing list