assert(chunk_num <= INT_MAX);
mp4ff_set_sample_position(c->mp4ff, c->track, chunk_num);
offset = c->fpos;
- ss = mp4ff_read_sample_getsize(c->mp4ff, c->track, chunk_num);
+ ss = mp4ff_get_sample_size(c->mp4ff, c->track, chunk_num);
if (ss <= 0)
return -E_MP4FF_BAD_SAMPLE;
assert(ss + offset <= c->mapsize);
mp4ff_set_position(f, offset);
}
-static int32_t mp4ff_audio_frame_size(const mp4ff_t * f, const int32_t track,
- const int32_t sample)
+int32_t mp4ff_get_sample_size(const mp4ff_t *f, int track, int sample)
{
- int32_t bytes;
- const mp4ff_track_t *p_track = f->track[track];
-
- if (p_track->stsz_sample_size) {
- bytes = p_track->stsz_sample_size;
- } else {
- bytes = p_track->stsz_table[sample];
- }
+ const mp4ff_track_t *t = f->track[track];
- return bytes;
-}
-
-int32_t mp4ff_read_sample_getsize(mp4ff_t * f, const int track,
- const int sample)
-{
- int32_t temp = mp4ff_audio_frame_size(f, track, sample);
- if (temp < 0)
- temp = 0;
- return temp;
+ if (t->stsz_sample_size != 0)
+ return t->stsz_sample_size;
+ return t->stsz_table[sample];
}
uint32_t mp4ff_get_sample_rate(const mp4ff_t * f, const int32_t track)
unsigned char** ppBuf, unsigned int* pBufSize);
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
void mp4ff_close(mp4ff_t *f);
-int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample);
+int32_t mp4ff_get_sample_size(const mp4ff_t *f, int track, int sample);
uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track);
uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track);
int32_t mp4ff_num_samples(const mp4ff_t *f, const int track);