Format taglib sources

This commit is contained in:
Jonas Kvinge
2020-06-13 19:02:42 +02:00
parent 72bff7fa35
commit 4ce099294c
224 changed files with 12905 additions and 15623 deletions

View File

@@ -43,38 +43,35 @@
using namespace Strawberry_TagLib::TagLib;
namespace
{
typedef List<FLAC::MetadataBlock *> BlockList;
typedef BlockList::Iterator BlockIterator;
typedef BlockList::Iterator BlockConstIterator;
namespace {
typedef List<FLAC::MetadataBlock *> BlockList;
typedef BlockList::Iterator BlockIterator;
typedef BlockList::Iterator BlockConstIterator;
enum { FlacXiphIndex = 0, FlacID3v2Index = 1, FlacID3v1Index = 2 };
enum { FlacXiphIndex = 0,
FlacID3v2Index = 1,
FlacID3v1Index = 2 };
const long MinPaddingLength = 4096;
const long MaxPaddingLegnth = 1024 * 1024;
const long MinPaddingLength = 4096;
const long MaxPaddingLegnth = 1024 * 1024;
const char LastBlockFlag = '\x80';
}
const char LastBlockFlag = '\x80';
} // namespace
class FLAC::File::FilePrivate
{
public:
explicit FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
ID3v2FrameFactory(frameFactory),
ID3v2Location(-1),
ID3v2OriginalSize(0),
ID3v1Location(-1),
properties(0),
flacStart(0),
streamStart(0),
scanned(false)
{
class FLAC::File::FilePrivate {
public:
explicit FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) : ID3v2FrameFactory(frameFactory),
ID3v2Location(-1),
ID3v2OriginalSize(0),
ID3v1Location(-1),
properties(0),
flacStart(0),
streamStart(0),
scanned(false) {
blocks.setAutoDelete(true);
}
~FilePrivate()
{
~FilePrivate() {
delete properties;
}
@@ -99,8 +96,7 @@ public:
// static members
////////////////////////////////////////////////////////////////////////////////
bool FLAC::File::isSupported(IOStream *stream)
{
bool FLAC::File::isSupported(IOStream *stream) {
// A FLAC file has an ID "fLaC" somewhere. An ID3v2 tag may precede.
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true);
@@ -111,84 +107,71 @@ bool FLAC::File::isSupported(IOStream *stream)
// public members
////////////////////////////////////////////////////////////////////////////////
FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
Strawberry_TagLib::TagLib::File(file),
d(new FilePrivate())
{
if(isOpen())
FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file),
d(new FilePrivate()) {
if (isOpen())
read(readProperties);
}
FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle) :
Strawberry_TagLib::TagLib::File(file),
d(new FilePrivate(frameFactory))
{
if(isOpen())
bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(file),
d(new FilePrivate(frameFactory)) {
if (isOpen())
read(readProperties);
}
FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle) :
Strawberry_TagLib::TagLib::File(stream),
d(new FilePrivate(frameFactory))
{
if(isOpen())
bool readProperties, Properties::ReadStyle) : Strawberry_TagLib::TagLib::File(stream),
d(new FilePrivate(frameFactory)) {
if (isOpen())
read(readProperties);
}
FLAC::File::~File()
{
FLAC::File::~File() {
delete d;
}
Strawberry_TagLib::TagLib::Tag *FLAC::File::tag() const
{
Strawberry_TagLib::TagLib::Tag *FLAC::File::tag() const {
return &d->tag;
}
PropertyMap FLAC::File::properties() const
{
PropertyMap FLAC::File::properties() const {
return d->tag.properties();
}
void FLAC::File::removeUnsupportedProperties(const StringList &unsupported)
{
void FLAC::File::removeUnsupportedProperties(const StringList &unsupported) {
d->tag.removeUnsupportedProperties(unsupported);
}
PropertyMap FLAC::File::setProperties(const PropertyMap &properties)
{
PropertyMap FLAC::File::setProperties(const PropertyMap &properties) {
return xiphComment(true)->setProperties(properties);
}
FLAC::Properties *FLAC::File::audioProperties() const
{
FLAC::Properties *FLAC::File::audioProperties() const {
return d->properties;
}
bool FLAC::File::save()
{
if(readOnly()) {
bool FLAC::File::save() {
if (readOnly()) {
debug("FLAC::File::save() - Cannot save to a read only file.");
return false;
}
if(!isValid()) {
if (!isValid()) {
debug("FLAC::File::save() -- Trying to save invalid file.");
return false;
}
// Create new vorbis comments
if(!hasXiphComment())
if (!hasXiphComment())
Tag::duplicate(&d->tag, xiphComment(true), false);
d->xiphCommentData = xiphComment()->render(false);
// Replace metadata blocks
for(BlockIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
if((*it)->code() == MetadataBlock::VorbisComment) {
for (BlockIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
if ((*it)->code() == MetadataBlock::VorbisComment) {
// Set the new Vorbis Comment block
delete *it;
d->blocks.erase(it);
@@ -201,7 +184,7 @@ bool FLAC::File::save()
// Render data for the metadata blocks
ByteVector data;
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
for (BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
ByteVector blockData = (*it)->render();
ByteVector blockHeader = ByteVector::fromUInt(blockData.size());
blockHeader[0] = (*it)->code();
@@ -214,7 +197,7 @@ bool FLAC::File::save()
long originalLength = d->streamStart - d->flacStart;
long paddingLength = originalLength - data.size() - 4;
if(paddingLength <= 0) {
if (paddingLength <= 0) {
paddingLength = MinPaddingLength;
}
else {
@@ -224,7 +207,7 @@ bool FLAC::File::save()
threshold = std::max(threshold, MinPaddingLength);
threshold = std::min(threshold, MaxPaddingLegnth);
if(paddingLength > threshold)
if (paddingLength > threshold)
paddingLength = MinPaddingLength;
}
@@ -239,25 +222,25 @@ bool FLAC::File::save()
d->streamStart += (static_cast<long>(data.size()) - originalLength);
if(d->ID3v1Location >= 0)
if (d->ID3v1Location >= 0)
d->ID3v1Location += (static_cast<long>(data.size()) - originalLength);
// Update ID3 tags
if(ID3v2Tag() && !ID3v2Tag()->isEmpty()) {
if (ID3v2Tag() && !ID3v2Tag()->isEmpty()) {
// ID3v2 tag is not empty. Update the old one or create a new one.
if(d->ID3v2Location < 0)
if (d->ID3v2Location < 0)
d->ID3v2Location = 0;
data = ID3v2Tag()->render();
insert(data, d->ID3v2Location, d->ID3v2OriginalSize);
d->flacStart += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
d->flacStart += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
d->streamStart += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
if(d->ID3v1Location >= 0)
if (d->ID3v1Location >= 0)
d->ID3v1Location += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
d->ID3v2OriginalSize = data.size();
@@ -266,13 +249,13 @@ bool FLAC::File::save()
// ID3v2 tag is empty. Remove the old one.
if(d->ID3v2Location >= 0) {
if (d->ID3v2Location >= 0) {
removeBlock(d->ID3v2Location, d->ID3v2OriginalSize);
d->flacStart -= d->ID3v2OriginalSize;
d->flacStart -= d->ID3v2OriginalSize;
d->streamStart -= d->ID3v2OriginalSize;
if(d->ID3v1Location >= 0)
if (d->ID3v1Location >= 0)
d->ID3v1Location -= d->ID3v2OriginalSize;
d->ID3v2Location = -1;
@@ -280,11 +263,11 @@ bool FLAC::File::save()
}
}
if(ID3v1Tag() && !ID3v1Tag()->isEmpty()) {
if (ID3v1Tag() && !ID3v1Tag()->isEmpty()) {
// ID3v1 tag is not empty. Update the old one or create a new one.
if(d->ID3v1Location >= 0) {
if (d->ID3v1Location >= 0) {
seek(d->ID3v1Location);
}
else {
@@ -298,7 +281,7 @@ bool FLAC::File::save()
// ID3v1 tag is empty. Remove the old one.
if(d->ID3v1Location >= 0) {
if (d->ID3v1Location >= 0) {
truncate(d->ID3v1Location);
d->ID3v1Location = -1;
}
@@ -307,69 +290,59 @@ bool FLAC::File::save()
return true;
}
ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
{
ID3v2::Tag *FLAC::File::ID3v2Tag(bool create) {
return d->tag.access<ID3v2::Tag>(FlacID3v2Index, create);
}
ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
{
ID3v1::Tag *FLAC::File::ID3v1Tag(bool create) {
return d->tag.access<ID3v1::Tag>(FlacID3v1Index, create);
}
Ogg::XiphComment *FLAC::File::xiphComment(bool create)
{
Ogg::XiphComment *FLAC::File::xiphComment(bool create) {
return d->tag.access<Ogg::XiphComment>(FlacXiphIndex, create);
}
void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
{
void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory) {
d->ID3v2FrameFactory = factory;
}
ByteVector FLAC::File::streamInfoData()
{
ByteVector FLAC::File::streamInfoData() {
debug("FLAC::File::streamInfoData() -- This function is obsolete. Returning an empty ByteVector.");
return ByteVector();
}
long FLAC::File::streamLength()
{
long FLAC::File::streamLength() {
debug("FLAC::File::streamLength() -- This function is obsolete. Returning zero.");
return 0;
}
List<FLAC::Picture *> FLAC::File::pictureList()
{
List<FLAC::Picture *> FLAC::File::pictureList() {
List<Picture *> pictures;
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
for (BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
Picture *picture = dynamic_cast<Picture *>(*it);
if(picture) {
if (picture) {
pictures.append(picture);
}
}
return pictures;
}
void FLAC::File::addPicture(Picture *picture)
{
void FLAC::File::addPicture(Picture *picture) {
d->blocks.append(picture);
}
void FLAC::File::removePicture(Picture *picture, bool del)
{
void FLAC::File::removePicture(Picture *picture, bool del) {
BlockIterator it = d->blocks.find(picture);
if(it != d->blocks.end())
if (it != d->blocks.end())
d->blocks.erase(it);
if(del)
if (del)
delete picture;
}
void FLAC::File::removePictures()
{
for(BlockIterator it = d->blocks.begin(); it != d->blocks.end(); ) {
if(dynamic_cast<Picture *>(*it)) {
void FLAC::File::removePictures() {
for (BlockIterator it = d->blocks.begin(); it != d->blocks.end();) {
if (dynamic_cast<Picture *>(*it)) {
delete *it;
it = d->blocks.erase(it);
}
@@ -379,32 +352,28 @@ void FLAC::File::removePictures()
}
}
void FLAC::File::strip(int tags)
{
if(tags & ID3v1)
void FLAC::File::strip(int tags) {
if (tags & ID3v1)
d->tag.set(FlacID3v1Index, 0);
if(tags & ID3v2)
if (tags & ID3v2)
d->tag.set(FlacID3v2Index, 0);
if(tags & XiphComment) {
if (tags & XiphComment) {
xiphComment()->removeAllFields();
xiphComment()->removeAllPictures();
}
}
bool FLAC::File::hasXiphComment() const
{
bool FLAC::File::hasXiphComment() const {
return !d->xiphCommentData.isEmpty();
}
bool FLAC::File::hasID3v1Tag() const
{
bool FLAC::File::hasID3v1Tag() const {
return (d->ID3v1Location >= 0);
}
bool FLAC::File::hasID3v2Tag() const
{
bool FLAC::File::hasID3v2Tag() const {
return (d->ID3v2Location >= 0);
}
@@ -412,13 +381,12 @@ bool FLAC::File::hasID3v2Tag() const
// private members
////////////////////////////////////////////////////////////////////////////////
void FLAC::File::read(bool readProperties)
{
void FLAC::File::read(bool readProperties) {
// Look for an ID3v2 tag
d->ID3v2Location = Utils::findID3v2(this);
if(d->ID3v2Location >= 0) {
if (d->ID3v2Location >= 0) {
d->tag.set(FlacID3v2Index, new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory));
d->ID3v2OriginalSize = ID3v2Tag()->header()->completeTagSize();
}
@@ -427,22 +395,22 @@ void FLAC::File::read(bool readProperties)
d->ID3v1Location = Utils::findID3v1(this);
if(d->ID3v1Location >= 0)
if (d->ID3v1Location >= 0)
d->tag.set(FlacID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
// Look for FLAC metadata, including vorbis comments
scan();
if(!isValid())
if (!isValid())
return;
if(!d->xiphCommentData.isEmpty())
if (!d->xiphCommentData.isEmpty())
d->tag.set(FlacXiphIndex, new Ogg::XiphComment(d->xiphCommentData));
else
d->tag.set(FlacXiphIndex, new Ogg::XiphComment());
if(readProperties) {
if (readProperties) {
// First block should be the stream_info metadata
@@ -450,7 +418,7 @@ void FLAC::File::read(bool readProperties)
long streamLength;
if(d->ID3v1Location >= 0)
if (d->ID3v1Location >= 0)
streamLength = d->ID3v1Location - d->streamStart;
else
streamLength = length() - d->streamStart;
@@ -459,24 +427,23 @@ void FLAC::File::read(bool readProperties)
}
}
void FLAC::File::scan()
{
void FLAC::File::scan() {
// Scan the metadata pages
if(d->scanned)
if (d->scanned)
return;
if(!isValid())
if (!isValid())
return;
long nextBlockOffset;
if(d->ID3v2Location >= 0)
if (d->ID3v2Location >= 0)
nextBlockOffset = find("fLaC", d->ID3v2Location + d->ID3v2OriginalSize);
else
nextBlockOffset = find("fLaC");
if(nextBlockOffset < 0) {
if (nextBlockOffset < 0) {
debug("FLAC::File::scan() -- FLAC stream not found");
setValid(false);
return;
@@ -485,7 +452,7 @@ void FLAC::File::scan()
nextBlockOffset += 4;
d->flacStart = nextBlockOffset;
while(true) {
while (true) {
seek(nextBlockOffset);
const ByteVector header = readBlock(4);
@@ -508,22 +475,20 @@ void FLAC::File::scan()
// First block should be the stream_info metadata
if(d->blocks.isEmpty() && blockType != MetadataBlock::StreamInfo) {
if (d->blocks.isEmpty() && blockType != MetadataBlock::StreamInfo) {
debug("FLAC::File::scan() -- First block should be the stream_info metadata");
setValid(false);
return;
}
if(blockLength == 0
&& blockType != MetadataBlock::Padding && blockType != MetadataBlock::SeekTable)
{
if (blockLength == 0 && blockType != MetadataBlock::Padding && blockType != MetadataBlock::SeekTable) {
debug("FLAC::File::scan() -- Zero-sized metadata block found");
setValid(false);
return;
}
const ByteVector data = readBlock(blockLength);
if(data.size() != blockLength) {
if (data.size() != blockLength) {
debug("FLAC::File::scan() -- Failed to read a metadata block");
setValid(false);
return;
@@ -532,8 +497,8 @@ void FLAC::File::scan()
MetadataBlock *block = 0;
// Found the vorbis-comment
if(blockType == MetadataBlock::VorbisComment) {
if(d->xiphCommentData.isEmpty()) {
if (blockType == MetadataBlock::VorbisComment) {
if (d->xiphCommentData.isEmpty()) {
d->xiphCommentData = data;
block = new UnknownMetadataBlock(MetadataBlock::VorbisComment, data);
}
@@ -541,9 +506,9 @@ void FLAC::File::scan()
debug("FLAC::File::scan() -- multiple Vorbis Comment blocks found, discarding");
}
}
else if(blockType == MetadataBlock::Picture) {
else if (blockType == MetadataBlock::Picture) {
FLAC::Picture *picture = new FLAC::Picture();
if(picture->parse(data)) {
if (picture->parse(data)) {
block = picture;
}
else {
@@ -551,19 +516,19 @@ void FLAC::File::scan()
delete picture;
}
}
else if(blockType == MetadataBlock::Padding) {
else if (blockType == MetadataBlock::Padding) {
// Skip all padding blocks.
}
else {
block = new UnknownMetadataBlock(blockType, data);
}
if(block)
if (block)
d->blocks.append(block);
nextBlockOffset += blockLength + 4;
if(isLastBlock)
if (isLastBlock)
break;
}

View File

@@ -37,14 +37,21 @@
namespace Strawberry_TagLib {
namespace TagLib {
class Tag;
namespace ID3v2 { class FrameFactory; class Tag; }
namespace ID3v1 { class Tag; }
namespace Ogg { class XiphComment; }
class Tag;
namespace ID3v2 {
class FrameFactory;
class Tag;
} // namespace ID3v2
namespace ID3v1 {
class Tag;
}
namespace Ogg {
class XiphComment;
}
//! An implementation of FLAC metadata
//! An implementation of FLAC metadata
/*!
/*!
* This is implementation of FLAC metadata for non-Ogg FLAC files. At some
* point when Ogg / FLAC is more common there will be a similar implementation
* under the Ogg hierarchy.
@@ -53,38 +60,37 @@ namespace TagLib {
* properties from the file.
*/
namespace FLAC {
namespace FLAC {
//! An implementation of TagLib::File with FLAC specific methods
//! An implementation of TagLib::File with FLAC specific methods
/*!
/*!
* This implements and provides an interface for FLAC files to the
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
* the abstract TagLib::File API as well as providing some additional
* information specific to FLAC files.
*/
class TAGLIB_EXPORT File : public Strawberry_TagLib::TagLib::File
{
public:
/*!
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.
*/
enum TagTypes {
//! Empty set. Matches no tag types.
NoTags = 0x0000,
//! Matches Vorbis comments.
XiphComment = 0x0001,
//! Matches ID3v1 tags.
ID3v1 = 0x0002,
//! Matches ID3v2 tags.
ID3v2 = 0x0004,
//! Matches all tag types.
AllTags = 0xffff
};
enum TagTypes {
//! Empty set. Matches no tag types.
NoTags = 0x0000,
//! Matches Vorbis comments.
XiphComment = 0x0001,
//! Matches ID3v1 tags.
ID3v1 = 0x0002,
//! Matches ID3v2 tags.
ID3v2 = 0x0004,
//! Matches all tag types.
AllTags = 0xffff
};
/*!
/*!
* Constructs a FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read.
*
@@ -93,10 +99,10 @@ namespace TagLib {
* \deprecated This constructor will be dropped in favor of the one below
* in a future version.
*/
File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
/*!
* Constructs an FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read.
*
@@ -105,12 +111,12 @@ namespace TagLib {
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
// BIC: merge with the above constructor
File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
// BIC: merge with the above constructor
File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
/*!
* Constructs a FLAC file from \a stream. If \a readProperties is true the
* file's audio properties will also be read.
*
@@ -122,17 +128,17 @@ 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);
// BIC: merge with the above constructor
File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
/*!
* Destroys this instance of the File.
*/
virtual ~File();
virtual ~File();
/*!
/*!
* Returns the Tag for this file. This will be a union of XiphComment,
* ID3v1 and ID3v2 tags.
*
@@ -140,43 +146,43 @@ namespace TagLib {
* \see ID3v1Tag()
* \see XiphComment()
*/
virtual Strawberry_TagLib::TagLib::Tag *tag() const;
virtual Strawberry_TagLib::TagLib::Tag *tag() const;
/*!
/*!
* Implements the unified property interface -- export function.
* If the file contains more than one tag (e.g. XiphComment and ID3v1),
* only the first one (in the order XiphComment, ID3v2, ID3v1) will be
* converted to the PropertyMap.
*/
PropertyMap properties() const;
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList &);
void removeUnsupportedProperties(const StringList &);
/*!
/*!
* Implements the unified property interface -- import function.
* This always creates a Xiph comment, if none exists. The return value
* relates to the Xiph comment only.
* Ignores any changes to ID3v1 or ID3v2 comments since they are not allowed
* in the FLAC specification.
*/
PropertyMap setProperties(const PropertyMap &);
PropertyMap setProperties(const PropertyMap &);
/*!
/*!
* Returns the FLAC::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
virtual Properties *audioProperties() const;
virtual Properties *audioProperties() const;
/*!
/*!
* Save the file. This will primarily save the XiphComment, but
* will also keep any old ID3-tags up to date. If the file
* has no XiphComment, one will be constructed from the ID3-tags.
*
* This returns true if the save was successful.
*/
virtual bool save();
virtual bool save();
/*!
/*!
* Returns a pointer to the ID3v2 tag of the file.
*
* If \a create is false (the default) this returns a null pointer
@@ -193,9 +199,9 @@ namespace TagLib {
*
* \see hasID3v2Tag()
*/
ID3v2::Tag *ID3v2Tag(bool create = false);
ID3v2::Tag *ID3v2Tag(bool create = false);
/*!
/*!
* Returns a pointer to the ID3v1 tag of the file.
*
* If \a create is false (the default) this returns a null pointer
@@ -212,9 +218,9 @@ namespace TagLib {
*
* \see hasID3v1Tag()
*/
ID3v1::Tag *ID3v1Tag(bool create = false);
ID3v1::Tag *ID3v1Tag(bool create = false);
/*!
/*!
* Returns a pointer to the XiphComment for the file.
*
* If \a create is false (the default) this returns a null pointer
@@ -231,9 +237,9 @@ namespace TagLib {
*
* \see hasXiphComment()
*/
Ogg::XiphComment *xiphComment(bool create = false);
Ogg::XiphComment *xiphComment(bool create = false);
/*!
/*!
* Set the ID3v2::FrameFactory to something other than the default. This
* can be used to specify the way that ID3v2 frames will be interpreted
* when
@@ -241,49 +247,49 @@ namespace TagLib {
* \see ID3v2FrameFactory
* \deprecated This value should be passed in via the constructor
*/
TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
/*!
/*!
* Returns the block of data used by FLAC::Properties for parsing the
* stream properties.
*
* \deprecated Always returns an empty vector.
*/
TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove
TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove
/*!
/*!
* Returns the length of the audio-stream, used by FLAC::Properties for
* calculating the bitrate.
*
* \deprecated Always returns zero.
*/
TAGLIB_DEPRECATED long streamLength(); // BIC: remove
TAGLIB_DEPRECATED long streamLength(); // BIC: remove
/*!
/*!
* Returns a list of pictures attached to the FLAC file.
*/
List<Picture *> pictureList();
List<Picture *> pictureList();
/*!
/*!
* Removes an attached picture. If \a del is true the picture's memory
* will be freed; if it is false, it must be deleted by the user.
*/
void removePicture(Picture *picture, bool del = true);
void removePicture(Picture *picture, bool del = true);
/*!
/*!
* Remove all attached images.
*/
void removePictures();
void removePictures();
/*!
/*!
* Add a new picture to the file. The file takes ownership of the
* picture and will handle freeing its memory.
*
* \note The file will be saved only after calling save().
*/
void addPicture(Picture *picture);
void addPicture(Picture *picture);
/*!
/*!
* This will remove the tags that match the OR-ed together TagTypes from
* the file. By default it removes all tags.
*
@@ -296,50 +302,50 @@ namespace TagLib {
* \note This won't remove the Vorbis comment block completely. The
* vendor ID will be preserved.
*/
void strip(int tags = AllTags);
void strip(int tags = AllTags);
/*!
/*!
* Returns whether or not the file on disk actually has a XiphComment.
*
* \see xiphComment()
*/
bool hasXiphComment() const;
bool hasXiphComment() const;
/*!
/*!
* Returns whether or not the file on disk actually has an ID3v1 tag.
*
* \see ID3v1Tag()
*/
bool hasID3v1Tag() const;
bool hasID3v1Tag() const;
/*!
/*!
* Returns whether or not the file on disk actually has an ID3v2 tag.
*
* \see ID3v2Tag()
*/
bool hasID3v2Tag() const;
bool hasID3v2Tag() const;
/*!
/*!
* Returns whether or not the given \a stream can be opened as a FLAC
* file.
*
* \note This method is designed to do a quick check. The result may
* not necessarily be correct.
*/
static bool isSupported(IOStream *stream);
static bool isSupported(IOStream *stream);
private:
File(const File &);
File &operator=(const File &);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
void scan();
void read(bool readProperties);
void scan();
class FilePrivate;
FilePrivate *d;
};
}
}
}
class FilePrivate;
FilePrivate *d;
};
} // namespace FLAC
} // namespace TagLib
} // namespace Strawberry_TagLib
#endif

View File

@@ -29,19 +29,14 @@
using namespace Strawberry_TagLib::TagLib;
class FLAC::MetadataBlock::MetadataBlockPrivate
{
public:
class FLAC::MetadataBlock::MetadataBlockPrivate {
public:
MetadataBlockPrivate() {}
};
FLAC::MetadataBlock::MetadataBlock()
{
FLAC::MetadataBlock::MetadataBlock() {
d = 0;
}
FLAC::MetadataBlock::~MetadataBlock()
{
FLAC::MetadataBlock::~MetadataBlock() {
}

View File

@@ -33,45 +33,44 @@
namespace Strawberry_TagLib {
namespace TagLib {
namespace FLAC {
namespace FLAC {
class TAGLIB_EXPORT MetadataBlock
{
public:
MetadataBlock();
virtual ~MetadataBlock();
class TAGLIB_EXPORT MetadataBlock {
public:
MetadataBlock();
virtual ~MetadataBlock();
enum BlockType {
StreamInfo = 0,
Padding,
Application,
SeekTable,
VorbisComment,
CueSheet,
Picture
};
enum BlockType {
StreamInfo = 0,
Padding,
Application,
SeekTable,
VorbisComment,
CueSheet,
Picture
};
/*!
/*!
* Returns the FLAC metadata block type.
*/
virtual int code() const = 0;
virtual int code() const = 0;
/*!
/*!
* Render the content of the block.
*/
virtual ByteVector render() const = 0;
virtual ByteVector render() const = 0;
private:
MetadataBlock(const MetadataBlock &item);
MetadataBlock &operator=(const MetadataBlock &item);
private:
MetadataBlock(const MetadataBlock &item);
MetadataBlock &operator=(const MetadataBlock &item);
class MetadataBlockPrivate;
MetadataBlockPrivate *d;
};
class MetadataBlockPrivate;
MetadataBlockPrivate *d;
};
}
} // namespace FLAC
}
}
} // namespace TagLib
} // namespace Strawberry_TagLib
#endif

View File

@@ -29,16 +29,14 @@
using namespace Strawberry_TagLib::TagLib;
class FLAC::Picture::PicturePrivate
{
public:
PicturePrivate() :
type(FLAC::Picture::Other),
width(0),
height(0),
colorDepth(0),
numColors(0)
{}
class FLAC::Picture::PicturePrivate {
public:
PicturePrivate() : type(FLAC::Picture::Other),
width(0),
height(0),
colorDepth(0),
numColors(0) {
}
Type type;
String mimeType;
@@ -50,30 +48,23 @@ public:
ByteVector data;
};
FLAC::Picture::Picture() :
d(new PicturePrivate())
{
FLAC::Picture::Picture() : d(new PicturePrivate()) {
}
FLAC::Picture::Picture(const ByteVector &data) :
d(new PicturePrivate())
{
FLAC::Picture::Picture(const ByteVector &data) : d(new PicturePrivate()) {
parse(data);
}
FLAC::Picture::~Picture()
{
FLAC::Picture::~Picture() {
delete d;
}
int FLAC::Picture::code() const
{
int FLAC::Picture::code() const {
return FLAC::MetadataBlock::Picture;
}
bool FLAC::Picture::parse(const ByteVector &data)
{
if(data.size() < 32) {
bool FLAC::Picture::parse(const ByteVector &data) {
if (data.size() < 32) {
debug("A picture block must contain at least 5 bytes.");
return false;
}
@@ -83,7 +74,7 @@ bool FLAC::Picture::parse(const ByteVector &data)
pos += 4;
unsigned int mimeTypeLength = data.toUInt(pos);
pos += 4;
if(pos + mimeTypeLength + 24 > data.size()) {
if (pos + mimeTypeLength + 24 > data.size()) {
debug("Invalid picture block.");
return false;
}
@@ -91,7 +82,7 @@ bool FLAC::Picture::parse(const ByteVector &data)
pos += mimeTypeLength;
unsigned int descriptionLength = data.toUInt(pos);
pos += 4;
if(pos + descriptionLength + 20 > data.size()) {
if (pos + descriptionLength + 20 > data.size()) {
debug("Invalid picture block.");
return false;
}
@@ -107,7 +98,7 @@ bool FLAC::Picture::parse(const ByteVector &data)
pos += 4;
unsigned int dataLength = data.toUInt(pos);
pos += 4;
if(pos + dataLength > data.size()) {
if (pos + dataLength > data.size()) {
debug("Invalid picture block.");
return false;
}
@@ -116,8 +107,7 @@ bool FLAC::Picture::parse(const ByteVector &data)
return true;
}
ByteVector FLAC::Picture::render() const
{
ByteVector FLAC::Picture::render() const {
ByteVector result;
result.append(ByteVector::fromUInt(d->type));
ByteVector mimeTypeData = d->mimeType.data(String::UTF8);
@@ -135,83 +125,66 @@ ByteVector FLAC::Picture::render() const
return result;
}
FLAC::Picture::Type FLAC::Picture::type() const
{
FLAC::Picture::Type FLAC::Picture::type() const {
return d->type;
}
void FLAC::Picture::setType(FLAC::Picture::Type type)
{
void FLAC::Picture::setType(FLAC::Picture::Type type) {
d->type = type;
}
String FLAC::Picture::mimeType() const
{
String FLAC::Picture::mimeType() const {
return d->mimeType;
}
void FLAC::Picture::setMimeType(const String &mimeType)
{
void FLAC::Picture::setMimeType(const String &mimeType) {
d->mimeType = mimeType;
}
String FLAC::Picture::description() const
{
String FLAC::Picture::description() const {
return d->description;
}
void FLAC::Picture::setDescription(const String &description)
{
void FLAC::Picture::setDescription(const String &description) {
d->description = description;
}
int FLAC::Picture::width() const
{
int FLAC::Picture::width() const {
return d->width;
}
void FLAC::Picture::setWidth(int width)
{
void FLAC::Picture::setWidth(int width) {
d->width = width;
}
int FLAC::Picture::height() const
{
int FLAC::Picture::height() const {
return d->height;
}
void FLAC::Picture::setHeight(int height)
{
void FLAC::Picture::setHeight(int height) {
d->height = height;
}
int FLAC::Picture::colorDepth() const
{
int FLAC::Picture::colorDepth() const {
return d->colorDepth;
}
void FLAC::Picture::setColorDepth(int colorDepth)
{
void FLAC::Picture::setColorDepth(int colorDepth) {
d->colorDepth = colorDepth;
}
int FLAC::Picture::numColors() const
{
int FLAC::Picture::numColors() const {
return d->numColors;
}
void FLAC::Picture::setNumColors(int numColors)
{
void FLAC::Picture::setNumColors(int numColors) {
d->numColors = numColors;
}
ByteVector FLAC::Picture::data() const
{
ByteVector FLAC::Picture::data() const {
return d->data;
}
void FLAC::Picture::setData(const ByteVector &data)
{
void FLAC::Picture::setData(const ByteVector &data) {
d->data = data;
}

View File

@@ -35,176 +35,174 @@
namespace Strawberry_TagLib {
namespace TagLib {
namespace FLAC {
namespace FLAC {
class TAGLIB_EXPORT Picture : public MetadataBlock
{
public:
/*!
class TAGLIB_EXPORT Picture : public MetadataBlock {
public:
/*!
* This describes the function or content of the picture.
*/
enum Type {
//! A type not enumerated below
Other = 0x00,
//! 32x32 PNG image that should be used as the file icon
FileIcon = 0x01,
//! File icon of a different size or format
OtherFileIcon = 0x02,
//! Front cover image of the album
FrontCover = 0x03,
//! Back cover image of the album
BackCover = 0x04,
//! Inside leaflet page of the album
LeafletPage = 0x05,
//! Image from the album itself
Media = 0x06,
//! Picture of the lead artist or soloist
LeadArtist = 0x07,
//! Picture of the artist or performer
Artist = 0x08,
//! Picture of the conductor
Conductor = 0x09,
//! Picture of the band or orchestra
Band = 0x0A,
//! Picture of the composer
Composer = 0x0B,
//! Picture of the lyricist or text writer
Lyricist = 0x0C,
//! Picture of the recording location or studio
RecordingLocation = 0x0D,
//! Picture of the artists during recording
DuringRecording = 0x0E,
//! Picture of the artists during performance
DuringPerformance = 0x0F,
//! Picture from a movie or video related to the track
MovieScreenCapture = 0x10,
//! Picture of a large, coloured fish
ColouredFish = 0x11,
//! Illustration related to the track
Illustration = 0x12,
//! Logo of the band or performer
BandLogo = 0x13,
//! Logo of the publisher (record company)
PublisherLogo = 0x14
};
enum Type {
//! A type not enumerated below
Other = 0x00,
//! 32x32 PNG image that should be used as the file icon
FileIcon = 0x01,
//! File icon of a different size or format
OtherFileIcon = 0x02,
//! Front cover image of the album
FrontCover = 0x03,
//! Back cover image of the album
BackCover = 0x04,
//! Inside leaflet page of the album
LeafletPage = 0x05,
//! Image from the album itself
Media = 0x06,
//! Picture of the lead artist or soloist
LeadArtist = 0x07,
//! Picture of the artist or performer
Artist = 0x08,
//! Picture of the conductor
Conductor = 0x09,
//! Picture of the band or orchestra
Band = 0x0A,
//! Picture of the composer
Composer = 0x0B,
//! Picture of the lyricist or text writer
Lyricist = 0x0C,
//! Picture of the recording location or studio
RecordingLocation = 0x0D,
//! Picture of the artists during recording
DuringRecording = 0x0E,
//! Picture of the artists during performance
DuringPerformance = 0x0F,
//! Picture from a movie or video related to the track
MovieScreenCapture = 0x10,
//! Picture of a large, coloured fish
ColouredFish = 0x11,
//! Illustration related to the track
Illustration = 0x12,
//! Logo of the band or performer
BandLogo = 0x13,
//! Logo of the publisher (record company)
PublisherLogo = 0x14
};
Picture();
Picture(const ByteVector &data);
~Picture();
Picture();
Picture(const ByteVector &data);
~Picture();
/*!
/*!
* Returns the type of the image.
*/
Type type() const;
Type type() const;
/*!
/*!
* Sets the type of the image.
*/
void setType(Type type);
void setType(Type type);
/*!
/*!
* Returns the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
*/
String mimeType() const;
String mimeType() const;
/*!
/*!
* Sets the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
*/
void setMimeType(const String &m);
void setMimeType(const String &m);
/*!
/*!
* Returns a text description of the image.
*/
String description() const;
String description() const;
/*!
/*!
* Sets a textual description of the image to \a desc.
*/
void setDescription(const String &desc);
void setDescription(const String &desc);
/*!
/*!
* Returns the width of the image.
*/
int width() const;
int width() const;
/*!
/*!
* Sets the width of the image.
*/
void setWidth(int w);
void setWidth(int w);
/*!
/*!
* Returns the height of the image.
*/
int height() const;
int height() const;
/*!
/*!
* Sets the height of the image.
*/
void setHeight(int h);
void setHeight(int h);
/*!
/*!
* Returns the color depth (in bits-per-pixel) of the image.
*/
int colorDepth() const;
int colorDepth() const;
/*!
/*!
* Sets the color depth (in bits-per-pixel) of the image.
*/
void setColorDepth(int depth);
void setColorDepth(int depth);
/*!
/*!
* Returns the number of colors used on the image..
*/
int numColors() const;
int numColors() const;
/*!
/*!
* Sets the number of colors used on the image (for indexed images).
*/
void setNumColors(int numColors);
void setNumColors(int numColors);
/*!
/*!
* Returns the image data.
*/
ByteVector data() const;
ByteVector data() const;
/*!
/*!
* Sets the image data.
*/
void setData(const ByteVector &data);
void setData(const ByteVector &data);
/*!
/*!
* Returns the FLAC metadata block type.
*/
int code() const;
int code() const;
/*!
/*!
* Render the content to the FLAC picture block format.
*/
ByteVector render() const;
ByteVector render() const;
/*!
/*!
* Parse the picture data in the FLAC picture block format.
*/
bool parse(const ByteVector &rawData);
bool parse(const ByteVector &rawData);
private:
Picture(const Picture &item);
Picture &operator=(const Picture &item);
private:
Picture(const Picture &item);
Picture &operator=(const Picture &item);
class PicturePrivate;
PicturePrivate *d;
};
class PicturePrivate;
PicturePrivate *d;
};
typedef List<Picture> PictureList;
typedef List<Picture> PictureList;
}
} // namespace FLAC
}
}
} // namespace TagLib
} // namespace Strawberry_TagLib
#endif

View File

@@ -31,16 +31,14 @@
using namespace Strawberry_TagLib::TagLib;
class FLAC::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
length(0),
bitrate(0),
sampleRate(0),
bitsPerSample(0),
channels(0),
sampleFrames(0) {}
class FLAC::Properties::PropertiesPrivate {
public:
PropertiesPrivate() : length(0),
bitrate(0),
sampleRate(0),
bitsPerSample(0),
channels(0),
sampleFrames(0) {}
int length;
int bitrate;
@@ -55,72 +53,57 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) : AudioProperties(style),
d(new PropertiesPrivate()) {
read(data, streamLength);
}
FLAC::Properties::Properties(File *, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
FLAC::Properties::Properties(File *, ReadStyle style) : AudioProperties(style),
d(new PropertiesPrivate()) {
debug("FLAC::Properties::Properties() - This constructor is no longer used.");
}
FLAC::Properties::~Properties()
{
FLAC::Properties::~Properties() {
delete d;
}
int FLAC::Properties::length() const
{
int FLAC::Properties::length() const {
return lengthInSeconds();
}
int FLAC::Properties::lengthInSeconds() const
{
int FLAC::Properties::lengthInSeconds() const {
return d->length / 1000;
}
int FLAC::Properties::lengthInMilliseconds() const
{
int FLAC::Properties::lengthInMilliseconds() const {
return d->length;
}
int FLAC::Properties::bitrate() const
{
int FLAC::Properties::bitrate() const {
return d->bitrate;
}
int FLAC::Properties::sampleRate() const
{
int FLAC::Properties::sampleRate() const {
return d->sampleRate;
}
int FLAC::Properties::bitsPerSample() const
{
int FLAC::Properties::bitsPerSample() const {
return d->bitsPerSample;
}
int FLAC::Properties::sampleWidth() const
{
int FLAC::Properties::sampleWidth() const {
return bitsPerSample();
}
int FLAC::Properties::channels() const
{
int FLAC::Properties::channels() const {
return d->channels;
}
unsigned long long FLAC::Properties::sampleFrames() const
{
unsigned long long FLAC::Properties::sampleFrames() const {
return d->sampleFrames;
}
ByteVector FLAC::Properties::signature() const
{
ByteVector FLAC::Properties::signature() const {
return d->signature;
}
@@ -128,9 +111,8 @@ ByteVector FLAC::Properties::signature() const
// private members
////////////////////////////////////////////////////////////////////////////////
void FLAC::Properties::read(const ByteVector &data, long streamLength)
{
if(data.size() < 18) {
void FLAC::Properties::read(const ByteVector &data, long streamLength) {
if (data.size() < 18) {
debug("FLAC::Properties::read() - FLAC properties must contain at least 18 bytes.");
return;
}
@@ -152,8 +134,8 @@ void FLAC::Properties::read(const ByteVector &data, long streamLength)
const unsigned int flags = data.toUInt(pos, true);
pos += 4;
d->sampleRate = flags >> 12;
d->channels = ((flags >> 9) & 7) + 1;
d->sampleRate = flags >> 12;
d->channels = ((flags >> 9) & 7) + 1;
d->bitsPerSample = ((flags >> 4) & 31) + 1;
// The last 4 bits are the most significant 4 bits for the 36 bit
@@ -165,12 +147,12 @@ void FLAC::Properties::read(const ByteVector &data, long streamLength)
d->sampleFrames = (hi << 32) | lo;
if(d->sampleFrames > 0 && d->sampleRate > 0) {
if (d->sampleFrames > 0 && d->sampleRate > 0) {
const double length = d->sampleFrames * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}
if(data.size() >= pos + 16)
if (data.size() >= pos + 16)
d->signature = data.mid(pos, 16);
}

View File

@@ -32,40 +32,39 @@
namespace Strawberry_TagLib {
namespace TagLib {
namespace FLAC {
namespace FLAC {
class File;
class File;
//! An implementation of audio property reading for FLAC
//! An implementation of audio property reading for FLAC
/*!
/*!
* This reads the data from an FLAC stream found in the AudioProperties
* API.
*/
class TAGLIB_EXPORT Properties : public AudioProperties
{
public:
/*!
class TAGLIB_EXPORT Properties : public AudioProperties {
public:
/*!
* Create an instance of FLAC::Properties with the data read from the
* ByteVector \a data.
*/
// BIC: switch to const reference
Properties(ByteVector data, long streamLength, ReadStyle style = Average);
// BIC: switch to const reference
Properties(ByteVector data, long 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);
// BIC: remove
Properties(File *file, ReadStyle style = Average);
/*!
/*!
* Destroys this FLAC::Properties instance.
*/
virtual ~Properties();
virtual ~Properties();
/*!
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
@@ -73,47 +72,47 @@ namespace TagLib {
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
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()
*/
// BIC: make virtual
int lengthInSeconds() const;
// BIC: make virtual
int lengthInSeconds() const;
/*!
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
virtual int bitrate() const;
/*!
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
virtual int sampleRate() const;
/*!
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
virtual int channels() const;
/*!
/*!
* Returns the number of bits per audio sample as read from the FLAC
* identification header.
*/
int bitsPerSample() const;
int bitsPerSample() const;
/*!
/*!
* Returns the sample width as read from the FLAC identification
* header.
*
@@ -121,30 +120,30 @@ namespace TagLib {
*
* \deprecated
*/
TAGLIB_DEPRECATED int sampleWidth() const;
TAGLIB_DEPRECATED int sampleWidth() const;
/*!
/*!
* Return the number of sample frames.
*/
unsigned long long sampleFrames() const;
unsigned long long sampleFrames() const;
/*!
/*!
* Returns the MD5 signature of the uncompressed audio stream as read
* from the stream info header.
*/
ByteVector signature() const;
ByteVector signature() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
void read(const ByteVector &data, long streamLength);
void read(const ByteVector &data, long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
}
class PropertiesPrivate;
PropertiesPrivate *d;
};
} // namespace FLAC
} // namespace TagLib
} // namespace Strawberry_TagLib
#endif

View File

@@ -30,49 +30,39 @@
using namespace Strawberry_TagLib::TagLib;
class FLAC::UnknownMetadataBlock::UnknownMetadataBlockPrivate
{
public:
class FLAC::UnknownMetadataBlock::UnknownMetadataBlockPrivate {
public:
UnknownMetadataBlockPrivate() : code(0) {}
int code;
ByteVector data;
};
FLAC::UnknownMetadataBlock::UnknownMetadataBlock(int code, const ByteVector &data) :
d(new UnknownMetadataBlockPrivate())
{
FLAC::UnknownMetadataBlock::UnknownMetadataBlock(int code, const ByteVector &data) : d(new UnknownMetadataBlockPrivate()) {
d->code = code;
d->data = data;
}
FLAC::UnknownMetadataBlock::~UnknownMetadataBlock()
{
FLAC::UnknownMetadataBlock::~UnknownMetadataBlock() {
delete d;
}
int FLAC::UnknownMetadataBlock::code() const
{
int FLAC::UnknownMetadataBlock::code() const {
return d->code;
}
void FLAC::UnknownMetadataBlock::setCode(int code)
{
void FLAC::UnknownMetadataBlock::setCode(int code) {
d->code = code;
}
ByteVector FLAC::UnknownMetadataBlock::data() const
{
ByteVector FLAC::UnknownMetadataBlock::data() const {
return d->data;
}
void FLAC::UnknownMetadataBlock::setData(const ByteVector &data)
{
void FLAC::UnknownMetadataBlock::setData(const ByteVector &data) {
d->data = data;
}
ByteVector FLAC::UnknownMetadataBlock::render() const
{
ByteVector FLAC::UnknownMetadataBlock::render() const {
return d->data;
}

View File

@@ -34,50 +34,49 @@
namespace Strawberry_TagLib {
namespace TagLib {
namespace FLAC {
namespace FLAC {
class TAGLIB_EXPORT UnknownMetadataBlock : public MetadataBlock
{
public:
UnknownMetadataBlock(int blockType, const ByteVector &data);
~UnknownMetadataBlock();
class TAGLIB_EXPORT UnknownMetadataBlock : public MetadataBlock {
public:
UnknownMetadataBlock(int blockType, const ByteVector &data);
~UnknownMetadataBlock();
/*!
/*!
* Returns the FLAC metadata block type.
*/
int code() const;
int code() const;
/*!
/*!
* Sets the FLAC metadata block type.
*/
void setCode(int code);
void setCode(int code);
/*!
/*!
* Returns the FLAC metadata block type.
*/
ByteVector data() const;
ByteVector data() const;
/*!
/*!
* Sets the FLAC metadata block type.
*/
void setData(const ByteVector &data);
void setData(const ByteVector &data);
/*!
/*!
* Render the content of the block.
*/
ByteVector render() const;
ByteVector render() const;
private:
UnknownMetadataBlock(const MetadataBlock &item);
UnknownMetadataBlock &operator=(const MetadataBlock &item);
private:
UnknownMetadataBlock(const MetadataBlock &item);
UnknownMetadataBlock &operator=(const MetadataBlock &item);
class UnknownMetadataBlockPrivate;
UnknownMetadataBlockPrivate *d;
};
class UnknownMetadataBlockPrivate;
UnknownMetadataBlockPrivate *d;
};
}
} // namespace FLAC
}
}
} // namespace TagLib
} // namespace Strawberry_TagLib
#endif