#include "mp4.h"
struct mp4_track {
- uint16_t channelCount;
- uint16_t sampleRate;
+ /* mp4a */
+ uint16_t channel_count;
+ uint16_t sample_rate;
/* stsz */
uint32_t stsz_sample_size;
uint32_t stco_entry_count;
uint32_t *stco_chunk_offset;
- uint32_t timeScale;
+ /* mdhd */
+ uint32_t time_scale;
uint64_t duration;
};
ret = read_int32(f, NULL); /* reserved */
if (ret <= 0)
return ret;
- ret = read_int16(f, &t->channelCount);
+ ret = read_int16(f, &t->channel_count);
if (ret <= 0)
return ret;
ret = read_int16(f, NULL);
ret = read_int16(f, NULL);
if (ret <= 0)
return ret;
- return read_int16(f, &t->sampleRate);
+ return read_int16(f, &t->sample_rate);
}
static int read_stsd(struct mp4 *f)
ret = read_int64(f, NULL); /* modification-time */
if (ret <= 0)
return ret;
- ret = read_int32(f, &t->timeScale);
+ ret = read_int32(f, &t->time_scale);
if (ret <= 0)
return ret;
ret = read_int64(f, &t->duration);
ret = read_int32(f, NULL); /* modification-time */
if (ret <= 0)
return ret;
- ret = read_int32(f, &t->timeScale);
+ ret = read_int32(f, &t->time_scale);
if (ret <= 0)
return ret;
ret = read_int32(f, &temp);
{
const struct mp4_track *t = f->audio_track;
- if (t->timeScale == 0)
+ if (t->time_scale == 0)
return 0;
- return t->duration * 1000 / t->timeScale;
+ return t->duration * 1000 / t->time_scale;
}
int mp4_set_sample_position(struct mp4 *f, int32_t sample)
uint32_t mp4_get_sample_rate(const struct mp4 *f)
{
- return f->audio_track->sampleRate;
+ return f->audio_track->sample_rate;
}
uint32_t mp4_get_channel_count(const struct mp4 *f)
{
- return f->audio_track->channelCount ;
+ return f->audio_track->channel_count;
}
int32_t mp4_num_samples(const struct mp4 *f)