mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Remove functions documented (but not marked) as deprecated
Clean up other stuff with comments about binary incompatibility, but only as far as to mostly keep source compatibility.
This commit is contained in:
parent
322085f90e
commit
ceb142c9bd
@ -54,13 +54,6 @@ APE::Item::Item() :
|
||||
{
|
||||
}
|
||||
|
||||
APE::Item::Item(const String &key, const String &value) :
|
||||
d(new ItemPrivate())
|
||||
{
|
||||
d->key = key;
|
||||
d->text.append(value);
|
||||
}
|
||||
|
||||
APE::Item::Item(const String &key, const StringList &values) :
|
||||
d(new ItemPrivate())
|
||||
{
|
||||
|
@ -56,12 +56,6 @@ namespace TagLib {
|
||||
*/
|
||||
Item();
|
||||
|
||||
/*!
|
||||
* Constructs a text item with \a key and \a value.
|
||||
*/
|
||||
// BIC: Remove this, StringList has a constructor from a single string
|
||||
Item(const String &key, const String &value);
|
||||
|
||||
/*!
|
||||
* Constructs a text item with \a key and \a values.
|
||||
*/
|
||||
|
@ -75,11 +75,6 @@ APE::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int APE::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int APE::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -61,22 +61,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -67,11 +67,6 @@ ASF::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int ASF::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int ASF::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
@ -121,11 +116,6 @@ bool ASF::Properties::isEncrypted() const
|
||||
// private members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ASF::Properties::setLength(int /*length*/)
|
||||
{
|
||||
debug("ASF::Properties::setLength() -- This method is deprecated. Do not use.");
|
||||
}
|
||||
|
||||
void ASF::Properties::setLengthInMilliseconds(int value)
|
||||
{
|
||||
d->length = value;
|
||||
|
@ -78,22 +78,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
@ -148,9 +138,6 @@ namespace TagLib {
|
||||
bool isEncrypted() const;
|
||||
|
||||
#ifndef DO_NOT_DOCUMENT
|
||||
// deprecated
|
||||
void setLength(int value);
|
||||
|
||||
void setLengthInMilliseconds(int value);
|
||||
void setBitrate(int value);
|
||||
void setSampleRate(int value);
|
||||
|
@ -152,7 +152,8 @@ namespace TagLib {
|
||||
virtual bool isEmpty() const;
|
||||
|
||||
/*!
|
||||
* \deprecated Use attributeListMap() const, contains(), removeItem(),
|
||||
* \warning You should not modify this data structure directly, instead
|
||||
* use attributeListMap() const, contains(), removeItem(),
|
||||
* attribute(), setAttribute(), addAttribute().
|
||||
*/
|
||||
AttributeListMap &attributeListMap();
|
||||
@ -161,7 +162,6 @@ namespace TagLib {
|
||||
* Returns a reference to the item list map. This is an AttributeListMap of
|
||||
* all of the items in the tag.
|
||||
*/
|
||||
// BIC: return by value
|
||||
const AttributeListMap &attributeListMap() const;
|
||||
|
||||
/*!
|
||||
|
@ -41,6 +41,31 @@ AudioProperties::~AudioProperties()
|
||||
|
||||
}
|
||||
|
||||
int AudioProperties::length() const
|
||||
{
|
||||
return lengthInSeconds();
|
||||
}
|
||||
|
||||
int AudioProperties::lengthInSeconds() const
|
||||
{
|
||||
return lengthInMilliseconds() / 1000;
|
||||
}
|
||||
|
||||
int AudioProperties::lengthInMilliseconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AudioProperties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AudioProperties::sampleRate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// protected methods
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -64,32 +64,42 @@ namespace TagLib {
|
||||
*/
|
||||
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 Use lengthInSeconds().
|
||||
*/
|
||||
virtual int length() const;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in seconds. The length is rounded down to
|
||||
* the nearest whole second.
|
||||
*
|
||||
* \see lengthInMilliseconds()
|
||||
*/
|
||||
virtual int lengthInSeconds() const = 0;
|
||||
virtual int lengthInSeconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in milliseconds.
|
||||
*
|
||||
* \see lengthInSeconds()
|
||||
*/
|
||||
virtual int lengthInMilliseconds() const = 0;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the most appropriate bit rate for the file in kb/s. For constant
|
||||
* bitrate formats this is simply the bitrate of the file. For variable
|
||||
* bitrate formats this is either the average or nominal bitrate.
|
||||
*/
|
||||
virtual int bitrate() const = 0;
|
||||
virtual int bitrate() const;
|
||||
|
||||
/*!
|
||||
* Returns the sample rate in Hz.
|
||||
*/
|
||||
virtual int sampleRate() const = 0;
|
||||
virtual int sampleRate() const;
|
||||
|
||||
/*!
|
||||
* Returns the number of audio channels.
|
||||
|
@ -288,6 +288,7 @@ namespace TagLib {
|
||||
*
|
||||
* \deprecated Use FileRef(FileName, bool, AudioProperties::ReadStyle).
|
||||
*/
|
||||
// Kept because it is used for the C bindings
|
||||
static File *create(FileName fileName,
|
||||
bool readAudioProperties = true,
|
||||
AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
|
||||
|
@ -104,7 +104,7 @@ namespace TagLib {
|
||||
*
|
||||
* \note In the current implementation, \a propertiesStyle is ignored.
|
||||
*/
|
||||
// BIC: merge with the above constructor
|
||||
// BIC: merge with the above constructor, kept for source compatibility
|
||||
File(FileName file, ID3v2::FrameFactory *frameFactory,
|
||||
bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average);
|
||||
@ -121,7 +121,6 @@ namespace TagLib {
|
||||
*
|
||||
* \note In the current implementation, \a propertiesStyle is ignored.
|
||||
*/
|
||||
// BIC: merge with the above constructor
|
||||
File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
|
||||
bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average);
|
||||
|
@ -55,30 +55,18 @@ public:
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FLAC::Properties::Properties(ByteVector data, offset_t streamLength, ReadStyle style) :
|
||||
FLAC::Properties::Properties(const ByteVector &data, offset_t streamLength, ReadStyle style) :
|
||||
AudioProperties(style),
|
||||
d(new PropertiesPrivate())
|
||||
{
|
||||
read(data, streamLength);
|
||||
}
|
||||
|
||||
FLAC::Properties::Properties(File *, ReadStyle style) :
|
||||
AudioProperties(style),
|
||||
d(new PropertiesPrivate())
|
||||
{
|
||||
debug("FLAC::Properties::Properties() - This constructor is no longer used.");
|
||||
}
|
||||
|
||||
FLAC::Properties::~Properties()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
int FLAC::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int FLAC::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -50,37 +50,19 @@ namespace TagLib {
|
||||
* Create an instance of FLAC::Properties with the data read from the
|
||||
* ByteVector \a data.
|
||||
*/
|
||||
// BIC: switch to const reference
|
||||
Properties(ByteVector data, offset_t streamLength, ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Create an instance of FLAC::Properties with the data read from the
|
||||
* FLAC::File \a file.
|
||||
*/
|
||||
// BIC: remove
|
||||
Properties(File *file, ReadStyle style = Average);
|
||||
Properties(const ByteVector &data, offset_t streamLength, ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Destroys this FLAC::Properties instance.
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -73,16 +73,6 @@ Mod::Tag *IT::File::tag() const
|
||||
return &d->tag;
|
||||
}
|
||||
|
||||
PropertyMap IT::File::properties() const
|
||||
{
|
||||
return d->tag.properties();
|
||||
}
|
||||
|
||||
PropertyMap IT::File::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
return d->tag.setProperties(properties);
|
||||
}
|
||||
|
||||
IT::Properties *IT::File::audioProperties() const
|
||||
{
|
||||
return &d->properties;
|
||||
|
@ -67,18 +67,6 @@ namespace TagLib {
|
||||
|
||||
Mod::Tag *tag() const;
|
||||
|
||||
/*!
|
||||
* Forwards to Mod::Tag::properties().
|
||||
* BIC: will be removed once File::toDict() is made virtual
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
|
||||
/*!
|
||||
* Forwards to Mod::Tag::setProperties().
|
||||
* BIC: will be removed once File::setProperties() is made virtual
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &);
|
||||
|
||||
/*!
|
||||
* Returns the IT::Properties for this file. If no audio properties
|
||||
* were read then this will return a null pointer.
|
||||
|
@ -79,31 +79,6 @@ IT::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int IT::Properties::length() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::lengthInSeconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::sampleRate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::channels() const
|
||||
{
|
||||
return d->channels;
|
||||
|
@ -55,11 +55,6 @@ namespace TagLib {
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle);
|
||||
virtual ~Properties();
|
||||
|
||||
int length() const;
|
||||
int lengthInSeconds() const;
|
||||
int lengthInMilliseconds() const;
|
||||
int bitrate() const;
|
||||
int sampleRate() const;
|
||||
int channels() const;
|
||||
|
||||
unsigned short lengthInPatterns() const;
|
||||
|
@ -55,21 +55,6 @@ Mod::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int Mod::Properties::length() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mod::Properties::lengthInSeconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mod::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mod::Properties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
|
@ -37,9 +37,6 @@ namespace TagLib {
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle);
|
||||
virtual ~Properties();
|
||||
|
||||
int length() const;
|
||||
int lengthInSeconds() const;
|
||||
int lengthInMilliseconds() const;
|
||||
int bitrate() const;
|
||||
int sampleRate() const;
|
||||
int channels() const;
|
||||
|
@ -101,12 +101,6 @@ MP4::Properties::sampleRate() const
|
||||
return d->sampleRate;
|
||||
}
|
||||
|
||||
int
|
||||
MP4::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int
|
||||
MP4::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
|
@ -47,22 +47,12 @@ namespace TagLib {
|
||||
Properties(File *file, Atoms *atoms, ReadStyle style = Average);
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -66,13 +66,6 @@ public:
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MPC::Properties::Properties(const ByteVector &data, offset_t streamLength, ReadStyle style) :
|
||||
AudioProperties(style),
|
||||
d(new PropertiesPrivate())
|
||||
{
|
||||
readSV7(data, streamLength);
|
||||
}
|
||||
|
||||
MPC::Properties::Properties(File *file, offset_t streamLength, ReadStyle style) :
|
||||
AudioProperties(style),
|
||||
d(new PropertiesPrivate())
|
||||
@ -93,11 +86,6 @@ MPC::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int MPC::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int MPC::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -48,14 +48,6 @@ namespace TagLib {
|
||||
class TAGLIB_EXPORT Properties : public AudioProperties
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Create an instance of MPC::Properties with the data read from the
|
||||
* ByteVector \a data.
|
||||
*
|
||||
* This constructor is deprecated. It only works for MPC version up to 7.
|
||||
*/
|
||||
Properties(const ByteVector &data, offset_t streamLength, ReadStyle style = Average);
|
||||
|
||||
/*!
|
||||
* Create an instance of MPC::Properties with the data read directly
|
||||
* from a MPC::File.
|
||||
@ -67,22 +59,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -220,7 +220,7 @@ namespace TagLib {
|
||||
|
||||
virtual String toString() const;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* CHAP frames each have a unique element ID. This searches for a CHAP
|
||||
|
@ -145,7 +145,7 @@ namespace TagLib {
|
||||
* - otherwise, the key will be "COMMENT:<description>"
|
||||
* - The single value will be the frame's text().
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* Comments each have a unique description. This searches for a comment
|
||||
|
@ -57,7 +57,7 @@ namespace TagLib {
|
||||
*/
|
||||
virtual String toString() const;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
protected:
|
||||
// Reimplementations.
|
||||
|
@ -90,61 +90,31 @@ short RelativeVolumeFrame::volumeAdjustmentIndex(ChannelType type) const
|
||||
return d->channels.contains(type) ? d->channels[type].volumeAdjustment : 0;
|
||||
}
|
||||
|
||||
short RelativeVolumeFrame::volumeAdjustmentIndex() const
|
||||
{
|
||||
return volumeAdjustmentIndex(MasterVolume);
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index, ChannelType type)
|
||||
{
|
||||
d->channels[type].volumeAdjustment = index;
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index)
|
||||
{
|
||||
setVolumeAdjustmentIndex(index, MasterVolume);
|
||||
}
|
||||
|
||||
float RelativeVolumeFrame::volumeAdjustment(ChannelType type) const
|
||||
{
|
||||
return d->channels.contains(type) ? static_cast<float>(d->channels[type].volumeAdjustment) / static_cast<float>(512) : 0;
|
||||
}
|
||||
|
||||
float RelativeVolumeFrame::volumeAdjustment() const
|
||||
{
|
||||
return volumeAdjustment(MasterVolume);
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setVolumeAdjustment(float adjustment, ChannelType type)
|
||||
{
|
||||
d->channels[type].volumeAdjustment = static_cast<short>(adjustment * static_cast<float>(512));
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setVolumeAdjustment(float adjustment)
|
||||
{
|
||||
setVolumeAdjustment(adjustment, MasterVolume);
|
||||
}
|
||||
|
||||
RelativeVolumeFrame::PeakVolume RelativeVolumeFrame::peakVolume(ChannelType type) const
|
||||
{
|
||||
return d->channels.contains(type) ? d->channels[type].peakVolume : PeakVolume();
|
||||
}
|
||||
|
||||
RelativeVolumeFrame::PeakVolume RelativeVolumeFrame::peakVolume() const
|
||||
{
|
||||
return peakVolume(MasterVolume);
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak, ChannelType type)
|
||||
{
|
||||
d->channels[type].peakVolume = peak;
|
||||
}
|
||||
|
||||
void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak)
|
||||
{
|
||||
setPeakVolume(peak, MasterVolume);
|
||||
}
|
||||
|
||||
String RelativeVolumeFrame::identification() const
|
||||
{
|
||||
return d->identification;
|
||||
|
@ -128,14 +128,6 @@ namespace TagLib {
|
||||
*/
|
||||
List<ChannelType> channels() const;
|
||||
|
||||
/*
|
||||
* There was a terrible API goof here, and while this can't be changed to
|
||||
* the way it appears below for binary compatibility reasons, let's at
|
||||
* least pretend that it looks clean.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
|
||||
/*!
|
||||
* Returns the relative volume adjustment "index". As indicated by the
|
||||
* ID3v2 standard this is a 16-bit signed integer that reflects the
|
||||
@ -209,31 +201,6 @@ namespace TagLib {
|
||||
*/
|
||||
void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
|
||||
|
||||
#else
|
||||
|
||||
// BIC: Combine each of the following pairs of functions (or maybe just
|
||||
// rework this junk altogether).
|
||||
|
||||
short volumeAdjustmentIndex(ChannelType type) const;
|
||||
short volumeAdjustmentIndex() const;
|
||||
|
||||
void setVolumeAdjustmentIndex(short index, ChannelType type);
|
||||
void setVolumeAdjustmentIndex(short index);
|
||||
|
||||
float volumeAdjustment(ChannelType type) const;
|
||||
float volumeAdjustment() const;
|
||||
|
||||
void setVolumeAdjustment(float adjustment, ChannelType type);
|
||||
void setVolumeAdjustment(float adjustment);
|
||||
|
||||
PeakVolume peakVolume(ChannelType type) const;
|
||||
PeakVolume peakVolume() const;
|
||||
|
||||
void setPeakVolume(const PeakVolume &peak, ChannelType type);
|
||||
void setPeakVolume(const PeakVolume &peak);
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Returns the identification for this frame.
|
||||
*/
|
||||
|
@ -222,7 +222,7 @@ namespace TagLib {
|
||||
|
||||
virtual String toString() const;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* CTOC frames each have a unique element ID. This searches for a CTOC
|
||||
|
@ -195,7 +195,7 @@ namespace TagLib {
|
||||
*/
|
||||
static const KeyConversionMap &involvedPeopleMap();
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
protected:
|
||||
// Reimplementations.
|
||||
@ -289,7 +289,7 @@ namespace TagLib {
|
||||
* in the value list, in order to be compatible with TagLib which copies
|
||||
* the description() into the fieldList().
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* Searches for the user defined text frame with the description \a description
|
||||
|
@ -94,7 +94,7 @@ namespace TagLib {
|
||||
|
||||
virtual String toString() const;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* UFID frames each have a unique owner. This searches for a UFID
|
||||
|
@ -145,7 +145,7 @@ namespace TagLib {
|
||||
* Note that currently the language() field is not supported by the PropertyMap
|
||||
* interface.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* LyricsFrames each have a unique description. This searches for a lyrics
|
||||
|
@ -69,7 +69,7 @@ namespace TagLib {
|
||||
|
||||
virtual void setText(const String &s);
|
||||
virtual String toString() const;
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
protected:
|
||||
virtual void parseFields(const ByteVector &data);
|
||||
@ -160,7 +160,7 @@ namespace TagLib {
|
||||
* characters), the returned map will contain an entry "WXXX/<description>"
|
||||
* in its unsupportedData() list.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* Searches for the user defined url frame with the description \a description
|
||||
|
@ -80,16 +80,6 @@ namespace
|
||||
// static methods
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Frame::headerSize()
|
||||
{
|
||||
return Header::size();
|
||||
}
|
||||
|
||||
unsigned int Frame::headerSize(unsigned int version)
|
||||
{
|
||||
return Header::size(version);
|
||||
}
|
||||
|
||||
ByteVector Frame::textDelimiter(String::Type t)
|
||||
{
|
||||
if(t == String::UTF16 || t == String::UTF16BE || t == String::UTF16LE)
|
||||
@ -106,6 +96,11 @@ const String Frame::urlPrefix("URL:");
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Frame::headerSize()
|
||||
{
|
||||
return d->header->size();
|
||||
}
|
||||
|
||||
Frame *Frame::createTextualFrame(const String &key, const StringList &values) //static
|
||||
{
|
||||
// check if the key is contained in the key<=>frameID mapping
|
||||
@ -235,7 +230,7 @@ void Frame::parse(const ByteVector &data)
|
||||
|
||||
ByteVector Frame::fieldData(const ByteVector &frameData) const
|
||||
{
|
||||
unsigned int headerSize = Header::size(d->header->version());
|
||||
unsigned int headerSize = d->header->size();
|
||||
|
||||
unsigned int frameDataOffset = headerSize;
|
||||
unsigned int frameDataLength = size();
|
||||
@ -287,14 +282,9 @@ String Frame::readStringField(const ByteVector &data, String::Type encoding, int
|
||||
return str;
|
||||
}
|
||||
|
||||
String::Type Frame::checkEncoding(const StringList &fields, String::Type encoding) // static
|
||||
String::Type Frame::checkTextEncoding(const StringList &fields, String::Type encoding) const
|
||||
{
|
||||
return checkEncoding(fields, encoding, 4);
|
||||
}
|
||||
|
||||
String::Type Frame::checkEncoding(const StringList &fields, String::Type encoding, unsigned int version) // static
|
||||
{
|
||||
if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
|
||||
if((encoding == String::UTF8 || encoding == String::UTF16BE) && header()->version() != 4)
|
||||
return String::UTF16;
|
||||
|
||||
if(encoding != String::Latin1)
|
||||
@ -302,7 +292,7 @@ String::Type Frame::checkEncoding(const StringList &fields, String::Type encodin
|
||||
|
||||
for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
|
||||
if(!(*it).isLatin1()) {
|
||||
if(version == 4) {
|
||||
if(header()->version() == 4) {
|
||||
debug("Frame::checkEncoding() -- Rendering using UTF8.");
|
||||
return String::UTF8;
|
||||
}
|
||||
@ -314,11 +304,6 @@ String::Type Frame::checkEncoding(const StringList &fields, String::Type encodin
|
||||
return String::Latin1;
|
||||
}
|
||||
|
||||
String::Type Frame::checkTextEncoding(const StringList &fields, String::Type encoding) const
|
||||
{
|
||||
return checkEncoding(fields, encoding, header()->version());
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::pair<const char *, const char *> frameTranslation[] = {
|
||||
@ -479,24 +464,6 @@ PropertyMap Frame::asProperties() const
|
||||
return m;
|
||||
}
|
||||
const ByteVector &id = frameID();
|
||||
// workaround until this function is virtual
|
||||
if(id == "TXXX")
|
||||
return dynamic_cast< const UserTextIdentificationFrame* >(this)->asProperties();
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
if(id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN" || id == "GRP1")
|
||||
return dynamic_cast< const TextIdentificationFrame* >(this)->asProperties();
|
||||
if(id == "WXXX")
|
||||
return dynamic_cast< const UserUrlLinkFrame* >(this)->asProperties();
|
||||
if(id[0] == 'W')
|
||||
return dynamic_cast< const UrlLinkFrame* >(this)->asProperties();
|
||||
if(id == "COMM")
|
||||
return dynamic_cast< const CommentsFrame* >(this)->asProperties();
|
||||
if(id == "USLT")
|
||||
return dynamic_cast< const UnsynchronizedLyricsFrame* >(this)->asProperties();
|
||||
if(id == "UFID")
|
||||
return dynamic_cast< const UniqueFileIdentifierFrame* >(this)->asProperties();
|
||||
if(id == "PCST")
|
||||
return dynamic_cast< const PodcastFrame* >(this)->asProperties();
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append(id);
|
||||
return m;
|
||||
@ -555,17 +522,12 @@ public:
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// static members (Frame::Header)
|
||||
// public members (Frame::Header)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Frame::Header::size()
|
||||
{
|
||||
return size(4);
|
||||
}
|
||||
|
||||
unsigned int Frame::Header::size(unsigned int version)
|
||||
{
|
||||
switch(version) {
|
||||
switch(d->version) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
@ -577,10 +539,6 @@ unsigned int Frame::Header::size(unsigned int version)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// public members (Frame::Header)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Frame::Header::Header(const ByteVector &data, unsigned int version) :
|
||||
d(new HeaderPrivate())
|
||||
{
|
||||
|
@ -85,21 +85,8 @@ namespace TagLib {
|
||||
|
||||
/*!
|
||||
* Returns the size of the frame header
|
||||
*
|
||||
* \deprecated This is only accurate for ID3v2.3 or ID3v2.4. Please use
|
||||
* the call below which accepts an ID3v2 version number. In the next
|
||||
* non-binary compatible release this will be made into a non-static
|
||||
* member that checks the internal ID3v2 version.
|
||||
*/
|
||||
static unsigned int headerSize(); // BIC: make non-static
|
||||
|
||||
/*!
|
||||
* Returns the size of the frame header for the given ID3v2 version.
|
||||
*
|
||||
* \deprecated Please see the explanation above.
|
||||
*/
|
||||
// BIC: remove
|
||||
static unsigned int headerSize(unsigned int version);
|
||||
unsigned int headerSize();
|
||||
|
||||
/*!
|
||||
* Sets the data that will be used as the frame. Since the length is not
|
||||
@ -229,24 +216,6 @@ namespace TagLib {
|
||||
String readStringField(const ByteVector &data, String::Type encoding,
|
||||
int *position = 0);
|
||||
|
||||
/*!
|
||||
* Checks a the list of string values to see if they can be used with the
|
||||
* specified encoding and returns the recommended encoding.
|
||||
*/
|
||||
// BIC: remove and make non-static
|
||||
static String::Type checkEncoding(const StringList &fields,
|
||||
String::Type encoding);
|
||||
|
||||
/*!
|
||||
* Checks a the list of string values to see if they can be used with the
|
||||
* specified encoding and returns the recommended encoding. This method
|
||||
* also checks the ID3v2 version and makes sure the encoding can be used
|
||||
* in the specified version.
|
||||
*/
|
||||
// BIC: remove and make non-static
|
||||
static String::Type checkEncoding(const StringList &fields,
|
||||
String::Type encoding, unsigned int version);
|
||||
|
||||
/*!
|
||||
* Checks a the list of string values to see if they can be used with the
|
||||
* specified encoding and returns the recommended encoding. This method
|
||||
@ -261,9 +230,8 @@ namespace TagLib {
|
||||
* Parses the contents of this frame as PropertyMap. If that fails, the returned
|
||||
* PropertyMap will be empty, and its unsupportedData() will contain this frame's
|
||||
* ID.
|
||||
* BIC: Will be a virtual function in future releases.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* Returns an appropriate ID3 frame ID for the given free-form tag key. This method
|
||||
@ -390,23 +358,8 @@ namespace TagLib {
|
||||
|
||||
/*!
|
||||
* Returns the size of the frame header in bytes.
|
||||
*
|
||||
* \deprecated Please use the version of this method that accepts a
|
||||
* version. This is only accurate for ID3v2.3 and ID3v2.4. This will be
|
||||
* removed in the next binary incompatible release (2.0) and will be
|
||||
* replaced with a non-static method that checks the frame version.
|
||||
*/
|
||||
// BIC: make non-static
|
||||
static unsigned int size();
|
||||
|
||||
/*!
|
||||
* Returns the size of the frame header in bytes for the ID3v2 version
|
||||
* that's given.
|
||||
*
|
||||
* \deprecated Please see the explanation in the version above.
|
||||
*/
|
||||
// BIC: remove
|
||||
static unsigned int size(unsigned int version);
|
||||
unsigned int size();
|
||||
|
||||
/*!
|
||||
* Returns true if the flag for tag alter preservation is set.
|
||||
|
@ -115,11 +115,6 @@ FrameFactory *FrameFactory::instance()
|
||||
return &factory;
|
||||
}
|
||||
|
||||
Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader) const
|
||||
{
|
||||
return createFrame(origData, const_cast<const Header *>(tagHeader));
|
||||
}
|
||||
|
||||
Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHeader) const
|
||||
{
|
||||
ByteVector data = origData;
|
||||
@ -159,9 +154,9 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe
|
||||
if(version > 3 && (tagHeader->unsynchronisation() || header->unsynchronisation())) {
|
||||
// Data lengths are not part of the encoded data, but since they are synch-safe
|
||||
// integers they will be never actually encoded.
|
||||
ByteVector frameData = data.mid(Frame::Header::size(version), header->frameSize());
|
||||
ByteVector frameData = data.mid(header->size(), header->frameSize());
|
||||
frameData = SynchData::decode(frameData);
|
||||
data = data.mid(0, Frame::Header::size(version)) + frameData;
|
||||
data = data.mid(0, header->size()) + frameData;
|
||||
}
|
||||
|
||||
// TagLib doesn't mess with encrypted frames, so just treat them
|
||||
|
@ -67,25 +67,18 @@ namespace TagLib {
|
||||
public:
|
||||
static FrameFactory *instance();
|
||||
|
||||
/*!
|
||||
* \deprecated Use createFrame(const ByteVector &, const Header *) const.
|
||||
*/
|
||||
// BIC: remove
|
||||
Frame *createFrame(const ByteVector &data, Header *tagHeader) const;
|
||||
/*!
|
||||
* Create a frame based on \a data. \a tagHeader should be a valid
|
||||
* ID3v2::Header instance.
|
||||
*/
|
||||
// BIC: make virtual
|
||||
Frame *createFrame(const ByteVector &data, const Header *tagHeader) const;
|
||||
virtual Frame *createFrame(const ByteVector &data, const Header *tagHeader) const;
|
||||
|
||||
/*!
|
||||
* After a tag has been read, this tries to rebuild some of them
|
||||
* information, most notably the recording date, from frames that
|
||||
* have been deprecated and can't be upgraded directly.
|
||||
*/
|
||||
// BIC: Make virtual
|
||||
void rebuildAggregateFrames(ID3v2::Tag *tag) const;
|
||||
virtual void rebuildAggregateFrames(ID3v2::Tag *tag) const;
|
||||
|
||||
/*!
|
||||
* Returns the default text encoding for text frames. If setTextEncoding()
|
||||
|
@ -656,7 +656,7 @@ ByteVector ID3v2::Tag::render(Version version) const
|
||||
}
|
||||
if(!(*it)->header()->tagAlterPreservation()) {
|
||||
const ByteVector frameData = (*it)->render();
|
||||
if(frameData.size() == Frame::headerSize((*it)->header()->version())) {
|
||||
if(frameData.size() == (*it)->headerSize()) {
|
||||
debug("An empty ID3v2 frame \'"
|
||||
+ String((*it)->header()->frameID()) + "\' has been discarded");
|
||||
continue;
|
||||
@ -789,7 +789,7 @@ void ID3v2::Tag::parse(const ByteVector &origData)
|
||||
// Make sure that there is at least enough room in the remaining frame data for
|
||||
// a frame header.
|
||||
|
||||
while(frameDataPosition < frameDataLength - Frame::headerSize(d->header.majorVersion())) {
|
||||
while(frameDataPosition < frameDataLength - d->header.size()) {
|
||||
|
||||
// If the next data is position is 0, assume that we've hit the padding
|
||||
// portion of the frame data.
|
||||
@ -815,7 +815,7 @@ void ID3v2::Tag::parse(const ByteVector &origData)
|
||||
return;
|
||||
}
|
||||
|
||||
frameDataPosition += frame->size() + Frame::headerSize(d->header.majorVersion());
|
||||
frameDataPosition += frame->size() + frame->headerSize();
|
||||
addFrame(frame);
|
||||
}
|
||||
|
||||
|
@ -323,11 +323,6 @@ APE::Tag *MPEG::File::APETag(bool create)
|
||||
return d->tag.access<APE::Tag>(APEIndex, create);
|
||||
}
|
||||
|
||||
bool MPEG::File::strip(int tags)
|
||||
{
|
||||
return strip(tags, true);
|
||||
}
|
||||
|
||||
bool MPEG::File::strip(int tags, bool freeMemory)
|
||||
{
|
||||
if(readOnly()) {
|
||||
|
@ -93,7 +93,7 @@ namespace TagLib {
|
||||
*
|
||||
* \note In the current implementation, \a propertiesStyle is ignored.
|
||||
*/
|
||||
// BIC: merge with the above constructor
|
||||
// BIC: merge with the above constructor, kept for source compatibility
|
||||
File(FileName file, ID3v2::FrameFactory *frameFactory,
|
||||
bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average);
|
||||
@ -255,20 +255,6 @@ namespace TagLib {
|
||||
*/
|
||||
APE::Tag *APETag(bool create = false);
|
||||
|
||||
/*!
|
||||
* This will strip the tags that match the OR-ed together TagTypes from the
|
||||
* file. By default it strips all tags. It returns true if the tags are
|
||||
* successfully stripped.
|
||||
*
|
||||
* This is equivalent to strip(tags, true)
|
||||
*
|
||||
* \note This will also invalidate pointers to the ID3 and APE tags
|
||||
* as their memory will be freed.
|
||||
*
|
||||
* \note This will update the file immediately.
|
||||
*/
|
||||
bool strip(int tags = AllTags);
|
||||
|
||||
/*!
|
||||
* This will strip the tags that match the OR-ed together TagTypes from the
|
||||
* file. By default it strips all tags. It returns true if the tags are
|
||||
@ -279,8 +265,7 @@ namespace TagLib {
|
||||
*
|
||||
* \note This will update the file immediately.
|
||||
*/
|
||||
// BIC: merge with the method above
|
||||
bool strip(int tags, bool freeMemory);
|
||||
bool strip(int tags = AllTags, bool freeMemory = true);
|
||||
|
||||
/*!
|
||||
* Returns the position in the file of the first MPEG frame.
|
||||
|
@ -84,11 +84,6 @@ MPEG::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int MPEG::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int MPEG::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -59,22 +59,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -34,6 +34,69 @@
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
namespace {
|
||||
|
||||
/*!
|
||||
* Returns a CRC checksum of the byte vector's \a data.
|
||||
*
|
||||
* \note This uses an uncommon variant of CRC32 specializes in Ogg.
|
||||
*/
|
||||
unsigned int pageChecksum(const ByteVector &data)
|
||||
{
|
||||
static const unsigned int crcTable[256] = {
|
||||
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
||||
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
||||
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
||||
0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
|
||||
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
|
||||
0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
|
||||
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
|
||||
0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
|
||||
0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
|
||||
0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
|
||||
0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
|
||||
0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
|
||||
0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
|
||||
0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
|
||||
0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
|
||||
0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
|
||||
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
|
||||
0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
|
||||
0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
|
||||
0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
|
||||
0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
|
||||
0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
|
||||
0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
|
||||
0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
|
||||
0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
|
||||
0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
|
||||
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
|
||||
0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
|
||||
0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
|
||||
0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
|
||||
0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
|
||||
0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
|
||||
0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
|
||||
0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
|
||||
0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
|
||||
0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
|
||||
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
|
||||
0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
|
||||
0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
|
||||
0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
|
||||
0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
|
||||
0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
|
||||
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
|
||||
};
|
||||
|
||||
unsigned int sum = 0;
|
||||
for(ByteVector::ConstIterator it = data.begin(); it != data.end(); ++it)
|
||||
sum = (sum << 8) ^ crcTable[((sum >> 24) & 0xff) ^ static_cast<unsigned char>(*it)];
|
||||
return sum;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class Ogg::Page::PagePrivate
|
||||
{
|
||||
public:
|
||||
@ -189,7 +252,7 @@ ByteVector Ogg::Page::render() const
|
||||
// the entire page with the 4 bytes reserved for the checksum zeroed and then
|
||||
// inserted in bytes 22-25 of the page header.
|
||||
|
||||
const ByteVector checksum = ByteVector::fromUInt(data.checksum(), false);
|
||||
const ByteVector checksum = ByteVector::fromUInt(::pageChecksum(data), false);
|
||||
std::copy(checksum.begin(), checksum.end(), data.begin() + 22);
|
||||
|
||||
return data;
|
||||
|
@ -71,11 +71,6 @@ Opus::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int Ogg::Opus::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int Ogg::Opus::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -61,22 +61,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -77,11 +77,6 @@ Speex::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int Speex::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int Speex::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -61,22 +61,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -39,6 +39,8 @@ namespace TagLib {
|
||||
* documentation. The typedef below will make this work with the current code.
|
||||
* In the next BIC version of TagLib this will be really moved into the Ogg
|
||||
* namespace.
|
||||
* Kept for source compatibility, the typedef in vorbisproperties.h was not
|
||||
* correct in TagLib 1.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
@ -144,6 +146,8 @@ namespace TagLib {
|
||||
* To keep compatibility with the current version put Vorbis in the Ogg namespace
|
||||
* only in the docs and provide a typedef to make it work. In the next BIC
|
||||
* version this will be removed and it will only exist in the Ogg namespace.
|
||||
* Kept for source compatibility, the typedef in vorbisproperties.h was not
|
||||
* correct in TagLib 1.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
|
@ -80,11 +80,6 @@ Vorbis::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int Vorbis::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int Vorbis::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -36,6 +36,8 @@ namespace TagLib {
|
||||
* documentation. The typedef below will make this work with the current code.
|
||||
* In the next BIC version of TagLib this will be really moved into the Ogg
|
||||
* namespace.
|
||||
* Kept for source compatibility, the typedef in vorbisproperties.h was not
|
||||
* correct in TagLib 1.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
@ -67,22 +69,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
@ -137,12 +129,14 @@ namespace TagLib {
|
||||
* To keep compatibility with the current version put Vorbis in the Ogg namespace
|
||||
* only in the docs and provide a typedef to make it work. In the next BIC
|
||||
* version this will be removed and it will only exist in the Ogg namespace.
|
||||
* Kept for source compatibility, the typedef in vorbisproperties.h was not
|
||||
* correct in TagLib 1.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
}
|
||||
#else
|
||||
namespace Ogg { namespace Vorbis { typedef TagLib::AudioProperties AudioProperties; } }
|
||||
namespace Ogg { namespace Vorbis { typedef TagLib::Vorbis::Properties Properties; } }
|
||||
#endif
|
||||
|
||||
} // namespace TagLib
|
||||
|
@ -344,11 +344,6 @@ List<FLAC::Picture *> Ogg::XiphComment::pictureList()
|
||||
return d->pictureList;
|
||||
}
|
||||
|
||||
ByteVector Ogg::XiphComment::render() const
|
||||
{
|
||||
return render(true);
|
||||
}
|
||||
|
||||
ByteVector Ogg::XiphComment::render(bool addFramingBit) const
|
||||
{
|
||||
ByteVector data;
|
||||
|
@ -212,11 +212,6 @@ namespace TagLib {
|
||||
*/
|
||||
bool contains(const String &key) const;
|
||||
|
||||
/*!
|
||||
* Renders the comment to a ByteVector suitable for inserting into a file.
|
||||
*/
|
||||
ByteVector render() const; // BIC: remove and merge with below
|
||||
|
||||
/*!
|
||||
* Renders the comment to a ByteVector suitable for inserting into a file.
|
||||
*
|
||||
@ -224,7 +219,7 @@ namespace TagLib {
|
||||
* be appended. However some formats (notably FLAC) do not work with this
|
||||
* in place.
|
||||
*/
|
||||
ByteVector render(bool addFramingBit) const;
|
||||
ByteVector render(bool addFramingBit = true) const;
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -69,11 +69,6 @@ RIFF::AIFF::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int RIFF::AIFF::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int RIFF::AIFF::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -57,22 +57,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -77,11 +77,6 @@ RIFF::WAV::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int RIFF::WAV::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int RIFF::WAV::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -60,22 +60,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -73,31 +73,6 @@ S3M::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int S3M::Properties::length() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int S3M::Properties::lengthInSeconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int S3M::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int S3M::Properties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int S3M::Properties::sampleRate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int S3M::Properties::channels() const
|
||||
{
|
||||
return d->channels;
|
||||
|
@ -48,11 +48,6 @@ namespace TagLib {
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle);
|
||||
virtual ~Properties();
|
||||
|
||||
int length() const;
|
||||
int lengthInSeconds() const;
|
||||
int lengthInMilliseconds() const;
|
||||
int bitrate() const;
|
||||
int sampleRate() const;
|
||||
int channels() const;
|
||||
|
||||
unsigned short lengthInPatterns() const;
|
||||
|
@ -58,17 +58,14 @@ namespace TagLib {
|
||||
* The default implementation in this class considers only the usual built-in
|
||||
* tags (artist, album, ...) and only one value per key.
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
virtual PropertyMap properties() const;
|
||||
|
||||
/*!
|
||||
* Removes unsupported properties, or a subset of them, from the tag.
|
||||
* The parameter \a properties must contain only entries from
|
||||
* properties().unsupportedData().
|
||||
* BIC: Will become virtual in future releases. Currently the non-virtual
|
||||
* standard implementation of TagLib::Tag does nothing, since there are
|
||||
* no unsupported elements.
|
||||
*/
|
||||
void removeUnsupportedProperties(const StringList& properties);
|
||||
virtual void removeUnsupportedProperties(const StringList& properties);
|
||||
|
||||
/*!
|
||||
* Sets the tags of this File to those specified in \a properties. This default
|
||||
@ -76,7 +73,7 @@ namespace TagLib {
|
||||
* (artist, album, ...), and only one value per key; the rest will be contained
|
||||
* in the returned PropertyMap.
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &properties);
|
||||
virtual PropertyMap setProperties(const PropertyMap &properties);
|
||||
|
||||
/*!
|
||||
* Returns the track name; if no track name is present in the tag
|
||||
|
@ -110,27 +110,9 @@ void TagUnion::set(int index, Tag *tag)
|
||||
|
||||
PropertyMap TagUnion::properties() const
|
||||
{
|
||||
// This is an ugly workaround but we can't add a virtual function.
|
||||
// Should be virtual in taglib2.
|
||||
|
||||
for(size_t i = 0; i < 3; ++i) {
|
||||
|
||||
if(d->tags[i] && !d->tags[i]->isEmpty()) {
|
||||
|
||||
if(dynamic_cast<const ID3v1::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const ID3v1::Tag *>(d->tags[i])->properties();
|
||||
|
||||
if(dynamic_cast<const ID3v2::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const ID3v2::Tag *>(d->tags[i])->properties();
|
||||
|
||||
if(dynamic_cast<const APE::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const APE::Tag *>(d->tags[i])->properties();
|
||||
|
||||
if(dynamic_cast<const Ogg::XiphComment *>(d->tags[i]))
|
||||
return dynamic_cast<const Ogg::XiphComment *>(d->tags[i])->properties();
|
||||
|
||||
if(dynamic_cast<const RIFF::Info::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const RIFF::Info::Tag *>(d->tags[i])->properties();
|
||||
return d->tags[i]->properties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,27 +121,9 @@ PropertyMap TagUnion::properties() const
|
||||
|
||||
void TagUnion::removeUnsupportedProperties(const StringList &unsupported)
|
||||
{
|
||||
// This is an ugly workaround but we can't add a virtual function.
|
||||
// Should be virtual in taglib2.
|
||||
|
||||
for(size_t i = 0; i < 3; ++i) {
|
||||
|
||||
if(d->tags[i]) {
|
||||
|
||||
if(dynamic_cast<ID3v1::Tag *>(d->tags[i]))
|
||||
dynamic_cast<ID3v1::Tag *>(d->tags[i])->removeUnsupportedProperties(unsupported);
|
||||
|
||||
else if(dynamic_cast<ID3v2::Tag *>(d->tags[i]))
|
||||
dynamic_cast<ID3v2::Tag *>(d->tags[i])->removeUnsupportedProperties(unsupported);
|
||||
|
||||
else if(dynamic_cast<APE::Tag *>(d->tags[i]))
|
||||
dynamic_cast<APE::Tag *>(d->tags[i])->removeUnsupportedProperties(unsupported);
|
||||
|
||||
else if(dynamic_cast<Ogg::XiphComment *>(d->tags[i]))
|
||||
dynamic_cast<Ogg::XiphComment *>(d->tags[i])->removeUnsupportedProperties(unsupported);
|
||||
|
||||
else if(dynamic_cast<RIFF::Info::Tag *>(d->tags[i]))
|
||||
dynamic_cast<RIFF::Info::Tag *>(d->tags[i])->removeUnsupportedProperties(unsupported);
|
||||
d->tags[i]->removeUnsupportedProperties(unsupported);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,4 +209,3 @@ bool TagUnion::isEmpty() const
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ namespace TagLib {
|
||||
|
||||
void set(int index, Tag *tag);
|
||||
|
||||
PropertyMap properties() const;
|
||||
void removeUnsupportedProperties(const StringList &unsupported);
|
||||
virtual PropertyMap properties() const;
|
||||
virtual void removeUnsupportedProperties(const StringList &unsupported);
|
||||
|
||||
virtual String title() const;
|
||||
virtual String artist() const;
|
||||
|
@ -660,60 +660,6 @@ bool ByteVector::isEmpty() const
|
||||
return (d->length == 0);
|
||||
}
|
||||
|
||||
unsigned int ByteVector::checksum() const
|
||||
{
|
||||
static const unsigned int crcTable[256] = {
|
||||
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
||||
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
||||
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
||||
0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
|
||||
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
|
||||
0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
|
||||
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
|
||||
0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
|
||||
0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
|
||||
0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
|
||||
0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
|
||||
0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
|
||||
0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
|
||||
0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
|
||||
0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
|
||||
0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
|
||||
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
|
||||
0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
|
||||
0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
|
||||
0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
|
||||
0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
|
||||
0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
|
||||
0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
|
||||
0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
|
||||
0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
|
||||
0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
|
||||
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
|
||||
0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
|
||||
0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
|
||||
0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
|
||||
0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
|
||||
0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
|
||||
0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
|
||||
0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
|
||||
0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
|
||||
0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
|
||||
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
|
||||
0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
|
||||
0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
|
||||
0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
|
||||
0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
|
||||
0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
|
||||
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
|
||||
};
|
||||
|
||||
unsigned int sum = 0;
|
||||
for(ByteVector::ConstIterator it = begin(); it != end(); ++it)
|
||||
sum = (sum << 8) ^ crcTable[((sum >> 24) & 0xff) ^ static_cast<unsigned char>(*it)];
|
||||
return sum;
|
||||
}
|
||||
|
||||
unsigned int ByteVector::toUInt(bool mostSignificantByteFirst) const
|
||||
{
|
||||
return toNumber<unsigned int>(*this, 0, mostSignificantByteFirst);
|
||||
|
@ -277,14 +277,6 @@ namespace TagLib {
|
||||
*/
|
||||
bool isEmpty() const;
|
||||
|
||||
/*!
|
||||
* Returns a CRC checksum of the byte vector's data.
|
||||
*
|
||||
* \note This uses an uncommon variant of CRC32 specializes in Ogg.
|
||||
*/
|
||||
// BIC: Remove or make generic.
|
||||
unsigned int checksum() const;
|
||||
|
||||
/*!
|
||||
* Converts the first 4 bytes of the vector to an unsigned integer.
|
||||
*
|
||||
|
@ -36,12 +36,6 @@ class ByteVectorListPrivate
|
||||
// static members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &pattern,
|
||||
int byteAlign)
|
||||
{
|
||||
return split(v, pattern, byteAlign, 0);
|
||||
}
|
||||
|
||||
ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &pattern,
|
||||
int byteAlign, int max)
|
||||
{
|
||||
|
@ -65,12 +65,6 @@ namespace TagLib {
|
||||
*/
|
||||
ByteVector toByteVector(const ByteVector &separator = " ") const;
|
||||
|
||||
/*!
|
||||
* Splits the ByteVector \a v into several strings at \a pattern. This will
|
||||
* not include the pattern in the returned ByteVectors.
|
||||
*/
|
||||
static ByteVectorList split(const ByteVector &v, const ByteVector &pattern,
|
||||
int byteAlign = 1);
|
||||
/*!
|
||||
* Splits the ByteVector \a v into several strings at \a pattern. This will
|
||||
* not include the pattern in the returned ByteVectors. \a max is the
|
||||
@ -78,9 +72,8 @@ namespace TagLib {
|
||||
* is 2 then a maximum of 1 match will be found and the vector will be split
|
||||
* on that match.
|
||||
*/
|
||||
// BIC: merge with the function above
|
||||
static ByteVectorList split(const ByteVector &v, const ByteVector &pattern,
|
||||
int byteAlign, int max);
|
||||
int byteAlign = 1, int max = 0);
|
||||
private:
|
||||
class ByteVectorListPrivate;
|
||||
ByteVectorListPrivate *d;
|
||||
|
@ -110,114 +110,16 @@ FileName File::name() const
|
||||
|
||||
PropertyMap File::properties() const
|
||||
{
|
||||
// ugly workaround until this method is virtual
|
||||
if(dynamic_cast<const APE::File* >(this))
|
||||
return dynamic_cast<const APE::File* >(this)->properties();
|
||||
if(dynamic_cast<const FLAC::File* >(this))
|
||||
return dynamic_cast<const FLAC::File* >(this)->properties();
|
||||
if(dynamic_cast<const IT::File* >(this))
|
||||
return dynamic_cast<const IT::File* >(this)->properties();
|
||||
if(dynamic_cast<const Mod::File* >(this))
|
||||
return dynamic_cast<const Mod::File* >(this)->properties();
|
||||
if(dynamic_cast<const MPC::File* >(this))
|
||||
return dynamic_cast<const MPC::File* >(this)->properties();
|
||||
if(dynamic_cast<const MPEG::File* >(this))
|
||||
return dynamic_cast<const MPEG::File* >(this)->properties();
|
||||
if(dynamic_cast<const Ogg::FLAC::File* >(this))
|
||||
return dynamic_cast<const Ogg::FLAC::File* >(this)->properties();
|
||||
if(dynamic_cast<const Ogg::Speex::File* >(this))
|
||||
return dynamic_cast<const Ogg::Speex::File* >(this)->properties();
|
||||
if(dynamic_cast<const Ogg::Opus::File* >(this))
|
||||
return dynamic_cast<const Ogg::Opus::File* >(this)->properties();
|
||||
if(dynamic_cast<const Ogg::Vorbis::File* >(this))
|
||||
return dynamic_cast<const Ogg::Vorbis::File* >(this)->properties();
|
||||
if(dynamic_cast<const RIFF::AIFF::File* >(this))
|
||||
return dynamic_cast<const RIFF::AIFF::File* >(this)->properties();
|
||||
if(dynamic_cast<const RIFF::WAV::File* >(this))
|
||||
return dynamic_cast<const RIFF::WAV::File* >(this)->properties();
|
||||
if(dynamic_cast<const S3M::File* >(this))
|
||||
return dynamic_cast<const S3M::File* >(this)->properties();
|
||||
if(dynamic_cast<const TrueAudio::File* >(this))
|
||||
return dynamic_cast<const TrueAudio::File* >(this)->properties();
|
||||
if(dynamic_cast<const WavPack::File* >(this))
|
||||
return dynamic_cast<const WavPack::File* >(this)->properties();
|
||||
if(dynamic_cast<const XM::File* >(this))
|
||||
return dynamic_cast<const XM::File* >(this)->properties();
|
||||
if(dynamic_cast<const MP4::File* >(this))
|
||||
return dynamic_cast<const MP4::File* >(this)->properties();
|
||||
if(dynamic_cast<const ASF::File* >(this))
|
||||
return dynamic_cast<const ASF::File* >(this)->properties();
|
||||
return tag()->properties();
|
||||
}
|
||||
|
||||
void File::removeUnsupportedProperties(const StringList &properties)
|
||||
{
|
||||
// here we only consider those formats that could possibly contain
|
||||
// unsupported properties
|
||||
if(dynamic_cast<APE::File* >(this))
|
||||
dynamic_cast<APE::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<FLAC::File* >(this))
|
||||
dynamic_cast<FLAC::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<MPC::File* >(this))
|
||||
dynamic_cast<MPC::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<MPEG::File* >(this))
|
||||
dynamic_cast<MPEG::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<Ogg::Vorbis::File* >(this))
|
||||
dynamic_cast<Ogg::Vorbis::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<RIFF::AIFF::File* >(this))
|
||||
dynamic_cast<RIFF::AIFF::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<RIFF::WAV::File* >(this))
|
||||
dynamic_cast<RIFF::WAV::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<TrueAudio::File* >(this))
|
||||
dynamic_cast<TrueAudio::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<WavPack::File* >(this))
|
||||
dynamic_cast<WavPack::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<MP4::File* >(this))
|
||||
dynamic_cast<MP4::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else if(dynamic_cast<ASF::File* >(this))
|
||||
dynamic_cast<ASF::File* >(this)->removeUnsupportedProperties(properties);
|
||||
else
|
||||
tag()->removeUnsupportedProperties(properties);
|
||||
tag()->removeUnsupportedProperties(properties);
|
||||
}
|
||||
|
||||
PropertyMap File::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
if(dynamic_cast<APE::File* >(this))
|
||||
return dynamic_cast<APE::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<FLAC::File* >(this))
|
||||
return dynamic_cast<FLAC::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<IT::File* >(this))
|
||||
return dynamic_cast<IT::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<Mod::File* >(this))
|
||||
return dynamic_cast<Mod::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<MPC::File* >(this))
|
||||
return dynamic_cast<MPC::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<MPEG::File* >(this))
|
||||
return dynamic_cast<MPEG::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<Ogg::FLAC::File* >(this))
|
||||
return dynamic_cast<Ogg::FLAC::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<Ogg::Speex::File* >(this))
|
||||
return dynamic_cast<Ogg::Speex::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<Ogg::Opus::File* >(this))
|
||||
return dynamic_cast<Ogg::Opus::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<Ogg::Vorbis::File* >(this))
|
||||
return dynamic_cast<Ogg::Vorbis::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<RIFF::AIFF::File* >(this))
|
||||
return dynamic_cast<RIFF::AIFF::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<RIFF::WAV::File* >(this))
|
||||
return dynamic_cast<RIFF::WAV::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<S3M::File* >(this))
|
||||
return dynamic_cast<S3M::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<TrueAudio::File* >(this))
|
||||
return dynamic_cast<TrueAudio::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<WavPack::File* >(this))
|
||||
return dynamic_cast<WavPack::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<XM::File* >(this))
|
||||
return dynamic_cast<XM::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<MP4::File* >(this))
|
||||
return dynamic_cast<MP4::File* >(this)->setProperties(properties);
|
||||
if(dynamic_cast<ASF::File* >(this))
|
||||
return dynamic_cast<ASF::File* >(this)->setProperties(properties);
|
||||
return tag()->setProperties(properties);
|
||||
}
|
||||
|
||||
|
@ -105,17 +105,15 @@ namespace TagLib {
|
||||
* to remove (a subset of) them.
|
||||
* For files that contain more than one tag (e.g. an MP3 with both an ID3v1 and an ID3v2
|
||||
* tag) only the most "modern" one will be exported (ID3v2 in this case).
|
||||
* BIC: Will be made virtual in future releases.
|
||||
*/
|
||||
PropertyMap properties() const;
|
||||
virtual PropertyMap properties() const;
|
||||
|
||||
/*!
|
||||
* Removes unsupported properties, or a subset of them, from the file's metadata.
|
||||
* The parameter \a properties must contain only entries from
|
||||
* properties().unsupportedData().
|
||||
* BIC: Will be mad virtual in future releases.
|
||||
*/
|
||||
void removeUnsupportedProperties(const StringList& properties);
|
||||
virtual void removeUnsupportedProperties(const StringList& properties);
|
||||
|
||||
/*!
|
||||
* Sets the tags of this File to those specified in \a properties. Calls the
|
||||
@ -129,9 +127,8 @@ namespace TagLib {
|
||||
* (ID3v2 for MP3 files). Older formats will be updated as well, if they exist, but won't
|
||||
* be taken into account for the return value of this function.
|
||||
* See the documentation of the subclass implementations for detailed descriptions.
|
||||
* BIC: will become pure virtual in the future
|
||||
*/
|
||||
PropertyMap setProperties(const PropertyMap &properties);
|
||||
virtual PropertyMap setProperties(const PropertyMap &properties);
|
||||
|
||||
/*!
|
||||
* Returns a pointer to this file's audio properties. This should be
|
||||
|
@ -39,8 +39,7 @@ namespace TagLib {
|
||||
// A base for the generic and specialized private class types. New
|
||||
// non-templatized members should be added here.
|
||||
|
||||
// BIC change to RefCounter
|
||||
class ListPrivateBase : public RefCounterOld
|
||||
class ListPrivateBase : public RefCounter
|
||||
{
|
||||
public:
|
||||
ListPrivateBase() : autoDelete(false) {}
|
||||
|
@ -31,18 +31,17 @@ namespace TagLib {
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// BIC change to RefCounter
|
||||
template <class Key, class T>
|
||||
template <class KeyP, class TP>
|
||||
class Map<Key, T>::MapPrivate : public RefCounterOld
|
||||
class Map<Key, T>::MapPrivate : public RefCounter
|
||||
{
|
||||
public:
|
||||
MapPrivate() : RefCounterOld() {}
|
||||
MapPrivate() : RefCounter() {}
|
||||
#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
|
||||
MapPrivate(const std::map<class KeyP, class TP>& m) : RefCounterOld(), map(m) {}
|
||||
MapPrivate(const std::map<class KeyP, class TP>& m) : RefCounter(), map(m) {}
|
||||
std::map<class KeyP, class TP> map;
|
||||
#else
|
||||
MapPrivate(const std::map<KeyP, TP>& m) : RefCounterOld(), map(m) {}
|
||||
MapPrivate(const std::map<KeyP, TP>& m) : RefCounter(), map(m) {}
|
||||
std::map<KeyP, TP> map;
|
||||
#endif
|
||||
};
|
||||
|
@ -74,41 +74,7 @@ namespace TagLib
|
||||
RefCounterPrivate *d;
|
||||
};
|
||||
|
||||
// BIC this old class is needed by tlist.tcc and tmap.tcc
|
||||
class RefCounterOld
|
||||
{
|
||||
public:
|
||||
RefCounterOld() : refCount(1) {}
|
||||
|
||||
#ifdef TAGLIB_ATOMIC_MAC
|
||||
void ref() { OSAtomicIncrement32Barrier(const_cast<int32_t*>(&refCount)); }
|
||||
bool deref() { return ! OSAtomicDecrement32Barrier(const_cast<int32_t*>(&refCount)); }
|
||||
int32_t count() { return refCount; }
|
||||
private:
|
||||
volatile int32_t refCount;
|
||||
#elif defined(TAGLIB_ATOMIC_WIN)
|
||||
void ref() { InterlockedIncrement(&refCount); }
|
||||
bool deref() { return ! InterlockedDecrement(&refCount); }
|
||||
long count() { return refCount; }
|
||||
private:
|
||||
volatile long refCount;
|
||||
#elif defined(TAGLIB_ATOMIC_GCC)
|
||||
void ref() { __sync_add_and_fetch(&refCount, 1); }
|
||||
bool deref() { return ! __sync_sub_and_fetch(&refCount, 1); }
|
||||
int count() { return refCount; }
|
||||
private:
|
||||
volatile int refCount;
|
||||
#else
|
||||
void ref() { refCount++; }
|
||||
bool deref() { return ! --refCount; }
|
||||
int count() { return refCount; }
|
||||
private:
|
||||
unsigned int refCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // DO_NOT_DOCUMENT
|
||||
#endif
|
||||
|
||||
|
@ -482,11 +482,6 @@ ByteVector String::data(Type t) const
|
||||
}
|
||||
}
|
||||
|
||||
int String::toInt() const
|
||||
{
|
||||
return toInt(0);
|
||||
}
|
||||
|
||||
int String::toInt(bool *ok) const
|
||||
{
|
||||
const wchar_t *begin = d->data.c_str();
|
||||
|
@ -338,15 +338,6 @@ namespace TagLib {
|
||||
*/
|
||||
ByteVector data(Type t) const;
|
||||
|
||||
/*!
|
||||
* Convert the string to an integer.
|
||||
*
|
||||
* Returns the integer if the conversion was successful or 0 if the
|
||||
* string does not represent a number.
|
||||
*/
|
||||
// BIC: merge with the method below
|
||||
int toInt() const;
|
||||
|
||||
/*!
|
||||
* Convert the string to an integer.
|
||||
*
|
||||
@ -354,7 +345,7 @@ namespace TagLib {
|
||||
* true and returns the integer. Otherwise it sets \a *ok to false
|
||||
* and the result is undefined.
|
||||
*/
|
||||
int toInt(bool *ok) const;
|
||||
int toInt(bool *ok = 0) const;
|
||||
|
||||
/*!
|
||||
* Returns a string with the leading and trailing whitespace stripped.
|
||||
|
@ -66,16 +66,14 @@ namespace TagLib {
|
||||
*
|
||||
* \see lengthInMilliseconds()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInSeconds() const;
|
||||
virtual int lengthInSeconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in milliseconds.
|
||||
*
|
||||
* \see lengthInSeconds()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -78,11 +78,6 @@ WavPack::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int WavPack::Properties::lengthInSeconds() const
|
||||
{
|
||||
return d->length / 1000;
|
||||
}
|
||||
|
||||
int WavPack::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return d->length;
|
||||
|
@ -62,22 +62,12 @@ namespace TagLib {
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
/*!
|
||||
* 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()
|
||||
*/
|
||||
// BIC: make virtual
|
||||
int lengthInMilliseconds() const;
|
||||
virtual int lengthInMilliseconds() const;
|
||||
|
||||
/*!
|
||||
* Returns the average bit rate of the file in kb/s.
|
||||
|
@ -69,31 +69,6 @@ XM::Properties::~Properties()
|
||||
delete d;
|
||||
}
|
||||
|
||||
int XM::Properties::length() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XM::Properties::lengthInSeconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XM::Properties::lengthInMilliseconds() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XM::Properties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XM::Properties::sampleRate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XM::Properties::channels() const
|
||||
{
|
||||
return d->channels;
|
||||
|
@ -43,11 +43,6 @@ namespace TagLib {
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle);
|
||||
virtual ~Properties();
|
||||
|
||||
int length() const;
|
||||
int lengthInSeconds() const;
|
||||
int lengthInMilliseconds() const;
|
||||
int bitrate() const;
|
||||
int sampleRate() const;
|
||||
int channels() const;
|
||||
|
||||
unsigned short lengthInPatterns() const;
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
void testPropertyInterface2()
|
||||
{
|
||||
APE::Tag tag;
|
||||
APE::Item item1 = APE::Item("TRACK", "17");
|
||||
APE::Item item1 = APE::Item("TRACK", String("17"));
|
||||
tag.setItem("TRACK", item1);
|
||||
|
||||
APE::Item item2 = APE::Item();
|
||||
@ -118,7 +118,7 @@ public:
|
||||
tag.removeUnsupportedProperties(properties.unsupportedData());
|
||||
CPPUNIT_ASSERT(!tag.itemListMap().contains("TESTBINARY"));
|
||||
|
||||
APE::Item item3 = APE::Item("TRACKNUMBER", "29");
|
||||
APE::Item item3 = APE::Item("TRACKNUMBER", String("29"));
|
||||
tag.setItem("TRACKNUMBER", item3);
|
||||
properties = tag.properties();
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)2, properties["TRACKNUMBER"].size());
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
void testTextBinary()
|
||||
{
|
||||
APE::Item item = APE::Item("DUMMY", "Test Text");
|
||||
APE::Item item = APE::Item("DUMMY", String("Test Text"));
|
||||
CPPUNIT_ASSERT_EQUAL(String("Test Text"), item.toString());
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector(), item.binaryData());
|
||||
|
||||
@ -188,4 +188,3 @@ public:
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestAPETag);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user