diff --git a/amarok-asf.patch b/amarok-asf.patch new file mode 100644 index 0000000..ffca2b9 --- /dev/null +++ b/amarok-asf.patch @@ -0,0 +1,3533 @@ + +Property changes on: amarok/src/metadata/asf +___________________________________________________________________ +Name: svn:ignore + + .libs +.deps +Makefile +Makefile.in + + +Index: amarok/src/metadata/asf/asffile.h +=================================================================== +--- amarok/src/metadata/asf/asffile.h (revision 0) ++++ amarok/src/metadata/asf/asffile.h (revision 743005) +@@ -0,0 +1,114 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#ifndef TAGLIB_ASFFILE_H ++#define TAGLIB_ASFFILE_H ++ ++#include ++#include ++#include "asfproperties.h" ++#include "asftag.h" ++ ++namespace TagLib { ++ ++ //! An implementation of ASF (WMA) metadata ++ namespace ASF { ++ ++ /*! ++ * This implements and provides an interface for ASF 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 ASF files. ++ */ ++ class File : public TagLib::File ++ { ++ public: ++ ++ /*! ++ * Contructs an ASF file from \a file. If \a readProperties is true the ++ * file's audio properties will also be read using \a propertiesStyle. If ++ * false, \a propertiesStyle is ignored. ++ * ++ * \note In the current implementation, both \a readProperties and ++ * \a propertiesStyle are ignored. ++ */ ++ File(const char *file, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); ++ ++ /*! ++ * Destroys this instance of the File. ++ */ ++ virtual ~File(); ++ ++ /*! ++ * Returns a pointer to the ASF tag of the file. ++ * ++ * ASF::Tag implements the tag interface, so this serves as the ++ * reimplementation of TagLib::File::tag(). ++ * ++ * \note The Tag is still owned by the ASF::File and should not be ++ * deleted by the user. It will be deleted when the file (object) is ++ * destroyed. ++ */ ++ virtual Tag *tag() const; ++ ++ /*! ++ * Returns the ASF audio properties for this file. ++ */ ++ virtual Properties *audioProperties() const; ++ ++ /*! ++ * Save the file. ++ * ++ * This returns true if the save was successful. ++ */ ++ virtual bool save(); ++ ++ private: ++ ++ int readBYTE(); ++ int readWORD(); ++ unsigned int readDWORD(); ++ long long readQWORD(); ++ static ByteVector renderString(const String &str, bool includeLength = false); ++ String readString(int len); ++ void read(bool readProperties, Properties::ReadStyle propertiesStyle); ++ ++ friend class Attribute; ++ ++ class BaseObject; ++ class UnknownObject; ++ class FilePropertiesObject; ++ class StreamPropertiesObject; ++ class ContentDescriptionObject; ++ class ExtendedContentDescriptionObject; ++ class HeaderExtensionObject; ++ class MetadataObject; ++ class MetadataLibraryObject; ++ ++ class FilePrivate; ++ FilePrivate *d; ++ }; ++ ++ } ++ ++} ++ ++#endif + +Property changes on: amarok/src/metadata/asf/asffile.h +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/asf/taglib_asffiletyperesolver.cpp +=================================================================== +--- amarok/src/metadata/asf/taglib_asffiletyperesolver.cpp (revision 0) ++++ amarok/src/metadata/asf/taglib_asffiletyperesolver.cpp (revision 743005) +@@ -0,0 +1,47 @@ ++/*************************************************************************** ++ copyright : (C) 2005 by Martin Aumueller ++ email : aumuell@reserv.at ++ ***************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * ++ * MA 02110-1301 USA * ++ ***************************************************************************/ ++ ++// (c) 2005 Martin Aumueller ++// See COPYING file for licensing information ++ ++#include "taglib_asffiletyperesolver.h" ++#include "asffile.h" ++ ++#include ++ ++TagLib::File *ASFFileTypeResolver::createFile(const char *fileName, ++ bool readProperties, ++ TagLib::AudioProperties::ReadStyle propertiesStyle) const ++{ ++ const char *ext = strrchr(fileName, '.'); ++ if(ext && (!strcasecmp(ext, ".wma") || !strcasecmp(ext, ".asf"))) ++ { ++ TagLib::ASF::File *f = new TagLib::ASF::File(fileName, readProperties, propertiesStyle); ++ if(f->isValid()) ++ return f; ++ else ++ { ++ delete f; ++ } ++ } ++ ++ return 0; ++} +Index: amarok/src/metadata/asf/asfattribute.h +=================================================================== +--- amarok/src/metadata/asf/asfattribute.h (revision 0) ++++ amarok/src/metadata/asf/asfattribute.h (revision 743005) +@@ -0,0 +1,176 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#ifndef TAGLIB_ASFATTRIBUTE_H ++#define TAGLIB_ASFATTRIBUTE_H ++ ++#include ++#include ++ ++namespace TagLib ++{ ++ ++ namespace ASF ++ { ++ ++ class File; ++ ++ class Attribute ++ { ++ public: ++ ++ /*! ++ * Enum of types an Attribute can have. ++ */ ++ enum AttributeTypes { ++ UnicodeType = 0, ++ BytesType = 1, ++ BoolType = 2, ++ DWordType = 3, ++ QWordType = 4, ++ WordType = 5, ++ GuidType = 6 ++ }; ++ ++ /*! ++ * Constructs an empty attribute. ++ */ ++ Attribute(); ++ ++ /*! ++ * Constructs an attribute with \a key and a UnicodeType \a value. ++ */ ++ Attribute(const String &value); ++ ++ /*! ++ * Constructs an attribute with \a key and a BytesType \a value. ++ */ ++ Attribute(const ByteVector &value); ++ ++ /*! ++ * Constructs an attribute with \a key and a DWordType \a value. ++ */ ++ Attribute(unsigned int value); ++ ++ /*! ++ * Constructs an attribute with \a key and a QWordType \a value. ++ */ ++ Attribute(unsigned long long value); ++ ++ /*! ++ * Constructs an attribute with \a key and a WordType \a value. ++ */ ++ Attribute(unsigned short value); ++ ++ /*! ++ * Constructs an attribute with \a key and a BoolType \a value. ++ */ ++ Attribute(bool value); ++ ++ /*! ++ * Construct an attribute as a copy of \a other. ++ */ ++ Attribute(const Attribute &item); ++ ++ /*! ++ * Copies the contents of \a other into this item. ++ */ ++ ASF::Attribute &operator=(const Attribute &other); ++ ++ /*! ++ * Destroys the attribute. ++ */ ++ virtual ~Attribute(); ++ ++ /*! ++ * Returns type of the value. ++ */ ++ AttributeTypes type() const; ++ ++ /*! ++ * Returns the BoolType \a value. ++ */ ++ unsigned short toBool() const; ++ ++ /*! ++ * Returns the WordType \a value. ++ */ ++ unsigned short toUShort() const; ++ ++ /*! ++ * Returns the DWordType \a value. ++ */ ++ unsigned int toUInt() const; ++ ++ /*! ++ * Returns the QWordType \a value. ++ */ ++ unsigned long long toULongLong() const; ++ ++ /*! ++ * Returns the UnicodeType \a value. ++ */ ++ String toString() const; ++ ++ /*! ++ * Returns the BytesType \a value. ++ */ ++ ByteVector toByteVector() const; ++ ++ /*! ++ * Returns the language number, or 0 is no stream number was set. ++ */ ++ int language() const; ++ ++ /*! ++ * Sets the language number. ++ */ ++ void setLanguage(int value); ++ ++ /*! ++ * Returns the stream number, or 0 is no stream number was set. ++ */ ++ int stream() const; ++ ++ /*! ++ * Sets the stream number. ++ */ ++ void setStream(int value); ++ ++#ifndef DO_NOT_DOCUMENT ++ /* THIS IS PRIVATE, DON'T TOUCH IT! */ ++ String parse(ASF::File &file, int kind = 0); ++#endif ++ ++ private: ++ friend class File; ++ ++ ByteVector render(const String &name, int kind = 0) const; ++ ++ class AttributePrivate; ++ AttributePrivate *d; ++ }; ++ ++ } ++ ++} ++ ++#endif + +Property changes on: amarok/src/metadata/asf/asfattribute.h +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/asf/taglib_asffiletyperesolver.h +=================================================================== +--- amarok/src/metadata/asf/taglib_asffiletyperesolver.h (revision 0) ++++ amarok/src/metadata/asf/taglib_asffiletyperesolver.h (revision 743005) +@@ -0,0 +1,39 @@ ++/*************************************************************************** ++ copyright : (C) 2005 by Martin Aumueller ++ email : aumuell@reserv.at ++ ***************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * ++ * MA 02110-1301 USA * ++ ***************************************************************************/ ++ ++// (c) 2005 Martin Aumueller ++// See COPYING file for licensing information ++ ++#ifndef TAGLIB_ASFFILETYPERESOLVER_H ++#define TAGLIB_ASFFILETYPERESOLVER_H ++ ++#include ++#include ++ ++ ++class ASFFileTypeResolver : public TagLib::FileRef::FileTypeResolver ++{ ++ TagLib::File *createFile(const char *fileName, ++ bool readAudioProperties, ++ TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const; ++}; ++ ++#endif +Index: amarok/src/metadata/asf/asftag.cpp +=================================================================== +--- amarok/src/metadata/asf/asftag.cpp (revision 0) ++++ amarok/src/metadata/asf/asftag.cpp (revision 743005) +@@ -0,0 +1,202 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#include "asftag.h" ++ ++using namespace TagLib; ++ ++class ASF::Tag::TagPrivate ++{ ++public: ++ String title; ++ String artist; ++ String copyright; ++ String comment; ++ String rating; ++ AttributeListMap attributeListMap; ++}; ++ ++ASF::Tag::Tag() ++: TagLib::Tag() ++{ ++ d = new TagPrivate; ++} ++ ++ASF::Tag::~Tag() ++{ ++ if(d) ++ delete d; ++} ++ ++String ++ASF::Tag::title() const ++{ ++ return d->title; ++} ++ ++String ++ASF::Tag::artist() const ++{ ++ return d->artist; ++} ++ ++String ++ASF::Tag::album() const ++{ ++ if(d->attributeListMap.contains("WM/AlbumTitle")) ++ return d->attributeListMap["WM/AlbumTitle"][0].toString(); ++ return String::null; ++} ++ ++String ++ASF::Tag::copyright() const ++{ ++ return d->copyright; ++} ++ ++String ++ASF::Tag::comment() const ++{ ++ return d->comment; ++} ++ ++String ++ASF::Tag::rating() const ++{ ++ return d->rating; ++} ++ ++unsigned int ++ASF::Tag::year() const ++{ ++ if(d->attributeListMap.contains("WM/Year")) ++ return d->attributeListMap["WM/Year"][0].toString().toInt(); ++ return 0; ++} ++ ++unsigned int ++ASF::Tag::track() const ++{ ++ if(d->attributeListMap.contains("WM/TrackNumber")) ++ return d->attributeListMap["WM/TrackNumber"][0].toString().toInt(); ++ if(d->attributeListMap.contains("WM/Track")) ++ return d->attributeListMap["WM/Track"][0].toUInt(); ++ return 0; ++} ++ ++String ++ASF::Tag::genre() const ++{ ++ if(d->attributeListMap.contains("WM/Genre")) ++ return d->attributeListMap["WM/Genre"][0].toString(); ++ return String::null; ++} ++ ++void ++ASF::Tag::setTitle(const String &value) ++{ ++ d->title = value; ++} ++ ++void ++ASF::Tag::setArtist(const String &value) ++{ ++ d->artist = value; ++} ++ ++void ++ASF::Tag::setCopyright(const String &value) ++{ ++ d->copyright = value; ++} ++ ++void ++ASF::Tag::setComment(const String &value) ++{ ++ d->comment = value; ++} ++ ++void ++ASF::Tag::setRating(const String &value) ++{ ++ d->rating = value; ++} ++ ++void ++ASF::Tag::setAlbum(const String &value) ++{ ++ setAttribute("WM/AlbumTitle", value); ++} ++ ++void ++ASF::Tag::setGenre(const String &value) ++{ ++ setAttribute("WM/Genre", value); ++} ++ ++void ++ASF::Tag::setYear(uint value) ++{ ++ setAttribute("WM/Year", String::number(value)); ++} ++ ++void ++ASF::Tag::setTrack(uint value) ++{ ++ setAttribute("WM/TrackNumber", String::number(value)); ++} ++ ++ASF::AttributeListMap& ++ASF::Tag::attributeListMap() ++{ ++ return d->attributeListMap; ++} ++ ++void ASF::Tag::removeItem(const String &key) ++{ ++ AttributeListMap::Iterator it = d->attributeListMap.find(key); ++ if(it != d->attributeListMap.end()) ++ d->attributeListMap.erase(it); ++} ++ ++void ASF::Tag::setAttribute(const String &name, const Attribute &attribute) ++{ ++ AttributeList value; ++ value.append(attribute); ++ d->attributeListMap.insert(name, value); ++} ++ ++void ASF::Tag::addAttribute(const String &name, const Attribute &attribute) ++{ ++ if(d->attributeListMap.contains(name)) { ++ d->attributeListMap[name].append(attribute); ++ } ++ else { ++ setAttribute(name, attribute); ++ } ++} ++ ++bool ASF::Tag::isEmpty() const { ++ return TagLib::Tag::isEmpty() && ++ copyright().isEmpty() && ++ rating().isEmpty() && ++ d->attributeListMap.isEmpty(); ++} +Index: amarok/src/metadata/asf/asfproperties.cpp +=================================================================== +--- amarok/src/metadata/asf/asfproperties.cpp (revision 0) ++++ amarok/src/metadata/asf/asfproperties.cpp (revision 743005) +@@ -0,0 +1,95 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#include ++#include "asfproperties.h" ++ ++using namespace TagLib; ++ ++class ASF::Properties::PropertiesPrivate ++{ ++public: ++ PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0) {} ++ int length; ++ int bitrate; ++ int sampleRate; ++ int channels; ++}; ++ ++//////////////////////////////////////////////////////////////////////////////// ++// public members ++//////////////////////////////////////////////////////////////////////////////// ++ ++ASF::Properties::Properties() : AudioProperties(AudioProperties::Average) ++{ ++ d = new PropertiesPrivate; ++} ++ ++ASF::Properties::~Properties() ++{ ++ if(d) ++ delete d; ++} ++ ++int ASF::Properties::length() const ++{ ++ return d->length; ++} ++ ++int ASF::Properties::bitrate() const ++{ ++ return d->bitrate; ++} ++ ++int ASF::Properties::sampleRate() const ++{ ++ return d->sampleRate; ++} ++ ++int ASF::Properties::channels() const ++{ ++ return d->channels; ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++// private members ++//////////////////////////////////////////////////////////////////////////////// ++ ++void ASF::Properties::setLength(int length) ++{ ++ d->length = length; ++} ++ ++void ASF::Properties::setBitrate(int length) ++{ ++ d->bitrate = length; ++} ++ ++void ASF::Properties::setSampleRate(int length) ++{ ++ d->sampleRate = length; ++} ++ ++void ASF::Properties::setChannels(int length) ++{ ++ d->channels = length; ++} ++ + +Property changes on: amarok/src/metadata/asf/asfproperties.cpp +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/asf/Makefile.am +=================================================================== +--- amarok/src/metadata/asf/Makefile.am (revision 0) ++++ amarok/src/metadata/asf/Makefile.am (revision 743005) +@@ -0,0 +1,20 @@ ++SUBDIRS = ++ ++INCLUDES = $(all_includes) $(taglib_includes) ++METASOURCES = AUTO ++libtagasf_la_LDFLAGS = $(all_libraries) ++noinst_LTLIBRARIES = libtagasf.la ++ ++libtagasf_la_SOURCES = \ ++ asfattribute.cpp \ ++ asfproperties.cpp \ ++ asftag.cpp \ ++ asffile.cpp \ ++ taglib_asffiletyperesolver.cpp ++ ++noinst_HEADERS = \ ++ asfattribute.h \ ++ asfproperties.h \ ++ asftag.h \ ++ asffile.h \ ++ taglib_asffiletyperesolver.h +Index: amarok/src/metadata/asf/asffile.cpp +=================================================================== +--- amarok/src/metadata/asf/asffile.cpp (revision 0) ++++ amarok/src/metadata/asf/asffile.cpp (revision 743005) +@@ -0,0 +1,547 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#include ++#include ++#include "asffile.h" ++#include "asftag.h" ++#include "asfproperties.h" ++ ++using namespace TagLib; ++ ++class ASF::File::FilePrivate ++{ ++public: ++ FilePrivate(): ++ size(0), ++ tag(0), ++ properties(0), ++ contentDescriptionObject(0), ++ extendedContentDescriptionObject(0), ++ headerExtensionObject(0), ++ metadataObject(0), ++ metadataLibraryObject(0) {} ++ unsigned long long size; ++ ASF::Tag *tag; ++ ASF::Properties *properties; ++ List objects; ++ ASF::File::ContentDescriptionObject *contentDescriptionObject; ++ ASF::File::ExtendedContentDescriptionObject *extendedContentDescriptionObject; ++ ASF::File::HeaderExtensionObject *headerExtensionObject; ++ ASF::File::MetadataObject *metadataObject; ++ ASF::File::MetadataLibraryObject *metadataLibraryObject; ++}; ++ ++static ByteVector headerGuid("\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16); ++static ByteVector filePropertiesGuid("\xA1\xDC\xAB\x8C\x47\xA9\xCF\x11\x8E\xE4\x00\xC0\x0C\x20\x53\x65", 16); ++static ByteVector streamPropertiesGuid("\x91\x07\xDC\xB7\xB7\xA9\xCF\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65", 16); ++static ByteVector contentDescriptionGuid("\x33\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16); ++static ByteVector extendedContentDescriptionGuid("\x40\xA4\xD0\xD2\x07\xE3\xD2\x11\x97\xF0\x00\xA0\xC9\x5E\xA8\x50", 16); ++static ByteVector headerExtensionGuid("\xb5\x03\xbf_.\xa9\xcf\x11\x8e\xe3\x00\xc0\x0c Se", 16); ++static ByteVector metadataGuid("\xEA\xCB\xF8\xC5\xAF[wH\204g\xAA\214D\xFAL\xCA", 16); ++static ByteVector metadataLibraryGuid("\224\034#D\230\224\321I\241A\x1d\x13NEpT", 16); ++ ++class ASF::File::BaseObject ++{ ++public: ++ ByteVector data; ++ virtual ~BaseObject() {} ++ virtual ByteVector guid() = 0; ++ virtual void parse(ASF::File *file, unsigned int size); ++ virtual ByteVector render(ASF::File *file); ++}; ++ ++class ASF::File::UnknownObject : public ASF::File::BaseObject ++{ ++ ByteVector myGuid; ++public: ++ UnknownObject(const ByteVector &guid); ++ ByteVector guid(); ++}; ++ ++class ASF::File::FilePropertiesObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++}; ++ ++class ASF::File::StreamPropertiesObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++}; ++ ++class ASF::File::ContentDescriptionObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++ ByteVector render(ASF::File *file); ++}; ++ ++class ASF::File::ExtendedContentDescriptionObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVectorList attributeData; ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++ ByteVector render(ASF::File *file); ++}; ++ ++class ASF::File::MetadataObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVectorList attributeData; ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++ ByteVector render(ASF::File *file); ++}; ++ ++class ASF::File::MetadataLibraryObject : public ASF::File::BaseObject ++{ ++public: ++ ByteVectorList attributeData; ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++ ByteVector render(ASF::File *file); ++}; ++ ++class ASF::File::HeaderExtensionObject : public ASF::File::BaseObject ++{ ++public: ++ List objects; ++ ByteVector guid(); ++ void parse(ASF::File *file, uint size); ++ ByteVector render(ASF::File *file); ++}; ++ ++void ++ASF::File::BaseObject::parse(ASF::File *file, unsigned int size) ++{ ++ data = file->readBlock(size - 24); ++} ++ ++ByteVector ++ASF::File::BaseObject::render(ASF::File * /*file*/) ++{ ++ return guid() + ByteVector::fromLongLong(data.size() + 24, false) + data; ++} ++ ++ASF::File::UnknownObject::UnknownObject(const ByteVector &guid) : myGuid(guid) ++{ ++} ++ ++ByteVector ++ASF::File::UnknownObject::guid() ++{ ++ return myGuid; ++} ++ ++ByteVector ++ASF::File::FilePropertiesObject::guid() ++{ ++ return filePropertiesGuid; ++} ++ ++void ++ASF::File::FilePropertiesObject::parse(ASF::File *file, uint size) ++{ ++ BaseObject::parse(file, size); ++ file->d->properties->setLength((int)(data.mid(40, 8).toLongLong(false) / 10000000L - data.mid(56, 8).toLongLong(false) / 1000L)); ++} ++ ++ByteVector ++ASF::File::StreamPropertiesObject::guid() ++{ ++ return streamPropertiesGuid; ++} ++ ++void ++ASF::File::StreamPropertiesObject::parse(ASF::File *file, uint size) ++{ ++ BaseObject::parse(file, size); ++ file->d->properties->setChannels(data.mid(56, 2).toShort(false)); ++ file->d->properties->setSampleRate(data.mid(58, 4).toUInt(false)); ++ file->d->properties->setBitrate(data.mid(62, 4).toUInt(false) * 8 / 1000); ++} ++ ++ByteVector ++ASF::File::ContentDescriptionObject::guid() ++{ ++ return contentDescriptionGuid; ++} ++ ++void ++ASF::File::ContentDescriptionObject::parse(ASF::File *file, uint /*size*/) ++{ ++ file->d->contentDescriptionObject = this; ++ int titleLength = file->readWORD(); ++ int artistLength = file->readWORD(); ++ int copyrightLength = file->readWORD(); ++ int commentLength = file->readWORD(); ++ int ratingLength = file->readWORD(); ++ file->d->tag->setTitle(file->readString(titleLength)); ++ file->d->tag->setArtist(file->readString(artistLength)); ++ file->d->tag->setCopyright(file->readString(copyrightLength)); ++ file->d->tag->setComment(file->readString(commentLength)); ++ file->d->tag->setRating(file->readString(ratingLength)); ++} ++ ++ByteVector ++ASF::File::ContentDescriptionObject::render(ASF::File *file) ++{ ++ ByteVector v1 = file->renderString(file->d->tag->title()); ++ ByteVector v2 = file->renderString(file->d->tag->artist()); ++ ByteVector v3 = file->renderString(file->d->tag->copyright()); ++ ByteVector v4 = file->renderString(file->d->tag->comment()); ++ ByteVector v5 = file->renderString(file->d->tag->rating()); ++ data.clear(); ++ data.append(ByteVector::fromShort(v1.size(), false)); ++ data.append(ByteVector::fromShort(v2.size(), false)); ++ data.append(ByteVector::fromShort(v3.size(), false)); ++ data.append(ByteVector::fromShort(v4.size(), false)); ++ data.append(ByteVector::fromShort(v5.size(), false)); ++ data.append(v1); ++ data.append(v2); ++ data.append(v3); ++ data.append(v4); ++ data.append(v5); ++ return BaseObject::render(file); ++} ++ ++ByteVector ++ASF::File::ExtendedContentDescriptionObject::guid() ++{ ++ return extendedContentDescriptionGuid; ++} ++ ++void ++ASF::File::ExtendedContentDescriptionObject::parse(ASF::File *file, uint /*size*/) ++{ ++ file->d->extendedContentDescriptionObject = this; ++ int count = file->readWORD(); ++ while(count--) { ++ ASF::Attribute attribute; ++ String name = attribute.parse(*file); ++ file->d->tag->addAttribute(name, attribute); ++ } ++} ++ ++ByteVector ++ASF::File::ExtendedContentDescriptionObject::render(ASF::File *file) ++{ ++ data.clear(); ++ data.append(ByteVector::fromShort(attributeData.size(), false)); ++ data.append(attributeData.toByteVector(ByteVector::null)); ++ return BaseObject::render(file); ++} ++ ++ByteVector ++ASF::File::MetadataObject::guid() ++{ ++ return metadataGuid; ++} ++ ++void ++ASF::File::MetadataObject::parse(ASF::File *file, uint /*size*/) ++{ ++ file->d->metadataObject = this; ++ int count = file->readWORD(); ++ while(count--) { ++ ASF::Attribute attribute; ++ String name = attribute.parse(*file, 1); ++ file->d->tag->addAttribute(name, attribute); ++ } ++} ++ ++ByteVector ++ASF::File::MetadataObject::render(ASF::File *file) ++{ ++ data.clear(); ++ data.append(ByteVector::fromShort(attributeData.size(), false)); ++ data.append(attributeData.toByteVector(ByteVector::null)); ++ return BaseObject::render(file); ++} ++ ++ByteVector ++ASF::File::MetadataLibraryObject::guid() ++{ ++ return metadataLibraryGuid; ++} ++ ++void ++ASF::File::MetadataLibraryObject::parse(ASF::File *file, uint /*size*/) ++{ ++ file->d->metadataLibraryObject = this; ++ int count = file->readWORD(); ++ while(count--) { ++ ASF::Attribute attribute; ++ String name = attribute.parse(*file, 2); ++ file->d->tag->addAttribute(name, attribute); ++ } ++} ++ ++ByteVector ++ASF::File::MetadataLibraryObject::render(ASF::File *file) ++{ ++ data.clear(); ++ data.append(ByteVector::fromShort(attributeData.size(), false)); ++ data.append(attributeData.toByteVector(ByteVector::null)); ++ return BaseObject::render(file); ++} ++ ++ByteVector ++ASF::File::HeaderExtensionObject::guid() ++{ ++ return headerExtensionGuid; ++} ++ ++void ++ASF::File::HeaderExtensionObject::parse(ASF::File *file, uint /*size*/) ++{ ++ file->d->headerExtensionObject = this; ++ file->seek(18, File::Current); ++ long long dataSize = file->readDWORD(); ++ long long dataPos = 0; ++ while(dataPos < dataSize) { ++ ByteVector guid = file->readBlock(16); ++ long long size = file->readQWORD(); ++ BaseObject *obj; ++ if(guid == metadataGuid) { ++ obj = new MetadataObject(); ++ } ++ else if(guid == metadataLibraryGuid) { ++ obj = new MetadataLibraryObject(); ++ } ++ else { ++ obj = new UnknownObject(guid); ++ } ++ obj->parse(file, size); ++ objects.append(obj); ++ dataPos += size; ++ } ++} ++ ++ByteVector ++ASF::File::HeaderExtensionObject::render(ASF::File *file) ++{ ++ data.clear(); ++ for(unsigned int i = 0; i < objects.size(); i++) { ++ data.append(objects[i]->render(file)); ++ } ++ data = ByteVector("\x11\xD2\xD3\xAB\xBA\xA9\xcf\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65\x06\x00", 18) + ByteVector::fromUInt(data.size(), false) + data; ++ return BaseObject::render(file); ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++// public members ++//////////////////////////////////////////////////////////////////////////////// ++ ++ASF::File::File(const char *file, bool readProperties, Properties::ReadStyle propertiesStyle) ++ : TagLib::File(file) ++{ ++ d = new FilePrivate; ++ read(readProperties, propertiesStyle); ++} ++ ++ASF::File::~File() ++{ ++ for(unsigned int i = 0; i < d->objects.size(); i++) { ++ delete d->objects[i]; ++ } ++ if(d->tag) { ++ delete d->tag; ++ } ++ if(d->properties) { ++ delete d->properties; ++ } ++ delete d; ++} ++ ++ASF::Tag *ASF::File::tag() const ++{ ++ return d->tag; ++} ++ ++ASF::Properties *ASF::File::audioProperties() const ++{ ++ return d->properties; ++} ++ ++void ASF::File::read(bool /*readProperties*/, Properties::ReadStyle /*propertiesStyle*/) ++{ ++ if(!isValid()) ++ return; ++ ++ ByteVector guid = readBlock(16); ++ if(guid != headerGuid) { ++ return; ++ } ++ ++ d->tag = new ASF::Tag(); ++ d->properties = new ASF::Properties(); ++ ++ d->size = readQWORD(); ++ int numObjects = readDWORD(); ++ seek(2, Current); ++ ++ for(int i = 0; i < numObjects; i++) { ++ ByteVector guid = readBlock(16); ++ long size = (long)readQWORD(); ++ BaseObject *obj; ++ if(guid == filePropertiesGuid) { ++ obj = new FilePropertiesObject(); ++ } ++ else if(guid == streamPropertiesGuid) { ++ obj = new StreamPropertiesObject(); ++ } ++ else if(guid == contentDescriptionGuid) { ++ obj = new ContentDescriptionObject(); ++ } ++ else if(guid == extendedContentDescriptionGuid) { ++ obj = new ExtendedContentDescriptionObject(); ++ } ++ else if(guid == headerExtensionGuid) { ++ obj = new HeaderExtensionObject(); ++ } ++ else { ++ obj = new UnknownObject(guid); ++ } ++ obj->parse(this, size); ++ d->objects.append(obj); ++ } ++} ++ ++bool ASF::File::save() ++{ ++ if(readOnly()) { ++ return false; ++ } ++ ++ if(!d->contentDescriptionObject) { ++ d->contentDescriptionObject = new ContentDescriptionObject(); ++ d->objects.append(d->contentDescriptionObject); ++ } ++ if(!d->extendedContentDescriptionObject) { ++ d->extendedContentDescriptionObject = new ExtendedContentDescriptionObject(); ++ d->objects.append(d->extendedContentDescriptionObject); ++ } ++ if(!d->headerExtensionObject) { ++ d->headerExtensionObject = new HeaderExtensionObject(); ++ d->objects.append(d->headerExtensionObject); ++ } ++ if(!d->metadataObject) { ++ d->metadataObject = new MetadataObject(); ++ d->headerExtensionObject->objects.append(d->metadataObject); ++ } ++ if(!d->metadataLibraryObject) { ++ d->metadataLibraryObject = new MetadataLibraryObject(); ++ d->headerExtensionObject->objects.append(d->metadataLibraryObject); ++ } ++ ++ ASF::AttributeListMap::ConstIterator it = d->tag->attributeListMap().begin(); ++ for(; it != d->tag->attributeListMap().end(); it++) { ++ const String &name = it->first; ++ const AttributeList &attributes = it->second; ++ bool inExtendedContentDescriptionObject = false; ++ bool inMetadataObject = false; ++ for(unsigned int j = 0; j < attributes.size(); j++) { ++ const Attribute &attribute = attributes[j]; ++ if(!inExtendedContentDescriptionObject && attribute.language() == 0 && attribute.stream() == 0) { ++ d->extendedContentDescriptionObject->attributeData.append(attribute.render(name)); ++ inExtendedContentDescriptionObject = true; ++ } ++ else if(!inMetadataObject && attribute.language() == 0 && attribute.stream() != 0) { ++ d->metadataObject->attributeData.append(attribute.render(name, 1)); ++ inMetadataObject = true; ++ } ++ else { ++ d->metadataLibraryObject->attributeData.append(attribute.render(name, 2)); ++ } ++ } ++ } ++ ++ ByteVector data; ++ for(unsigned int i = 0; i < d->objects.size(); i++) { ++ data.append(d->objects[i]->render(this)); ++ } ++ data = headerGuid + ByteVector::fromLongLong(data.size() + 30, false) + ByteVector::fromUInt(d->objects.size(), false) + ByteVector("\x01\x02", 2) + data; ++ insert(data, 0, d->size); ++ ++ return true; ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++// protected members ++//////////////////////////////////////////////////////////////////////////////// ++ ++int ASF::File::readBYTE() ++{ ++ ByteVector v = readBlock(1); ++ return v[0]; ++} ++ ++int ASF::File::readWORD() ++{ ++ ByteVector v = readBlock(2); ++ return v.toShort(false); ++} ++ ++unsigned int ASF::File::readDWORD() ++{ ++ ByteVector v = readBlock(4); ++ return v.toUInt(false); ++} ++ ++long long ASF::File::readQWORD() ++{ ++ ByteVector v = readBlock(8); ++ return v.toLongLong(false); ++} ++ ++String ++ASF::File::readString(int length) ++{ ++ ByteVector data = readBlock(length); ++ unsigned int size = data.size(); ++ while (size >= 2) { ++ if(data[size - 1] != '\0' || data[size - 2] != '\0') { ++ break; ++ } ++ size -= 2; ++ } ++ if(size != data.size()) { ++ data.resize(size); ++ } ++ return String(data, String::UTF16LE); ++} ++ ++ByteVector ++ASF::File::renderString(const String &str, bool includeLength) ++{ ++ ByteVector data = str.data(String::UTF16LE) + ByteVector::fromShort(0, false); ++ if(includeLength) { ++ data = ByteVector::fromShort(data.size(), false) + data; ++ } ++ return data; ++} + +Property changes on: amarok/src/metadata/asf/asffile.cpp +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/asf/asftag.h +=================================================================== +--- amarok/src/metadata/asf/asftag.h (revision 0) ++++ amarok/src/metadata/asf/asftag.h (revision 743005) +@@ -0,0 +1,181 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#ifndef TAGLIB_ASFTAG_H ++#define TAGLIB_ASFTAG_H ++ ++#include ++#include ++#include ++#include "asfattribute.h" ++ ++namespace TagLib { ++ ++ namespace ASF { ++ ++ typedef List AttributeList; ++ typedef Map AttributeListMap; ++ ++ class Tag : public TagLib::Tag { ++ ++ friend class File; ++ ++ public: ++ ++ Tag(); ++ ++ virtual ~Tag(); ++ ++ /*! ++ * Returns the track name. ++ */ ++ virtual String title() const; ++ ++ /*! ++ * Returns the artist name. ++ */ ++ virtual String artist() const; ++ ++ /*! ++ * Returns the album name; if no album name is present in the tag ++ * String::null will be returned. ++ */ ++ virtual String album() const; ++ ++ /*! ++ * Returns the track comment. ++ */ ++ virtual String comment() const; ++ ++ /*! ++ * Returns the genre name; if no genre is present in the tag String::null ++ * will be returned. ++ */ ++ virtual String genre() const; ++ ++ /*! ++ * Returns the rating. ++ */ ++ virtual String rating() const; ++ ++ /*! ++ * Returns the genre name; if no genre is present in the tag String::null ++ * will be returned. ++ */ ++ virtual String copyright() const; ++ ++ /*! ++ * Returns the year; if there is no year set, this will return 0. ++ */ ++ virtual uint year() const; ++ ++ /*! ++ * Returns the track number; if there is no track number set, this will ++ * return 0. ++ */ ++ virtual uint track() const; ++ ++ /*! ++ * Sets the title to \a s. ++ */ ++ virtual void setTitle(const String &s); ++ ++ /*! ++ * Sets the artist to \a s. ++ */ ++ virtual void setArtist(const String &s); ++ ++ /*! ++ * Sets the album to \a s. If \a s is String::null then this value will be ++ * cleared. ++ */ ++ virtual void setAlbum(const String &s); ++ ++ /*! ++ * Sets the comment to \a s. ++ */ ++ virtual void setComment(const String &s); ++ ++ /*! ++ * Sets the rating to \a s. ++ */ ++ virtual void setRating(const String &s); ++ ++ /*! ++ * Sets the copyright to \a s. ++ */ ++ virtual void setCopyright(const String &s); ++ ++ /*! ++ * Sets the genre to \a s. ++ */ ++ virtual void setGenre(const String &s); ++ ++ /*! ++ * Sets the year to \a i. If \a s is 0 then this value will be cleared. ++ */ ++ virtual void setYear(uint i); ++ ++ /*! ++ * Sets the track to \a i. If \a s is 0 then this value will be cleared. ++ */ ++ virtual void setTrack(uint i); ++ ++ /*! ++ * Returns true if the tag does not contain any data. This should be ++ * reimplemented in subclasses that provide more than the basic tagging ++ * abilities in this class. ++ */ ++ virtual bool isEmpty() const; ++ ++ /*! ++ * Returns a reference to the item list map. This is an AttributeListMap of ++ * all of the items in the tag. ++ * ++ * This is the most powerfull structure for accessing the items of the tag. ++ */ ++ AttributeListMap &attributeListMap(); ++ ++ /*! ++ * Removes the \a key attribute from the tag ++ */ ++ void removeItem(const String &name); ++ ++ /*! ++ * Sets the \a key attribute to the value of \a attribute. If an attribute ++ * with the \a key is already present, it will be replaced. ++ */ ++ void setAttribute(const String &name, const Attribute &attribute); ++ ++ /*! ++ * Sets the \a key attribute to the value of \a attribute. If an attribute ++ * with the \a key is already present, it will be added to the list. ++ */ ++ void addAttribute(const String &name, const Attribute &attribute); ++ ++ private: ++ ++ class TagPrivate; ++ TagPrivate *d; ++ }; ++ } ++} ++#endif +Index: amarok/src/metadata/asf/asfproperties.h +=================================================================== +--- amarok/src/metadata/asf/asfproperties.h (revision 0) ++++ amarok/src/metadata/asf/asfproperties.h (revision 743005) +@@ -0,0 +1,69 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#ifndef TAGLIB_ASFPROPERTIES_H ++#define TAGLIB_ASFPROPERTIES_H ++ ++#include ++#include ++ ++namespace TagLib { ++ ++ namespace ASF { ++ ++ //! An implementation of ASF audio properties ++ class Properties : public AudioProperties ++ { ++ public: ++ ++ /*! ++ * Create an instance of ASF::Properties. ++ */ ++ Properties(); ++ ++ /*! ++ * Destroys this ASF::Properties instance. ++ */ ++ virtual ~Properties(); ++ ++ // Reimplementations. ++ virtual int length() const; ++ virtual int bitrate() const; ++ virtual int sampleRate() const; ++ virtual int channels() const; ++ ++#ifndef DO_NOT_DOCUMENT ++ void setLength(int value); ++ void setBitrate(int value); ++ void setSampleRate(int value); ++ void setChannels(int value); ++#endif ++ ++ private: ++ class PropertiesPrivate; ++ PropertiesPrivate *d; ++ }; ++ ++ } ++ ++} ++ ++#endif + +Property changes on: amarok/src/metadata/asf/asfproperties.h +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/asf/asfattribute.cpp +=================================================================== +--- amarok/src/metadata/asf/asfattribute.cpp (revision 0) ++++ amarok/src/metadata/asf/asfattribute.cpp (revision 743005) +@@ -0,0 +1,304 @@ ++/************************************************************************** ++ copyright : (C) 2005-2007 by Lukáš Lalinský ++ email : lalinsky@gmail.com ++ **************************************************************************/ ++ ++/*************************************************************************** ++ * This library is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Lesser General Public License version * ++ * 2.1 as published by the Free Software Foundation. * ++ * * ++ * This library is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * ++ * Lesser General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Lesser General Public * ++ * License along with this library; if not, write to the Free Software * ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * ++ * USA * ++ ***************************************************************************/ ++ ++#include ++#include "asfattribute.h" ++#include "asffile.h" ++ ++using namespace TagLib; ++ ++class ASF::Attribute::AttributePrivate : public RefCounter ++{ ++public: ++ AttributePrivate() ++ : stream(0), ++ language(0) {} ++ AttributeTypes type; ++ String stringValue; ++ ByteVector byteVectorValue; ++ union { ++ unsigned int intValue; ++ unsigned short shortValue; ++ unsigned long long longLongValue; ++ bool boolValue; ++ }; ++ int stream; ++ int language; ++}; ++ ++//////////////////////////////////////////////////////////////////////////////// ++// public members ++//////////////////////////////////////////////////////////////////////////////// ++ ++ASF::Attribute::Attribute() ++{ ++ d = new AttributePrivate; ++ d->type = UnicodeType; ++} ++ ++ASF::Attribute::Attribute(const ASF::Attribute &other) ++ : d(other.d) ++{ ++ d->ref(); ++} ++ ++ASF::Attribute & ++ASF::Attribute::operator=(const ASF::Attribute &other) ++{ ++ if(d->deref()) ++ delete d; ++ d = other.d; ++ d->ref(); ++ return *this; ++} ++ ++ASF::Attribute::~Attribute() ++{ ++ if(d->deref()) ++ delete d; ++} ++ ++ASF::Attribute::Attribute(const String &value) ++{ ++ d = new AttributePrivate; ++ d->type = UnicodeType; ++ d->stringValue = value; ++} ++ ++ASF::Attribute::Attribute(const ByteVector &value) ++{ ++ d = new AttributePrivate; ++ d->type = BytesType; ++ d->byteVectorValue = value; ++} ++ ++ASF::Attribute::Attribute(unsigned int value) ++{ ++ d = new AttributePrivate; ++ d->type = DWordType; ++ d->intValue = value; ++} ++ ++ASF::Attribute::Attribute(unsigned long long value) ++{ ++ d = new AttributePrivate; ++ d->type = QWordType; ++ d->longLongValue = value; ++} ++ ++ASF::Attribute::Attribute(unsigned short value) ++{ ++ d = new AttributePrivate; ++ d->type = WordType; ++ d->shortValue = value; ++} ++ ++ASF::Attribute::Attribute(bool value) ++{ ++ d = new AttributePrivate; ++ d->type = BoolType; ++ d->boolValue = value; ++} ++ ++ASF::Attribute::AttributeTypes ++ASF::Attribute::type() const ++{ ++ return d->type; ++} ++ ++String ++ASF::Attribute::toString() const ++{ ++ return d->stringValue; ++} ++ ++ByteVector ++ASF::Attribute::toByteVector() const ++{ ++ return d->byteVectorValue; ++} ++ ++unsigned short ++ASF::Attribute::toBool() const ++{ ++ return d->shortValue; ++} ++ ++unsigned short ++ASF::Attribute::toUShort() const ++{ ++ return d->shortValue; ++} ++ ++unsigned int ++ASF::Attribute::toUInt() const ++{ ++ return d->intValue; ++} ++ ++unsigned long long ++ASF::Attribute::toULongLong() const ++{ ++ return d->longLongValue; ++} ++ ++String ++ASF::Attribute::parse(ASF::File &f, int kind) ++{ ++ int size, nameLength; ++ String name; ++ ++ // extended content descriptor ++ if(kind == 0) { ++ nameLength = f.readWORD(); ++ name = f.readString(nameLength); ++ d->type = ASF::Attribute::AttributeTypes(f.readWORD()); ++ size = f.readWORD(); ++ } ++ // metadata & metadata library ++ else { ++ int temp = f.readWORD(); ++ // metadata library ++ if(kind == 2) { ++ d->language = temp; ++ } ++ d->stream = f.readWORD(); ++ nameLength = f.readWORD(); ++ d->type = ASF::Attribute::AttributeTypes(f.readWORD()); ++ size = f.readDWORD(); ++ name = f.readString(nameLength); ++ } ++ ++ switch(d->type) { ++ case WordType: ++ d->shortValue = f.readWORD(); ++ break; ++ ++ case BoolType: ++ if(kind == 0) { ++ d->boolValue = f.readDWORD() == 1; ++ } ++ else { ++ d->boolValue = f.readWORD() == 1; ++ } ++ break; ++ ++ case DWordType: ++ d->intValue = f.readDWORD(); ++ break; ++ ++ case QWordType: ++ d->longLongValue = f.readQWORD(); ++ break; ++ ++ case UnicodeType: ++ d->stringValue = f.readString(size); ++ break; ++ ++ case BytesType: ++ case GuidType: ++ d->byteVectorValue = f.readBlock(size); ++ break; ++ } ++ ++ return name; ++} ++ ++ByteVector ++ASF::Attribute::render(const String &name, int kind) const ++{ ++ ByteVector data; ++ ++ switch (d->type) { ++ case WordType: ++ data.append(ByteVector::fromShort(d->shortValue, false)); ++ break; ++ ++ case BoolType: ++ if(kind == 0) { ++ data.append(ByteVector::fromUInt(d->boolValue ? 1 : 0, false)); ++ } ++ else { ++ data.append(ByteVector::fromShort(d->boolValue ? 1 : 0, false)); ++ } ++ break; ++ ++ case DWordType: ++ data.append(ByteVector::fromUInt(d->intValue, false)); ++ break; ++ ++ case QWordType: ++ data.append(ByteVector::fromLongLong(d->longLongValue, false)); ++ break; ++ ++ case UnicodeType: ++ data.append(File::renderString(d->stringValue)); ++ break; ++ ++ case BytesType: ++ case GuidType: ++ data.append(d->byteVectorValue); ++ break; ++ } ++ ++ if(kind == 0) { ++ data = File::renderString(name, true) + ++ ByteVector::fromShort((int)d->type, false) + ++ ByteVector::fromShort(data.size(), false) + ++ data; ++ } ++ else { ++ ByteVector nameData = File::renderString(name); ++ data = ByteVector::fromShort(kind == 2 ? d->language : 0, false) + ++ ByteVector::fromShort(d->stream, false) + ++ ByteVector::fromShort(nameData.size(), false) + ++ ByteVector::fromShort((int)d->type, false) + ++ ByteVector::fromUInt(data.size(), false) + ++ nameData + ++ data; ++ } ++ ++ return data; ++} ++ ++int ++ASF::Attribute::language() const ++{ ++ return d->language; ++} ++ ++void ++ASF::Attribute::setLanguage(int value) ++{ ++ d->language = value; ++} ++ ++int ++ASF::Attribute::stream() const ++{ ++ return d->stream; ++} ++ ++void ++ASF::Attribute::setStream(int value) ++{ ++ d->stream = value; ++} + +Property changes on: amarok/src/metadata/asf/asfattribute.cpp +___________________________________________________________________ +Name: svn:eol-style + + native + +Index: amarok/src/metadata/mp4/mp4file.cpp +=================================================================== +--- amarok/src/metadata/mp4/mp4file.cpp (revision 705231) ++++ amarok/src/metadata/mp4/mp4file.cpp (working copy) +@@ -156,10 +156,7 @@ + } + #endif + +- if(!MP4Close(handle)) +- { +- fprintf(stderr, "close failed\n"); +- } ++ MP4Close(handle); + + mp4file = MP4Read(name()); + if(mp4file == MP4_INVALID_FILE_HANDLE) +Index: amarok/src/metadata/wma/taglib_wmafiletyperesolver.h +=================================================================== +--- amarok/src/metadata/wma/taglib_wmafiletyperesolver.h (revision 705231) ++++ amarok/src/metadata/wma/taglib_wmafiletyperesolver.h (working copy) +@@ -1,39 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Martin Aumueller +- email : aumuell@reserv.at +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-// (c) 2005 Martin Aumueller +-// See COPYING file for licensing information +- +-#ifndef TAGLIB_WMAFILETYPERESOLVER_H +-#define TAGLIB_WMAFILETYPERESOLVER_H +- +-#include +-#include +- +- +-class WMAFileTypeResolver : public TagLib::FileRef::FileTypeResolver +-{ +- TagLib::File *createFile(const char *fileName, +- bool readAudioProperties, +- TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const; +-}; +- +-#endif +Index: amarok/src/metadata/wma/wmatag.cpp +=================================================================== +--- amarok/src/metadata/wma/wmatag.cpp (revision 705231) ++++ amarok/src/metadata/wma/wmatag.cpp (working copy) +@@ -1,210 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#include +- +-using namespace TagLib; +- +-class WMA::Tag::TagPrivate +-{ +-public: +- String title; +- String artist; +- String copyright; +- String comment; +- String rating; +- AttributeMap attributeMap; +-}; +- +-WMA::Tag::Tag() +-: TagLib::Tag() +-{ +- d = new TagPrivate; +-} +- +-WMA::Tag::~Tag() +-{ +- if(d) +- delete d; +-} +- +-String +-WMA::Tag::title() const +-{ +- return d->title; +-} +- +-String +-WMA::Tag::artist() const +-{ +- return d->artist; +-} +- +-String +-WMA::Tag::album() const +-{ +- if(d->attributeMap.contains("WM/AlbumTitle")) +- return d->attributeMap["WM/AlbumTitle"].toString(); +- return String::null; +-} +- +-String +-WMA::Tag::copyright() const +-{ +- return d->copyright; +-} +- +-String +-WMA::Tag::comment() const +-{ +- return d->comment; +-} +- +-String +-WMA::Tag::rating() const +-{ +- return d->rating; +-} +- +-unsigned int +-WMA::Tag::year() const +-{ +- if(d->attributeMap.contains("WM/Year")) +- return d->attributeMap["WM/Year"].toInt(); +- return 0; +-} +- +-unsigned int +-WMA::Tag::track() const +-{ +- if(d->attributeMap.contains("WM/TrackNumber")) +- return d->attributeMap["WM/TrackNumber"].toInt(); +- if(d->attributeMap.contains("WM/Track")) +- return d->attributeMap["WM/Track"].toInt(); +- return 0; +-} +- +-String +-WMA::Tag::genre() const +-{ +- if(d->attributeMap.contains("WM/Genre")) +- return d->attributeMap["WM/Genre"].toString(); +- return String::null; +-} +- +-void +-WMA::Tag::setTitle(const String &value) +-{ +- d->title = value; +-} +- +-void +-WMA::Tag::setArtist(const String &value) +-{ +- d->artist = value; +-} +- +-void +-WMA::Tag::setCopyright(const String &value) +-{ +- d->copyright = value; +-} +- +-void +-WMA::Tag::setComment(const String &value) +-{ +- d->comment = value; +-} +- +-void +-WMA::Tag::setRating(const String &value) +-{ +- d->rating = value; +-} +- +-void +-WMA::Tag::setAlbum(const String &value) +-{ +- setAttribute("WM/AlbumTitle", value); +-} +- +-void +-WMA::Tag::setGenre(const String &value) +-{ +- setAttribute("WM/Genre", value); +-} +- +-void +-WMA::Tag::setYear(uint value) +-{ +- setAttribute("WM/Year", String::number(value)); +-} +- +-void +-WMA::Tag::setTrack(uint value) +-{ +- setAttribute("WM/TrackNumber", String::number(value)); +-} +- +-const WMA::AttributeMap& WMA::Tag::attributeMap() const +-{ +- return d->attributeMap; +-} +- +-void WMA::Tag::removeItem(const ByteVector &key) +-{ +- AttributeMap::Iterator it = d->attributeMap.find(key); +- if(it != d->attributeMap.end()) +- d->attributeMap.erase(it); +-} +- +-void WMA::Tag::setAttribute(const ByteVector &key, const String &value) +-{ +- setAttribute(key, WMA::Attribute(key, value)); +-} +- +-void WMA::Tag::setAttribute(const ByteVector &key, const Attribute &attribute) +-{ +- removeItem(key); +- d->attributeMap.insert(key, attribute); +-} +- +-bool WMA::Tag::isEmpty() const { +- return TagLib::Tag::isEmpty() && +- copyright().isEmpty() && +- rating().isEmpty() && +- d->attributeMap.isEmpty(); +-} +- +-void WMA::Tag::duplicate(const Tag *source, Tag *target, bool overwrite) { +- TagLib::Tag::duplicate(source, target, overwrite); +- if(overwrite) { +- target->setCopyright(source->copyright()); +- target->setRating(source->rating()); +- } +- else { +- if (target->copyright().isEmpty()) +- target->setCopyright(source->copyright()); +- if (target->rating().isEmpty()) +- target->setRating(source->rating()); +- } +-} +- +Index: amarok/src/metadata/wma/wmaproperties.cpp +=================================================================== +--- amarok/src/metadata/wma/wmaproperties.cpp (revision 705231) ++++ amarok/src/metadata/wma/wmaproperties.cpp (working copy) +@@ -1,83 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#include +-#include +- +-using namespace TagLib; +- +-class WMA::Properties::PropertiesPrivate +-{ +-public: +- PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0) {} +- int length; +- int bitrate; +- int sampleRate; +- int channels; +-}; +- +-//////////////////////////////////////////////////////////////////////////////// +-// public members +-//////////////////////////////////////////////////////////////////////////////// +- +-WMA::Properties::Properties() : AudioProperties(AudioProperties::Average) +-{ +- d = new PropertiesPrivate; +-} +- +-WMA::Properties::~Properties() +-{ +- if(d) +- delete d; +-} +- +-int WMA::Properties::length() const +-{ +- return d->length; +-} +- +-int WMA::Properties::bitrate() const +-{ +- return d->bitrate; +-} +- +-int WMA::Properties::sampleRate() const +-{ +- return d->sampleRate; +-} +- +-int WMA::Properties::channels() const +-{ +- return d->channels; +-} +- +-//////////////////////////////////////////////////////////////////////////////// +-// private members +-//////////////////////////////////////////////////////////////////////////////// +- +-void WMA::Properties::set(int length, int bitrate, int sampleRate, int channels) +-{ +- d->length = length; +- d->bitrate = bitrate; +- d->sampleRate = sampleRate; +- d->channels = channels; +-} +- +Index: amarok/src/metadata/wma/wmafile.cpp +=================================================================== +--- amarok/src/metadata/wma/wmafile.cpp (revision 705231) ++++ amarok/src/metadata/wma/wmafile.cpp (working copy) +@@ -1,388 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#include +-#include +-#include +-#include +- +-#include +- +-using namespace TagLib; +- +-class WMA::File::FilePrivate +-{ +-public: +- FilePrivate(): size(0), offset1(0), offset2(0), size1(0), size2(0), +- numObjects(0), tag(0), properties(0) {} +- unsigned long long size; +- unsigned long offset1, offset2, size1, size2, numObjects; +- WMA::Tag *tag; +- WMA::Properties *properties; +-}; +- +-// GUIDs +- +-struct WMA::GUID +-{ +- WMA::DWORD v1; +- WMA::WORD v2; +- WMA::WORD v3; +- WMA::BYTE v4[8]; +- bool operator==(const GUID &g) const { return memcmp(this, &g, sizeof(WMA::GUID)) == 0; } +- bool operator!=(const GUID &g) const { return memcmp(this, &g, sizeof(WMA::GUID)) != 0; } +- static GUID header; +- static GUID fileProperties; +- static GUID streamProperties; +- static GUID contentDescription; +- static GUID extendedContentDescription; +- static GUID audioMedia; +-}; +- +-WMA::GUID WMA::GUID::header = { +- 0x75B22630, 0x668E, 0x11CF, { 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C } +-}; +- +-WMA::GUID WMA::GUID::fileProperties = { +- 0x8CABDCA1, 0xA947, 0x11CF, { 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, +-}; +- +-WMA::GUID WMA::GUID::streamProperties = { +- 0xB7DC0791, 0xA9B7, 0x11CF, { 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, +-}; +- +-WMA::GUID WMA::GUID::contentDescription = { +- 0x75b22633, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }, +-}; +- +-WMA::GUID WMA::GUID::extendedContentDescription = { +- 0xD2D0A440, 0xE307, 0x11D2, { 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 }, +-}; +- +-WMA::GUID WMA::GUID::audioMedia = { +- 0xF8699E40, 0x5B4D, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, +-}; +- +-//////////////////////////////////////////////////////////////////////////////// +-// public members +-//////////////////////////////////////////////////////////////////////////////// +- +-WMA::File::File(const char *file, bool readProperties, Properties::ReadStyle propertiesStyle) +- : TagLib::File(file) +-{ +- d = new FilePrivate; +- read(readProperties, propertiesStyle); +-} +- +-WMA::File::~File() +-{ +- if(d) { +- if (d->tag) +- delete d->tag; +- if (d->properties) +- delete d->properties; +- delete d; +- } +-} +- +-TagLib::Tag *WMA::File::tag() const +-{ +- return d->tag; +-} +- +-WMA::Tag *WMA::File::WMATag() const +-{ +- return d->tag; +-} +- +-WMA::Properties *WMA::File::audioProperties() const +-{ +- return d->properties; +-} +- +-void WMA::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */) +-{ +- WMA::GUID guid; +- +- readGUID(guid); +- if(guid != GUID::header) { +- return; +- } +- +- int length = 0; +- int bitrate = 0; +- int sampleRate = 0; +- int channels = 0; +- +- d->tag = new WMA::Tag(); +- if(!d->tag) +- return; +- +- d->size = readQWORD(); +- d->numObjects = readDWORD(); +- seek(2, Current); +- +- for(int i = 0; i < (int)d->numObjects; i++) { +- +- readGUID(guid); +- long objectSize = (long)readQWORD(); +- +- if(readProperties && guid == GUID::fileProperties) { +- +- seek(16+8+8+8, Current); +- length = (int)(readQWORD() / 10000000L); +- seek(8+8+4+4+4+4, Current); +- +- } +- +- else if(readProperties && guid == GUID::streamProperties) { +- +- long pos = tell(); +- +- readGUID(guid); +- if(guid != GUID::audioMedia) { +- return; +- } +- +- seek(16+8+4+4+2+4+2, Current); +- channels = readWORD(); +- sampleRate = readDWORD(); +- bitrate = readDWORD() * 8 / 1000; +- +- seek(pos + (long)objectSize - 24); +- } +- +- else if(guid == GUID::extendedContentDescription) { +- +- d->offset2 = tell() - 16 - 8; +- d->size2 = (long)objectSize; +- +- int numDescriptors = readWORD(); +- +- for(int j = 0; j < numDescriptors; j++) { +- WMA::Attribute attr(*this); +- d->tag->setAttribute(attr.name().toCString(false), attr); +- } +- +- } +- +- else if(guid == GUID::contentDescription) { +- +- d->offset1 = tell() - 16 - 8; +- d->size1 = (long)objectSize; +- +- int titleLength = readWORD(); +- int artistLength = readWORD(); +- int copyrightLength = readWORD(); +- int commentLength = readWORD(); +- int ratingLength = readWORD(); +- +- String value; +- +- readString(titleLength, value); +- d->tag->setTitle(value); +- +- readString(artistLength, value); +- d->tag->setArtist(value); +- +- readString(copyrightLength, value); +- d->tag->setCopyright(value); +- +- readString(commentLength, value); +- d->tag->setComment(value); +- +- readString(ratingLength, value); +- d->tag->setRating(value); +- } +- +- else { +- seek((long)objectSize - 24, Current); +- } +- +- } +- +- if(readProperties) { +- d->properties = new WMA::Properties(); +- if(d->properties) +- d->properties->set(length, bitrate, sampleRate, channels); +- } +- +-} +- +-bool WMA::File::save() +-{ +- if(readOnly()) { +- return false; +- } +- +- if(d->offset1 == 0) { +- d->offset1 = 16 + 8 + 4 + 2; +- d->numObjects++; +- } +- +- if(d->offset2 == 0) { +- d->offset2 = 16 + 8 + 4 + 2; +- d->numObjects++; +- } +- +- ByteVector chunk1 = renderContentDescription(); +- ByteVector chunk2 = renderExtendedContentDescription(); +- +- if(d->offset1 > d->offset2) { +- insert(chunk1, d->offset1, d->size1); +- insert(chunk2, d->offset2, d->size2); +- } +- else { +- insert(chunk2, d->offset2, d->size2); +- insert(chunk1, d->offset1, d->size1); +- } +- +- insert(ByteVector::fromLongLong(d->size + +- (int)(chunk1.size() - d->size1) + +- (int)(chunk2.size() - d->size2), false) + +- ByteVector::fromUInt(d->numObjects, false), 16, 8 + 4); +- +- return true; +-} +- +-//////////////////////////////////////////////////////////////////////////////// +-// protected members +-//////////////////////////////////////////////////////////////////////////////// +- +-int WMA::File::readBYTE() +-{ +- ByteVector v = readBlock(1); +- return v[0]; +-} +- +-int WMA::File::readWORD() +-{ +- ByteVector v = readBlock(2); +- return v.toShort(false); +-} +- +-unsigned int WMA::File::readDWORD() +-{ +- ByteVector v = readBlock(4); +- return v.toUInt(false); +-} +- +-long long WMA::File::readQWORD() +-{ +- ByteVector v = readBlock(8); +- return v.toLongLong(false); +-} +- +-void WMA::File::readGUID(GUID &g) +-{ +- g.v1 = readDWORD(); +- g.v2 = readWORD(); +- g.v3 = readWORD(); +- for(int i = 0; i < 8; i++) +- g.v4[i] = readBYTE(); +-} +- +-void WMA::File::readString(int len, String &s) +-{ +- ByteVector v = readBlock(len); +- if(len < 2 || v[len-1] != 0 || v[len-2] != 0) +- v.append(ByteVector::fromShort(0)); +- s = String(v, String::UTF16LE); +-} +- +-ByteVector WMA::File::renderContentDescription() +-{ +- String s; +- +- s = d->tag->title(); +- ByteVector v1 = s.data(String::UTF16LE); +- if(s.size()) { +- v1.append((char)0); +- v1.append((char)0); +- } +- +- s = d->tag->artist(); +- ByteVector v2 = s.data(String::UTF16LE); +- if(s.size()) { +- v2.append((char)0); +- v2.append((char)0); +- } +- +- s = d->tag->copyright(); +- ByteVector v3 = s.data(String::UTF16LE); +- if(s.size()) { +- v3.append((char)0); +- v3.append((char)0); +- } +- +- s = d->tag->comment(); +- ByteVector v4 = s.data(String::UTF16LE); +- if(s.size()) { +- v4.append((char)0); +- v4.append((char)0); +- } +- +- s = d->tag->rating(); +- ByteVector v5 = s.data(String::UTF16LE); +- if(s.size()) { +- v5.append((char)0); +- v5.append((char)0); +- } +- +- ByteVector data; +- +- data.append(ByteVector::fromShort(v1.size(), false)); +- data.append(ByteVector::fromShort(v2.size(), false)); +- data.append(ByteVector::fromShort(v3.size(), false)); +- data.append(ByteVector::fromShort(v4.size(), false)); +- data.append(ByteVector::fromShort(v5.size(), false)); +- +- data.append(v1); +- data.append(v2); +- data.append(v3); +- data.append(v4); +- data.append(v5); +- +- data = ByteVector(reinterpret_cast(&GUID::contentDescription), sizeof(GUID)) +- + ByteVector::fromLongLong(data.size() + 16 + 8, false) +- + data; +- +- return data; +-} +- +-ByteVector WMA::File::renderExtendedContentDescription() +-{ +- ByteVector data; +- +- data.append(ByteVector::fromShort(d->tag->attributeMap().size(), false)); +- +- WMA::AttributeMap::ConstIterator it = d->tag->attributeMap().begin(); +- for(; it != d->tag->attributeMap().end(); it++) +- data.append(it->second.render()); +- +- data = ByteVector(reinterpret_cast(&GUID::extendedContentDescription), sizeof(GUID)) +- + ByteVector::fromLongLong(data.size() + 16 + 8, false) +- + data; +- +- return data; +-} +- +- +Index: amarok/src/metadata/wma/wmatag.h +=================================================================== +--- amarok/src/metadata/wma/wmatag.h (revision 705231) ++++ amarok/src/metadata/wma/wmatag.h (working copy) +@@ -1,188 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#ifndef TAGLIB_WMATAG_H +-#define TAGLIB_WMATAG_H +- +-#include +-#include +-#include "wmafile.h" +-#include "wmaattribute.h" +- +-namespace TagLib { +- +- namespace WMA { +- +- typedef Map AttributeMap; +- +- class Tag : public TagLib::Tag { +- +- friend class File; +- +- public: +- +- Tag(); +- +- virtual ~Tag(); +- +- /*! +- * Returns the track name. +- */ +- virtual String title() const; +- +- /*! +- * Returns the artist name. +- */ +- virtual String artist() const; +- +- /*! +- * Returns the album name; if no album name is present in the tag +- * String::null will be returned. +- */ +- virtual String album() const; +- +- /*! +- * Returns the track comment. +- */ +- virtual String comment() const; +- +- /*! +- * Returns the genre name; if no genre is present in the tag String::null +- * will be returned. +- */ +- virtual String genre() const; +- +- /*! +- * Returns the rating. +- */ +- virtual String rating() const; +- +- /*! +- * Returns the genre name; if no genre is present in the tag String::null +- * will be returned. +- */ +- virtual String copyright() const; +- +- /*! +- * Returns the year; if there is no year set, this will return 0. +- */ +- virtual uint year() const; +- +- /*! +- * Returns the track number; if there is no track number set, this will +- * return 0. +- */ +- virtual uint track() const; +- +- /*! +- * Sets the title to \a s. +- */ +- virtual void setTitle(const String &s); +- +- /*! +- * Sets the artist to \a s. +- */ +- virtual void setArtist(const String &s); +- +- /*! +- * Sets the album to \a s. If \a s is String::null then this value will be +- * cleared. +- */ +- virtual void setAlbum(const String &s); +- +- /*! +- * Sets the comment to \a s. +- */ +- virtual void setComment(const String &s); +- +- /*! +- * Sets the rating to \a s. +- */ +- virtual void setRating(const String &s); +- +- /*! +- * Sets the copyright to \a s. +- */ +- virtual void setCopyright(const String &s); +- +- /*! +- * Sets the genre to \a s. +- */ +- virtual void setGenre(const String &s); +- +- /*! +- * Sets the year to \a i. If \a s is 0 then this value will be cleared. +- */ +- virtual void setYear(uint i); +- +- /*! +- * Sets the track to \a i. If \a s is 0 then this value will be cleared. +- */ +- virtual void setTrack(uint i); +- +- /*! +- * Returns true if the tag does not contain any data. This should be +- * reimplemented in subclasses that provide more than the basic tagging +- * abilities in this class. +- */ +- virtual bool isEmpty() const; +- +- /*! +- * Copies the generic data from one tag to another. +- * +- * If \a overwrite is true then the values will be unconditionally copied. +- * If false only empty values will be overwritten. +- */ +- static void duplicate(const Tag *source, Tag *target, bool overwrite = true); +- +- /*! +- * Returns a reference to the item list map. This is an ItemListMap of +- * all of the items in the tag. +- * +- * This is the most powerfull structure for accessing the items of the tag. +- * +- * \warning You should not modify this data structure directly, instead +- * use setItem() and removeItem(). +- */ +- const AttributeMap &attributeMap() const; +- +- /*! +- * Removes the \a key attribute from the tag +- */ +- void removeItem(const ByteVector &key); +- +- void setAttribute(const ByteVector &key, const String &value); +- +- /*! +- * Sets the \a key attribute to the value of \a attribute. If an attribute +- * with the \a key is already present, it will be replaced. +- */ +- void setAttribute(const ByteVector &key, const Attribute &attribute); +- +- private: +- +- class TagPrivate; +- TagPrivate *d; +- +- }; +- } +-} +-#endif +Index: amarok/src/metadata/wma/wmaproperties.h +=================================================================== +--- amarok/src/metadata/wma/wmaproperties.h (revision 705231) ++++ amarok/src/metadata/wma/wmaproperties.h (working copy) +@@ -1,71 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#ifndef TAGLIB_WMAPROPERTIES_H +-#define TAGLIB_WMAPROPERTIES_H +- +-#include +-#include +- +-namespace TagLib { +- +- namespace WMA { +- +- class File; +- +- class Properties : public AudioProperties +- { +- +- friend class WMA::File; +- +- public: +- +- /*! +- * Create an instance of WMA::Properties. +- */ +- Properties(); +- +- /*! +- * Destroys this WMA::Properties instance. +- */ +- virtual ~Properties(); +- +- // Reimplementations. +- +- virtual int length() const; +- virtual int bitrate() const; +- virtual int sampleRate() const; +- virtual int channels() const; +- +- private: +- +- class PropertiesPrivate; +- PropertiesPrivate *d; +- +- void set(int length, int bitrate, int sampleRate, int channels); +- +- }; +- +- } +- +-} +- +-#endif +Index: amarok/src/metadata/wma/Makefile.am +=================================================================== +--- amarok/src/metadata/wma/Makefile.am (revision 705231) ++++ amarok/src/metadata/wma/Makefile.am (working copy) +@@ -1,20 +0,0 @@ +-SUBDIRS = +- +-INCLUDES = $(all_includes) $(taglib_includes) +-METASOURCES = AUTO +-libtagwma_la_LDFLAGS = $(all_libraries) +-noinst_LTLIBRARIES = libtagwma.la +- +-libtagwma_la_SOURCES = \ +- wmaattribute.cpp \ +- wmaproperties.cpp \ +- wmatag.cpp \ +- wmafile.cpp \ +- taglib_wmafiletyperesolver.cpp +- +-noinst_HEADERS = \ +- wmaattribute.h \ +- wmaproperties.h \ +- wmatag.h \ +- wmafile.h \ +- taglib_wmafiletyperesolver.h +Index: amarok/src/metadata/wma/wmaattribute.cpp +=================================================================== +--- amarok/src/metadata/wma/wmaattribute.cpp (revision 705231) ++++ amarok/src/metadata/wma/wmaattribute.cpp (working copy) +@@ -1,231 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#include +-#include +- +-using namespace TagLib; +- +-class WMA::Attribute::AttributePrivate +-{ +-public: +- AttributeTypes type; +- String name; +- String value_string; +- ByteVector value_bytes; +- union { +- int value_int; +- long long value_longlong; +- }; +-}; +- +-//////////////////////////////////////////////////////////////////////////////// +-// public members +-//////////////////////////////////////////////////////////////////////////////// +- +-WMA::Attribute::Attribute() +-{ +- d = new AttributePrivate; +- d->name = String::null; +- d->type = UnicodeType; +-} +- +-WMA::Attribute::Attribute(WMA::File &file) +-{ +- d = new AttributePrivate; +- parse(file); +-} +- +-WMA::Attribute::Attribute(const String &name, const String &value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = UnicodeType; +- d->value_string = value; +-} +- +-WMA::Attribute::Attribute(const String &name, const ByteVector &value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = BytesType; +- d->value_bytes = value; +-} +- +-WMA::Attribute::Attribute(const String &name, unsigned int value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = DWordType; +- d->value_int = value; +-} +- +-WMA::Attribute::Attribute(const String &name, unsigned long long value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = QWordType; +- d->value_longlong = value; +-} +- +-WMA::Attribute::Attribute(const String &name, unsigned short value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = WordType; +- d->value_int = value; +-} +- +-WMA::Attribute::Attribute(const String &name, bool value) +-{ +- d = new AttributePrivate; +- d->name = name; +- d->type = BoolType; +- d->value_int = value; +-} +- +-WMA::Attribute::Attribute(const Attribute &attr) +-{ +- d = new AttributePrivate(*attr.d); +-} +- +-WMA::Attribute::~Attribute() +-{ +- if(d) +- delete d; +-} +- +-String WMA::Attribute::name() const +-{ +- return d->name; +-} +- +-WMA::Attribute::AttributeTypes WMA::Attribute::type() const +-{ +- return d->type; +-} +- +-String WMA::Attribute::toString() const +-{ +- return d->value_string; +-} +- +-ByteVector WMA::Attribute::toByteVector() const +-{ +- return d->value_bytes; +-} +- +-int WMA::Attribute::toInt() const +-{ +- if (d->type == UnicodeType) +- return d->value_string.toInt(); +- else +- return d->value_int; +-} +- +-long long WMA::Attribute::toLongLong() const +-{ +- return d->value_longlong; +-} +- +-bool WMA::Attribute::parse(WMA::File &f) +-{ +- int size = f.readWORD(); +- f.readString(size, d->name); +- +- d->type = (WMA::Attribute::AttributeTypes)f.readWORD(); +- size = f.readWORD(); +- +- switch(d->type) { +- case WordType: +- d->value_int = f.readWORD(); +- break; +- +- case BoolType: +- case DWordType: +- d->value_int = f.readDWORD(); +- break; +- +- case QWordType: +- d->value_longlong = f.readQWORD(); +- break; +- +- case UnicodeType: +- f.readString(size, d->value_string); +- break; +- +- case BytesType: +- d->value_bytes = f.readBlock(size); +- break; +- +- default: +- return false; +- } +- +- return true; +-} +- +-ByteVector WMA::Attribute::render() const +-{ +- ByteVector data; +- +- ByteVector v = d->name.data(String::UTF16LE); +- data.append(ByteVector::fromShort(v.size() + 2, false)); +- data.append(v + ByteVector::fromShort(0, false)); +- +- data.append(ByteVector::fromShort((int)d->type, false)); +- +- switch (d->type) { +- case WordType: +- data.append(ByteVector::fromShort(2, false)); +- data.append(ByteVector::fromShort(d->value_int, false)); +- break; +- +- case BoolType: +- case DWordType: +- data.append(ByteVector::fromShort(4, false)); +- data.append(ByteVector::fromUInt(d->value_int, false)); +- break; +- +- case QWordType: +- data.append(ByteVector::fromShort(8, false)); +- data.append(ByteVector::fromLongLong(d->value_longlong, false)); +- break; +- +- case UnicodeType: +- v = d->value_string.data(String::UTF16LE); +- data.append(ByteVector::fromShort(v.size() + 2, false)); +- data.append(v + ByteVector::fromShort(0, false)); +- break; +- +- case BytesType: +- data.append(ByteVector::fromShort(d->value_bytes.size(), false)); +- data.append(d->value_bytes); +- break; +- +- default: +- return ByteVector::null; +- } +- +- return data; +-} +- +- +Index: amarok/src/metadata/wma/wmafile.h +=================================================================== +--- amarok/src/metadata/wma/wmafile.h (revision 705231) ++++ amarok/src/metadata/wma/wmafile.h (working copy) +@@ -1,100 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#ifndef TAGLIB_WMAFILE_H +-#define TAGLIB_WMAFILE_H +- +-#include +-#include +-#include "wmaproperties.h" +-#include "wmatag.h" +- +-namespace TagLib { +- +- namespace WMA { +- +- struct GUID; +- +- typedef unsigned char BYTE; +- typedef unsigned short WORD; +- typedef unsigned int DWORD; +- typedef unsigned long long QWORD; +- +- class File : public TagLib::File +- { +- +- friend class Attribute; +- +- public: +- +- File(const char *file, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average); +- +- virtual ~File(); +- +- /*! +- * Returns the TagLib::Tag for this file. +- */ +- virtual TagLib::Tag *tag() const; +- +- /*! +- * Returns the WMA::Tag for this file. +- */ +- virtual Tag *WMATag() const; +- +- /*! +- * Returns the WMA::Properties for this file. +- */ +- virtual Properties *audioProperties() const; +- +- +- /*! +- * Save the file. +- * +- * This returns true if the save was successful. +- */ +- virtual bool save(); +- +- protected: +- +- int readBYTE(); +- int readWORD(); +- unsigned int readDWORD(); +- long long readQWORD(); +- void readGUID(GUID &g); +- void readString(int len, String &s); +- +- ByteVector renderContentDescription(); +- ByteVector renderExtendedContentDescription(); +- +- void read(bool readProperties, Properties::ReadStyle propertiesStyle); +- +- private: +- +- class FilePrivate; +- FilePrivate *d; +- +- }; +- +- } +- +-} +- +-#endif +Index: amarok/src/metadata/wma/taglib_wmafiletyperesolver.cpp +=================================================================== +--- amarok/src/metadata/wma/taglib_wmafiletyperesolver.cpp (revision 705231) ++++ amarok/src/metadata/wma/taglib_wmafiletyperesolver.cpp (working copy) +@@ -1,47 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Martin Aumueller +- email : aumuell@reserv.at +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-// (c) 2005 Martin Aumueller +-// See COPYING file for licensing information +- +-#include "taglib_wmafiletyperesolver.h" +-#include "wmafile.h" +- +-#include +- +-TagLib::File *WMAFileTypeResolver::createFile(const char *fileName, +- bool readProperties, +- TagLib::AudioProperties::ReadStyle propertiesStyle) const +-{ +- const char *ext = strrchr(fileName, '.'); +- if(ext && (!strcasecmp(ext, ".wma") || !strcasecmp(ext, ".asf"))) +- { +- TagLib::WMA::File *f = new TagLib::WMA::File(fileName, readProperties, propertiesStyle); +- if(f->isValid()) +- return f; +- else +- { +- delete f; +- } +- } +- +- return 0; +-} +Index: amarok/src/metadata/wma/wmaattribute.h +=================================================================== +--- amarok/src/metadata/wma/wmaattribute.h (revision 705231) ++++ amarok/src/metadata/wma/wmaattribute.h (working copy) +@@ -1,125 +0,0 @@ +-/*************************************************************************** +- copyright : (C) 2005 by Lukas Lalinsky +- email : lalinsky@gmail.com +- ***************************************************************************/ +- +-/*************************************************************************** +- * This library is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Lesser General Public License version * +- * 2.1 as published by the Free Software Foundation. * +- * * +- * This library is distributed in the hope that it will be useful, but * +- * WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +- * Lesser General Public License for more details. * +- * * +- * You should have received a copy of the GNU Lesser General Public * +- * License along with this library; if not, write to the Free Software * +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +- * MA 02110-1301 USA * +- ***************************************************************************/ +- +-#ifndef TAGLIB_WMAATTRIBUTE_H +-#define TAGLIB_WMAATTRIBUTE_H +- +-#include +-#include +- +-namespace TagLib { +- +- namespace WMA { +- +- class File; +- +- class Attribute { +- +- friend class File; +- +- public: +- +- /*! +- * Enum of types an Attribute can have. +- */ +- enum AttributeTypes { +- UnicodeType = 0, +- BytesType = 1, +- BoolType = 2, +- DWordType = 3, +- QWordType = 4, +- WordType = 5 +- }; +- +- /*! +- * Constructs an empty attribute. +- */ +- Attribute(); +- +- /*! +- * Constructs an attribute with \a key and \a value. +- */ +- Attribute(const String &key, const String &value); +- Attribute(const String &key, const ByteVector &value); +- Attribute(const String &key, unsigned int value); +- Attribute(const String &key, unsigned long long value); +- Attribute(const String &key, unsigned short value); +- Attribute(const String &key, bool value); +- +- /*! +- * Construct an attribute as a copy of \a item. +- */ +- Attribute(const Attribute &item); +- +- /*! +- * Destroys the attribute. +- */ +- virtual ~Attribute(); +- +- /*! +- * Returns the name. +- */ +- String name() const; +- +- /*! +- * Returns type of the value. +- */ +- AttributeTypes type() const; +- +- /*! +- * Returns the value as a String. +- */ +- String toString() const; +- +- /*! +- * Returns the value as a ByteVector. +- */ +- ByteVector toByteVector() const; +- +- /*! +- * Returns the value as an integer. +- */ +- int toInt() const; +- +- /*! +- * Returns the value as a long long. +- */ +- long long toLongLong() const; +- +- ByteVector render() const; +- +- protected: +- +- Attribute(WMA::File &file); +- bool parse(WMA::File &file); +- +- private: +- +- class AttributePrivate; +- AttributePrivate *d; +- +- }; +- +- } +- +-} +- +-#endif + +Property changes on: amarok/src/metadata/wma +___________________________________________________________________ +Name: svn:ignore + - .libs +.deps +Makefile +Makefile.in + + +Index: amarok/src/metadata/tplugins.cpp +=================================================================== +--- amarok/src/metadata/tplugins.cpp (revision 705231) ++++ amarok/src/metadata/tplugins.cpp (working copy) +@@ -42,8 +42,8 @@ + #include "wavpack/wvfile.h" + #include "speex/taglib_speexfiletyperesolver.h" + #include "speex/speexfile.h" +-#include "wma/taglib_wmafiletyperesolver.h" +-#include "wma/wmafile.h" ++#include "asf/taglib_asffiletyperesolver.h" ++#include "asf/asffile.h" + #include "rmff/taglib_realmediafiletyperesolver.h" + #include "rmff/taglib_realmediafile.h" + #include "audible/taglib_audiblefiletyperesolver.h" +@@ -95,7 +95,7 @@ + || mimetype->is( "video/x-msvideo" ) + || mimetype->is( "video/x-ms-wmv" ) ) + { +- return new TagLib::WMA::File(fileName, readProperties, propertiesStyle); ++ return new TagLib::ASF::File(fileName, readProperties, propertiesStyle); + } + else if( mimetype->is( "audio/vnd.rn-realaudio" ) + || mimetype->is( "audio/x-pn-realaudio" ) +@@ -130,7 +130,7 @@ + { + //TagLib::FileRef::addFileTypeResolver(new MimeTypeFileTypeResolver); + TagLib::FileRef::addFileTypeResolver(new MP4FileTypeResolver); +- TagLib::FileRef::addFileTypeResolver(new WMAFileTypeResolver); ++ TagLib::FileRef::addFileTypeResolver(new ASFFileTypeResolver); + TagLib::FileRef::addFileTypeResolver(new RealMediaFileTypeResolver); + TagLib::FileRef::addFileTypeResolver(new AudibleFileTypeResolver); + TagLib::FileRef::addFileTypeResolver(new AACFileTypeResolver); +Index: amarok/src/metadata/Makefile.am +=================================================================== +--- amarok/src/metadata/Makefile.am (revision 705231) ++++ amarok/src/metadata/Makefile.am (working copy) +@@ -6,7 +6,7 @@ + MP4_LDADD = m4a/libtagm4a.la + endif + +-SUBDIRS = speex wavpack trueaudio wma audible rmff $(MP4_SUBDIR) aac wav ++SUBDIRS = speex wavpack trueaudio asf audible rmff $(MP4_SUBDIR) aac wav + + + INCLUDES = -I$(top_srcdir)/amarok/src $(all_includes) $(taglib_includes) +@@ -24,7 +24,7 @@ + speex/libtagspeex.la \ + trueaudio/libtagtrueaudio.la \ + wavpack/libtagwavpack.la \ +- wma/libtagwma.la \ ++ asf/libtagasf.la \ + wav/libtagwav.la \ + rmff/libtagrealmedia.la \ + $(MP4_LDADD) \ diff --git a/amarok.spec b/amarok.spec index e47641d..66b5ba3 100644 --- a/amarok.spec +++ b/amarok.spec @@ -1,10 +1,12 @@ # TODO: # Rio Karma support : libkarma +%define _with_mp4v2 --with-mp4v2 + Name: amarok Summary: Media player Version: 1.4.7 -Release: 11%{?dist} +Release: 12%{?dist} Group: Applications/Multimedia License: GPLv2+ @@ -21,8 +23,12 @@ Patch2: amarok-1.4.7-xdg.patch # http://bugs.kde.org/148317 - dynamic mode floods playlist ... # http://websvn.kde.org/branches/stable/extragear/multimedia/amarok/src/playlist.cpp?r1=705494&r2=705493&pathrev=705494&view=patch Patch3: amarok-1.4.7-148317.patch +# fix asf/wma support (with recent taglib) +# svn diff amarok/src/metadata --revision 705231 +Patch4: amarok-asf.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: automake libtool BuildRequires: alsa-lib-devel BuildRequires: desktop-file-utils BuildRequires: esound-devel @@ -40,6 +46,7 @@ BuildRequires: taglib-devel BuildRequires: libifp-devel # Ipod BuildRequires: libgpod-devel +%{?_with_mp4v2:BuildRequires: libmp4v2-devel} # MTP players BuildRequires: libmtp-devel BuildRequires: libmusicbrainz-devel @@ -99,12 +106,16 @@ use any of xmms' visualisation plugins with Amarok. %prep -%setup -q +%setup -q + %patch0 -p0 -b .147126 %patch1 -p1 -b .utf8 %patch2 -p1 -b .xdg %patch3 -p4 -b .148317 +%patch4 -p0 -b .asf +# for patch4 +make -f admin/Makefile.common %build @@ -120,7 +131,8 @@ unset QTDIR && . %{_sysconfdir}/profile.d/qt.sh %ifnarch ppc64 x86_64 s390 s390x ia64 sparc sparc64 alpha --with-helix=%{_libdir}/helix \ %endif - %{?_with_gstreamer} + %{?_with_gstreamer} \ + %{?_with_livm4v2} # --enable-final \ # --with-nmm \ @@ -148,12 +160,14 @@ desktop-file-install --vendor "" \ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la -%find_lang %{name} +%find_lang %{name} # HTML for lang_dir in $RPM_BUILD_ROOT%{_docdir}/HTML/* ; do - lang=$(basename $lang_dir) - [ "$lang" == "en" ] && d=en/%{name} || d=$lang - echo "%lang($lang) %doc %{_docdir}/HTML/$d" >> %{name}.lang + if [ -d $lang_dir ]; then + lang=$(basename $lang_dir) + [ "$lang" == "en" ] && d=en/%{name} || d=$lang + echo "%lang($lang) %doc %{_docdir}/HTML/$d" >> %{name}.lang + fi done @@ -248,14 +262,16 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/services/amarok_helixengine_plugin.desktop %endif - %files visualisation %defattr(-,root,root,-) %{_bindir}/amarok_libvisual - %changelog +* Thu Nov 29 2007 Rex Dieter 1.4.7-12 +- --with-mp4v2 (rh#346011) +- fix asf/wma support (rh#346011,kde#151733) + * Wed Nov 21 2007 Rex Dieter 1.4.7-11 - dynamic mode floods playlist ... (kde #148317)