Mercurial > audlegacy-plugins
comparison src/aac/mp4ff/mp4ff.c @ 3137:8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 07 May 2009 11:04:15 -0500 |
parents | 3d6a2732f26a |
children |
comparison
equal
deleted
inserted
replaced
3136:a9593b76cf19 | 3137:8c884237cecd |
---|---|
289 else duration -= offset; | 289 else duration -= offset; |
290 } | 290 } |
291 return duration; | 291 return duration; |
292 } | 292 } |
293 | 293 |
294 | |
295 int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track) | 294 int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track) |
296 { | 295 { |
297 int32_t i; | 296 int32_t i; |
298 int32_t total = 0; | 297 int32_t total = 0; |
299 | 298 |
300 for (i = 0; i < f->track[track]->stts_entry_count; i++) | 299 if (track < 0) |
301 { | 300 return -1; |
302 total += f->track[track]->stts_sample_count[i]; | 301 |
303 } | 302 for (i = 0; i < f->track[track]->stts_entry_count; i++) |
304 return total; | 303 { |
305 } | 304 total += f->track[track]->stts_sample_count[i]; |
306 | 305 } |
307 | 306 |
308 | 307 return total; |
308 } | |
309 | 309 |
310 uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track) | 310 uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track) |
311 { | 311 { |
312 return f->track[track]->sampleRate; | 312 return f->track[track]->sampleRate; |
313 } | 313 } |