Additional manual formatting to taglib sources
This commit is contained in:
32
3rdparty/taglib/wavpack/wavpackfile.cpp
vendored
32
3rdparty/taglib/wavpack/wavpackfile.cpp
vendored
@@ -43,8 +43,10 @@
|
||||
using namespace Strawberry_TagLib::TagLib;
|
||||
|
||||
namespace {
|
||||
enum { WavAPEIndex,
|
||||
WavID3v1Index };
|
||||
enum {
|
||||
WavAPEIndex,
|
||||
WavID3v1Index
|
||||
};
|
||||
}
|
||||
|
||||
class WavPack::File::FilePrivate {
|
||||
@@ -52,7 +54,7 @@ class WavPack::File::FilePrivate {
|
||||
FilePrivate() : APELocation(-1),
|
||||
APESize(0),
|
||||
ID3v1Location(-1),
|
||||
properties(0) {}
|
||||
properties(nullptr) {}
|
||||
|
||||
~FilePrivate() {
|
||||
delete properties;
|
||||
@@ -73,26 +75,30 @@ class WavPack::File::FilePrivate {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool WavPack::File::isSupported(IOStream *stream) {
|
||||
|
||||
// A WavPack file has to start with "wvpk".
|
||||
|
||||
const ByteVector id = Utils::readHeader(stream, 4, false);
|
||||
return (id == "wvpk");
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file), d(new FilePrivate()) {
|
||||
|
||||
if (isOpen())
|
||||
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, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream), d(new FilePrivate()) {
|
||||
|
||||
if (isOpen())
|
||||
read(readProperties);
|
||||
|
||||
}
|
||||
|
||||
WavPack::File::~File() {
|
||||
@@ -112,10 +118,12 @@ void WavPack::File::removeUnsupportedProperties(const StringList &unsupported) {
|
||||
}
|
||||
|
||||
PropertyMap WavPack::File::setProperties(const PropertyMap &properties) {
|
||||
|
||||
if (ID3v1Tag())
|
||||
ID3v1Tag()->setProperties(properties);
|
||||
|
||||
return APETag(true)->setProperties(properties);
|
||||
|
||||
}
|
||||
|
||||
WavPack::Properties *WavPack::File::audioProperties() const {
|
||||
@@ -123,6 +131,7 @@ WavPack::Properties *WavPack::File::audioProperties() const {
|
||||
}
|
||||
|
||||
bool WavPack::File::save() {
|
||||
|
||||
if (readOnly()) {
|
||||
debug("WavPack::File::save() -- File is read only.");
|
||||
return false;
|
||||
@@ -191,6 +200,7 @@ bool WavPack::File::save() {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
ID3v1::Tag *WavPack::File::ID3v1Tag(bool create) {
|
||||
@@ -202,14 +212,16 @@ APE::Tag *WavPack::File::APETag(bool create) {
|
||||
}
|
||||
|
||||
void WavPack::File::strip(int tags) {
|
||||
|
||||
if (tags & ID3v1)
|
||||
d->tag.set(WavID3v1Index, 0);
|
||||
d->tag.set(WavID3v1Index, nullptr);
|
||||
|
||||
if (tags & APE)
|
||||
d->tag.set(WavAPEIndex, 0);
|
||||
d->tag.set(WavAPEIndex, nullptr);
|
||||
|
||||
if (!ID3v1Tag())
|
||||
APETag(true);
|
||||
|
||||
}
|
||||
|
||||
bool WavPack::File::hasID3v1Tag() const {
|
||||
@@ -225,6 +237,7 @@ bool WavPack::File::hasAPETag() const {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void WavPack::File::read(bool readProperties) {
|
||||
|
||||
// Look for an ID3v1 tag
|
||||
|
||||
d->ID3v1Location = Utils::findID3v1(this);
|
||||
@@ -260,4 +273,5 @@ void WavPack::File::read(bool readProperties) {
|
||||
|
||||
d->properties = new Properties(this, streamLength);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
187
3rdparty/taglib/wavpack/wavpackfile.h
vendored
187
3rdparty/taglib/wavpack/wavpackfile.h
vendored
@@ -49,29 +49,30 @@ class Tag;
|
||||
//! An implementation of WavPack metadata
|
||||
|
||||
/*!
|
||||
* This is implementation of WavPack metadata.
|
||||
*
|
||||
* This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
|
||||
* properties from the file.
|
||||
*/
|
||||
* This is implementation of WavPack metadata.
|
||||
*
|
||||
* This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
|
||||
* properties from the file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WavPack {
|
||||
|
||||
//! An implementation of Strawberry_TagLib::TagLib::File with WavPack specific methods
|
||||
|
||||
/*!
|
||||
* This implements and provides an interface for WavPack files to the
|
||||
* Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing
|
||||
* the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional
|
||||
* information specific to WavPack files.
|
||||
*/
|
||||
* This implements and provides an interface for WavPack files to the
|
||||
* Strawberry_TagLib::TagLib::Tag and Strawberry_TagLib::TagLib::AudioProperties interfaces by way of implementing
|
||||
* the abstract Strawberry_TagLib::TagLib::File API as well as providing some additional
|
||||
* information specific to WavPack files.
|
||||
*
|
||||
*/
|
||||
|
||||
class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
public:
|
||||
/*!
|
||||
* This set of flags is used for various operations and is suitable for
|
||||
* being OR-ed together.
|
||||
*/
|
||||
* This set of flags is used for various operations and is suitable for being OR-ed together.
|
||||
*/
|
||||
enum TagTypes {
|
||||
//! Empty set. Matches no tag types.
|
||||
NoTags = 0x0000,
|
||||
@@ -84,132 +85,125 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
};
|
||||
|
||||
/*!
|
||||
* Constructs a WavPack file from \a file. If \a readProperties is true the
|
||||
* file's audio properties will also be read using \a propertiesStyle. If
|
||||
* false, \a propertiesStyle is ignored
|
||||
*/
|
||||
* Constructs a WavPack file from \a file.
|
||||
* If \a readProperties is true the file's audio properties will also be read using \a propertiesStyle.
|
||||
* If false, \a propertiesStyle is ignored
|
||||
*/
|
||||
File(FileName file, bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average);
|
||||
|
||||
/*!
|
||||
* Constructs an WavPack file from \a file. If \a readProperties is true the
|
||||
* file's audio properties will also be read using \a propertiesStyle. If
|
||||
* false, \a propertiesStyle is ignored.
|
||||
*
|
||||
* \note TagLib will *not* take ownership of the stream, the caller is
|
||||
* responsible for deleting it after the File object.
|
||||
*/
|
||||
* Constructs an WavPack file from \a file.
|
||||
* If \a readProperties is true the file's audio properties will also be read using \a propertiesStyle.
|
||||
* If false, \a propertiesStyle is ignored.
|
||||
*
|
||||
* \note TagLib will *not* take ownership of the stream, the caller is
|
||||
* responsible for deleting it after the File object.
|
||||
*/
|
||||
File(IOStream *stream, bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average);
|
||||
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
|
||||
/*!
|
||||
* Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
|
||||
* or a combination of the two.
|
||||
*/
|
||||
* Returns the Tag for this file.
|
||||
* This will be an APE tag, an ID3v1 tag or a combination of the two.
|
||||
*/
|
||||
virtual Strawberry_TagLib::TagLib::Tag *tag() const;
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- export function.
|
||||
* If the file contains both an APE and an ID3v1 tag, only APE
|
||||
* will be converted to the PropertyMap.
|
||||
*/
|
||||
* Implements the unified property interface -- export function.
|
||||
* If the file contains both an APE and an ID3v1 tag,
|
||||
* only APE will be converted to the PropertyMap.
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
|
||||
void removeUnsupportedProperties(const StringList &properties);
|
||||
|
||||
/*!
|
||||
* Implements the unified property interface -- import function.
|
||||
* Creates an APE tag if it does not exists and calls setProperties() on
|
||||
* that. Any existing ID3v1 tag will be updated as well.
|
||||
*/
|
||||
* Implements the unified property interface -- import function.
|
||||
* Creates an APE tag if it does not exists and calls setProperties() on that.
|
||||
* Any existing ID3v1 tag will be updated as well.
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &);
|
||||
|
||||
/*!
|
||||
* Returns the MPC::Properties for this file. If no audio properties
|
||||
* were read then this will return a null pointer.
|
||||
*/
|
||||
* Returns the MPC::Properties for this file.
|
||||
* If no audio properties were read then this will return a null pointer.
|
||||
*/
|
||||
virtual Properties *audioProperties() const;
|
||||
|
||||
/*!
|
||||
* Saves the file.
|
||||
*
|
||||
* This returns true if the save was successful.
|
||||
*/
|
||||
* Saves the file.
|
||||
*
|
||||
* This returns true if the save was successful.
|
||||
*/
|
||||
virtual bool save();
|
||||
|
||||
/*!
|
||||
* Returns a pointer to the ID3v1 tag of the file.
|
||||
*
|
||||
* If \a create is false (the default) this may return a null pointer
|
||||
* if there is no valid ID3v1 tag. If \a create is true it will create
|
||||
* an ID3v1 tag if one does not exist and returns a valid pointer.
|
||||
*
|
||||
* \note This may return a valid pointer regardless of whether or not the
|
||||
* file on disk has an ID3v1 tag. Use hasID3v1Tag() to check if the file
|
||||
* on disk actually has an ID3v1 tag.
|
||||
*
|
||||
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
|
||||
* deleted by the user. It will be deleted when the file (object) is
|
||||
* destroyed.
|
||||
*
|
||||
* \see hasID3v1Tag()
|
||||
*/
|
||||
* Returns a pointer to the ID3v1 tag of the file.
|
||||
*
|
||||
* If \a create is false (the default) this may return a null pointer if there is no valid ID3v1 tag.
|
||||
* If \a create is true it will create an ID3v1 tag if one does not exist and returns a valid pointer.
|
||||
*
|
||||
* \note This may return a valid pointer regardless of whether or not the file on disk has an ID3v1 tag.
|
||||
* Use hasID3v1Tag() to check if the file on disk actually has an ID3v1 tag.
|
||||
*
|
||||
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be deleted by the user.
|
||||
* It will be deleted when the file (object) is destroyed.
|
||||
*
|
||||
* \see hasID3v1Tag()
|
||||
*/
|
||||
ID3v1::Tag *ID3v1Tag(bool create = false);
|
||||
|
||||
/*!
|
||||
* Returns a pointer to the APE tag of the file.
|
||||
*
|
||||
* If \a create is false (the default) this may return a null pointer
|
||||
* if there is no valid APE tag. If \a create is true it will create
|
||||
* an APE tag if one does not exist and returns a valid pointer.
|
||||
*
|
||||
* \note This may return a valid pointer regardless of whether or not the
|
||||
* file on disk has an APE tag. Use hasAPETag() to check if the file
|
||||
* on disk actually has an APE tag.
|
||||
*
|
||||
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
|
||||
* deleted by the user. It will be deleted when the file (object) is
|
||||
* destroyed.
|
||||
*
|
||||
* \see hasAPETag()
|
||||
*/
|
||||
* Returns a pointer to the APE tag of the file.
|
||||
*
|
||||
* If \a create is false (the default) this may return a null pointer if there is no valid APE tag.
|
||||
* If \a create is true it will create an APE tag if one does not exist and returns a valid pointer.
|
||||
*
|
||||
* \note This may return a valid pointer regardless of whether or not the file on disk has an APE tag.
|
||||
* Use hasAPETag() to check if the file on disk actually has an APE tag.
|
||||
*
|
||||
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be deleted by the user.
|
||||
* It will be deleted when the file (object) is destroyed.
|
||||
*
|
||||
* \see hasAPETag()
|
||||
*/
|
||||
APE::Tag *APETag(bool create = false);
|
||||
|
||||
/*!
|
||||
* This will remove the tags that match the OR-ed together TagTypes from the
|
||||
* file. By default it removes all tags.
|
||||
*
|
||||
* \note This will also invalidate pointers to the tags
|
||||
* as their memory will be freed.
|
||||
* \note In order to make the removal permanent save() still needs to be called
|
||||
*/
|
||||
* This will remove the tags that match the OR-ed together TagTypes from the file.
|
||||
* By default it removes all tags.
|
||||
*
|
||||
* \note This will also invalidate pointers to the tags as their memory will be freed.
|
||||
* \note In order to make the removal permanent save() still needs to be called
|
||||
*/
|
||||
void strip(int tags = AllTags);
|
||||
|
||||
/*!
|
||||
* Returns whether or not the file on disk actually has an ID3v1 tag.
|
||||
*
|
||||
* \see ID3v1Tag()
|
||||
*/
|
||||
* Returns whether or not the file on disk actually has an ID3v1 tag.
|
||||
*
|
||||
* \see ID3v1Tag()
|
||||
*/
|
||||
bool hasID3v1Tag() const;
|
||||
|
||||
/*!
|
||||
* Returns whether or not the file on disk actually has an APE tag.
|
||||
*
|
||||
* \see APETag()
|
||||
*/
|
||||
* Returns whether or not the file on disk actually has an APE tag.
|
||||
*
|
||||
* \see APETag()
|
||||
*/
|
||||
bool hasAPETag() const;
|
||||
|
||||
/*!
|
||||
* Check if the given \a stream can be opened as a WavPack file.
|
||||
*
|
||||
* \note This method is designed to do a quick check. The result may
|
||||
* not necessarily be correct.
|
||||
*/
|
||||
* Check if the given \a stream can be opened as a WavPack file.
|
||||
*
|
||||
* \note This method is designed to do a quick check. The result may
|
||||
* not necessarily be correct.
|
||||
*/
|
||||
static bool isSupported(IOStream *stream);
|
||||
|
||||
private:
|
||||
@@ -221,6 +215,7 @@ class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File {
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
};
|
||||
|
||||
} // namespace WavPack
|
||||
} // namespace TagLib
|
||||
} // namespace Strawberry_TagLib
|
||||
|
||||
16
3rdparty/taglib/wavpack/wavpackproperties.cpp
vendored
16
3rdparty/taglib/wavpack/wavpackproperties.cpp
vendored
@@ -63,13 +63,7 @@ class WavPack::Properties::PropertiesPrivate {
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WavPack::Properties::Properties(const ByteVector &, long, ReadStyle style) : AudioProperties(style),
|
||||
d(new PropertiesPrivate()) {
|
||||
debug("WavPack::Properties::Properties() -- This constructor is no longer used.");
|
||||
}
|
||||
|
||||
WavPack::Properties::Properties(File *file, long streamLength, ReadStyle style) : AudioProperties(style),
|
||||
d(new PropertiesPrivate()) {
|
||||
WavPack::Properties::Properties(File *file, long streamLength, ReadStyle style) : AudioProperties(style), d(new PropertiesPrivate()) {
|
||||
read(file, streamLength);
|
||||
}
|
||||
|
||||
@@ -77,10 +71,6 @@ WavPack::Properties::~Properties() {
|
||||
delete d;
|
||||
}
|
||||
|
||||
int WavPack::Properties::length() const {
|
||||
return lengthInSeconds();
|
||||
}
|
||||
|
||||
int WavPack::Properties::lengthInSeconds() const {
|
||||
return d->length / 1000;
|
||||
}
|
||||
@@ -144,6 +134,7 @@ const unsigned int sample_rates[] = {
|
||||
#define FINAL_BLOCK 0x1000
|
||||
|
||||
void WavPack::Properties::read(File *file, long streamLength) {
|
||||
|
||||
long offset = 0;
|
||||
|
||||
while (true) {
|
||||
@@ -190,9 +181,11 @@ void WavPack::Properties::read(File *file, long streamLength) {
|
||||
d->length = static_cast<int>(length + 0.5);
|
||||
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unsigned int WavPack::Properties::seekFinalIndex(File *file, long streamLength) {
|
||||
|
||||
const long offset = file->rfind("wvpk", streamLength);
|
||||
if (offset == -1)
|
||||
return 0;
|
||||
@@ -214,4 +207,5 @@ unsigned int WavPack::Properties::seekFinalIndex(File *file, long streamLength)
|
||||
const unsigned int blockSamples = data.toUInt(20, false);
|
||||
|
||||
return blockIndex + blockSamples;
|
||||
|
||||
}
|
||||
|
||||
81
3rdparty/taglib/wavpack/wavpackproperties.h
vendored
81
3rdparty/taglib/wavpack/wavpackproperties.h
vendored
@@ -35,7 +35,6 @@
|
||||
|
||||
namespace Strawberry_TagLib {
|
||||
namespace TagLib {
|
||||
|
||||
namespace WavPack {
|
||||
|
||||
class File;
|
||||
@@ -45,92 +44,73 @@ static const unsigned int HeaderSize = 32;
|
||||
//! An implementation of audio property reading for WavPack
|
||||
|
||||
/*!
|
||||
* This reads the data from an WavPack stream found in the AudioProperties
|
||||
* API.
|
||||
*/
|
||||
* This reads the data from an WavPack stream found in the AudioProperties
|
||||
* API.
|
||||
*/
|
||||
|
||||
class TAGLIB_EXPORT Properties : public AudioProperties {
|
||||
public:
|
||||
/*!
|
||||
* Create an instance of WavPack::Properties with the data read from the
|
||||
* ByteVector \a data.
|
||||
*
|
||||
* \deprecated This constructor will be dropped in favor of the one below
|
||||
* in a future version.
|
||||
*/
|
||||
TAGLIB_DEPRECATED Properties(const ByteVector &data, long streamLength,
|
||||
ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Create an instance of WavPack::Properties.
|
||||
*/
|
||||
* Create an instance of WavPack::Properties.
|
||||
*/
|
||||
Properties(File *file, long streamLength, ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Destroys this WavPack::Properties instance.
|
||||
*/
|
||||
* Destroys this WavPack::Properties 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
|
||||
*/
|
||||
TAGLIB_DEPRECATED virtual int length() const;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in seconds. The length is rounded down to
|
||||
* the nearest whole second.
|
||||
*
|
||||
* \see lengthInMilliseconds()
|
||||
*/
|
||||
* Returns the length of the file in seconds.
|
||||
* The length is rounded down to the nearest whole second.
|
||||
*
|
||||
* \see lengthInMilliseconds()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInSeconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in milliseconds.
|
||||
*
|
||||
* \see lengthInSeconds()
|
||||
*/
|
||||
* Returns the length of the file in milliseconds.
|
||||
*
|
||||
* \see lengthInSeconds()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
*/
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
*/
|
||||
virtual int bitrate() const;
|
||||
|
||||
/*!
|
||||
* Returns the sample rate in Hz. 0 means unknown or custom.
|
||||
*/
|
||||
* Returns the sample rate in Hz. 0 means unknown or custom.
|
||||
*/
|
||||
virtual int sampleRate() const;
|
||||
|
||||
/*!
|
||||
* Returns the number of audio channels.
|
||||
*/
|
||||
* Returns the number of audio channels.
|
||||
*/
|
||||
virtual int channels() const;
|
||||
|
||||
/*!
|
||||
* Returns the number of bits per audio sample.
|
||||
*/
|
||||
* Returns the number of bits per audio sample.
|
||||
*/
|
||||
int bitsPerSample() const;
|
||||
|
||||
/*!
|
||||
* Returns whether or not the file is lossless encoded.
|
||||
*/
|
||||
* Returns whether or not the file is lossless encoded.
|
||||
*/
|
||||
bool isLossless() const;
|
||||
|
||||
/*!
|
||||
* Returns the total number of audio samples in file.
|
||||
*/
|
||||
* Returns the total number of audio samples in file.
|
||||
*/
|
||||
unsigned int sampleFrames() const;
|
||||
|
||||
/*!
|
||||
* Returns WavPack version.
|
||||
*/
|
||||
* Returns WavPack version.
|
||||
*/
|
||||
int version() const;
|
||||
|
||||
private:
|
||||
@@ -143,6 +123,7 @@ class TAGLIB_EXPORT Properties : public AudioProperties {
|
||||
class PropertiesPrivate;
|
||||
PropertiesPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace WavPack
|
||||
} // namespace TagLib
|
||||
} // namespace Strawberry_TagLib
|
||||
|
||||
Reference in New Issue
Block a user