Commit graph

430 commits

Author SHA1 Message Date
Roman Artiukhin
004304dc65 unicode: add iso_decode_ex with utf8 buffer size check
Make use of it in id3tags, playlist and cuesheet

Change-Id: Ibc8abc0faf16688bc9b826b7a712d1dfe9bf75b2
2024-12-15 09:26:26 -05:00
William Wilgus
f233b6e2f2 'libmad remove warnings
calculating inside a function makes it work
adding FORCE_INLINE makes warning reappear
anything else in bounds of the array asounds ok but has digital
distortion so pretty confident the code is right

Change-Id: Ibb2babe20b1d8a980f3e3fd19b4cddaaff9213a6
2024-12-14 01:21:56 -05:00
Christian Soffke
4cf65ec926 metadata: mp3: fix iTunSMPB info replacing comment
Data from the iTunes seamless playback data field
(support for which was introduced in f3e5ced)
prevents proper comments from being displayed.

Change-Id: Ifb00b1229e636a79a460ba6d706191fcf28b1502
2024-12-13 20:49:18 +01:00
Roman Artiukhin
a23002cd5e unicode: Unify check for UTF-16 BOM
Adds utf16_has_bom function

Change-Id: I67ea474c9cf6ca6e6684351c2f54131164b7903c
2024-12-13 17:38:05 +02:00
Roman Artiukhin
11fbbc7826 metadata: mp3: Reduce size of is_cuesheet function
Saves 80 bytes on Sansa E200V2 (176 -> 96)

Change-Id: I976e47f74641110ef37049101b9eb0db0afe512b
2024-12-13 17:09:29 +02:00
Roman Artiukhin
f7d5da6b2f metadata: mp3: Limit utf-8 buffer stack allocation to prevent stack overflow
Fixes FS#13518

Change-Id: I549ecb21c3dbaba580c13a6a155559585f0aa08e
2024-12-11 11:36:09 +02:00
Roman Artiukhin
18520c27a5 metadata: mp3: Avoid utf-8 buffer stack allocation for utf-8 tags
Change-Id: I9f35fc017efa6e8f36cd295adf662612cf9c6c16
2024-12-11 11:36:08 +02:00
Roman Artiukhin
c1ee278abf metadata: mp3: Avoid utf-8 buffer stack allocation when processing cuesheet
Change-Id: Ife49d5e3f2850e8621f927a4864d7863c103db77
2024-12-11 11:36:08 +02:00
William Wilgus
e9b14b3986 libmad synth.c silence warnings try #3
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I7b2897ae20dad1b11af39439a4d1856267b1222b
2024-12-10 11:16:40 -05:00
Solomon Peachy
95681c3959 Revert "libmad synth.c silence warnings try #2"
This reverts commit 5650007399.

Reason for revert:  Results in warnings on *all* device builds.

Change-Id: I635be6791c3ea9c7d7e89f9cf5dd2e4e4e042a80
2024-12-10 08:59:00 -05:00
William Wilgus
5650007399 libmad synth.c silence warnings try #2
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I135af6df5569fb4b6d18d79f7893b5c27f6f83ea
2024-12-10 02:17:55 -05:00
Solomon Peachy
e3323e3ba7 Revert "libmad synth.c silence warnings"
This reverts commit b14056e90f.

Reason for revert: Not mathematically equivalent, inconsistent with other code paths, and leads to audio artifacts on ARM targets.

Change-Id: I71646e6e8df2aa2c57decdb5360daff870670c87
2024-12-08 19:14:01 -05:00
William Wilgus
b14056e90f libmad synth.c silence warnings
synth.c is using a negative offset which gcc doesn't like

equlivalent code just uses pointer math instead

Change-Id: Ia1282c5608409cdff05cd4b90c4d4b695174482a
2024-12-08 00:06:59 -05:00
Christian Soffke
87452d775e fix warnings on some systems / format specifier mismatch
Instead of %ld or %lx, use %jd or %jx
for off_t (after casting to intmax_t)

Change-Id: I4cd1831816820d2862b383ff8782e548b2fca294
2024-12-07 11:07:44 -05:00
Christian Soffke
1745b74576 Make simulator compile on MacOS
Tested on MacOS Sequoia (Apple Silicon) with the
latest Xcode command line tools, gcc 14
(Homebrew GCC 14.2.0_1) and sdl2 (Homebrew 2.30.9)

Make sure 'gcc' (and 'gcc-ar') is in your PATH
ahead of the Xcode-provided "gcc"(clang). E.g.
by setting up symlinks in /usr/local/bin that
point to gcc-14 and gcc-ar-14.

Notes:
- The appropriate bmp from uisimulator/bitmaps
  has to be manually copied to your build folder
  and renamed to UI256.bmp, if you want the sim
  background to be displayed

Change-Id: I559f33d2165065f913f30c016b85906af380fb81
2024-11-30 22:19:02 -05:00
William Wilgus
1fddea5e8e Revert "[BugFix] Enums are only 2 bytes on some Devices"
This reverts commit 4ec34f6986.

Reason for revert:
 -fshort-enums makes them smaller if the explicitrly enumerated values will fit in a smaller type

Change-Id: I834dfd2b2039eda91bc02c9cf95a0f9dfc5783f6
2024-11-24 11:38:16 -05:00
William Wilgus
4ec34f6986 [BugFix] Enums are only 2 bytes on some Devices
using enums to hold values larger than 0xFFFF could be problematic

WIP

Change-Id: I3a9be957265364b545f022fe26163f0869569e3e
2024-11-24 10:23:53 -05:00
Solomon Peachy
bdf1690cb2 build: Allow LTO to work globally, not just codecs/plugins
IMPORTANT: There is no guarantee this will compile cleanly much less
_work_ on any given target.  This is purely to enable future hackery.

Change-Id: Ib58f21b717719fd4325622b446a60779406ae035
2024-11-24 08:23:38 -05:00
Vencislav Atanasov
f040c4c9ec Rename CPU_S5L870X to CPU_S5L87XX
This is a preparation to introduce support for the following SoC models: S5L8720 (iPod Nano 4G, iPod Touch 2G), S5L8730 (iPod Nano 5G), S5L8723 (iPod Nano 6G) and S5L8740 (iPod Nano 7G)

The whole family consists of SoCs which are similar, running ARMv6 and Thumb2 instructions, but some peripherals are located at a different address.

No functional change is to be expected so far.

Change-Id: If1f7669c49cf110ccc52c5234cc42ffd6f2b4e80
2024-11-20 10:58:32 -05:00
Vencislav Atanasov
5c6d463cc3 Simplify libgme define
Change-Id: I3e66f57b3640246bde9fc1c5d75b094553f8598c
2024-11-20 12:31:09 +02:00
Roman Artiukhin
da478aaa32 metadata: mp3: Simplify comment tag processing
Avoid unnecessary string comparison.

Change-Id: Ib1c5622f7b7760c43c4763930dc4ef6b409dbc05
2024-11-07 07:53:41 -05:00
Roman Artiukhin
2156d9874f metadata: mp3: Improve support for long tags
Increase buffer size by 368 bytes by using id3v1buf.
Limit tag size only if metadata fails to fit without limitation.

Change-Id: I82d551ac75c2e8fcb9ff0ef318445e0e6a1f8148
2024-11-07 07:53:08 -05:00
Roman Artiukhin
063b917f69 Codecs: wma: fix parsing album art
We can't assume that album art file starts right after album art type (apparently it can contain also additional info like filename).

Related to FS#12576 (album art is now shown)

Change-Id: I68c7a1dc536ff13a47fb73ea84539b2f7a44265b
2024-10-23 09:10:18 +03:00
Roman Artiukhin
f3d6196016 Codecs: wma: don't fail in case parsing errors in album art
Fixes FS#12576 (album art is not shown but file is now playable)

Change-Id: Idc8e1dcf7b5760b4fd37c43913a534ed4eae512a
2024-10-19 10:41:23 +03:00
Solomon Peachy
2f109a7c2a flac: 7th channel decode buffer may not fit into IRAM.
(Fixes failure to compile on nano2g)

Change-Id: Ibe40a18ee74a3ac3ca2ec9dfac478d1fda5d34ee
2024-10-14 13:43:54 -04:00
Solomon Peachy
29f28ad8e6 flac: Implement proper support for 7 channel FLACs
* Allocate buffer for additional channel
 * Proper downmixing

Change-Id: I4190358a93bb328585952affcd42db05b05c19a5
2024-10-14 12:28:07 -04:00
Solomon Peachy
3aef933348 flac: Bump maximum channel count to 7 (FS#13306)
This is actually the root fix for the crash; the fix in
772eff8ca6 didn't restrict it to 2 channels, just sanity
checked the file vs MAX_CHANNELS.

Change-Id: If5a0a9b946a179ad47d6e7955f7c025de3aaaa0e
2024-10-14 11:05:28 -04:00
Solomon Peachy
772eff8ca6 flac: Explicitly reject FLAC files with more than two channels (FS#13306)
It's not clear that we've ever intended to support >2ch files, based on
'#define MAX_CHANNELS 2' and other logic that only seems to care about
mono vs not.

Change-Id: I15e92fb29cceef32e63fc3a821f6e96bbde930b6
2024-10-14 09:00:26 -04:00
Solomon Peachy
d4d74fda00 codecs: abs() --> llabs() in speex and libgme
We were calling abs() on 64-bit (ie long long) variables.

Change-Id: I8326910a4ce733e9e2251aa5f9047e336c8be6df
2024-10-12 12:01:36 -04:00
Roman Artiukhin
ef6da7503a Codecs: mp4: Support object type 29 (AAC LC + SBR + PS).
Backport libfaad commit d35cf8f24d

Change-Id: I0d637d2be36f5e4bb10d7d09adc442b470e81bf7
2024-09-25 14:01:57 +03:00
Solomon Peachy
c3f51b5fe9 opus: Re-add a ICONST_ATTR lost in 4c6bb798d6bebc80f07e863236adbaf8d156a9c
Change-Id: If1395d5b1d71c1bc0bb9104ff26d2addbfd1040f
2024-09-24 10:27:17 -04:00
Roman Artiukhin
ff0ad4ca7d metadata: aac: support .aac files with mp4 container inside
Change-Id: Id982c58184197f6b2f9eeb0cf403cc2e30a97e24
2024-09-23 17:43:13 +03:00
Roman Artiukhin
3f3ec8273a metadata: aac: Fix any file is treated as valid aac
Fixup for d50470bc

Change-Id: Ie96a636afd3f18e03d70601628c2731cb7314483
2024-09-21 14:51:50 -04:00
Wolfram Sang
22b05c97a3 codec: cRSID: check whole load address
Due to a typo, only the high byte of the embedded load address was
checked to be empty. For a full check, high and low byte must be
evaluated, of course. Also, fixed in cRSID 1.3.

Change-Id: Ib0b701622b006ab4bb1791f07bf17b3b06a70719
2024-09-05 16:16:18 +02:00
Christian Soffke
23e5f77ab0 Remove mp3info function & remove list_do_action from plugin_api
Change-Id: Ia9a2d6889679832f23b19a989927277ba886cba4
2024-07-26 15:15:06 -04:00
William Wilgus
7e90760a48 [Feature] Playlis to cue plugin
generate valid cue files from a playlist

uses remarks to store extra id3 info and display and playlist index

Change-Id: I00c9f6389445bb601dde6eb8f36157044024f8cb
2024-07-20 07:27:01 -04:00
Solomon Peachy
43dfa7d084 opus: Re-add IRAM hints to some constant tables
Was accidently disabled in 14c6bb798d
(in January 2019)

See 8e8671a73e for the benchmarks.

Change-Id: I3d558f8cfc041a14d0a1e55da3b042c7d01089e8
2024-07-10 09:23:33 -04:00
Solomon Peachy
67b5fa06d5 opus: Re-enable Coldfire ASM optimizations
Was accidently disabled in 14c6bb798d
(in January 2019)

(Had to make a minor change due argument differences)

Change-Id: If7c128cdeaa9ed82b2b33de1b75ca7cc4a95abdd
2024-07-10 09:23:33 -04:00
William Wilgus
fdbaf7df59 [Feature] playlist_viewer id3 title display
Not sure this is a great idea from disk and battery standpoint
but there is no reason you can't..

using the name buffer to fill title data
prevent hitting the disk for each screen scroll

add get_metadata_ex to allow flags
 METADATA_EXCLUDE_ID3_PATH
  prevent copying the filename to the ID3 struct
 METADATA_CLOSE_FD_ON_EXIT
  instead of seeking to the beginning the file is closed before
  get_metadata returns

add logic to allow a invalid fd to signal that get_metadata
should open and close the file within its call

bugfix per Chris_s don't use the tagcache for the trackinfo

Change-Id: Ic7a595b39a8d7a57f975312bc9c8bb4111f22a88
2024-07-09 01:40:02 -04:00
Solomon Peachy
eb8f6e578e libspeex: Fix up two build regressions in 547b6a570
Broke rbspeex build if we weren't using system libspeex
2024-06-21 16:38:45 -04:00
Solomon Peachy
547b6a570d codecs: Update libspeex from 1.2beta3 to 1.2rc1
This is a relatively minor bump, but it's the first step towards
bringing this current.

Change-Id: Iab6c9b0c77f0ba705280434ea74b513364719499
2024-06-20 07:08:35 -04:00
Solomon Peachy
6f4d0b7eb1 m4a: Fix a warning under GCC 8.
...Not sure why this just cropped up now.

Change-Id: I2318ee929fb5fddbf033680d92f21bba73631db6
2024-06-19 09:22:44 -04:00
Roman Artiukhin
e80cf93b67 Codecs: debugging: Disable compiler optimizations when DEBUG is defined
Change-Id: I6a65a2f650c4c7e0cde6165e8f46df1f3a5fd855
2024-06-18 20:43:35 -04:00
Solomon Peachy
73f40d8a23 build: Experimental LTO support, phase one
* Only codecs and plugins are enabled
 * Only native builds (so far)
 * Only tested on xDuoo X3 (MIPS, monochrome)
 * opus & speex generate some warnings
 * Significant compile time impact

Change-Id: I519b0d179631a54b2103cd67225bd5ec6ad3bd2f
2024-06-18 08:15:47 -04:00
Solomon Peachy
8c86fb6da0 arm: Use -masm-syntax-unified when compiling with gcc8 or newer
Annoyingly, this makes all of the '.S' files we compile get treated as
divided syntax, so we need to make the syntax in them explicit.

Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf
2024-05-08 21:45:42 -04:00
Solomon Peachy
98971604c7 Correct one of the GCC14 warning workarounds
(Accidentally pushed an out-of-date commit)

Change-Id: I53a85420349d6fc12831a481becc2dd1617a8ed9
2024-04-25 20:49:56 -04:00
Solomon Peachy
1922ac1aac Temporary fix for build warnings under GCC 14.0.1
...Both appear to be false positives, and will hopefully be resolved
in a later GCC point release.  I will periodically revisit this.

Change-Id: I7388932f5be052d39dd8c4195b438bf275dd72d9
2024-04-25 19:19:38 -04:00
Roman Artiukhin
19f21a2b3f Codecs: mp4: Enable FAAD_STATIC_ALLOC
Allocates several SBR + PS arrays and variables statically
Prevents out of memory exceptions for long audiobooks

Note from original commit a602f46d why it was disabled:
For now malloc is not fully removed but used by a few arrays needed for AAC-HE SBR+PS only. Reason to keep malloc is to have this amount of memory available for AAC-LC files which might require large m4a tables.

But now with "shrinkable" seek table 2c6dfd06 it's no longer a critical issue for aac-lc files (we just load less seek entries) but might be critical for aac-he files.

Fixes issue described here https://www.rockbox.org/tracker/task/13049#comment44587

Change-Id: Id9c20bad4c46034299a2a4de95d41c807b3af412
2024-03-28 08:25:02 -04:00
Roman Artiukhin
76ec55cc49 Remove ATRAC3 specific fields (channels, extradata_size) from mp3entry
Also fixes typo of using never initialized id3->channels in wav metadata (introduced in 2d1937a1)

Change-Id: I28cddec2b9d9bd1e756ffaa004b4f6e8528a7566
2024-02-02 09:36:53 -05:00
Roman Artiukhin
be16edc94b Codecs: mpa: Use both time and offset when resuming files
The supplied time may be more accurate than the calculated time from the bitrate (can be quite inaccurate for long vbr files and even for cbr due to padding)

Change-Id: I1f8291eab45fbd91a161b51776c391a0f7886a5c
2024-01-24 18:19:33 +02:00