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 
40  namespace MP4 {
41 
47 
49  {
50  public:
51  Tag();
52  Tag(TagLib::File *file, Atoms *atoms);
53  ~Tag();
54  bool save();
55 
56  String title() const;
57  String artist() const;
58  String album() const;
59  String comment() const;
60  String genre() const;
61  uint year() const;
62  uint track() const;
63 
64  void setTitle(const String &value);
65  void setArtist(const String &value);
66  void setAlbum(const String &value);
67  void setComment(const String &value);
68  void setGenre(const String &value);
69  void setYear(uint value);
70  void setTrack(uint value);
71 
72  virtual bool isEmpty() const;
73 
77  ItemMap &itemListMap();
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 
105  PropertyMap properties() const;
106  void removeUnsupportedProperties(const StringList& properties);
107  PropertyMap setProperties(const PropertyMap &properties);
108 
109  private:
110  AtomDataList parseData2(const Atom *atom, int expectedFlags = -1,
111  bool freeForm = false);
112  ByteVectorList parseData(const Atom *atom, int expectedFlags = -1,
113  bool freeForm = false);
114  void parseText(const Atom *atom, int expectedFlags = 1);
115  void parseFreeForm(const Atom *atom);
116  void parseInt(const Atom *atom);
117  void parseByte(const Atom *atom);
118  void parseUInt(const Atom *atom);
119  void parseLongLong(const Atom *atom);
120  void parseGnre(const Atom *atom);
121  void parseIntPair(const Atom *atom);
122  void parseBool(const Atom *atom);
123  void parseCovr(const Atom *atom);
124 
125  ByteVector padIlst(const ByteVector &data, int length = -1) const;
126  ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
127  ByteVector renderData(const ByteVector &name, int flags,
128  const ByteVectorList &data) const;
129  ByteVector renderText(const ByteVector &name, const Item &item,
130  int flags = TypeUTF8) const;
131  ByteVector renderFreeForm(const String &name, const Item &item) const;
132  ByteVector renderBool(const ByteVector &name, const Item &item) const;
133  ByteVector renderInt(const ByteVector &name, const Item &item) const;
134  ByteVector renderByte(const ByteVector &name, const Item &item) const;
135  ByteVector renderUInt(const ByteVector &name, const Item &item) const;
136  ByteVector renderLongLong(const ByteVector &name, const Item &item) const;
137  ByteVector renderIntPair(const ByteVector &name, const Item &item) const;
138  ByteVector renderIntPairNoTrailing(const ByteVector &name, const Item &item) const;
139  ByteVector renderCovr(const ByteVector &name, const Item &item) const;
140 
141  void updateParents(const AtomList &path, long delta, int ignore = 0);
142  void updateOffsets(long delta, long offset);
143 
144  void saveNew(ByteVector data);
145  void saveExisting(ByteVector data, const AtomList &path);
146 
147  void addItem(const String &name, const Item &value);
148 
149  class TagPrivate;
150  TagPrivate *d;
151  };
152 
153  }
154 
155 }
156 
157 #endif
A list of ByteVectors.
Definition: tbytevectorlist.h:41
unsigned int uint
Definition: taglib.h:66
TagLib::Map< String, Item > ItemMap
Definition: mp4tag.h:46
A map for format-independent tag representations.
Definition: tpropertymap.h:104
Definition: tag.h:46
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
A wide string class suitable for unicode.
Definition: tstring.h:84
A byte vector.
Definition: tbytevector.h:45
A generic, implicitly shared map.
Definition: tmap.h:43
Definition: mp4item.h:37
A list of strings.
Definition: tstringlist.h:45
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
String TAGLIB_EXPORT genre(int index)
TagLib::Map< String, Item > ItemListMap
Definition: mp4tag.h:45
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41