Programming · TagLib#

Transmitting file data ……………………. Committed revision 73980.

Banshee bug 412273 should now be solved, as well as minor bugs that may show up in a few files here and there. To summarize the change, let me first present you with the Changelog:

2007-03-08 Brian Nickel <**********>
   * src/TagLib/Mpc/File.cs: Inherit NonContainer.File
   * src/TagLib/CombinedTag.cs: Add some useful features for NonContainer.*
   * src/TagLib/Id3v1/Tag.cs: Add Tag.Size instead of repeated hardcoding of
   128.
   * src/TagLib/Id3v2/Footer.cs:
   * src/TagLib/Id3v2/Header.cs: Throw proper CorruptFileExceptions
   * src/TagLib/Mpeg/File.cs: Inherit NonContainer.File
   * src/TagLib/WavPack/File.cs: Inherit NonContainer.File
   * src/TagLib/NonContainer:
   * src/TagLib/NonContainer/Tag.cs:
   * src/TagLib/NonContainer/File.cs:
   * src/TagLib/NonContainer/EndTag.cs:
   * src/TagLib/NonContainer/StartTag.cs: New generic abstracts for files
   that can start/end with an assortment of tags. (FLAC, WV, MPC, MP3)
   * src/TagLib/Ape/Tag.cs: Read backwards if a footer is found and forwards if
   a header is found.
   * src/TagLib/Ape/Footer.cs: FooterPresent and IsHeader were read
   incorrectly. Also throw proper exceptions while reading.
   * src/TagLib/Flac/File.cs: Inherit NonContainer.File
   * src/TagLib/Flac/BlockHeader.cs:
   * src/TagLib/Flac/Block.cs: Removed from Flac.File, made public.
   * src/TagLib/Mpeg4/File.cs: Remove old commented code.
   * src/Makefile.am:
   * src/taglib-sharp.csproj:
   * src/taglib-sharp.mdp:
   * taglib-sharp.mds:
   * tests/tests.mdp:
   * examples/SetPictures.mdp:
   * examples/ReadFromUri.mdp: Updates.

To solve this bug, I created a new namespace, TagLib.NonContainer, which provides an abstract file which does the following:

  1. Checks the very beginning of the file for a valid APE or ID3 tag, reads it, and then checks after that tag for another, until none is found.
  2. It then lets the child class read whatever it wants to at the beginning of the file. For most formats, this is just going to be the first header block, and for FLAC it’s a vorbis comment and embedded images.
  3. It then advanced to the end and searches backwards in similar manner.
  4. Same as 2, but at the end.
  5. Have the child class read the audio properties, if necessary.

So, now you can read ID3v2 tags at the end or APE tags at the front, not to mention fun combinations like (APE, APE, ID3v2, APE). The combinations are infinite! (sarcasm implied)

On the plus side, now the child classes are much cleaner and easier to work with internally.

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s