rockbox/lib/rbcodec/codecs
Michael Giacomelli 8194d51c49 a52: play files that do not start with a frame
A52 files cut from a longer stream can start partway through a frame.
The metadata parser required a sync word at offset 0 and rejected
them, although the codec can resync.  Scan the first 64 KB for a frame
header that is followed by a second valid header, record it as
first_frame_offset, and use that offset when seeking and resuming.

Tested in the simulator (perfsim) and on a Sansa Clip+: a file
starting with 675 bytes of a partial frame now plays.  In the
simulator it decodes all 3161 frames with the same output as the file
without those bytes, and seeks land on frame starts.

Fixes FS#9056

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I5d72b1cd1d8437491ec00a38459e391fb158b9a2
2026-10-09 11:09:42 -04:00
..
cRSID Revert "[BugFix] Enums are only 2 bytes on some Devices" 2024-11-24 11:38:16 -05:00
demac libdemac: reciprocal table for the pivot division on ARMv5+ 2026-10-05 10:19:38 -04:00
lib chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
liba52 chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libalac chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libasap chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libasf chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libatrac atrac3: keep the second window table out of small IRAM 2026-10-06 22:18:33 -04:00
libayumi chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libcook chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libfaad chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libffmpegFLAC flac: ARM assembly for the 64-bit LPC filter 2026-10-05 12:19:09 -04:00
libgme chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libm4a libm4a: handle sparse chunk maps and video-first MP4 2026-09-07 09:17:27 -04:00
libmad chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libmusepack chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libopus opus: filter the PLC excitation in place 2026-09-30 11:25:30 -04:00
libpcm chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
librm Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
libspc chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libspeex libspeex: Silence a spurious warning under Clang 2026-07-15 16:22:18 -04:00
libtremor vorbis: don't buffer the comment packet 2026-10-05 22:41:43 -04:00
libtta chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libwavpack chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libwma wma: fix dropouts in files with LSP exponents 2026-10-05 21:21:27 -04:00
libwmapro wmapro: fix the level and accuracy of 16 bit streams 2026-10-05 20:13:48 -04:00
libwmavoice chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
a52.c a52: play files that do not start with a frame 2026-10-09 11:09:42 -04:00
a52_rm.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aac_bsf.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
adx.c fix warnings on some systems / format specifier mismatch 2024-12-07 11:07:44 -05:00
aiff.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aiff_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
alac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ape.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
asap.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
atrac3_oma.c atrac3: output samples with 28 fractional bits 2026-10-06 21:56:47 -04:00
atrac3_rm.c atrac3: output samples with 28 fractional bits 2026-10-06 21:56:47 -04:00
au.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ay.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
codec_crt0.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
codecs.h chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
codecs.make codecs: link libarm_support for its division routines 2026-10-05 07:46:37 -04:00
cook.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
flac.c flac: cope with frames larger than one buffer request 2026-10-03 18:17:56 -04: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 chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mp3_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mpa.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mpc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
nsf.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
opus.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
raac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04: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: Don't uselessly upconvert from 16bpp mono to 28bpp stereo 2025-09-02 20:19:22 -04:00
smaf.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
SOURCES warble: fix build on targets with HAVE_RECORDING 2026-08-25 08:01:09 -04:00
spc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
speex.c build: Silence a pile of set-but-not-used warnings in codecs 2026-05-17 16:39:06 -04:00
tta.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vgm.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
vorbis.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vox.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vtx.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav64.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wavpack.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wavpack_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wma.c wma: decode every codec packet in an ASF payload 2026-10-05 20:47:12 -04:00
wmapro.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wmavoice.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00