Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 24th April 2002, 09:41   #1
VolureDarkAngel
Junior Member
 
VolureDarkAngel's Avatar
 
Join Date: Apr 2002
Posts: 5
ID3v2 Invalid Tag size (Programming Help)

I have a small problem in your version of the ID3 v2 Tags

I am a programmer making an ID3 Tagger and went to the ID3 website to gather the specs for the tag format.

After careful research looking over the tag I have found that your Winamp 2.79 dows not use the ID3 tagging system Properly. In the size portion of the header it notes the tag is much Longer then the file

here is what I have done

1 Created a File containing Data "File Data"
2 Added the ID3v2 Tags to the file using the Winamp 2.79 Tag editor
3 Opened the newly tagged file in a hex editor

While looking over the tag I noticed this fatal flaw

Your header (As Follows)
4944 3303 0000 0000 0F6D
Does not represent the Tag at all

the file size is 2048 with "FileData" and everything but as you can see the tag says its size is 0F6D (3949). If I were to try to clear or change this tag I would efficently overwrite the beginning of the file. Now I understand for the most part 1901 Bytes is not a very significant portion of a file but if done repeatedly could diminish the file significantly. and say its just a companion file just of the tag. Opening past the end of the file could cause Program errors and Memory leaks if used improperly. Please help me understand and correct this problem. How would you trap and correct this is you were to encounter it ?

Thank you
I have encluded the MP3 in a text file for your view. you should check it in a hex editor not to damage the invalid characters by use in notepad or other editors.
Attached Files
File Type: txt file.txt (2.0 KB, 178 views)
VolureDarkAngel is offline   Reply With Quote
Old 24th April 2002, 23:26   #2
chrisbolt
Junior Member
 
Join Date: Dec 2000
Posts: 8
This is not a bug

This is not a bug in Winamp, you didn't research carefully enough. If you read the ID3v2 spec closely, you'll notice:
Quote:
The ID3v2 tag size is encoded with four bytes where the most significant bit (bit 7) is set to zero in every byte, making a total of 28 bits. The zeroed bits are ignored, so a 257 bytes long tag is represented as $00 00 02 01.
The most significant bit is zeroed to prevent the header from being mistaken as the MP3 sync. Since the most significant bit is ignored, you can't just convert it directly from hex to binary. If you did that, the example ($00 00 02 01) would come out to 513 bytes when it really should come out to 257 bytes.

If you want the code to find the size, here's some example code in PHP, but it should be easy to port: (this assumes $fp is the file descriptor of the mp3, and it's right at the position of the size portion of the id3v2 header)
Quote:
$bytes = array();
for ($i = 0; $i < 4; $i++)
$bytes[$i] = fgetc($fp);
$v2size = (
($bytes[0] << 21) |
($bytes[1] << 14) |
($bytes[2] << 7) |
($bytes[3] ));
(if the most significant bit wasn't ignored, the numbers would be 24, 16, 8)
chrisbolt is offline   Reply With Quote
Old 25th April 2002, 12:25   #3
VolureDarkAngel
Junior Member
 
VolureDarkAngel's Avatar
 
Join Date: Apr 2002
Posts: 5
Hmm

Ok so this means

$0??????? per Byte ?
VolureDarkAngel is offline   Reply With Quote
Old 25th April 2002, 13:19   #4
chrisbolt
Junior Member
 
Join Date: Dec 2000
Posts: 8
Yes.
chrisbolt is offline   Reply With Quote
Old 25th April 2002, 21:00   #5
VolureDarkAngel
Junior Member
 
VolureDarkAngel's Avatar
 
Join Date: Apr 2002
Posts: 5
Another Programming problem

I figured it out and I got the Size settings working right
But Winamp dosnt recognize any of my Tags. I even mimiced the Chr(0) Before the tag that Winamp likes to throw in there but to no avail Winamp wont read My Tags

It says they are there but wont display them. Perhaps they need to be in a specific order or something ?

It is about to make me blow a gasket

VolureDarkAngel is offline   Reply With Quote
Old 25th April 2002, 21:05   #6
VolureDarkAngel
Junior Member
 
VolureDarkAngel's Avatar
 
Join Date: Apr 2002
Posts: 5
No More problem

I think I figured it out
VolureDarkAngel is offline   Reply With Quote
Old 25th April 2002, 22:32   #7
VolureDarkAngel
Junior Member
 
VolureDarkAngel's Avatar
 
Join Date: Apr 2002
Posts: 5
My Tagger works now

Here is my Tagger it works now

Thanks a lot for your help

http://www.lokisystems.cjb.net/download

VolureDarkAngel is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump