comparison mov.c @ 6173:1b9079c05f9a libavformat

Improve mov atom parsing debug message, print parent atom and size in decimal
author bcoudurier
date Fri, 25 Jun 2010 01:19:03 +0000
parents 2bab410094e0
children d81e41261983
comparison
equal deleted inserted replaced
6172:b8c470fec3f7 6173:1b9079c05f9a
264 if(atom.size >= 8) { 264 if(atom.size >= 8) {
265 a.size = get_be32(pb); 265 a.size = get_be32(pb);
266 a.type = get_le32(pb); 266 a.type = get_le32(pb);
267 } 267 }
268 total_size += 8; 268 total_size += 8;
269 dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", 269 dprintf(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
270 a.type, (char*)&a.type, a.size, atom.size, total_size); 270 a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
271 if (a.size == 1) { /* 64 bit extended size */ 271 if (a.size == 1) { /* 64 bit extended size */
272 a.size = get_be64(pb) - 8; 272 a.size = get_be64(pb) - 8;
273 total_size += 8; 273 total_size += 8;
274 } 274 }
275 if (a.size == 0) { 275 if (a.size == 0) {
958 958
959 for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) { 959 for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
960 //Parsing Sample description table 960 //Parsing Sample description table
961 enum CodecID id; 961 enum CodecID id;
962 int dref_id = 1; 962 int dref_id = 1;
963 MOVAtom a = { 0 }; 963 MOVAtom a = { AV_RL32("stsd") };
964 int64_t start_pos = url_ftell(pb); 964 int64_t start_pos = url_ftell(pb);
965 int size = get_be32(pb); /* size */ 965 int size = get_be32(pb); /* size */
966 uint32_t format = get_le32(pb); /* data format */ 966 uint32_t format = get_le32(pb); /* data format */
967 967
968 if (size >= 16) { 968 if (size >= 16) {
2364 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) 2364 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
2365 { 2365 {
2366 MOVContext *mov = s->priv_data; 2366 MOVContext *mov = s->priv_data;
2367 ByteIOContext *pb = s->pb; 2367 ByteIOContext *pb = s->pb;
2368 int err; 2368 int err;
2369 MOVAtom atom = { 0 }; 2369 MOVAtom atom = { AV_RL32("root") };
2370 2370
2371 mov->fc = s; 2371 mov->fc = s;
2372 /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ 2372 /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
2373 if(!url_is_streamed(pb)) 2373 if(!url_is_streamed(pb))
2374 atom.size = url_fsize(pb); 2374 atom.size = url_fsize(pb);
2428 retry: 2428 retry:
2429 sample = mov_find_next_sample(s, &st); 2429 sample = mov_find_next_sample(s, &st);
2430 if (!sample) { 2430 if (!sample) {
2431 mov->found_mdat = 0; 2431 mov->found_mdat = 0;
2432 if (!url_is_streamed(s->pb) || 2432 if (!url_is_streamed(s->pb) ||
2433 mov_read_default(mov, s->pb, (MOVAtom){ 0, INT64_MAX }) < 0 || 2433 mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
2434 url_feof(s->pb)) 2434 url_feof(s->pb))
2435 return AVERROR_EOF; 2435 return AVERROR_EOF;
2436 dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); 2436 dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
2437 goto retry; 2437 goto retry;
2438 } 2438 }