gmediaserver-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gmediaserver-devel] taglib - why?


From: Oskar Liljeblad
Subject: [gmediaserver-devel] taglib - why?
Date: Tue, 20 Dec 2005 09:09:13 +0100
User-agent: Mutt/1.5.11

I've been looking a little at taglib. The API looks simple and it seems to
be able to grab info from many formats. But then I discovered this code for
identifying file format:

  // Ok, this is really dumb for now, but it works for testing.

  String s = fileName;

  // If this list is updated, the method defaultFileExtensions() should also be
  // updated.  However at some point that list should be created at the same 
time
  // that a default file type resolver is created.

  if(s.size() > 4) {
    if(s.substr(s.size() - 4, 4).upper() == ".OGG")
      return new Vorbis::File(fileName, readAudioProperties, 
audioPropertiesStyle);
    if(s.substr(s.size() - 4, 4).upper() == ".MP3")
      return new MPEG::File(fileName, readAudioProperties, 
audioPropertiesStyle);
    if(s.substr(s.size() - 5, 5).upper() == ".FLAC")
      return new FLAC::File(fileName, readAudioProperties, 
audioPropertiesStyle);
    if(s.substr(s.size() - 4, 4).upper() == ".MPC")
      return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle);
  }

I.e. it detects file format by looking at file extension alone! I don't think
this is a very good idea. id3lib doesn't look at file extensions. Are there any
other benefits of taglib that would justify a change?

Regards,

Oskar




reply via email to

[Prev in Thread] Current Thread [Next in Thread]