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