diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-02-16 06:54:32 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-02-19 13:35:41 +0000 |
commit | bdc3dd4fca4aa628b934e7a0bc5d9d5955cdc2cd (patch) | |
tree | 922a45679cbb12ab2467db3cb4224846550be45a /lib/rbcodec/metadata | |
parent | 8c76c1b1c2a49cdfb111b5f2640d5a55588cc956 (diff) | |
download | rockbox-bdc3dd4fca4aa628b934e7a0bc5d9d5955cdc2cd.tar.gz rockbox-bdc3dd4fca4aa628b934e7a0bc5d9d5955cdc2cd.zip |
MP4: append mdat sections together in metadata parser
mp4 files can have multiple 'mdat' chunks. This is common for
audiobooks, where there is often a secondary mdat containing the
chapter names, but it's also legal to have multiple mdat chunks
for a single logical "track"
This confuses the mp4 metadata parser, which assumes there is
only a single mdat, and always uses the last mdat seen to
determine the "filesize" of the data we're trying to decode.
Work around this by appending each mdat's size to result in the final
"filesize"
Change-Id: I3e7a7efb0f05ef965e8d77f79e450c957524a480
Diffstat (limited to 'lib/rbcodec/metadata')
-rw-r--r-- | lib/rbcodec/metadata/mp4.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c index 6973d3a314..35f4e3bfda 100644 --- a/lib/rbcodec/metadata/mp4.c +++ b/lib/rbcodec/metadata/mp4.c | |||
@@ -758,7 +758,8 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
758 | Ignore them. */ | 758 | Ignore them. */ |
759 | if(size == 0) | 759 | if(size == 0) |
760 | break; | 760 | break; |
761 | id3->filesize = size; | 761 | /* mdat chunks accumulate! */ |
762 | id3->filesize += size; | ||
762 | if(id3->samples > 0) { | 763 | if(id3->samples > 0) { |
763 | /* We've already seen the moov chunk. */ | 764 | /* We've already seen the moov chunk. */ |
764 | done = true; | 765 | done = true; |