1
0
Fork 0
forked from len0rd/rockbox
Commit graph

16 commits

Author SHA1 Message Date
roman.artiukhin
2030d681e4 Codecs: mp4: Fix sign overflow in seek by offset
Change-Id: I52f536ae959f989c3dc70a50cb802eb1b8615642
2023-11-02 09:40:56 +02:00
roman.artiukhin
d05f6aac2d Codecs: mp4: Skip FOURCC filetype chunk check
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
2023-09-29 08:21:27 -04:00
roman.artiukhin
a45204f5df Codecs: mp4: Fix seek in files with single element in lookup_table
lookup_table offset shouldn't be zero terminated.
And fix possible out of bound access.

Change-Id: I212a5fcc1868a2ca519b0052b170e836276fe9de
2023-09-22 10:37:38 -04:00
roman.artiukhin
57409f52d5 Codecs: mp4: Accurate seek in large files with small lookup_table
Read sample_byte_sizes table on demand when it can't be cached

Change-Id: I2191be63ceebfd8b16e1e973e13c5b51986b6564
2023-09-20 11:43:39 +03:00
Solomon Peachy
ac82a653bb libm4a: Fix warnings introduced in 001a338e51
Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5
2023-09-19 11:47:38 -04:00
roman.artiukhin
001a338e51 Codecs: mp4: Reuse lookup_table index from seek in m4a_check_sample_offset
Change-Id: If2fc3038ce8db8ddf2991406a5cce294a857eadc
2023-09-19 11:13:19 -04:00
roman.artiukhin
ef7d6009b4 Codecs: mp4: Optimize m4a_check_sample_offset
Make optimization from 2358fabb actually work.
Fix potential out of bound access.
Remove redundant zero offset check.

Change-Id: I0a0ba04670b612d410ac17a761bd08c2915721b9
2023-09-19 11:13:19 -04:00
roman.artiukhin
9242e4cadb Codecs: mp4: Small cleanup
Remove unnecessary frame modification

Change-Id: I884152a66477efea7cfcadc638f55352ad75fc41
2023-09-18 11:29:21 -04:00
roman.artiukhin
6acb6446e6 Codecs: mp4: Improve support for long files. Part 2
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
2023-09-18 11:29:05 -04:00
roman.artiukhin
27aa95afcb Codecs: mp4: Fix seek in very large files
Samples count requires 64 bit

Change-Id: Ia54be57d7d15b3db19dbc29ff8a06671594abb4b
2023-09-15 09:08:18 -04:00
William Wilgus
6b0e3fe775 Codecs: mp4: Improve support for long files, prevent endless loop
pretty unlikely but I think in a memory exaustion scenario
you might roll the uint8 over to zero and crash

Change-Id: If73dc64484f2d363446be068aa7bf8025407a2a7
2023-09-09 21:16:35 -04:00
roman.artiukhin
2c6dfd06a6 Codecs: mp4: Improve support for long files
Reduce lookup_table (seek accuracy) till it fits on device

Fixes FS#13049

Change-Id: I934de500a4383e17b82821afa2e0396a27061707
2023-09-06 16:49:30 -04:00
roman.artiukhin
a190d0ca9c Codecs: mp4: Skip unknown chunks
Needed for opening some m4b books (see FS#13049)

Change-Id: Id289451e6b2b8a7ad1f6b9f00ef512ab9692383d
2023-09-06 16:49:23 -04:00
Aidan MacDonald
4dd3c2b33e codecs: m4a: improve seek accuracy
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
2022-05-02 12:16:21 -04:00
Rafaël Carré
dfeab527e0 remove extraneous parens 2012-05-06 23:41:37 -04:00
Sean Bartell
f40bfc9267 Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
2012-04-25 22:13:20 +02:00