Commit graph

145 commits

Author SHA1 Message Date
Michael Hohmuth
8207a4a267 FS#12132 patch 8: retrieve_entries: Decrease binsize by reenabling
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-04 10:23:18 +00:00
Michael Hohmuth
e7c2449d07 Database: Fix array-bounds calculation when applying a format using
%strip to partially loaded (chunked) database results.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30247 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 10:21:52 +00:00
Thomas Martitz
98096970e0 Cleanup tree.c cache handling a bit.
* 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-08-03 09:49:25 +00:00
Michael Hohmuth
eab7e74778 FS#12132 patch 6, part 2: tagnavi.config: Add support for "basename"
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-31 16:26:35 +00:00
Michael Hohmuth
accea18ded FS#12132 patch 6, part 1: tagnavi.config: Add support for string
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-31 16:26:31 +00:00
Thomas Martitz
1b7ff725c6 Revert "Introduce bsearch() and use it in tagtree.c."
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-18 18:57:50 +00:00
Thomas Martitz
74ab227b58 Introduce bsearch() and use it in tagtree.c.
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-07-18 18:55:20 +00:00
Miika Pekkarinen
d0084ffd7a Fixed a regression caused in r30021: tagnavi_custom.config parsing
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-23 20:22:00 +00:00
Thomas Martitz
316f9a0238 tagtree: Refactor memory allocation to local functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30029 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 19:32:56 +00:00
Thomas Martitz
19d08c2664 Move struct search_instruction into struct menu root, as they're not allocated or used independently.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30028 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 19:32:52 +00:00
Michael Hohmuth
851cac848a Prevent out-of-bounds array access when a tagnavi config file defines too many %format specifications
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30006 a1c6a512-1295-4272-9138-f99709370657
2011-06-14 20:54:26 +00:00
Michael Hohmuth
05a1984eb3 FS#12065 - Fix two regressions introduced with r26192 (FS#10976 /
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-06-01 08:00:37 +00:00
Nils Wallménius
f42a305b57 Accept FS#12136: Save some binsize in tagtree.c. Thanks to sideral for testing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29937 a1c6a512-1295-4272-9138-f99709370657
2011-05-31 19:44:21 +00:00
Michael Hohmuth
6a24a7a903 tagnavi.config: Add a logical-OR operator ("|") for tagnavi conditionals.
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-05-10 10:25:41 +00:00
Magnus Holmgren
ed2cfb8c1d Don't (partially) apply changes to max entries in the file browser 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-04-30 11:00:26 +00:00
Michael Sevakis
6510973223 Give playback engine better control over the codec. Codec simply follows 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-23 14:31:13 +00:00
Michael Hohmuth
4844142e16 Do not update resume information and do not log statistics when a
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-02-08 20:31:27 +00:00
Dominik Riebeling
d2cc5ce58e Fix player becoming unresponsive on Stop / Pause in some cases.
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-17 22:28:36 +00:00
Michael Giacomelli
cacc64a4fe Blind commit a 'fix' for automatic resume on HWCODEC since I don't 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-02 03:48:40 +00:00
Michael Giacomelli
66e8fc0f0d Commit part of FS#11748 by Michael Hohmuth. Adds support for automatically 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
2011-01-02 02:49:13 +00:00
Jonathan Gordon
7270e5eafd Accept FS#11722 by Michael Hohmuth
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-11-16 13:17:37 +00:00
Thomas Martitz
6eaab4d004 Ged rid of uisimulator/common/io.c for android builds.
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-09-01 21:29:34 +00:00
Jonathan Gordon
0e263d5b77 accept FS#10992 by Rui Araújo to fix FS#10976 - make the <Untagged> string translatable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26192 a1c6a512-1295-4272-9138-f99709370657
2010-05-20 13:24:50 +00:00
Thomas Martitz
50a6ca39ad Move c/h files implementing/defining standard library stuff into a new libc 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
2010-05-06 21:04:40 +00:00
Jonathan Gordon
6643a3bc74 Fix FS#9660 - make warn on playlist erase work correctly when creating a new 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-12-21 05:44:00 +00:00
Jeffrey Goode
9d842683eb Comment out LOGF_ENABLE defines everywhere, replace evil comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23497 a1c6a512-1295-4272-9138-f99709370657
2009-11-03 16:25:03 +00:00
Jeffrey Goode
9a4420bf96 FS#10739: playback.c code split
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657
2009-10-31 19:17:36 +00:00
Thomas Martitz
774bacc692 Correct wrong usage of event callbacks all over the place. It's not supposed 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-10-20 21:54:44 +00:00
Thomas Martitz
16983afae7 Fix displaying of the database browser's progress splash so that it works as 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-20 19:31:09 +00:00
Thomas Martitz
18e40e0f4c Make kbd_input() show a cancel splash to indicate user abort better and for 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-08-12 14:38:25 +00:00
Nils Wallménius
3d4701a6e4 FS#10080
* 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-07-14 13:57:45 +00:00
Miika Pekkarinen
8e2bdcaab6 A bunch of stability fixes into tagcache engine and database browser. Mainly 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-20 16:17:54 +00:00
Andrew Mahone
1248a0dc1f Replace arrays of tags that are numeric/sorted/uniqued with bitfields 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-06-03 08:19:32 +00:00
Thomas Martitz
38d5175b52 Rename struct root_menu and the global int root_menu to avoid clashes with #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-30 16:35:28 +00:00
Thomas Martitz
fc502e0b15 Move enum table into tagtree.c as it's not used elsewhere and switch to 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-30 16:10:34 +00:00
Bertrik Sikken
2dc2054319 Remove some unused declarations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21010 a1c6a512-1295-4272-9138-f99709370657
2009-05-21 12:32:26 +00:00
Bertrik Sikken
b24fafbf14 Yet more #include cleanups
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20249 a1c6a512-1295-4272-9138-f99709370657
2009-03-08 20:28:15 +00:00
Frank Gevaerts
2f8a0081c6 Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do 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
2008-11-01 16:14:28 +00:00
Jonathan Gordon
71898e5c54 Accept FS#9480 - centralise and organise the events in the apps/ layer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18819 a1c6a512-1295-4272-9138-f99709370657
2008-10-16 10:38:03 +00:00
Frank Gevaerts
46573019a5 add HAVE_DISK_STORAGE, and use that instead of HAVE_FLASH_STORAGE when checking for an actual disk (i.e. related to spindown, skipping,...)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18735 a1c6a512-1295-4272-9138-f99709370657
2008-10-07 19:37:33 +00:00
Jonathan Gordon
a3b9bfc763 dont let the database create a new playlist when party mode is on. (fixes FS#8292)
its not consistant with the filebrowser though, i.e you have to open the context menu for the item to add it to the playlist (whereas in the filebrowser it automatically gets queued if its selected)
still better than ignoreing the setting though


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18316 a1c6a512-1295-4272-9138-f99709370657
2008-08-19 12:05:01 +00:00
Nils Wallménius
01729e7a18 FS#9281 Rename of splash functions.
* Remove gui_splash()
* Rename gui_syncsplash() to splashf() and remove its voice 
capabilities.
* Rename the internal splash() to splash_internal() and introduce an 
externally visible splash() that handles simple splashing  without 
printf functionality e.g. splash(HZ, ID2P(LANG_FOO)); or splash(HZ, 
"foo"); if a LANG_* id is passed it will be voiced.
* Adjust all places that called gui_syncsplash() to use the correct 
variant from above.
* Export both new functions to plugins and adjust places calling 
rb->splash() to use the correct variant so that we now have naming 
consistency between the core and plugins.
* Fix one latent bug that would cause my sim to crash with the above 
changes and correct P2STR and P2ID macros, thanks to pondlife.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18282 a1c6a512-1295-4272-9138-f99709370657
2008-08-15 08:27:39 +00:00
Bertrik Sikken
f4d4a6ab60 Implement FS#8947 - Add a stub in the simulator for ata_disk_is_active. This make it possible to clean up some #ifdef SIMULATOR macros.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17927 a1c6a512-1295-4272-9138-f99709370657
2008-07-03 13:37:57 +00:00
Robert Kukla
f9f2d6d42e fix FS#9104 - Database sorting does not work on un-filtered list
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17910 a1c6a512-1295-4272-9138-f99709370657
2008-07-01 20:55:19 +00:00
Jonathan Gordon
a3e63cf044 very minor code police. also fix a possible but unlikely missed cpu_boost(false)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17867 a1c6a512-1295-4272-9138-f99709370657
2008-06-29 07:29:14 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Nils Wallménius
dabcb81e13 Introduce a small helper function that asks the user if the dynamic playlist should be erased to increase code re-use
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17295 a1c6a512-1295-4272-9138-f99709370657
2008-05-01 10:13:12 +00:00
Bertrik Sikken
2843469876 Moved atoi declaration to stdlib.h. Deleted atoi.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17280 a1c6a512-1295-4272-9138-f99709370657
2008-04-28 16:18:04 +00:00
Bertrik Sikken
43414807da Updated use of events.h header file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17267 a1c6a512-1295-4272-9138-f99709370657
2008-04-27 19:56:16 +00:00
Nils Wallménius
33c44461e1 Const police raid, making a lot of pointers to lang strings const and removing some ugly casting
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17251 a1c6a512-1295-4272-9138-f99709370657
2008-04-26 09:30:24 +00:00