summaryrefslogtreecommitdiffstats
path: root/apps/tagtree.c
AgeCommit message (Collapse)AuthorFilesLines
2020-07-22keyboard add ability to specify temporary custom layoutsWilliam Wilgus1-1/+1
rb core allows you to load custom keyboard layouts this patch adds the ability to load a keyboard layout in a buffer the custom layout is temporary and does not overwrite the current layout use like so: unsigned short kbd[64]; unsigned short *kbd_p = kbd; if (!kbd_create_layout("ABCD1234\n", kbd, sizeof(kbd))) kbd_p = NULL; rb->kbd_input(buf,sizeof(buf), kbd_p); Change-Id: I7be2bd4a1b4797a147fa70228a9749dc56ac052a
2019-08-02tagtree add %reload to allow hot reloading of tagnavi configWilliam Wilgus1-18/+124
adds (static) function tagtree_unload frees all buflib allocations for tagtree adds command %reload that allows a new tagnavi file to be loaded without device restart use it like so.. "Reload..." -> %reload Allocations are now checked for validity (probably a good idea anyway) Change-Id: I2b4b9b7e253f97f3e6575e0ea7a92905e004d47f
2019-07-10tagtree.c->loadroot() guard against overflowWilliam Wilgus1-0/+3
forum user chris_s noted an possible unhandled cache overflow Change-Id: Ia79399d6581ef6b635578896519fda8126c731d7
2018-10-18Fix menu warningsWilliam Wilgus1-4/+4
change offending bool return to int warning: cast between incompatible function types from '_Bool (*)(void)' to 'int (*)(void)' [-Wcast-function-type] forgot to remove -- typedef int (*menu_function)(void); Change-Id: Ie4c8d3ddb0fb7843c4ec584203350d658d6bee3e
2017-02-10Fix tagtree from blowing up when its buffer movesMichael Sevakis1-1/+6
I noticed that after booting with the external storage removed, playing from tagtree, inserting the card, forcing dircache to reallocate from the debug screen, and trying to reenter tagtree, it would data abort because the dircache reallaction to a larger size caused the tagtree buffer to move. Adjustment to at least one pointer (csi) was missed. Since it's non-trivial there to determine when things should be NULL and when they shouldn't, add check for menu too before moving it. As for the rest, who knows. Change-Id: Iea6538a2091b4b47083f39296555efc47edf8ba8
2014-03-14events: Rework event subsystem (add_event, send_event) to be more versatile.Thomas Martitz1-6/+8
add_event_ex is added that takes an extra user_data pointer. This pointer is passed to the callback (add_event and add_event_ex have slightly different callbacks types). All callbacks also get the event id passed. Events added with add_event_ex must be removed with remove_event_ex because the user_data pointer must match in addition to the callback pointer. On the other add_event is simplified to omit the oneshort parameter which was almost always false (still there with add_event_ex). As a side effect the ata_idle_notify callbacks are changed as well, they do not take a data parameter anymore which was always NULL anyway. This commit also adds some documentation to events.h Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
2014-03-10Implement time-based resume and playback start.Michael Sevakis1-5/+15
This complements offset-based resume and playback start funcionality. The implementation is global on both HWCODEC and SWCODEC. Basically, if either the specified elapsed or offset are non-zero, it indicates a mid-track resume. To resume by time only, set elapsed to nonzero and offset to zero. To resume by offset only, set offset to nonzero and elapsed to zero. Which one the codec uses and which has priority is up to the codec; however, using an elapsed time covers more cases: * Codecs not able to use an offset such as VGM or other atomic formats * Starting playback at a nonzero elapsed time from a source that contains no offset, such as a cuesheet The change re-versions pretty much everything from tagcache to nvram. Change-Id: Ic7aebb24e99a03ae99585c5e236eba960d163f38 Reviewed-on: http://gerrit.rockbox.org/516 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested: Michael Sevakis <jethead71@rockbox.org>
2014-01-15tagtree: Use strnatcasecmp() for the database browser too.Thomas Martitz1-1/+14
Even though you can insert leading zeros that makes ascii sort work for numbers, sometimes the leading zeros don't suffice. In order to always sort numerically strnatcasecmp() is needed. With the default tagnavi.config this affects albums with discnum > 9 or tracnums > 99. This FS#12888. Change-Id: Ie265c86eaf6dd07b6beda9e5eef25eb81eef8fd4
2013-07-13Get rid of some superfluous single-purpose functions in playback.Michael Sevakis1-26/+45
* Remove explicit tracking of elapsed time of previous track. * Remove function to obtain auto skip flag. * Most playback events now carry the extra information instead and pass 'struct track_event *' for data. * Tweak scrobbler to use PLAYBACK_EVENT_TRACK_FINISH, which makes it cleaner and removes the struct mp3entry. Change-Id: I500d2abb4056a32646496efc3617406e36811ec5
2013-07-12Fix whitespace in files for following commit.Michael Sevakis1-207/+207
Change-Id: I4adb8a152e9b99fcd26d95da7334d7d0cbe2a036
2011-08-30GSoC/Buflib: Enable compaction in buflib.Thomas Martitz1-48/+181
This enables the ability to allocate (and free) memory dynamically without fragmentation, through compaction. This means allocations can move and fragmentation be reduced. Most changes are preparing Rockbox for this, which many times means adding a move callback which can temporarily disable movement when the corresponding code is in a critical section. For now, the audio buffer allocation has a central role, because it's the one having allocated most. This buffer is able to shrink itself, for which it needs to stop playback for a very short moment. For this, audio_buffer_available() returns the size of the audio buffer which can possibly be used by other allocations because the audio buffer can shrink. lastfm scrobbling and timestretch can now be toggled at runtime without requiring a reboot. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
2011-08-30GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz1-2/+10
The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
2011-08-04FS#12132 patch 8: retrieve_entries: Decrease binsize by reenablingMichael Hohmuth1-27/+34
inlining format_str() and avoiding a string copy by printing directly into the name buffer. Also uses quite a bit less stack space. En passant, made basename printing more robust by not limiting the buffer into which the file pathname is fetched by the max size of the resulting basename string. Also, fixed a potential buffer overrun in format_str. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30248 a1c6a512-1295-4272-9138-f99709370657
2011-08-04Database: Fix array-bounds calculation when applying a format usingMichael Hohmuth1-4/+5
%strip to partially loaded (chunked) database results. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30247 a1c6a512-1295-4272-9138-f99709370657
2011-08-03Cleanup tree.c cache handling a bit.Thomas Martitz1-10/+12
* Rename stuff to not re-use the term dircache * Move cache to own struct * Encapsulate retrieving entries a bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30242 a1c6a512-1295-4272-9138-f99709370657
2011-07-31FS#12132 patch 6, part 2: tagnavi.config: Add support for "basename"Michael Hohmuth1-0/+1
in formats and conditions. The basename is the non-directory part of a file's pathname. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30230 a1c6a512-1295-4272-9138-f99709370657
2011-07-31FS#12132 patch 6, part 1: tagnavi.config: Add support for stringMichael Hohmuth1-28/+48
truncation in tagnavi %formats using the standard "%{width}.{truncation}s" format syntax. String truncation is especially useful when using part of a string tag, filename, or basename for sorting and %strip'ing. (Basename support is forthcoming in a subsequent commit.) Also renovated the format_str() code a bit (improved structuring, removed code duplication) and increased the maximum length of a printf conversion specification to 20 characters. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30229 a1c6a512-1295-4272-9138-f99709370657
2011-07-18Revert "Introduce bsearch() and use it in tagtree.c."Thomas Martitz1-69/+65
It was committed by accident (it's on FS still). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30157 a1c6a512-1295-4272-9138-f99709370657
2011-07-18Introduce bsearch() and use it in tagtree.c.Thomas Martitz1-65/+69
bsearch() is a general purpose binary search function for arrays. It's supposedly faster than looping over arrays. The array needs to be sorted in ascending order under the provided comparison function. If the key and array element are of the same kind, then the same compare function can be used for qsort() and bsearch(). Code taken from glibc. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30155 a1c6a512-1295-4272-9138-f99709370657
2011-06-23Fixed a regression caused in r30021: tagnavi_custom.config parsingMiika Pekkarinen1-1/+7
fails if lines ended with <CR><LF> sequence. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30058 a1c6a512-1295-4272-9138-f99709370657
2011-06-20tagtree: Refactor memory allocation to local functions.Thomas Martitz1-18/+32
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30029 a1c6a512-1295-4272-9138-f99709370657
2011-06-20Move struct search_instruction into struct menu root, as they're not ↵Thomas Martitz1-16/+12
allocated or used independently. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30028 a1c6a512-1295-4272-9138-f99709370657
2011-06-14Prevent out-of-bounds array access when a tagnavi config file defines too ↵Michael Hohmuth1-0/+6
many %format specifications git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30006 a1c6a512-1295-4272-9138-f99709370657
2011-06-01FS#12065 - Fix two regressions introduced with r26192 (FS#10976 /Michael Hohmuth1-6/+7
FS#10992 - make the <Untagged> string translatable): * The translation was done too early: before the tagnavi format clauses were checked. This prevented comparisons against "<Untagged>" when a non-English translation was active. * The code overwrote the buffer containing the constant string "<Untagged>" with the translation. This is neither safe nor necessary: The result pointer simply can be swapped with a pointer to the translation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29941 a1c6a512-1295-4272-9138-f99709370657
2011-05-31Accept FS#12136: Save some binsize in tagtree.c. Thanks to sideral for testing.Nils Wallménius1-68/+91
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29937 a1c6a512-1295-4272-9138-f99709370657
2011-05-10tagnavi.config: Add a logical-OR operator ("|") for tagnavi conditionals.Michael Hohmuth1-6/+18
Logical-AND ("&") always takes precedence over logical-OR. (Parentheses are not supported.) Fight binsize increase by storing some common expressions in local variables. This avoids repeated reevaluations involving memory accesses. check_clauses: Fail clause (return false) in case of errors (tag too long, DB entry deleted). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29851 a1c6a512-1295-4272-9138-f99709370657
2011-04-30Don't (partially) apply changes to max entries in the file browser ↵Magnus Holmgren1-1/+1
immediately. The setting affects a buffer that is allocated during boot, so code using that buffer should use the value that was in effect during boot. Add a note to the manual that a reboot is needed for the changes to be applied. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29798 a1c6a512-1295-4272-9138-f99709370657
2011-02-23Give playback engine better control over the codec. Codec simply follows ↵Michael Sevakis1-6/+3
commands and doesn't concern itself with audio state. Get track change notification in on the actual last buffer insert of the track because now audio simply waits for a track change notify from PCM on the last track and it must be sent reliably. This is still at an intermediate stage but works. Codecs and plugins become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29387 a1c6a512-1295-4272-9138-f99709370657
2011-02-08Do not update resume information and do not log statistics when aMichael Hohmuth1-3/+8
track is interrupted within the first 15 seconds. Regard a rewind to 0:00 as a track restart (updating resume position / playback statistics before the rewind and starting the 15 s delay). This allows skipping forward across an unplayed track without changing its resume offset. Also, it is possible to skip backward to the previous track after rewinding to the current track to 0:00 (pressing Left twice) without losing the current track's resume position. Initially contributed by Dave Slusher Caveats: * Works only for SWCODEC * Skipping forward without altering the resume position does not work when skip to outro has been turned on. * The 15-second window in which the resume offset will not be updated should start at the initial resume position, not at 0:00. This would allow skipping over partially played tracks without altering the resume position. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29250 a1c6a512-1295-4272-9138-f99709370657
2011-01-17Fix player becoming unresponsive on Stop / Pause in some cases.Dominik Riebeling1-1/+1
Fix for FS#11856: In tagtree_buffer_event, do not wait for database to come online as that may never happen. Rather, wait until it either has come online or has decided that this will never happen. Added a new function to tagcache.c to export this information. Flyspray: FS#11865 Author: Michael Hohmuth git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29081 a1c6a512-1295-4272-9138-f99709370657
2011-01-02Blind commit a 'fix' for automatic resume on HWCODEC since I don't ↵Michael Giacomelli1-2/+8
understand HWCODEC and have no way to test builds for it. For now just disable it. In the long term it would be nice to support this on HWCODEC, or failing that, clean this up a little more. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28943 a1c6a512-1295-4272-9138-f99709370657
2011-01-02Commit part of FS#11748 by Michael Hohmuth. Adds support for automatically ↵Michael Giacomelli1-22/+62
resuming any song that is not played to completion at any point later in time, regardless of how many intermediate tracks are played. This is accomplished by expanding the database to record incompletely played tracks. Currently, the feature is simply on or off, in which case all tracks automatically resume, or they do not. The remainder of patches in the task expand this feature by allowing only certain file to automatically resume, only resuming in certain circumstances, etc but are not included until we reach agreement on what should be included. Additionally, the manual will need to be updated once we agree on the available settings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28942 a1c6a512-1295-4272-9138-f99709370657
2010-11-16Accept FS#11722 by Michael HohmuthJonathan Gordon1-0/+3
Wait for the db to be ready before trying to to any runtime stats git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28608 a1c6a512-1295-4272-9138-f99709370657
2010-09-01Ged rid of uisimulator/common/io.c for android builds.Thomas Martitz1-1/+1
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants. Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know). For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one, the values can be retrieved via the new dir_get_info(). Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-05-20accept FS#10992 by Rui Araújo to fix FS#10976 - make the <Untagged> string ↵Jonathan Gordon1-0/+6
translatable git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26192 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz1-1/+1
directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
2009-12-21Fix FS#9660 - make warn on playlist erase work correctly when creating a new ↵Jonathan Gordon1-2/+1
playlist from the database (a bit of a hack, but not bad enough to outright reject) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24089 a1c6a512-1295-4272-9138-f99709370657
2009-11-03Comment out LOGF_ENABLE defines everywhere, replace evil commentsJeffrey Goode1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23497 a1c6a512-1295-4272-9138-f99709370657
2009-10-31FS#10739: playback.c code splitJeffrey Goode1-1/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657
2009-10-20Correct wrong usage of event callbacks all over the place. It's not supposed ↵Thomas Martitz1-2/+4
to return anything, and should take a data parameter. Fixing it because correcting the event api prototypes causes many warnings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23301 a1c6a512-1295-4272-9138-f99709370657
2009-08-20Fix displaying of the database browser's progress splash so that it works as ↵Thomas Martitz1-20/+20
intended (according to r16432: hide until 0.5s have passed, but never if the disk isn't spinning). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22442 a1c6a512-1295-4272-9138-f99709370657
2009-08-12Make kbd_input() show a cancel splash to indicate user abort better and for ↵Thomas Martitz1-1/+1
better consistency all over the place. Change checking for its return value (style-wise) at some places too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22269 a1c6a512-1295-4272-9138-f99709370657
2009-07-14FS#10080Nils Wallménius1-9/+8
* Move strncpy() from core to the pluginlib * Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins * Drop strncpy() from the codec api as no codec used it * Bump codec and plugin api versions git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
2009-06-20A bunch of stability fixes into tagcache engine and database browser. Mainly ↵Miika Pekkarinen1-29/+39
data retrieval problems, races, data corruption of sorted index files at the end with junk data, access to unitialized memory and so on. Should fix FS#8710 and may fix FS#8414. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21402 a1c6a512-1295-4272-9138-f99709370657
2009-06-03Replace arrays of tags that are numeric/sorted/uniqued with bitfields ↵Andrew Mahone1-3/+3
flagging each tag that is a member of the set, and replace the membership tests with a shift and bitwise and. The test is still done inside a function on SH, as this saves some space vs the macro used on other targets. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21175 a1c6a512-1295-4272-9138-f99709370657
2009-05-30Rename struct root_menu and the global int root_menu to avoid clashes with ↵Thomas Martitz1-17/+17
#including plugin.h (which #includes root_menu.h), which will be needed for pictureflow in the database (I have some code for that). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21137 a1c6a512-1295-4272-9138-f99709370657
2009-05-30Move enum table into tagtree.c as it's not used elsewhere and switch to ↵Thomas Martitz1-28/+35
uppercase for its constants as per docs/CONTRIBUTING. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21135 a1c6a512-1295-4272-9138-f99709370657
2009-05-21Remove some unused declarationsBertrik Sikken1-1/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21010 a1c6a512-1295-4272-9138-f99709370657
2009-03-08Yet more #include cleanupsBertrik Sikken1-0/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20249 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts1-1/+2
that, it also introduces sd_*, nand_*, and mmc_*. This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657