From 008c368c87873615ccbe8bc0b3482d93ae15779d Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Sat, 2 Jan 2010 20:54:55 +0000 Subject: Commit first part of FS#10832 by Juliusz Chroboczek. Allows playback of unstreamable AAC/ALAC files by stepping through the file to find the index, potientially rebuffering. This is likely to impose a battery life hit on files which are unstreamable and not much smaller then the buffer, but should not impact streamable files at all. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24147 a1c6a512-1295-4272-9138-f99709370657 --- apps/metadata/mp4.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'apps/metadata/mp4.c') diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 44bc68e..c5a525d 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c @@ -548,6 +548,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, uint32_t type; uint32_t handler = 0; bool rc = true; + bool done = false; do { @@ -681,6 +682,10 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, case MP4_mdat: id3->filesize = size; + if(id3->samples > 0) { + /* We've already seen the moov chunk. */ + done = true; + } break; case MP4_chpl: @@ -708,15 +713,11 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, } /* Skip final seek. */ - if (id3->filesize == 0) + if (!done) { lseek(fd, size, SEEK_CUR); } - } - while (rc && (size_left > 0) && (errno == 0) && (id3->filesize == 0)); - /* Break on non-zero filesize, since Rockbox currently doesn't support - * metadata after the mdat atom (which sets the filesize field). - */ + } while (rc && (size_left > 0) && (errno == 0) && !done); return rc; } -- cgit v1.1