comparison Plugins/Input/aac/libmp4v2/mp4atom.cpp @ 199:0a2ad94e8607 trunk

[svn] Synced with bmp-mp4. Build system is fragile, but should work now.
author chainsaw
date Wed, 16 Nov 2005 16:21:11 -0800
parents fa848bd484d8
children f2dc045d2327
comparison
equal deleted inserted replaced
198:5a338b31e393 199:0a2ad94e8607
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;
87 case 'd': 107 case 'd':
88 if (ATOMID(type) == ATOMID("d263")) { 108 if (ATOMID(type) == ATOMID("d263")) {
89 pAtom = new MP4D263Atom(); 109 pAtom = new MP4D263Atom();
90 } else if (ATOMID(type) == ATOMID("damr")) { 110 } else if (ATOMID(type) == ATOMID("damr")) {
91 pAtom = new MP4DamrAtom(); 111 pAtom = new MP4DamrAtom();
112 } else if (ATOMID(type) == ATOMID("dinf")) {
113 pAtom = new MP4DinfAtom();
92 } else if (ATOMID(type) == ATOMID("dref")) { 114 } else if (ATOMID(type) == ATOMID("dref")) {
93 pAtom = new MP4DrefAtom(); 115 pAtom = new MP4DrefAtom();
94 } else if (ATOMID(type) == ATOMID("dpnd")) { 116 } else if (ATOMID(type) == ATOMID("dpnd")) {
95 pAtom = new MP4TrefTypeAtom(type); 117 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();
96 } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ 126 } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */
97 pAtom = new MP4DataAtom(); 127 pAtom = new MP4DataAtom();
128 } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */
129 pAtom = new MP4DiskAtom();
98 } 130 }
99 break; 131 break;
100 case 'e': 132 case 'e':
101 if (ATOMID(type) == ATOMID("elst")) { 133 if (ATOMID(type) == ATOMID("esds")) {
134 pAtom = new MP4EsdsAtom();
135 } else if (ATOMID(type) == ATOMID("edts")) {
136 pAtom = new MP4EdtsAtom();
137 } else if (ATOMID(type) == ATOMID("elst")) {
102 pAtom = new MP4ElstAtom(); 138 pAtom = new MP4ElstAtom();
103 } else if (ATOMID(type) == ATOMID("enca")) { 139 } else if (ATOMID(type) == ATOMID("enca")) {
104 pAtom = new MP4EncaAtom(); 140 pAtom = new MP4EncaAtom();
105 } else if (ATOMID(type) == ATOMID("encv")) { 141 } else if (ATOMID(type) == ATOMID("encv")) {
106 pAtom = new MP4EncvAtom(); 142 pAtom = new MP4EncvAtom();
107 } 143 }
108 break; 144 break;
109 case 'f': 145 case 'f':
110 if (ATOMID(type) == ATOMID("free")) { 146 if (ATOMID(type) == ATOMID("free")) {
111 pAtom = new MP4FreeAtom(); 147 pAtom = new MP4FreeAtom();
148 } else if (ATOMID(type) == ATOMID("frma")) {
149 pAtom = new MP4FrmaAtom();
112 } else if (ATOMID(type) == ATOMID("ftyp")) { 150 } else if (ATOMID(type) == ATOMID("ftyp")) {
113 pAtom = new MP4FtypAtom(); 151 pAtom = new MP4FtypAtom();
152 }
153 break;
154 case 'g':
155 if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes
156 pAtom = new MP4GnreAtom();
114 } 157 }
115 break; 158 break;
116 case 'h': 159 case 'h':
117 if (ATOMID(type) == ATOMID("hdlr")) { 160 if (ATOMID(type) == ATOMID("hdlr")) {
118 pAtom = new MP4HdlrAtom(); 161 pAtom = new MP4HdlrAtom();
162 } else if (ATOMID(type) == ATOMID("hmhd")) {
163 pAtom = new MP4HmhdAtom();
119 } else if (ATOMID(type) == ATOMID("hint")) { 164 } else if (ATOMID(type) == ATOMID("hint")) {
120 pAtom = new MP4TrefTypeAtom(type); 165 pAtom = new MP4TrefTypeAtom(type);
121 } else if (ATOMID(type) == ATOMID("hnti")) { 166 } else if (ATOMID(type) == ATOMID("hnti")) {
122 pAtom = new MP4HntiAtom(); 167 pAtom = new MP4HntiAtom();
123 } else if (ATOMID(type) == ATOMID("hinf")) { 168 } else if (ATOMID(type) == ATOMID("hinf")) {
124 pAtom = new MP4HinfAtom(); 169 pAtom = new MP4HinfAtom();
125 } else if (ATOMID(type) == ATOMID("h263")) { 170 } else if (ATOMID(type) == ATOMID("h263")) {
126 pAtom = new MP4VideoAtom("h263"); 171 pAtom = new MP4VideoAtom("h263");
127 } else if (ATOMID(type) == ATOMID("href")) {
128 pAtom = new MP4HrefAtom();
129 } 172 }
130 break; 173 break;
131 case 'i': 174 case 'i':
132 if (ATOMID(type) == ATOMID("ipir")) { 175 if (ATOMID(type) == ATOMID("iKMS")) {
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")) {
133 pAtom = new MP4TrefTypeAtom(type); 182 pAtom = new MP4TrefTypeAtom(type);
183 } else if (ATOMID(type) == ATOMID("ilst")) {
184 pAtom = new MP4IlstAtom();
134 } else if (ATOMID(type) == ATOMID("ima4")) { 185 } else if (ATOMID(type) == ATOMID("ima4")) {
135 pAtom = new MP4SoundAtom("ima4"); 186 pAtom = new MP4SoundAtom("ima4");
136 } 187 }
137 break; 188 break;
138 case 'j': 189 case 'j':
139 if (ATOMID(type) == ATOMID("jpeg")) { 190 if (ATOMID(type) == ATOMID("jpeg")) {
140 pAtom = new MP4VideoAtom("jpeg"); 191 pAtom = new MP4VideoAtom("jpeg");
141 } 192 }
142 break; 193 break;
143 case 'm': 194 case 'm':
144 if (ATOMID(type) == ATOMID("mdhd")) { 195 if (ATOMID(type) == ATOMID("mdia")) {
196 pAtom = new MP4MdiaAtom();
197 } else if (ATOMID(type) == ATOMID("minf")) {
198 pAtom = new MP4MinfAtom();
199 } else if (ATOMID(type) == ATOMID("mdhd")) {
145 pAtom = new MP4MdhdAtom(); 200 pAtom = new MP4MdhdAtom();
201 } else if (ATOMID(type) == ATOMID("mdat")) {
202 pAtom = new MP4MdatAtom();
203 } else if (ATOMID(type) == ATOMID("moov")) {
204 pAtom = new MP4MoovAtom();
146 } else if (ATOMID(type) == ATOMID("mvhd")) { 205 } else if (ATOMID(type) == ATOMID("mvhd")) {
147 pAtom = new MP4MvhdAtom(); 206 pAtom = new MP4MvhdAtom();
148 } else if (ATOMID(type) == ATOMID("mdat")) {
149 pAtom = new MP4MdatAtom();
150 } else if (ATOMID(type) == ATOMID("mpod")) { 207 } else if (ATOMID(type) == ATOMID("mpod")) {
151 pAtom = new MP4TrefTypeAtom(type); 208 pAtom = new MP4TrefTypeAtom(type);
152 } else if (ATOMID(type) == ATOMID("mp4a")) { 209 } else if (ATOMID(type) == ATOMID("mp4a")) {
153 pAtom = new MP4Mp4aAtom(); 210 pAtom = new MP4Mp4aAtom();
154 } else if (ATOMID(type) == ATOMID("mp4s")) { 211 } else if (ATOMID(type) == ATOMID("mp4s")) {
155 pAtom = new MP4Mp4sAtom(); 212 pAtom = new MP4Mp4sAtom();
156 } else if (ATOMID(type) == ATOMID("mp4v")) { 213 } else if (ATOMID(type) == ATOMID("mp4v")) {
157 pAtom = new MP4Mp4vAtom(); 214 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();
158 } else if (ATOMID(type) == ATOMID("mean")) { // iTunes 225 } else if (ATOMID(type) == ATOMID("mean")) { // iTunes
159 pAtom = new MP4MeanAtom(); 226 pAtom = new MP4MeanAtom();
160 } 227 }
161 break; 228 break;
162 case 'n': 229 case 'n':
163 if (ATOMID(type) == ATOMID("name")) { // iTunes 230 if (ATOMID(type) == ATOMID("nmhd")) {
231 pAtom = new MP4NmhdAtom();
232 } else if (ATOMID(type) == ATOMID("nump")) {
233 pAtom = new MP4NumpAtom();
234 } else if (ATOMID(type) == ATOMID("name")) { // iTunes
164 pAtom = new MP4NameAtom(); 235 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();
165 } 243 }
166 break; 244 break;
167 case 'r': 245 case 'r':
168 if (ATOMID(type) == ATOMID("rtp ")) { 246 if (ATOMID(type) == ATOMID("rtp ")) {
169 pAtom = new MP4RtpAtom(); 247 pAtom = new MP4RtpAtom();
176 pAtom = new MP4S263Atom(); 254 pAtom = new MP4S263Atom();
177 } else if (ATOMID(type) == ATOMID("samr")) { 255 } else if (ATOMID(type) == ATOMID("samr")) {
178 pAtom = new MP4AmrAtom("samr"); 256 pAtom = new MP4AmrAtom("samr");
179 } else if (ATOMID(type) == ATOMID("sawb")) { 257 } else if (ATOMID(type) == ATOMID("sawb")) {
180 pAtom = new MP4AmrAtom("sawb"); 258 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();
181 } else if (ATOMID(type) == ATOMID("stbl")) { 265 } else if (ATOMID(type) == ATOMID("stbl")) {
182 pAtom = new MP4StblAtom(); 266 pAtom = new MP4StblAtom();
183 } else if (ATOMID(type) == ATOMID("stsd")) { 267 } else if (ATOMID(type) == ATOMID("stsd")) {
184 pAtom = new MP4StsdAtom(); 268 pAtom = new MP4StsdAtom();
269 } else if (ATOMID(type) == ATOMID("stts")) {
270 pAtom = new MP4SttsAtom();
185 } else if (ATOMID(type) == ATOMID("stsz")) { 271 } else if (ATOMID(type) == ATOMID("stsz")) {
186 pAtom = new MP4StszAtom(); 272 pAtom = new MP4StszAtom();
187 } else if (ATOMID(type) == ATOMID("stsc")) { 273 } else if (ATOMID(type) == ATOMID("stsc")) {
188 pAtom = new MP4StscAtom(); 274 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();
189 } else if (ATOMID(type) == ATOMID("stdp")) { 281 } else if (ATOMID(type) == ATOMID("stdp")) {
190 pAtom = new MP4StdpAtom(); 282 pAtom = new MP4StdpAtom();
283 } else if (ATOMID(type) == ATOMID("smhd")) {
284 pAtom = new MP4SmhdAtom();
191 } else if (ATOMID(type) == ATOMID("sdp ")) { 285 } else if (ATOMID(type) == ATOMID("sdp ")) {
192 pAtom = new MP4SdpAtom(); 286 pAtom = new MP4SdpAtom();
287 } else if (ATOMID(type) == ATOMID("snro")) {
288 pAtom = new MP4SnroAtom();
193 } else if (ATOMID(type) == ATOMID("sync")) { 289 } else if (ATOMID(type) == ATOMID("sync")) {
194 pAtom = new MP4TrefTypeAtom(type); 290 pAtom = new MP4TrefTypeAtom(type);
195 } else if (ATOMID(type) == ATOMID("skip")) { 291 } else if (ATOMID(type) == ATOMID("skip")) {
196 pAtom = new MP4FreeAtom(); 292 pAtom = new MP4FreeAtom();
197 pAtom->SetType("skip"); 293 pAtom->SetType("skip");
198 } else if (ATOMID(type) == ATOMID("sowt")) { 294 } else if (ATOMID(type) == ATOMID("sowt")) {
199 pAtom = new MP4SoundAtom("sowt"); 295 pAtom = new MP4SoundAtom("sowt");
200 } 296 }
201 break; 297 break;
202 case 't': 298 case 't':
203 if (ATOMID(type) == ATOMID("tkhd")) { 299 if (ATOMID(type) == ATOMID("trak")) {
300 pAtom = new MP4TrakAtom();
301 } else if (ATOMID(type) == ATOMID("tkhd")) {
204 pAtom = new MP4TkhdAtom(); 302 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();
205 } else if (ATOMID(type) == ATOMID("tfhd")) { 307 } else if (ATOMID(type) == ATOMID("tfhd")) {
206 pAtom = new MP4TfhdAtom(); 308 pAtom = new MP4TfhdAtom();
309 } else if (ATOMID(type) == ATOMID("trex")) {
310 pAtom = new MP4TrexAtom();
207 } else if (ATOMID(type) == ATOMID("trun")) { 311 } else if (ATOMID(type) == ATOMID("trun")) {
208 pAtom = new MP4TrunAtom(); 312 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();
209 } else if (ATOMID(type) == ATOMID("twos")) { 329 } else if (ATOMID(type) == ATOMID("twos")) {
210 pAtom = new MP4SoundAtom("twos"); 330 pAtom = new MP4SoundAtom("twos");
211 } 331 }
212 break; 332 break;
213 case 'u': 333 case 'u':
236 pAtom = new MP4VideoAtom("SVQ3"); 356 pAtom = new MP4VideoAtom("SVQ3");
237 } else if (ATOMID(type) == ATOMID("SMI ")) { 357 } else if (ATOMID(type) == ATOMID("SMI ")) {
238 pAtom = new MP4SmiAtom(); 358 pAtom = new MP4SmiAtom();
239 } 359 }
240 break; 360 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 }
241 } 393 }
242 } 394 }
243 395
244 if (pAtom == NULL) { 396 if (pAtom == NULL) {
245 pAtom = new MP4StandardAtom(type); 397 pAtom = new MP4Atom(type);
246 // unknown type is set by StandardAtom type 398 pAtom->SetUnknownType(true);
247 } 399 }
248 400
249 ASSERT(pAtom); 401 ASSERT(pAtom);
250 return pAtom; 402 return pAtom;
251 } 403 }
285 u_int8_t extendedType[16]; 437 u_int8_t extendedType[16];
286 438
287 u_int64_t pos = pFile->GetPosition(); 439 u_int64_t pos = pFile->GetPosition();
288 440
289 VERBOSE_READ(pFile->GetVerbosity(), 441 VERBOSE_READ(pFile->GetVerbosity(),
290 printf("ReadAtom: pos = 0x%llx\n", pos)); 442 printf("ReadAtom: pos = 0x"X64"\n", pos));
291 443
292 u_int64_t dataSize = pFile->ReadUInt32(); 444 u_int64_t dataSize = pFile->ReadUInt32();
293 445
294 char type[5]; 446 char type[5];
295 pFile->ReadBytes((u_int8_t*)&type[0], 4); 447 pFile->ReadBytes((u_int8_t*)&type[0], 4);
313 } 465 }
314 466
315 dataSize -= hdrSize; 467 dataSize -= hdrSize;
316 468
317 VERBOSE_READ(pFile->GetVerbosity(), 469 VERBOSE_READ(pFile->GetVerbosity(),
318 printf("ReadAtom: type = \"%s\" data-size = %llu (0x%llx) hdr %u\n", 470 printf("ReadAtom: type = %s data-size = "U64" (0x"X64")\n",
319 type, dataSize, dataSize, hdrSize)); 471 type, dataSize, dataSize));
320 472
321 if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { 473 if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) {
322 VERBOSE_ERROR(pFile->GetVerbosity(), 474 VERBOSE_ERROR(pFile->GetVerbosity(),
323 printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of \"%s\" \"%s\" %llu vs %llu\n", 475 printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of %s \"%s\"\n",
324 pParentAtom->GetType(), type, 476 pParentAtom->GetType(), type));
325 pos + hdrSize + dataSize,
326 pParentAtom->GetEnd()));
327 VERBOSE_READ(pFile->GetVerbosity(), 477 VERBOSE_READ(pFile->GetVerbosity(),
328 printf("parent %s (%llu) pos %llu hdr %d data %llu sum %llu\n", 478 printf("parent %s ("U64") pos "U64" hdr %d data "U64" sum "U64"\n",
329 pParentAtom->GetType(), 479 pParentAtom->GetType(),
330 pParentAtom->GetEnd(), 480 pParentAtom->GetEnd(),
331 pos, 481 pos,
332 hdrSize, 482 hdrSize,
333 dataSize, 483 dataSize,
390 { 540 {
391 ASSERT(m_pFile); 541 ASSERT(m_pFile);
392 542
393 if (ATOMID(m_type) != 0 && m_size > 1000000) { 543 if (ATOMID(m_type) != 0 && m_size > 1000000) {
394 VERBOSE_READ(GetVerbosity(), 544 VERBOSE_READ(GetVerbosity(),
395 printf("Warning: %s atom size %llu is suspect\n", 545 printf("Warning: %s atom size "U64" is suspect\n",
396 m_type, m_size)); 546 m_type, m_size));
397 } 547 }
398 548
399 ReadProperties(); 549 ReadProperties();
400 550
408 558
409 void MP4Atom::Skip() 559 void MP4Atom::Skip()
410 { 560 {
411 if (m_pFile->GetPosition() != m_end) { 561 if (m_pFile->GetPosition() != m_end) {
412 VERBOSE_READ(m_pFile->GetVerbosity(), 562 VERBOSE_READ(m_pFile->GetVerbosity(),
413 printf("Skip: %llu bytes\n", m_end - m_pFile->GetPosition())); 563 printf("Skip: "U64" bytes\n", m_end - m_pFile->GetPosition()));
414 } 564 }
415 m_pFile->SetPosition(m_end); 565 m_pFile->SetPosition(m_end);
416 } 566 }
417 567
418 MP4Atom* MP4Atom::FindAtom(const char* name) 568 MP4Atom* MP4Atom::FindAtom(const char* name)
544 694
545 m_pProperties[i]->Read(m_pFile); 695 m_pProperties[i]->Read(m_pFile);
546 696
547 if (m_pFile->GetPosition() > m_end) { 697 if (m_pFile->GetPosition() > m_end) {
548 VERBOSE_READ(GetVerbosity(), 698 VERBOSE_READ(GetVerbosity(),
549 printf("ReadProperties: insufficient data for property: %s pos 0x%llx atom end 0x%llx\n", 699 printf("ReadProperties: insufficient data for property: %s pos 0x"X64" atom end 0x"X64"\n",
550 m_pProperties[i]->GetName(), 700 m_pProperties[i]->GetName(),
551 m_pFile->GetPosition(), m_end)); 701 m_pFile->GetPosition(), m_end));
552 702
553 throw new MP4Error("atom is too small", "Atom ReadProperties"); 703 throw new MP4Error("atom is too small", "Atom ReadProperties");
554 } 704 }
586 } 736 }
587 continue; 737 continue;
588 } 738 }
589 // otherwise, output a warning, but don't care 739 // otherwise, output a warning, but don't care
590 VERBOSE_WARNING(GetVerbosity(), 740 VERBOSE_WARNING(GetVerbosity(),
591 printf("Error: In %s atom, extra %lld bytes at end of atom\n", 741 printf("Error: In %s atom, extra "D64" bytes at end of atom\n",
592 m_type, (m_end - position))); 742 m_type, (m_end - position)));
593 for (uint64_t ix = 0; ix < m_end - position; ix++) { 743 for (uint64_t ix = 0; ix < m_end - position; ix++) {
594 m_pFile->ReadUInt8(); 744 m_pFile->ReadUInt8();
595 } 745 }
596 continue; 746 continue;
698 848
699 void MP4Atom::FinishWrite(bool use64) 849 void MP4Atom::FinishWrite(bool use64)
700 { 850 {
701 m_end = m_pFile->GetPosition(); 851 m_end = m_pFile->GetPosition();
702 m_size = (m_end - m_start); 852 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));
707 //use64 = m_pFile->Use64Bits(); 853 //use64 = m_pFile->Use64Bits();
708 if (use64) { 854 if (use64) {
709 m_pFile->SetPosition(m_start + 8); 855 m_pFile->SetPosition(m_start + 8);
710 m_pFile->WriteUInt64(m_size); 856 m_pFile->WriteUInt64(m_size);
711 } else { 857 } else {