From: Andre Noll Date: Fri, 20 Aug 2021 11:38:55 +0000 (+0200) Subject: mp4: Simplify read_mp4a(). X-Git-Tag: v0.7.1~7^2~42 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=e4897ce9b79a58a0ccfe5f6fc2b6d4738710f93f;p=paraslash.git mp4: Simplify read_mp4a(). 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. --- diff --git a/mp4.c b/mp4.c index 2ca4ed8a..479a2b69 100644 --- 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)