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

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

View File

@@ -93,7 +93,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);
AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Constructs an APE file from \a stream.
@@ -104,7 +104,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);
AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Destroys this instance of the File.
@@ -135,10 +135,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the APE::Properties for this file.
* Returns the APE::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

@@ -38,9 +38,9 @@
using namespace Strawberry_TagLib::TagLib;
class APE::Properties::PropertiesPrivate {
class APE::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : length(0),
AudioPropertiesPrivate() : length(0),
bitrate(0),
sampleRate(0),
channels(0),
@@ -61,43 +61,43 @@ class APE::Properties::PropertiesPrivate {
// public members
////////////////////////////////////////////////////////////////////////////////
APE::Properties::Properties(File *file, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) {
APE::AudioProperties::AudioProperties(File *file, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file, streamLength);
}
APE::Properties::~Properties() {
APE::AudioProperties::~AudioProperties() {
delete d;
}
int APE::Properties::lengthInSeconds() const {
int APE::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int APE::Properties::lengthInMilliseconds() const {
int APE::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int APE::Properties::bitrate() const {
int APE::AudioProperties::bitrate() const {
return d->bitrate;
}
int APE::Properties::sampleRate() const {
int APE::AudioProperties::sampleRate() const {
return d->sampleRate;
}
int APE::Properties::channels() const {
int APE::AudioProperties::channels() const {
return d->channels;
}
int APE::Properties::version() const {
int APE::AudioProperties::version() const {
return d->version;
}
int APE::Properties::bitsPerSample() const {
int APE::AudioProperties::bitsPerSample() const {
return d->bitsPerSample;
}
unsigned int APE::Properties::sampleFrames() const {
unsigned int APE::AudioProperties::sampleFrames() const {
return d->sampleFrames;
}
@@ -114,7 +114,7 @@ int headerVersion(const ByteVector &header) {
}
} // namespace
void APE::Properties::read(File *file, long streamLength) {
void APE::AudioProperties::read(File *file, long streamLength) {
// First, we assume that the file pointer is set at the first descriptor.
long offset = file->tell();
@@ -128,7 +128,7 @@ void APE::Properties::read(File *file, long streamLength) {
}
if (version < 0) {
debug("APE::Properties::read() -- APE descriptor not found");
debug("APE::AudioProperties::read() -- APE descriptor not found");
return;
}
@@ -147,13 +147,13 @@ void APE::Properties::read(File *file, long streamLength) {
}
void APE::Properties::analyzeCurrent(File *file) {
void APE::AudioProperties::analyzeCurrent(File *file) {
// Read the descriptor
file->seek(2, File::Current);
const ByteVector descriptor = file->readBlock(44);
if (descriptor.size() < 44) {
debug("APE::Properties::analyzeCurrent() -- descriptor is too short.");
debug("APE::AudioProperties::analyzeCurrent() -- descriptor is too short.");
return;
}
@@ -165,7 +165,7 @@ void APE::Properties::analyzeCurrent(File *file) {
// Read the header
const ByteVector header = file->readBlock(24);
if (header.size() < 24) {
debug("APE::Properties::analyzeCurrent() -- MAC header is too short.");
debug("APE::AudioProperties::analyzeCurrent() -- MAC header is too short.");
return;
}
@@ -184,11 +184,11 @@ void APE::Properties::analyzeCurrent(File *file) {
}
void APE::Properties::analyzeOld(File *file) {
void APE::AudioProperties::analyzeOld(File *file) {
const ByteVector header = file->readBlock(26);
if (header.size() < 26) {
debug("APE::Properties::analyzeOld() -- MAC header is too short.");
debug("APE::AudioProperties::analyzeOld() -- MAC header is too short.");
return;
}
@@ -218,7 +218,7 @@ void APE::Properties::analyzeOld(File *file) {
file->seek(16, File::Current);
const ByteVector fmt = file->readBlock(28);
if (fmt.size() < 28 || !fmt.startsWith("WAVEfmt ")) {
debug("APE::Properties::analyzeOld() -- fmt header is too short.");
debug("APE::AudioProperties::analyzeOld() -- fmt header is too short.");
return;
}

View File

@@ -45,18 +45,18 @@ class File;
* This reads the data from an APE 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 APE::Properties with the data read from the APE::File \a file.
* Create an instance of APE::AudioProperties with the data read from the APE::File \a file.
*/
Properties(File *file, long streamLength, ReadStyle style = Average);
AudioProperties(File *file, long streamLength, ReadStyle style = Average);
/*!
* Destroys this APE::Properties instance.
* Destroys this APE::AudioProperties instance.
*/
virtual ~Properties();
virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -105,16 +105,16 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int version() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void read(File *file, long streamLength);
void analyzeCurrent(File *file);
void analyzeOld(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace APE
} // namespace TagLib