diff --git a/fileref.cpp b/fileref.cpp index 6c12749d..58732656 100644 --- a/fileref.cpp +++ b/fileref.cpp @@ -132,6 +132,15 @@ bool FileRef::operator!=(const FileRef &ref) const File *FileRef::create(const char *fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle) // static { + + List::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; } diff --git a/fileref.h b/fileref.h index b4e64eea..2b6352b0 100644 --- 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();