From: Andre Noll Date: Wed, 18 Aug 2021 18:46:52 +0000 (+0200) Subject: mp4: Simplify sample_range_size(). X-Git-Tag: v0.7.1~7^2~54 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=6663ff04ae902bdea92b35b3b8dbdccd459d9099;p=paraslash.git mp4: Simplify sample_range_size(). Reduce indentation by making the else branch unconditional and simply call the track pointer "t" rather than "p_track". --- diff --git a/mp4.c b/mp4.c index 1b387534..89d90c73 100644 --- a/mp4.c +++ b/mp4.c @@ -1046,19 +1046,14 @@ static int32_t sample_range_size(const struct mp4 *f, int32_t track, int32_t chunk_sample, int32_t sample) { int32_t i, total; - const struct mp4_track *p_track = f->track[track]; - - if (p_track->stsz_sample_size) { - return (sample - chunk_sample) * p_track->stsz_sample_size; - } else { - if (sample >= p_track->stsz_sample_count) - return 0; //error - - for (i = chunk_sample, total = 0; i < sample; i++) { - total += p_track->stsz_table[i]; - } - } + const struct mp4_track *t = f->track[track]; + if (t->stsz_sample_size) + return (sample - chunk_sample) * t->stsz_sample_size; + if (sample >= t->stsz_sample_count) + return 0; /* error */ + for (i = chunk_sample, total = 0; i < sample; i++) + total += t->stsz_table[i]; return total; }