return 1;
}
-int32_t mp4_get_sample_size(const struct mp4 *f, int sample)
+int mp4_get_sample_size(const struct mp4 *f, uint32_t sample, uint32_t *result)
{
const struct mp4_track *t = &f->track;
+ if (sample >= t->stsz_sample_count)
+ return -ERRNO_TO_PARA_ERROR(EINVAL);
if (t->stsz_sample_size != 0)
- return t->stsz_sample_size;
- return t->stsz_table[sample];
+ *result = t->stsz_sample_size;
+ else
+ *result = t->stsz_table[sample];
+ return 1;
}
uint32_t mp4_get_sample_rate(const struct mp4 *f)