TagLib API Documentation
mp4atom.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// This file is not part of the public API!
27
28#ifndef TAGLIB_MP4ATOM_H
29#define TAGLIB_MP4ATOM_H
30
31#include "tfile.h"
32#include "tlist.h"
33
34namespace TagLib {
35 namespace MP4 {
36
38 TypeImplicit = 0, // for use with tags for which no type needs to be indicated because only one type is allowed
39 TypeUTF8 = 1, // without any count or null terminator
40 TypeUTF16 = 2, // also known as UTF-16BE
41 TypeSJIS = 3, // deprecated unless it is needed for special Japanese characters
42 TypeHTML = 6, // the HTML file header specifies which HTML version
43 TypeXML = 7, // the XML header must identify the DTD or schemas
44 TypeUUID = 8, // also known as GUID; stored as 16 bytes in binary (valid as an ID)
45 TypeISRC = 9, // stored as UTF-8 text (valid as an ID)
46 TypeMI3P = 10, // stored as UTF-8 text (valid as an ID)
47 TypeGIF = 12, // (deprecated) a GIF image
48 TypeJPEG = 13, // a JPEG image
49 TypePNG = 14, // a PNG image
50 TypeURL = 15, // absolute, in UTF-8 characters
51 TypeDuration = 16, // in milliseconds, 32-bit integer
52 TypeDateTime = 17, // in UTC, counting seconds since midnight, January 1, 1904; 32 or 64-bits
53 TypeGenred = 18, // a list of enumerated values
54 TypeInteger = 21, // a signed big-endian integer with length one of { 1,2,3,4,8 } bytes
55 TypeRIAAPA = 24, // RIAA parental advisory; { -1=no, 1=yes, 0=unspecified }, 8-bit integer
56 TypeUPC = 25, // Universal Product Code, in text UTF-8 format (valid as an ID)
57 TypeBMP = 27, // Windows bitmap image
58 TypeUndefined = 255 // undefined
59 };
60
61#ifndef DO_NOT_DOCUMENT
62 struct AtomData {
63 AtomData(AtomDataType type, const ByteVector &data) :
64 type(type), data(data) { }
65 AtomDataType type;
66 int locale { 0 };
67 ByteVector data;
68 };
69
70 class Atom;
71 using AtomList = TagLib::List<Atom *>;
72 using AtomDataList = TagLib::List<AtomData>;
73
74 class TAGLIB_EXPORT Atom
75 {
76 public:
77 Atom(File *file);
78 ~Atom();
79 Atom(const Atom &) = delete;
80 Atom &operator=(const Atom &) = delete;
81 Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
82 bool path(AtomList &path, const char *name1, const char *name2 = nullptr, const char *name3 = nullptr);
83 AtomList findall(const char *name, bool recursive = false) const;
84 void addToOffset(offset_t delta);
85 void prependChild(Atom *atom);
86 bool removeChild(Atom *meta);
87 offset_t offset() const;
88 offset_t length() const;
89 const ByteVector &name() const;
90 const AtomList &children() const;
91
92 private:
93 class AtomPrivate;
95 std::unique_ptr<AtomPrivate> d;
96 };
97
99 class TAGLIB_EXPORT Atoms
100 {
101 public:
102 Atoms(File *file);
103 ~Atoms();
104 Atoms(const Atoms &) = delete;
105 Atoms &operator=(const Atoms &) = delete;
106 Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr) const;
107 AtomList path(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr) const;
108 bool checkRootLevelAtoms();
109 const AtomList &atoms() const;
110
111 private:
112 class AtomsPrivate;
114 std::unique_ptr<AtomsPrivate> d;
115 };
116#endif // DO_NOT_DOCUMENT
117 } // namespace MP4
118} // namespace TagLib
119
120#endif
A byte vector.
Definition: tbytevector.h:46
A generic, implicitly shared list.
Definition: tlist.h:54
AtomDataType
Definition: mp4atom.h:37
@ TypeGenred
Definition: mp4atom.h:53
@ TypeUUID
Definition: mp4atom.h:44
@ TypeBMP
Definition: mp4atom.h:57
@ TypeMI3P
Definition: mp4atom.h:46
@ TypeImplicit
Definition: mp4atom.h:38
@ TypeXML
Definition: mp4atom.h:43
@ TypeDuration
Definition: mp4atom.h:51
@ TypeUndefined
Definition: mp4atom.h:58
@ TypeISRC
Definition: mp4atom.h:45
@ TypeURL
Definition: mp4atom.h:50
@ TypeUPC
Definition: mp4atom.h:56
@ TypeSJIS
Definition: mp4atom.h:41
@ TypeUTF16
Definition: mp4atom.h:40
@ TypeUTF8
Definition: mp4atom.h:39
@ TypeInteger
Definition: mp4atom.h:54
@ TypeRIAAPA
Definition: mp4atom.h:55
@ TypePNG
Definition: mp4atom.h:49
@ TypeJPEG
Definition: mp4atom.h:48
@ TypeHTML
Definition: mp4atom.h:42
@ TypeGIF
Definition: mp4atom.h:47
@ TypeDateTime
Definition: mp4atom.h:52
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
off_t offset_t
Definition: taglib.h:64
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55