This is a little something I have been working on, it will read and write ID3v1.1 and v2.3 tags, as well as the audio information for an MP3 file. When writing a v1.1 tag it will replace the existing tag if present, when writing a v2.3 tag it will strip out the frames that are present in the ID3Info structure and replace them with data you supply, all other frames are unchanged. You can optionally have unknown frames removed. There is also a function to extract the album art image from an v2.3 tag and return a bitmap handle. Compressed frames are decompressed before adding them to the structure using zlib, I only had one example frame to test decompression so it is not 100% tested. The only frames that are read/written are those that WinAmp does, this can be expanded if necessary.

The code prefers a v2.3 tag and when ReadIDtag is called it will first attempt to read that, if it is not found it will attempt to find a v1.1 tag. Since there is no way to read a v1.1 tag if there is a v2.3 tag present I have provided a function to do that.

GetAudioInfo will properly decode the average bitrate and playback time for VBR/XING encoded files.

Unicode frames are converted to ANSI prior to being returned.

Posted on 2004-05-28 02:09:43 by donkey
The code uses the following libraries...

Note that if you include the decompression part you should acknowledge the following people in your about box:

Zlib : Jean-loup Gailly and Mark Adler
Zlibstat : LaptoniC

If you use the bitmap routine you should acknowledge:

BitmapFromMemory : Ernest Murphy
Posted on 2004-05-28 02:11:59 by donkey
Just for those who have had this problem, do not attempt to replace lib based functions with the ones from MASM32, only BitmapFromMemory is used from the MASM32 library. The others are different in my libraries, mine follow the more standard format of dest,source while the MASM32 versions are a hodgepodge depending on the author. In general string functions like szCopy etc... will follow the lstrxxx version in both parameter order and return value with my libs but the parameters are probably reversed in MASM32.
Posted on 2004-05-28 23:42:17 by donkey
haven't tested it, but :alright:
Posted on 2004-05-29 11:16:07 by f0dder
Hi f0dder,

Thanks. I have tested it on my MP3's here but they were all generated by me from originals so it is difficult to say that the tests were extensive. All my tests were properly read and written to by WinAmp. I tried downloading a few test MP3's from p2p but the ones I got were mostly garbage (the thing not the band). It is difficult to make it robust when I can't know the range of problematic tags. I downloaded the SDK from id3.org and tested with that, it is where I got my only example of a compressed tag. Hopefully someone will use it and report any problems, I will probably convert it to a lib file soon.

I am looking into DirectSound to playback the MP3s, but I have no programming experience in DirectX so it is taking a long time to gather the required infomation and coding practices. I beleive that if I can bypass the MCI that I can acheive good enough playback quality and make it a nice lib.
Posted on 2004-05-29 12:52:36 by donkey