sample_to_chunk last value was ignored in some cases leading to invalid sample value in lookup_table.
Fixes FS#13600
Change-Id: I8f066966e15c384d3185f689b68a2cc2a3abad1d
Instead of FOURCC it needs ignore-case text match. Also value can contain \0 ('m4a\0' instead of expected 'm4a ').But let's simply skip it and let decoder handle it.
Change-Id: I87eefcabbc9010481286257c26cee09e61d1221c
Don't store sample_to_chunk table and read data on demand instead (it's required only once for building lookup table). It allows to store 2x bigger lookup table.
Change-Id: Ida79d0c281040300d6561e124fe10ebacb0e4679
pretty unlikely but I think in a memory exaustion scenario
you might roll the uint8 over to zero and crash
Change-Id: If73dc64484f2d363446be068aa7bf8025407a2a7
Seeking doesn't work well in M4A files with very few chunks due to
the seek method used (chunk based using the info in the 'stco' atom).
According to libm4a/demux.c the expected seek resolution using this
method is 1/4 to 1/2 seconds. However, ffmpeg generates files with a
1 megabyte chunk size, so the resolution is much worse than expected
on some files: around 30-40 seconds at 256kbps.
There was a bug with the seek position reported back to Rockbox: the
codec pretended it could seek exactly to the requested sample, but it
would only seek to the start of a chunk. This could leave the UI in a
confusing state because the real playback position was different from
what the elapsed time showed. Fix this by recalculating the reported
sample position using the chunk start.
To fix the low seek accuracy, use the table in the 'stsz' atom to skip
individual packets within a chunk. This is very accurate, but it takes
a lot of RAM to allocate the table. Currently the table is not allowed
to use more than half of the codec RAM, which should suffice for short
files on most targets. On files where the table is too large the codec
will fall back to the less accurate chunk-based seek method.
Change-Id: Ide38ea846c1cdd69691e9b1e1cd87eb0fa11cf78