]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Simplify read_mp4a().
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 20 Aug 2021 11:38:55 +0000 (13:38 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
The single caller resets the file offset after the call, so we may
stop reading the atom after we've parsed the last field of interest,
which happens to be the sample rate.

mp4.c

diff --git a/mp4.c b/mp4.c
index 2ca4ed8a7235f0ddb42ac8f7e2564602d7a93ef4..479a2b69c562b7c0724e68032259dc4c2330f908 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -550,7 +550,6 @@ static int read_mp4a(struct mp4 *f)
 {
        int ret;
        int32_t i;
-       uint8_t atom_type = 0;
        struct mp4_track *t;
 
        if (f->total_tracks == 0)
@@ -583,13 +582,7 @@ static int read_mp4a(struct mp4 *f)
        ret = read_int16(f, NULL);
        if (ret <= 0)
                return ret;
-       ret = read_int16(f, &t->sampleRate);
-       if (ret <= 0)
-               return ret;
-       ret = read_int16(f, NULL);
-       if (ret <= 0)
-               return ret;
-       return atom_read_header(f, &atom_type, NULL, NULL);
+       return read_int16(f, &t->sampleRate);
 }
 
 static int read_stsd(struct mp4 *f)