]> granicus.if.org Git - taglib/commitdiff
Hmm, that last one wasn't really quite ready. Now we actually check our list
authorScott Wheeler <wheeler@kde.org>
Thu, 21 Jul 2005 18:10:10 +0000 (18:10 +0000)
committerScott Wheeler <wheeler@kde.org>
Thu, 21 Jul 2005 18:10:10 +0000 (18:10 +0000)
of FileTypeResolvers.

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@437391 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

fileref.cpp
fileref.h

index 6c12749d0ffdd0b1aa8ca0e70cc548038e8f4efc..587326566b810cece264318c0ea441da3db2712e 100644 (file)
@@ -132,6 +132,15 @@ bool FileRef::operator!=(const FileRef &ref) const
 File *FileRef::create(const char *fileName, bool readAudioProperties,
                       AudioProperties::ReadStyle audioPropertiesStyle) // static
 {
+
+  List<const FileTypeResolver *>::ConstIterator it = FileRefPrivate::fileTypeResolvers.begin();
+
+  for(; it != FileRefPrivate::fileTypeResolvers.end(); ++it) {
+    File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle);
+    if(file)
+      return file;
+  }
+
   // Ok, this is really dumb for now, but it works for testing.
 
   String s = fileName;
@@ -145,7 +154,7 @@ File *FileRef::create(const char *fileName, bool readAudioProperties,
       return new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
     if(s.substr(s.size() - 4, 4).upper() == ".MPC")
       return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle);
-  }
+  }  
 
   return 0;
 }
index b4e64eea6dc23d6fd9c905ffb42f592687487754..2b6352b043d33f0cf3b6313efb71a5d0aace62ea 100644 (file)
--- a/fileref.h
+++ b/fileref.h
@@ -95,7 +95,10 @@ namespace TagLib {
        * deleted.  Deletion will happen automatically when the FileRef passes
        * out of scope.
        */
-      virtual File *createFile(const char *fileName) = 0;
+      virtual File *createFile(const char *fileName,
+                               bool readAudioProperties = true,
+                               AudioProperties::ReadStyle
+                               audioPropertiesStyle = AudioProperties::Average) const = 0;
     };
 
     FileRef();