# HG changeset patch # User nenolod # Date 1151522687 25200 # Node ID 961f3f0aa2e8e43131c8841a3b736a54813e06fe # Parent 19e6c1f1d5097f117d4c8221aa992dfcab990fc8 [svn] - sanity checking prevents us from exploding when we encounter a file we don't support diff -r 19e6c1f1d509 -r 961f3f0aa2e8 ChangeLog --- a/ChangeLog Wed Jun 28 11:59:29 2006 -0700 +++ b/ChangeLog Wed Jun 28 12:24:47 2006 -0700 @@ -1,3 +1,12 @@ +2006-06-28 18:59:29 +0000 William Pitcock + revision [1602] + - cleanups + + + Changes: Modified: + +12 -57 trunk/Plugins/Input/aac/src/libmp4.c + + 2006-06-28 14:01:29 +0000 Tony Vroon revision [1600] Thanks to fluxinator this botched submission is now fixed. diff -r 19e6c1f1d509 -r 961f3f0aa2e8 Plugins/Input/aac/mp4ff/mp4ff.c --- a/Plugins/Input/aac/mp4ff/mp4ff.c Wed Jun 28 11:59:29 2006 -0700 +++ b/Plugins/Input/aac/mp4ff/mp4ff.c Wed Jun 28 12:24:47 2006 -0700 @@ -177,7 +177,7 @@ int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track, uint8_t** ppBuf, uint32_t* pBufSize) { - if (track >= f->total_tracks) + if (track < 0 || track >= f->total_tracks) { *ppBuf = NULL; *pBufSize = 0; @@ -204,7 +204,10 @@ int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track) { - return f->track[track]->type; + if (track < 0) + return -1; + + return f->track[track]->type; } int32_t mp4ff_total_tracks(const mp4ff_t *f) @@ -214,22 +217,34 @@ int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track) { + if (track < 0) + return -1; + return f->track[track]->timeScale; } uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track) { + if (track < 0) + return -1; + return f->track[track]->avgBitrate; } uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track) { + if (track < 0) + return -1; + return f->track[track]->maxBitrate; } int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track) { - return f->track[track]->duration; + if (track < 0) + return -1; + + return f->track[track]->duration; } int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track) @@ -250,6 +265,9 @@ 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]; diff -r 19e6c1f1d509 -r 961f3f0aa2e8 Plugins/Input/aac/src/libmp4.c --- a/Plugins/Input/aac/src/libmp4.c Wed Jun 28 11:59:29 2006 -0700 +++ b/Plugins/Input/aac/src/libmp4.c Wed Jun 28 12:24:47 2006 -0700 @@ -250,6 +250,9 @@ guint bufferSize = 0; faacDecHandle decoder; + if (mp4track == -1) + return NULL; + decoder = faacDecOpen(); mp4ff_get_decoder_config(mp4file, mp4track, &buffer, &bufferSize);