#include "mp4.h"
struct mp4_track {
- int32_t type;
+ bool is_audio;
int32_t channelCount;
int32_t sampleSize;
uint16_t sampleRate;
return 0;
}
-enum tracks {
- TRACK_UNKNOWN = 0,
- TRACK_AUDIO = 1,
- TRACK_VIDEO = 2,
- TRACK_SYSTEM = 3
-};
-
enum atoms {
/* atoms with subatoms */
ATOM_MOOV = 1,
uint8_t atom_type = 0;
size = atom_read_header(f, &atom_type, &header_size);
skip += size;
-
- if (atom_type == ATOM_MP4A) {
- t->type = TRACK_AUDIO;
+ t->is_audio = atom_type == ATOM_MP4A;
+ if (t->is_audio)
read_mp4a(f);
- } else if (atom_type == ATOM_MP4V) {
- t->type = TRACK_VIDEO;
- } else if (atom_type == ATOM_MP4S) {
- t->type = TRACK_SYSTEM;
- } else {
- t->type = TRACK_UNKNOWN;
- }
set_position(f, skip);
}
*/
bool mp4_is_audio_track(const struct mp4 *f, int32_t track)
{
- return f->track[track]->type == TRACK_AUDIO;
+ return f->track[track]->is_audio;
}
void mp4_set_sample_position(struct mp4 *f, int32_t track, int32_t sample)