TagLib  1.13.1
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 
38 namespace TagLib {
39  namespace MP4 {
45 
47  {
48  public:
49  Tag();
50  Tag(TagLib::File *file, Atoms *atoms);
51  virtual ~Tag();
52  bool save();
53 
54  virtual String title() const;
55  virtual String artist() const;
56  virtual String album() const;
57  virtual String comment() const;
58  virtual String genre() const;
59  virtual unsigned int year() const;
60  virtual unsigned int track() const;
61 
62  virtual void setTitle(const String &value);
63  virtual void setArtist(const String &value);
64  virtual void setAlbum(const String &value);
65  virtual void setComment(const String &value);
66  virtual void setGenre(const String &value);
67  virtual void setYear(unsigned int value);
68  virtual void setTrack(unsigned int value);
69 
70  virtual bool isEmpty() const;
71 
76 
80  const ItemMap &itemMap() const;
81 
85  Item item(const String &key) const;
86 
90  void setItem(const String &key, const Item &value);
91 
96  void removeItem(const String &key);
97 
101  bool contains(const String &key) const;
102 
106  bool strip();
107 
109  void removeUnsupportedProperties(const StringList& properties);
111 
112  protected:
117  void setTextItem(const String &key, const String &value);
118 
119  private:
120  AtomDataList parseData2(const Atom *atom, int expectedFlags = -1,
121  bool freeForm = false);
122  ByteVectorList parseData(const Atom *atom, int expectedFlags = -1,
123  bool freeForm = false);
124  void parseText(const Atom *atom, int expectedFlags = 1);
125  void parseFreeForm(const Atom *atom);
126  void parseInt(const Atom *atom);
127  void parseByte(const Atom *atom);
128  void parseUInt(const Atom *atom);
129  void parseLongLong(const Atom *atom);
130  void parseGnre(const Atom *atom);
131  void parseIntPair(const Atom *atom);
132  void parseBool(const Atom *atom);
133  void parseCovr(const Atom *atom);
134 
135  ByteVector padIlst(const ByteVector &data, int length = -1) const;
136  ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
137  ByteVector renderData(const ByteVector &name, int flags,
138  const ByteVectorList &data) const;
139  ByteVector renderText(const ByteVector &name, const Item &item,
140  int flags = TypeUTF8) const;
141  ByteVector renderFreeForm(const String &name, const Item &item) const;
142  ByteVector renderBool(const ByteVector &name, const Item &item) const;
143  ByteVector renderInt(const ByteVector &name, const Item &item) const;
144  ByteVector renderByte(const ByteVector &name, const Item &item) const;
145  ByteVector renderUInt(const ByteVector &name, const Item &item) const;
146  ByteVector renderLongLong(const ByteVector &name, const Item &item) const;
147  ByteVector renderIntPair(const ByteVector &name, const Item &item) const;
148  ByteVector renderIntPairNoTrailing(const ByteVector &name, const Item &item) const;
149  ByteVector renderCovr(const ByteVector &name, const Item &item) const;
150 
151  void updateParents(const AtomList &path, long delta, int ignore = 0);
152  void updateOffsets(long delta, long offset);
153 
154  void saveNew(ByteVector data);
155  void saveExisting(ByteVector data, const AtomList &path);
156 
157  void addItem(const String &name, const Item &value);
158 
159  class TagPrivate;
160  TagPrivate *d;
161  };
162  } // namespace MP4
163 } // namespace TagLib
164 #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:36
Definition: mp4tag.h:47
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)
const ItemMap & itemMap() const
void removeItem(const String &key)
void setTextItem(const String &key, const String &value)
virtual bool isEmpty() const
virtual unsigned int year() const
virtual String title() const
virtual void setGenre(const String &value)
TAGLIB_DEPRECATED ItemMap & itemListMap()
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:43
TagLib::Map< String, Item > ItemMap
Definition: mp4tag.h:44
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