Adapt most changes from taglib2
This commit is contained in:
17
3rdparty/taglib/dsdiff/dsdiffdiintag.cpp
vendored
17
3rdparty/taglib/dsdiff/dsdiffdiintag.cpp
vendored
@@ -26,6 +26,7 @@
|
||||
#include "dsdiffdiintag.h"
|
||||
#include "tstringlist.h"
|
||||
#include "tpropertymap.h"
|
||||
#include "tpicturemap.h"
|
||||
|
||||
using namespace Strawberry_TagLib::TagLib;
|
||||
using namespace DSDIFF::DIIN;
|
||||
@@ -75,21 +76,19 @@ unsigned int DSDIFF::DIIN::Tag::track() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PictureMap DSDIFF::DIIN::Tag::pictures() const {
|
||||
return PictureMap();
|
||||
}
|
||||
|
||||
void DSDIFF::DIIN::Tag::setTitle(const String &title) {
|
||||
|
||||
if (title.isEmpty())
|
||||
d->title = String();
|
||||
else
|
||||
d->title = title;
|
||||
d->title = title;
|
||||
|
||||
}
|
||||
|
||||
void DSDIFF::DIIN::Tag::setArtist(const String &artist) {
|
||||
|
||||
if (artist.isEmpty())
|
||||
d->artist = String();
|
||||
else
|
||||
d->artist = artist;
|
||||
d->artist = artist;
|
||||
|
||||
}
|
||||
|
||||
@@ -103,6 +102,8 @@ void DSDIFF::DIIN::Tag::setYear(unsigned int) {}
|
||||
|
||||
void DSDIFF::DIIN::Tag::setTrack(unsigned int) {}
|
||||
|
||||
void DSDIFF::DIIN::Tag::setPictures(const PictureMap&) {}
|
||||
|
||||
PropertyMap DSDIFF::DIIN::Tag::properties() const {
|
||||
|
||||
PropertyMap properties;
|
||||
|
||||
46
3rdparty/taglib/dsdiff/dsdiffdiintag.h
vendored
46
3rdparty/taglib/dsdiff/dsdiffdiintag.h
vendored
@@ -42,83 +42,93 @@ namespace DIIN {
|
||||
class TAGLIB_EXPORT Tag : public Strawberry_TagLib::TagLib::Tag {
|
||||
public:
|
||||
explicit Tag();
|
||||
virtual ~Tag();
|
||||
~Tag() override;
|
||||
|
||||
/*!
|
||||
* Returns the track name; if no track name is present in the tag String() will be returned.
|
||||
*/
|
||||
String title() const;
|
||||
String title() const override;
|
||||
|
||||
/*!
|
||||
* Returns the artist name; if no artist name is present in the tag String() will be returned.
|
||||
*/
|
||||
String artist() const;
|
||||
String artist() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns String().
|
||||
*/
|
||||
String album() const;
|
||||
String album() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns String().
|
||||
*/
|
||||
String comment() const;
|
||||
String comment() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns String().
|
||||
*/
|
||||
String genre() const;
|
||||
String genre() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns 0.
|
||||
*/
|
||||
unsigned int year() const;
|
||||
unsigned int year() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns 0.
|
||||
*/
|
||||
unsigned int track() const;
|
||||
unsigned int track() const override;
|
||||
|
||||
/*!
|
||||
* Not supported. Therefore always returns an empty list.
|
||||
*/
|
||||
PictureMap pictures() const override;
|
||||
|
||||
/*!
|
||||
* Sets the title to \a title. If \a title is String() then this value will be cleared.
|
||||
*/
|
||||
void setTitle(const String &title);
|
||||
void setTitle(const String &title) override;
|
||||
|
||||
/*!
|
||||
* Sets the artist to \a artist. If \a artist is String() then this value will be cleared.
|
||||
*/
|
||||
void setArtist(const String &artist);
|
||||
void setArtist(const String &artist) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setAlbum(const String &album);
|
||||
void setAlbum(const String &album) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setComment(const String &comment);
|
||||
void setComment(const String &comment) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setGenre(const String &genre);
|
||||
void setGenre(const String &genre) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setYear(unsigned int year);
|
||||
void setYear(unsigned int year) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setTrack(unsigned int track);
|
||||
void setTrack(unsigned int track) override;
|
||||
|
||||
/*!
|
||||
* Not supported and therefore ignored.
|
||||
*/
|
||||
void setPictures(const PictureMap&) override;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- export function.
|
||||
* Since the DIIN tag is very limited, the exported map is as well.
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
PropertyMap properties() const override;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- import function.
|
||||
@@ -127,10 +137,10 @@ class TAGLIB_EXPORT Tag : public Strawberry_TagLib::TagLib::Tag {
|
||||
* Additionally, if the map contains tags with multiple values,
|
||||
* all but the first will be contained in the returned map of unsupported properties.
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &);
|
||||
PropertyMap setProperties(const PropertyMap &) override;
|
||||
|
||||
private:
|
||||
explicit Tag(const Tag &);
|
||||
Tag(const Tag &);
|
||||
Tag &operator=(const Tag &);
|
||||
|
||||
class TagPrivate;
|
||||
|
||||
132
3rdparty/taglib/dsdiff/dsdifffile.cpp
vendored
132
3rdparty/taglib/dsdiff/dsdifffile.cpp
vendored
@@ -23,19 +23,20 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tstring.h>
|
||||
#include <tbytevector.h>
|
||||
#include <tdebug.h>
|
||||
#include <id3v2tag.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
#include <memory>
|
||||
#include <array>
|
||||
|
||||
#include "tstring.h"
|
||||
#include "tbytevector.h"
|
||||
#include "tdebug.h"
|
||||
#include "id3v2tag.h"
|
||||
#include "tstringlist.h"
|
||||
#include "tpropertymap.h"
|
||||
#include "tagutils.h"
|
||||
|
||||
#include "tagunion.h"
|
||||
#include "dsdifffile.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace Strawberry_TagLib::TagLib;
|
||||
|
||||
namespace {
|
||||
@@ -89,7 +90,6 @@ class DSDIFF::File::FilePrivate {
|
||||
size(0),
|
||||
isID3InPropChunk(false),
|
||||
duplicateID3V2chunkIndex(-1),
|
||||
properties(nullptr),
|
||||
id3v2TagChunkID("ID3 "),
|
||||
hasID3v2(false),
|
||||
hasDiin(false) {
|
||||
@@ -97,10 +97,6 @@ class DSDIFF::File::FilePrivate {
|
||||
childChunkIndex[DIINIndex] = -1;
|
||||
}
|
||||
|
||||
~FilePrivate() {
|
||||
delete properties;
|
||||
}
|
||||
|
||||
Endianness endianness;
|
||||
ByteVector type;
|
||||
unsigned long long size;
|
||||
@@ -118,9 +114,9 @@ class DSDIFF::File::FilePrivate {
|
||||
*/
|
||||
int duplicateID3V2chunkIndex;
|
||||
|
||||
AudioProperties *properties;
|
||||
std::unique_ptr<AudioProperties> properties;
|
||||
|
||||
TagUnion tag;
|
||||
DoubleTagUnion tag;
|
||||
|
||||
ByteVector id3v2TagChunkID;
|
||||
|
||||
@@ -211,7 +207,7 @@ PropertyMap DSDIFF::File::setProperties(const PropertyMap &properties) {
|
||||
}
|
||||
|
||||
DSDIFF::AudioProperties *DSDIFF::File::audioProperties() const {
|
||||
return d->properties;
|
||||
return d->properties.get();
|
||||
}
|
||||
|
||||
bool DSDIFF::File::save() {
|
||||
@@ -269,7 +265,10 @@ bool DSDIFF::File::save(TagTypes tags, StripTags, ID3v2::Version version) {
|
||||
if (tags & DIIN && diinTag) {
|
||||
if (!diinTag->title().isEmpty()) {
|
||||
ByteVector diinTitle;
|
||||
diinTitle.append(ByteVector::fromUInt(diinTag->title().size(), d->endianness == BigEndian));
|
||||
if (d->endianness == BigEndian)
|
||||
diinTitle.append(ByteVector::fromUInt32BE(diinTag->title().size()));
|
||||
else
|
||||
diinTitle.append(ByteVector::fromUInt32LE(diinTag->title().size()));
|
||||
diinTitle.append(ByteVector::fromCString(diinTag->title().toCString()));
|
||||
setChildChunkData("DITI", diinTitle, DIINChunk);
|
||||
}
|
||||
@@ -278,7 +277,10 @@ bool DSDIFF::File::save(TagTypes tags, StripTags, ID3v2::Version version) {
|
||||
|
||||
if (!diinTag->artist().isEmpty()) {
|
||||
ByteVector diinArtist;
|
||||
diinArtist.append(ByteVector::fromUInt(diinTag->artist().size(), d->endianness == BigEndian));
|
||||
if (d->endianness == BigEndian)
|
||||
diinArtist.append(ByteVector::fromUInt32BE(diinTag->artist().size()));
|
||||
else
|
||||
diinArtist.append(ByteVector::fromUInt32LE(diinTag->artist().size()));
|
||||
diinArtist.append(ByteVector::fromCString(diinTag->artist().toCString()));
|
||||
setChildChunkData("DIAR", diinArtist, DIINChunk);
|
||||
}
|
||||
@@ -324,7 +326,10 @@ void DSDIFF::File::removeRootChunk(unsigned int i) {
|
||||
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);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
|
||||
|
||||
removeBlock(d->chunks[i].offset - 12, chunkSize);
|
||||
|
||||
@@ -357,14 +362,14 @@ void DSDIFF::File::setRootChunkData(unsigned int i, const ByteVector &data) {
|
||||
// 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);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 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);
|
||||
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;
|
||||
@@ -395,7 +400,10 @@ void DSDIFF::File::setRootChunkData(const ByteVector &name, const ByteVector &da
|
||||
|
||||
// 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);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
|
||||
|
||||
// Now add the chunk to the file
|
||||
writeChunk(name,
|
||||
@@ -422,14 +430,18 @@ void DSDIFF::File::removeChildChunk(unsigned int i, unsigned int childChunkNum)
|
||||
|
||||
unsigned long long removedChunkTotalSize = childChunks[i].size + childChunks[i].padding + 12;
|
||||
d->size -= removedChunkTotalSize;
|
||||
insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 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);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
// Remove the chunk
|
||||
|
||||
removeBlock(childChunks[i].offset - 12, removedChunkTotalSize);
|
||||
@@ -467,19 +479,23 @@ void DSDIFF::File::setChildChunkData(unsigned int i, const ByteVector &data, uns
|
||||
|
||||
d->size += ((data.size() + 1) & ~1) - (childChunks[i].size + childChunks[i].padding);
|
||||
|
||||
insert(ByteVector::fromLongLong(d->size, d->endianness == BigEndian), 4, 8);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 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);
|
||||
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size), 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);
|
||||
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;
|
||||
@@ -523,14 +539,18 @@ void DSDIFF::File::setChildChunkData(const ByteVector &name, const ByteVector &d
|
||||
// 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);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->size), 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,
|
||||
d->endianness == BigEndian),
|
||||
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
if (d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
else
|
||||
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size), d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
|
||||
|
||||
// Now add the chunk to the file
|
||||
|
||||
@@ -587,14 +607,14 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
bool bigEndian = (d->endianness == BigEndian);
|
||||
|
||||
d->type = readBlock(4);
|
||||
d->size = readBlock(8).toLongLong(bigEndian);
|
||||
d->size = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
|
||||
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);
|
||||
unsigned long long chunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
|
||||
|
||||
if (!isValidChunkID(chunkName)) {
|
||||
debug("DSDIFF::File::read() -- Chunk '" + chunkName + "' has invalid ID");
|
||||
@@ -654,7 +674,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
|
||||
while (tell() + 12 <= dstChunkEnd) {
|
||||
ByteVector dstChunkName = readBlock(4);
|
||||
long long dstChunkSize = readBlock(8).toLongLong(bigEndian);
|
||||
long long dstChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
|
||||
|
||||
if (!isValidChunkID(dstChunkName)) {
|
||||
debug("DSDIFF::File::read() -- DST Chunk '" + dstChunkName + "' has invalid ID");
|
||||
@@ -670,8 +690,8 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
|
||||
if (dstChunkName == "FRTE") {
|
||||
// Found the DST frame information chunk
|
||||
dstNumFrames = readBlock(4).toUInt(bigEndian);
|
||||
dstFrameRate = readBlock(2).toUShort(bigEndian);
|
||||
dstNumFrames = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
|
||||
dstFrameRate = bigEndian ? readBlock(2).toUInt16BE(0) : readBlock(2).toUInt16LE(0);
|
||||
// Found the wanted one, no need to look at the others
|
||||
break;
|
||||
}
|
||||
@@ -696,7 +716,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
seek(d->chunks[i].offset + 4);
|
||||
while (tell() + 12 <= propChunkEnd) {
|
||||
ByteVector propChunkName = readBlock(4);
|
||||
long long propChunkSize = readBlock(8).toLongLong(bigEndian);
|
||||
long long propChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
|
||||
|
||||
if (!isValidChunkID(propChunkName)) {
|
||||
debug("DSDIFF::File::read() -- PROP Chunk '" + propChunkName + "' has invalid ID");
|
||||
@@ -742,7 +762,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
|
||||
while (tell() + 12 <= diinChunkEnd) {
|
||||
ByteVector diinChunkName = readBlock(4);
|
||||
long long diinChunkSize = readBlock(8).toLongLong(bigEndian);
|
||||
long long diinChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
|
||||
|
||||
if (!isValidChunkID(diinChunkName)) {
|
||||
debug("DSDIFF::File::read() -- DIIN Chunk '" + diinChunkName + "' has invalid ID");
|
||||
@@ -802,8 +822,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
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;
|
||||
// ID3V2 tag has already been found at root level
|
||||
@@ -817,12 +836,12 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
else if (d->childChunks[PROPChunk][i].name == "FS ") {
|
||||
// Sample rate
|
||||
seek(d->childChunks[PROPChunk][i].offset);
|
||||
sampleRate = readBlock(4).toUInt(0, 4, bigEndian);
|
||||
sampleRate = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
|
||||
}
|
||||
else if (d->childChunks[PROPChunk][i].name == "CHNL") {
|
||||
// Channels
|
||||
seek(d->childChunks[PROPChunk][i].offset);
|
||||
channels = readBlock(2).toShort(0, bigEndian);
|
||||
channels = bigEndian ? readBlock(2).toInt16BE(0) : readBlock(2).toInt16LE(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,7 +853,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
for (unsigned int i = 0; i < d->childChunks[DIINChunk].size(); i++) {
|
||||
if (d->childChunks[DIINChunk][i].name == "DITI") {
|
||||
seek(d->childChunks[DIINChunk][i].offset);
|
||||
unsigned int titleStrLength = readBlock(4).toUInt(0, 4, bigEndian);
|
||||
unsigned int titleStrLength = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
|
||||
if (titleStrLength <= d->childChunks[DIINChunk][i].size) {
|
||||
ByteVector titleStr = readBlock(titleStrLength);
|
||||
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false)->setTitle(titleStr);
|
||||
@@ -842,7 +861,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
}
|
||||
else if (d->childChunks[DIINChunk][i].name == "DIAR") {
|
||||
seek(d->childChunks[DIINChunk][i].offset);
|
||||
unsigned int artistStrLength = readBlock(4).toUInt(0, 4, bigEndian);
|
||||
unsigned int artistStrLength = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
|
||||
if (artistStrLength <= d->childChunks[DIINChunk][i].size) {
|
||||
ByteVector artistStr = readBlock(artistStrLength);
|
||||
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false)->setArtist(artistStr);
|
||||
@@ -868,7 +887,7 @@ void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle properti
|
||||
if (lengthDSDSamplesTimeChannels > 0)
|
||||
bitrate = (audioDataSizeinBytes * 8 * sampleRate) / lengthDSDSamplesTimeChannels / 1000;
|
||||
|
||||
d->properties = new AudioProperties(sampleRate, channels, lengthDSDSamplesTimeChannels, bitrate, propertiesStyle);
|
||||
d->properties.reset(new AudioProperties(sampleRate, channels, lengthDSDSamplesTimeChannels, bitrate, propertiesStyle));
|
||||
}
|
||||
|
||||
if (!ID3v2Tag()) {
|
||||
@@ -887,7 +906,10 @@ void DSDIFF::File::writeChunk(const ByteVector &name, const ByteVector &data, un
|
||||
combined.append(ByteVector(leadingPadding, '\x00'));
|
||||
|
||||
combined.append(name);
|
||||
combined.append(ByteVector::fromLongLong(data.size(), d->endianness == BigEndian));
|
||||
if (d->endianness == BigEndian)
|
||||
combined.append(ByteVector::fromUInt64BE(data.size()));
|
||||
else
|
||||
combined.append(ByteVector::fromUInt64LE(data.size()));
|
||||
combined.append(data);
|
||||
if ((data.size() & 0x01) != 0)
|
||||
combined.append('\x00');
|
||||
|
||||
16
3rdparty/taglib/dsdiff/dsdifffile.h
vendored
16
3rdparty/taglib/dsdiff/dsdifffile.h
vendored
@@ -95,7 +95,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
~File() override;
|
||||
|
||||
/*!
|
||||
* Returns a pointer to a tag that is the union of the ID3v2 and DIIN tags.
|
||||
@@ -110,7 +110,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
* \see ID3v2Tag()
|
||||
* \see DIINTag()
|
||||
*/
|
||||
virtual Tag *tag() const;
|
||||
Tag *tag() const override;
|
||||
|
||||
/*!
|
||||
* Returns the ID3V2 Tag for this file.
|
||||
@@ -132,21 +132,21 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
* Implements the unified property interface -- export function.
|
||||
* This method forwards to ID3v2::Tag::properties().
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
PropertyMap properties() const override;
|
||||
|
||||
void removeUnsupportedProperties(const StringList &properties);
|
||||
void removeUnsupportedProperties(const StringList &properties) override;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- import function.
|
||||
* This method forwards to ID3v2::Tag::setProperties().
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &properties);
|
||||
PropertyMap setProperties(const PropertyMap &properties) override;
|
||||
|
||||
/*!
|
||||
* Returns the AIFF::AudioProperties for this file.
|
||||
* If no audio properties were read then this will return a null pointer.
|
||||
*/
|
||||
virtual AudioProperties *audioProperties() const;
|
||||
AudioProperties *audioProperties() const override;
|
||||
|
||||
/*!
|
||||
* Save the file. If at least one tag -- ID3v1 or DIIN -- exists this will duplicate its content into the other tag.
|
||||
@@ -161,7 +161,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
*
|
||||
* \see save(int tags)
|
||||
*/
|
||||
virtual bool save();
|
||||
bool save() override;
|
||||
|
||||
/*!
|
||||
* Save the file. If \a strip is specified,
|
||||
@@ -209,7 +209,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
File(IOStream *stream, Endianness endianness);
|
||||
|
||||
private:
|
||||
explicit File(const File &);
|
||||
File(const File &);
|
||||
File &operator=(const File &);
|
||||
|
||||
void removeRootChunk(const ByteVector &id);
|
||||
|
||||
20
3rdparty/taglib/dsdiff/dsdiffproperties.cpp
vendored
20
3rdparty/taglib/dsdiff/dsdiffproperties.cpp
vendored
@@ -23,8 +23,8 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
#include "tstring.h"
|
||||
#include "tdebug.h"
|
||||
|
||||
#include "dsdiffproperties.h"
|
||||
|
||||
@@ -32,12 +32,12 @@ using namespace Strawberry_TagLib::TagLib;
|
||||
|
||||
class DSDIFF::AudioProperties::AudioPropertiesPrivate {
|
||||
public:
|
||||
AudioPropertiesPrivate() : length(0),
|
||||
bitrate(0),
|
||||
sampleRate(0),
|
||||
channels(0),
|
||||
sampleWidth(0),
|
||||
sampleCount(0) {
|
||||
explicit AudioPropertiesPrivate() : length(0),
|
||||
bitrate(0),
|
||||
sampleRate(0),
|
||||
channels(0),
|
||||
sampleWidth(0),
|
||||
sampleCount(0) {
|
||||
}
|
||||
|
||||
int length;
|
||||
@@ -52,9 +52,7 @@ class DSDIFF::AudioProperties::AudioPropertiesPrivate {
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DSDIFF::AudioProperties::AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) {
|
||||
|
||||
d = new AudioPropertiesPrivate;
|
||||
DSDIFF::AudioProperties::AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle) : Strawberry_TagLib::TagLib::AudioProperties(), d(new AudioPropertiesPrivate) {
|
||||
|
||||
d->channels = channels;
|
||||
d->sampleCount = samplesCount;
|
||||
|
||||
16
3rdparty/taglib/dsdiff/dsdiffproperties.h
vendored
16
3rdparty/taglib/dsdiff/dsdiffproperties.h
vendored
@@ -45,26 +45,26 @@ class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioPro
|
||||
/*!
|
||||
* Create an instance of DSDIFF::AudioProperties with the data read from the ByteVector \a data.
|
||||
*/
|
||||
explicit AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style);
|
||||
explicit AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle);
|
||||
|
||||
/*!
|
||||
* Destroys this DSDIFF::AudioProperties instance.
|
||||
*/
|
||||
virtual ~AudioProperties();
|
||||
~AudioProperties() override;
|
||||
|
||||
// Reimplementations.
|
||||
|
||||
virtual int lengthInSeconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
int lengthInSeconds() const override;
|
||||
int lengthInMilliseconds() const override;
|
||||
int bitrate() const override;
|
||||
int sampleRate() const override;
|
||||
int channels() const override;
|
||||
|
||||
int bitsPerSample() const;
|
||||
long long sampleCount() const;
|
||||
|
||||
private:
|
||||
explicit AudioProperties(const AudioProperties &);
|
||||
AudioProperties(const AudioProperties &);
|
||||
AudioProperties &operator=(const AudioProperties &);
|
||||
|
||||
class AudioPropertiesPrivate;
|
||||
|
||||
Reference in New Issue
Block a user