Beispiel #1
0
/* read atom header, return atom size, atom size is with header included */
uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size)
{
    uint64_t size;
    int32_t ret;
    int8_t atom_header[8];

    ret = mp4ff_read_data(f, atom_header, 8);
    if (ret != 8)
        return 0;

    size = mp4ff_atom_get_size(atom_header);
    *header_size = 8;

    /* check for 64 bit atom size */
    if (size == 1)
    {
        *header_size = 16;
        size = mp4ff_read_int64(f);
    }

    //printf("%c%c%c%c\n", atom_header[4], atom_header[5], atom_header[6], atom_header[7]);

    *atom_type = mp4ff_atom_name_to_type(atom_header[4], atom_header[5], atom_header[6], atom_header[7]);

    return size;
}
Beispiel #2
0
static int32_t mp4ff_read_frma(mp4ff_t *f)
{
    uint8_t atom_type;
    int8_t type[4];

    mp4ff_read_data(f, type, 4);

    atom_type = mp4ff_atom_name_to_type(type[0], type[1], type[2], type[3]);

    if (atom_type == ATOM_MP4A)
    {
        f->track[f->total_tracks - 1]->type = TRACK_AUDIO;
    } else if (atom_type == ATOM_MP4V) {
        f->track[f->total_tracks - 1]->type = TRACK_VIDEO;
    } else if (atom_type == ATOM_MP4S) {
        f->track[f->total_tracks - 1]->type = TRACK_SYSTEM;
    } else {
        f->track[f->total_tracks - 1]->type = TRACK_UNKNOWN;
    }

    return 0;
}