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

@@ -71,7 +71,7 @@ class MPEG::File::FilePrivate {
TagUnion tag;
Properties *properties;
AudioProperties *properties;
};
////////////////////////////////////////////////////////////////////////////////
@@ -129,14 +129,14 @@ bool MPEG::File::isSupported(IOStream *stream) {
// 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())
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())
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;
}
@@ -480,7 +480,7 @@ void MPEG::File::read(bool readProperties) {
}
if (readProperties)
d->properties = new Properties(this);
d->properties = new AudioProperties(this);
// 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.
*/
// 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.
@@ -102,7 +102,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
*/
File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
/*!
* Destroys this instance of the File.
@@ -145,10 +145,10 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
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.
*/
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.

View File

@@ -26,6 +26,7 @@
#include <tdebug.h>
#include <tstring.h>
#include "audioproperties.h"
#include "mpegproperties.h"
#include "mpegfile.h"
#include "xingheader.h"
@@ -34,9 +35,9 @@
using namespace Strawberry_TagLib::TagLib;
class MPEG::Properties::PropertiesPrivate {
class MPEG::AudioProperties::AudioPropertiesPrivate {
public:
PropertiesPrivate() : xingHeader(nullptr),
AudioPropertiesPrivate() : xingHeader(nullptr),
length(0),
bitrate(0),
sampleRate(0),
@@ -48,7 +49,7 @@ class MPEG::Properties::PropertiesPrivate {
isCopyrighted(false),
isOriginal(false) {}
~PropertiesPrivate() {
~AudioPropertiesPrivate() {
delete xingHeader;
}
@@ -69,63 +70,59 @@ class MPEG::Properties::PropertiesPrivate {
// 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);
}
MPEG::Properties::~Properties() {
MPEG::AudioProperties::~AudioProperties() {
delete d;
}
int MPEG::Properties::length() const {
return lengthInSeconds();
}
int MPEG::Properties::lengthInSeconds() const {
int MPEG::AudioProperties::lengthInSeconds() const {
return d->length / 1000;
}
int MPEG::Properties::lengthInMilliseconds() const {
int MPEG::AudioProperties::lengthInMilliseconds() const {
return d->length;
}
int MPEG::Properties::bitrate() const {
int MPEG::AudioProperties::bitrate() const {
return d->bitrate;
}
int MPEG::Properties::sampleRate() const {
int MPEG::AudioProperties::sampleRate() const {
return d->sampleRate;
}
int MPEG::Properties::channels() const {
int MPEG::AudioProperties::channels() const {
return d->channels;
}
const MPEG::XingHeader *MPEG::Properties::xingHeader() const {
const MPEG::XingHeader *MPEG::AudioProperties::xingHeader() const {
return d->xingHeader;
}
MPEG::Header::Version MPEG::Properties::version() const {
MPEG::Header::Version MPEG::AudioProperties::version() const {
return d->version;
}
int MPEG::Properties::layer() const {
int MPEG::AudioProperties::layer() const {
return d->layer;
}
bool MPEG::Properties::protectionEnabled() const {
bool MPEG::AudioProperties::protectionEnabled() const {
return d->protectionEnabled;
}
MPEG::Header::ChannelMode MPEG::Properties::channelMode() const {
MPEG::Header::ChannelMode MPEG::AudioProperties::channelMode() const {
return d->channelMode;
}
bool MPEG::Properties::isCopyrighted() const {
bool MPEG::AudioProperties::isCopyrighted() const {
return d->isCopyrighted;
}
bool MPEG::Properties::isOriginal() const {
bool MPEG::AudioProperties::isOriginal() const {
return d->isOriginal;
}
@@ -133,13 +130,13 @@ bool MPEG::Properties::isOriginal() const {
// 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.
const long firstFrameOffset = file->firstFrameOffset();
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;
}
@@ -179,7 +176,7 @@ void MPEG::Properties::read(File *file) {
const long lastFrameOffset = file->lastFrameOffset();
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;
}

View File

@@ -44,27 +44,17 @@ class XingHeader;
* 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:
/*!
* 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();
/*!
* 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;
virtual ~AudioProperties();
/*!
* 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;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
AudioProperties(const AudioProperties &);
AudioProperties &operator=(const AudioProperties &);
void read(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
};
} // namespace MPEG