TagLib  1.13
mp4tag.h
Go to the documentation of this file.
1/**************************************************************************
2 copyright : (C) 2007,2011 by Lukáš Lalinský
3 email : lalinsky@gmail.com
4 **************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_MP4TAG_H
27#define TAGLIB_MP4TAG_H
28
29#include "tag.h"
30#include "tbytevectorlist.h"
31#include "tfile.h"
32#include "tmap.h"
33#include "tstringlist.h"
34#include "taglib_export.h"
35#include "mp4atom.h"
36#include "mp4item.h"
37
38namespace TagLib {
39
40 namespace MP4 {
41
47
49 {
50 public:
51 Tag();
52 Tag(TagLib::File *file, Atoms *atoms);
53 virtual ~Tag();
54 bool save();
55
56 virtual String title() const;
57 virtual String artist() const;
58 virtual String album() const;
59 virtual String comment() const;
60 virtual String genre() const;
61 virtual unsigned int year() const;
62 virtual unsigned int track() const;
63
64 virtual void setTitle(const String &value);
65 virtual void setArtist(const String &value);
66 virtual void setAlbum(const String &value);
67 virtual void setComment(const String &value);
68 virtual void setGenre(const String &value);
69 virtual void setYear(unsigned int value);
70 virtual void setTrack(unsigned int value);
71
72 virtual bool isEmpty() const;
73
78
82 const ItemMap &itemMap() const;
83
87 Item item(const String &key) const;
88
92 void setItem(const String &key, const Item &value);
93
98 void removeItem(const String &key);
99
103 bool contains(const String &key) const;
104
108 bool strip();
109
113
114 protected:
119 void setTextItem(const String &key, const String &value);
120
121 private:
122 AtomDataList parseData2(const Atom *atom, int expectedFlags = -1,
123 bool freeForm = false);
124 ByteVectorList parseData(const Atom *atom, int expectedFlags = -1,
125 bool freeForm = false);
126 void parseText(const Atom *atom, int expectedFlags = 1);
127 void parseFreeForm(const Atom *atom);
128 void parseInt(const Atom *atom);
129 void parseByte(const Atom *atom);
130 void parseUInt(const Atom *atom);
131 void parseLongLong(const Atom *atom);
132 void parseGnre(const Atom *atom);
133 void parseIntPair(const Atom *atom);
134 void parseBool(const Atom *atom);
135 void parseCovr(const Atom *atom);
136
137 ByteVector padIlst(const ByteVector &data, int length = -1) const;
138 ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
139 ByteVector renderData(const ByteVector &name, int flags,
140 const ByteVectorList &data) const;
141 ByteVector renderText(const ByteVector &name, const Item &item,
142 int flags = TypeUTF8) const;
143 ByteVector renderFreeForm(const String &name, const Item &item) const;
144 ByteVector renderBool(const ByteVector &name, const Item &item) const;
145 ByteVector renderInt(const ByteVector &name, const Item &item) const;
146 ByteVector renderByte(const ByteVector &name, const Item &item) const;
147 ByteVector renderUInt(const ByteVector &name, const Item &item) const;
148 ByteVector renderLongLong(const ByteVector &name, const Item &item) const;
149 ByteVector renderIntPair(const ByteVector &name, const Item &item) const;
150 ByteVector renderIntPairNoTrailing(const ByteVector &name, const Item &item) const;
151 ByteVector renderCovr(const ByteVector &name, const Item &item) const;
152
153 void updateParents(const AtomList &path, long delta, int ignore = 0);
154 void updateOffsets(long delta, long offset);
155
156 void saveNew(ByteVector data);
157 void saveExisting(ByteVector data, const AtomList &path);
158
159 void addItem(const String &name, const Item &value);
160
161 class TagPrivate;
162 TagPrivate *d;
163 };
164
165 }
166
167}
168
169#endif
A list of ByteVectors.
Definition: tbytevectorlist.h:42
A byte vector.
Definition: tbytevector.h:46
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
Definition: mp4item.h:38
Definition: mp4tag.h:49
virtual String artist() const
void removeUnsupportedProperties(const StringList &properties)
virtual void setTitle(const String &value)
virtual void setComment(const String &value)
virtual String album() const
void setItem(const String &key, const Item &value)
void removeItem(const String &key)
void setTextItem(const String &key, const String &value)
virtual bool isEmpty() const
virtual unsigned int year() const
TAGLIB_DEPRECATED ItemMap & itemListMap()
virtual String title() const
virtual void setGenre(const String &value)
const ItemMap & itemMap() const
virtual String comment() const
virtual void setTrack(unsigned int value)
bool contains(const String &key) const
Tag(TagLib::File *file, Atoms *atoms)
PropertyMap properties() const
PropertyMap setProperties(const PropertyMap &properties)
virtual void setArtist(const String &value)
virtual unsigned int track() const
virtual void setYear(unsigned int value)
virtual void setAlbum(const String &value)
Item item(const String &key) const
virtual String genre() const
A generic, implicitly shared map.
Definition: tmap.h:44
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
A list of strings.
Definition: tstringlist.h:46
A wide string class suitable for unicode.
Definition: tstring.h:85
Definition: tag.h:47
TAGLIB_DEPRECATED typedef TagLib::Map< String, Item > ItemListMap
Definition: mp4tag.h:45
TagLib::Map< String, Item > ItemMap
Definition: mp4tag.h:46
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
#define TAGLIB_EXPORT
Definition: taglib_export.h:40