path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03add const to const * stringsWilliam Wilgus2-5/+5
I don't think this will amke any difference except maybe for hosted ports Change-Id: I84f898aea92a6963901a6d889dd18b63f24c9a41
2022-05-02codecs: m4a: improve seek accuracyAidan MacDonald3-53/+127
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-02Fix some non-portable alignment valuesAidan MacDonald1-2/+2
UBSan reports an avalanche of unaligned pointer bugs stemming from hardcoded 4-byte alignments used in certain places. Use sizeof(long) instead to align to the machine word size. Change-Id: I28e505212462c5268afa24e95df3a103ac3e2213
2022-04-20buffering: remove bufgettail/bufcuttailAidan MacDonald2-39/+0
These operations can only be used in limited circumstances and have exactly one user. bufgettail especially seems of dubious value; how often do you need to read N bytes from the end of a file without changing the file position? strip_tags() was the only function using them, to strip off ID3v1 and APE tags off the end of buffered tracks. This would save only 32-192 bytes per track -- if the container format uses APE/ID3v1. It hardly seems worth the effort. Change-Id: I8fc3c1408517eda6126e75e76d76daea904b50eb
2022-04-17Fix undefined behavior that blocks compiling with UBSanAidan MacDonald1-1/+2
Left shifts are not defined in C if they would cause signed overflow, so these expressions get instrumented, which makes them unusable as switch values and triggers compile errors when compiling with UBSan. Change-Id: I0588d4be1e00ba1cfde0eac119ead368b20d10c9
2022-03-20[COV] metadata module, fix uninit warnings #2William Wilgus2-10/+12
decrease size hit of initializing asf by using a union remove init from bytes LE conversion in metadata common -- bad idea for performance Change-Id: I4514adc125e5da2b99d9f913ba74afd5f1345822
2022-03-20[COV] metadata module, fix uninit warningsWilliam Wilgus4-9/+9
Change-Id: Ifeb22642d7fb683542ff9dcfca0bc58c91ab5f38
2022-03-14metadata.c fix redWilliam Wilgus1-2/+2
comma, helpful Change-Id: Iaa352cf1b542f1b805278af8560a6927684dc8d2
2022-03-14BUGFIX string_option parsersWilliam Wilgus3-20/+30
fix bugs introduced in the switch over to using string_option instead of if else strcmp trees, embedded album art should work again skin parser had an error for 'noborder' and 'nobar' Change-Id: I957d81e5fa8467b33bbd93d63c4428c36100acca
2022-03-13replace more strcmp if then trees with string_option()William Wilgus4-51/+66
1 Change-Id: Ic89bbb2ab41068d09c7bd9caa5ba7f38749b9084
2022-03-13Warble builds define WARBLE fix metadata_common in warble buildsWilliam Wilgus1-1/+1
Change-Id: Ie5115162da5a06d917de09f75b90254bb30b7513
2022-03-13option_string clean-up and consolidate with metadata_commonWilliam Wilgus4-27/+54
Change-Id: I2649f6af37bd871fb8f181ae2f716ff0bcf1f65c
2022-03-13metadata_common.c optimize parse_tagWilliam Wilgus1-28/+50
Change-Id: I84ad404fdcc9698b9d08e6e9c37929f4b7bf569f
2022-03-12ARM support, optimize popcount fnWilliam Wilgus1-19/+24
Change-Id: Iec02d0b5973721a3943b9c23ced3afc721cd3753
2022-03-11BUGFIX arm aeabi_sdivmod crashes in interupt modeWilliam Wilgus1-4/+4
Change-Id: I6e89334b0f5df1d513a3f466e1db9cdc198944fe
2022-03-08backtrace, put pc and sp on their own linesWilliam Wilgus1-1/+2
Change-Id: Ia5853c4f2d1b86dc1e2cd0882f5da27e4eba5724
2022-02-12buflib: add a common dummy callbacks struct & use itAidan MacDonald4-2/+19
There are various allocations that can't be moved or shrunk. Provide a global callback struct for this use case instead of making each caller declare its own dummy struct. Also fixed ROLO and x1000 installer code which incorrectly used movable allocations. Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1
2021-11-28x1000-installer: remove redundant overflow checkAidan MacDonald1-3/+1
This overflow is impossible to trigger due to the simple relationship between binary and hexadecimal numbers. Change-Id: Ie8243129967abb935a77152a808765318052c979
2021-11-28x1000-installer: map filenames accept only valid charactersAidan MacDonald1-1/+13
Instead of using isgraph(), check for legal FAT32 characters excluding spaces (which are used as field separators). Change-Id: I291f0acb5f24c558099c237d913f4f35ae06b834
2021-11-28x1000-installer: add test for xf_map_parselineAidan MacDonald3-0/+143
Change-Id: I35db43c83dc3964607b95f6b5c300c2fef455ac8
2021-11-28x1000-installer: xf_stream_read_lines bugfixesAidan MacDonald2-11/+12
- Only treat EOF as newline if the line is non-empty to suppress a useless empty line after the end of a file. - Deal with 0- and 1-byte line buffers safely. - Remove whitespace stripping and comment handling which was left over from refactoring. Move it to xf_map_parse() where it belongs. Change-Id: I9f05f4e18ca6dd011ca4cd231f0b5ea37c784778
2021-11-28x1000-installer: tests for xf_stream.cAidan MacDonald5-1/+259
Change-Id: Ib9d1ca0109029f09ff0f8adfc10925c7c9a0f8b9
2021-11-28x1000-installer: simple test suite runnerAidan MacDonald2-59/+79
Change-Id: I0b9ee81cbd8dda593924b2f7c32a1d1d87ce84b0
2021-11-28x1000-installer: add test & code coverage support to makefileAidan MacDonald2-7/+51
Pass COVERAGE=1 to enable clang-based code coverage and pass SANITIZE=1 to enable sanitizers. 'make cov' will run the test app and show a coverage summary. Change-Id: I8a33e8b78665165d8da1818dc01f495f0c52cf06
2021-11-27x1000-installer: Initial commit of new frameworkAidan MacDonald30-0/+2894
This is a new flash installer framework for the X1000 targets. A bunch of this code is *UNTESTED* but there is an external test harness which allows the library to be built and tested on a PC. Once tests are written and the bugs are ironed out this framework will replace the existing installer code. New features: - Update tarballs are MD5-checksummed to guarantee integrity. - The flash map is no longer fixed -- updates are self describing and carry a map file which specifies the areas to update. - Can take full or partial backups with checksums computed on the fly. - Supports an additional verification mode which reads back data after writing to ensure the flash contents were not silently corrupted. Change-Id: I29a89190c7ff566019f6a844ad0571f01fb7192f
2021-11-27microtar: Update to latest upstream commitAidan MacDonald12-558/+1415
This is a major overhaul of the library with some API changes and ease of use improvements, particularly for creating new archives. The updated functionality is intended to support a new X1000 installer framework. Change-Id: Icf192bb546831231d49303fbf529ef1c1ce8905c
2021-08-11metadata/mp3data.c init vars & add sanity checksWilliam Wilgus1-2/+8
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
2021-08-11metadata/metadata_common.c check read for proper bytes readWilliam Wilgus1-10/+8
Change-Id: I25d7c20d449cde4d5cfd3f57e00ff45f4c14f60b
2021-08-11metadata/metadata_common.c WS changesWilliam Wilgus1-18/+18
Change-Id: Ieef86e94676c603a21cbb5af55e63ba628a09cdf
2021-08-11metadata/asf.c ensure variable init & add sanity checksWilliam Wilgus1-16/+28
Change-Id: If4432549b843cafb000c3fedee12184d75da595b
2021-08-11metadata/mp4.c fix small oversight / bugWilliam Wilgus1-4/+4
didn't set the genre string to null on case entry means read failure would leave genre string indeterminate add explicit NULL & leave genre uninitialized Change-Id: I1452a0b57985646c982ec80755d0df9d03745f1e
2021-08-11metadata/mp4.c check for read errors skip buffer appropriatelyWilliam Wilgus1-47/+61
WIP Change-Id: I770f0d911f7d9826e89d886892ff3913661a8151
2021-08-08As3525 wavpack_enc document some intentional switch fall throughWilliam Wilgus1-0/+1
Change-Id: I56bf439df2c05653d65f49238e886e4ef2291176
2021-08-07metadata/asap.c consolidate read char function and check return valuesWilliam Wilgus1-23/+27
and a bit of cleanup using macros to make the code easier to follow Change-Id: I2c5953a68a9f415453e508c14a9c1a5a1e84e6b5
2021-08-07metadata/asap.c WS cleanupWilliam Wilgus1-26/+26
Change-Id: Id3bc053a45eeea107a54dd47640fa3ceb4b04498
2021-08-07metadata/vfx.c cleanup string and character handlingWilliam Wilgus1-17/+19
Change-Id: I7550d6db05b0d31a1433d0af9b2233f9dc3f5ee2
2021-08-07metadata/smaf.c handle read errorsWilliam Wilgus1-26/+27
Change-Id: I450f1fc8e1b69ce09f9888f5384c3e23a93822a1
2021-08-06metadata/mp3data.c set data to 0 in case of read errorWilliam Wilgus1-3/+2
Change-Id: I15d4e3d3be4bf4531c892f4351355b0b2e8e0ca9
2021-08-06Fix use of uninitialized variable in mp4 metadata parserAidan MacDonald1-1/+1
Change-Id: Idca69e7429af13609785755d4e152d87f471c462
2021-08-05metadata: Fix sign extension in get_uint64_le() routineSolomon Peachy1-1/+1
Change-Id: Ibd85cf72ac1babd1fa636c341b90b76bdfc0491b
2021-08-05lib/skin_parser check that malloc succeededWilliam Wilgus1-0/+5
Change-Id: I32db233a53b0f693f815cf96bcbe6711c366e5b3
2021-08-04Document intentional fallthroughs + fix harmless unintended onesAidan MacDonald2-0/+4
Change-Id: I1ca5b1027ec30cbf61093bab35b980196ed14e6b
2021-08-02metadata/flac.c fix potential buffer overrunWilliam Wilgus1-0/+12
Change-Id: Iee12f251455c4fda9d91d10e466d17e5e02046b9
2021-08-01id3tags.c check for buffer overrunWilliam Wilgus1-0/+3
Change-Id: I74fde8e234fe85abfabefddcea7f10038167c715
2021-07-25rbcodec: Fix typo in makefileAidan MacDonald1-1/+1
Hopefully this will fix all those random build failures. Change-Id: I02ff625c538a21f20b33874b4ab54ed8c893a433
2021-07-22tlsf make ~0 explicitly unsigned ~0uWilliam Wilgus1-2/+2
Change-Id: Ib3220df24fee470416ef813b89bdc5f27e455af7
2021-07-15misc: Fix up a few warnings uncovered by LTOSolomon Peachy3-17/+14
* direct use of memcpy() instead of ci->memcpy() in flac and mod * uninitialized variable in mpegplayer Change-Id: I2d08682d5f66c319780e69e3ff63d600c61d8f5a
2021-07-08build: Nuke the ASMFLAGS workaround for gcc 3.4.xSolomon Peachy3-5/+5
Change-Id: I0f21e9539d39afd54916fa8d84ce798eef474a2c
2021-07-08build: Rename SHARED_LDFLAG to SHARED_LDFLAGSSolomon Peachy1-1/+1
Change-Id: Icb81c72fbcfcdad624112a386ba38a40a830d18f
2021-06-16FS#13299: Handle MP3 files with more than 128K of headers before audio dataSolomon Peachy1-12/+15
Encountered a file with ~600K of ID3v1 headers. Optimize the potential overhead by minimizing reverse seeks. Change-Id: I972dbf1af1c36659f19c7ab4eed0b9149c642880