Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ethan (3163)

ethan
  reversethis-{ed. ... rap.nov.olissat}

Being a 25-year old chap living in the western-most town of Germany. Stuying communication and information science and being a huge fan of XS-related things.

Journal of ethan (3163)

Sunday February 09, 2003
04:56 AM

Getting big

[ #10486 ]

Some time has passed and I am happily busy with rewriting MP3::Mplib.

I was hoping to get away rather cheaply with this well written, cosy and cute mplib. But I wouldn't be me if I weren't bloating the whole thing quite severely. The thing is that the mplib is still not quite complete. Some id3v2 frames that I would like to support haven't get their own parsing and assemble functions so I decided to add them. This is a finger-snap for simple frames but left me rather baffled when trying to implement support for the APIC-frame (attached picture). The problem is that these data appear to be zlib-compressed when stored in an id3v2 tag. I didn't know that so naturally my functions returned garbage since they expected uncompressed data.

I had a look into zlib.h and was rather compelled till I saw the compress() function that simply takes two buffers and two integers (one being the length of the compressed input-data and the other the size of the uncompressed data which fortunately happens to be stored in the APIC-frame). So now MP3::Mplib can extract whole pictures out of mp3-files which makes me quite excited.

The downside of it is that the depency list grows and now requires to have zlib installed (but this is probably not so uncommon on today's machines). But it worries me with respect to Windows machines. I have to add some means to check for the existence of zlib I think so that I can no-op the APIC-handling functions if they are not installed. Perhaps ExtUtils::MakeMaker can help me.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I had a look into zlib.h and was rather compelled till I saw the compress() function

    Any reason why you're not using Compress::Zlib [cpan.org] rather than zlib directly? Are you currently doing the work in XS, rather than in perl?

    • Any reason why you're not using Compress::Zlib [cpan.org] rather than zlib directly? Are you currently doing the work in XS, rather than in perl?

      Yes, this module is pure XS and doesn't contain any Perl-code save for the stuff created by h2xs. I would have probably skipped to Compress::Zlib if doing it within the XS part hadn't worked. But fortunately it was rather painless. :-)