diff --git a/3rdparty/taglib/CMakeLists.txt b/3rdparty/taglib/CMakeLists.txt index 11fc1dded..6519e2169 100644 --- a/3rdparty/taglib/CMakeLists.txt +++ b/3rdparty/taglib/CMakeLists.txt @@ -93,6 +93,7 @@ set(tag_HDRS mpeg/xingheader.h mpeg/id3v1/id3v1tag.h mpeg/id3v1/id3v1genres.h + mpeg/id3v2/id3v2.h mpeg/id3v2/id3v2extendedheader.h mpeg/id3v2/id3v2frame.h mpeg/id3v2/id3v2header.h diff --git a/3rdparty/taglib/ape/apefile.h b/3rdparty/taglib/ape/apefile.h index 4975b1e45..dc80b5c87 100644 --- a/3rdparty/taglib/ape/apefile.h +++ b/3rdparty/taglib/ape/apefile.h @@ -57,12 +57,12 @@ namespace TagLib { namespace APE { - //! An implementation of Strawberry_TagLib::TagLib::File with APE specific methods + //! An implementation of TagLib::File with APE specific methods /*! * This implements and provides an interface for APE files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to APE files. */ diff --git a/3rdparty/taglib/ape/apeproperties.h b/3rdparty/taglib/ape/apeproperties.h index 20b7a0dc3..710240c37 100644 --- a/3rdparty/taglib/ape/apeproperties.h +++ b/3rdparty/taglib/ape/apeproperties.h @@ -56,7 +56,7 @@ namespace TagLib { * * \deprecated */ - Properties(File *file, ReadStyle style = Average); + TAGLIB_DEPRECATED Properties(File *file, ReadStyle style = Average); /*! * Create an instance of APE::Properties with the data read from the @@ -77,7 +77,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/asf/asfattribute.h b/3rdparty/taglib/asf/asfattribute.h index 6c79618bc..a83f20e24 100644 --- a/3rdparty/taglib/asf/asfattribute.h +++ b/3rdparty/taglib/asf/asfattribute.h @@ -81,7 +81,7 @@ namespace TagLib * only one may be of type 1 and only one may be of type 2. * * The specification also states that the description of the picture can be no longer than 64 characters, but can be empty. - * WM/Picture attributes added with Strawberry_TagLib::TagLib::ASF are not automatically validated to conform to ID3 specifications. + * WM/Picture attributes added with TagLib::ASF are not automatically validated to conform to ID3 specifications. * You must add code in your application to perform validations if you want to maintain complete compatibility with ID3. */ Attribute(const Picture &value); diff --git a/3rdparty/taglib/asf/asffile.h b/3rdparty/taglib/asf/asffile.h index f5f9fe784..8c978be0c 100644 --- a/3rdparty/taglib/asf/asffile.h +++ b/3rdparty/taglib/asf/asffile.h @@ -40,8 +40,8 @@ namespace TagLib { /*! * This implements and provides an interface for ASF files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to ASF files. */ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File @@ -80,7 +80,7 @@ namespace TagLib { * Returns a pointer to the ASF tag of the file. * * ASF::Tag implements the tag interface, so this serves as the - * reimplementation of Strawberry_TagLib::TagLib::File::tag(). + * reimplementation of TagLib::File::tag(). * * \note The Tag is still owned by the ASF::File and should not be * deleted by the user. It will be deleted when the file (object) is diff --git a/3rdparty/taglib/asf/asftag.h b/3rdparty/taglib/asf/asftag.h index 3c43ae5f9..aff74be30 100644 --- a/3rdparty/taglib/asf/asftag.h +++ b/3rdparty/taglib/asf/asftag.h @@ -161,6 +161,7 @@ namespace TagLib { * Returns a reference to the item list map. This is an AttributeListMap of * all of the items in the tag. */ + // BIC: return by value const AttributeListMap &attributeListMap() const; /*! diff --git a/3rdparty/taglib/audioproperties.h b/3rdparty/taglib/audioproperties.h index d07f2f9c3..97fac396a 100644 --- a/3rdparty/taglib/audioproperties.h +++ b/3rdparty/taglib/audioproperties.h @@ -36,7 +36,7 @@ namespace TagLib { /*! * The values here are common to most audio formats. For more specific, codec * dependent values, please see see the subclasses APIs. This is meant to - * compliment the Strawberry_TagLib::TagLib::File and Strawberry_TagLib::TagLib::Tag APIs in providing a simple + * compliment the TagLib::File and TagLib::Tag APIs in providing a simple * interface that is sufficient for most applications. */ diff --git a/3rdparty/taglib/dsdiff/dsdifffile.cpp b/3rdparty/taglib/dsdiff/dsdifffile.cpp index 153557704..636c5943c 100644 --- a/3rdparty/taglib/dsdiff/dsdifffile.cpp +++ b/3rdparty/taglib/dsdiff/dsdifffile.cpp @@ -33,18 +33,45 @@ #include "tagunion.h" #include "dsdifffile.h" -using namespace Strawberry_TagLib::TagLib; +#include -struct Chunk64 -{ - ByteVector name; - unsigned long long offset; - unsigned long long size; - char padding; -}; +using namespace Strawberry_TagLib::TagLib; namespace { + struct Chunk64 + { + ByteVector name; + unsigned long long offset; + unsigned long long size; + char padding; + }; + + typedef std::vector ChunkList; + + int chunkIndex(const ChunkList &chunks, const ByteVector &id) + { + for(int i = 0; i < chunks.size(); i++) { + if(chunks[i].name == id) + return i; + } + + return -1; + } + + bool isValidChunkID(const ByteVector &name) + { + if(name.size() != 4) + return false; + + for(int i = 0; i < 4; i++) { + if(name[i] < 32 || name[i] > 127) + return false; + } + + return true; + } + enum { ID3v2Index = 0, DIINIndex = 1 @@ -59,14 +86,14 @@ class DSDIFF::File::FilePrivate { public: FilePrivate() : - endianness(BigEndian), - size(0), - isID3InPropChunk(false), - duplicateID3V2chunkIndex(-1), - properties(0), - id3v2TagChunkID("ID3 "), - hasID3v2(false), - hasDiin(false) + endianness(BigEndian), + size(0), + isID3InPropChunk(false), + duplicateID3V2chunkIndex(-1), + properties(0), + id3v2TagChunkID("ID3 "), + hasID3v2(false), + hasDiin(false) { childChunkIndex[ID3v2Index] = -1; childChunkIndex[DIINIndex] = -1; @@ -81,12 +108,18 @@ public: ByteVector type; unsigned long long size; ByteVector format; - std::vector chunks; - std::vector childChunks[2]; - int childChunkIndex[2]; - bool isID3InPropChunk; // Two possibilities can be found: ID3V2 chunk inside PROP chunk or at root level - int duplicateID3V2chunkIndex; // 2 ID3 chunks are present. This is then the index of the one in - // PROP chunk that will be removed upon next save to remove duplicates. + ChunkList chunks; + std::array childChunks; + std::array childChunkIndex; + /* + * Two possibilities can be found: ID3V2 chunk inside PROP chunk or at root level + */ + bool isID3InPropChunk; + /* + * ID3 chunks are present. This is then the index of the one in PROP chunk that + * will be removed upon next save to remove duplicates. + */ + int duplicateID3V2chunkIndex; Properties *properties; @@ -142,9 +175,9 @@ Strawberry_TagLib::TagLib::Tag *DSDIFF::File::tag() const return &d->tag; } -ID3v2::Tag *DSDIFF::File::ID3v2Tag() const +ID3v2::Tag *DSDIFF::File::ID3v2Tag(bool create) const { - return d->tag.access(ID3v2Index, false); + return d->tag.access(ID3v2Index, create); } bool DSDIFF::File::hasID3v2Tag() const @@ -152,9 +185,9 @@ bool DSDIFF::File::hasID3v2Tag() const return d->hasID3v2; } -DSDIFF::DIIN::Tag *DSDIFF::File::DIINTag() const +DSDIFF::DIIN::Tag *DSDIFF::File::DIINTag(bool create) const { - return d->tag.access(DIINIndex, false); + return d->tag.access(DIINIndex, create); } bool DSDIFF::File::hasDIINTag() const @@ -190,6 +223,11 @@ DSDIFF::Properties *DSDIFF::File::audioProperties() const } bool DSDIFF::File::save() +{ + return save(AllTags); +} + +bool DSDIFF::File::save(TagTypes tags, StripTags strip, ID3v2::Version version) { if(readOnly()) { debug("DSDIFF::File::save() -- File is read only."); @@ -201,36 +239,44 @@ bool DSDIFF::File::save() return false; } + //if(strip == StripOthers || strip == StripAll) + //File::strip(static_cast(AllTags & ~tags)); + // First: save ID3V2 chunk + ID3v2::Tag *id3v2Tag = d->tag.access(ID3v2Index, false); - if(d->isID3InPropChunk) { - if(id3v2Tag != NULL && !id3v2Tag->isEmpty()) { - setChildChunkData(d->id3v2TagChunkID, id3v2Tag->render(), PROPChunk); - d->hasID3v2 = true; + + if(tags & ID3v2 && id3v2Tag) { + if(d->isID3InPropChunk) { + if(id3v2Tag && !id3v2Tag->isEmpty()) { + setChildChunkData(d->id3v2TagChunkID, id3v2Tag->render(version), PROPChunk); + d->hasID3v2 = true; + } + else { + // Empty tag: remove it + setChildChunkData(d->id3v2TagChunkID, ByteVector(), PROPChunk); + d->hasID3v2 = false; + } } else { - // Empty tag: remove it - setChildChunkData(d->id3v2TagChunkID, ByteVector(), PROPChunk); - d->hasID3v2 = false; - } - } - else { - if(id3v2Tag != NULL && !id3v2Tag->isEmpty()) { - setRootChunkData(d->id3v2TagChunkID, id3v2Tag->render()); - d->hasID3v2 = true; - } - else { - // Empty tag: remove it - setRootChunkData(d->id3v2TagChunkID, ByteVector()); - d->hasID3v2 = false; + if(id3v2Tag && !id3v2Tag->isEmpty()) { + setRootChunkData(d->id3v2TagChunkID, id3v2Tag->render(version)); + d->hasID3v2 = true; + } + else { + // Empty tag: remove it + setRootChunkData(d->id3v2TagChunkID, ByteVector()); + d->hasID3v2 = false; + } } } // Second: save the DIIN chunk - if(d->hasDiin) { - DSDIFF::DIIN::Tag *diinTag = d->tag.access(DIINIndex, false); - if(!diinTag->title().isNull() && !diinTag->title().isEmpty()) { + DSDIFF::DIIN::Tag *diinTag = d->tag.access(DIINIndex, false); + + if(tags & DIIN && diinTag) { + if(!diinTag->title().isEmpty()) { ByteVector diinTitle; diinTitle.append(ByteVector::fromUInt(diinTag->title().size(), d->endianness == BigEndian)); diinTitle.append(ByteVector::fromCString(diinTag->title().toCString())); @@ -239,7 +285,7 @@ bool DSDIFF::File::save() else setChildChunkData("DITI", ByteVector(), DIINChunk); - if(!diinTag->artist().isNull() && !diinTag->artist().isEmpty()) { + if(!diinTag->artist().isEmpty()) { ByteVector diinArtist; diinArtist.append(ByteVector::fromUInt(diinTag->artist().size(), d->endianness == BigEndian)); diinArtist.append(ByteVector::fromCString(diinTag->artist().toCString())); @@ -258,46 +304,80 @@ bool DSDIFF::File::save() return true; } +void DSDIFF::File::strip(TagTypes tags) +{ + if(tags & ID3v2) { + removeRootChunk("ID3 "); + removeRootChunk("id3 "); + d->hasID3v2 = false; + d->tag.set(ID3v2Index, new ID3v2::Tag); + + /// TODO: needs to also account for ID3v2 tags under the PROP chunk + } + if(tags & DIIN) { + removeRootChunk("DITI"); + removeRootChunk("DIAR"); + d->hasDiin = false; + d->tag.set(DIINIndex, new DIIN::Tag); + } +} + //////////////////////////////////////////////////////////////////////////////// // private members //////////////////////////////////////////////////////////////////////////////// -void DSDIFF::File::setRootChunkData(unsigned int i, const ByteVector &data) +void DSDIFF::File::removeRootChunk(unsigned int i) { - if(data.isNull() || data.isEmpty()) { - // Null data: remove chunk - // Update global size - unsigned long long removedChunkTotalSize = d->chunks[i].size + d->chunks[i].padding + 12; - d->size -= removedChunkTotalSize; + unsigned long long chunkSize = d->chunks[i].size + d->chunks[i].padding + 12; + + d->size -= chunkSize; insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); - removeBlock(d->chunks[i].offset - 12, removedChunkTotalSize); + removeBlock(d->chunks[i].offset - 12, chunkSize); // Update the internal offsets + for(unsigned long r = i + 1; r < d->chunks.size(); r++) d->chunks[r].offset = d->chunks[r - 1].offset + 12 + d->chunks[r - 1].size + d->chunks[r - 1].padding; d->chunks.erase(d->chunks.begin() + i); +} + +void DSDIFF::File::removeRootChunk(const ByteVector &id) +{ + int i = chunkIndex(d->chunks, id); + + if(i >= 0) + removeRootChunk(i); +} + +void DSDIFF::File::setRootChunkData(unsigned int i, const ByteVector &data) +{ + if(data.isEmpty()) { + removeRootChunk(i); + return; } - else { - // Non null data: update chunk - // First we update the global size - d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding); - insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); - // Now update the specific chunk - writeChunk(d->chunks[i].name, - data, - d->chunks[i].offset - 12, - d->chunks[i].size + d->chunks[i].padding + 12); + // Non null data: update chunk + // First we update the global size - d->chunks[i].size = data.size(); - d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0; + d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding); + insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); - // Finally update the internal offsets - updateRootChunksStructure(i + 1); - } + // Now update the specific chunk + + writeChunk(d->chunks[i].name, + data, + d->chunks[i].offset - 12, + d->chunks[i].size + d->chunks[i].padding + 12); + + d->chunks[i].size = data.size(); + d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0; + + // Finally update the internal offsets + + updateRootChunksStructure(i + 1); } void DSDIFF::File::setRootChunkData(const ByteVector &name, const ByteVector &data) @@ -307,15 +387,15 @@ void DSDIFF::File::setRootChunkData(const ByteVector &name, const ByteVector &da return; } - for(unsigned int i = 0; i < d->chunks.size(); i++) { - if(d->chunks[i].name == name) { - setRootChunkData(i, data); - return; - } + int i = chunkIndex(d->chunks, name); + + if(i >= 0) { + setRootChunkData(i, data); + return; } // Couldn't find an existing chunk, so let's create a new one. - unsigned int i = d->chunks.size() - 1; + i = d->chunks.size() - 1; unsigned long offset = d->chunks[i].offset + d->chunks[i].size + d->chunks[i].padding; // First we update the global size @@ -338,28 +418,29 @@ void DSDIFF::File::setRootChunkData(const ByteVector &name, const ByteVector &da d->chunks.push_back(chunk); } -void DSDIFF::File::setChildChunkData(unsigned int i, - const ByteVector &data, - unsigned int childChunkNum) +void DSDIFF::File::removeChildChunk(unsigned int i, unsigned int childChunkNum) { - std::vector &childChunks = d->childChunks[childChunkNum]; + ChunkList &childChunks = d->childChunks[childChunkNum]; - if(data.isNull() || data.isEmpty()) { - // Null data: remove chunk // Update global size + unsigned long long removedChunkTotalSize = childChunks[i].size + childChunks[i].padding + 12; d->size -= removedChunkTotalSize; insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); + // Update child chunk size + d->chunks[d->childChunkIndex[childChunkNum]].size -= removedChunkTotalSize; insert(ByteVector::fromLongLong(d->chunks[d->childChunkIndex[childChunkNum]].size, d->endianness == BigEndian), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8); // Remove the chunk + removeBlock(childChunks[i].offset - 12, removedChunkTotalSize); // Update the internal offsets // For child chunks + if((i + 1) < childChunks.size()) { childChunks[i + 1].offset = childChunks[i].offset; i++; @@ -369,49 +450,65 @@ void DSDIFF::File::setChildChunkData(unsigned int i, } // And for root chunks + for(i = d->childChunkIndex[childChunkNum] + 1; i < d->chunks.size(); i++) d->chunks[i].offset = d->chunks[i - 1].offset + 12 + d->chunks[i - 1].size + d->chunks[i - 1].padding; childChunks.erase(childChunks.begin() + i); +} + +void DSDIFF::File::setChildChunkData(unsigned int i, + const ByteVector &data, + unsigned int childChunkNum) +{ + ChunkList &childChunks = d->childChunks[childChunkNum]; + + if(data.isEmpty()) { + removeChildChunk(i, childChunkNum); + return; } - else { - // Non null data: update chunk - // First we update the global size - d->size += ((data.size() + 1) & ~1) - (childChunks[i].size + childChunks[i].padding); - insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); - // And the PROP chunk size - d->chunks[d->childChunkIndex[childChunkNum]].size += ((data.size() + 1) & ~1) - - (childChunks[i].size + childChunks[i].padding); - insert(ByteVector::fromLongLong(d->chunks[d->childChunkIndex[childChunkNum]].size, - d->endianness == BigEndian), - d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8); - // Now update the specific chunk - writeChunk(childChunks[i].name, - data, - childChunks[i].offset - 12, - childChunks[i].size + childChunks[i].padding + 12); + // Non null data: update chunk + // First we update the global size - childChunks[i].size = data.size(); - childChunks[i].padding = (data.size() & 0x01) ? 1 : 0; + d->size += ((data.size() + 1) & ~1) - (childChunks[i].size + childChunks[i].padding); - // Now update the internal offsets - // For child Chunks - for(i++; i < childChunks.size(); i++) - childChunks[i].offset = childChunks[i - 1].offset + 12 - + childChunks[i - 1].size + childChunks[i - 1].padding; + insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); - // And for root chunks - updateRootChunksStructure(d->childChunkIndex[childChunkNum] + 1); - } + // And the PROP chunk size + + d->chunks[d->childChunkIndex[childChunkNum]].size += + ((data.size() + 1) & ~1) - (childChunks[i].size + childChunks[i].padding); + insert(ByteVector::fromLongLong(d->chunks[d->childChunkIndex[childChunkNum]].size, + d->endianness == BigEndian), + d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8); + + // Now update the specific chunk + + writeChunk(childChunks[i].name, + data, + childChunks[i].offset - 12, + childChunks[i].size + childChunks[i].padding + 12); + + childChunks[i].size = data.size(); + childChunks[i].padding = (data.size() & 0x01) ? 1 : 0; + + // Now update the internal offsets + // For child Chunks + for(i++; i < childChunks.size(); i++) + childChunks[i].offset = childChunks[i - 1].offset + 12 + + childChunks[i - 1].size + childChunks[i - 1].padding; + + // And for root chunks + updateRootChunksStructure(d->childChunkIndex[childChunkNum] + 1); } void DSDIFF::File::setChildChunkData(const ByteVector &name, const ByteVector &data, unsigned int childChunkNum) { - std::vector &childChunks = d->childChunks[childChunkNum]; + ChunkList &childChunks = d->childChunks[childChunkNum]; if(childChunks.size() == 0) { debug("DSDIFF::File::setPropChunkData - No valid chunks found."); @@ -426,17 +523,22 @@ void DSDIFF::File::setChildChunkData(const ByteVector &name, } // Do not attempt to remove a non existing chunk - if(data.isNull() || data.isEmpty()) + + if(data.isEmpty()) return; // Couldn't find an existing chunk, so let's create a new one. + unsigned int i = childChunks.size() - 1; unsigned long offset = childChunks[i].offset + childChunks[i].size + childChunks[i].padding; // First we update the global size + d->size += (offset & 1) + ((data.size() + 1) & ~1) + 12; insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8); + // And the child chunk size + d->chunks[d->childChunkIndex[childChunkNum]].size += (offset & 1) + ((data.size() + 1) & ~1) + 12; insert(ByteVector::fromLongLong(d->chunks[d->childChunkIndex[childChunkNum]].size, @@ -444,6 +546,7 @@ void DSDIFF::File::setChildChunkData(const ByteVector &name, d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8); // Now add the chunk to the file + unsigned long long nextRootChunkIdx = length(); if((d->childChunkIndex[childChunkNum] + 1) < static_cast(d->chunks.size())) nextRootChunkIdx = d->chunks[d->childChunkIndex[childChunkNum] + 1].offset - 12; @@ -453,6 +556,7 @@ void DSDIFF::File::setChildChunkData(const ByteVector &name, (offset & 1) ? 1 : 0); // For root chunks + updateRootChunksStructure(d->childChunkIndex[childChunkNum] + 1); Chunk64 chunk; @@ -464,19 +568,6 @@ void DSDIFF::File::setChildChunkData(const ByteVector &name, childChunks.push_back(chunk); } -static bool isValidChunkID(const ByteVector &name) -{ - if(name.size() != 4) - return false; - - for(int i = 0; i < 4; i++) { - if(name[i] < 32 || name[i] > 127) - return false; - } - - return true; -} - void DSDIFF::File::updateRootChunksStructure(unsigned int startingChunk) { for(unsigned int i = startingChunk; i < d->chunks.size(); i++) @@ -484,17 +575,19 @@ void DSDIFF::File::updateRootChunksStructure(unsigned int startingChunk) + d->chunks[i - 1].size + d->chunks[i - 1].padding; // Update childchunks structure as well + if(d->childChunkIndex[PROPChunk] >= static_cast(startingChunk)) { - std::vector &childChunksToUpdate = d->childChunks[PROPChunk]; + ChunkList &childChunksToUpdate = d->childChunks[PROPChunk]; if(childChunksToUpdate.size() > 0) { childChunksToUpdate[0].offset = d->chunks[d->childChunkIndex[PROPChunk]].offset + 12; for(unsigned int i = 1; i < childChunksToUpdate.size(); i++) childChunksToUpdate[i].offset = childChunksToUpdate[i - 1].offset + 12 + childChunksToUpdate[i - 1].size + childChunksToUpdate[i - 1].padding; } + } if(d->childChunkIndex[DIINChunk] >= static_cast(startingChunk)) { - std::vector &childChunksToUpdate = d->childChunks[DIINChunk]; + ChunkList &childChunksToUpdate = d->childChunks[DIINChunk]; if(childChunksToUpdate.size() > 0) { childChunksToUpdate[0].offset = d->chunks[d->childChunkIndex[DIINChunk]].offset + 12; for(unsigned int i = 1; i < childChunksToUpdate.size(); i++) @@ -513,6 +606,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty d->format = readBlock(4); // + 12: chunk header at least, fix for additional junk bytes + while(tell() + 12 <= length()) { ByteVector chunkName = readBlock(4); unsigned long long chunkSize = readBlock(8).toLongLong(bigEndian); @@ -523,7 +617,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty break; } - if(static_cast(tell()) + chunkSize > static_cast(length())) { + if(static_cast(tell()) + chunkSize > + static_cast(length())) { debug("DSDIFF::File::read() -- Chunk '" + chunkName + "' has invalid size (larger than the file size)"); setValid(false); @@ -538,6 +633,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty seek(chunk.size, Current); // Check padding + chunk.padding = 0; long uPosNotPadded = tell(); if((uPosNotPadded & 0x01) != 0) { @@ -551,10 +647,14 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty d->chunks.push_back(chunk); } - unsigned long long lengthDSDSamplesTimeChannels = 0; // For DSD uncompressed - unsigned long long audioDataSizeinBytes = 0; // For computing bitrate - unsigned long dstNumFrames = 0; // For DST compressed frames - unsigned short dstFrameRate = 0; // For DST compressed frames + // For DSD uncompressed + unsigned long long lengthDSDSamplesTimeChannels = 0; + // For computing bitrate + unsigned long long audioDataSizeinBytes = 0; + // For DST compressed frames + unsigned long dstNumFrames = 0; + // For DST compressed frames + unsigned short dstFrameRate = 0; for(unsigned int i = 0; i < d->chunks.size(); i++) { if(d->chunks[i].name == "DSD ") { @@ -589,7 +689,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty // Found the DST frame information chunk dstNumFrames = readBlock(4).toUInt(bigEndian); dstFrameRate = readBlock(2).toUShort(bigEndian); - break; // Found the wanted one, no need to look at the others + // Found the wanted one, no need to look at the others + break; } seek(dstChunkSize, Current); @@ -608,7 +709,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty d->childChunkIndex[PROPChunk] = i; // Now decodes the chunks inside the PROP chunk long long propChunkEnd = d->chunks[i].offset + d->chunks[i].size; - seek(d->chunks[i].offset + 4); // +4 to remove the 'SND ' marker at beginning of 'PROP' chunk + // +4 to remove the 'SND ' marker at beginning of 'PROP' chunk + seek(d->chunks[i].offset + 4); while(tell() + 12 <= propChunkEnd) { ByteVector propChunkName = readBlock(4); long long propChunkSize = readBlock(8).toLongLong(bigEndian); @@ -650,7 +752,9 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty else if(d->chunks[i].name == "DIIN") { d->childChunkIndex[DIINChunk] = i; d->hasDiin = true; + // Now decode the chunks inside the DIIN chunk + long long diinChunkEnd = d->chunks[i].offset + d->chunks[i].size; seek(d->chunks[i].offset); @@ -679,8 +783,10 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty seek(chunk.size, Current); // Check padding + chunk.padding = 0; long uPosNotPadded = tell(); + if((uPosNotPadded & 0x01) != 0) { ByteVector iByte = readBlock(1); if((iByte.size() != 1) || (iByte[0] != 0)) @@ -715,10 +821,12 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty unsigned short channels=0; for(unsigned int i = 0; i < d->childChunks[PROPChunk].size(); i++) { - if(d->childChunks[PROPChunk][i].name == "ID3 " || d->childChunks[PROPChunk][i].name == "id3 ") { + if(d->childChunks[PROPChunk][i].name == "ID3 " || + d->childChunks[PROPChunk][i].name == "id3 ") { if(d->hasID3v2) { d->duplicateID3V2chunkIndex = i; - continue; // ID3V2 tag has already been found at root level + // ID3V2 tag has already been found at root level + continue; } d->id3v2TagChunkID = d->childChunks[PROPChunk][i].name; d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->childChunks[PROPChunk][i].offset)); @@ -738,6 +846,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty } // Read title & artist from DIIN chunk + d->tag.access(DIINIndex, true); if(d->hasDiin) { @@ -765,8 +874,9 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty if(lengthDSDSamplesTimeChannels == 0) { // DST compressed signal : need to compute length of DSD uncompressed frames if(dstFrameRate > 0) - lengthDSDSamplesTimeChannels = (unsigned long long)dstNumFrames - * (unsigned long long)sampleRate / (unsigned long long)dstFrameRate; + lengthDSDSamplesTimeChannels = (unsigned long long) dstNumFrames * + (unsigned long long) sampleRate / + (unsigned long long) dstFrameRate; else lengthDSDSamplesTimeChannels = 0; } @@ -777,7 +887,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty } int bitrate = 0; if(lengthDSDSamplesTimeChannels > 0) - bitrate = (audioDataSizeinBytes*8*sampleRate) / lengthDSDSamplesTimeChannels / 1000; + bitrate = (audioDataSizeinBytes * 8 * sampleRate) / lengthDSDSamplesTimeChannels / 1000; d->properties = new Properties(sampleRate, channels, @@ -788,7 +898,8 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty if(!ID3v2Tag()) { d->tag.access(ID3v2Index, true); - d->isID3InPropChunk = false; // By default, ID3 chunk is at root level + // By default, ID3 chunk is at root level + d->isID3InPropChunk = false; d->hasID3v2 = false; } } diff --git a/3rdparty/taglib/dsdiff/dsdifffile.h b/3rdparty/taglib/dsdiff/dsdifffile.h index 95f256467..e881c7cdb 100644 --- a/3rdparty/taglib/dsdiff/dsdifffile.h +++ b/3rdparty/taglib/dsdiff/dsdifffile.h @@ -41,7 +41,7 @@ namespace TagLib { * * This supports an ID3v2 tag as well as reading stream from the ID3 RIFF * chunk as well as properties from the file. - * Description of the DSDIFF format is available + * Description of the DSDIFF format is available * at http://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf * DSDIFF standard does not explicitly specify the ID3V2 chunk * It can be found at the root level, but also sometimes inside the PROP chunk @@ -50,18 +50,34 @@ namespace TagLib { namespace DSDIFF { - //! An implementation of Strawberry_TagLib::TagLib::File with DSDIFF specific methods + //! An implementation of TagLib::File with DSDIFF specific methods /*! * This implements and provides an interface for DSDIFF files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to DSDIFF files. */ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File { public: + + /*! + * This set of flags is used for various operations and is suitable for + * being OR-ed together. + */ + enum TagTypes { + //! Empty set. Matches no tag types. + NoTags = 0x0000, + //! Matches DIIN tags. + DIIN = 0x0002, + //! Matches ID3v1 tags. + ID3v2 = 0x0002, + //! Matches all tag types. + AllTags = 0xffff + }; + /*! * Constructs an DSDIFF file from \a file. If \a readProperties is true * the file's audio properties will also be read. @@ -115,13 +131,13 @@ namespace TagLib { * * \see hasID3v2Tag() */ - virtual ID3v2::Tag *ID3v2Tag() const; + ID3v2::Tag *ID3v2Tag(bool create = false) const; /*! * Returns the DSDIFF DIIN Tag for this file * */ - DSDIFF::DIIN::Tag *DIINTag() const; + DSDIFF::DIIN::Tag *DIINTag(bool create = false) const; /*! * Implements the unified property interface -- export function. @@ -161,15 +177,21 @@ namespace TagLib { virtual bool save(); /*! - * Save the file. This will attempt to save all of the tag types that are - * specified by OR-ing together TagTypes values. The save() method above - * uses AllTags. This returns true if saving was successful. - * - * This strips all tags not included in the mask, but does not modify them - * in memory, so later calls to save() which make use of these tags will - * remain valid. This also strips empty tags. + * Save the file. If \a strip is specified, it is possible to choose if + * tags not specified in \a tags should be stripped from the file or + * retained. With \a version, it is possible to specify whether ID3v2.4 + * or ID3v2.3 should be used. */ - bool save(int tags); + bool save(TagTypes tags, StripTags strip = StripOthers, ID3v2::Version version = ID3v2::v4); + + /*! + * This will strip the tags that match the OR-ed together TagTypes from the + * file. By default it strips all tags. It returns true if the tags are + * successfully stripped. + * + * \note This will update the file immediately. + */ + void strip(TagTypes tags = AllTags); /*! * Returns whether or not the file on disk actually has an ID3v2 tag. @@ -179,8 +201,8 @@ namespace TagLib { bool hasID3v2Tag() const; /*! - * Returns whether or not the file on disk actually has the DSDIFF - * Title & Artist tag. + * Returns whether or not the file on disk actually has the DSDIFF + * title and artist tags. * * \see DIINTag() */ @@ -205,6 +227,10 @@ namespace TagLib { File(const File &); File &operator=(const File &); + void removeRootChunk(const ByteVector &id); + void removeRootChunk(unsigned int chunk); + void removeChildChunk(unsigned int i, unsigned int chunk); + /*! * Sets the data for the the specified chunk at root level to \a data. * diff --git a/3rdparty/taglib/fileref.h b/3rdparty/taglib/fileref.h index fa104a74b..8eac42562 100644 --- a/3rdparty/taglib/fileref.h +++ b/3rdparty/taglib/fileref.h @@ -42,7 +42,7 @@ namespace TagLib { /*! * FileRef exists to provide a minimal, generic and value-based wrapper around * a File. It is lightweight and implicitly shared, and as such suitable for - * pass-by-value use. This hides some of the uglier details of Strawberry_TagLib::TagLib::File + * pass-by-value use. This hides some of the uglier details of TagLib::File * and the non-generic portions of the concrete file implementations. * * This class is useful in a "simple usage" situation where it is desirable diff --git a/3rdparty/taglib/flac/flacfile.h b/3rdparty/taglib/flac/flacfile.h index 00b995b0c..164aff555 100644 --- a/3rdparty/taglib/flac/flacfile.h +++ b/3rdparty/taglib/flac/flacfile.h @@ -55,12 +55,12 @@ namespace TagLib { namespace FLAC { - //! An implementation of Strawberry_TagLib::TagLib::File with FLAC specific methods + //! An implementation of TagLib::File with FLAC specific methods /*! * This implements and provides an interface for FLAC files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to FLAC files. */ @@ -241,7 +241,7 @@ namespace TagLib { * \see ID3v2FrameFactory * \deprecated This value should be passed in via the constructor */ - void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); + TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); /*! * Returns the block of data used by FLAC::Properties for parsing the @@ -249,7 +249,7 @@ namespace TagLib { * * \deprecated Always returns an empty vector. */ - ByteVector streamInfoData(); // BIC: remove + TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove /*! * Returns the length of the audio-stream, used by FLAC::Properties for @@ -257,7 +257,7 @@ namespace TagLib { * * \deprecated Always returns zero. */ - long streamLength(); // BIC: remove + TAGLIB_DEPRECATED long streamLength(); // BIC: remove /*! * Returns a list of pictures attached to the FLAC file. diff --git a/3rdparty/taglib/flac/flacproperties.h b/3rdparty/taglib/flac/flacproperties.h index 4019115d0..6a2363372 100644 --- a/3rdparty/taglib/flac/flacproperties.h +++ b/3rdparty/taglib/flac/flacproperties.h @@ -73,7 +73,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to @@ -121,7 +121,7 @@ namespace TagLib { * * \deprecated */ - int sampleWidth() const; + TAGLIB_DEPRECATED int sampleWidth() const; /*! * Return the number of sample frames. diff --git a/3rdparty/taglib/mp4/mp4file.h b/3rdparty/taglib/mp4/mp4file.h index 40e3ffd97..3ccfe3aef 100644 --- a/3rdparty/taglib/mp4/mp4file.h +++ b/3rdparty/taglib/mp4/mp4file.h @@ -42,8 +42,8 @@ namespace TagLib { /*! * This implements and provides an interface for MP4 files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to MP4 files. */ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File @@ -79,7 +79,7 @@ namespace TagLib { * Returns a pointer to the MP4 tag of the file. * * MP4::Tag implements the tag interface, so this serves as the - * reimplementation of Strawberry_TagLib::TagLib::File::tag(). + * reimplementation of TagLib::File::tag(). * * \note The Tag is still owned by the MP4::File and should not be * deleted by the user. It will be deleted when the file (object) is diff --git a/3rdparty/taglib/mp4/mp4properties.h b/3rdparty/taglib/mp4/mp4properties.h index 8f552666f..61d666228 100644 --- a/3rdparty/taglib/mp4/mp4properties.h +++ b/3rdparty/taglib/mp4/mp4properties.h @@ -58,7 +58,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/mp4/mp4tag.h b/3rdparty/taglib/mp4/mp4tag.h index b5f146ab2..d139f39b2 100644 --- a/3rdparty/taglib/mp4/mp4tag.h +++ b/3rdparty/taglib/mp4/mp4tag.h @@ -43,7 +43,7 @@ namespace TagLib { /*! * \deprecated */ - typedef Strawberry_TagLib::TagLib::Map ItemListMap; + TAGLIB_DEPRECATED typedef Strawberry_TagLib::TagLib::Map ItemListMap; typedef Strawberry_TagLib::TagLib::Map ItemMap; class TAGLIB_EXPORT Tag: public Strawberry_TagLib::TagLib::Tag @@ -75,7 +75,7 @@ namespace TagLib { /*! * \deprecated Use the item() and setItem() API instead */ - ItemMap &itemListMap(); + TAGLIB_DEPRECATED ItemMap &itemListMap(); /*! * Returns a string-keyed map of the MP4::Items for this tag. diff --git a/3rdparty/taglib/mpc/mpcfile.h b/3rdparty/taglib/mpc/mpcfile.h index 9f5e29b0e..0ad3fe152 100644 --- a/3rdparty/taglib/mpc/mpcfile.h +++ b/3rdparty/taglib/mpc/mpcfile.h @@ -54,12 +54,12 @@ namespace TagLib { namespace MPC { - //! An implementation of Strawberry_TagLib::TagLib::File with MPC specific methods + //! An implementation of TagLib::File with MPC specific methods /*! * This implements and provides an interface for MPC files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to MPC files. * The only invalid tag combination supported is an ID3v1 tag after an APE tag. */ @@ -199,7 +199,7 @@ namespace TagLib { * \deprecated * \see strip */ - void remove(int tags = AllTags); + TAGLIB_DEPRECATED void remove(int tags = AllTags); /*! * Returns whether or not the file on disk actually has an ID3v1 tag. diff --git a/3rdparty/taglib/mpc/mpcproperties.cpp b/3rdparty/taglib/mpc/mpcproperties.cpp index aa1818940..627b9e3f5 100644 --- a/3rdparty/taglib/mpc/mpcproperties.cpp +++ b/3rdparty/taglib/mpc/mpcproperties.cpp @@ -49,18 +49,17 @@ public: albumGain(0), albumPeak(0) {} - int version; - int length; - int bitrate; - int sampleRate; - int channels; + int version; + int length; + int bitrate; + int sampleRate; + int channels; unsigned int totalFrames; unsigned int sampleFrames; - unsigned int trackGain; - unsigned int trackPeak; - unsigned int albumGain; - unsigned int albumPeak; - String flags; + int trackGain; + int trackPeak; + int albumGain; + int albumPeak; }; //////////////////////////////////////////////////////////////////////////////// @@ -312,9 +311,9 @@ void MPC::Properties::readSV7(const ByteVector &data, long streamLength) const unsigned int gapless = data.toUInt(5, false); d->trackGain = data.toShort(14, false); - d->trackPeak = data.toShort(12, false); + d->trackPeak = data.toUShort(12, false); d->albumGain = data.toShort(18, false); - d->albumPeak = data.toShort(16, false); + d->albumPeak = data.toUShort(16, false); // convert gain info if(d->trackGain != 0) { diff --git a/3rdparty/taglib/mpc/mpcproperties.h b/3rdparty/taglib/mpc/mpcproperties.h index 7dd4bc67b..121ca29b7 100644 --- a/3rdparty/taglib/mpc/mpcproperties.h +++ b/3rdparty/taglib/mpc/mpcproperties.h @@ -75,7 +75,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/mpeg/id3v1/id3v1tag.h b/3rdparty/taglib/mpeg/id3v1/id3v1tag.h index 3b56021b8..d86f9c411 100644 --- a/3rdparty/taglib/mpeg/id3v1/id3v1tag.h +++ b/3rdparty/taglib/mpeg/id3v1/id3v1tag.h @@ -89,7 +89,7 @@ namespace TagLib { * This is an implementation of the ID3v1 format. ID3v1 is both the simplest * and most common of tag formats but is rather limited. Because of its * pervasiveness and the way that applications have been written around the - * fields that it provides, the generic Strawberry_TagLib::TagLib::Tag API is a mirror of what is + * fields that it provides, the generic TagLib::Tag API is a mirror of what is * provided by ID3v1. * * ID3v1 tags should generally only contain Latin1 information. However because diff --git a/3rdparty/taglib/mpeg/id3v2/frames/chapterframe.cpp b/3rdparty/taglib/mpeg/id3v2/frames/chapterframe.cpp index 292312410..b7103a8b5 100644 --- a/3rdparty/taglib/mpeg/id3v2/frames/chapterframe.cpp +++ b/3rdparty/taglib/mpeg/id3v2/frames/chapterframe.cpp @@ -267,7 +267,7 @@ void ChapterFrame::parseFields(const ByteVector &data) return; while(embPos < size - header()->size()) { - Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), (d->tagHeader != 0)); + Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), d->tagHeader); if(!frame) return; diff --git a/3rdparty/taglib/mpeg/id3v2/frames/relativevolumeframe.h b/3rdparty/taglib/mpeg/id3v2/frames/relativevolumeframe.h index cd7897932..cb53d7904 100644 --- a/3rdparty/taglib/mpeg/id3v2/frames/relativevolumeframe.h +++ b/3rdparty/taglib/mpeg/id3v2/frames/relativevolumeframe.h @@ -132,12 +132,12 @@ namespace TagLib { /*! * \deprecated Always returns master volume. */ - ChannelType channelType() const; + TAGLIB_DEPRECATED ChannelType channelType() const; /*! * \deprecated This method no longer has any effect. */ - void setChannelType(ChannelType t); + TAGLIB_DEPRECATED void setChannelType(ChannelType t); /* * There was a terrible API goof here, and while this can't be changed to diff --git a/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp b/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp index db3131e76..365f2751f 100644 --- a/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp +++ b/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp @@ -304,7 +304,7 @@ void TableOfContentsFrame::parseFields(const ByteVector &data) return; while(embPos < size - header()->size()) { - Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), (d->tagHeader != 0)); + Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), d->tagHeader); if(!frame) return; diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2.h b/3rdparty/taglib/mpeg/id3v2/id3v2.h new file mode 100644 index 000000000..5be5c5098 --- /dev/null +++ b/3rdparty/taglib/mpeg/id3v2/id3v2.h @@ -0,0 +1,26 @@ +#ifndef TAGLIB_ID3V2_H +#define TAGLIB_ID3V2_H + +namespace Strawberry_TagLib { +namespace TagLib { + //! An ID3v2 implementation + + /*! + * This is a relatively complete and flexible framework for working with ID3v2 + * tags. + * + * \see ID3v2::Tag + */ + namespace ID3v2 { + /*! + * Used to specify which version of the ID3 standard to use when saving tags. + */ + enum Version { + v3 = 3, //(tagHeader)); +} + +Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHeader) const { ByteVector data = origData; unsigned int version = tagHeader->majorVersion(); diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2framefactory.h b/3rdparty/taglib/mpeg/id3v2/id3v2framefactory.h index bd9d3c353..22dfe82e9 100644 --- a/3rdparty/taglib/mpeg/id3v2/id3v2framefactory.h +++ b/3rdparty/taglib/mpeg/id3v2/id3v2framefactory.h @@ -87,12 +87,17 @@ namespace TagLib { */ Frame *createFrame(const ByteVector &data, unsigned int version = 4) const; + /*! + * \deprecated + */ + // BIC: remove + Frame *createFrame(const ByteVector &data, Header *tagHeader) const; /*! * Create a frame based on \a data. \a tagHeader should be a valid * ID3v2::Header instance. */ // BIC: make virtual - Frame *createFrame(const ByteVector &data, Header *tagHeader) const; + Frame *createFrame(const ByteVector &data, const Header *tagHeader) const; /*! * After a tag has been read, this tries to rebuild some of them diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2header.cpp b/3rdparty/taglib/mpeg/id3v2/id3v2header.cpp index 8e1659ae2..0396734fc 100644 --- a/3rdparty/taglib/mpeg/id3v2/id3v2header.cpp +++ b/3rdparty/taglib/mpeg/id3v2/id3v2header.cpp @@ -207,14 +207,14 @@ void Header::parse(const ByteVector &data) if(sizeData.size() != 4) { d->tagSize = 0; - debug("Strawberry_TagLib::TagLib::ID3v2::Header::parse() - The tag size as read was 0 bytes!"); + debug("TagLib::ID3v2::Header::parse() - The tag size as read was 0 bytes!"); return; } for(ByteVector::ConstIterator it = sizeData.begin(); it != sizeData.end(); it++) { if(static_cast(*it) >= 128) { d->tagSize = 0; - debug("Strawberry_TagLib::TagLib::ID3v2::Header::parse() - One of the size bytes in the id3v2 header was greater than the allowed 128."); + debug("TagLib::ID3v2::Header::parse() - One of the size bytes in the id3v2 header was greater than the allowed 128."); return; } } diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2header.h b/3rdparty/taglib/mpeg/id3v2/id3v2header.h index c8db6e19f..5cce280d8 100644 --- a/3rdparty/taglib/mpeg/id3v2/id3v2header.h +++ b/3rdparty/taglib/mpeg/id3v2/id3v2header.h @@ -28,6 +28,7 @@ #include "tbytevector.h" #include "taglib_export.h" +#include "id3v2.h" namespace Strawberry_TagLib { namespace TagLib { diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2tag.cpp b/3rdparty/taglib/mpeg/id3v2/id3v2tag.cpp index 78e21d56d..5e2f2f92c 100644 --- a/3rdparty/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/3rdparty/taglib/mpeg/id3v2/id3v2tag.cpp @@ -462,7 +462,7 @@ PropertyMap ID3v2::Tag::setProperties(const PropertyMap &origProps) ByteVector ID3v2::Tag::render() const { - return render(4); + return render(ID3v2::v4); } void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const @@ -568,17 +568,17 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const } ByteVector ID3v2::Tag::render(int version) const +{ + return render(version == 3 ? v3 : v4); +} + +ByteVector ID3v2::Tag::render(Version version) const { // We need to render the "tag data" first so that we have to correct size to // render in the tag's header. The "tag data" -- everything that is included // in ID3v2::Header::tagSize() -- includes the extended header, frames and // padding, but does not include the tag's header or footer. - if(version != 3 && version != 4) { - debug("Unknown ID3v2 version, using ID3v2.4"); - version = 4; - } - // TODO: Render the extended header. // Downgrade the frames that ID3v2.3 doesn't support. @@ -587,7 +587,7 @@ ByteVector ID3v2::Tag::render(int version) const newFrames.setAutoDelete(true); FrameList frameList; - if(version == 4) { + if(version == v4) { frameList = d->frameList; } else { @@ -601,7 +601,7 @@ ByteVector ID3v2::Tag::render(int version) const // Loop through the frames rendering them and adding them to the tagData. for(FrameList::ConstIterator it = frameList.begin(); it != frameList.end(); it++) { - (*it)->header()->setVersion(version); + (*it)->header()->setVersion(version == v3 ? 3 : 4); if((*it)->header()->frameID().size() != 4) { debug("An ID3v2 frame of unsupported or unknown type \'" + String((*it)->header()->frameID()) + "\' has been discarded"); diff --git a/3rdparty/taglib/mpeg/id3v2/id3v2tag.h b/3rdparty/taglib/mpeg/id3v2/id3v2tag.h index 74adc3fb7..f37f06c27 100644 --- a/3rdparty/taglib/mpeg/id3v2/id3v2tag.h +++ b/3rdparty/taglib/mpeg/id3v2/id3v2tag.h @@ -33,6 +33,7 @@ #include "tmap.h" #include "taglib_export.h" +#include "id3v2.h" #include "id3v2framefactory.h" namespace Strawberry_TagLib { @@ -40,15 +41,6 @@ namespace TagLib { class File; - //! An ID3v2 implementation - - /*! - * This is a relatively complete and flexible framework for working with ID3v2 - * tags. - * - * \see ID3v2::Tag - */ - namespace ID3v2 { class Header; @@ -126,7 +118,7 @@ namespace TagLib { * heart and should not be done without much meditation on the spec. It's * rather long, but if you're planning on messing with this class and others * that deal with the details of ID3v2 (rather than the nice, safe, abstract - * Strawberry_TagLib::TagLib::Tag and friends), it's worth your time to familiarize yourself + * TagLib::Tag and friends), it's worth your time to familiarize yourself * with said spec (which is distributed with the TagLib sources). TagLib * tries to do most of the work, but with a little luck, you can still * convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a @@ -202,7 +194,7 @@ namespace TagLib { * prone to change my mind, so this gets to stay around until near a * release. */ - Footer *footer() const; + TAGLIB_DEPRECATED Footer *footer() const; /*! * Returns a reference to the frame list map. This is an FrameListMap of @@ -217,7 +209,7 @@ namespace TagLib { * beats per minute -- the TBPM frame. * * \code - * Strawberry_TagLib::TagLib::MPEG::File f("foo.mp3"); + * TagLib::MPEG::File f("foo.mp3"); * * // Check to make sure that it has an ID3v2 tag * @@ -225,7 +217,7 @@ namespace TagLib { * * // Get the list of frames for a specific frame type * - * Strawberry_TagLib::TagLib::ID3v2::FrameList l = f.ID3v2Tag()->frameListMap()["TBPM"]; + * TagLib::ID3v2::FrameList l = f.ID3v2Tag()->frameListMap()["TBPM"]; * * if(!l.isEmpty()) * std::cout << l.front()->toString() << std::endl; @@ -346,14 +338,18 @@ namespace TagLib { */ ByteVector render() const; + /*! + * \deprecated + */ + TAGLIB_DEPRECATED ByteVector render(int version) const; + /*! * Render the tag back to binary data, suitable to be written to disk. * - * The \a version parameter specifies the version of the rendered - * ID3v2 tag. It can be either 4 or 3. + * The \a version parameter specifies whether ID3v2.4 (default) or ID3v2.3 + * should be used. */ - // BIC: combine with the above method - ByteVector render(int version) const; + ByteVector render(Version version) const; /*! * Gets the current string handler that decides how the "Latin-1" data @@ -397,6 +393,9 @@ namespace TagLib { */ void setTextFrame(const ByteVector &id, const String &value); + /*! + * Dowgrade frames from ID3v2.4 (used internally and by default) to ID3v2.3 + */ void downgradeFrames(FrameList *existingFrames, FrameList *newFrames) const; private: diff --git a/3rdparty/taglib/mpeg/mpegfile.cpp b/3rdparty/taglib/mpeg/mpegfile.cpp index 032fce10c..552e27442 100644 --- a/3rdparty/taglib/mpeg/mpegfile.cpp +++ b/3rdparty/taglib/mpeg/mpegfile.cpp @@ -182,7 +182,7 @@ PropertyMap MPEG::File::setProperties(const PropertyMap &properties) { // update ID3v1 tag if it exists, but ignore the return value - if(hasID3v1Tag()) + if(ID3v1Tag()) ID3v1Tag()->setProperties(properties); return ID3v2Tag(true)->setProperties(properties); @@ -195,29 +195,35 @@ MPEG::Properties *MPEG::File::audioProperties() const bool MPEG::File::save() { - if (hasID3v1Tag() || !ID3v1Tag()->isEmpty()) { - return save(AllTags, true, 4, true); - } else { - return save(AllTags, true, 4, false); - } + return save(AllTags); } bool MPEG::File::save(int tags) { - return save(tags, true); + return save(tags, StripOthers); } bool MPEG::File::save(int tags, bool stripOthers) { - return save(tags, stripOthers, 4); + return save(tags, stripOthers ? StripOthers : StripNone, ID3v2::v4); } bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version) { - return save(tags, stripOthers, id3v2Version, true); + return save(tags, + stripOthers ? StripOthers : StripNone, + id3v2Version == 3 ? ID3v2::v3 : ID3v2::v4); } bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags) +{ + return save(tags, + stripOthers ? StripOthers : StripNone, + id3v2Version == 3 ? ID3v2::v3 : ID3v2::v4, + duplicateTags ? Duplicate : DoNotDuplicate); +} + +bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, DuplicateTags duplicate) { if(readOnly()) { debug("MPEG::File::save() -- File is read only."); @@ -226,22 +232,22 @@ bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplica // Create the tags if we've been asked to. - if(duplicateTags) { + if(duplicate == Duplicate) { // Copy the values from the tag that does exist into the new tag, // except if the existing tag is to be stripped. - if((tags & ID3v2) && ID3v1Tag() && !(stripOthers && !(tags & ID3v1))) + if((tags & ID3v2) && ID3v1Tag() && !(strip == StripOthers && !(tags & ID3v1))) Tag::duplicate(ID3v1Tag(), ID3v2Tag(true), false); - if((tags & ID3v1) && d->tag[ID3v2Index] && !(stripOthers && !(tags & ID3v2))) + if((tags & ID3v1) && d->tag[ID3v2Index] && !(strip == StripOthers && !(tags & ID3v2))) Tag::duplicate(ID3v2Tag(), ID3v1Tag(true), false); } // Remove all the tags not going to be saved. - if(stripOthers) - strip(~tags, false); + if(strip == StripOthers) + File::strip(~tags, false); if(ID3v2 & tags) { @@ -252,7 +258,7 @@ bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplica if(d->ID3v2Location < 0) d->ID3v2Location = 0; - const ByteVector data = ID3v2Tag()->render(id3v2Version); + const ByteVector data = ID3v2Tag()->render(version); insert(data, d->ID3v2Location, d->ID3v2OriginalSize); if(d->APELocation >= 0) @@ -267,7 +273,7 @@ bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplica // ID3v2 tag is empty. Remove the old one. - strip(ID3v2, false); + File::strip(ID3v2, false); } } @@ -291,7 +297,7 @@ bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplica // ID3v1 tag is empty. Remove the old one. - strip(ID3v1, false); + File::strip(ID3v1, false); } } @@ -320,7 +326,7 @@ bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplica // APE tag is empty. Remove the old one. - strip(APE, false); + File::strip(APE, false); } } diff --git a/3rdparty/taglib/mpeg/mpegfile.h b/3rdparty/taglib/mpeg/mpegfile.h index 021a2edba..7b4efec3b 100644 --- a/3rdparty/taglib/mpeg/mpegfile.h +++ b/3rdparty/taglib/mpeg/mpegfile.h @@ -32,6 +32,8 @@ #include "mpegproperties.h" +#include "id3v2.h" + namespace Strawberry_TagLib { namespace TagLib { @@ -39,14 +41,14 @@ namespace TagLib { namespace ID3v1 { class Tag; } namespace APE { class Tag; } - //! An implementation of Strawberry_TagLib::TagLib::File with MPEG (MP3) specific methods + //! An implementation of TagLib::File with MPEG (MP3) specific methods namespace MPEG { //! An MPEG file class with some useful methods specific to MPEG /*! - * This implements the generic Strawberry_TagLib::TagLib::File API and additionally provides + * This implements the generic TagLib::File API and additionally provides * access to properties that are distinct to MPEG files, notably access * to the different ID3 tags. */ @@ -164,15 +166,14 @@ namespace TagLib { virtual Properties *audioProperties() const; /*! - * Save the file. If an ID3v1 tag exists this will duplicate the tag - * content into the other tag. This returns true if saving was - * successful. + * Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this + * will duplicate its content into the other tag. This returns true + * if saving was successful. * * If neither exists or if both tags are empty, this will strip the tags * from the file. * - * This is the same as calling save(AllTags, true, 4, false); or if an - * ID3v1 tag exists, save(AllTags, true, 4, true). + * This is the same as calling save(AllTags); * * If you would like more granular control over the content of the tags, * with the concession of generality, use parameterized save call below. @@ -193,49 +194,39 @@ namespace TagLib { bool save(int tags); /*! - * Save the file. This will attempt to save all of the tag types that are - * specified by OR-ing together TagTypes values. The save() method above - * uses AllTags. This returns true if saving was successful. - * - * If \a stripOthers is true this strips all tags not included in the mask, - * but does not modify them in memory, so later calls to save() which make - * use of these tags will remain valid. This also strips empty tags. + * \deprecated */ // BIC: combine with the above method - bool save(int tags, bool stripOthers); + TAGLIB_DEPRECATED bool save(int tags, bool stripOthers); + + /*! + * \deprecated + */ + // BIC: combine with the above method + TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version); + + /*! + * \deprecated + */ + // BIC: combine with the above method + TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags); /*! * Save the file. This will attempt to save all of the tag types that are - * specified by OR-ing together TagTypes values. The save() method above - * uses AllTags. This returns true if saving was successful. + * specified by OR-ing together TagTypes values. * - * If \a stripOthers is true this strips all tags not included in the mask, - * but does not modify them in memory, so later calls to save() which make - * use of these tags will remain valid. This also strips empty tags. + * \a strip can be set to strip all tags except those in \a tags. Those + * tags will not be modified in memory, and thus remain valid. * - * The \a id3v2Version parameter specifies the version of the saved - * ID3v2 tag. It can be either 4 or 3. + * \a version specifies the ID3v2 version to be used for writing tags. By + * default, the latest standard, ID3v2.4 is used. + * + * If \a duplicate is set to DuplicateTags and at least one tag -- ID3v1 + * or ID3v2 -- exists this will duplicate its content into the other tag. */ - // BIC: combine with the above method - bool save(int tags, bool stripOthers, int id3v2Version); - - /*! - * Save the file. This will attempt to save all of the tag types that are - * specified by OR-ing together TagTypes values. The save() method above - * uses AllTags. This returns true if saving was successful. - * - * If \a stripOthers is true this strips all tags not included in the mask, - * but does not modify them in memory, so later calls to save() which make - * use of these tags will remain valid. This also strips empty tags. - * - * The \a id3v2Version parameter specifies the version of the saved - * ID3v2 tag. It can be either 4 or 3. - * - * If \a duplicateTags is true and at least one tag -- ID3v1 or ID3v2 -- - * exists this will duplicate its content into the other tag. - */ - // BIC: combine with the above method - bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags); + bool save(int tags, StripTags strip, + ID3v2::Version version = ID3v2::v4, + DuplicateTags duplicate = Duplicate); /*! * Returns a pointer to the ID3v2 tag of the file. @@ -327,7 +318,7 @@ namespace TagLib { * \see ID3v2FrameFactory * \deprecated This value should be passed in via the constructor */ - void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); + TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); /*! * Returns the position in the file of the first MPEG frame. diff --git a/3rdparty/taglib/mpeg/mpegheader.h b/3rdparty/taglib/mpeg/mpegheader.h index 38378c9b3..8db0f705d 100644 --- a/3rdparty/taglib/mpeg/mpegheader.h +++ b/3rdparty/taglib/mpeg/mpegheader.h @@ -53,7 +53,7 @@ namespace TagLib { * * \deprecated */ - Header(const ByteVector &data); + TAGLIB_DEPRECATED Header(const ByteVector &data); /*! * Parses an MPEG header based on \a file and \a offset. diff --git a/3rdparty/taglib/mpeg/xingheader.h b/3rdparty/taglib/mpeg/xingheader.h index 96c312a66..05128b19e 100644 --- a/3rdparty/taglib/mpeg/xingheader.h +++ b/3rdparty/taglib/mpeg/xingheader.h @@ -112,7 +112,7 @@ namespace TagLib { * * \deprecated Always returns 0. */ - static int xingHeaderOffset(Strawberry_TagLib::TagLib::MPEG::Header::Version v, + TAGLIB_DEPRECATED static int xingHeaderOffset(Strawberry_TagLib::TagLib::MPEG::Header::Version v, Strawberry_TagLib::TagLib::MPEG::Header::ChannelMode c); private: diff --git a/3rdparty/taglib/ogg/flac/oggflacfile.h b/3rdparty/taglib/ogg/flac/oggflacfile.h index af72567a7..149657a6c 100644 --- a/3rdparty/taglib/ogg/flac/oggflacfile.h +++ b/3rdparty/taglib/ogg/flac/oggflacfile.h @@ -52,12 +52,12 @@ namespace TagLib { using Strawberry_TagLib::TagLib::FLAC::Properties; - //! An implementation of Strawberry_TagLib::TagLib::File with Ogg/FLAC specific methods + //! An implementation of TagLib::File with Ogg/FLAC specific methods /*! * This implements and provides an interface for Ogg/FLAC files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to Ogg FLAC files. */ diff --git a/3rdparty/taglib/ogg/oggpage.h b/3rdparty/taglib/ogg/oggpage.h index c01948ea4..9245ba2c2 100644 --- a/3rdparty/taglib/ogg/oggpage.h +++ b/3rdparty/taglib/ogg/oggpage.h @@ -94,7 +94,7 @@ namespace TagLib { * * \deprecated Always returns null. */ - Page* getCopyWithNewPageSequenceNumber(int sequenceNumber); + TAGLIB_DEPRECATED Page *getCopyWithNewPageSequenceNumber(int sequenceNumber); /*! * Returns the index of the first packet wholly or partially contained in diff --git a/3rdparty/taglib/ogg/opus/opusfile.h b/3rdparty/taglib/ogg/opus/opusfile.h index cb858084f..abf2622a1 100644 --- a/3rdparty/taglib/ogg/opus/opusfile.h +++ b/3rdparty/taglib/ogg/opus/opusfile.h @@ -85,7 +85,7 @@ namespace TagLib { /*! * Returns the XiphComment for this file. XiphComment implements the tag * interface, so this serves as the reimplementation of - * Strawberry_TagLib::TagLib::File::tag(). + * TagLib::File::tag(). */ virtual Ogg::XiphComment *tag() const; diff --git a/3rdparty/taglib/ogg/opus/opusproperties.h b/3rdparty/taglib/ogg/opus/opusproperties.h index 1e2807017..0b9e3a927 100644 --- a/3rdparty/taglib/ogg/opus/opusproperties.h +++ b/3rdparty/taglib/ogg/opus/opusproperties.h @@ -70,7 +70,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/ogg/speex/speexfile.h b/3rdparty/taglib/ogg/speex/speexfile.h index 7e30abf39..49587ecb8 100644 --- a/3rdparty/taglib/ogg/speex/speexfile.h +++ b/3rdparty/taglib/ogg/speex/speexfile.h @@ -85,7 +85,7 @@ namespace TagLib { /*! * Returns the XiphComment for this file. XiphComment implements the tag * interface, so this serves as the reimplementation of - * Strawberry_TagLib::TagLib::File::tag(). + * TagLib::File::tag(). */ virtual Ogg::XiphComment *tag() const; diff --git a/3rdparty/taglib/ogg/speex/speexproperties.h b/3rdparty/taglib/ogg/speex/speexproperties.h index be8870ae7..0c4bb9532 100644 --- a/3rdparty/taglib/ogg/speex/speexproperties.h +++ b/3rdparty/taglib/ogg/speex/speexproperties.h @@ -70,7 +70,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/ogg/vorbis/vorbisfile.h b/3rdparty/taglib/ogg/vorbis/vorbisfile.h index 18ec84739..f1bfdba94 100644 --- a/3rdparty/taglib/ogg/vorbis/vorbisfile.h +++ b/3rdparty/taglib/ogg/vorbis/vorbisfile.h @@ -92,7 +92,7 @@ namespace TagLib { /*! * Returns the XiphComment for this file. XiphComment implements the tag * interface, so this serves as the reimplementation of - * Strawberry_TagLib::TagLib::File::tag(). + * TagLib::File::tag(). */ virtual Ogg::XiphComment *tag() const; diff --git a/3rdparty/taglib/ogg/vorbis/vorbisproperties.h b/3rdparty/taglib/ogg/vorbis/vorbisproperties.h index c30787e6d..94f391f56 100644 --- a/3rdparty/taglib/ogg/vorbis/vorbisproperties.h +++ b/3rdparty/taglib/ogg/vorbis/vorbisproperties.h @@ -76,7 +76,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to diff --git a/3rdparty/taglib/ogg/xiphcomment.h b/3rdparty/taglib/ogg/xiphcomment.h index c636e96a0..bd713a36b 100644 --- a/3rdparty/taglib/ogg/xiphcomment.h +++ b/3rdparty/taglib/ogg/xiphcomment.h @@ -187,7 +187,7 @@ namespace TagLib { * \deprecated Using this method may lead to a linkage error. */ // BIC: remove and merge with below - void removeField(const String &key, const String &value = String::null); + TAGLIB_DEPRECATED void removeField(const String &key, const String &value = String()); /*! * Remove all the fields specified by \a key. diff --git a/3rdparty/taglib/riff/aiff/aifffile.cpp b/3rdparty/taglib/riff/aiff/aifffile.cpp index a49ca6c3c..fdf58a119 100644 --- a/3rdparty/taglib/riff/aiff/aifffile.cpp +++ b/3rdparty/taglib/riff/aiff/aifffile.cpp @@ -117,6 +117,11 @@ RIFF::AIFF::Properties *RIFF::AIFF::File::audioProperties() const } bool RIFF::AIFF::File::save() +{ + return save(ID3v2::v4); +} + +bool RIFF::AIFF::File::save(ID3v2::Version version) { if(readOnly()) { debug("RIFF::AIFF::File::save() -- File is read only."); @@ -135,7 +140,7 @@ bool RIFF::AIFF::File::save() } if(tag() && !tag()->isEmpty()) { - setChunkData("ID3 ", d->tag->render()); + setChunkData("ID3 ", d->tag->render(version)); d->hasID3v2 = true; } diff --git a/3rdparty/taglib/riff/aiff/aifffile.h b/3rdparty/taglib/riff/aiff/aifffile.h index 6cf5e9437..5ad8cf4ea 100644 --- a/3rdparty/taglib/riff/aiff/aifffile.h +++ b/3rdparty/taglib/riff/aiff/aifffile.h @@ -46,12 +46,12 @@ namespace TagLib { namespace AIFF { - //! An implementation of Strawberry_TagLib::TagLib::File with AIFF specific methods + //! An implementation of TagLib::File with AIFF specific methods /*! * This implements and provides an interface for AIFF files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to AIFF files. */ @@ -120,6 +120,11 @@ namespace TagLib { */ virtual bool save(); + /*! + * Save using a specific ID3v2 version (e.g. v3) + */ + bool save(ID3v2::Version version); + /*! * Returns whether or not the file on disk actually has an ID3v2 tag. * diff --git a/3rdparty/taglib/riff/aiff/aiffproperties.h b/3rdparty/taglib/riff/aiff/aiffproperties.h index 44d892f36..00d560a18 100644 --- a/3rdparty/taglib/riff/aiff/aiffproperties.h +++ b/3rdparty/taglib/riff/aiff/aiffproperties.h @@ -53,7 +53,7 @@ namespace TagLib { * * \deprecated */ - Properties(const ByteVector &data, ReadStyle style); + TAGLIB_DEPRECATED Properties(const ByteVector &data, ReadStyle style); /*! * Create an instance of AIFF::Properties with the data read from the @@ -74,7 +74,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to @@ -120,7 +120,7 @@ namespace TagLib { * * \deprecated */ - int sampleWidth() const; + TAGLIB_DEPRECATED int sampleWidth() const; /*! * Returns the number of sample frames diff --git a/3rdparty/taglib/riff/rifffile.h b/3rdparty/taglib/riff/rifffile.h index 68f0fe5f2..0000b3d11 100644 --- a/3rdparty/taglib/riff/rifffile.h +++ b/3rdparty/taglib/riff/rifffile.h @@ -32,14 +32,14 @@ namespace Strawberry_TagLib { namespace TagLib { - //! An implementation of Strawberry_TagLib::TagLib::File with RIFF specific methods + //! An implementation of TagLib::File with RIFF specific methods namespace RIFF { //! An RIFF file class with some useful methods specific to RIFF /*! - * This implements the generic Strawberry_TagLib::TagLib::File API and additionally provides + * This implements the generic TagLib::File API and additionally provides * access to properties that are distinct to RIFF files, notably access * to the different ID3 tags. */ diff --git a/3rdparty/taglib/riff/wav/wavfile.cpp b/3rdparty/taglib/riff/wav/wavfile.cpp index 7001d90f2..cc8d43279 100644 --- a/3rdparty/taglib/riff/wav/wavfile.cpp +++ b/3rdparty/taglib/riff/wav/wavfile.cpp @@ -151,6 +151,13 @@ bool RIFF::WAV::File::save() } bool RIFF::WAV::File::save(TagTypes tags, bool stripOthers, int id3v2Version) +{ + return save(tags, + stripOthers ? StripOthers : StripNone, + id3v2Version == 3 ? ID3v2::v3 : ID3v2::v4); +} + +bool RIFF::WAV::File::save(TagTypes tags, StripTags strip, ID3v2::Version version) { if(readOnly()) { debug("RIFF::WAV::File::save() -- File is read only."); @@ -162,14 +169,14 @@ bool RIFF::WAV::File::save(TagTypes tags, bool stripOthers, int id3v2Version) return false; } - if(stripOthers) - strip(static_cast(AllTags & ~tags)); + if(strip == StripOthers) + File::strip(static_cast(AllTags & ~tags)); if(tags & ID3v2) { removeTagChunks(ID3v2); if(ID3v2Tag() && !ID3v2Tag()->isEmpty()) { - setChunkData("ID3 ", ID3v2Tag()->render(id3v2Version)); + setChunkData("ID3 ", ID3v2Tag()->render(version)); d->hasID3v2 = true; } } diff --git a/3rdparty/taglib/riff/wav/wavfile.h b/3rdparty/taglib/riff/wav/wavfile.h index ab21da23e..a6745ebf5 100644 --- a/3rdparty/taglib/riff/wav/wavfile.h +++ b/3rdparty/taglib/riff/wav/wavfile.h @@ -47,12 +47,12 @@ namespace TagLib { namespace WAV { - //! An implementation of Strawberry_TagLib::TagLib::File with WAV specific methods + //! An implementation of TagLib::File with WAV specific methods /*! * This implements and provides an interface for WAV files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to WAV files. */ @@ -160,7 +160,19 @@ namespace TagLib { */ virtual bool save(); - bool save(TagTypes tags, bool stripOthers = true, int id3v2Version = 4); + /*! + * \deprecated + */ + TAGLIB_DEPRECATED bool save(TagTypes tags, bool stripOthers, int id3v2Version = 4); + + /*! + * Save the file. If \a strip is specified, it is possible to choose if + * tags not specified in \a tags should be stripped from the file or + * retained. With \a version, it is possible to specify whether ID3v2.4 + * or ID3v2.3 should be used. + */ + bool save(TagTypes tags, StripTags strip = StripOthers, + ID3v2::Version version = ID3v2::v4); /*! * Returns whether or not the file on disk actually has an ID3v2 tag. diff --git a/3rdparty/taglib/riff/wav/wavproperties.h b/3rdparty/taglib/riff/wav/wavproperties.h index 87a72b5a1..004312606 100644 --- a/3rdparty/taglib/riff/wav/wavproperties.h +++ b/3rdparty/taglib/riff/wav/wavproperties.h @@ -56,7 +56,7 @@ namespace TagLib { * * \deprecated */ - Properties(const ByteVector &data, ReadStyle style); + TAGLIB_DEPRECATED Properties(const ByteVector &data, ReadStyle style); /*! * Create an instance of WAV::Properties with the data read from the @@ -64,7 +64,7 @@ namespace TagLib { * * \deprecated */ - Properties(const ByteVector &data, unsigned int streamLength, ReadStyle style); + TAGLIB_DEPRECATED Properties(const ByteVector &data, unsigned int streamLength, ReadStyle style); /*! * Create an instance of WAV::Properties with the data read from the @@ -85,7 +85,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to @@ -131,7 +131,7 @@ namespace TagLib { * * \deprecated */ - int sampleWidth() const; + TAGLIB_DEPRECATED int sampleWidth() const; /*! * Returns the number of sample frames. diff --git a/3rdparty/taglib/tag.h b/3rdparty/taglib/tag.h index 452babe36..ef6e8a8c5 100644 --- a/3rdparty/taglib/tag.h +++ b/3rdparty/taglib/tag.h @@ -39,7 +39,7 @@ namespace TagLib { * of various audio codecs and tagging schemes. As such it is generally a * subset of what is available in the specific formats but should be suitable * for most applications. This is meant to compliment the generic APIs found - * in Strawberry_TagLib::TagLib::AudioProperties, Strawberry_TagLib::TagLib::File and Strawberry_TagLib::TagLib::FileRef. + * in TagLib::AudioProperties, TagLib::File and TagLib::FileRef. */ class PropertyMap; @@ -66,7 +66,7 @@ namespace TagLib { * The parameter \a properties must contain only entries from * properties().unsupportedData(). * BIC: Will become virtual in future releases. Currently the non-virtual - * standard implementation of Strawberry_TagLib::TagLib::Tag does nothing, since there are + * standard implementation of TagLib::Tag does nothing, since there are * no unsupported elements. */ void removeUnsupportedProperties(const StringList& properties); diff --git a/3rdparty/taglib/tagunion.h b/3rdparty/taglib/tagunion.h index 257ce1580..f263ae08e 100644 --- a/3rdparty/taglib/tagunion.h +++ b/3rdparty/taglib/tagunion.h @@ -44,7 +44,7 @@ namespace TagLib { enum AccessType { Read, Write }; /*! - * Creates a Strawberry_TagLib::TagLib::Tag that is the union of \a first, \a second, and + * Creates a TagLib::Tag that is the union of \a first, \a second, and * \a third. The TagUnion takes ownership of these tags and will handle * their deletion. */ diff --git a/3rdparty/taglib/toolkit/taglib.h b/3rdparty/taglib/toolkit/taglib.h index 570389612..9380e19e6 100644 --- a/3rdparty/taglib/toolkit/taglib.h +++ b/3rdparty/taglib/toolkit/taglib.h @@ -44,6 +44,16 @@ #define TAGLIB_CONSTRUCT_BITSET(x) static_cast(x) #endif +#if __cplusplus >= 201402 +#define TAGLIB_DEPRECATED [[deprecated]] +#elif defined(__GNUC__) || defined(__clang__) +#define TAGLIB_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define TAGLIB_DEPRECATED __declspec(deprecated) +#else +#define TAGLIB_DEPRECATED +#endif + #include //! A namespace for all TagLib related classes and functions @@ -52,7 +62,7 @@ * This namespace contains everything in TagLib. For projects working with * TagLib extensively it may be convenient to add a * \code - * using namespace Strawberry_TagLib::TagLib; + * using namespace TagLib; * \endcode */ diff --git a/3rdparty/taglib/toolkit/tfile.h b/3rdparty/taglib/toolkit/tfile.h index 55274234c..2ad35b944 100644 --- a/3rdparty/taglib/toolkit/tfile.h +++ b/3rdparty/taglib/toolkit/tfile.h @@ -63,6 +63,23 @@ namespace TagLib { End }; + /*! + * Specify which tags to strip either explicitly, or on save. + */ + enum StripTags { + StripNone, //data, s.c_str(), s.length(), t); } else { - debug("String::String() -- Strawberry_TagLib::TagLib::wstring should not contain Latin1 or UTF-8."); + debug("String::String() -- TagLib::wstring should not contain Latin1 or UTF-8."); } } diff --git a/3rdparty/taglib/toolkit/tstring.h b/3rdparty/taglib/toolkit/tstring.h index 7c673a7d1..1e2cf480f 100644 --- a/3rdparty/taglib/toolkit/tstring.h +++ b/3rdparty/taglib/toolkit/tstring.h @@ -34,9 +34,9 @@ #include /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * - * Converts a QString to a Strawberry_TagLib::TagLib::String without a requirement to link to Qt. + * Converts a QString to a TagLib::String without a requirement to link to Qt. * * \note consider conversion via usual char-by-char for loop to avoid UTF16->UTF8->UTF16 * conversion happening in the background @@ -49,9 +49,9 @@ #endif /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * - * Converts a Strawberry_TagLib::TagLib::String to a QString without a requirement to link to Qt. + * Converts a TagLib::String to a QString without a requirement to link to Qt. * * \note consider conversion via usual char-by-char for loop to avoid UTF16->UTF8->UTF16 * conversion happening in the background @@ -69,7 +69,7 @@ namespace TagLib { /*! * This is an implicitly shared \e wide string. For storage it uses - * Strawberry_TagLib::TagLib::wstring, but as this is an implementation detail this of + * TagLib::wstring, but as this is an implementation detail this of * course could change. Strings are stored internally as UTF-16(without BOM/ * CPU byte order) * @@ -542,7 +542,7 @@ namespace TagLib { * may lead to a linkage error. */ // BIC: remove - static const Type WCharByteOrder; + TAGLIB_DEPRECATED static const Type WCharByteOrder; class StringPrivate; StringPrivate *d; @@ -552,21 +552,21 @@ namespace TagLib { } /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * * Concatenates \a s1 and \a s2 and returns the result as a string. */ TAGLIB_EXPORT const Strawberry_TagLib::TagLib::String operator+(const Strawberry_TagLib::TagLib::String &s1, const Strawberry_TagLib::TagLib::String &s2); /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * * Concatenates \a s1 and \a s2 and returns the result as a string. */ TAGLIB_EXPORT const Strawberry_TagLib::TagLib::String operator+(const char *s1, const Strawberry_TagLib::TagLib::String &s2); /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * * Concatenates \a s1 and \a s2 and returns the result as a string. */ @@ -574,7 +574,7 @@ TAGLIB_EXPORT const Strawberry_TagLib::TagLib::String operator+(const Strawberry /*! - * \relates Strawberry_TagLib::TagLib::String + * \relates TagLib::String * * Send the string to an output stream. */ diff --git a/3rdparty/taglib/trueaudio/trueaudiofile.h b/3rdparty/taglib/trueaudio/trueaudiofile.h index eae4bddfe..4705d0da7 100644 --- a/3rdparty/taglib/trueaudio/trueaudiofile.h +++ b/3rdparty/taglib/trueaudio/trueaudiofile.h @@ -52,12 +52,12 @@ namespace TagLib { namespace TrueAudio { - //! An implementation of Strawberry_TagLib::TagLib::File with TrueAudio specific methods + //! An implementation of TagLib::File with TrueAudio specific methods /*! * This implements and provides an interface for TrueAudio files to the - * Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing - * the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional * information specific to TrueAudio files. */ @@ -167,7 +167,7 @@ namespace TagLib { * \see ID3v2FrameFactory * \deprecated This value should be passed in via the constructor */ - void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); + TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); /*! * Saves the file. diff --git a/3rdparty/taglib/wavpack/wavpackproperties.h b/3rdparty/taglib/wavpack/wavpackproperties.h index e4df91a64..61073ebaf 100644 --- a/3rdparty/taglib/wavpack/wavpackproperties.h +++ b/3rdparty/taglib/wavpack/wavpackproperties.h @@ -59,12 +59,12 @@ namespace TagLib { * \deprecated This constructor will be dropped in favor of the one below * in a future version. */ - Properties(const ByteVector &data, long streamLength, ReadStyle style = Average); + TAGLIB_DEPRECATED Properties(const ByteVector &data, long streamLength, + ReadStyle style = Average); /*! * Create an instance of WavPack::Properties. */ - // BIC: merge with the above constructor Properties(File *file, long streamLength, ReadStyle style = Average); /*! @@ -80,7 +80,7 @@ namespace TagLib { * * \deprecated */ - virtual int length() const; + TAGLIB_DEPRECATED virtual int length() const; /*! * Returns the length of the file in seconds. The length is rounded down to