rockbox/lib/rbcodec/codecs
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
..
demac libedemac: ARMv7 asm code is for NEON-equipped processors only 2020-04-15 00:35:35 +02:00
lib [3/4] Completely remove HWCODEC support 2020-07-24 21:20:13 +00:00
liba52 Document intentional fallthroughs + fix harmless unintended ones 2021-08-04 18:59:46 +00:00
libalac fixed alac_set_info() issues. 2019-07-25 18:16:48 -04:00
libasap Fix codecs in simulator builds on Windows 2017-01-15 21:46:19 +01:00
libasf Support MP3 audiostreams embedded in ASF containers. 2021-02-28 16:11:54 +00:00
libatrac Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00
libayumi codecs: Add support for the 'VTX' ZX Spectrum chiptunes format. 2020-10-09 11:39:25 -04:00
libcook iPod Classic: disable IRAM1 2018-07-30 18:50:27 -04:00
libfaad iPod Classic: disable IRAM1 2018-07-30 18:50:27 -04:00
libffmpegFLAC flac fix dumb typo 2021-03-03 02:58:34 +00:00
libgme rbcodec: Fix typo in include guard 2021-04-06 17:27:06 +01:00
libm4a codecs: m4a: improve seek accuracy 2022-05-02 12:16:21 -04:00
libmad build: Nuke the ASMFLAGS workaround for gcc 3.4.x 2021-07-08 20:47:30 -04:00
libmusepack iPod Classic: disable IRAM1 2018-07-30 18:50:27 -04:00
libopus Sync opus codec to upstream git 2021-04-23 14:23:04 +00:00
libpcm libpcm: Get unbranded structure tag out of my way. 2017-11-06 20:06:08 -05:00
librm Third attempt to shut up the warble build printf() warning. 2018-12-28 07:57:23 -05:00
libspc iPod Classic: disable IRAM1 2018-07-30 18:50:27 -04:00
libspeex misc: Fix up a few warnings uncovered by LTO 2021-07-15 18:37:42 +00:00
libtremor Clean up places that use #if defined(CPU_ARM | CPU_COLDFIRE | CPU_MIPS) 2021-03-04 14:14:33 +00:00
libtta Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00
libwavpack Limit more variables to file scope 2015-01-11 21:40:51 +01:00
libwma iPod Classic: disable IRAM1 2018-07-30 18:50:27 -04:00
libwmapro wmapro: Backport multiple fixes 2020-10-28 02:12:01 +00:00
libwmavoice build: Put all codec optiomization definitions in one place 2018-12-25 14:17:29 -05:00
a52.c Improved seeking in a52 codec 2018-12-22 19:54:40 -05:00
a52_rm.c Realmedia related codecs fixes and enhancements 2018-12-22 20:12:10 -05:00
aac.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
aac_bsf.c Fix logf warnings in more codecs 2020-07-03 03:43:47 +00:00
adx.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
aiff.c Add support for ID3 tags embedded in AIFF files 2020-07-15 18:30:07 +00:00
aiff_enc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
alac.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
ape.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
asap.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
atrac3_oma.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
atrac3_rm.c Realmedia related codecs fixes and enhancements 2018-12-22 20:12:10 -05:00
au.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
ay.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
codec_crt0.c Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00
codecs.h [3/4] Completely remove HWCODEC support 2020-07-24 21:20:13 +00:00
codecs.make rbcodec: Fix typo in makefile 2021-07-25 15:55:36 +01:00
cook.c Realmedia related codecs fixes and enhancements 2018-12-22 20:12:10 -05:00
flac.c misc: Fix up a few warnings uncovered by LTO 2021-07-15 18:37:42 +00:00
gbs.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
hes.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
kss.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
mod.c misc: Fix up a few warnings uncovered by LTO 2021-07-15 18:37:42 +00:00
mp3_enc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
mpa.c Support MP3 audiostreams embedded in ASF containers. 2021-02-28 16:11:54 +00:00
mpc.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
nsf.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
opus.c opus: shrink stack usage by nearly 700 bytes 2020-07-15 15:09:08 +00:00
raac.c Realmedia related codecs fixes and enhancements 2018-12-22 20:12:10 -05:00
sgc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
shorten.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
sid.c sid: Fix an out-of-bounds read in the channel mixing code 2020-03-28 11:43:23 +01:00
smaf.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
SOURCES codecs: Add support for the 'VTX' ZX Spectrum chiptunes format. 2020-10-09 11:39:25 -04:00
spc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
speex.c Fix logf build warnings in speex codec 2020-06-28 03:24:20 +00:00
tta.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
vgm.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
vorbis.c Clean up places that use #if defined(CPU_ARM | CPU_COLDFIRE | CPU_MIPS) 2021-03-04 14:14:33 +00:00
vox.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
vtx.c codecs: Add support for the 'VTX' ZX Spectrum chiptunes format. 2020-10-09 11:39:25 -04:00
wav.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wav64.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wav_enc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wavpack.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wavpack_enc.c As3525 wavpack_enc document some intentional switch fall through 2021-08-08 09:27:27 -04:00
wma.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wmapro.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
wmavoice.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00