Adapt most changes from taglib2
This commit is contained in:
30
3rdparty/taglib/wavpack/wavpackfile.cpp
vendored
30
3rdparty/taglib/wavpack/wavpackfile.cpp
vendored
@@ -27,12 +27,12 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tbytevector.h>
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
#include <tagunion.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
#include "tbytevector.h"
|
||||
#include "tstring.h"
|
||||
#include "tdebug.h"
|
||||
#include "tagunion.h"
|
||||
#include "tpropertymap.h"
|
||||
#include "tagutils.h"
|
||||
|
||||
#include "wavpackfile.h"
|
||||
#include "id3v1tag.h"
|
||||
@@ -60,12 +60,12 @@ class WavPack::File::FilePrivate {
|
||||
delete properties;
|
||||
}
|
||||
|
||||
long APELocation;
|
||||
long APESize;
|
||||
long long APELocation;
|
||||
long long APESize;
|
||||
|
||||
long ID3v1Location;
|
||||
long long ID3v1Location;
|
||||
|
||||
TagUnion tag;
|
||||
DoubleTagUnion tag;
|
||||
|
||||
AudioProperties *properties;
|
||||
};
|
||||
@@ -109,14 +109,6 @@ Strawberry_TagLib::TagLib::Tag *WavPack::File::tag() const {
|
||||
return &d->tag;
|
||||
}
|
||||
|
||||
PropertyMap WavPack::File::properties() const {
|
||||
return d->tag.properties();
|
||||
}
|
||||
|
||||
void WavPack::File::removeUnsupportedProperties(const StringList &properties) {
|
||||
d->tag.removeUnsupportedProperties(properties);
|
||||
}
|
||||
|
||||
PropertyMap WavPack::File::setProperties(const PropertyMap &properties) {
|
||||
|
||||
if (ID3v1Tag())
|
||||
@@ -262,7 +254,7 @@ void WavPack::File::read(bool readProperties) {
|
||||
|
||||
if (readProperties) {
|
||||
|
||||
long streamLength;
|
||||
long long streamLength;
|
||||
|
||||
if (d->APELocation >= 0)
|
||||
streamLength = d->APELocation;
|
||||
|
||||
21
3rdparty/taglib/wavpack/wavpackfile.h
vendored
21
3rdparty/taglib/wavpack/wavpackfile.h
vendored
@@ -104,42 +104,33 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
~File() override;
|
||||
|
||||
/*!
|
||||
* Returns the Tag for this file.
|
||||
* This will be an APE tag, an ID3v1 tag or a combination of the two.
|
||||
*/
|
||||
virtual Strawberry_TagLib::TagLib::Tag *tag() const;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- export function.
|
||||
* If the file contains both an APE and an ID3v1 tag,
|
||||
* only APE will be converted to the PropertyMap.
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
|
||||
void removeUnsupportedProperties(const StringList &properties);
|
||||
Strawberry_TagLib::TagLib::Tag *tag() const override;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- import function.
|
||||
* Creates an APE tag if it does not exists and calls setProperties() on that.
|
||||
* Any existing ID3v1 tag will be updated as well.
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &);
|
||||
PropertyMap setProperties(const PropertyMap&) override;
|
||||
|
||||
/*!
|
||||
* Returns the MPC::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;
|
||||
|
||||
/*!
|
||||
* Saves the file.
|
||||
*
|
||||
* This returns true if the save was successful.
|
||||
*/
|
||||
virtual bool save();
|
||||
bool save() override;
|
||||
|
||||
/*!
|
||||
* Returns a pointer to the ID3v1 tag of the file.
|
||||
@@ -205,7 +196,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
static bool isSupported(IOStream *stream);
|
||||
|
||||
private:
|
||||
explicit File(const File&);
|
||||
File(const File&);
|
||||
File &operator=(const File&);
|
||||
|
||||
void read(bool readProperties);
|
||||
|
||||
44
3rdparty/taglib/wavpack/wavpackproperties.cpp
vendored
44
3rdparty/taglib/wavpack/wavpackproperties.cpp
vendored
@@ -27,8 +27,8 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
#include "tstring.h"
|
||||
#include "tdebug.h"
|
||||
|
||||
#include "wavpackproperties.h"
|
||||
#include "wavpackfile.h"
|
||||
@@ -40,14 +40,14 @@ using namespace Strawberry_TagLib::TagLib;
|
||||
|
||||
class WavPack::AudioProperties::AudioPropertiesPrivate {
|
||||
public:
|
||||
AudioPropertiesPrivate() : length(0),
|
||||
bitrate(0),
|
||||
sampleRate(0),
|
||||
channels(0),
|
||||
version(0),
|
||||
bitsPerSample(0),
|
||||
lossless(false),
|
||||
sampleFrames(0) {}
|
||||
explicit AudioPropertiesPrivate() : length(0),
|
||||
bitrate(0),
|
||||
sampleRate(0),
|
||||
channels(0),
|
||||
version(0),
|
||||
bitsPerSample(0),
|
||||
lossless(false),
|
||||
sampleFrames(0) {}
|
||||
|
||||
int length;
|
||||
int bitrate;
|
||||
@@ -63,7 +63,7 @@ class WavPack::AudioProperties::AudioPropertiesPrivate {
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WavPack::AudioProperties::AudioProperties(File *file, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
|
||||
WavPack::AudioProperties::AudioProperties(File *file, long long streamLength, ReadStyle) : Strawberry_TagLib::TagLib::AudioProperties(), d(new AudioPropertiesPrivate()) {
|
||||
read(file, streamLength);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ const unsigned int sample_rates[] = {
|
||||
|
||||
#define FINAL_BLOCK 0x1000
|
||||
|
||||
void WavPack::AudioProperties::read(File *file, long streamLength) {
|
||||
void WavPack::AudioProperties::read(File *file, long long streamLength) {
|
||||
|
||||
long offset = 0;
|
||||
|
||||
@@ -151,17 +151,17 @@ void WavPack::AudioProperties::read(File *file, long streamLength) {
|
||||
break;
|
||||
}
|
||||
|
||||
const unsigned int flags = data.toUInt(24, false);
|
||||
const unsigned int flags = data.toUInt32LE(24);
|
||||
|
||||
if (offset == 0) {
|
||||
d->version = data.toShort(8, false);
|
||||
d->version = data.toUInt16LE(8);
|
||||
if (d->version < MIN_STREAM_VERS || d->version > MAX_STREAM_VERS)
|
||||
break;
|
||||
|
||||
d->bitsPerSample = ((flags & BYTES_STORED) + 1) * 8 - ((flags & SHIFT_MASK) >> SHIFT_LSB);
|
||||
d->sampleRate = sample_rates[(flags & SRATE_MASK) >> SRATE_LSB];
|
||||
d->lossless = !(flags & LOSSLESS_FLAG);
|
||||
d->sampleFrames = data.toUInt(12, false);
|
||||
d->sampleFrames = data.toUInt32LE(12);
|
||||
}
|
||||
|
||||
d->channels += (flags & MONO_FLAG) ? 1 : 2;
|
||||
@@ -169,7 +169,7 @@ void WavPack::AudioProperties::read(File *file, long streamLength) {
|
||||
if (flags & FINAL_BLOCK)
|
||||
break;
|
||||
|
||||
const unsigned int blockSize = data.toUInt(4, false);
|
||||
const unsigned int blockSize = data.toUInt32LE(4);
|
||||
offset += blockSize + 8;
|
||||
}
|
||||
|
||||
@@ -184,9 +184,9 @@ void WavPack::AudioProperties::read(File *file, long streamLength) {
|
||||
|
||||
}
|
||||
|
||||
unsigned int WavPack::AudioProperties::seekFinalIndex(File *file, long streamLength) {
|
||||
unsigned int WavPack::AudioProperties::seekFinalIndex(File *file, long long streamLength) {
|
||||
|
||||
const long offset = file->rfind("wvpk", streamLength);
|
||||
const long long offset = file->rfind("wvpk", streamLength);
|
||||
if (offset == -1)
|
||||
return 0;
|
||||
|
||||
@@ -195,16 +195,16 @@ unsigned int WavPack::AudioProperties::seekFinalIndex(File *file, long streamLen
|
||||
if (data.size() < 32)
|
||||
return 0;
|
||||
|
||||
const int version = data.toShort(8, false);
|
||||
const int version = data.toUInt16LE(8);
|
||||
if (version < MIN_STREAM_VERS || version > MAX_STREAM_VERS)
|
||||
return 0;
|
||||
|
||||
const unsigned int flags = data.toUInt(24, false);
|
||||
const unsigned int flags = data.toUInt32LE(24);
|
||||
if (!(flags & FINAL_BLOCK))
|
||||
return 0;
|
||||
|
||||
const unsigned int blockIndex = data.toUInt(16, false);
|
||||
const unsigned int blockSamples = data.toUInt(20, false);
|
||||
const unsigned int blockIndex = data.toUInt32LE(16);
|
||||
const unsigned int blockSamples = data.toUInt32LE(20);
|
||||
|
||||
return blockIndex + blockSamples;
|
||||
|
||||
|
||||
21
3rdparty/taglib/wavpack/wavpackproperties.h
vendored
21
3rdparty/taglib/wavpack/wavpackproperties.h
vendored
@@ -54,12 +54,12 @@ class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioPro
|
||||
/*!
|
||||
* Create an instance of WavPack::Properties.
|
||||
*/
|
||||
explicit AudioProperties(File *file, long streamLength, ReadStyle style = Average);
|
||||
explicit AudioProperties(File *file, long long streamLength, ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Destroys this WavPack::AudioProperties instance.
|
||||
*/
|
||||
virtual ~AudioProperties();
|
||||
~AudioProperties() override;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in seconds.
|
||||
@@ -67,29 +67,29 @@ class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioPro
|
||||
*
|
||||
* \see lengthInMilliseconds()
|
||||
*/
|
||||
virtual int lengthInSeconds() const;
|
||||
int lengthInSeconds() const override;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in milliseconds.
|
||||
*
|
||||
* \see lengthInSeconds()
|
||||
*/
|
||||
virtual int lengthInMilliseconds() const;
|
||||
int lengthInMilliseconds() const override;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
*/
|
||||
virtual int bitrate() const;
|
||||
int bitrate() const override;
|
||||
|
||||
/*!
|
||||
* Returns the sample rate in Hz. 0 means unknown or custom.
|
||||
*/
|
||||
virtual int sampleRate() const;
|
||||
int sampleRate() const override;
|
||||
|
||||
/*!
|
||||
* Returns the number of audio channels.
|
||||
*/
|
||||
virtual int channels() const;
|
||||
int channels() const override;
|
||||
|
||||
/*!
|
||||
* Returns the number of bits per audio sample.
|
||||
@@ -112,11 +112,8 @@ class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioPro
|
||||
int version() const;
|
||||
|
||||
private:
|
||||
explicit AudioProperties(const AudioProperties&);
|
||||
AudioProperties &operator=(const AudioProperties&);
|
||||
|
||||
void read(File *file, long streamLength);
|
||||
unsigned int seekFinalIndex(File *file, long streamLength);
|
||||
void read(File *file, long long streamLength);
|
||||
unsigned int seekFinalIndex(File *file, long long streamLength);
|
||||
|
||||
class AudioPropertiesPrivate;
|
||||
AudioPropertiesPrivate *d;
|
||||
|
||||
Reference in New Issue
Block a user