ret = -E_MP4_BAD_SAMPLE_COUNT;
if (f->track.stsz_sample_count == 0)
goto fail;
+ ret = -E_MP4_CORRUPT;
+ if (f->track.time_scale == 0)
+ goto fail;
*result = f;
return 1;
fail:
{
const struct mp4_track *t = &f->track;
- if (t->time_scale == 0)
- return 0;
return t->duration * 1000 / t->time_scale;
}
uint32_t mp4_num_samples(const struct mp4 *f)
{
- const struct mp4_track *t = &f->track;
- uint32_t total = 0;
-
- for (uint32_t n = 0; n < t->stts_entry_count; n++)
- total += t->stts_sample_count[n];
- return total;
+ return f->track.stsz_sample_count;
}
int mp4_open_meta(const struct mp4_callback *cb, struct mp4 **result)