mp4tag.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef TAGLIB_MP4TAG_H
00027 #define TAGLIB_MP4TAG_H
00028
00029 #include "tag.h"
00030 #include "tbytevectorlist.h"
00031 #include "tfile.h"
00032 #include "tmap.h"
00033 #include "tstringlist.h"
00034 #include "taglib_export.h"
00035 #include "mp4atom.h"
00036 #include "mp4item.h"
00037
00038 namespace TagLib {
00039
00040 namespace MP4 {
00041
00045 typedef TagLib::Map<String, Item> ItemListMap;
00046 typedef TagLib::Map<String, Item> ItemMap;
00047
00048 class TAGLIB_EXPORT Tag: public TagLib::Tag
00049 {
00050 public:
00051 Tag();
00052 Tag(TagLib::File *file, Atoms *atoms);
00053 virtual ~Tag();
00054 bool save();
00055
00056 virtual String title() const;
00057 virtual String artist() const;
00058 virtual String album() const;
00059 virtual String comment() const;
00060 virtual String genre() const;
00061 virtual unsigned int year() const;
00062 virtual unsigned int track() const;
00063
00064 virtual void setTitle(const String &value);
00065 virtual void setArtist(const String &value);
00066 virtual void setAlbum(const String &value);
00067 virtual void setComment(const String &value);
00068 virtual void setGenre(const String &value);
00069 virtual void setYear(unsigned int value);
00070 virtual void setTrack(unsigned int value);
00071
00072 virtual bool isEmpty() const;
00073
00077 ItemMap &itemListMap();
00078
00082 const ItemMap &itemMap() const;
00083
00087 Item item(const String &key) const;
00088
00092 void setItem(const String &key, const Item &value);
00093
00098 void removeItem(const String &key);
00099
00103 bool contains(const String &key) const;
00104
00105 PropertyMap properties() const;
00106 void removeUnsupportedProperties(const StringList& properties);
00107 PropertyMap setProperties(const PropertyMap &properties);
00108
00109 private:
00110 AtomDataList parseData2(const Atom *atom, int expectedFlags = -1,
00111 bool freeForm = false);
00112 ByteVectorList parseData(const Atom *atom, int expectedFlags = -1,
00113 bool freeForm = false);
00114 void parseText(const Atom *atom, int expectedFlags = 1);
00115 void parseFreeForm(const Atom *atom);
00116 void parseInt(const Atom *atom);
00117 void parseByte(const Atom *atom);
00118 void parseUInt(const Atom *atom);
00119 void parseLongLong(const Atom *atom);
00120 void parseGnre(const Atom *atom);
00121 void parseIntPair(const Atom *atom);
00122 void parseBool(const Atom *atom);
00123 void parseCovr(const Atom *atom);
00124
00125 ByteVector padIlst(const ByteVector &data, int length = -1) const;
00126 ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
00127 ByteVector renderData(const ByteVector &name, int flags,
00128 const ByteVectorList &data) const;
00129 ByteVector renderText(const ByteVector &name, const Item &item,
00130 int flags = TypeUTF8) const;
00131 ByteVector renderFreeForm(const String &name, const Item &item) const;
00132 ByteVector renderBool(const ByteVector &name, const Item &item) const;
00133 ByteVector renderInt(const ByteVector &name, const Item &item) const;
00134 ByteVector renderByte(const ByteVector &name, const Item &item) const;
00135 ByteVector renderUInt(const ByteVector &name, const Item &item) const;
00136 ByteVector renderLongLong(const ByteVector &name, const Item &item) const;
00137 ByteVector renderIntPair(const ByteVector &name, const Item &item) const;
00138 ByteVector renderIntPairNoTrailing(const ByteVector &name, const Item &item) const;
00139 ByteVector renderCovr(const ByteVector &name, const Item &item) const;
00140
00141 void updateParents(const AtomList &path, long delta, int ignore = 0);
00142 void updateOffsets(long delta, long offset);
00143
00144 void saveNew(ByteVector data);
00145 void saveExisting(ByteVector data, const AtomList &path);
00146
00147 void addItem(const String &name, const Item &value);
00148
00149 class TagPrivate;
00150 TagPrivate *d;
00151 };
00152
00153 }
00154
00155 }
00156
00157 #endif