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

@@ -43,7 +43,7 @@ class RIFF::AIFF::File::FilePrivate {
delete tag;
}
Properties *properties;
AudioProperties *properties;
ID3v2::Tag *tag;
bool hasID3v2;
@@ -66,13 +66,13 @@ bool RIFF::AIFF::File::isSupported(IOStream *stream) {
// public members
////////////////////////////////////////////////////////////////////////////////
RIFF::AIFF::File::File(FileName file, bool readProperties, Properties::ReadStyle) : RIFF::File(file, BigEndian), d(new FilePrivate()) {
RIFF::AIFF::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : RIFF::File(file, BigEndian), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
}
RIFF::AIFF::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : RIFF::File(stream, BigEndian), d(new FilePrivate()) {
RIFF::AIFF::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : RIFF::File(stream, BigEndian), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
@@ -98,7 +98,7 @@ PropertyMap RIFF::AIFF::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(properties);
}
RIFF::AIFF::Properties *RIFF::AIFF::File::audioProperties() const {
RIFF::AIFF::AudioProperties *RIFF::AIFF::File::audioProperties() const {
return d->properties;
}
@@ -160,6 +160,6 @@ void RIFF::AIFF::File::read(bool readProperties) {
d->tag = new ID3v2::Tag();
if (readProperties)
d->properties = new Properties(this, Properties::Average);
d->properties = new AudioProperties(this, AudioProperties::Average);
}

View File

@@ -63,7 +63,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::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 AIFF file from \a stream.
@@ -75,7 +75,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::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.
@@ -107,10 +107,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the AIFF::Properties for this file.
* Returns the AIFF::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.
@@ -143,7 +143,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
void read(bool readProperties);
friend class Properties;
friend class AudioProperties;
class FilePrivate;
FilePrivate *d;

View File

@@ -30,9 +30,9 @@
using namespace Strawberry_TagLib::TagLib;
class RIFF::AIFF::Properties::PropertiesPrivate {
class RIFF::AIFF::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : length(0),
AudioPropertiesPrivate() : length(0),
bitrate(0),
sampleRate(0),
channels(0),
@@ -55,51 +55,51 @@ class RIFF::AIFF::Properties::PropertiesPrivate {
// public members
////////////////////////////////////////////////////////////////////////////////
RIFF::AIFF::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) {
RIFF::AIFF::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file);
}
RIFF::AIFF::Properties::~Properties() {
RIFF::AIFF::AudioProperties::~AudioProperties() {
delete d;
}
int RIFF::AIFF::Properties::lengthInSeconds() const {
int RIFF::AIFF::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int RIFF::AIFF::Properties::lengthInMilliseconds() const {
int RIFF::AIFF::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int RIFF::AIFF::Properties::bitrate() const {
int RIFF::AIFF::AudioProperties::bitrate() const {
return d->bitrate;
}
int RIFF::AIFF::Properties::sampleRate() const {
int RIFF::AIFF::AudioProperties::sampleRate() const {
return d->sampleRate;
}
int RIFF::AIFF::Properties::channels() const {
int RIFF::AIFF::AudioProperties::channels() const {
return d->channels;
}
int RIFF::AIFF::Properties::bitsPerSample() const {
int RIFF::AIFF::AudioProperties::bitsPerSample() const {
return d->bitsPerSample;
}
unsigned int RIFF::AIFF::Properties::sampleFrames() const {
unsigned int RIFF::AIFF::AudioProperties::sampleFrames() const {
return d->sampleFrames;
}
bool RIFF::AIFF::Properties::isAiffC() const {
bool RIFF::AIFF::AudioProperties::isAiffC() const {
return (!d->compressionType.isEmpty());
}
ByteVector RIFF::AIFF::Properties::compressionType() const {
ByteVector RIFF::AIFF::AudioProperties::compressionType() const {
return d->compressionType;
}
String RIFF::AIFF::Properties::compressionName() const {
String RIFF::AIFF::AudioProperties::compressionName() const {
return d->compressionName;
}
@@ -107,7 +107,7 @@ String RIFF::AIFF::Properties::compressionName() const {
// private members
////////////////////////////////////////////////////////////////////////////////
void RIFF::AIFF::Properties::read(File *file) {
void RIFF::AIFF::AudioProperties::read(File *file) {
ByteVector data;
unsigned int streamLength = 0;
@@ -117,23 +117,23 @@ void RIFF::AIFF::Properties::read(File *file) {
if (data.isEmpty())
data = file->chunkData(i);
else
debug("RIFF::AIFF::Properties::read() - Duplicate 'COMM' chunk found.");
debug("RIFF::AIFF::AudioProperties::read() - Duplicate 'COMM' chunk found.");
}
else if (name == "SSND") {
if (streamLength == 0)
streamLength = file->chunkDataSize(i) + file->chunkPadding(i);
else
debug("RIFF::AIFF::Properties::read() - Duplicate 'SSND' chunk found.");
debug("RIFF::AIFF::AudioProperties::read() - Duplicate 'SSND' chunk found.");
}
}
if (data.size() < 18) {
debug("RIFF::AIFF::Properties::read() - 'COMM' chunk not found or too short.");
debug("RIFF::AIFF::AudioProperties::read() - 'COMM' chunk not found or too short.");
return;
}
if (streamLength == 0) {
debug("RIFF::AIFF::Properties::read() - 'SSND' chunk not found.");
debug("RIFF::AIFF::AudioProperties::read() - 'SSND' chunk not found.");
return;
}

View File

@@ -41,18 +41,18 @@ class File;
* This reads the data from an AIFF 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 AIFF::Properties with the data read from the AIFF::File \a file.
* Create an instance of AIFF::AudioProperties with the data read from the AIFF::File \a file.
*/
Properties(File *file, ReadStyle style);
AudioProperties(File *file, ReadStyle style);
/*!
* Destroys this AIFF::Properties instance.
* Destroys this AIFF::AudioProperties instance.
*/
virtual ~Properties();
virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -119,13 +119,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
String compressionName() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void read(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace AIFF
} // namespace RIFF

View File

@@ -51,7 +51,7 @@ class RIFF::WAV::File::FilePrivate {
delete properties;
}
Properties *properties;
AudioProperties *properties;
TagUnion tag;
bool hasID3v2;
@@ -75,14 +75,14 @@ bool RIFF::WAV::File::isSupported(IOStream *stream) {
// public members
////////////////////////////////////////////////////////////////////////////////
RIFF::WAV::File::File(FileName file, bool readProperties, Properties::ReadStyle) : RIFF::File(file, LittleEndian), d(new FilePrivate()) {
RIFF::WAV::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : RIFF::File(file, LittleEndian), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
}
RIFF::WAV::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : RIFF::File(stream, LittleEndian), d(new FilePrivate()) {
RIFF::WAV::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : RIFF::File(stream, LittleEndian), d(new FilePrivate()) {
if (isOpen())
read(readProperties);
@@ -132,7 +132,7 @@ PropertyMap RIFF::WAV::File::setProperties(const PropertyMap &properties) {
}
RIFF::WAV::Properties *RIFF::WAV::File::audioProperties() const {
RIFF::WAV::AudioProperties *RIFF::WAV::File::audioProperties() const {
return d->properties;
}
@@ -223,7 +223,7 @@ void RIFF::WAV::File::read(bool readProperties) {
d->tag.set(InfoIndex, new RIFF::Info::Tag());
if (readProperties)
d->properties = new Properties(this, Properties::Average);
d->properties = new AudioProperties(this, AudioProperties::Average);
}
void RIFF::WAV::File::removeTagChunks(TagTypes tags) {

View File

@@ -75,7 +75,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::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 a WAV file from \a stream.
@@ -85,7 +85,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::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.
@@ -142,10 +142,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the WAV::Properties for this file. If no audio properties
* Returns the WAV::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.
@@ -187,7 +187,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
void read(bool readProperties);
void removeTagChunks(TagTypes tags);
friend class Properties;
friend class AudioProperties;
class FilePrivate;
FilePrivate *d;

View File

@@ -37,9 +37,9 @@ enum WaveFormat {
};
} // namespace
class RIFF::WAV::Properties::PropertiesPrivate {
class RIFF::WAV::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : format(0),
AudioPropertiesPrivate() : format(0),
length(0),
bitrate(0),
sampleRate(0),
@@ -60,43 +60,43 @@ class RIFF::WAV::Properties::PropertiesPrivate {
// public members
////////////////////////////////////////////////////////////////////////////////
Strawberry_TagLib::TagLib::RIFF::WAV::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style),d(new PropertiesPrivate()) {
Strawberry_TagLib::TagLib::RIFF::WAV::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style),d(new AudioPropertiesPrivate()) {
read(file);
}
RIFF::WAV::Properties::~Properties() {
RIFF::WAV::AudioProperties::~AudioProperties() {
delete d;
}
int RIFF::WAV::Properties::lengthInSeconds() const {
int RIFF::WAV::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int RIFF::WAV::Properties::lengthInMilliseconds() const {
int RIFF::WAV::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int RIFF::WAV::Properties::bitrate() const {
int RIFF::WAV::AudioProperties::bitrate() const {
return d->bitrate;
}
int RIFF::WAV::Properties::sampleRate() const {
int RIFF::WAV::AudioProperties::sampleRate() const {
return d->sampleRate;
}
int RIFF::WAV::Properties::channels() const {
int RIFF::WAV::AudioProperties::channels() const {
return d->channels;
}
int RIFF::WAV::Properties::bitsPerSample() const {
int RIFF::WAV::AudioProperties::bitsPerSample() const {
return d->bitsPerSample;
}
unsigned int RIFF::WAV::Properties::sampleFrames() const {
unsigned int RIFF::WAV::AudioProperties::sampleFrames() const {
return d->sampleFrames;
}
int RIFF::WAV::Properties::format() const {
int RIFF::WAV::AudioProperties::format() const {
return d->format;
}
@@ -104,7 +104,7 @@ int RIFF::WAV::Properties::format() const {
// private members
////////////////////////////////////////////////////////////////////////////////
void RIFF::WAV::Properties::read(File *file) {
void RIFF::WAV::AudioProperties::read(File *file) {
ByteVector data;
unsigned int streamLength = 0;
@@ -116,35 +116,35 @@ void RIFF::WAV::Properties::read(File *file) {
if (data.isEmpty())
data = file->chunkData(i);
else
debug("RIFF::WAV::Properties::read() - Duplicate 'fmt ' chunk found.");
debug("RIFF::WAV::AudioProperties::read() - Duplicate 'fmt ' chunk found.");
}
else if (name == "data") {
if (streamLength == 0)
streamLength = file->chunkDataSize(i) + file->chunkPadding(i);
else
debug("RIFF::WAV::Properties::read() - Duplicate 'data' chunk found.");
debug("RIFF::WAV::AudioProperties::read() - Duplicate 'data' chunk found.");
}
else if (name == "fact") {
if (totalSamples == 0)
totalSamples = file->chunkData(i).toUInt(0, false);
else
debug("RIFF::WAV::Properties::read() - Duplicate 'fact' chunk found.");
debug("RIFF::WAV::AudioProperties::read() - Duplicate 'fact' chunk found.");
}
}
if (data.size() < 16) {
debug("RIFF::WAV::Properties::read() - 'fmt ' chunk not found or too short.");
debug("RIFF::WAV::AudioProperties::read() - 'fmt ' chunk not found or too short.");
return;
}
if (streamLength == 0) {
debug("RIFF::WAV::Properties::read() - 'data' chunk not found.");
debug("RIFF::WAV::AudioProperties::read() - 'data' chunk not found.");
return;
}
d->format = data.toShort(0, false);
if (d->format != FORMAT_PCM && totalSamples == 0) {
debug("RIFF::WAV::Properties::read() - Non-PCM format, but 'fact' chunk not found.");
debug("RIFF::WAV::AudioProperties::read() - Non-PCM format, but 'fact' chunk not found.");
return;
}

View File

@@ -46,17 +46,17 @@ class File;
* API.
*/
class TAGLIB_EXPORT Properties : public AudioProperties {
class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public:
/*!
* Create an instance of WAV::Properties with the data read from the WAV::File \a file.
* Create an instance of WAV::AudioProperties with the data read from the WAV::File \a file.
*/
Properties(File *file, ReadStyle style);
AudioProperties(File *file, ReadStyle style);
/*!
* Destroys this WAV::Properties instance.
* Destroys this WAV::AudioProperties instance.
*/
virtual ~Properties();
virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds.
@@ -109,13 +109,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int format() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void read(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace WAV