Xigga

Xigga C# ID3 Library - Update

Hello Everyone,

I just did a major re-write to my library. The code is very optimized now. Before I had a lot of unneeded functions, objects, and buffers (OMG!). I was able to knock out a lot of stuff. The only CPU intensive aspect of the library is detecting the MPEG Audio Info. For those of you who don’t know what it means, MPEG Audio Info contains information about the actual audio stream, like bitrate, sample rate, channels, duration, etc. That information is not part of the ID3 tag. Since MP3’s are stream based, each audio sample has its own MPEG Audio header. The trouble is detecting if the data is MPEG Audio Info or if it’s just the audio stream. What I am doing right now is, I’m parsing the whole MP3 file and reading all MPEG Audio Info patterns and doing a complex check to see if it’s a valid MPEG Audio Info header. This is taking up most of the CPU time. It’s all done in memory, but it’s still a big hit to performance.

I’m going to continue finding a better way to detect valid MPEG Audio Info headers without doing a cross check with the other headers. Also I’m ignoring all MPEG Audio Info headers if they say anything other than MPEG 1 Layer 3. Some people may have MPEG 1 Layer 2, or other combinations. So my library won’t work with that.

Other good news is that it will read the ID3 information very fast! :) My library currently sits at 52kb. It only reads ID3 tags, but it reads all the versions. My next step is to make it write ID3v2.4.0 and ID3v1.1 tags. I’m not going to add support for writing ID3v2.3.0 or ID3v2.2.0 tags. I may allow the option to append the ID3v2.4.0 tag, instead of removing the old one. That’s just a thought. I would rather have the older tags be removed and just have ID3v2.4.0 and ID3v1.1.

I know a couple of you guys out there are eager to try out my library. I would say I’m at version 0.5. It’s easy to parse TEXT tags, but binary tags, like the Image tag, I don’t have support for decompressing the JPEG or any other format yet. I’m definitely not going to write my own image decompresser. If there’s code already available, then I’ll just use that, if not, you will still have access to the raw byte array of the JPEG image in memory, so you can use your own library to decompress/compress it.

Once I have tested my current build (0.5), I will release the library and I’ll provide some sample code on how to use it. It’s pretty simple. You can read all the tags/information with just two lines of code. Hopefully, I’ll get done with my work project so I can work on this more.

 

No comments yet. Be the first.

Leave a reply

Sponsor Ads