-#define TRACK_AUDIO 1
-#define TRACK_VIDEO 2
-#define TRACK_SYSTEM 3
-#define TRACK_UNKNOWN 0
-
-/* atoms with subatoms */
-#define ATOM_MOOV 1
-#define ATOM_TRAK 2
-#define ATOM_EDTS 3
-#define ATOM_MDIA 4
-#define ATOM_MINF 5
-#define ATOM_STBL 6
-#define ATOM_UDTA 7
-#define ATOM_ILST 8 /* iTunes Metadata list */
-#define ATOM_TITLE 9
-#define ATOM_ARTIST 10
-#define ATOM_WRITER 11
-#define ATOM_ALBUM 12
-#define ATOM_DATE 13
-#define ATOM_TOOL 14
-#define ATOM_COMMENT 15
-#define ATOM_GENRE1 16
-#define ATOM_TRACK 17
-#define ATOM_DISC 18
-#define ATOM_COMPILATION 19
-#define ATOM_GENRE2 20
-#define ATOM_TEMPO 21
-#define ATOM_COVER 22
-#define ATOM_DRMS 23
-#define ATOM_SINF 24
-#define ATOM_SCHI 25
-
-#define SUBATOMIC 128
-
-/* atoms without subatoms */
-#define ATOM_FTYP 129
-#define ATOM_MDAT 130
-#define ATOM_MVHD 131
-#define ATOM_TKHD 132
-#define ATOM_TREF 133
-#define ATOM_MDHD 134
-#define ATOM_VMHD 135
-#define ATOM_SMHD 136
-#define ATOM_HMHD 137
-#define ATOM_STSD 138
-#define ATOM_STTS 139
-#define ATOM_STSZ 140
-#define ATOM_STZ2 141
-#define ATOM_STCO 142
-#define ATOM_STSC 143
-#define ATOM_MP4A 144
-#define ATOM_MP4V 145
-#define ATOM_MP4S 146
-#define ATOM_ESDS 147
-#define ATOM_META 148 /* iTunes Metadata box */
-#define ATOM_NAME 149 /* iTunes Metadata name box */
-#define ATOM_DATA 150 /* iTunes Metadata data box */
-#define ATOM_CTTS 151
-#define ATOM_FRMA 152
-#define ATOM_IVIV 153
-#define ATOM_PRIV 154
-#define ATOM_USER 155
-#define ATOM_KEY 156
-#define ATOM_ALBUM_ARTIST 157
-#define ATOM_CONTENTGROUP 158
-#define ATOM_LYRICS 159
-#define ATOM_DESCRIPTION 160
-#define ATOM_NETWORK 161
-#define ATOM_SHOW 162
-#define ATOM_EPISODENAME 163
-#define ATOM_SORTTITLE 164
-#define ATOM_SORTALBUM 165
-#define ATOM_SORTARTIST 166
-#define ATOM_SORTALBUMARTIST 167
-#define ATOM_SORTWRITER 168
-#define ATOM_SORTSHOW 169
-#define ATOM_SEASON 170
-#define ATOM_EPISODE 171
-#define ATOM_PODCAST 172
-
-#define ATOM_UNKNOWN 255
-#define ATOM_FREE ATOM_UNKNOWN
-#define ATOM_SKIP ATOM_UNKNOWN
-
-#define COPYRIGHT_SYMBOL ((int8_t)0xA9)
-
-static uint8_t atom_name_to_type(const int8_t a, const int8_t b,
- const int8_t c, const int8_t d)
-{
- if (a == 'm') {
- if (atom_compare(a, b, c, d, 'm', 'o', 'o', 'v'))
- return ATOM_MOOV;
- else if (atom_compare(a, b, c, d, 'm', 'i', 'n', 'f'))
- return ATOM_MINF;
- else if (atom_compare(a, b, c, d, 'm', 'd', 'i', 'a'))
- return ATOM_MDIA;
- else if (atom_compare(a, b, c, d, 'm', 'd', 'a', 't'))
- return ATOM_MDAT;
- else if (atom_compare(a, b, c, d, 'm', 'd', 'h', 'd'))
- return ATOM_MDHD;
- else if (atom_compare(a, b, c, d, 'm', 'v', 'h', 'd'))
- return ATOM_MVHD;
- else if (atom_compare(a, b, c, d, 'm', 'p', '4', 'a'))
- return ATOM_MP4A;
- else if (atom_compare(a, b, c, d, 'm', 'p', '4', 'v'))
- return ATOM_MP4V;
- else if (atom_compare(a, b, c, d, 'm', 'p', '4', 's'))
- return ATOM_MP4S;
- else if (atom_compare(a, b, c, d, 'm', 'e', 't', 'a'))
- return ATOM_META;
- } else if (a == 't') {
- if (atom_compare(a, b, c, d, 't', 'r', 'a', 'k'))
- return ATOM_TRAK;
- else if (atom_compare(a, b, c, d, 't', 'k', 'h', 'd'))
- return ATOM_TKHD;
- else if (atom_compare(a, b, c, d, 't', 'r', 'e', 'f'))
- return ATOM_TREF;
- else if (atom_compare(a, b, c, d, 't', 'r', 'k', 'n'))
- return ATOM_TRACK;
- else if (atom_compare(a, b, c, d, 't', 'm', 'p', 'o'))
- return ATOM_TEMPO;
- else if (atom_compare(a, b, c, d, 't', 'v', 'n', 'n'))
- return ATOM_NETWORK;
- else if (atom_compare(a, b, c, d, 't', 'v', 's', 'h'))
- return ATOM_SHOW;
- else if (atom_compare(a, b, c, d, 't', 'v', 'e', 'n'))
- return ATOM_EPISODENAME;
- else if (atom_compare(a, b, c, d, 't', 'v', 's', 'n'))
- return ATOM_SEASON;
- else if (atom_compare(a, b, c, d, 't', 'v', 'e', 's'))
- return ATOM_EPISODE;
- } else if (a == 's') {
- if (atom_compare(a, b, c, d, 's', 't', 'b', 'l'))
- return ATOM_STBL;
- else if (atom_compare(a, b, c, d, 's', 'm', 'h', 'd'))
- return ATOM_SMHD;
- else if (atom_compare(a, b, c, d, 's', 't', 's', 'd'))
- return ATOM_STSD;
- else if (atom_compare(a, b, c, d, 's', 't', 't', 's'))
- return ATOM_STTS;
- else if (atom_compare(a, b, c, d, 's', 't', 'c', 'o'))
- return ATOM_STCO;
- else if (atom_compare(a, b, c, d, 's', 't', 's', 'c'))
- return ATOM_STSC;
- else if (atom_compare(a, b, c, d, 's', 't', 's', 'z'))
- return ATOM_STSZ;
- else if (atom_compare(a, b, c, d, 's', 't', 'z', '2'))
- return ATOM_STZ2;
- else if (atom_compare(a, b, c, d, 's', 'k', 'i', 'p'))
- return ATOM_SKIP;
- else if (atom_compare(a, b, c, d, 's', 'i', 'n', 'f'))
- return ATOM_SINF;
- else if (atom_compare(a, b, c, d, 's', 'c', 'h', 'i'))
- return ATOM_SCHI;
- else if (atom_compare(a, b, c, d, 's', 'o', 'n', 'm'))
- return ATOM_SORTTITLE;
- else if (atom_compare(a, b, c, d, 's', 'o', 'a', 'l'))
- return ATOM_SORTALBUM;
- else if (atom_compare(a, b, c, d, 's', 'o', 'a', 'r'))
- return ATOM_SORTARTIST;
- else if (atom_compare(a, b, c, d, 's', 'o', 'a', 'a'))
- return ATOM_SORTALBUMARTIST;
- else if (atom_compare(a, b, c, d, 's', 'o', 'c', 'o'))
- return ATOM_SORTWRITER;
- else if (atom_compare(a, b, c, d, 's', 'o', 's', 'n'))
- return ATOM_SORTSHOW;
- } else if (a == COPYRIGHT_SYMBOL) {
- if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'n', 'a', 'm'))
- return ATOM_TITLE;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'A', 'R', 'T'))
- return ATOM_ARTIST;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'w', 'r', 't'))
- return ATOM_WRITER;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'a', 'l', 'b'))
- return ATOM_ALBUM;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'd', 'a', 'y'))
- return ATOM_DATE;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 't', 'o', 'o'))
- return ATOM_TOOL;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'c', 'm', 't'))
- return ATOM_COMMENT;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'g', 'e', 'n'))
- return ATOM_GENRE1;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'g', 'r', 'p'))
- return ATOM_CONTENTGROUP;
- else if (atom_compare(a, b, c, d, COPYRIGHT_SYMBOL, 'l', 'y', 'r'))
- return ATOM_LYRICS;
- }