taglib: Rename Properties to AudioProperties

This commit is contained in:
Jonas Kvinge
2020-06-22 00:49:25 +02:00
parent f49c47c20d
commit 3a3dc02a66
80 changed files with 740 additions and 789 deletions

View File

@@ -69,7 +69,7 @@ class MPC::File::FilePrivate {
TagUnion tag;
Properties *properties;
AudioProperties *properties;
};
////////////////////////////////////////////////////////////////////////////////
@@ -90,14 +90,14 @@ bool MPC::File::isSupported(IOStream *stream) {
// public members
////////////////////////////////////////////////////////////////////////////////
MPC::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
MPC::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
}
MPC::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
MPC::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
@@ -127,7 +127,7 @@ PropertyMap MPC::File::setProperties(const PropertyMap &properties) {
return APETag(true)->setProperties(properties);
}
MPC::Properties *MPC::File::audioProperties() const {
MPC::AudioProperties *MPC::File::audioProperties() const {
return d->properties;
}
@@ -310,7 +310,7 @@ void MPC::File::read(bool readProperties) {
seek(0);
}
d->properties = new Properties(this, streamLength);
d->properties = new AudioProperties(this, streamLength);
}
}

View File

@@ -89,7 +89,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average);
File(FileName file, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Constructs an MPC file from \a stream.
@@ -99,7 +99,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average);
File(IOStream *stream, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Destroys this instance of the File.
@@ -128,10 +128,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the MPC::Properties for this file.
* Returns the MPC::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer.
*/
virtual Properties *audioProperties() const;
virtual AudioProperties *audioProperties() const;
/*!
* Saves the file.

View File

@@ -33,9 +33,9 @@
using namespace Strawberry_TagLib::TagLib;
class MPC::Properties::PropertiesPrivate {
class MPC::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : version(0),
AudioPropertiesPrivate() : version(0),
length(0),
bitrate(0),
sampleRate(0),
@@ -64,11 +64,11 @@ class MPC::Properties::PropertiesPrivate {
// public members
////////////////////////////////////////////////////////////////////////////////
MPC::Properties::Properties(const ByteVector &data, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) {
MPC::AudioProperties::AudioProperties(const ByteVector &data, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
readSV7(data, streamLength);
}
MPC::Properties::Properties(File *file, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) {
MPC::AudioProperties::AudioProperties(File *file, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
ByteVector magic = file->readBlock(4);
if (magic == "MPCK") {
@@ -82,55 +82,55 @@ MPC::Properties::Properties(File *file, long streamLength, ReadStyle style) : Au
}
MPC::Properties::~Properties() {
MPC::AudioProperties::~AudioProperties() {
delete d;
}
int MPC::Properties::lengthInSeconds() const {
int MPC::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int MPC::Properties::lengthInMilliseconds() const {
int MPC::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int MPC::Properties::bitrate() const {
int MPC::AudioProperties::bitrate() const {
return d->bitrate;
}
int MPC::Properties::sampleRate() const {
int MPC::AudioProperties::sampleRate() const {
return d->sampleRate;
}
int MPC::Properties::channels() const {
int MPC::AudioProperties::channels() const {
return d->channels;
}
int MPC::Properties::mpcVersion() const {
int MPC::AudioProperties::mpcVersion() const {
return d->version;
}
unsigned int MPC::Properties::totalFrames() const {
unsigned int MPC::AudioProperties::totalFrames() const {
return d->totalFrames;
}
unsigned int MPC::Properties::sampleFrames() const {
unsigned int MPC::AudioProperties::sampleFrames() const {
return d->sampleFrames;
}
int MPC::Properties::trackGain() const {
int MPC::AudioProperties::trackGain() const {
return d->trackGain;
}
int MPC::Properties::trackPeak() const {
int MPC::AudioProperties::trackPeak() const {
return d->trackPeak;
}
int MPC::Properties::albumGain() const {
int MPC::AudioProperties::albumGain() const {
return d->albumGain;
}
int MPC::Properties::albumPeak() const {
int MPC::AudioProperties::albumPeak() const {
return d->albumPeak;
}
@@ -184,7 +184,7 @@ unsigned long readSize(const ByteVector &data, unsigned int &pos) {
const unsigned short sftable[8] = { 44100, 48000, 37800, 32000, 0, 0, 0, 0 };
} // namespace
void MPC::Properties::readSV8(File *file, long streamLength) {
void MPC::AudioProperties::readSV8(File *file, long streamLength) {
bool readSH = false, readRG = false;
@@ -195,7 +195,7 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
bool eof;
const unsigned long packetSize = readSize(file, packetSizeLength, eof);
if (eof) {
debug("MPC::Properties::readSV8() - Reached to EOF.");
debug("MPC::AudioProperties::readSV8() - Reached to EOF.");
break;
}
@@ -203,7 +203,7 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
const ByteVector data = file->readBlock(dataSize);
if (data.size() != dataSize) {
debug("MPC::Properties::readSV8() - dataSize doesn't match the actual data size.");
debug("MPC::AudioProperties::readSV8() - dataSize doesn't match the actual data size.");
break;
}
@@ -212,7 +212,7 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
// http://trac.musepack.net/wiki/SV8Specification#StreamHeaderPacket
if (dataSize <= 5) {
debug("MPC::Properties::readSV8() - \"SH\" packet is too short to parse.");
debug("MPC::AudioProperties::readSV8() - \"SH\" packet is too short to parse.");
break;
}
@@ -223,13 +223,13 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
pos += 1;
d->sampleFrames = readSize(data, pos);
if (pos > dataSize - 3) {
debug("MPC::Properties::readSV8() - \"SH\" packet is corrupt.");
debug("MPC::AudioProperties::readSV8() - \"SH\" packet is corrupt.");
break;
}
const unsigned long begSilence = readSize(data, pos);
if (pos > dataSize - 2) {
debug("MPC::Properties::readSV8() - \"SH\" packet is corrupt.");
debug("MPC::AudioProperties::readSV8() - \"SH\" packet is corrupt.");
break;
}
@@ -251,7 +251,7 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
// http://trac.musepack.net/wiki/SV8Specification#ReplaygainPacket
if (dataSize <= 9) {
debug("MPC::Properties::readSV8() - \"RG\" packet is too short to parse.");
debug("MPC::AudioProperties::readSV8() - \"RG\" packet is too short to parse.");
break;
}
@@ -277,7 +277,7 @@ void MPC::Properties::readSV8(File *file, long streamLength) {
}
void MPC::Properties::readSV7(const ByteVector &data, long streamLength) {
void MPC::AudioProperties::readSV7(const ByteVector &data, long streamLength) {
if (data.startsWith("MP+")) {
d->version = data[3] & 15;

View File

@@ -44,24 +44,24 @@ static const unsigned int HeaderSize = 8 * 7;
* This reads the data from an MPC stream found in the AudioProperties API.
*/
class TAGLIB_EXPORT Properties : public AudioProperties {
class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public:
/*!
* Create an instance of MPC::Properties with the data read from the ByteVector \a data.
* Create an instance of MPC::AudioProperties with the data read from the ByteVector \a data.
*
* This constructor is deprecated. It only works for MPC version up to 7.
*/
Properties(const ByteVector &data, long streamLength, ReadStyle style = Average);
AudioProperties(const ByteVector &data, long streamLength, ReadStyle style = Average);
/*!
* Create an instance of MPC::Properties with the data read directly from a MPC::File.
* Create an instance of MPC::AudioProperties with the data read directly from a MPC::File.
*/
Properties(File *file, long streamLength, ReadStyle style = Average);
AudioProperties(File *file, long streamLength, ReadStyle style = Average);
/*!
* Destroys this MPC::Properties instance.
* Destroys this MPC::AudioProperties instance.
*/
virtual ~Properties();
virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds.
@@ -130,14 +130,14 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int albumPeak() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void readSV7(const ByteVector &data, long streamLength);
void readSV8(File *file, long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace MPC
} // namespace TagLib