-
- *chunk_sample = total + (*chunk - chunk1) * chunk1samples;
-
- return 0;
-}
-
-static int32_t chunk_to_offset(const struct mp4 *f, int32_t track,
- int32_t chunk)
-{
- const struct mp4_track *p_track = f->track[track];
-
- if (p_track->stco_entry_count && (chunk > p_track->stco_entry_count)) {
- return p_track->stco_chunk_offset[p_track->stco_entry_count -
- 1];
- } else if (p_track->stco_entry_count) {
- return p_track->stco_chunk_offset[chunk - 1];
- } else {
- return 8;
- }
-
- return 0;
-}
-
-static int32_t sample_range_size(const struct mp4 *f, int32_t track,
- int32_t chunk_sample, int32_t sample)
-{
- int32_t i, total;
- const struct mp4_track *p_track = f->track[track];
-
- if (p_track->stsz_sample_size) {
- return (sample - chunk_sample) * p_track->stsz_sample_size;
- } else {
- if (sample >= p_track->stsz_sample_count)
- return 0; //error
-
- for (i = chunk_sample, total = 0; i < sample; i++) {
- total += p_track->stsz_table[i];
- }
- }
-
- return total;