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; TagUnion tag;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -98,14 +98,14 @@ bool APE::File::isSupported(IOStream *) {
// public members // 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()) if (isOpen())
read(readProperties); 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()) if (isOpen())
read(readProperties); 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; return d->properties;
} }
@@ -300,7 +300,7 @@ void APE::File::read(bool readProperties) {
seek(0); 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. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an APE file from \a stream. * 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. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -135,10 +135,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &); 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. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.

View File

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

View File

@@ -45,18 +45,18 @@ class File;
* This reads the data from an APE stream found in the AudioProperties API. * 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: 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. * 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; int version() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file, long streamLength); void read(File *file, long streamLength);
void analyzeCurrent(File *file); void analyzeCurrent(File *file);
void analyzeOld(File *file); void analyzeOld(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace APE } // namespace APE
} // namespace TagLib } // namespace TagLib

View File

@@ -68,7 +68,7 @@ class ASF::File::FilePrivate {
unsigned long long headerSize; unsigned long long headerSize;
ASF::Tag *tag; ASF::Tag *tag;
ASF::Properties *properties; ASF::AudioProperties *properties;
List<BaseObject *> objects; List<BaseObject *> objects;
@@ -474,12 +474,12 @@ bool ASF::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ASF::File::File(FileName file, bool, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) { ASF::File::File(FileName file, bool, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(); read();
} }
ASF::File::File(IOStream *stream, bool, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) { ASF::File::File(IOStream *stream, bool, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(); read();
} }
@@ -504,7 +504,7 @@ PropertyMap ASF::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(properties); return d->tag->setProperties(properties);
} }
ASF::Properties *ASF::File::audioProperties() const { ASF::AudioProperties *ASF::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -609,7 +609,7 @@ void ASF::File::read() {
} }
d->tag = new ASF::Tag(); d->tag = new ASF::Tag();
d->properties = new ASF::Properties(); d->properties = new ASF::AudioProperties();
bool ok; bool ok;
d->headerSize = readQWORD(this, &ok); d->headerSize = readQWORD(this, &ok);

View File

@@ -54,7 +54,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* read. * read.
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an ASF file from \a stream. * Constructs an ASF file from \a stream.
@@ -66,7 +66,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note TagLib will *not* take ownership of the stream, the caller is * \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object. * responsible for deleting it after the File object.
*/ */
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. * Destroys this instance of the File.
@@ -103,7 +103,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
/*! /*!
* Returns the ASF audio properties for this file. * Returns the ASF audio properties for this file.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -29,14 +29,14 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class ASF::Properties::PropertiesPrivate { class ASF::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
channels(0), channels(0),
bitsPerSample(0), bitsPerSample(0),
codec(ASF::Properties::Unknown), codec(ASF::AudioProperties::Unknown),
encrypted(false) {} encrypted(false) {}
int length; int length;
@@ -44,7 +44,7 @@ class ASF::Properties::PropertiesPrivate {
int sampleRate; int sampleRate;
int channels; int channels;
int bitsPerSample; int bitsPerSample;
ASF::Properties::Codec codec; ASF::AudioProperties::Codec codec;
String codecName; String codecName;
String codecDescription; String codecDescription;
bool encrypted; bool encrypted;
@@ -54,51 +54,51 @@ class ASF::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ASF::Properties::Properties() : AudioProperties(AudioProperties::Average), ASF::AudioProperties::AudioProperties() : Strawberry_TagLib::TagLib::AudioProperties(AudioProperties::Average),
d(new PropertiesPrivate()) { d(new AudioPropertiesPrivate()) {
} }
ASF::Properties::~Properties() { ASF::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int ASF::Properties::lengthInSeconds() const { int ASF::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int ASF::Properties::lengthInMilliseconds() const { int ASF::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int ASF::Properties::bitrate() const { int ASF::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int ASF::Properties::sampleRate() const { int ASF::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int ASF::Properties::channels() const { int ASF::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int ASF::Properties::bitsPerSample() const { int ASF::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
ASF::Properties::Codec ASF::Properties::codec() const { ASF::AudioProperties::Codec ASF::AudioProperties::codec() const {
return d->codec; return d->codec;
} }
String ASF::Properties::codecName() const { String ASF::AudioProperties::codecName() const {
return d->codecName; return d->codecName;
} }
String ASF::Properties::codecDescription() const { String ASF::AudioProperties::codecDescription() const {
return d->codecDescription; return d->codecDescription;
} }
bool ASF::Properties::isEncrypted() const { bool ASF::AudioProperties::isEncrypted() const {
return d->encrypted; return d->encrypted;
} }
@@ -106,31 +106,31 @@ bool ASF::Properties::isEncrypted() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ASF::Properties::setLength(int /*length*/) { void ASF::AudioProperties::setLength(int /*length*/) {
debug("ASF::Properties::setLength() -- This method is deprecated. Do not use."); debug("ASF::AudioProperties::setLength() -- This method is deprecated. Do not use.");
} }
void ASF::Properties::setLengthInMilliseconds(int value) { void ASF::AudioProperties::setLengthInMilliseconds(int value) {
d->length = value; d->length = value;
} }
void ASF::Properties::setBitrate(int value) { void ASF::AudioProperties::setBitrate(int value) {
d->bitrate = value; d->bitrate = value;
} }
void ASF::Properties::setSampleRate(int value) { void ASF::AudioProperties::setSampleRate(int value) {
d->sampleRate = value; d->sampleRate = value;
} }
void ASF::Properties::setChannels(int value) { void ASF::AudioProperties::setChannels(int value) {
d->channels = value; d->channels = value;
} }
void ASF::Properties::setBitsPerSample(int value) { void ASF::AudioProperties::setBitsPerSample(int value) {
d->bitsPerSample = value; d->bitsPerSample = value;
} }
void ASF::Properties::setCodec(int value) { void ASF::AudioProperties::setCodec(int value) {
switch (value) { switch (value) {
case 0x0160: case 0x0160:
@@ -152,14 +152,14 @@ void ASF::Properties::setCodec(int value) {
} }
void ASF::Properties::setCodecName(const String &value) { void ASF::AudioProperties::setCodecName(const String &value) {
d->codecName = value; d->codecName = value;
} }
void ASF::Properties::setCodecDescription(const String &value) { void ASF::AudioProperties::setCodecDescription(const String &value) {
d->codecDescription = value; d->codecDescription = value;
} }
void ASF::Properties::setEncrypted(bool value) { void ASF::AudioProperties::setEncrypted(bool value) {
d->encrypted = value; d->encrypted = value;
} }

View File

@@ -35,7 +35,7 @@ namespace TagLib {
namespace ASF { namespace ASF {
//! An implementation of ASF audio properties //! An implementation of ASF audio properties
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Audio codec types can be used in ASF file. * Audio codec types can be used in ASF file.
@@ -70,12 +70,12 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
/*! /*!
* Creates an instance of ASF::Properties. * Creates an instance of ASF::Properties.
*/ */
Properties(); AudioProperties();
/*! /*!
* Destroys this ASF::Properties instance. * Destroys this ASF::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to * Returns the length of the file in seconds. The length is rounded down to
@@ -160,8 +160,8 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
#endif #endif
private: private:
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace ASF } // namespace ASF

View File

@@ -49,41 +49,40 @@ using namespace Strawberry_TagLib::TagLib;
// Should be true virtual functions in taglib2. // Should be true virtual functions in taglib2.
#define VIRTUAL_FUNCTION_WORKAROUND(function_name, default_value) \ #define VIRTUAL_FUNCTION_WORKAROUND(function_name, default_value) \
if (dynamic_cast<const APE::Properties*>(this)) \ if (dynamic_cast<const APE::AudioProperties*>(this)) \
return dynamic_cast<const APE::Properties*>(this)->function_name(); \ return dynamic_cast<const APE::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const ASF::Properties*>(this)) \ else if (dynamic_cast<const ASF::AudioProperties*>(this)) \
return dynamic_cast<const ASF::Properties*>(this)->function_name(); \ return dynamic_cast<const ASF::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const FLAC::Properties*>(this)) \ else if (dynamic_cast<const FLAC::AudioProperties*>(this)) \
return dynamic_cast<const FLAC::Properties*>(this)->function_name(); \ return dynamic_cast<const FLAC::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const MP4::Properties*>(this)) \ else if (dynamic_cast<const MP4::AudioProperties*>(this)) \
return dynamic_cast<const MP4::Properties*>(this)->function_name(); \ return dynamic_cast<const MP4::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const MPC::Properties*>(this)) \ else if (dynamic_cast<const MPC::AudioProperties*>(this)) \
return dynamic_cast<const MPC::Properties*>(this)->function_name(); \ return dynamic_cast<const MPC::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const MPEG::Properties*>(this)) \ else if (dynamic_cast<const MPEG::AudioProperties*>(this)) \
return dynamic_cast<const MPEG::Properties*>(this)->function_name(); \ return dynamic_cast<const MPEG::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const Ogg::Opus::Properties*>(this)) \ else if (dynamic_cast<const Ogg::Opus::AudioProperties*>(this)) \
return dynamic_cast<const Ogg::Opus::Properties*>(this)->function_name(); \ return dynamic_cast<const Ogg::Opus::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const Ogg::Speex::Properties*>(this)) \ else if (dynamic_cast<const Ogg::Speex::AudioProperties*>(this)) \
return dynamic_cast<const Ogg::Speex::Properties*>(this)->function_name(); \ return dynamic_cast<const Ogg::Speex::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const TrueAudio::Properties*>(this)) \ else if (dynamic_cast<const TrueAudio::AudioProperties*>(this)) \
return dynamic_cast<const TrueAudio::Properties*>(this)->function_name(); \ return dynamic_cast<const TrueAudio::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const RIFF::AIFF::Properties*>(this)) \ else if (dynamic_cast<const RIFF::AIFF::AudioProperties*>(this)) \
return dynamic_cast<const RIFF::AIFF::Properties*>(this)->function_name(); \ return dynamic_cast<const RIFF::AIFF::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const RIFF::WAV::Properties*>(this)) \ else if (dynamic_cast<const RIFF::WAV::AudioProperties*>(this)) \
return dynamic_cast<const RIFF::WAV::Properties*>(this)->function_name(); \ return dynamic_cast<const RIFF::WAV::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const Vorbis::Properties*>(this)) \ else if (dynamic_cast<const Vorbis::AudioProperties*>(this)) \
return dynamic_cast<const Vorbis::Properties*>(this)->function_name(); \ return dynamic_cast<const Vorbis::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const WavPack::Properties*>(this)) \ else if (dynamic_cast<const WavPack::AudioProperties*>(this)) \
return dynamic_cast<const WavPack::Properties*>(this)->function_name(); \ return dynamic_cast<const WavPack::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const DSF::Properties*>(this)) \ else if (dynamic_cast<const DSF::AudioProperties*>(this)) \
return dynamic_cast<const DSF::Properties*>(this)->function_name(); \ return dynamic_cast<const DSF::AudioProperties*>(this)->function_name(); \
else if (dynamic_cast<const DSDIFF::Properties*>(this)) \ else if (dynamic_cast<const DSDIFF::AudioProperties*>(this)) \
return dynamic_cast<const DSDIFF::Properties*>(this)->function_name(); \ return dynamic_cast<const DSDIFF::AudioProperties*>(this)->function_name(); \
else \ else \
return (default_value); return (default_value);
class AudioProperties::AudioPropertiesPrivate { class AudioProperties::AudioPropertiesPrivate {};
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// public methods // public methods

View File

@@ -62,11 +62,6 @@ class TAGLIB_EXPORT AudioProperties {
*/ */
virtual ~AudioProperties(); virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds.
*/
//virtual int length() const = 0;
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
* *

View File

@@ -118,7 +118,7 @@ class DSDIFF::File::FilePrivate {
*/ */
int duplicateID3V2chunkIndex; int duplicateID3V2chunkIndex;
Properties *properties; AudioProperties *properties;
TagUnion tag; TagUnion tag;
@@ -145,7 +145,7 @@ bool DSDIFF::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
DSDIFF::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(file) { DSDIFF::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(file) {
d = new FilePrivate; d = new FilePrivate;
d->endianness = BigEndian; d->endianness = BigEndian;
@@ -154,7 +154,7 @@ DSDIFF::File::File(FileName file, bool readProperties, Properties::ReadStyle pro
} }
DSDIFF::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(stream) { DSDIFF::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::File(stream) {
d = new FilePrivate; d = new FilePrivate;
d->endianness = BigEndian; d->endianness = BigEndian;
@@ -210,7 +210,7 @@ PropertyMap DSDIFF::File::setProperties(const PropertyMap &properties) {
return d->tag.access<ID3v2::Tag>(ID3v2Index, true)->setProperties(properties); return d->tag.access<ID3v2::Tag>(ID3v2Index, true)->setProperties(properties);
} }
DSDIFF::Properties *DSDIFF::File::audioProperties() const { DSDIFF::AudioProperties *DSDIFF::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -582,7 +582,7 @@ void DSDIFF::File::updateRootChunksStructure(unsigned int startingChunk) {
} }
void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) { void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle propertiesStyle) {
bool bigEndian = (d->endianness == BigEndian); bool bigEndian = (d->endianness == BigEndian);
@@ -868,7 +868,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty
if (lengthDSDSamplesTimeChannels > 0) if (lengthDSDSamplesTimeChannels > 0)
bitrate = (audioDataSizeinBytes * 8 * sampleRate) / lengthDSDSamplesTimeChannels / 1000; bitrate = (audioDataSizeinBytes * 8 * sampleRate) / lengthDSDSamplesTimeChannels / 1000;
d->properties = new Properties(sampleRate, channels, lengthDSDSamplesTimeChannels, bitrate, propertiesStyle); d->properties = new AudioProperties(sampleRate, channels, lengthDSDSamplesTimeChannels, bitrate, propertiesStyle);
} }
if (!ID3v2Tag()) { if (!ID3v2Tag()) {

View File

@@ -80,7 +80,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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 DSDIFF file from \a stream. * Constructs an DSDIFF file from \a stream.
@@ -91,7 +91,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -144,10 +144,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &properties); PropertyMap setProperties(const PropertyMap &properties);
/*! /*!
* 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. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Save the file. If at least one tag -- ID3v1 or DIIN -- exists this will duplicate its content into the other tag. * Save the file. If at least one tag -- ID3v1 or DIIN -- exists this will duplicate its content into the other tag.
@@ -254,7 +254,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
void updateRootChunksStructure(unsigned int startingChunk); void updateRootChunksStructure(unsigned int startingChunk);
void read(bool readProperties, Properties::ReadStyle propertiesStyle); void read(bool readProperties, AudioProperties::ReadStyle propertiesStyle);
void writeChunk(const ByteVector &name, const ByteVector &data, unsigned long long offset, unsigned long replace = 0, unsigned int leadingPadding = 0); void writeChunk(const ByteVector &name, const ByteVector &data, unsigned long long offset, unsigned long replace = 0, unsigned int leadingPadding = 0);
class FilePrivate; class FilePrivate;

View File

@@ -30,9 +30,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class DSDIFF::Properties::PropertiesPrivate { class DSDIFF::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
channels(0), channels(0),
@@ -52,9 +52,9 @@ class DSDIFF::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
DSDIFF::Properties::Properties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style) : AudioProperties(style) { DSDIFF::AudioProperties::AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) {
d = new PropertiesPrivate; d = new AudioPropertiesPrivate;
d->channels = channels; d->channels = channels;
d->sampleCount = samplesCount; d->sampleCount = samplesCount;
@@ -65,38 +65,34 @@ DSDIFF::Properties::Properties(const unsigned int sampleRate, const unsigned sho
} }
DSDIFF::Properties::~Properties() { DSDIFF::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int DSDIFF::Properties::length() const { int DSDIFF::AudioProperties::lengthInSeconds() const {
return lengthInSeconds();
}
int DSDIFF::Properties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int DSDIFF::Properties::lengthInMilliseconds() const { int DSDIFF::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int DSDIFF::Properties::bitrate() const { int DSDIFF::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int DSDIFF::Properties::sampleRate() const { int DSDIFF::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int DSDIFF::Properties::channels() const { int DSDIFF::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int DSDIFF::Properties::bitsPerSample() const { int DSDIFF::AudioProperties::bitsPerSample() const {
return d->sampleWidth; return d->sampleWidth;
} }
long long DSDIFF::Properties::sampleCount() const { long long DSDIFF::AudioProperties::sampleCount() const {
return d->sampleCount; return d->sampleCount;
} }

View File

@@ -40,21 +40,20 @@ class File;
* This reads the data from an DSDIFF stream found in the AudioProperties API. * This reads the data from an DSDIFF 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: public:
/*! /*!
* Create an instance of DSDIFF::Properties with the data read from the ByteVector \a data. * Create an instance of DSDIFF::AudioProperties with the data read from the ByteVector \a data.
*/ */
Properties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style); AudioProperties(const unsigned int sampleRate, const unsigned short channels, const unsigned long long samplesCount, const int bitrate, ReadStyle style);
/*! /*!
* Destroys this DSDIFF::Properties instance. * Destroys this DSDIFF::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
// Reimplementations. // Reimplementations.
virtual int length() const;
virtual int lengthInSeconds() const; virtual int lengthInSeconds() const;
virtual int lengthInMilliseconds() const; virtual int lengthInMilliseconds() const;
virtual int bitrate() const; virtual int bitrate() const;
@@ -65,11 +64,11 @@ class TAGLIB_EXPORT Properties : public Strawberry_TagLib::TagLib::AudioProperti
long long sampleCount() const; long long sampleCount() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace DSDIFF } // namespace DSDIFF

View File

@@ -51,7 +51,7 @@ class DSF::File::FilePrivate {
long long fileSize; long long fileSize;
long long metadataOffset; long long metadataOffset;
Properties *properties; AudioProperties *properties;
ID3v2::Tag *tag; ID3v2::Tag *tag;
}; };
@@ -72,14 +72,14 @@ bool DSF::File::isSupported(IOStream *stream) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
DSF::File::File(FileName file, bool readProperties, 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()) if (isOpen())
read(readProperties, propertiesStyle); 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()) if (isOpen())
read(readProperties, propertiesStyle); read(readProperties, propertiesStyle);
@@ -102,7 +102,7 @@ PropertyMap DSF::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(properties); return d->tag->setProperties(properties);
} }
DSF::Properties *DSF::File::audioProperties() const { DSF::AudioProperties *DSF::File::audioProperties() const {
return d->properties; 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 // 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 // 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); chunkSize = readBlock(8).toLongLong(false);
d->properties = new Properties(readBlock(chunkSize), propertiesStyle); d->properties = new AudioProperties(readBlock(chunkSize), propertiesStyle);
// Skip the data chunk // 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. * If false, \a propertiesStyle is ignored.
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an DSF file from \a file. * 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. * If false, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * 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. * Returns the DSF::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.
@@ -115,7 +115,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
File(const File &); File(const File &);
File &operator=(const File &); File &operator=(const File &);
void read(bool readProperties, Properties::ReadStyle propertiesStyle); void read(bool readProperties, AudioProperties::ReadStyle propertiesStyle);
class FilePrivate; class FilePrivate;
FilePrivate *d; FilePrivate *d;

View File

@@ -30,9 +30,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class DSF::Properties::PropertiesPrivate { class DSF::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : formatVersion(0), AudioPropertiesPrivate() : formatVersion(0),
formatID(0), formatID(0),
channelType(0), channelType(0),
channelNum(0), channelNum(0),
@@ -63,61 +63,57 @@ class DSF::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
DSF::Properties::Properties(const ByteVector &data, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) { DSF::AudioProperties::AudioProperties(const ByteVector &data, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style) {
d = new PropertiesPrivate; d = new AudioPropertiesPrivate;
read(data); read(data);
} }
DSF::Properties::~Properties() { DSF::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int DSF::Properties::length() const { int DSF::AudioProperties::lengthInSeconds() const {
return lengthInSeconds();
}
int DSF::Properties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int DSF::Properties::lengthInMilliseconds() const { int DSF::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int DSF::Properties::bitrate() const { int DSF::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int DSF::Properties::sampleRate() const { int DSF::AudioProperties::sampleRate() const {
return d->samplingFrequency; return d->samplingFrequency;
} }
int DSF::Properties::channels() const { int DSF::AudioProperties::channels() const {
return d->channelNum; return d->channelNum;
} }
// DSF specific // DSF specific
int DSF::Properties::formatVersion() const { int DSF::AudioProperties::formatVersion() const {
return d->formatVersion; return d->formatVersion;
} }
int DSF::Properties::formatID() const { int DSF::AudioProperties::formatID() const {
return d->formatID; return d->formatID;
} }
int DSF::Properties::channelType() const { int DSF::AudioProperties::channelType() const {
return d->channelType; return d->channelType;
} }
int DSF::Properties::bitsPerSample() const { int DSF::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
long long DSF::Properties::sampleCount() const { long long DSF::AudioProperties::sampleCount() const {
return d->sampleCount; return d->sampleCount;
} }
int DSF::Properties::blockSizePerChannel() const { int DSF::AudioProperties::blockSizePerChannel() const {
return d->blockSizePerChannel; return d->blockSizePerChannel;
} }
@@ -125,7 +121,7 @@ int DSF::Properties::blockSizePerChannel() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void DSF::Properties::read(const ByteVector &data) { void DSF::AudioProperties::read(const ByteVector &data) {
d->formatVersion = data.toUInt(0U, false); d->formatVersion = data.toUInt(0U, false);
d->formatID = data.toUInt(4U, false); d->formatID = data.toUInt(4U, false);
d->channelType = data.toUInt(8U, 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. * 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: public:
/*! /*!
* Create an instance of DSF::AudioProperties with the data read from the ByteVector \a data. * 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. * Destroys this DSF::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
// Reimplementations. // Reimplementations.
virtual int length() const;
virtual int lengthInSeconds() const; virtual int lengthInSeconds() const;
virtual int lengthInMilliseconds() const; virtual int lengthInMilliseconds() const;
virtual int bitrate() const; virtual int bitrate() const;
@@ -80,13 +79,13 @@ class TAGLIB_EXPORT Properties : public Strawberry_TagLib::TagLib::AudioProperti
int blockSizePerChannel() const; int blockSizePerChannel() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(const ByteVector &data); void read(const ByteVector &data);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace DSF } // namespace DSF
} // namespace TagLib } // namespace TagLib

View File

@@ -83,7 +83,7 @@ class FLAC::File::FilePrivate {
TagUnion tag; TagUnion tag;
Properties *properties; AudioProperties *properties;
ByteVector xiphCommentData; ByteVector xiphCommentData;
BlockList blocks; BlockList blocks;
@@ -109,14 +109,14 @@ bool FLAC::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) { FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) { FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -143,7 +143,7 @@ PropertyMap FLAC::File::setProperties(const PropertyMap &properties) {
return xiphComment(true)->setProperties(properties); return xiphComment(true)->setProperties(properties);
} }
FLAC::Properties *FLAC::File::audioProperties() const { FLAC::AudioProperties *FLAC::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -416,7 +416,7 @@ void FLAC::File::read(bool readProperties) {
else else
streamLength = length() - d->streamStart; streamLength = length() - d->streamStart;
d->properties = new Properties(infoData, streamLength); d->properties = new AudioProperties(infoData, streamLength);
} }
} }

View File

@@ -97,7 +97,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs a FLAC file from \a stream. If \a readProperties is true the file's audio properties will also be read. * Constructs a FLAC file from \a stream. If \a readProperties is true the file's audio properties will also be read.
@@ -109,7 +109,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
// BIC: merge with the above constructor // BIC: merge with the above constructor
File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -141,9 +141,9 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the FLAC::Properties for this file. If no audio properties were read then this will return a null pointer. * Returns the FLAC::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;
/*! /*!
* Save the file. This will primarily save the XiphComment, but will also keep any old ID3-tags up to date. * Save the file. This will primarily save the XiphComment, but will also keep any old ID3-tags up to date.

View File

@@ -31,9 +31,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class FLAC::Properties::PropertiesPrivate { class FLAC::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
bitsPerSample(0), bitsPerSample(0),
@@ -53,43 +53,43 @@ class FLAC::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
FLAC::Properties::Properties(const ByteVector &data, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { FLAC::AudioProperties::AudioProperties(const ByteVector &data, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(data, streamLength); read(data, streamLength);
} }
FLAC::Properties::~Properties() { FLAC::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int FLAC::Properties::lengthInSeconds() const { int FLAC::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int FLAC::Properties::lengthInMilliseconds() const { int FLAC::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int FLAC::Properties::bitrate() const { int FLAC::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int FLAC::Properties::sampleRate() const { int FLAC::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int FLAC::Properties::bitsPerSample() const { int FLAC::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
int FLAC::Properties::channels() const { int FLAC::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
unsigned long long FLAC::Properties::sampleFrames() const { unsigned long long FLAC::AudioProperties::sampleFrames() const {
return d->sampleFrames; return d->sampleFrames;
} }
ByteVector FLAC::Properties::signature() const { ByteVector FLAC::AudioProperties::signature() const {
return d->signature; return d->signature;
} }
@@ -97,10 +97,10 @@ ByteVector FLAC::Properties::signature() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void FLAC::Properties::read(const ByteVector &data, long streamLength) { void FLAC::AudioProperties::read(const ByteVector &data, long streamLength) {
if (data.size() < 18) { if (data.size() < 18) {
debug("FLAC::Properties::read() - FLAC properties must contain at least 18 bytes."); debug("FLAC::AudioProperties::read() - FLAC properties must contain at least 18 bytes.");
return; return;
} }

View File

@@ -42,17 +42,17 @@ class File;
* This reads the data from an FLAC stream found in the AudioProperties API. * This reads the data from an FLAC stream found in the AudioProperties API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of FLAC::Properties with the data read from the ByteVector \a data. * Create an instance of FLAC::AudioProperties with the data read from the ByteVector \a data.
*/ */
Properties(const ByteVector &data, long streamLength, ReadStyle style = Average); AudioProperties(const ByteVector &data, long streamLength, ReadStyle style = Average);
/*! /*!
* Destroys this FLAC::Properties instance. * Destroys this FLAC::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -101,13 +101,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
ByteVector signature() const; ByteVector signature() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(const ByteVector &data, long streamLength); void read(const ByteVector &data, long streamLength);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace FLAC } // namespace FLAC
} // namespace TagLib } // namespace TagLib

View File

@@ -38,7 +38,7 @@ class IT::File::FilePrivate {
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {} explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {}
Mod::Tag tag; Mod::Tag tag;
IT::Properties properties; IT::AudioProperties properties;
}; };
IT::File::File(FileName file, bool readProperties, IT::File::File(FileName file, bool readProperties,
@@ -73,7 +73,7 @@ PropertyMap IT::File::setProperties(const PropertyMap &properties) {
return d->tag.setProperties(properties); return d->tag.setProperties(properties);
} }
IT::Properties *IT::File::audioProperties() const { IT::AudioProperties *IT::File::audioProperties() const {
return &d->properties; return &d->properties;
} }
@@ -151,7 +151,7 @@ bool IT::File::save() {
return false; return false;
unsigned long fileSize = File::length(); unsigned long fileSize = File::length();
if (special & Properties::MessageAttached) { if (special & AudioProperties::MessageAttached) {
seek(54); seek(54);
if (!readU16L(messageLength) || !readU32L(messageOffset)) if (!readU16L(messageLength) || !readU32L(messageOffset))
return false; return false;
@@ -219,7 +219,7 @@ void IT::File::read(bool) {
// sample/instrument names are abused as comments so // sample/instrument names are abused as comments so
// I just add all together. // I just add all together.
String message; String message;
if (special & Properties::MessageAttached) { if (special & AudioProperties::MessageAttached) {
READ_U16L_AS(messageLength); READ_U16L_AS(messageLength);
READ_U32L_AS(messageOffset); READ_U32L_AS(messageOffset);
seek(messageOffset); seek(messageOffset);

View File

@@ -77,10 +77,10 @@ class TAGLIB_EXPORT File : public Mod::FileBase {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the IT::Properties for this file. If no audio properties * Returns the IT::AudioProperties for this file. If no audio properties
* were read then this will return a null pointer. * were read then this will return a null pointer.
*/ */
IT::Properties *audioProperties() const; IT::AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -29,9 +29,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace IT; using namespace IT;
class IT::Properties::PropertiesPrivate { class IT::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : channels(0), AudioPropertiesPrivate() : channels(0),
lengthInPatterns(0), lengthInPatterns(0),
instrumentCount(0), instrumentCount(0),
sampleCount(0), sampleCount(0),
@@ -65,152 +65,148 @@ class IT::Properties::PropertiesPrivate {
unsigned char pitchWheelDepth; unsigned char pitchWheelDepth;
}; };
IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : AudioProperties(propertiesStyle), d(new PropertiesPrivate()) {} IT::AudioProperties::AudioProperties(AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::AudioProperties(propertiesStyle), d(new AudioPropertiesPrivate()) {}
IT::Properties::~Properties() { IT::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int IT::Properties::length() const { int IT::AudioProperties::lengthInSeconds() const {
return 0; return 0;
} }
int IT::Properties::lengthInSeconds() const { int IT::AudioProperties::lengthInMilliseconds() const {
return 0; return 0;
} }
int IT::Properties::lengthInMilliseconds() const { int IT::AudioProperties::bitrate() const {
return 0; return 0;
} }
int IT::Properties::bitrate() const { int IT::AudioProperties::sampleRate() const {
return 0; return 0;
} }
int IT::Properties::sampleRate() const { int IT::AudioProperties::channels() const {
return 0;
}
int IT::Properties::channels() const {
return d->channels; return d->channels;
} }
unsigned short IT::Properties::lengthInPatterns() const { unsigned short IT::AudioProperties::lengthInPatterns() const {
return d->lengthInPatterns; return d->lengthInPatterns;
} }
bool IT::Properties::stereo() const { bool IT::AudioProperties::stereo() const {
return d->flags & Stereo; return d->flags & Stereo;
} }
unsigned short IT::Properties::instrumentCount() const { unsigned short IT::AudioProperties::instrumentCount() const {
return d->instrumentCount; return d->instrumentCount;
} }
unsigned short IT::Properties::sampleCount() const { unsigned short IT::AudioProperties::sampleCount() const {
return d->sampleCount; return d->sampleCount;
} }
unsigned short IT::Properties::patternCount() const { unsigned short IT::AudioProperties::patternCount() const {
return d->patternCount; return d->patternCount;
} }
unsigned short IT::Properties::version() const { unsigned short IT::AudioProperties::version() const {
return d->version; return d->version;
} }
unsigned short IT::Properties::compatibleVersion() const { unsigned short IT::AudioProperties::compatibleVersion() const {
return d->compatibleVersion; return d->compatibleVersion;
} }
unsigned short IT::Properties::flags() const { unsigned short IT::AudioProperties::flags() const {
return d->flags; return d->flags;
} }
unsigned short IT::Properties::special() const { unsigned short IT::AudioProperties::special() const {
return d->special; return d->special;
} }
unsigned char IT::Properties::globalVolume() const { unsigned char IT::AudioProperties::globalVolume() const {
return d->globalVolume; return d->globalVolume;
} }
unsigned char IT::Properties::mixVolume() const { unsigned char IT::AudioProperties::mixVolume() const {
return d->mixVolume; return d->mixVolume;
} }
unsigned char IT::Properties::tempo() const { unsigned char IT::AudioProperties::tempo() const {
return d->tempo; return d->tempo;
} }
unsigned char IT::Properties::bpmSpeed() const { unsigned char IT::AudioProperties::bpmSpeed() const {
return d->bpmSpeed; return d->bpmSpeed;
} }
unsigned char IT::Properties::panningSeparation() const { unsigned char IT::AudioProperties::panningSeparation() const {
return d->panningSeparation; return d->panningSeparation;
} }
unsigned char IT::Properties::pitchWheelDepth() const { unsigned char IT::AudioProperties::pitchWheelDepth() const {
return d->pitchWheelDepth; return d->pitchWheelDepth;
} }
void IT::Properties::setChannels(int channels) { void IT::AudioProperties::setChannels(int channels) {
d->channels = channels; d->channels = channels;
} }
void IT::Properties::setLengthInPatterns(unsigned short lengthInPatterns) { void IT::AudioProperties::setLengthInPatterns(unsigned short lengthInPatterns) {
d->lengthInPatterns = lengthInPatterns; d->lengthInPatterns = lengthInPatterns;
} }
void IT::Properties::setInstrumentCount(unsigned short instrumentCount) { void IT::AudioProperties::setInstrumentCount(unsigned short instrumentCount) {
d->instrumentCount = instrumentCount; d->instrumentCount = instrumentCount;
} }
void IT::Properties::setSampleCount(unsigned short sampleCount) { void IT::AudioProperties::setSampleCount(unsigned short sampleCount) {
d->sampleCount = sampleCount; d->sampleCount = sampleCount;
} }
void IT::Properties::setPatternCount(unsigned short patternCount) { void IT::AudioProperties::setPatternCount(unsigned short patternCount) {
d->patternCount = patternCount; d->patternCount = patternCount;
} }
void IT::Properties::setFlags(unsigned short flags) { void IT::AudioProperties::setFlags(unsigned short flags) {
d->flags = flags; d->flags = flags;
} }
void IT::Properties::setSpecial(unsigned short special) { void IT::AudioProperties::setSpecial(unsigned short special) {
d->special = special; d->special = special;
} }
void IT::Properties::setCompatibleVersion(unsigned short compatibleVersion) { void IT::AudioProperties::setCompatibleVersion(unsigned short compatibleVersion) {
d->compatibleVersion = compatibleVersion; d->compatibleVersion = compatibleVersion;
} }
void IT::Properties::setVersion(unsigned short version) { void IT::AudioProperties::setVersion(unsigned short version) {
d->version = version; d->version = version;
} }
void IT::Properties::setGlobalVolume(unsigned char globalVolume) { void IT::AudioProperties::setGlobalVolume(unsigned char globalVolume) {
d->globalVolume = globalVolume; d->globalVolume = globalVolume;
} }
void IT::Properties::setMixVolume(unsigned char mixVolume) { void IT::AudioProperties::setMixVolume(unsigned char mixVolume) {
d->mixVolume = mixVolume; d->mixVolume = mixVolume;
} }
void IT::Properties::setTempo(unsigned char tempo) { void IT::AudioProperties::setTempo(unsigned char tempo) {
d->tempo = tempo; d->tempo = tempo;
} }
void IT::Properties::setBpmSpeed(unsigned char bpmSpeed) { void IT::AudioProperties::setBpmSpeed(unsigned char bpmSpeed) {
d->bpmSpeed = bpmSpeed; d->bpmSpeed = bpmSpeed;
} }
void IT::Properties::setPanningSeparation(unsigned char panningSeparation) { void IT::AudioProperties::setPanningSeparation(unsigned char panningSeparation) {
d->panningSeparation = panningSeparation; d->panningSeparation = panningSeparation;
} }
void IT::Properties::setPitchWheelDepth(unsigned char pitchWheelDepth) { void IT::AudioProperties::setPitchWheelDepth(unsigned char pitchWheelDepth) {
d->pitchWheelDepth = pitchWheelDepth; d->pitchWheelDepth = pitchWheelDepth;
} }

View File

@@ -32,7 +32,7 @@
namespace Strawberry_TagLib { namespace Strawberry_TagLib {
namespace TagLib { namespace TagLib {
namespace IT { namespace IT {
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
friend class File; friend class File;
public: public:
@@ -54,10 +54,9 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
MidiConfEmbedded = 8 MidiConfEmbedded = 8
}; };
Properties(AudioProperties::ReadStyle propertiesStyle); AudioProperties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties(); virtual ~AudioProperties();
int length() const;
int lengthInSeconds() const; int lengthInSeconds() const;
int lengthInMilliseconds() const; int lengthInMilliseconds() const;
int bitrate() const; int bitrate() const;
@@ -97,11 +96,11 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
void setPitchWheelDepth(unsigned char pitchWheelDepth); void setPitchWheelDepth(unsigned char pitchWheelDepth);
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace IT } // namespace IT
} // namespace TagLib } // namespace TagLib

View File

@@ -38,7 +38,7 @@ class Mod::File::FilePrivate {
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {} explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {}
Mod::Tag tag; Mod::Tag tag;
Mod::Properties properties; Mod::AudioProperties properties;
}; };
Mod::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { Mod::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) {
@@ -63,7 +63,7 @@ Mod::Tag *Mod::File::tag() const {
return &d->tag; return &d->tag;
} }
Mod::Properties *Mod::File::audioProperties() const { Mod::AudioProperties *Mod::File::audioProperties() const {
return &d->properties; return &d->properties;
} }

View File

@@ -77,9 +77,9 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::Mod::FileBase {
*/ */
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the Mod::Properties for this file. If no audio properties were read then this will return a null pointer. * Returns the Mod::AudioProperties for this file. If no audio properties were read then this will return a null pointer.
*/ */
Mod::Properties *audioProperties() const; Mod::AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -29,62 +29,58 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace Mod; using namespace Mod;
class Mod::Properties::PropertiesPrivate { class Mod::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : channels(0), instrumentCount(0), lengthInPatterns(0) {} AudioPropertiesPrivate() : channels(0), instrumentCount(0), lengthInPatterns(0) {}
int channels; int channels;
unsigned int instrumentCount; unsigned int instrumentCount;
unsigned char lengthInPatterns; unsigned char lengthInPatterns;
}; };
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : AudioProperties(propertiesStyle), d(new PropertiesPrivate()) { Mod::AudioProperties::AudioProperties(AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::AudioProperties(propertiesStyle), d(new AudioPropertiesPrivate()) {
} }
Mod::Properties::~Properties() { Mod::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int Mod::Properties::length() const { int Mod::AudioProperties::lengthInSeconds() const {
return 0; return 0;
} }
int Mod::Properties::lengthInSeconds() const { int Mod::AudioProperties::lengthInMilliseconds() const {
return 0; return 0;
} }
int Mod::Properties::lengthInMilliseconds() const { int Mod::AudioProperties::bitrate() const {
return 0; return 0;
} }
int Mod::Properties::bitrate() const { int Mod::AudioProperties::sampleRate() const {
return 0; return 0;
} }
int Mod::Properties::sampleRate() const { int Mod::AudioProperties::channels() const {
return 0;
}
int Mod::Properties::channels() const {
return d->channels; return d->channels;
} }
unsigned int Mod::Properties::instrumentCount() const { unsigned int Mod::AudioProperties::instrumentCount() const {
return d->instrumentCount; return d->instrumentCount;
} }
unsigned char Mod::Properties::lengthInPatterns() const { unsigned char Mod::AudioProperties::lengthInPatterns() const {
return d->lengthInPatterns; return d->lengthInPatterns;
} }
void Mod::Properties::setChannels(int channels) { void Mod::AudioProperties::setChannels(int channels) {
d->channels = channels; d->channels = channels;
} }
void Mod::Properties::setInstrumentCount(unsigned int instrumentCount) { void Mod::AudioProperties::setInstrumentCount(unsigned int instrumentCount) {
d->instrumentCount = instrumentCount; d->instrumentCount = instrumentCount;
} }
void Mod::Properties::setLengthInPatterns(unsigned char lengthInPatterns) { void Mod::AudioProperties::setLengthInPatterns(unsigned char lengthInPatterns) {
d->lengthInPatterns = lengthInPatterns; d->lengthInPatterns = lengthInPatterns;
} }

View File

@@ -33,12 +33,11 @@ namespace Strawberry_TagLib {
namespace TagLib { namespace TagLib {
namespace Mod { namespace Mod {
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
Properties(AudioProperties::ReadStyle propertiesStyle); AudioProperties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties(); virtual ~AudioProperties();
int length() const;
int lengthInSeconds() const; int lengthInSeconds() const;
int lengthInMilliseconds() const; int lengthInMilliseconds() const;
int bitrate() const; int bitrate() const;
@@ -56,11 +55,11 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
private: private:
friend class File; friend class File;
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace Mod } // namespace Mod

View File

@@ -63,7 +63,7 @@ class MP4::File::FilePrivate {
MP4::Tag *tag; MP4::Tag *tag;
MP4::Atoms *atoms; MP4::Atoms *atoms;
MP4::Properties *properties; MP4::AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -118,7 +118,7 @@ PropertyMap MP4::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(properties); return d->tag->setProperties(properties);
} }
MP4::Properties * MP4::AudioProperties *
MP4::File::audioProperties() const { MP4::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -142,7 +142,7 @@ void MP4::File::read(bool readProperties) {
d->tag = new Tag(this, d->atoms); d->tag = new Tag(this, d->atoms);
if (readProperties) { if (readProperties) {
d->properties = new Properties(this, d->atoms); d->properties = new AudioProperties(this, d->atoms);
} }
} }

View File

@@ -54,7 +54,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, bool readProperties = true, Properties::ReadStyle audioPropertiesStyle = Properties::Average); File(FileName file, bool readProperties = true, AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an MP4 file from \a stream. * Constructs an MP4 file from \a stream.
@@ -66,7 +66,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle audioPropertiesStyle = Properties::Average); AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -101,7 +101,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
/*! /*!
* Returns the MP4 audio properties for this file. * Returns the MP4 audio properties for this file.
*/ */
Properties *audioProperties() const; AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -31,15 +31,15 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class MP4::Properties::PropertiesPrivate { class MP4::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
channels(0), channels(0),
bitsPerSample(0), bitsPerSample(0),
encrypted(false), encrypted(false),
codec(MP4::Properties::Unknown) {} codec(MP4::AudioProperties::Unknown) {}
int length; int length;
int bitrate; int bitrate;
@@ -54,44 +54,44 @@ class MP4::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { MP4::AudioProperties::AudioProperties(File *file, MP4::Atoms *atoms, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file, atoms); read(file, atoms);
} }
MP4::Properties::~Properties() { MP4::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int MP4::Properties::channels() const { int MP4::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int MP4::Properties::sampleRate() const { int MP4::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int MP4::Properties::lengthInSeconds() const { int MP4::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int MP4::Properties::lengthInMilliseconds() const { int MP4::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int MP4::Properties::bitrate() const { int MP4::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int MP4::Properties::bitsPerSample() const { int MP4::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
bool MP4::Properties::isEncrypted() const { bool MP4::AudioProperties::isEncrypted() const {
return d->encrypted; return d->encrypted;
} }
MP4::Properties::Codec MP4::AudioProperties::Codec
MP4::Properties::codec() const { MP4::AudioProperties::codec() const {
return d->codec; return d->codec;
} }
@@ -99,7 +99,7 @@ MP4::Properties::codec() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void MP4::Properties::read(File *file, Atoms *atoms) { void MP4::AudioProperties::read(File *file, Atoms *atoms) {
MP4::Atom *moov = atoms->find("moov"); MP4::Atom *moov = atoms->find("moov");
if (!moov) { if (!moov) {

View File

@@ -37,7 +37,7 @@ class Atoms;
class File; class File;
//! An implementation of MP4 audio properties //! An implementation of MP4 audio properties
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
enum Codec { enum Codec {
Unknown = 0, Unknown = 0,
@@ -45,8 +45,8 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
ALAC ALAC
}; };
Properties(File *file, Atoms *atoms, ReadStyle style = Average); AudioProperties(File *file, Atoms *atoms, ReadStyle style = Average);
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -97,8 +97,8 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
private: private:
void read(File *file, Atoms *atoms); void read(File *file, Atoms *atoms);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace MP4 } // namespace MP4

View File

@@ -69,7 +69,7 @@ class MPC::File::FilePrivate {
TagUnion tag; TagUnion tag;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -90,14 +90,14 @@ bool MPC::File::isSupported(IOStream *stream) {
// public members // 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()) if (isOpen())
read(readProperties); 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()) if (isOpen())
read(readProperties); read(readProperties);
@@ -127,7 +127,7 @@ PropertyMap MPC::File::setProperties(const PropertyMap &properties) {
return APETag(true)->setProperties(properties); return APETag(true)->setProperties(properties);
} }
MPC::Properties *MPC::File::audioProperties() const { MPC::AudioProperties *MPC::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -310,7 +310,7 @@ void MPC::File::read(bool readProperties) {
seek(0); 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. * \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. * 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. * \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. * Destroys this instance of the File.
@@ -128,10 +128,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &); 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. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.

View File

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

View File

@@ -71,7 +71,7 @@ class MPEG::File::FilePrivate {
TagUnion tag; TagUnion tag;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -129,14 +129,14 @@ bool MPEG::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
MPEG::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) { MPEG::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
MPEG::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) { MPEG::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -170,7 +170,7 @@ PropertyMap MPEG::File::setProperties(const PropertyMap &properties) {
} }
MPEG::Properties *MPEG::File::audioProperties() const { MPEG::AudioProperties *MPEG::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -480,7 +480,7 @@ void MPEG::File::read(bool readProperties) {
} }
if (readProperties) if (readProperties)
d->properties = new Properties(this); d->properties = new AudioProperties(this);
// Make sure that we have our default tag types available. // Make sure that we have our default tag types available.

View File

@@ -88,7 +88,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
// BIC: merge with the above constructor // BIC: merge with the above constructor
File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an MPEG file from \a stream. * Constructs an MPEG file from \a stream.
@@ -102,7 +102,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
*/ */
File(IOStream *stream, ID3v2::FrameFactory *frameFactory, File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties = true, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -145,10 +145,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the MPEG::Properties for this file. * Returns the MPEG::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this will duplicate its content into the other tag. * Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this will duplicate its content into the other tag.

View File

@@ -26,6 +26,7 @@
#include <tdebug.h> #include <tdebug.h>
#include <tstring.h> #include <tstring.h>
#include "audioproperties.h"
#include "mpegproperties.h" #include "mpegproperties.h"
#include "mpegfile.h" #include "mpegfile.h"
#include "xingheader.h" #include "xingheader.h"
@@ -34,9 +35,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class MPEG::Properties::PropertiesPrivate { class MPEG::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : xingHeader(nullptr), AudioPropertiesPrivate() : xingHeader(nullptr),
length(0), length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
@@ -48,7 +49,7 @@ class MPEG::Properties::PropertiesPrivate {
isCopyrighted(false), isCopyrighted(false),
isOriginal(false) {} isOriginal(false) {}
~PropertiesPrivate() { ~AudioPropertiesPrivate() {
delete xingHeader; delete xingHeader;
} }
@@ -69,63 +70,59 @@ class MPEG::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
MPEG::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { MPEG::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file); read(file);
} }
MPEG::Properties::~Properties() { MPEG::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int MPEG::Properties::length() const { int MPEG::AudioProperties::lengthInSeconds() const {
return lengthInSeconds();
}
int MPEG::Properties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int MPEG::Properties::lengthInMilliseconds() const { int MPEG::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int MPEG::Properties::bitrate() const { int MPEG::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int MPEG::Properties::sampleRate() const { int MPEG::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int MPEG::Properties::channels() const { int MPEG::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
const MPEG::XingHeader *MPEG::Properties::xingHeader() const { const MPEG::XingHeader *MPEG::AudioProperties::xingHeader() const {
return d->xingHeader; return d->xingHeader;
} }
MPEG::Header::Version MPEG::Properties::version() const { MPEG::Header::Version MPEG::AudioProperties::version() const {
return d->version; return d->version;
} }
int MPEG::Properties::layer() const { int MPEG::AudioProperties::layer() const {
return d->layer; return d->layer;
} }
bool MPEG::Properties::protectionEnabled() const { bool MPEG::AudioProperties::protectionEnabled() const {
return d->protectionEnabled; return d->protectionEnabled;
} }
MPEG::Header::ChannelMode MPEG::Properties::channelMode() const { MPEG::Header::ChannelMode MPEG::AudioProperties::channelMode() const {
return d->channelMode; return d->channelMode;
} }
bool MPEG::Properties::isCopyrighted() const { bool MPEG::AudioProperties::isCopyrighted() const {
return d->isCopyrighted; return d->isCopyrighted;
} }
bool MPEG::Properties::isOriginal() const { bool MPEG::AudioProperties::isOriginal() const {
return d->isOriginal; return d->isOriginal;
} }
@@ -133,13 +130,13 @@ bool MPEG::Properties::isOriginal() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void MPEG::Properties::read(File *file) { void MPEG::AudioProperties::read(File *file) {
// Only the first valid frame is required if we have a VBR header. // Only the first valid frame is required if we have a VBR header.
const long firstFrameOffset = file->firstFrameOffset(); const long firstFrameOffset = file->firstFrameOffset();
if (firstFrameOffset < 0) { if (firstFrameOffset < 0) {
debug("MPEG::Properties::read() -- Could not find an MPEG frame in the stream."); debug("MPEG::AudioProperties::read() -- Could not find an MPEG frame in the stream.");
return; return;
} }
@@ -179,7 +176,7 @@ void MPEG::Properties::read(File *file) {
const long lastFrameOffset = file->lastFrameOffset(); const long lastFrameOffset = file->lastFrameOffset();
if (lastFrameOffset < 0) { if (lastFrameOffset < 0) {
debug("MPEG::Properties::read() -- Could not find an MPEG frame in the stream."); debug("MPEG::AudioProperties::read() -- Could not find an MPEG frame in the stream.");
return; return;
} }

View File

@@ -44,27 +44,17 @@ class XingHeader;
* This reads the data from an MPEG Layer III stream found in the AudioProperties API. * This reads the data from an MPEG Layer III stream found in the AudioProperties API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of MPEG::Properties with the data read from the MPEG::File \a file. * Create an instance of MPEG::AudioProperties with the data read from the MPEG::File \a file.
*/ */
Properties(File *file, ReadStyle style = Average); AudioProperties(File *file, ReadStyle style = Average);
/*! /*!
* Destroys this MPEG Properties instance. * Destroys this MPEG AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*!
* Returns the length of the file in seconds.
* The length is rounded down to the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
virtual int length() const;
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -133,13 +123,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
bool isOriginal() const; bool isOriginal() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace MPEG } // namespace MPEG

View File

@@ -33,7 +33,7 @@
#include "oggflacfile.h" #include "oggflacfile.h"
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using Strawberry_TagLib::TagLib::FLAC::Properties; using Strawberry_TagLib::TagLib::FLAC::AudioProperties;
class Ogg::FLAC::File::FilePrivate { class Ogg::FLAC::File::FilePrivate {
public: public:
@@ -52,7 +52,7 @@ class Ogg::FLAC::File::FilePrivate {
Ogg::XiphComment *comment; Ogg::XiphComment *comment;
Properties *properties; AudioProperties *properties;
ByteVector streamInfoData; ByteVector streamInfoData;
ByteVector xiphCommentData; ByteVector xiphCommentData;
long streamStart; long streamStart;
@@ -78,14 +78,14 @@ bool Ogg::FLAC::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Ogg::FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) : Ogg::File(file), d(new FilePrivate()) { Ogg::FLAC::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Ogg::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties, propertiesStyle); read(readProperties, propertiesStyle);
} }
Ogg::FLAC::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Ogg::File(stream), d(new FilePrivate()) { Ogg::FLAC::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Ogg::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties, propertiesStyle); read(readProperties, propertiesStyle);
@@ -108,7 +108,7 @@ PropertyMap Ogg::FLAC::File::setProperties(const PropertyMap &properties) {
return d->comment->setProperties(properties); return d->comment->setProperties(properties);
} }
Properties *Ogg::FLAC::File::audioProperties() const { FLAC::AudioProperties *Ogg::FLAC::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -148,7 +148,7 @@ bool Ogg::FLAC::File::hasXiphComment() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Ogg::FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) { void Ogg::FLAC::File::read(bool readProperties, AudioProperties::ReadStyle propertiesStyle) {
// Sanity: Check if we really have an Ogg/FLAC file // Sanity: Check if we really have an Ogg/FLAC file
@@ -178,7 +178,7 @@ void Ogg::FLAC::File::read(bool readProperties, Properties::ReadStyle properties
if (readProperties) if (readProperties)
d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle); d->properties = new AudioProperties(streamInfoData(), streamLength(), propertiesStyle);
} }

View File

@@ -50,7 +50,7 @@ namespace Ogg {
*/ */
namespace FLAC { namespace FLAC {
using Strawberry_TagLib::TagLib::FLAC::Properties; using Strawberry_TagLib::TagLib::FLAC::AudioProperties;
//! An implementation of TagLib::File with Ogg/FLAC specific methods //! An implementation of TagLib::File with Ogg/FLAC specific methods
@@ -69,7 +69,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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 Ogg/FLAC file from \a stream. * Constructs an Ogg/FLAC file from \a stream.
@@ -79,7 +79,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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. * Destroys this instance of the File.
@@ -100,10 +100,10 @@ class TAGLIB_EXPORT File : public Ogg::File {
virtual XiphComment *tag() const; virtual XiphComment *tag() const;
/*! /*!
* Returns the FLAC::Properties for this file. * Returns the FLAC::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
@@ -126,7 +126,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
virtual bool save(); virtual bool save();
/*! /*!
* Returns the length of the audio-stream, used by FLAC::Properties for calculating the bitrate. * Returns the length of the audio-stream, used by FLAC::AudioProperties for calculating the bitrate.
*/ */
long streamLength(); long streamLength();
@@ -148,7 +148,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
File(const File &); File(const File &);
File &operator=(const File &); File &operator=(const File &);
void read(bool readProperties, Properties::ReadStyle propertiesStyle); void read(bool readProperties, AudioProperties::ReadStyle propertiesStyle);
void scan(); void scan();
ByteVector streamInfoData(); ByteVector streamInfoData();
ByteVector xiphCommentData(); ByteVector xiphCommentData();

View File

@@ -47,7 +47,7 @@ class Opus::File::FilePrivate {
} }
Ogg::XiphComment *comment; Ogg::XiphComment *comment;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -67,14 +67,14 @@ bool Ogg::Opus::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Opus::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Ogg::File(file), d(new FilePrivate()) { Opus::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : Ogg::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
Opus::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Ogg::File(stream), d(new FilePrivate()) { Opus::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : Ogg::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -97,7 +97,7 @@ PropertyMap Opus::File::setProperties(const PropertyMap &properties) {
return d->comment->setProperties(properties); return d->comment->setProperties(properties);
} }
Opus::Properties *Opus::File::audioProperties() const { Opus::AudioProperties *Opus::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -137,6 +137,6 @@ void Opus::File::read(bool readProperties) {
d->comment = new Ogg::XiphComment(commentHeaderData.mid(8)); d->comment = new Ogg::XiphComment(commentHeaderData.mid(8));
if (readProperties) if (readProperties)
d->properties = new Properties(this); d->properties = new AudioProperties(this);
} }

View File

@@ -61,7 +61,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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 Opus file from \a stream. * Constructs an Opus file from \a stream.
@@ -71,7 +71,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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. * Destroys this instance of the File.
@@ -97,10 +97,10 @@ class TAGLIB_EXPORT File : public Ogg::File {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the Opus::Properties for this file. * Returns the Opus::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -38,9 +38,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace Strawberry_TagLib::TagLib::Ogg; using namespace Strawberry_TagLib::TagLib::Ogg;
class Opus::Properties::PropertiesPrivate { class Opus::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
inputSampleRate(0), inputSampleRate(0),
channels(0), channels(0),
@@ -57,27 +57,27 @@ class Opus::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Opus::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { Opus::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file); read(file);
} }
Opus::Properties::~Properties() { Opus::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int Ogg::Opus::Properties::lengthInSeconds() const { int Ogg::Opus::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int Ogg::Opus::Properties::lengthInMilliseconds() const { int Ogg::Opus::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int Opus::Properties::bitrate() const { int Opus::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int Opus::Properties::sampleRate() const { int Opus::AudioProperties::sampleRate() const {
// Opus can decode any stream at a sample rate of 8, 12, 16, 24, or 48 kHz, // Opus can decode any stream at a sample rate of 8, 12, 16, 24, or 48 kHz,
// so there is no single sample rate. Let's assume it's the highest // so there is no single sample rate. Let's assume it's the highest
@@ -86,15 +86,15 @@ int Opus::Properties::sampleRate() const {
} }
int Opus::Properties::channels() const { int Opus::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int Opus::Properties::inputSampleRate() const { int Opus::AudioProperties::inputSampleRate() const {
return d->inputSampleRate; return d->inputSampleRate;
} }
int Opus::Properties::opusVersion() const { int Opus::AudioProperties::opusVersion() const {
return d->opusVersion; return d->opusVersion;
} }
@@ -102,7 +102,7 @@ int Opus::Properties::opusVersion() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Opus::Properties::read(File *file) { void Opus::AudioProperties::read(File *file) {
// Get the identification header from the Ogg implementation. // Get the identification header from the Ogg implementation.
@@ -158,11 +158,11 @@ void Opus::Properties::read(File *file) {
} }
} }
else { else {
debug("Opus::Properties::read() -- The PCM values for the start or " debug("Opus::AudioProperties::read() -- The PCM values for the start or "
"end of this file was incorrect."); "end of this file was incorrect.");
} }
} }
else else
debug("Opus::Properties::read() -- Could not find valid first and last Ogg pages."); debug("Opus::AudioProperties::read() -- Could not find valid first and last Ogg pages.");
} }

View File

@@ -47,18 +47,18 @@ class File;
* This reads the data from an Ogg Opus stream found in the AudioProperties API. * This reads the data from an Ogg Opus stream found in the AudioProperties API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of Opus::Properties with the data read from the * Create an instance of Opus::AudioProperties with the data read from the
* Opus::File \a file. * Opus::File \a file.
*/ */
Properties(File *file, ReadStyle style = Average); AudioProperties(File *file, ReadStyle style = Average);
/*! /*!
* Destroys this Opus::Properties instance. * Destroys this Opus::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -105,13 +105,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int opusVersion() const; int opusVersion() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace Opus } // namespace Opus

View File

@@ -47,7 +47,7 @@ class Speex::File::FilePrivate {
} }
Ogg::XiphComment *comment; Ogg::XiphComment *comment;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -67,12 +67,12 @@ bool Ogg::Speex::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Speex::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Ogg::File(file), d(new FilePrivate()) { Speex::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : Ogg::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
Speex::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Ogg::File(stream), d(new FilePrivate()) { Speex::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : Ogg::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
@@ -93,7 +93,7 @@ PropertyMap Speex::File::setProperties(const PropertyMap &properties) {
return d->comment->setProperties(properties); return d->comment->setProperties(properties);
} }
Speex::Properties *Speex::File::audioProperties() const { Speex::AudioProperties *Speex::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -127,6 +127,6 @@ void Speex::File::read(bool readProperties) {
d->comment = new Ogg::XiphComment(commentHeaderData); d->comment = new Ogg::XiphComment(commentHeaderData);
if (readProperties) if (readProperties)
d->properties = new Properties(this); d->properties = new AudioProperties(this);
} }

View File

@@ -62,7 +62,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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 Speex file from \a stream. * Constructs a Speex file from \a stream.
@@ -72,7 +72,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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. * Destroys this instance of the File.
@@ -97,10 +97,10 @@ class TAGLIB_EXPORT File : public Ogg::File {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the Speex::Properties for this file. * Returns the Speex::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -38,9 +38,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace Strawberry_TagLib::TagLib::Ogg; using namespace Strawberry_TagLib::TagLib::Ogg;
class Speex::Properties::PropertiesPrivate { class Speex::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
bitrateNominal(0), bitrateNominal(0),
sampleRate(0), sampleRate(0),
@@ -63,39 +63,39 @@ class Speex::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Speex::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { Speex::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file); read(file);
} }
Speex::Properties::~Properties() { Speex::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int Speex::Properties::lengthInSeconds() const { int Speex::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int Speex::Properties::lengthInMilliseconds() const { int Speex::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int Speex::Properties::bitrate() const { int Speex::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int Speex::Properties::bitrateNominal() const { int Speex::AudioProperties::bitrateNominal() const {
return d->bitrateNominal; return d->bitrateNominal;
} }
int Speex::Properties::sampleRate() const { int Speex::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int Speex::Properties::channels() const { int Speex::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int Speex::Properties::speexVersion() const { int Speex::AudioProperties::speexVersion() const {
return d->speexVersion; return d->speexVersion;
} }
@@ -103,13 +103,13 @@ int Speex::Properties::speexVersion() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Speex::Properties::read(File *file) { void Speex::AudioProperties::read(File *file) {
// Get the identification header from the Ogg implementation. // Get the identification header from the Ogg implementation.
const ByteVector data = file->packet(0); const ByteVector data = file->packet(0);
if (data.size() < 64) { if (data.size() < 64) {
debug("Speex::Properties::read() -- data is too short."); debug("Speex::AudioProperties::read() -- data is too short.");
return; return;
} }
@@ -175,12 +175,12 @@ void Speex::Properties::read(File *file) {
} }
} }
else { else {
debug("Speex::Properties::read() -- Either the PCM values for the start or " debug("Speex::AudioProperties::read() -- Either the PCM values for the start or "
"end of this file was incorrect or the sample rate is zero."); "end of this file was incorrect or the sample rate is zero.");
} }
} }
else else
debug("Speex::Properties::read() -- Could not find valid first and last Ogg pages."); debug("Speex::AudioProperties::read() -- Could not find valid first and last Ogg pages.");
// Alternative to the actual average bitrate. // Alternative to the actual average bitrate.

View File

@@ -42,17 +42,17 @@ class File;
//! An implementation of audio property reading for Ogg Speex //! An implementation of audio property reading for Ogg Speex
//! This reads the data from an Ogg Speex stream found in the AudioProperties API. //! This reads the data from an Ogg Speex stream found in the AudioProperties API.
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of Speex::Properties with the data read from the Speex::File \a file. * Create an instance of Speex::AudioProperties with the data read from the Speex::File \a file.
*/ */
Properties(File *file, ReadStyle style = Average); AudioProperties(File *file, ReadStyle style = Average);
/*! /*!
* Destroys this Speex::Properties instance. * Destroys this Speex::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -96,13 +96,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int speexVersion() const; int speexVersion() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace Speex } // namespace Speex

View File

@@ -44,7 +44,7 @@ class Vorbis::File::FilePrivate {
} }
Ogg::XiphComment *comment; Ogg::XiphComment *comment;
Properties *properties; AudioProperties *properties;
}; };
namespace Strawberry_TagLib { namespace Strawberry_TagLib {
@@ -72,13 +72,13 @@ bool Vorbis::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Vorbis::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Ogg::File(file), Vorbis::File::File(FileName file, bool readProperties, Strawberry_TagLib::TagLib::AudioProperties::ReadStyle) : Ogg::File(file),
d(new FilePrivate()) { d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
Vorbis::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Ogg::File(stream), Vorbis::File::File(IOStream *stream, bool readProperties, Strawberry_TagLib::TagLib::AudioProperties::ReadStyle) : Ogg::File(stream),
d(new FilePrivate()) { d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -100,7 +100,7 @@ PropertyMap Vorbis::File::setProperties(const PropertyMap &properties) {
return d->comment->setProperties(properties); return d->comment->setProperties(properties);
} }
Vorbis::Properties *Vorbis::File::audioProperties() const { Vorbis::AudioProperties *Vorbis::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -135,6 +135,6 @@ void Vorbis::File::read(bool readProperties) {
d->comment = new Ogg::XiphComment(commentHeaderData.mid(7)); d->comment = new Ogg::XiphComment(commentHeaderData.mid(7));
if (readProperties) if (readProperties)
d->properties = new Properties(this); d->properties = new AudioProperties(this);
} }

View File

@@ -64,7 +64,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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, Strawberry_TagLib::TagLib::AudioProperties::ReadStyle propertiesStyle = Strawberry_TagLib::TagLib::AudioProperties::Average);
/*! /*!
* Constructs a Vorbis file from \a stream. * Constructs a Vorbis file from \a stream.
@@ -74,7 +74,7 @@ class TAGLIB_EXPORT File : public Ogg::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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, Strawberry_TagLib::TagLib::AudioProperties::ReadStyle propertiesStyle = Strawberry_TagLib::TagLib::AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -101,9 +101,9 @@ class TAGLIB_EXPORT File : public Ogg::File {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the Vorbis::Properties for this file. If no audio properties were read then this will return a null pointer. * Returns the Vorbis::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;
/*! /*!
* Save the file. * Save the file.

View File

@@ -33,9 +33,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class Vorbis::Properties::PropertiesPrivate { class Vorbis::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
channels(0), channels(0),
@@ -68,47 +68,47 @@ static const char vorbisSetupHeaderID[] = { 0x01, 'v', 'o', 'r', 'b', 'i', 's',
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Vorbis::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { Vorbis::AudioProperties::AudioProperties(File *file, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file); read(file);
} }
Vorbis::Properties::~Properties() { Vorbis::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int Vorbis::Properties::lengthInSeconds() const { int Vorbis::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int Vorbis::Properties::lengthInMilliseconds() const { int Vorbis::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int Vorbis::Properties::bitrate() const { int Vorbis::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int Vorbis::Properties::sampleRate() const { int Vorbis::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int Vorbis::Properties::channels() const { int Vorbis::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int Vorbis::Properties::vorbisVersion() const { int Vorbis::AudioProperties::vorbisVersion() const {
return d->vorbisVersion; return d->vorbisVersion;
} }
int Vorbis::Properties::bitrateMaximum() const { int Vorbis::AudioProperties::bitrateMaximum() const {
return d->bitrateMaximum; return d->bitrateMaximum;
} }
int Vorbis::Properties::bitrateNominal() const { int Vorbis::AudioProperties::bitrateNominal() const {
return d->bitrateNominal; return d->bitrateNominal;
} }
int Vorbis::Properties::bitrateMinimum() const { int Vorbis::AudioProperties::bitrateMinimum() const {
return d->bitrateMinimum; return d->bitrateMinimum;
} }
@@ -116,20 +116,20 @@ int Vorbis::Properties::bitrateMinimum() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Vorbis::Properties::read(File *file) { void Vorbis::AudioProperties::read(File *file) {
// Get the identification header from the Ogg implementation. // Get the identification header from the Ogg implementation.
const ByteVector data = file->packet(0); const ByteVector data = file->packet(0);
if (data.size() < 28) { if (data.size() < 28) {
debug("Vorbis::Properties::read() -- data is too short."); debug("Vorbis::AudioProperties::read() -- data is too short.");
return; return;
} }
unsigned int pos = 0; unsigned int pos = 0;
if (data.mid(pos, 7) != vorbisSetupHeaderID) { if (data.mid(pos, 7) != vorbisSetupHeaderID) {
debug("Vorbis::Properties::read() -- invalid Vorbis identification header"); debug("Vorbis::AudioProperties::read() -- invalid Vorbis identification header");
return; return;
} }
@@ -179,12 +179,12 @@ void Vorbis::Properties::read(File *file) {
} }
} }
else { else {
debug("Vorbis::Properties::read() -- Either the PCM values for the start or " debug("Vorbis::AudioProperties::read() -- Either the PCM values for the start or "
"end of this file was incorrect or the sample rate is zero."); "end of this file was incorrect or the sample rate is zero.");
} }
} }
else else
debug("Vorbis::Properties::read() -- Could not find valid first and last Ogg pages."); debug("Vorbis::AudioProperties::read() -- Could not find valid first and last Ogg pages.");
// Alternative to the actual average bitrate. // Alternative to the actual average bitrate.

View File

@@ -52,17 +52,17 @@ class File;
* This reads the data from an Ogg Vorbis stream found in the AudioProperties API. * This reads the data from an Ogg Vorbis stream found in the AudioProperties API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of Vorbis::Properties with the data read from the Vorbis::File \a file. * Create an instance of Vorbis::AudioProperties with the data read from the Vorbis::File \a file.
*/ */
Properties(File *file, ReadStyle style = Average); AudioProperties(File *file, ReadStyle style = Average);
/*! /*!
* Destroys this VorbisProperties instance. * Destroys this VorbisProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -116,13 +116,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int bitrateMinimum() const; int bitrateMinimum() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace Vorbis } // namespace Vorbis

View File

@@ -43,7 +43,7 @@ class RIFF::AIFF::File::FilePrivate {
delete tag; delete tag;
} }
Properties *properties; AudioProperties *properties;
ID3v2::Tag *tag; ID3v2::Tag *tag;
bool hasID3v2; bool hasID3v2;
@@ -66,13 +66,13 @@ bool RIFF::AIFF::File::isSupported(IOStream *stream) {
// public members // 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()) if (isOpen())
read(readProperties); 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()) if (isOpen())
read(readProperties); read(readProperties);
@@ -98,7 +98,7 @@ PropertyMap RIFF::AIFF::File::setProperties(const PropertyMap &properties) {
return d->tag->setProperties(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; return d->properties;
} }
@@ -160,6 +160,6 @@ void RIFF::AIFF::File::read(bool readProperties) {
d->tag = new ID3v2::Tag(); d->tag = new ID3v2::Tag();
if (readProperties) 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. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an AIFF file from \a stream. * 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. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -107,10 +107,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
PropertyMap setProperties(const PropertyMap &); 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. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.
@@ -143,7 +143,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
void read(bool readProperties); void read(bool readProperties);
friend class Properties; friend class AudioProperties;
class FilePrivate; class FilePrivate;
FilePrivate *d; FilePrivate *d;

View File

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

View File

@@ -41,18 +41,18 @@ class File;
* This reads the data from an AIFF stream found in the AudioProperties API. * 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: 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. * 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; String compressionName() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace AIFF } // namespace AIFF
} // namespace RIFF } // namespace RIFF

View File

@@ -51,7 +51,7 @@ class RIFF::WAV::File::FilePrivate {
delete properties; delete properties;
} }
Properties *properties; AudioProperties *properties;
TagUnion tag; TagUnion tag;
bool hasID3v2; bool hasID3v2;
@@ -75,14 +75,14 @@ bool RIFF::WAV::File::isSupported(IOStream *stream) {
// public members // 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()) if (isOpen())
read(readProperties); 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()) if (isOpen())
read(readProperties); 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; return d->properties;
} }
@@ -223,7 +223,7 @@ void RIFF::WAV::File::read(bool readProperties) {
d->tag.set(InfoIndex, new RIFF::Info::Tag()); d->tag.set(InfoIndex, new RIFF::Info::Tag());
if (readProperties) if (readProperties)
d->properties = new Properties(this, Properties::Average); d->properties = new AudioProperties(this, AudioProperties::Average);
} }
void RIFF::WAV::File::removeTagChunks(TagTypes tags) { 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. * \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. * 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. * \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. * Destroys this instance of the File.
@@ -142,10 +142,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
PropertyMap setProperties(const PropertyMap &); 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. * were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.
@@ -187,7 +187,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::RIFF::File {
void read(bool readProperties); void read(bool readProperties);
void removeTagChunks(TagTypes tags); void removeTagChunks(TagTypes tags);
friend class Properties; friend class AudioProperties;
class FilePrivate; class FilePrivate;
FilePrivate *d; FilePrivate *d;

View File

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

View File

@@ -46,17 +46,17 @@ class File;
* API. * API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: 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. * Returns the length of the file in seconds.
@@ -109,13 +109,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int format() const; int format() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file); void read(File *file);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace WAV } // namespace WAV

View File

@@ -40,7 +40,7 @@ class S3M::File::FilePrivate {
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {} explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {}
Mod::Tag tag; Mod::Tag tag;
S3M::Properties properties; S3M::AudioProperties properties;
}; };
S3M::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { S3M::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle propertiesStyle) : Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) {
@@ -73,7 +73,7 @@ PropertyMap S3M::File::setProperties(const PropertyMap &properties) {
return d->tag.setProperties(properties); return d->tag.setProperties(properties);
} }
S3M::Properties *S3M::File::audioProperties() const { S3M::AudioProperties *S3M::File::audioProperties() const {
return &d->properties; return &d->properties;
} }

View File

@@ -77,10 +77,10 @@ class TAGLIB_EXPORT File : public Mod::FileBase {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the S3M::Properties for this file. If no audio properties * Returns the S3M::AudioProperties for this file. If no audio properties
* were read then this will return a null pointer. * were read then this will return a null pointer.
*/ */
S3M::Properties *audioProperties() const; S3M::AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -29,9 +29,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace S3M; using namespace S3M;
class S3M::Properties::PropertiesPrivate { class S3M::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : lengthInPatterns(0), AudioPropertiesPrivate() : lengthInPatterns(0),
channels(0), channels(0),
stereo(false), stereo(false),
sampleCount(0), sampleCount(0),
@@ -59,124 +59,120 @@ class S3M::Properties::PropertiesPrivate {
unsigned char bpmSpeed; unsigned char bpmSpeed;
}; };
S3M::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : AudioProperties(propertiesStyle), d(new PropertiesPrivate()) {} S3M::AudioProperties::AudioProperties(AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::AudioProperties(propertiesStyle), d(new AudioPropertiesPrivate()) {}
S3M::Properties::~Properties() { S3M::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int S3M::Properties::length() const { int S3M::AudioProperties::lengthInSeconds() const {
return 0; return 0;
} }
int S3M::Properties::lengthInSeconds() const { int S3M::AudioProperties::lengthInMilliseconds() const {
return 0; return 0;
} }
int S3M::Properties::lengthInMilliseconds() const { int S3M::AudioProperties::bitrate() const {
return 0; return 0;
} }
int S3M::Properties::bitrate() const { int S3M::AudioProperties::sampleRate() const {
return 0; return 0;
} }
int S3M::Properties::sampleRate() const { int S3M::AudioProperties::channels() const {
return 0;
}
int S3M::Properties::channels() const {
return d->channels; return d->channels;
} }
unsigned short S3M::Properties::lengthInPatterns() const { unsigned short S3M::AudioProperties::lengthInPatterns() const {
return d->lengthInPatterns; return d->lengthInPatterns;
} }
bool S3M::Properties::stereo() const { bool S3M::AudioProperties::stereo() const {
return d->stereo; return d->stereo;
} }
unsigned short S3M::Properties::sampleCount() const { unsigned short S3M::AudioProperties::sampleCount() const {
return d->sampleCount; return d->sampleCount;
} }
unsigned short S3M::Properties::patternCount() const { unsigned short S3M::AudioProperties::patternCount() const {
return d->patternCount; return d->patternCount;
} }
unsigned short S3M::Properties::flags() const { unsigned short S3M::AudioProperties::flags() const {
return d->flags; return d->flags;
} }
unsigned short S3M::Properties::trackerVersion() const { unsigned short S3M::AudioProperties::trackerVersion() const {
return d->trackerVersion; return d->trackerVersion;
} }
unsigned short S3M::Properties::fileFormatVersion() const { unsigned short S3M::AudioProperties::fileFormatVersion() const {
return d->fileFormatVersion; return d->fileFormatVersion;
} }
unsigned char S3M::Properties::globalVolume() const { unsigned char S3M::AudioProperties::globalVolume() const {
return d->globalVolume; return d->globalVolume;
} }
unsigned char S3M::Properties::masterVolume() const { unsigned char S3M::AudioProperties::masterVolume() const {
return d->masterVolume; return d->masterVolume;
} }
unsigned char S3M::Properties::tempo() const { unsigned char S3M::AudioProperties::tempo() const {
return d->tempo; return d->tempo;
} }
unsigned char S3M::Properties::bpmSpeed() const { unsigned char S3M::AudioProperties::bpmSpeed() const {
return d->bpmSpeed; return d->bpmSpeed;
} }
void S3M::Properties::setLengthInPatterns(unsigned short lengthInPatterns) { void S3M::AudioProperties::setLengthInPatterns(unsigned short lengthInPatterns) {
d->lengthInPatterns = lengthInPatterns; d->lengthInPatterns = lengthInPatterns;
} }
void S3M::Properties::setChannels(int channels) { void S3M::AudioProperties::setChannels(int channels) {
d->channels = channels; d->channels = channels;
} }
void S3M::Properties::setStereo(bool stereo) { void S3M::AudioProperties::setStereo(bool stereo) {
d->stereo = stereo; d->stereo = stereo;
} }
void S3M::Properties::setSampleCount(unsigned short sampleCount) { void S3M::AudioProperties::setSampleCount(unsigned short sampleCount) {
d->sampleCount = sampleCount; d->sampleCount = sampleCount;
} }
void S3M::Properties::setPatternCount(unsigned short patternCount) { void S3M::AudioProperties::setPatternCount(unsigned short patternCount) {
d->patternCount = patternCount; d->patternCount = patternCount;
} }
void S3M::Properties::setFlags(unsigned short flags) { void S3M::AudioProperties::setFlags(unsigned short flags) {
d->flags = flags; d->flags = flags;
} }
void S3M::Properties::setTrackerVersion(unsigned short trackerVersion) { void S3M::AudioProperties::setTrackerVersion(unsigned short trackerVersion) {
d->trackerVersion = trackerVersion; d->trackerVersion = trackerVersion;
} }
void S3M::Properties::setFileFormatVersion(unsigned short fileFormatVersion) { void S3M::AudioProperties::setFileFormatVersion(unsigned short fileFormatVersion) {
d->fileFormatVersion = fileFormatVersion; d->fileFormatVersion = fileFormatVersion;
} }
void S3M::Properties::setGlobalVolume(unsigned char globalVolume) { void S3M::AudioProperties::setGlobalVolume(unsigned char globalVolume) {
d->globalVolume = globalVolume; d->globalVolume = globalVolume;
} }
void S3M::Properties::setMasterVolume(unsigned char masterVolume) { void S3M::AudioProperties::setMasterVolume(unsigned char masterVolume) {
d->masterVolume = masterVolume; d->masterVolume = masterVolume;
} }
void S3M::Properties::setTempo(unsigned char tempo) { void S3M::AudioProperties::setTempo(unsigned char tempo) {
d->tempo = tempo; d->tempo = tempo;
} }
void S3M::Properties::setBpmSpeed(unsigned char bpmSpeed) { void S3M::AudioProperties::setBpmSpeed(unsigned char bpmSpeed) {
d->bpmSpeed = bpmSpeed; d->bpmSpeed = bpmSpeed;
} }

View File

@@ -33,7 +33,7 @@ namespace Strawberry_TagLib {
namespace TagLib { namespace TagLib {
namespace S3M { namespace S3M {
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
friend class File; friend class File;
public: public:
@@ -48,10 +48,9 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
CustomData = 128 CustomData = 128
}; };
Properties(AudioProperties::ReadStyle propertiesStyle); AudioProperties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties(); virtual ~AudioProperties();
int length() const;
int lengthInSeconds() const; int lengthInSeconds() const;
int lengthInMilliseconds() const; int lengthInMilliseconds() const;
int bitrate() const; int bitrate() const;
@@ -85,11 +84,11 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
void setBpmSpeed(unsigned char bpmSpeed); void setBpmSpeed(unsigned char bpmSpeed);
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace S3M } // namespace S3M

View File

@@ -69,7 +69,7 @@ class TrueAudio::File::FilePrivate {
TagUnion tag; TagUnion tag;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -89,28 +89,28 @@ bool TrueAudio::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
TrueAudio::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) { TrueAudio::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
TrueAudio::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) { TrueAudio::File::File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
TrueAudio::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) { TrueAudio::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
TrueAudio::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) { TrueAudio::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate(frameFactory)) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -142,7 +142,7 @@ PropertyMap TrueAudio::File::setProperties(const PropertyMap &properties) {
} }
TrueAudio::Properties *TrueAudio::File::audioProperties() const { TrueAudio::AudioProperties *TrueAudio::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -288,7 +288,7 @@ void TrueAudio::File::read(bool readProperties) {
seek(0); seek(0);
} }
d->properties = new Properties(readBlock(TrueAudio::HeaderSize), streamLength); d->properties = new AudioProperties(readBlock(TrueAudio::HeaderSize), streamLength);
} }
} }

View File

@@ -87,7 +87,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs a TrueAudio file from \a file. * Constructs a TrueAudio file from \a file.
@@ -97,7 +97,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs a TrueAudio file from \a stream. * Constructs a TrueAudio file from \a stream.
@@ -107,7 +107,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \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);
/*! /*!
* Constructs a TrueAudio file from \a stream. * Constructs a TrueAudio file from \a stream.
@@ -119,7 +119,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* *
* \note In the current implementation, \a propertiesStyle is ignored. * \note In the current implementation, \a propertiesStyle is ignored.
*/ */
File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties = true, AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -146,10 +146,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
void removeUnsupportedProperties(const StringList &properties); void removeUnsupportedProperties(const StringList &properties);
/*! /*!
* Returns the TrueAudio::Properties for this file. * Returns the TrueAudio::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.
*/ */

View File

@@ -36,9 +36,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class TrueAudio::Properties::PropertiesPrivate { class TrueAudio::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : version(0), AudioPropertiesPrivate() : version(0),
length(0), length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
@@ -59,43 +59,43 @@ class TrueAudio::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
TrueAudio::Properties::Properties(const ByteVector &data, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { TrueAudio::AudioProperties::AudioProperties(const ByteVector &data, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(data, streamLength); read(data, streamLength);
} }
TrueAudio::Properties::~Properties() { TrueAudio::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int TrueAudio::Properties::lengthInSeconds() const { int TrueAudio::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int TrueAudio::Properties::lengthInMilliseconds() const { int TrueAudio::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int TrueAudio::Properties::bitrate() const { int TrueAudio::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int TrueAudio::Properties::sampleRate() const { int TrueAudio::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int TrueAudio::Properties::bitsPerSample() const { int TrueAudio::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
int TrueAudio::Properties::channels() const { int TrueAudio::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
unsigned int TrueAudio::Properties::sampleFrames() const { unsigned int TrueAudio::AudioProperties::sampleFrames() const {
return d->sampleFrames; return d->sampleFrames;
} }
int TrueAudio::Properties::ttaVersion() const { int TrueAudio::AudioProperties::ttaVersion() const {
return d->version; return d->version;
} }
@@ -103,15 +103,15 @@ int TrueAudio::Properties::ttaVersion() const {
// private members // private members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TrueAudio::Properties::read(const ByteVector &data, long streamLength) { void TrueAudio::AudioProperties::read(const ByteVector &data, long streamLength) {
if (data.size() < 4) { if (data.size() < 4) {
debug("TrueAudio::Properties::read() -- data is too short."); debug("TrueAudio::AudioProperties::read() -- data is too short.");
return; return;
} }
if (!data.startsWith("TTA")) { if (!data.startsWith("TTA")) {
debug("TrueAudio::Properties::read() -- invalid header signature."); debug("TrueAudio::AudioProperties::read() -- invalid header signature.");
return; return;
} }
@@ -124,7 +124,7 @@ void TrueAudio::Properties::read(const ByteVector &data, long streamLength) {
// TTA2 headers are in development, and have a different format // TTA2 headers are in development, and have a different format
if (1 == d->version) { if (1 == d->version) {
if (data.size() < 18) { if (data.size() < 18) {
debug("TrueAudio::Properties::read() -- data is too short."); debug("TrueAudio::AudioProperties::read() -- data is too short.");
return; return;
} }

View File

@@ -46,17 +46,17 @@ static const unsigned int HeaderSize = 18;
* This reads the data from an TrueAudio stream found in the AudioProperties API. * This reads the data from an TrueAudio stream found in the AudioProperties API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of TrueAudio::Properties with the data read from the ByteVector \a data. * Create an instance of TrueAudio::AudioProperties with the data read from the ByteVector \a data.
*/ */
Properties(const ByteVector &data, long streamLength, ReadStyle style = Average); AudioProperties(const ByteVector &data, long streamLength, ReadStyle style = Average);
/*! /*!
* Destroys this TrueAudio::Properties instance. * Destroys this TrueAudio::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * Returns the length of the file in seconds. The length is rounded down to the nearest whole second.
@@ -105,13 +105,13 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int ttaVersion() const; int ttaVersion() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(const ByteVector &data, long streamLength); void read(const ByteVector &data, long streamLength);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace TrueAudio } // namespace TrueAudio

View File

@@ -67,7 +67,7 @@ class WavPack::File::FilePrivate {
TagUnion tag; TagUnion tag;
Properties *properties; AudioProperties *properties;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -87,14 +87,14 @@ bool WavPack::File::isSupported(IOStream *stream) {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
WavPack::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) { WavPack::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
} }
WavPack::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) { WavPack::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
if (isOpen()) if (isOpen())
read(readProperties); read(readProperties);
@@ -126,7 +126,7 @@ PropertyMap WavPack::File::setProperties(const PropertyMap &properties) {
} }
WavPack::Properties *WavPack::File::audioProperties() const { WavPack::AudioProperties *WavPack::File::audioProperties() const {
return d->properties; return d->properties;
} }
@@ -271,7 +271,7 @@ void WavPack::File::read(bool readProperties) {
else else
streamLength = length(); streamLength = length();
d->properties = new Properties(this, streamLength); d->properties = new AudioProperties(this, streamLength);
} }
} }

View File

@@ -90,7 +90,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* If false, \a propertiesStyle is ignored * If false, \a propertiesStyle is ignored
*/ */
File(FileName file, bool readProperties = true, File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Constructs an WavPack file from \a file. * Constructs an WavPack file from \a file.
@@ -101,7 +101,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
* responsible for deleting it after the File object. * responsible for deleting it after the File object.
*/ */
File(IOStream *stream, bool readProperties = true, File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average); AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*! /*!
* Destroys this instance of the File. * Destroys this instance of the File.
@@ -131,10 +131,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
PropertyMap setProperties(const PropertyMap &); 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. * If no audio properties were read then this will return a null pointer.
*/ */
virtual Properties *audioProperties() const; virtual AudioProperties *audioProperties() const;
/*! /*!
* Saves the file. * Saves the file.

View File

@@ -38,9 +38,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
class WavPack::Properties::PropertiesPrivate { class WavPack::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : length(0), AudioPropertiesPrivate() : length(0),
bitrate(0), bitrate(0),
sampleRate(0), sampleRate(0),
channels(0), channels(0),
@@ -63,47 +63,47 @@ class WavPack::Properties::PropertiesPrivate {
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
WavPack::Properties::Properties(File *file, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) { WavPack::AudioProperties::AudioProperties(File *file, long streamLength, ReadStyle style) : Strawberry_TagLib::TagLib::AudioProperties(style), d(new AudioPropertiesPrivate()) {
read(file, streamLength); read(file, streamLength);
} }
WavPack::Properties::~Properties() { WavPack::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int WavPack::Properties::lengthInSeconds() const { int WavPack::AudioProperties::lengthInSeconds() const {
return d->length / 1000; return d->length / 1000;
} }
int WavPack::Properties::lengthInMilliseconds() const { int WavPack::AudioProperties::lengthInMilliseconds() const {
return d->length; return d->length;
} }
int WavPack::Properties::bitrate() const { int WavPack::AudioProperties::bitrate() const {
return d->bitrate; return d->bitrate;
} }
int WavPack::Properties::sampleRate() const { int WavPack::AudioProperties::sampleRate() const {
return d->sampleRate; return d->sampleRate;
} }
int WavPack::Properties::channels() const { int WavPack::AudioProperties::channels() const {
return d->channels; return d->channels;
} }
int WavPack::Properties::version() const { int WavPack::AudioProperties::version() const {
return d->version; return d->version;
} }
int WavPack::Properties::bitsPerSample() const { int WavPack::AudioProperties::bitsPerSample() const {
return d->bitsPerSample; return d->bitsPerSample;
} }
bool WavPack::Properties::isLossless() const { bool WavPack::AudioProperties::isLossless() const {
return d->lossless; return d->lossless;
} }
unsigned int WavPack::Properties::sampleFrames() const { unsigned int WavPack::AudioProperties::sampleFrames() const {
return d->sampleFrames; return d->sampleFrames;
} }
@@ -133,7 +133,7 @@ const unsigned int sample_rates[] = {
#define FINAL_BLOCK 0x1000 #define FINAL_BLOCK 0x1000
void WavPack::Properties::read(File *file, long streamLength) { void WavPack::AudioProperties::read(File *file, long streamLength) {
long offset = 0; long offset = 0;
@@ -142,12 +142,12 @@ void WavPack::Properties::read(File *file, long streamLength) {
const ByteVector data = file->readBlock(32); const ByteVector data = file->readBlock(32);
if (data.size() < 32) { if (data.size() < 32) {
debug("WavPack::Properties::read() -- data is too short."); debug("WavPack::AudioProperties::read() -- data is too short.");
break; break;
} }
if (!data.startsWith("wvpk")) { if (!data.startsWith("wvpk")) {
debug("WavPack::Properties::read() -- Block header not found."); debug("WavPack::AudioProperties::read() -- Block header not found.");
break; break;
} }
@@ -184,7 +184,7 @@ void WavPack::Properties::read(File *file, long streamLength) {
} }
unsigned int WavPack::Properties::seekFinalIndex(File *file, long streamLength) { unsigned int WavPack::AudioProperties::seekFinalIndex(File *file, long streamLength) {
const long offset = file->rfind("wvpk", streamLength); const long offset = file->rfind("wvpk", streamLength);
if (offset == -1) if (offset == -1)

View File

@@ -48,18 +48,18 @@ static const unsigned int HeaderSize = 32;
* API. * API.
*/ */
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
public: public:
/*! /*!
* Create an instance of WavPack::Properties. * Create an instance of WavPack::Properties.
*/ */
Properties(File *file, long streamLength, ReadStyle style = Average); AudioProperties(File *file, long streamLength, ReadStyle style = Average);
/*! /*!
* Destroys this WavPack::Properties instance. * Destroys this WavPack::AudioProperties instance.
*/ */
virtual ~Properties(); virtual ~AudioProperties();
/*! /*!
* Returns the length of the file in seconds. * Returns the length of the file in seconds.
@@ -114,14 +114,14 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
int version() const; int version() const;
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
void read(File *file, long streamLength); void read(File *file, long streamLength);
unsigned int seekFinalIndex(File *file, long streamLength); unsigned int seekFinalIndex(File *file, long streamLength);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace WavPack } // namespace WavPack

View File

@@ -307,7 +307,7 @@ class XM::File::FilePrivate {
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {} explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle) : properties(propertiesStyle) {}
Mod::Tag tag; Mod::Tag tag;
XM::Properties properties; XM::AudioProperties properties;
}; };
XM::File::File(FileName file, bool readProperties, XM::File::File(FileName file, bool readProperties,
@@ -340,7 +340,7 @@ PropertyMap XM::File::setProperties(const PropertyMap &properties) {
return d->tag.setProperties(properties); return d->tag.setProperties(properties);
} }
XM::Properties *XM::File::audioProperties() const { XM::AudioProperties *XM::File::audioProperties() const {
return &d->properties; return &d->properties;
} }

View File

@@ -77,10 +77,10 @@ class TAGLIB_EXPORT File : public Mod::FileBase {
PropertyMap setProperties(const PropertyMap &); PropertyMap setProperties(const PropertyMap &);
/*! /*!
* Returns the XM::Properties for this file. * Returns the XM::AudioProperties for this file.
* If no audio properties were read then this will return a null pointer. * If no audio properties were read then this will return a null pointer.
*/ */
XM::Properties *audioProperties() const; XM::AudioProperties *audioProperties() const;
/*! /*!
* Save the file. * Save the file.

View File

@@ -29,9 +29,9 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
using namespace XM; using namespace XM;
class XM::Properties::PropertiesPrivate { class XM::AudioProperties::AudioPropertiesPrivate {
public: public:
PropertiesPrivate() : lengthInPatterns(0), AudioPropertiesPrivate() : lengthInPatterns(0),
channels(0), channels(0),
version(0), version(0),
restartPosition(0), restartPosition(0),
@@ -55,108 +55,104 @@ class XM::Properties::PropertiesPrivate {
unsigned short bpmSpeed; unsigned short bpmSpeed;
}; };
XM::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : AudioProperties(propertiesStyle), d(new PropertiesPrivate()) {} XM::AudioProperties::AudioProperties(AudioProperties::ReadStyle propertiesStyle) : Strawberry_TagLib::TagLib::AudioProperties(propertiesStyle), d(new AudioPropertiesPrivate()) {}
XM::Properties::~Properties() { XM::AudioProperties::~AudioProperties() {
delete d; delete d;
} }
int XM::Properties::length() const { int XM::AudioProperties::lengthInSeconds() const {
return 0; return 0;
} }
int XM::Properties::lengthInSeconds() const { int XM::AudioProperties::lengthInMilliseconds() const {
return 0; return 0;
} }
int XM::Properties::lengthInMilliseconds() const { int XM::AudioProperties::bitrate() const {
return 0; return 0;
} }
int XM::Properties::bitrate() const { int XM::AudioProperties::sampleRate() const {
return 0; return 0;
} }
int XM::Properties::sampleRate() const { int XM::AudioProperties::channels() const {
return 0;
}
int XM::Properties::channels() const {
return d->channels; return d->channels;
} }
unsigned short XM::Properties::lengthInPatterns() const { unsigned short XM::AudioProperties::lengthInPatterns() const {
return d->lengthInPatterns; return d->lengthInPatterns;
} }
unsigned short XM::Properties::version() const { unsigned short XM::AudioProperties::version() const {
return d->version; return d->version;
} }
unsigned short XM::Properties::restartPosition() const { unsigned short XM::AudioProperties::restartPosition() const {
return d->restartPosition; return d->restartPosition;
} }
unsigned short XM::Properties::patternCount() const { unsigned short XM::AudioProperties::patternCount() const {
return d->patternCount; return d->patternCount;
} }
unsigned short XM::Properties::instrumentCount() const { unsigned short XM::AudioProperties::instrumentCount() const {
return d->instrumentCount; return d->instrumentCount;
} }
unsigned int XM::Properties::sampleCount() const { unsigned int XM::AudioProperties::sampleCount() const {
return d->sampleCount; return d->sampleCount;
} }
unsigned short XM::Properties::flags() const { unsigned short XM::AudioProperties::flags() const {
return d->flags; return d->flags;
} }
unsigned short XM::Properties::tempo() const { unsigned short XM::AudioProperties::tempo() const {
return d->tempo; return d->tempo;
} }
unsigned short XM::Properties::bpmSpeed() const { unsigned short XM::AudioProperties::bpmSpeed() const {
return d->bpmSpeed; return d->bpmSpeed;
} }
void XM::Properties::setLengthInPatterns(unsigned short lengthInPatterns) { void XM::AudioProperties::setLengthInPatterns(unsigned short lengthInPatterns) {
d->lengthInPatterns = lengthInPatterns; d->lengthInPatterns = lengthInPatterns;
} }
void XM::Properties::setChannels(int channels) { void XM::AudioProperties::setChannels(int channels) {
d->channels = channels; d->channels = channels;
} }
void XM::Properties::setVersion(unsigned short version) { void XM::AudioProperties::setVersion(unsigned short version) {
d->version = version; d->version = version;
} }
void XM::Properties::setRestartPosition(unsigned short restartPosition) { void XM::AudioProperties::setRestartPosition(unsigned short restartPosition) {
d->restartPosition = restartPosition; d->restartPosition = restartPosition;
} }
void XM::Properties::setPatternCount(unsigned short patternCount) { void XM::AudioProperties::setPatternCount(unsigned short patternCount) {
d->patternCount = patternCount; d->patternCount = patternCount;
} }
void XM::Properties::setInstrumentCount(unsigned short instrumentCount) { void XM::AudioProperties::setInstrumentCount(unsigned short instrumentCount) {
d->instrumentCount = instrumentCount; d->instrumentCount = instrumentCount;
} }
void XM::Properties::setSampleCount(unsigned int sampleCount) { void XM::AudioProperties::setSampleCount(unsigned int sampleCount) {
d->sampleCount = sampleCount; d->sampleCount = sampleCount;
} }
void XM::Properties::setFlags(unsigned short flags) { void XM::AudioProperties::setFlags(unsigned short flags) {
d->flags = flags; d->flags = flags;
} }
void XM::Properties::setTempo(unsigned short tempo) { void XM::AudioProperties::setTempo(unsigned short tempo) {
d->tempo = tempo; d->tempo = tempo;
} }
void XM::Properties::setBpmSpeed(unsigned short bpmSpeed) { void XM::AudioProperties::setBpmSpeed(unsigned short bpmSpeed) {
d->bpmSpeed = bpmSpeed; d->bpmSpeed = bpmSpeed;
} }

View File

@@ -33,7 +33,7 @@
namespace Strawberry_TagLib { namespace Strawberry_TagLib {
namespace TagLib { namespace TagLib {
namespace XM { namespace XM {
class TAGLIB_EXPORT Properties : public AudioProperties { class TAGLIB_EXPORT AudioProperties : public Strawberry_TagLib::TagLib::AudioProperties {
friend class File; friend class File;
public: public:
@@ -42,10 +42,9 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
LinearFreqTable = 1 // otherwise its the amiga freq. table LinearFreqTable = 1 // otherwise its the amiga freq. table
}; };
Properties(AudioProperties::ReadStyle propertiesStyle); AudioProperties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties(); virtual ~AudioProperties();
int length() const;
int lengthInSeconds() const; int lengthInSeconds() const;
int lengthInMilliseconds() const; int lengthInMilliseconds() const;
int bitrate() const; int bitrate() const;
@@ -75,11 +74,11 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
void setBpmSpeed(unsigned short bpmSpeed); void setBpmSpeed(unsigned short bpmSpeed);
private: private:
Properties(const Properties &); AudioProperties(const AudioProperties &);
Properties &operator=(const Properties &); AudioProperties &operator=(const AudioProperties &);
class PropertiesPrivate; class AudioPropertiesPrivate;
PropertiesPrivate *d; AudioPropertiesPrivate *d;
}; };
} // namespace XM } // namespace XM