ATOM_DATE,
ATOM_COMMENT,
- SUBATOMIC = 128,
-
/* atoms without subatoms */
ATOM_MDHD, /* track header */
ATOM_STSD, /* sample description box */
return 1;
}
-static int parse_leaf_atom(struct mp4 *f, uint64_t size, uint8_t header_size,
- uint8_t atom_type)
-{
- uint64_t dest_position = get_position(f) + size - 8;
- int ret = 1; /* return success for atoms we don't care about */
-
- switch (atom_type) {
- case ATOM_STSZ: ret = read_stsz(f); break;
- case ATOM_STTS: ret = read_stts(f); break;
- case ATOM_STSC: ret = read_stsc(f); break;
- case ATOM_STCO: ret = read_stco(f); break;
- case ATOM_STSD: ret = read_stsd(f); break;
- case ATOM_MDHD: ret = read_mdhd(f); break;
- case ATOM_META:
- f->meta_offset = get_position(f) - header_size;
- f->meta_size = size;
- ret = read_meta(f, size);
- break;
- }
- set_position(f, dest_position);
- return ret;
-}
-
static bool need_atom(uint8_t atom_type, bool meta_only)
{
/* these are needed in any case */
}
if (!need_atom(atom_type, meta_only))
continue;
- if (atom_type < SUBATOMIC) /* atom contains subatoms */
+ switch (atom_type) {
+ case ATOM_STSZ: ret = read_stsz(f); break;
+ case ATOM_STTS: ret = read_stts(f); break;
+ case ATOM_STSC: ret = read_stsc(f); break;
+ case ATOM_STCO: ret = read_stco(f); break;
+ case ATOM_STSD: ret = read_stsd(f); break;
+ case ATOM_MDHD: ret = read_mdhd(f); break;
+ case ATOM_META:
+ f->meta_offset = get_position(f) - header_size;
+ f->meta_size = size;
+ ret = read_meta(f, size);
+ break;
+ default:
ret = parse_sub_atoms(f, size - header_size, meta_only);
- else
- ret = parse_leaf_atom(f, size, header_size, atom_type);
+ }
if (ret <= 0)
return ret;
}