TagLib  2.0.2
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 "tfile.h"
30 #include "tmap.h"
31 #include "tstringlist.h"
32 #include "taglib_export.h"
33 #include "tag.h"
34 #include "mp4atom.h"
35 #include "mp4item.h"
36 
37 namespace TagLib {
38  namespace MP4 {
39 
40  class ItemFactory;
41 
44  {
45  public:
46  Tag();
47  Tag(TagLib::File *file, Atoms *atoms,
48  const ItemFactory *factory = nullptr);
49  ~Tag() override;
50  Tag(const Tag &) = delete;
51  Tag &operator=(const Tag &) = delete;
52  bool save();
53 
54  String title() const override;
55  String artist() const override;
56  String album() const override;
57  String comment() const override;
58  String genre() const override;
59  unsigned int year() const override;
60  unsigned int track() const override;
61 
62  void setTitle(const String &value) override;
63  void setArtist(const String &value) override;
64  void setAlbum(const String &value) override;
65  void setComment(const String &value) override;
66  void setGenre(const String &value) override;
67  void setYear(unsigned int value) override;
68  void setTrack(unsigned int value) override;
69 
70  bool isEmpty() const override;
71 
75  const ItemMap &itemMap() const;
76 
80  Item item(const String &key) const;
81 
85  void setItem(const String &key, const Item &value);
86 
91  void removeItem(const String &key);
92 
96  bool contains(const String &key) const;
97 
101  bool strip();
102 
103  PropertyMap properties() const override;
104  void removeUnsupportedProperties(const StringList &props) override;
105  PropertyMap setProperties(const PropertyMap &props) override;
106 
107  StringList complexPropertyKeys() const override;
108  List<VariantMap> complexProperties(const String &key) const override;
109  bool setComplexProperties(const String &key, const List<VariantMap> &value) override;
110 
111  protected:
116  void setTextItem(const String &key, const String &value);
117 
118  private:
119  ByteVector padIlst(const ByteVector &data, int length = -1) const;
120  ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
121 
122 
123  void updateParents(const AtomList &path, offset_t delta, int ignore = 0);
124  void updateOffsets(offset_t delta, offset_t offset);
125 
126  void saveNew(ByteVector data);
127  void saveExisting(ByteVector data, const AtomList &path);
128 
129  void addItem(const String &name, const Item &value);
130 
131  class TagPrivate;
133  std::unique_ptr<TagPrivate> d;
134  };
135  } // namespace MP4
136 } // namespace TagLib
137 #endif
A generic, implicitly shared list.
Definition: tlist.h:53
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:122
A simple, generic interface to common audio metadata fields.
Definition: tag.h:48
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
A wide string class suitable for unicode.
Definition: tstring.h:82
A byte vector.
Definition: tbytevector.h:45
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
A generic, implicitly shared map.
Definition: tmap.h:44
MP4 item.
Definition: mp4item.h:36
A list of strings.
Definition: tstringlist.h:43
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
An MP4 tag implementation.
Definition: mp4tag.h:43
A factory for creating MP4 items during parsing.
Definition: mp4itemfactory.h:69
String TAGLIB_EXPORT genre(int index)
off_t offset_t
Definition: taglib.h:64
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41