changeset 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 a9593b76cf19
children 8e26022bb814
files src/aac/mp4ff/mp4ff.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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;