Mercurial > libavformat.hg
comparison mov.c @ 1446:a353426e83e5 libavformat
reintroduce isom field and read version 1 audio stsd only if file is not isom, fix testclip_wrong_version_1_audio_stsd.mp4
author | bcoudurier |
---|---|
date | Fri, 03 Nov 2006 15:02:51 +0000 |
parents | 404048ea11bc |
children | da1e7a00d3a2 |
comparison
equal
deleted
inserted
replaced
1445:db97355877b1 | 1446:a353426e83e5 |
---|---|
283 AVPaletteControl palette_control; | 283 AVPaletteControl palette_control; |
284 MOV_mdat_atom_t *mdat_list; | 284 MOV_mdat_atom_t *mdat_list; |
285 int mdat_count; | 285 int mdat_count; |
286 DVDemuxContext *dv_demux; | 286 DVDemuxContext *dv_demux; |
287 AVFormatContext *dv_fctx; | 287 AVFormatContext *dv_fctx; |
288 int isom; /* 1 if file is ISO Media (mp4/3gp) */ | |
288 } MOVContext; | 289 } MOVContext; |
289 | 290 |
290 | 291 |
291 /* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */ | 292 /* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */ |
292 | 293 |
403 ctype = get_le32(pb); | 404 ctype = get_le32(pb); |
404 type = get_le32(pb); /* component subtype */ | 405 type = get_le32(pb); /* component subtype */ |
405 | 406 |
406 dprintf("ctype= %c%c%c%c (0x%08lx)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype); | 407 dprintf("ctype= %c%c%c%c (0x%08lx)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype); |
407 dprintf("stype= %c%c%c%c\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]); | 408 dprintf("stype= %c%c%c%c\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]); |
409 if(!ctype) | |
410 c->isom = 1; | |
408 if(type == MKTAG('v', 'i', 'd', 'e')) | 411 if(type == MKTAG('v', 'i', 'd', 'e')) |
409 st->codec->codec_type = CODEC_TYPE_VIDEO; | 412 st->codec->codec_type = CODEC_TYPE_VIDEO; |
410 else if(type == MKTAG('s', 'o', 'u', 'n')) | 413 else if(type == MKTAG('s', 'o', 'u', 'n')) |
411 st->codec->codec_type = CODEC_TYPE_AUDIO; | 414 st->codec->codec_type = CODEC_TYPE_AUDIO; |
412 get_be32(pb); /* component manufacture */ | 415 get_be32(pb); /* component manufacture */ |
504 | 507 |
505 static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 508 static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
506 { | 509 { |
507 uint32_t type = get_le32(pb); | 510 uint32_t type = get_le32(pb); |
508 | 511 |
512 if (type != MKTAG('q','t',' ',' ')) | |
513 c->isom = 1; | |
509 av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); | 514 av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); |
510 get_be32(pb); /* minor version */ | 515 get_be32(pb); /* minor version */ |
511 url_fskip(pb, atom.size - 8); | 516 url_fskip(pb, atom.size - 8); |
512 return 0; | 517 return 0; |
513 } | 518 } |
944 default: | 949 default: |
945 break; | 950 break; |
946 } | 951 } |
947 | 952 |
948 //Read QT version 1 fields. In version 0 theese dont exist | 953 //Read QT version 1 fields. In version 0 theese dont exist |
949 dprintf("version =%d\n",version); | 954 dprintf("version =%d, isom =%d\n",version,c->isom); |
955 if(!c->isom) { | |
950 if(version==1) { | 956 if(version==1) { |
951 sc->sample_size_v1.den = get_be32(pb); /* samples per packet */ | 957 sc->sample_size_v1.den = get_be32(pb); /* samples per packet */ |
952 get_be32(pb); /* bytes per packet */ | 958 get_be32(pb); /* bytes per packet */ |
953 sc->sample_size_v1.num = get_be32(pb); /* bytes per frame */ | 959 sc->sample_size_v1.num = get_be32(pb); /* bytes per frame */ |
954 get_be32(pb); /* bytes per sample */ | 960 get_be32(pb); /* bytes per sample */ |
959 get_be32(pb); /* always 0x7F000000 */ | 965 get_be32(pb); /* always 0x7F000000 */ |
960 get_be32(pb); /* bits per channel if sound is uncompressed */ | 966 get_be32(pb); /* bits per channel if sound is uncompressed */ |
961 get_be32(pb); /* lcpm format specific flag */ | 967 get_be32(pb); /* lcpm format specific flag */ |
962 get_be32(pb); /* bytes per audio packet if constant */ | 968 get_be32(pb); /* bytes per audio packet if constant */ |
963 get_be32(pb); /* lpcm frames per audio packet if constant */ | 969 get_be32(pb); /* lpcm frames per audio packet if constant */ |
970 } | |
964 } | 971 } |
965 | 972 |
966 bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); | 973 bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); |
967 if (bits_per_sample) { | 974 if (bits_per_sample) { |
968 st->codec->bits_per_sample = bits_per_sample; | 975 st->codec->bits_per_sample = bits_per_sample; |