Mercurial > audlegacy
comparison Plugins/Input/aac/libmp4v2/mp4atom.cpp @ 201:f2dc045d2327 trunk
[svn] libmp4v2 goes back to the future
author | chainsaw |
---|---|
date | Thu, 17 Nov 2005 14:01:18 -0800 |
parents | 0a2ad94e8607 |
children |
comparison
equal
deleted
inserted
replaced
200:094ef8a0a9fd | 201:f2dc045d2327 |
---|---|
82 pAtom = new MP4UrlAtom("alis"); | 82 pAtom = new MP4UrlAtom("alis"); |
83 } else if (ATOMID(type) == ATOMID("alaw")) { | 83 } else if (ATOMID(type) == ATOMID("alaw")) { |
84 pAtom = new MP4SoundAtom("alaw"); | 84 pAtom = new MP4SoundAtom("alaw"); |
85 } | 85 } |
86 break; | 86 break; |
87 case 'b': | |
88 if (ATOMID(type) == ATOMID("bitr")) { | |
89 pAtom = new MP4BitrAtom(); | |
90 } else if (ATOMID(type) == ATOMID("btrt")) { | |
91 pAtom = new MP4BtrtAtom(); | |
92 } | |
93 break; | |
94 case 'c': | |
95 if (ATOMID(type) == ATOMID("ctts")) { | |
96 pAtom = new MP4CttsAtom(); | |
97 } else if (ATOMID(type) == ATOMID("co64")) { | |
98 pAtom = new MP4Co64Atom(); | |
99 } else if (ATOMID(type) == ATOMID("cprt")) { | |
100 pAtom = new MP4CprtAtom(); | |
101 } else if (ATOMID(type) == ATOMID("cpil")) { /* Apple iTunes */ | |
102 pAtom = new MP4CpilAtom(); | |
103 } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */ | |
104 pAtom = new MP4CovrAtom(); | |
105 } | |
106 break; | |
107 case 'd': | 87 case 'd': |
108 if (ATOMID(type) == ATOMID("d263")) { | 88 if (ATOMID(type) == ATOMID("d263")) { |
109 pAtom = new MP4D263Atom(); | 89 pAtom = new MP4D263Atom(); |
110 } else if (ATOMID(type) == ATOMID("damr")) { | 90 } else if (ATOMID(type) == ATOMID("damr")) { |
111 pAtom = new MP4DamrAtom(); | 91 pAtom = new MP4DamrAtom(); |
112 } else if (ATOMID(type) == ATOMID("dinf")) { | |
113 pAtom = new MP4DinfAtom(); | |
114 } else if (ATOMID(type) == ATOMID("dref")) { | 92 } else if (ATOMID(type) == ATOMID("dref")) { |
115 pAtom = new MP4DrefAtom(); | 93 pAtom = new MP4DrefAtom(); |
116 } else if (ATOMID(type) == ATOMID("dpnd")) { | 94 } else if (ATOMID(type) == ATOMID("dpnd")) { |
117 pAtom = new MP4TrefTypeAtom(type); | 95 pAtom = new MP4TrefTypeAtom(type); |
118 } else if (ATOMID(type) == ATOMID("dmed")) { | |
119 pAtom = new MP4DmedAtom(); | |
120 } else if (ATOMID(type) == ATOMID("dimm")) { | |
121 pAtom = new MP4DimmAtom(); | |
122 } else if (ATOMID(type) == ATOMID("drep")) { | |
123 pAtom = new MP4DrepAtom(); | |
124 } else if (ATOMID(type) == ATOMID("dmax")) { | |
125 pAtom = new MP4DmaxAtom(); | |
126 } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ | 96 } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ |
127 pAtom = new MP4DataAtom(); | 97 pAtom = new MP4DataAtom(); |
128 } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */ | |
129 pAtom = new MP4DiskAtom(); | |
130 } | 98 } |
131 break; | 99 break; |
132 case 'e': | 100 case 'e': |
133 if (ATOMID(type) == ATOMID("esds")) { | 101 if (ATOMID(type) == ATOMID("elst")) { |
134 pAtom = new MP4EsdsAtom(); | |
135 } else if (ATOMID(type) == ATOMID("edts")) { | |
136 pAtom = new MP4EdtsAtom(); | |
137 } else if (ATOMID(type) == ATOMID("elst")) { | |
138 pAtom = new MP4ElstAtom(); | 102 pAtom = new MP4ElstAtom(); |
139 } else if (ATOMID(type) == ATOMID("enca")) { | 103 } else if (ATOMID(type) == ATOMID("enca")) { |
140 pAtom = new MP4EncaAtom(); | 104 pAtom = new MP4EncaAtom(); |
141 } else if (ATOMID(type) == ATOMID("encv")) { | 105 } else if (ATOMID(type) == ATOMID("encv")) { |
142 pAtom = new MP4EncvAtom(); | 106 pAtom = new MP4EncvAtom(); |
143 } | 107 } |
144 break; | 108 break; |
145 case 'f': | 109 case 'f': |
146 if (ATOMID(type) == ATOMID("free")) { | 110 if (ATOMID(type) == ATOMID("free")) { |
147 pAtom = new MP4FreeAtom(); | 111 pAtom = new MP4FreeAtom(); |
148 } else if (ATOMID(type) == ATOMID("frma")) { | |
149 pAtom = new MP4FrmaAtom(); | |
150 } else if (ATOMID(type) == ATOMID("ftyp")) { | 112 } else if (ATOMID(type) == ATOMID("ftyp")) { |
151 pAtom = new MP4FtypAtom(); | 113 pAtom = new MP4FtypAtom(); |
152 } | |
153 break; | |
154 case 'g': | |
155 if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes | |
156 pAtom = new MP4GnreAtom(); | |
157 } | 114 } |
158 break; | 115 break; |
159 case 'h': | 116 case 'h': |
160 if (ATOMID(type) == ATOMID("hdlr")) { | 117 if (ATOMID(type) == ATOMID("hdlr")) { |
161 pAtom = new MP4HdlrAtom(); | 118 pAtom = new MP4HdlrAtom(); |
162 } else if (ATOMID(type) == ATOMID("hmhd")) { | |
163 pAtom = new MP4HmhdAtom(); | |
164 } else if (ATOMID(type) == ATOMID("hint")) { | 119 } else if (ATOMID(type) == ATOMID("hint")) { |
165 pAtom = new MP4TrefTypeAtom(type); | 120 pAtom = new MP4TrefTypeAtom(type); |
166 } else if (ATOMID(type) == ATOMID("hnti")) { | 121 } else if (ATOMID(type) == ATOMID("hnti")) { |
167 pAtom = new MP4HntiAtom(); | 122 pAtom = new MP4HntiAtom(); |
168 } else if (ATOMID(type) == ATOMID("hinf")) { | 123 } else if (ATOMID(type) == ATOMID("hinf")) { |
169 pAtom = new MP4HinfAtom(); | 124 pAtom = new MP4HinfAtom(); |
170 } else if (ATOMID(type) == ATOMID("h263")) { | 125 } else if (ATOMID(type) == ATOMID("h263")) { |
171 pAtom = new MP4VideoAtom("h263"); | 126 pAtom = new MP4VideoAtom("h263"); |
127 } else if (ATOMID(type) == ATOMID("href")) { | |
128 pAtom = new MP4HrefAtom(); | |
172 } | 129 } |
173 break; | 130 break; |
174 case 'i': | 131 case 'i': |
175 if (ATOMID(type) == ATOMID("iKMS")) { | 132 if (ATOMID(type) == ATOMID("ipir")) { |
176 pAtom = new MP4IKMSAtom(); | |
177 } else if (ATOMID(type) == ATOMID("iSFM")) { | |
178 pAtom = new MP4ISFMAtom(); | |
179 } else if (ATOMID(type) == ATOMID("iods")) { | |
180 pAtom = new MP4IodsAtom(); | |
181 } else if (ATOMID(type) == ATOMID("ipir")) { | |
182 pAtom = new MP4TrefTypeAtom(type); | 133 pAtom = new MP4TrefTypeAtom(type); |
183 } else if (ATOMID(type) == ATOMID("ilst")) { | |
184 pAtom = new MP4IlstAtom(); | |
185 } else if (ATOMID(type) == ATOMID("ima4")) { | 134 } else if (ATOMID(type) == ATOMID("ima4")) { |
186 pAtom = new MP4SoundAtom("ima4"); | 135 pAtom = new MP4SoundAtom("ima4"); |
187 } | 136 } |
188 break; | 137 break; |
189 case 'j': | 138 case 'j': |
190 if (ATOMID(type) == ATOMID("jpeg")) { | 139 if (ATOMID(type) == ATOMID("jpeg")) { |
191 pAtom = new MP4VideoAtom("jpeg"); | 140 pAtom = new MP4VideoAtom("jpeg"); |
192 } | 141 } |
193 break; | 142 break; |
194 case 'm': | 143 case 'm': |
195 if (ATOMID(type) == ATOMID("mdia")) { | 144 if (ATOMID(type) == ATOMID("mdhd")) { |
196 pAtom = new MP4MdiaAtom(); | |
197 } else if (ATOMID(type) == ATOMID("minf")) { | |
198 pAtom = new MP4MinfAtom(); | |
199 } else if (ATOMID(type) == ATOMID("mdhd")) { | |
200 pAtom = new MP4MdhdAtom(); | 145 pAtom = new MP4MdhdAtom(); |
146 } else if (ATOMID(type) == ATOMID("mvhd")) { | |
147 pAtom = new MP4MvhdAtom(); | |
201 } else if (ATOMID(type) == ATOMID("mdat")) { | 148 } else if (ATOMID(type) == ATOMID("mdat")) { |
202 pAtom = new MP4MdatAtom(); | 149 pAtom = new MP4MdatAtom(); |
203 } else if (ATOMID(type) == ATOMID("moov")) { | |
204 pAtom = new MP4MoovAtom(); | |
205 } else if (ATOMID(type) == ATOMID("mvhd")) { | |
206 pAtom = new MP4MvhdAtom(); | |
207 } else if (ATOMID(type) == ATOMID("mpod")) { | 150 } else if (ATOMID(type) == ATOMID("mpod")) { |
208 pAtom = new MP4TrefTypeAtom(type); | 151 pAtom = new MP4TrefTypeAtom(type); |
209 } else if (ATOMID(type) == ATOMID("mp4a")) { | 152 } else if (ATOMID(type) == ATOMID("mp4a")) { |
210 pAtom = new MP4Mp4aAtom(); | 153 pAtom = new MP4Mp4aAtom(); |
211 } else if (ATOMID(type) == ATOMID("mp4s")) { | 154 } else if (ATOMID(type) == ATOMID("mp4s")) { |
212 pAtom = new MP4Mp4sAtom(); | 155 pAtom = new MP4Mp4sAtom(); |
213 } else if (ATOMID(type) == ATOMID("mp4v")) { | 156 } else if (ATOMID(type) == ATOMID("mp4v")) { |
214 pAtom = new MP4Mp4vAtom(); | 157 pAtom = new MP4Mp4vAtom(); |
215 } else if (ATOMID(type) == ATOMID("moof")) { | |
216 pAtom = new MP4MoofAtom(); | |
217 } else if (ATOMID(type) == ATOMID("mfhd")) { | |
218 pAtom = new MP4MfhdAtom(); | |
219 } else if (ATOMID(type) == ATOMID("mvex")) { | |
220 pAtom = new MP4MvexAtom(); | |
221 } else if (ATOMID(type) == ATOMID("maxr")) { | |
222 pAtom = new MP4MaxrAtom(); | |
223 } else if (ATOMID(type) == ATOMID("meta")) { // iTunes | |
224 pAtom = new MP4MetaAtom(); | |
225 } else if (ATOMID(type) == ATOMID("mean")) { // iTunes | 158 } else if (ATOMID(type) == ATOMID("mean")) { // iTunes |
226 pAtom = new MP4MeanAtom(); | 159 pAtom = new MP4MeanAtom(); |
227 } | 160 } |
228 break; | 161 break; |
229 case 'n': | 162 case 'n': |
230 if (ATOMID(type) == ATOMID("nmhd")) { | 163 if (ATOMID(type) == ATOMID("name")) { // iTunes |
231 pAtom = new MP4NmhdAtom(); | |
232 } else if (ATOMID(type) == ATOMID("nump")) { | |
233 pAtom = new MP4NumpAtom(); | |
234 } else if (ATOMID(type) == ATOMID("name")) { // iTunes | |
235 pAtom = new MP4NameAtom(); | 164 pAtom = new MP4NameAtom(); |
236 } | |
237 break; | |
238 case 'p': | |
239 if (ATOMID(type) == ATOMID("pmax")) { | |
240 pAtom = new MP4PmaxAtom(); | |
241 } else if (ATOMID(type) == ATOMID("payt")) { | |
242 pAtom = new MP4PaytAtom(); | |
243 } | 165 } |
244 break; | 166 break; |
245 case 'r': | 167 case 'r': |
246 if (ATOMID(type) == ATOMID("rtp ")) { | 168 if (ATOMID(type) == ATOMID("rtp ")) { |
247 pAtom = new MP4RtpAtom(); | 169 pAtom = new MP4RtpAtom(); |
254 pAtom = new MP4S263Atom(); | 176 pAtom = new MP4S263Atom(); |
255 } else if (ATOMID(type) == ATOMID("samr")) { | 177 } else if (ATOMID(type) == ATOMID("samr")) { |
256 pAtom = new MP4AmrAtom("samr"); | 178 pAtom = new MP4AmrAtom("samr"); |
257 } else if (ATOMID(type) == ATOMID("sawb")) { | 179 } else if (ATOMID(type) == ATOMID("sawb")) { |
258 pAtom = new MP4AmrAtom("sawb"); | 180 pAtom = new MP4AmrAtom("sawb"); |
259 } else if (ATOMID(type) == ATOMID("schi")) { | |
260 pAtom = new MP4SchiAtom(); | |
261 } else if (ATOMID(type) == ATOMID("schm")) { | |
262 pAtom = new MP4SchmAtom(); | |
263 } else if (ATOMID(type) == ATOMID("sinf")) { | |
264 pAtom = new MP4SinfAtom(); | |
265 } else if (ATOMID(type) == ATOMID("stbl")) { | 181 } else if (ATOMID(type) == ATOMID("stbl")) { |
266 pAtom = new MP4StblAtom(); | 182 pAtom = new MP4StblAtom(); |
267 } else if (ATOMID(type) == ATOMID("stsd")) { | 183 } else if (ATOMID(type) == ATOMID("stsd")) { |
268 pAtom = new MP4StsdAtom(); | 184 pAtom = new MP4StsdAtom(); |
269 } else if (ATOMID(type) == ATOMID("stts")) { | |
270 pAtom = new MP4SttsAtom(); | |
271 } else if (ATOMID(type) == ATOMID("stsz")) { | 185 } else if (ATOMID(type) == ATOMID("stsz")) { |
272 pAtom = new MP4StszAtom(); | 186 pAtom = new MP4StszAtom(); |
273 } else if (ATOMID(type) == ATOMID("stsc")) { | 187 } else if (ATOMID(type) == ATOMID("stsc")) { |
274 pAtom = new MP4StscAtom(); | 188 pAtom = new MP4StscAtom(); |
275 } else if (ATOMID(type) == ATOMID("stco")) { | |
276 pAtom = new MP4StcoAtom(); | |
277 } else if (ATOMID(type) == ATOMID("stss")) { | |
278 pAtom = new MP4StssAtom(); | |
279 } else if (ATOMID(type) == ATOMID("stsh")) { | |
280 pAtom = new MP4StshAtom(); | |
281 } else if (ATOMID(type) == ATOMID("stdp")) { | 189 } else if (ATOMID(type) == ATOMID("stdp")) { |
282 pAtom = new MP4StdpAtom(); | 190 pAtom = new MP4StdpAtom(); |
283 } else if (ATOMID(type) == ATOMID("smhd")) { | |
284 pAtom = new MP4SmhdAtom(); | |
285 } else if (ATOMID(type) == ATOMID("sdp ")) { | 191 } else if (ATOMID(type) == ATOMID("sdp ")) { |
286 pAtom = new MP4SdpAtom(); | 192 pAtom = new MP4SdpAtom(); |
287 } else if (ATOMID(type) == ATOMID("snro")) { | |
288 pAtom = new MP4SnroAtom(); | |
289 } else if (ATOMID(type) == ATOMID("sync")) { | 193 } else if (ATOMID(type) == ATOMID("sync")) { |
290 pAtom = new MP4TrefTypeAtom(type); | 194 pAtom = new MP4TrefTypeAtom(type); |
291 } else if (ATOMID(type) == ATOMID("skip")) { | 195 } else if (ATOMID(type) == ATOMID("skip")) { |
292 pAtom = new MP4FreeAtom(); | 196 pAtom = new MP4FreeAtom(); |
293 pAtom->SetType("skip"); | 197 pAtom->SetType("skip"); |
294 } else if (ATOMID(type) == ATOMID("sowt")) { | 198 } else if (ATOMID(type) == ATOMID("sowt")) { |
295 pAtom = new MP4SoundAtom("sowt"); | 199 pAtom = new MP4SoundAtom("sowt"); |
296 } | 200 } |
297 break; | 201 break; |
298 case 't': | 202 case 't': |
299 if (ATOMID(type) == ATOMID("trak")) { | 203 if (ATOMID(type) == ATOMID("tkhd")) { |
300 pAtom = new MP4TrakAtom(); | |
301 } else if (ATOMID(type) == ATOMID("tkhd")) { | |
302 pAtom = new MP4TkhdAtom(); | 204 pAtom = new MP4TkhdAtom(); |
303 } else if (ATOMID(type) == ATOMID("tref")) { | |
304 pAtom = new MP4TrefAtom(); | |
305 } else if (ATOMID(type) == ATOMID("traf")) { | |
306 pAtom = new MP4TrafAtom(); | |
307 } else if (ATOMID(type) == ATOMID("tfhd")) { | 205 } else if (ATOMID(type) == ATOMID("tfhd")) { |
308 pAtom = new MP4TfhdAtom(); | 206 pAtom = new MP4TfhdAtom(); |
309 } else if (ATOMID(type) == ATOMID("trex")) { | |
310 pAtom = new MP4TrexAtom(); | |
311 } else if (ATOMID(type) == ATOMID("trun")) { | 207 } else if (ATOMID(type) == ATOMID("trun")) { |
312 pAtom = new MP4TrunAtom(); | 208 pAtom = new MP4TrunAtom(); |
313 } else if (ATOMID(type) == ATOMID("tmin")) { | |
314 pAtom = new MP4TminAtom(); | |
315 } else if (ATOMID(type) == ATOMID("tmax")) { | |
316 pAtom = new MP4TmaxAtom(); | |
317 } else if (ATOMID(type) == ATOMID("trpy")) { | |
318 pAtom = new MP4TrpyAtom(); | |
319 } else if (ATOMID(type) == ATOMID("tpyl")) { | |
320 pAtom = new MP4TpylAtom(); | |
321 } else if (ATOMID(type) == ATOMID("tims")) { | |
322 pAtom = new MP4TimsAtom(); | |
323 } else if (ATOMID(type) == ATOMID("tsro")) { | |
324 pAtom = new MP4TsroAtom(); | |
325 } else if (ATOMID(type) == ATOMID("trkn")) { // iTunes | |
326 pAtom = new MP4TrknAtom(); | |
327 } else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes | |
328 pAtom = new MP4TmpoAtom(); | |
329 } else if (ATOMID(type) == ATOMID("twos")) { | 209 } else if (ATOMID(type) == ATOMID("twos")) { |
330 pAtom = new MP4SoundAtom("twos"); | 210 pAtom = new MP4SoundAtom("twos"); |
331 } | 211 } |
332 break; | 212 break; |
333 case 'u': | 213 case 'u': |
356 pAtom = new MP4VideoAtom("SVQ3"); | 236 pAtom = new MP4VideoAtom("SVQ3"); |
357 } else if (ATOMID(type) == ATOMID("SMI ")) { | 237 } else if (ATOMID(type) == ATOMID("SMI ")) { |
358 pAtom = new MP4SmiAtom(); | 238 pAtom = new MP4SmiAtom(); |
359 } | 239 } |
360 break; | 240 break; |
361 case 0251: { // copyright symbol | |
362 static const char name[5]={0251,'n', 'a', 'm', '\0'}; | |
363 static const char art[5]={0251,'A', 'R', 'T', '\0'}; | |
364 static const char wrt[5]={0251,'w', 'r', 't', '\0'}; | |
365 static const char alb[5]={0251,'a', 'l', 'b', '\0'}; | |
366 static const char day[5]={0251,'d', 'a', 'y', '\0'}; | |
367 static const char too[5]={0251,'t', 'o', 'o', '\0'}; | |
368 static const char cmt[5]={0251,'c', 'm', 't', '\0'}; | |
369 static const char gen[5]={0251,'g', 'e', 'n', '\0'}; | |
370 if (ATOMID(type) == ATOMID(name)) { | |
371 pAtom = new MP4NamAtom(); | |
372 } else if (ATOMID(type) == ATOMID(art)) { /* Apple iTunes */ | |
373 pAtom = new MP4ArtAtom(); | |
374 } else if (ATOMID(type) == ATOMID(wrt)) { /* Apple iTunes */ | |
375 pAtom = new MP4WrtAtom(); | |
376 } else if (ATOMID(type) == ATOMID(alb)) { /* Apple iTunes */ | |
377 pAtom = new MP4AlbAtom(); | |
378 } else if (ATOMID(type) == ATOMID(day)) { /* Apple iTunes */ | |
379 pAtom = new MP4DayAtom(); | |
380 } else if (ATOMID(type) == ATOMID(too)) { /* Apple iTunes */ | |
381 pAtom = new MP4TooAtom(); | |
382 } else if (ATOMID(type) == ATOMID(cmt)) { /* Apple iTunes */ | |
383 pAtom = new MP4CmtAtom(); | |
384 } else if (ATOMID(type) == ATOMID(gen)) { /* Apple iTunes */ | |
385 pAtom = new MP4GenAtom(); | |
386 } | |
387 break; | |
388 } | |
389 case '-': | |
390 if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */ | |
391 pAtom = new MP4DashAtom(); | |
392 } | |
393 } | 241 } |
394 } | 242 } |
395 | 243 |
396 if (pAtom == NULL) { | 244 if (pAtom == NULL) { |
397 pAtom = new MP4Atom(type); | 245 pAtom = new MP4StandardAtom(type); |
398 pAtom->SetUnknownType(true); | 246 // unknown type is set by StandardAtom type |
399 } | 247 } |
400 | 248 |
401 ASSERT(pAtom); | 249 ASSERT(pAtom); |
402 return pAtom; | 250 return pAtom; |
403 } | 251 } |
437 u_int8_t extendedType[16]; | 285 u_int8_t extendedType[16]; |
438 | 286 |
439 u_int64_t pos = pFile->GetPosition(); | 287 u_int64_t pos = pFile->GetPosition(); |
440 | 288 |
441 VERBOSE_READ(pFile->GetVerbosity(), | 289 VERBOSE_READ(pFile->GetVerbosity(), |
442 printf("ReadAtom: pos = 0x"X64"\n", pos)); | 290 printf("ReadAtom: pos = 0x%llx\n", pos)); |
443 | 291 |
444 u_int64_t dataSize = pFile->ReadUInt32(); | 292 u_int64_t dataSize = pFile->ReadUInt32(); |
445 | 293 |
446 char type[5]; | 294 char type[5]; |
447 pFile->ReadBytes((u_int8_t*)&type[0], 4); | 295 pFile->ReadBytes((u_int8_t*)&type[0], 4); |
465 } | 313 } |
466 | 314 |
467 dataSize -= hdrSize; | 315 dataSize -= hdrSize; |
468 | 316 |
469 VERBOSE_READ(pFile->GetVerbosity(), | 317 VERBOSE_READ(pFile->GetVerbosity(), |
470 printf("ReadAtom: type = %s data-size = "U64" (0x"X64")\n", | 318 printf("ReadAtom: type = \"%s\" data-size = %llu (0x%llx) hdr %u\n", |
471 type, dataSize, dataSize)); | 319 type, dataSize, dataSize, hdrSize)); |
472 | 320 |
473 if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { | 321 if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { |
474 VERBOSE_ERROR(pFile->GetVerbosity(), | 322 VERBOSE_ERROR(pFile->GetVerbosity(), |
475 printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of %s \"%s\"\n", | 323 printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of \"%s\" \"%s\" %llu vs %llu\n", |
476 pParentAtom->GetType(), type)); | 324 pParentAtom->GetType(), type, |
325 pos + hdrSize + dataSize, | |
326 pParentAtom->GetEnd())); | |
477 VERBOSE_READ(pFile->GetVerbosity(), | 327 VERBOSE_READ(pFile->GetVerbosity(), |
478 printf("parent %s ("U64") pos "U64" hdr %d data "U64" sum "U64"\n", | 328 printf("parent %s (%llu) pos %llu hdr %d data %llu sum %llu\n", |
479 pParentAtom->GetType(), | 329 pParentAtom->GetType(), |
480 pParentAtom->GetEnd(), | 330 pParentAtom->GetEnd(), |
481 pos, | 331 pos, |
482 hdrSize, | 332 hdrSize, |
483 dataSize, | 333 dataSize, |
540 { | 390 { |
541 ASSERT(m_pFile); | 391 ASSERT(m_pFile); |
542 | 392 |
543 if (ATOMID(m_type) != 0 && m_size > 1000000) { | 393 if (ATOMID(m_type) != 0 && m_size > 1000000) { |
544 VERBOSE_READ(GetVerbosity(), | 394 VERBOSE_READ(GetVerbosity(), |
545 printf("Warning: %s atom size "U64" is suspect\n", | 395 printf("Warning: %s atom size %llu is suspect\n", |
546 m_type, m_size)); | 396 m_type, m_size)); |
547 } | 397 } |
548 | 398 |
549 ReadProperties(); | 399 ReadProperties(); |
550 | 400 |
558 | 408 |
559 void MP4Atom::Skip() | 409 void MP4Atom::Skip() |
560 { | 410 { |
561 if (m_pFile->GetPosition() != m_end) { | 411 if (m_pFile->GetPosition() != m_end) { |
562 VERBOSE_READ(m_pFile->GetVerbosity(), | 412 VERBOSE_READ(m_pFile->GetVerbosity(), |
563 printf("Skip: "U64" bytes\n", m_end - m_pFile->GetPosition())); | 413 printf("Skip: %llu bytes\n", m_end - m_pFile->GetPosition())); |
564 } | 414 } |
565 m_pFile->SetPosition(m_end); | 415 m_pFile->SetPosition(m_end); |
566 } | 416 } |
567 | 417 |
568 MP4Atom* MP4Atom::FindAtom(const char* name) | 418 MP4Atom* MP4Atom::FindAtom(const char* name) |
694 | 544 |
695 m_pProperties[i]->Read(m_pFile); | 545 m_pProperties[i]->Read(m_pFile); |
696 | 546 |
697 if (m_pFile->GetPosition() > m_end) { | 547 if (m_pFile->GetPosition() > m_end) { |
698 VERBOSE_READ(GetVerbosity(), | 548 VERBOSE_READ(GetVerbosity(), |
699 printf("ReadProperties: insufficient data for property: %s pos 0x"X64" atom end 0x"X64"\n", | 549 printf("ReadProperties: insufficient data for property: %s pos 0x%llx atom end 0x%llx\n", |
700 m_pProperties[i]->GetName(), | 550 m_pProperties[i]->GetName(), |
701 m_pFile->GetPosition(), m_end)); | 551 m_pFile->GetPosition(), m_end)); |
702 | 552 |
703 throw new MP4Error("atom is too small", "Atom ReadProperties"); | 553 throw new MP4Error("atom is too small", "Atom ReadProperties"); |
704 } | 554 } |
736 } | 586 } |
737 continue; | 587 continue; |
738 } | 588 } |
739 // otherwise, output a warning, but don't care | 589 // otherwise, output a warning, but don't care |
740 VERBOSE_WARNING(GetVerbosity(), | 590 VERBOSE_WARNING(GetVerbosity(), |
741 printf("Error: In %s atom, extra "D64" bytes at end of atom\n", | 591 printf("Error: In %s atom, extra %lld bytes at end of atom\n", |
742 m_type, (m_end - position))); | 592 m_type, (m_end - position))); |
743 for (uint64_t ix = 0; ix < m_end - position; ix++) { | 593 for (uint64_t ix = 0; ix < m_end - position; ix++) { |
744 m_pFile->ReadUInt8(); | 594 m_pFile->ReadUInt8(); |
745 } | 595 } |
746 continue; | 596 continue; |
848 | 698 |
849 void MP4Atom::FinishWrite(bool use64) | 699 void MP4Atom::FinishWrite(bool use64) |
850 { | 700 { |
851 m_end = m_pFile->GetPosition(); | 701 m_end = m_pFile->GetPosition(); |
852 m_size = (m_end - m_start); | 702 m_size = (m_end - m_start); |
703 VERBOSE_WRITE(GetVerbosity(), | |
704 printf("end: type %s %llu %llu size %llu\n", m_type, | |
705 m_start, m_end, | |
706 m_size)); | |
853 //use64 = m_pFile->Use64Bits(); | 707 //use64 = m_pFile->Use64Bits(); |
854 if (use64) { | 708 if (use64) { |
855 m_pFile->SetPosition(m_start + 8); | 709 m_pFile->SetPosition(m_start + 8); |
856 m_pFile->WriteUInt64(m_size); | 710 m_pFile->WriteUInt64(m_size); |
857 } else { | 711 } else { |