From kde-commits Sun Nov 28 12:54:53 2010 From: =?utf-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sun, 28 Nov 2010 12:54:53 +0000 To: kde-commits Subject: kdesupport/taglib Message-Id: <20101128125453.4A775AC8A3 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129094894208120 SVN commit 1201717 by lalinsky: Work-in-progress support for writing FLAC picture This will enable the possibility to add support for accessing the Seektable and Cuesheet blocks, but I'm not planning on implementing that right now. CCBUG:218696 M +3 -0 taglib/CMakeLists.txt M +1 -0 taglib/flac/flacfile.cpp A taglib/flac/flacmetadatablock.cpp [License: LGPL (v2.1) (wrong address)] A taglib/flac/flacmetadatablock.h [License: LGPL (v2.1) (wrong address)] A taglib/flac/flacmetadatablocks.cpp [License: LGPL (v2.1) (wrong address)] A taglib/flac/flacmetadatablocks.h [License: LGPL (v2.1) (wrong address)] M +24 -0 taglib/flac/flacpicture.cpp M +12 -1 taglib/flac/flacpicture.h A taglib/flac/flacunknownmetadatablock.cpp [License: LGPL (v2.1) (wrong address)] A taglib/flac/flacunknownmetadatablock.h [License: LGPL (v2.1) (wrong address)] U taglib/toolkit/tbytevector.h M +3 -0 tests/CMakeLists.txt A tests/test_flacmetadatablocks.cpp [License: UNKNOWN] A tests/test_flacpicture.cpp [License: UNKNOWN] A tests/test_flacunknownmetadatablock.cpp [License: UNKNOWN] --- trunk/kdesupport/taglib/taglib/CMakeLists.txt #1201716:1201717 @@ -95,6 +95,9 @@ flac/flacfile.cpp flac/flacpicture.cpp flac/flacproperties.cpp +flac/flacmetadatablock.cpp +flac/flacmetadatablocks.cpp +flac/flacunknownmetadatablock.cpp ) SET(oggflacs_SRCS --- trunk/kdesupport/taglib/taglib/flac/flacfile.cpp #1201716:1201717 @@ -36,6 +36,7 @@ #include "flacpicture.h" #include "flacfile.h" +#include "flacmetadatablock.h" using namespace TagLib; --- trunk/kdesupport/taglib/taglib/flac/flacpicture.cpp #1201716:1201717 @@ -70,6 +70,11 @@ delete d; } +int FLAC::Picture::code() const +{ + return FLAC::MetadataBlock::Picture; +} + bool FLAC::Picture::parse(const ByteVector &data) { if(data.size() < 32) { @@ -115,6 +120,25 @@ return true; } +ByteVector FLAC::Picture::render() const +{ + ByteVector result; + result.append(ByteVector::fromUInt(d->type)); + ByteVector mimeTypeData = d->mimeType.data(String::UTF8); + result.append(ByteVector::fromUInt(mimeTypeData.size())); + result.append(mimeTypeData); + ByteVector descriptionData = d->description.data(String::UTF8); + result.append(ByteVector::fromUInt(descriptionData.size())); + result.append(descriptionData); + result.append(ByteVector::fromUInt(d->width)); + result.append(ByteVector::fromUInt(d->height)); + result.append(ByteVector::fromUInt(d->colorDepth)); + result.append(ByteVector::fromUInt(d->numColors)); + result.append(ByteVector::fromUInt(d->data.size())); + result.append(d->data); + return result; +} + FLAC::Picture::Type FLAC::Picture::type() const { return d->type; --- trunk/kdesupport/taglib/taglib/flac/flacpicture.h #1201716:1201717 @@ -30,12 +30,13 @@ #include "tbytevector.h" #include "taglib_export.h" #include "attachedpictureframe.h" +#include "flacmetadatablock.h" namespace TagLib { namespace FLAC { - class TAGLIB_EXPORT Picture + class TAGLIB_EXPORT Picture : public MetadataBlock { public: typedef ID3v2::AttachedPictureFrame::Type Type; @@ -128,6 +129,16 @@ */ void setData(const ByteVector &data); + /*! + * Returns the FLAC metadata block type. + */ + int code() const; + + /*! + * Render the content of the block. + */ + ByteVector render() const; + bool parse(const ByteVector &rawData); private: --- trunk/kdesupport/taglib/tests/CMakeLists.txt #1201716:1201717 @@ -40,6 +40,9 @@ test_ogg.cpp test_oggflac.cpp test_flac.cpp + test_flacpicture.cpp + test_flacmetadatablocks.cpp + test_flacunknownmetadatablock.cpp test_ape.cpp test_apetag.cpp test_wav.cpp