![]() |
|
00001 /************************************************************************** 00002 copyright : (C) 2007,2011 by Lukáš Lalinský 00003 email : lalinsky@gmail.com 00004 **************************************************************************/ 00005 00006 /*************************************************************************** 00007 * This library is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU Lesser General Public License version * 00009 * 2.1 as published by the Free Software Foundation. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, but * 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the Free Software * 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 00019 * 02110-1301 USA * 00020 * * 00021 * Alternatively, this file is available under the Mozilla Public * 00022 * License Version 1.1. You may obtain a copy of the License at * 00023 * http://www.mozilla.org/MPL/ * 00024 ***************************************************************************/ 00025 00026 // This file is not part of the public API! 00027 00028 #ifndef DO_NOT_DOCUMENT 00029 00030 #ifndef TAGLIB_MP4ATOM_H 00031 #define TAGLIB_MP4ATOM_H 00032 00033 #include "tfile.h" 00034 #include "tlist.h" 00035 00036 namespace TagLib { 00037 00038 namespace MP4 { 00039 00040 class Atom; 00041 typedef TagLib::List<Atom *> AtomList; 00042 00043 enum AtomDataType 00044 { 00045 TypeImplicit = 0, // for use with tags for which no type needs to be indicated because only one type is allowed 00046 TypeUTF8 = 1, // without any count or null terminator 00047 TypeUTF16 = 2, // also known as UTF-16BE 00048 TypeSJIS = 3, // deprecated unless it is needed for special Japanese characters 00049 TypeHTML = 6, // the HTML file header specifies which HTML version 00050 TypeXML = 7, // the XML header must identify the DTD or schemas 00051 TypeUUID = 8, // also known as GUID; stored as 16 bytes in binary (valid as an ID) 00052 TypeISRC = 9, // stored as UTF-8 text (valid as an ID) 00053 TypeMI3P = 10, // stored as UTF-8 text (valid as an ID) 00054 TypeGIF = 12, // (deprecated) a GIF image 00055 TypeJPEG = 13, // a JPEG image 00056 TypePNG = 14, // a PNG image 00057 TypeURL = 15, // absolute, in UTF-8 characters 00058 TypeDuration = 16, // in milliseconds, 32-bit integer 00059 TypeDateTime = 17, // in UTC, counting seconds since midnight, January 1, 1904; 32 or 64-bits 00060 TypeGenred = 18, // a list of enumerated values 00061 TypeInteger = 21, // a signed big-endian integer with length one of { 1,2,3,4,8 } bytes 00062 TypeRIAAPA = 24, // RIAA parental advisory; { -1=no, 1=yes, 0=unspecified }, 8-bit ingteger 00063 TypeUPC = 25, // Universal Product Code, in text UTF-8 format (valid as an ID) 00064 TypeBMP = 27, // Windows bitmap image 00065 TypeUndefined = 255 // undefined 00066 }; 00067 00068 struct AtomData { 00069 AtomData(AtomDataType type, ByteVector data) : type(type), locale(0), data(data) {} 00070 AtomDataType type; 00071 int locale; 00072 ByteVector data; 00073 }; 00074 00075 typedef TagLib::List<AtomData> AtomDataList; 00076 00077 class Atom 00078 { 00079 public: 00080 Atom(File *file); 00081 ~Atom(); 00082 Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 00083 bool path(AtomList &path, const char *name1, const char *name2 = 0, const char *name3 = 0); 00084 AtomList findall(const char *name, bool recursive = false); 00085 long offset; 00086 long length; 00087 TagLib::ByteVector name; 00088 AtomList children; 00089 private: 00090 static const int numContainers = 11; 00091 static const char *containers[11]; 00092 }; 00093 00095 class Atoms 00096 { 00097 public: 00098 Atoms(File *file); 00099 ~Atoms(); 00100 Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 00101 AtomList path(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 00102 AtomList atoms; 00103 }; 00104 00105 } 00106 00107 } 00108 00109 #endif 00110 00111 #endif