diff options
author | Tim Malseed <t.malseed@gmail.com> | 2019-03-18 00:22:19 +1100 |
---|---|---|
committer | Stephen F. Booth <me@sbooth.org> | 2019-03-17 08:22:19 -0500 |
commit | 6455671ecef7014ee83e91e1fd4e1f9b93dff53a (patch) | |
tree | 4181fda717c8ca4de5b4b68d9572550ae3bd7a49 | |
parent | 660748210fed054e886095c75c8e9f62276f4320 (diff) |
Update mp4properties.cpp (#893)
When parsing mp4 media header version 1 (mdhd) atoms, the timescale (unit) is parsed as a `LongLong` (8 bytes), but instead should be a `UInt` (4 bytes). This results in an incorrect timescale, and also pushes the offset of the duration (length) off by 4 bytes.
The end result being that the AudioProperties track length for mp4's with mdhd v1 comes back as 0.
See: https://wiki.multimedia.cx/index.php/QuickTime_container
| Entry | Bytes (v0) | Bytes (v1) |
| :--- | :---: | :---: |
| size | 4 | 4 |
| type | 4 | 4 |
| version | 1 | 1 |
| flags | 3 | 3 |
| creation time* | 4 | **8** |
| modification time* | 4 | **8** |
| time scale | 4 | 4 |
| duration* | 4 | **8** |
| language | 2 | 2 |
| quality | 2 | 2 |
-rw-r--r-- | taglib/mp4/mp4properties.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp index e863a375..faa43c27 100644 --- a/taglib/mp4/mp4properties.cpp +++ b/taglib/mp4/mp4properties.cpp @@ -175,8 +175,8 @@ MP4::Properties::read(File *file, Atoms *atoms) debug("MP4: Atom 'trak.mdia.mdhd' is smaller than expected"); return; } - unit = data.toLongLong(28U); - length = data.toLongLong(36U); + unit = data.toUInt(28U); + length = data.toLongLong(32U); } else { if(data.size() < 24 + 8) { |