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

@@ -51,7 +51,7 @@ class DSF::File::FilePrivate {
long long fileSize;
long long metadataOffset;
Properties *properties;
AudioProperties *properties;
ID3v2::Tag *tag;
};
@@ -72,14 +72,14 @@ bool DSF::File::isSupported(IOStream *stream) {
////////////////////////////////////////////////////////////////////////////////
DSF::File::File(FileName file, bool readProperties,
Properties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
if (isOpen())
read(readProperties, propertiesStyle);
}
DSF::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
DSF::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
if (isOpen())
read(readProperties, propertiesStyle);
@@ -102,7 +102,7 @@ PropertyMap DSF::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(properties);
}
DSF::Properties *DSF::File::audioProperties() const {
DSF::AudioProperties *DSF::File::audioProperties() const {
return d->properties;
}
@@ -170,7 +170,7 @@ bool DSF::File::save() {
////////////////////////////////////////////////////////////////////////////////
void DSF::File::read(bool, Properties::ReadStyle propertiesStyle) {
void DSF::File::read(bool, AudioProperties::ReadStyle propertiesStyle) {
// A DSF file consists of four chunks: DSD chunk, format chunk, data chunk, and metadata chunk
// The file format is not chunked in the sense of a RIFF File, though
@@ -220,7 +220,7 @@ void DSF::File::read(bool, Properties::ReadStyle propertiesStyle) {
chunkSize = readBlock(8).toLongLong(false);
d->properties = new Properties(readBlock(chunkSize), propertiesStyle);
d->properties = new AudioProperties(readBlock(chunkSize), propertiesStyle);
// Skip the data chunk

View File

@@ -60,7 +60,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Constructs an DSF file from \a file.
@@ -68,7 +68,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* If false, \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.
@@ -96,7 +96,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* Returns the DSF::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.
@@ -115,7 +115,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
File(const File &);
File &operator=(const File &);
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
void read(bool readProperties, AudioProperties::ReadStyle propertiesStyle);
class FilePrivate;
FilePrivate *d;

View File

@@ -30,9 +30,9 @@
using namespace Strawberry_TagLib::TagLib;
class DSF::Properties::PropertiesPrivate {
class DSF::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : formatVersion(0),
AudioPropertiesPrivate() : formatVersion(0),
formatID(0),
channelType(0),
channelNum(0),
@@ -63,61 +63,57 @@ class DSF::Properties::PropertiesPrivate {
// public members
////////////////////////////////////////////////////////////////////////////////
DSF::Properties::Properties(const ByteVector &data, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) {
d = new PropertiesPrivate;
DSF::AudioProperties::AudioProperties(const ByteVector &data, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) {
d = new AudioPropertiesPrivate;
read(data);
}
DSF::Properties::~Properties() {
DSF::AudioProperties::~AudioProperties() {
delete d;
}
int DSF::Properties::length() const {
return lengthInSeconds();
}
int DSF::Properties::lengthInSeconds() const {
int DSF::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int DSF::Properties::lengthInMilliseconds() const {
int DSF::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int DSF::Properties::bitrate() const {
int DSF::AudioProperties::bitrate() const {
return d->bitrate;
}
int DSF::Properties::sampleRate() const {
int DSF::AudioProperties::sampleRate() const {
return d->samplingFrequency;
}
int DSF::Properties::channels() const {
int DSF::AudioProperties::channels() const {
return d->channelNum;
}
// DSF specific
int DSF::Properties::formatVersion() const {
int DSF::AudioProperties::formatVersion() const {
return d->formatVersion;
}
int DSF::Properties::formatID() const {
int DSF::AudioProperties::formatID() const {
return d->formatID;
}
int DSF::Properties::channelType() const {
int DSF::AudioProperties::channelType() const {
return d->channelType;
}
int DSF::Properties::bitsPerSample() const {
int DSF::AudioProperties::bitsPerSample() const {
return d->bitsPerSample;
}
long long DSF::Properties::sampleCount() const {
long long DSF::AudioProperties::sampleCount() const {
return d->sampleCount;
}
int DSF::Properties::blockSizePerChannel() const {
int DSF::AudioProperties::blockSizePerChannel() const {
return d->blockSizePerChannel;
}
@@ -125,7 +121,7 @@ int DSF::Properties::blockSizePerChannel() const {
// private members
////////////////////////////////////////////////////////////////////////////////
void DSF::Properties::read(const ByteVector &data) {
void DSF::AudioProperties::read(const ByteVector &data) {
d->formatVersion = data.toUInt(0U, false);
d->formatID = data.toUInt(4U, false);
d->channelType = data.toUInt(8U, false);

View File

@@ -40,21 +40,20 @@ class File;
* This reads the data from a DSF stream found in the AudioProperties API.
*/
class TAGLIB_EXPORT Properties : public Strawberry_TagLib::TagLib::AudioProperties {
class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public:
/*!
* Create an instance of DSF::AudioProperties with the data read from the ByteVector \a data.
*/
Properties(const ByteVector &data, ReadStyle style);
AudioProperties(const ByteVector &data, ReadStyle style);
/*!
* Destroys this DSF::AudioProperties instance.
*/
virtual ~Properties();
virtual ~AudioProperties();
// Reimplementations.
virtual int length() const;
virtual int lengthInSeconds() const;
virtual int lengthInMilliseconds() const;
virtual int bitrate() const;
@@ -80,13 +79,13 @@ class TAGLIB_EXPORT Properties : public Strawberry_TagLib::TagLib::AudioProperti
int blockSizePerChannel() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void read(const ByteVector &data);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace DSF
} // namespace TagLib