Time to rethink the abstract Tag interface!
andlind at gmail.com
Thu Jan 18 22:20:20 CET 2007
I've been considering using TagLib for a project I'm working on. On
one hand I'm really impressed with the library, on the other hand I'm
a bit disappointed with the abstracted "Tag" interface.
In the devel list I've read comment like the following (Scott Wheeler,
> The "generic" tag API only supports the features that are supported
> by all tag types.
I wholeheartedly disagrees with this statement!
I think that the tag interface should be considered the *main*
interface to TagLib, especially if the number of formats will increase
in the future. As the main interface it is imperative that it will
meet the needs for most, if not all, applications. Today it does not!
I suggest that the following changes should be done to the abstract
* Instead of providing the intersection of the features of the
supported formats, the interfaces it should provide the *union*!
For example, the abstract interface should support attributes like
"number of discs in set" and multi-values tags. A good thing is if
an application could ask the interface what features are provided.
(Also, the methods that update a file could return a status, so it
could indicate that the application is setting an attribute the
format doesn't support.)
* Return values with special meaning should not collide with valid
values. Concretely, I've seen tons of files that have a "0" in the
year field. Unfortunately, the abstract interface uses 0 to
indicate that the field is empty, hence it's impossible using the
abstract interface to distinguish between a "0" and an empty field.
* I suggest that the abstract interface should be expanded to handle
*at least* the following. In addition, all the standard mp3 fields
could easily be handled (there is no cost involved in having a
- Artists -- Note the plural form (file formats like FLAC supports
and encourages that more than one artist is listed).
- Genre. (Or possible a collection of genres.)
- Year (where it's possible to distinguish between "0" and an empty
- Track nr.
- Number of tracks on album.
- Disc number.
- Number of discs in collection.
* Care should be taken when designing the interface so that the
C-level interface still would be usable. This would also ensure
that the script language bindings could be adopted to the new
If you think that this is a good path for future versions of the
library I could make an attempt at making a concrete implementation of
the Tag and C-level interfaces.
-- Anders Lindgren
More information about the taglib-devel