# HG changeset patch # User William Pitcock # Date 1241712255 18000 # Node ID 8c884237cecdf312bcf02314f625459bbd48bc49 # Parent a9593b76cf195afc3a5e43e4a8a473ff488072b1 mp4ff_num_samples(): check for track -1, cause that's not a good thing. diff -r a9593b76cf19 -r 8c884237cecd src/aac/mp4ff/mp4ff.c --- a/src/aac/mp4ff/mp4ff.c Thu May 07 15:31:32 2009 +0200 +++ b/src/aac/mp4ff/mp4ff.c Thu May 07 11:04:15 2009 -0500 @@ -291,22 +291,22 @@ return duration; } - int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track) { - int32_t i; - int32_t total = 0; + int32_t i; + int32_t total = 0; + + if (track < 0) + return -1; - for (i = 0; i < f->track[track]->stts_entry_count; i++) - { - total += f->track[track]->stts_sample_count[i]; - } - return total; + for (i = 0; i < f->track[track]->stts_entry_count; i++) + { + total += f->track[track]->stts_sample_count[i]; + } + + return total; } - - - uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track) { return f->track[track]->sampleRate;