From 02090f335ddc49110f51af9851ae7a85e644d4c9 Mon Sep 17 00:00:00 2001 From: Tim Malseed Date: Sat, 16 Mar 2019 23:59:13 +1100 Subject: [PATCH] Fixed an MP4 AudioProperties parsing error (#892) The 'unit' (timescale) of 'mdhd' v1 atoms is a 32-bit unsigned integer (4 bytes long), but is parsed as a 64-bit integer (8 bytes long). This also affects the byte offset of the 'length' (duration). This results in MP4 AudioProperties reporting a track length of zero. This change addresses both problems. See: https://wiki.multimedia.cx/index.php/QuickTime_container --- taglib/mp4/mp4properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp index 5df7c3a2..261d58ae 100644 --- a/taglib/mp4/mp4properties.cpp +++ b/taglib/mp4/mp4properties.cpp @@ -195,8 +195,8 @@ MP4::AudioProperties::read(File *file, Atoms *atoms) debug("MP4: Atom 'trak.mdia.mdhd' is smaller than expected"); return; } - unit = data.toInt64BE(28); - length = data.toInt64BE(36); + unit = data.toUInt32BE(28); + length = data.toInt64BE(32); } else { if(data.size() < 24 + 4) {