Commit graph

16777 commits

Author SHA1 Message Date
Christian Soffke
f3358eb20a Properties plugin: Eliminate redundant Track Info code
When opening an audio file from the file
browser or database using the Properties
plugin, it will now use existing code from
the Show Track Info screen for displaying
metadata. The menu option has been
renamed accordingly.

Change-Id: I5a824865b9f980151b91aff3c3c18ec45830a12c
2022-05-09 09:44:23 -04:00
Aidan MacDonald
4b293285ea pictureflow: fix album index alignment in load_album_index
Change-Id: I7c3c86ffdab62859ce88faeeb84160ea52a4626a
2022-05-07 16:28:27 +01:00
Aidan MacDonald
f661dc596e pictureflow: fix bug in calculation of album art buf size
I intended to check for enough space in buffer but this isn't
really doing it and it is making aa_bufsz slightly too big so
it's a possible buffer overflow.

Restore the old ALIGN_DOWN(..., 4) rounding in case it's important,
if not, then no harm done.

Change-Id: I904f255ac79a77d5328b44667502ceae8308e659
2022-05-07 15:52:26 +01:00
William Wilgus
2c4480979f tdspeed.c remove buffer name strings
get rid of the magic buffer size and the whole name buffer
naming the buffers individually doesn't serve any real purpose
instead add a static string for all td buffers

Change-Id: I962a966456453e1b84bab6fec6f4df7cb075ef4e
2022-05-05 00:31:07 -04:00
William Wilgus
09ef94ed8b add const to const * strings iriver Fix Red
the iriver devices overwrite the pointer

Change-Id: I20ae6db2aec0f957824b61db349c7c45a95e58d9
2022-05-03 23:58:00 -04:00
William Wilgus
79864c6ec2 add const to const * strings
I don't think this will amke any difference except maybe for hosted ports

Change-Id: I84f898aea92a6963901a6d889dd18b63f24c9a41
2022-05-03 23:00:58 -04:00
Aidan MacDonald
b79eefc858 apps: fix tagtree arithmetic on null pointers
It was possible for the tag tree's buflib move callback to turn a
null pointer non-null. The tagcache_search_clause->str can be null
for OR clauses. Also ensure that clauses are zeroed on allocation
to ensure garbage pointers don't creep in.

Change-Id: Ic823a8eecc501eeaa75798066521e427a9a89190
2022-05-02 16:48:19 +01:00
Aidan MacDonald
6e37b31851 apps: fix use of negative fd in open_plugin.c
Bug reported by UBSan.

Change-Id: I3223a496dfa5df4e3df97fb88a14ea0174d4b428
2022-05-02 16:42:32 +01:00
Aidan MacDonald
dadfbfc6a5 apps: fix close of negative fd in talk.c
Bug reported by UBSan.

Change-Id: I02276521510acac8696499895fec15993c55aaf6
2022-05-02 16:34:18 +01:00
Aidan MacDonald
e5e457b526 apps: fix int/long mismatch in playlist.c
A couple of places use sizeof(int) for allocations and copying but
the indices are longs, which causes bugs in the simulator on 64-bit.

Change-Id: Ie101ac57d44217c4b1657cf0152c97e276bd7043
2022-05-02 16:10:15 +01:00
Aidan MacDonald
6b8c94a6e3 Fix some non-portable alignment values
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-05-02 15:38:48 +01:00
Aidan MacDonald
366f00a3d3 plugins: fix out of bounds read in chopper
GCC complains about this when compiling with UBSan.

Change-Id: I4bd8ff2b47882ab95620dc7750a9a80f823cc2ea
2022-05-02 15:38:48 +01:00
William Wilgus
ab71b9e334 tree.c update settings when new theme selected
Change-Id: I376aba4258dd3c54c45d97317aa1e7bc8f2a3a17
2022-04-28 18:56:13 -04:00
William Wilgus
f0d3a62d91 keyboard.c change math for editline above picker
Change-Id: I59e7f7face07f3f97fc6e016ee333cd3139ad5fd
2022-04-27 21:40:49 -04:00
Aidan MacDonald
9e93796407 buffering: remove bufgettail/bufcuttail
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-20 16:51:49 -04:00
William Wilgus
002575dbcf [BUGFIX] gui_synclist move global display settings to list struct
forgot to add the update function to the list_wraparound callback

Change-Id: I7ee7940f126726c727344d7d09371f1bf3295c81
2022-04-18 23:08:04 -04:00
Christian Soffke
1c3f6e063a fiiom3k Yes/No screen: Only accept Play button for YES
According to the on screen instructions, any other button
should mean No.

More importantly, in my experience at least, the Select
"button", since it is touch-activated, can sometimes be
pressed by accident, especially when a warning screen
is displayed as a result of pressing that same button.

Change-Id: Ieeadfa8018b5df99605297bc47948a181c22dab4
2022-04-18 22:28:13 -04:00
Christian Soffke
e71a441762 ImageViewer: Fix buffer overflow
np_file is a buffer of size MAX_PATH. After
removing only the file name component and
leaving the rest of the path, the
available space may not be sufficient
for appending another file name (possibly of
size MAX_PATH itself) to it.

This can occur after a file of acceptable
length is opened in ImageViewer, and you
then advance to another file whose path
(including the file name) is longer than
MAX_PATH.

Change-Id: Ideadd9451359bd5735bce92fca5d983e61f300e9
2022-04-18 10:58:40 -04:00
Christian Soffke
1c66e97522 Database: Remove File View menu
These options don't seem to
apply to the database...

Change-Id: I777073eeaed4099acf44996b95fa05b4c2b3abc4
2022-04-18 10:48:41 -04:00
Christian Soffke
4d7327b04d Album Art: Eliminate redundant check
When the 'Album Art' setting was set to
'Prefer Image File' and neither image file
nor embedded artwork were found,
playback would check for files twice.

Change-Id: Ibe392928d58ec04103e2572124841724509bd859
2022-04-18 09:13:31 -04:00
Aidan MacDonald
1af92e5ff8 Fix red from 6f5af8e53c
Change-Id: I02dbc3e91856eaef081446ca77919e6182a85e1d
2022-04-17 17:21:02 +01:00
Christian Soffke
6f5af8e53c Add Codec to Track Info screen
Change-Id: Ieec0e49d0b5e1ca14fa828a510edf30d548969b2
2022-04-17 11:32:13 -04:00
William Wilgus
c4156b1909 viewports, set flags to VP_DEFAULT_FLAGS
flags were getting un-initialized memory
it really didn't matter with the flags getting initialized
anyway
But once I added a new flag that didn't explicitly
set or clear the flag at init well here we are

set flags to VP_DEFAULT_FLAGS in viewport_set_defaults()

add the flags variable to the default vp's set to 0
(it was already initialized to 0 by bss, make it explicit)

Change-Id: I3a9a062455b4cf66d2b8c70fdf05402a5c0c091c
2022-04-17 10:59:56 -04:00
Christian Soffke
6703f43f5c Playlist Viewer: Always retrieve track Info from disk
Frequency, file size, and the codec are not stored
in the database and thus can’t be displayed in the
Playlist Viewer's Track Info screen when metadata
is only retrieved from the database.

Change-Id: I9e1d11c13ad8bf7b90b654ed78e4e7f763c30f8a
2022-04-17 10:58:42 -04:00
Aidan MacDonald
0e8f3669d0 Fix remaining red from 3fcdadce24
Change-Id: I619a637bdf1fb932c3618f1f40aaa1c9e7f98300
2022-04-16 16:06:13 +01:00
Aidan MacDonald
76035decc6 Fix red in 3fcdadce24
Change-Id: Idbee52505b3c109a0aad23e2edf7dd78519eb173
2022-04-16 10:41:19 -04:00
Christian Soffke
f989339664 Remove dead code
Change-Id: If31a99e6488dabab47d482637b2609ff829df1ca
2022-04-16 10:18:28 -04:00
Christian Soffke
68ac932585 PictureFlow: Disable 'Album Not Found' splash when stopped
...and go to last album, even if it hadn't
been selected for playback

Change-Id: I44013e930a1feb873f128c2885ecb8ddaf4ae3ff
2022-04-16 10:13:50 -04:00
Christian Soffke
e3bf6f08e3 PictureFlow: Delay LCD Update until center slide is loaded
Eliminates flashing of slide right after launch or
when changing sorting on the M3K using the
volume buttons

Change-Id: Icd317e0b0d5b939269dc8dafd30d0c0f9daa5fd9
2022-04-16 10:13:50 -04:00
Aidan MacDonald
3fcdadce24 plugins: Add multiboot select plugin
This plugin provides a menu for easily editing the root redirect file
on targets that support multiboot. You can select a new root from a
list of Rockbox installations detected on the filesystem or remove all
redirects to boot from the default location.

To avoid searching the whole filesystem, only subdirectories of the
volume roots are checked for valid installations. Only installations
that are compatible with the current player will be displayed.

Change-Id: I7dcbadfd97873b87817870e61d2ae37956d2da00
2022-04-16 14:36:39 +01:00
Aidan MacDonald
d55dceff37 apps: Add ability to do a clean reboot
Allow a clean shutdown to end in either power off or reboot. Add a
new event SYS_REBOOT to signal it and sys_reboot() to trigger the
event. SYS_REBOOT signals a reboot request and should be listened
for alongside SYS_POWEROFF events.

Change-Id: I99ba7fb5feed2bb5a0a40a274e8466ad74fe3a43
2022-04-16 14:36:39 +01:00
William Wilgus
b9ab75732a bitmap/list.c fix red
--typo

Change-Id: Iaa632e215d7d1e3758f62fedd72565fa633d925e
2022-04-10 23:59:33 -04:00
William Wilgus
ddcab156f7 gui_synclist move global display settings to list struct
its really painful needing to override global settings in order to change
some aspects of lists

this patch moves:

[scrollbar position, cursor type,
talk_menus, keyclick,
wrap around, scroll paginated]

to variables within the synclist, it also makes updating
after settings changes a necessity

I think I have the static synclists in core covered

(I think the one in gui/list-skinned can be left as is)

this patch allows easy modification these flags on the fly

Change-Id: Id0dcb8b05eb9ecd78929c0aff7678bf2ab4c70a7
2022-04-10 22:24:28 -04:00
Aidan MacDonald
8dbc0914f6 imageviewer: limit progress bar LCD update rate
The progress callback doesn't rate limit LCD updates, which causes
excessive slowdowns (up to 150x!) on some targets. Limiting updates
to 20fps solves the problem and should boost load speed across the
board, particularly for large images and animated GIFs that may run
the progress callback thousands of times.

Change-Id: Ia48924d4dcb24c1111509329581809be494d0165
2022-04-09 23:15:48 +01:00
Aidan MacDonald
32f1418c5a buffering: fix buffer overflows with bitmap loading
In some circumstances it was possible for a bitmap to overflow its
buffer and overwrite the next handle. The easiest way to trigger it
is with a highly compressed JPEG that is decoded to a large bitmap.
Because the JPEG file size is used to determine how much to allocate
this would cause an obvious buffer overflow when the JPEG is smaller
than the decoded bitmap. Fix this by using the decoded bitmap size as
the allocation size. Some overhead must be added to deal with JPEGs,
but it will be freed once the image is loaded.

A less obvious possibility is the fact that add_handle() will allow
a handle to be added even if there's not enough space for the entire
allocation. This is generally beneficial because it allows the first
part of a file to be loaded while waiting for space to free up, but
for bitmaps it is not valid because the whole image is loaded at once.
Hence if there is not actually enough space in the buffer, the bitmap
load can again overflow the actual free space and overwrite the next
handle.

The buffering code supports an H_ALLOCALL flag for allocations that
need the free space available immediately, so use it for bitmaps to
avoid that bug.

load_image() had a sketchy-looking check for free space which stopped
me from triggering the bug with simple tests, but since guessing the
free space is obviously a bad idea when the caller *knows* how much
free space there really is, remove that guess and let the caller tell
load_image() the real deal.

Change-Id: If62a58759705d83c16ee5b50f26bcbccc3f6c01f
2022-04-09 15:20:57 +01:00
Aidan MacDonald
5aa0fc3b00 jpeg: provide a rough estimate of decoder memory overhead
JPEG decoding requires additional space in the bitmap buffer beyond
what is needed for the decoded pixel data. Provide a way to estimate
how much overhead is needed.

The actual overhead is sizeof(struct jpeg) + decode_buf_size, where
the latter depends on the image size and JPEG encoding used. From my
testing decode_buf_size is normally pretty small (under 5 KiB) but
looking at the code it could be large in some cases, primarily with
large images, so 32 KiB seems to be a decent compromise. Someone who
knows better about JPEG should pick a better value if that's too big.

Using a constant is obviously not the most accurate but it seems to
be the simplest option for retrofitting to existing code.

Change-Id: I573b0abb8ca2d79e43f185010487f07226edb793
2022-04-09 15:20:57 +01:00
Aidan MacDonald
7718b24401 buffering: fix signed overflow in next_handle_id()
Not sure what the comment is talking about - signed overflow
is undefined behavior and we don't use -fwrapv or other flags
to make it defined. I can't see how a compiler could abuse it
here, but the overflow is nonetheless easily avoided.

Change-Id: Ibed6d7c0d841db2aa86b9d8ba4c6a0d08c413354
2022-04-09 15:20:57 +01:00
William Wilgus
bd444ebd0a BUGFIX keyboard.c make vp alloc static
don't stop playback to alloc viewports for the keyboard
For the moment it doesn't make much difference
each vp takes about 40 bytes (double that in the sim?)
so not the end of the world 120 extra bytes

Change-Id: I482d7e3061cf9fb8065dc28bf62a6f830770f3c7
2022-04-08 18:11:21 -04:00
Nick Peskett
db55d30372 Allow cuesheet index offsets longer than 99 minutes.
While the track number is limited to 99, I know of no documented
constraint on the value of offset minutes to 99.

As we are storing the millisecond offset as unsigned long, assuming
32 bit, we can allow 70,000 minutes (2^32 / 60000).

However, I've been unable to generate a test audio file 48 days long
under 2GB, so I've set the limit to 30,000 minutes.

In addition, this change reduces the maximum number of seconds to 59,
and frames to 74.

I've generated some silent test files with the filenames being
cue_[minutes].mp3

http://peskett.co.uk/rockbox/test_cues/

Change-Id: I3ca4468ebc88ba134c4e785e9395f90bf76941ac
2022-04-07 20:10:19 -04:00
William Wilgus
d1be73cfc0 keyboard.c Use viewports, move text box pos
allows items to be moved around with less code changes

remove scrolling I was not overly impressed with it
add test_kbd plugin

Change-Id: Ic183c7221bda9405891632704f3a7bbfd79bfe83
2022-04-07 19:46:56 -04:00
William Wilgus
bf3e67204c lastfm_scrobbler check for back to back repeat entries
if you skip a track after the halfway point the scrobbler may double post
with slightly different timestamps but the same track info

take a crc of the non-unique part and check against the previously
written track

Change-Id: I676342c4cd76f632131d9cb6d9f7d2f59df357e6
2022-04-02 08:05:37 -04:00
William Wilgus
43abe2d820 lastfm_scrobbler check pointers for validity
we need to make sure we don't deref NULL pointers

Change-Id: I9c564b681cd20222c3a134680e60a310b2eb846c
2022-04-02 07:42:06 -04:00
Aidan MacDonald
5ffe520de4 playlist: use path_strip_last_volume, clarify path conventions
The comment regarding Windows paths was fairly confusing as to
its intent. What the code is trying to do is replace the drive
letter with the volume containing the playlist, which appears
reasonable. The middle of the comment was devoted to explaining
why the code below was potentially incorrect which only served
to add to the confusion.

AFAICT the last volume specifier in a path will cause search to
start from the root of that volume, so any incorrect result can
be avoided by using the new function path_strip_last_volume().

Finally, add a comment at the top of the function that explains
what it does.

Change-Id: If4e4938801f2f81eb52f5d32b5461872995e5e83
2022-04-01 11:40:02 -04:00
Christian Soffke
ca0c3dee0a ImageViewer: M3K keymap allow scrolling up/down
Change-Id: I385354688b1d8f8df4d44e7e177e23bdb6ed3df4
2022-04-01 11:01:52 -04:00
James D. Smith
6e3937e836 lastfm Scrobbler: Substitute album artist for empty artist.
Change-Id: I66dda13ec2cbb592ebe0d269f0c7eff749bc737a
2022-04-01 06:11:42 -04:00
Solomon Peachy
a9e02b4850 FS13338: Updated Slovak translation (Matej Golian)
Change-Id: I41f794a457435f0d02da180673e272438e3879b2
2022-03-31 21:33:53 -04:00
Solomon Peachy
f08d083ed0 FS13441: Updated Italian translation (Alessio Lenzi)
Change-Id: I442d79842ca1d58d122058171175a6fee844a353
2022-03-31 21:32:42 -04:00
Solomon Peachy
cbb5efd525 FS13340: Updated Polish Translation (Adam Rak)
Change-Id: I5b10231277c6c546400b3d74e3c0339f6026b729
2022-03-31 21:31:33 -04:00
William Wilgus
43830d0128 alarm_menu share setter with settime
share the time picker with the alarm

block the date portion, seconds are ignored

Change-Id: Idc6974466772c33248ff532c8f3c62c744ee06d9
2022-03-30 09:05:28 -04:00
Christian Soffke
df3afcfa3b PictureFlow: Configurable album sorting
Now offers sorting by:

- Album artist, then album name
- Album artist, then album year
- Album year
- Album name

Years are determined by the most recently
released track appearing on an album, if the
value differs between tracks.

On the M3K,  instead of by going into Settings,
volume buttons can also be used for quickly
adjusting the current sorting

Change-Id: I2c50059617114fb418336c466fdd37415473ac7d
2022-03-27 08:51:58 -04:00