]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Simplify sample_range_size().
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 18 Aug 2021 18:46:52 +0000 (20:46 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
Reduce indentation by making the else branch unconditional and simply
call the track pointer "t" rather than "p_track".

mp4.c

diff --git a/mp4.c b/mp4.c
index 1b387534d6adcbca4521472d473ebad49c7973cb..89d90c7366431ecaa6a7ee64f306be3c09228833 100644 (file)
--- 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;
 }