mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
ID3v2: Always pass correct FrameFactory from File to Tag
This commit is contained in:
parent
b993e70cf4
commit
59166f6757
@ -166,7 +166,7 @@ TagLib::Tag *DSDIFF::File::tag() const
|
||||
|
||||
ID3v2::Tag *DSDIFF::File::ID3v2Tag(bool create) const
|
||||
{
|
||||
return d->tag.access<ID3v2::Tag>(ID3v2Index, create);
|
||||
return d->tag.access<ID3v2::Tag>(ID3v2Index, create, d->ID3v2FrameFactory);
|
||||
}
|
||||
|
||||
bool DSDIFF::File::hasID3v2Tag() const
|
||||
@ -294,7 +294,7 @@ void DSDIFF::File::strip(int tags)
|
||||
removeChildChunk("ID3 ", PROPChunk);
|
||||
removeChildChunk("id3 ", PROPChunk);
|
||||
d->hasID3v2 = false;
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag);
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag(nullptr, 0, d->ID3v2FrameFactory));
|
||||
d->duplicateID3V2chunkIndex = -1;
|
||||
d->isID3InPropChunk = false;
|
||||
d->id3v2TagChunkID.setData("ID3 ");
|
||||
@ -909,7 +909,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty
|
||||
}
|
||||
|
||||
if(!ID3v2Tag()) {
|
||||
d->tag.access<ID3v2::Tag>(ID3v2Index, true);
|
||||
d->tag.access<ID3v2::Tag>(ID3v2Index, true, d->ID3v2FrameFactory);
|
||||
// By default, ID3 chunk is at root level
|
||||
d->isID3InPropChunk = false;
|
||||
d->hasID3v2 = false;
|
||||
|
@ -225,7 +225,7 @@ void DSF::File::read(AudioProperties::ReadStyle propertiesStyle)
|
||||
|
||||
// A metadata offset of 0 indicates the absence of an ID3v2 tag
|
||||
if(d->metadataOffset == 0)
|
||||
d->tag = std::make_unique<ID3v2::Tag>();
|
||||
d->tag = std::make_unique<ID3v2::Tag>(nullptr, 0, d->ID3v2FrameFactory);
|
||||
else
|
||||
d->tag = std::make_unique<ID3v2::Tag>(this, d->metadataOffset,
|
||||
d->ID3v2FrameFactory);
|
||||
|
@ -360,7 +360,8 @@ bool FLAC::File::save()
|
||||
|
||||
ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
|
||||
{
|
||||
return d->tag.access<ID3v2::Tag>(FlacID3v2Index, create);
|
||||
return d->tag.access<ID3v2::Tag>(FlacID3v2Index, create,
|
||||
d->ID3v2FrameFactory);
|
||||
}
|
||||
|
||||
ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
|
||||
|
@ -297,7 +297,7 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
|
||||
|
||||
ID3v2::Tag *MPEG::File::ID3v2Tag(bool create)
|
||||
{
|
||||
return d->tag.access<ID3v2::Tag>(ID3v2Index, create);
|
||||
return d->tag.access<ID3v2::Tag>(ID3v2Index, create, d->ID3v2FrameFactory);
|
||||
}
|
||||
|
||||
ID3v1::Tag *MPEG::File::ID3v1Tag(bool create)
|
||||
|
@ -167,7 +167,7 @@ void RIFF::AIFF::File::read(bool readProperties)
|
||||
}
|
||||
|
||||
if(!d->tag)
|
||||
d->tag = std::make_unique<ID3v2::Tag>();
|
||||
d->tag = std::make_unique<ID3v2::Tag>(nullptr, 0, d->ID3v2FrameFactory);
|
||||
|
||||
if(readProperties)
|
||||
d->properties = std::make_unique<Properties>(this, Properties::Average);
|
||||
|
@ -113,7 +113,7 @@ void RIFF::WAV::File::strip(TagTypes tags)
|
||||
removeTagChunks(tags);
|
||||
|
||||
if(tags & ID3v2)
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag());
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag(nullptr, 0, d->ID3v2FrameFactory));
|
||||
|
||||
if(tags & Info)
|
||||
d->tag.set(InfoIndex, new RIFF::Info::Tag());
|
||||
@ -224,7 +224,7 @@ void RIFF::WAV::File::read(bool readProperties)
|
||||
}
|
||||
|
||||
if(!d->tag[ID3v2Index])
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag());
|
||||
d->tag.set(ID3v2Index, new ID3v2::Tag(nullptr, 0, d->ID3v2FrameFactory));
|
||||
|
||||
if(!d->tag[InfoIndex])
|
||||
d->tag.set(InfoIndex, new RIFF::Info::Tag());
|
||||
|
@ -92,6 +92,15 @@ namespace TagLib {
|
||||
return static_cast<T *>(tag(index));
|
||||
}
|
||||
|
||||
template <class T, class F> T *access(int index, bool create, const F *factory)
|
||||
{
|
||||
if(!create || tag(index))
|
||||
return static_cast<T *>(tag(index));
|
||||
|
||||
set(index, new T(nullptr, 0, factory));
|
||||
return static_cast<T *>(tag(index));
|
||||
}
|
||||
|
||||
private:
|
||||
TagUnion(const Tag &);
|
||||
TagUnion &operator=(const Tag &);
|
||||
|
@ -217,7 +217,8 @@ ID3v1::Tag *TrueAudio::File::ID3v1Tag(bool create)
|
||||
|
||||
ID3v2::Tag *TrueAudio::File::ID3v2Tag(bool create)
|
||||
{
|
||||
return d->tag.access<ID3v2::Tag>(TrueAudioID3v2Index, create);
|
||||
return d->tag.access<ID3v2::Tag>(TrueAudioID3v2Index, create,
|
||||
d->ID3v2FrameFactory);
|
||||
}
|
||||
|
||||
void TrueAudio::File::strip(int tags)
|
||||
|
Loading…
Reference in New Issue
Block a user