diff --git a/taglib/dsdiff/dsdifffile.cpp b/taglib/dsdiff/dsdifffile.cpp index cb6f0649..107d3921 100644 --- a/taglib/dsdiff/dsdifffile.cpp +++ b/taglib/dsdiff/dsdifffile.cpp @@ -812,7 +812,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty } else if(d->chunks[i].name == "ID3 " || d->chunks[i].name == "id3 ") { d->id3v2TagChunkID = d->chunks[i].name; - d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->chunks[i].offset)); + d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->chunks[i].offset, + d->ID3v2FrameFactory)); d->isID3InPropChunk = false; d->hasID3v2 = true; } @@ -841,7 +842,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty continue; } d->id3v2TagChunkID = d->childChunks[PROPChunk][i].name; - d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->childChunks[PROPChunk][i].offset)); + d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->childChunks[PROPChunk][i].offset, + d->ID3v2FrameFactory)); d->isID3InPropChunk = true; d->hasID3v2 = true; } diff --git a/taglib/dsdiff/dsdifffile.h b/taglib/dsdiff/dsdifffile.h index dea91b4a..dbfaa25b 100644 --- a/taglib/dsdiff/dsdifffile.h +++ b/taglib/dsdiff/dsdifffile.h @@ -83,7 +83,7 @@ namespace TagLib { * * \note In the current implementation, \a propertiesStyle is ignored. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory (default if null). */ File(FileName file, bool readProperties = true, @@ -94,7 +94,7 @@ namespace TagLib { * Constructs an DSDIFF file from \a stream. If \a readProperties is true * the file's audio properties will also be read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory (default if null). * * \note TagLib will *not* take ownership of the stream, the caller is diff --git a/taglib/dsf/dsffile.h b/taglib/dsf/dsffile.h index b5c7b979..0264cb05 100644 --- a/taglib/dsf/dsffile.h +++ b/taglib/dsf/dsffile.h @@ -46,7 +46,7 @@ namespace TagLib { * \a propertiesStyle are ignored. The audio properties are always * read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory (default if null). */ File(FileName file, bool readProperties = true, @@ -61,7 +61,7 @@ namespace TagLib { * \a propertiesStyle are ignored. The audio properties are always * read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory (default if null). * * \note TagLib will *not* take ownership of the stream, the caller is diff --git a/taglib/flac/flacfile.h b/taglib/flac/flacfile.h index b311a495..8bdd1ff5 100644 --- a/taglib/flac/flacfile.h +++ b/taglib/flac/flacfile.h @@ -98,7 +98,7 @@ namespace TagLib { * Constructs an FLAC file from \a file. If \a readProperties is true the * file's audio properties will also be read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * \note In the current implementation, \a propertiesStyle is ignored. @@ -115,7 +115,7 @@ namespace TagLib { * \note TagLib will *not* take ownership of the stream, the caller is * responsible for deleting it after the File object. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * \note In the current implementation, \a propertiesStyle is ignored. diff --git a/taglib/mpeg/mpegfile.h b/taglib/mpeg/mpegfile.h index 004e2733..41fd9863 100644 --- a/taglib/mpeg/mpegfile.h +++ b/taglib/mpeg/mpegfile.h @@ -87,7 +87,7 @@ namespace TagLib { * Constructs an MPEG file from \a file. If \a readProperties is true the * file's audio properties will also be read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * If \a propertiesStyle is not Fast, the file will be scanned @@ -105,7 +105,7 @@ namespace TagLib { * \note TagLib will *not* take ownership of the stream, the caller is * responsible for deleting it after the File object. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * If \a propertiesStyle is not Fast, the file will be scanned diff --git a/taglib/riff/wav/wavfile.cpp b/taglib/riff/wav/wavfile.cpp index 60e58225..a3e21b88 100644 --- a/taglib/riff/wav/wavfile.cpp +++ b/taglib/riff/wav/wavfile.cpp @@ -41,6 +41,15 @@ namespace class RIFF::WAV::File::FilePrivate { public: + FilePrivate(ID3v2::FrameFactory *frameFactory) + : ID3v2FrameFactory(frameFactory ? frameFactory + : ID3v2::FrameFactory::instance()) + { + } + + ~FilePrivate() = default; + + const ID3v2::FrameFactory *ID3v2FrameFactory; std::unique_ptr properties; TagUnion tag; @@ -64,17 +73,19 @@ bool RIFF::WAV::File::isSupported(IOStream *stream) // public members //////////////////////////////////////////////////////////////////////////////// -RIFF::WAV::File::File(FileName file, bool readProperties, Properties::ReadStyle) : +RIFF::WAV::File::File(FileName file, bool readProperties, Properties::ReadStyle, + ID3v2::FrameFactory *frameFactory) : RIFF::File(file, LittleEndian), - d(std::make_unique()) + d(std::make_unique(frameFactory)) { if(isOpen()) read(readProperties); } -RIFF::WAV::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : +RIFF::WAV::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle, + ID3v2::FrameFactory *frameFactory) : RIFF::File(stream, LittleEndian), - d(std::make_unique()) + d(std::make_unique(frameFactory)) { if(isOpen()) read(readProperties); @@ -190,7 +201,8 @@ void RIFF::WAV::File::read(bool readProperties) const ByteVector name = chunkName(i); if(name == "ID3 " || name == "id3 ") { if(!d->tag[ID3v2Index]) { - d->tag.set(ID3v2Index, new ID3v2::Tag(this, chunkOffset(i))); + d->tag.set(ID3v2Index, new ID3v2::Tag(this, chunkOffset(i), + d->ID3v2FrameFactory)); d->hasID3v2 = true; } else { diff --git a/taglib/riff/wav/wavfile.h b/taglib/riff/wav/wavfile.h index da5a1a59..fbb65f41 100644 --- a/taglib/riff/wav/wavfile.h +++ b/taglib/riff/wav/wavfile.h @@ -74,9 +74,13 @@ namespace TagLib { * file's audio properties will also be read. * * \note In the current implementation, \a propertiesStyle is ignored. + * + * If this file contains an ID3v2 tag, the frames will be created using + * \a frameFactory (default if null). */ File(FileName file, bool readProperties = true, - Properties::ReadStyle propertiesStyle = Properties::Average); + Properties::ReadStyle propertiesStyle = Properties::Average, + ID3v2::FrameFactory *frameFactory = nullptr); /*! * Constructs a WAV file from \a stream. If \a readProperties is true the @@ -86,9 +90,13 @@ namespace TagLib { * responsible for deleting it after the File object. * * \note In the current implementation, \a propertiesStyle is ignored. + * + * If this file contains an ID3v2 tag, the frames will be created using + * \a frameFactory (default if null). */ File(IOStream *stream, bool readProperties = true, - Properties::ReadStyle propertiesStyle = Properties::Average); + Properties::ReadStyle propertiesStyle = Properties::Average, + ID3v2::FrameFactory *frameFactory = nullptr); /*! * Destroys this instance of the File. diff --git a/taglib/trueaudio/trueaudiofile.h b/taglib/trueaudio/trueaudiofile.h index 64f3a46b..7b95b00e 100644 --- a/taglib/trueaudio/trueaudiofile.h +++ b/taglib/trueaudio/trueaudiofile.h @@ -91,7 +91,7 @@ namespace TagLib { * Constructs a TrueAudio file from \a file. If \a readProperties is true * the file's audio properties will also be read. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * \note In the current implementation, \a propertiesStyle is ignored. @@ -119,7 +119,7 @@ namespace TagLib { * \note TagLib will *not* take ownership of the stream, the caller is * responsible for deleting it after the File object. * - * If this file contains and ID3v2 tag the frames will be created using + * If this file contains an ID3v2 tag, the frames will be created using * \a frameFactory. * * \note In the current implementation, \a propertiesStyle is ignored.