Commit graph

227 commits

Author SHA1 Message Date
Boris Gjenero
17ed3253fc Add const to global pointers to strings.
When a global pointer is not declared as constant, gcc will put it in
memory. Getting the address of the string it points to requires loading
the address of the pointer and then loading the pointer. When the pointer
is declared constant, the address of the string is loaded directly.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31345 a1c6a512-1295-4272-9138-f99709370657
2011-12-17 18:31:55 +00:00
Boris Gjenero
8e6030c822 FS#12378 : Remove various unused code, and comment out some unused code and data for reference or future use.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31256 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 21:45:25 +00:00
Thomas Martitz
1645c148e3 Simulate usb plugging on the sim better using sim_tasks.
Now all threads need to ack the connection like on real target, dircache is unloaded and playback stops accordingly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31009 a1c6a512-1295-4272-9138-f99709370657
2011-11-17 18:40:00 +00:00
Thomas Martitz
7e14b935df Dircache: Allow dircache to be enabled without reboot.
Also add two dircache function, one of which does what dircache_disable()
did previously as this now also frees the dircache buffer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30393 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 21:07:46 +00:00
Thomas Martitz
0c4c81620f Fix h100 red and other warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30384 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 14:32:16 +00:00
Thomas Martitz
baa070cca6 GSoC/Buflib: Enable compaction in buflib.
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-30 14:01:45 +00:00
Thomas Martitz
d0b72e2590 GSoC/Buflib: Add buflib memory alocator to the core.
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-30 14:01:33 +00:00
Thomas Jarosch
faf354c4f3 Fix file descriptor leak on error
Credit goes to "cppcheck" again.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30350 a1c6a512-1295-4272-9138-f99709370657
2011-08-25 19:42:00 +00:00
Thomas Martitz
2c07d238db Fix tempbuf assignment in tagcache and bump plugin API/ABI for r30308.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30314 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 18:08:40 +00:00
Thomas Martitz
d1322b7159 GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.
Namely, introduce buffer_get_buffer() and buffer_release_buffer().
buffer_get_buffer() aquires all available and grabs a lock, attempting to
call buffer_alloc() or buffer_get_buffer() while this lock is locked will cause
a panicf() (doesn't actually happen, but is for debugging purpose).
buffer_release_buffer() unlocks that lock and can additionally increment the
audiobuf buffer to make an allocation. Pass 0 to only unlock if buffer was
used temporarily only.
buffer_available() is a replacement function to query audiobuflen, i.e. what's
left in the buffer.
Buffer init is moved up in the init chain and handles ipodvideo64mb internally.

Further changes happened to mp3data.c and talk.c as to not call the above API
functions, but get the buffer from callers. The caller is the audio system
which has the buffer lock while mp3data.c and talk mess with the buffer.
mpeg.c now implements some buffer related functions of playback.h, especially
audio_get_buffer(), allowing to reduce #ifdef hell a tiny bit.

audiobuf and audiobufend are local to buffer.c now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30308 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 15:13:00 +00:00
Michael Hohmuth
c027dc20be Database: Bug fix: The filename seek index is invalid if FLAG_DIRCACHE
is set on a database entry and the dircache went offline.  In this
case, retrieve() and get_next() need to abort and take the ramcache
offline as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30255 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 23:03:43 +00:00
Michael Hohmuth
fa81cdc61a Database: find_entry_ram: Avoid dircache use if it's not ready
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30254 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 23:03:27 +00:00
Michael Hohmuth
4cb473562e Database: Fix memory-area bounds checking during database reload.
Check free space before reading new data from disk, and do not forget
to account for the RAM-cache header.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30246 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 10:21:40 +00:00
Michael Hohmuth
fa5cf8edea Database: Fix to support case-sensitive file systems containing audio
files with names differing only in capitalization.  Thanks to Slasheri
for the fix.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30241 a1c6a512-1295-4272-9138-f99709370657
2011-08-02 22:10:06 +00:00
Thomas Martitz
7bbd7daaf7 Tagcache: Rename global static variable for better readability.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30239 a1c6a512-1295-4272-9138-f99709370657
2011-08-02 14:35:10 +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
Miika Pekkarinen
337e922685 Allocate indices directly in ramcache header. Add version code to
tagcache state dump header. Debug: hdr-structure corruption might
happen after rebuilding of dircache.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30109 a1c6a512-1295-4272-9138-f99709370657
2011-07-01 13:48:28 +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
af7aaae478 Dircache: Don't expose struct dircache_entry and pointers into the cache, use IDs instead.
Only integer IDs are exposed from dircache with this. This way the cache is isolated from other modules.
This is needed for my buflib gsoc project.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30038 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:42 +00:00
Thomas Martitz
e063725534 Dircache: Return the size of the result string in dircache_copy_path() so that callers don't need to call strlen on it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30034 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:15 +00:00
Miika Pekkarinen
f2ef42c1da Fixed a changelog export/import problem with tagcache where <CR> or <LF>
characters in a tag could cause the parser fail to import a track
statistics correctly. Now line feeds are escaped properly and carriage
returns ignored on import.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30021 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 15:53:33 +00:00
Miika Pekkarinen
8d9b9d247b Removed redundant copy of tagcache master_header structure stored in
memory. One of these headers (current_tcmh) was not loaded in when
tagcache state was initialized from a hibernated state file (flashed
H1xx targets). That caused internal serial number to start always from
zero, rendering "recently played tracks" query not working as expected.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30016 a1c6a512-1295-4272-9138-f99709370657
2011-06-19 14:36:26 +00:00
Michael Hohmuth
f9f96325e2 FS#12107: Remove track-number guessing code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29982 a1c6a512-1295-4272-9138-f99709370657
2011-06-06 23:03:31 +00:00
Michael Hohmuth
6a0021cf20 FS#12132 patch 5: check_clauses: Optimizations.
* There's no need to reset the buffer argument to
  check_against_clauses to 0 when it's not needed.  We can always
  initialize str = buf and only change it on a RAM search hit.

* Do not memset buffer to 0 -- it's sufficient to make sure the
  retrieved tag string is zero-terminated.

* Factor out a call to check_virtual_tags from two branches of an if
  statement.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29981 a1c6a512-1295-4272-9138-f99709370657
2011-06-06 22:49:07 +00:00
Michael Hohmuth
564a8ed1fd FS#12132 patch 3: Rename read_numeric_tag to find_tag, as it is indeed
used for nonnumeric tags as well.

Optimization for the nonnumeric case: Only numerics are ever updated,
so there's no need to scan the command queue for updates to nonnumeric
tags.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29979 a1c6a512-1295-4272-9138-f99709370657
2011-06-06 22:48:57 +00:00
Michael Hohmuth
509d6a901d FS#12132 patch 2: add_uniqbuf: Fix confusing indentation in if condition
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29978 a1c6a512-1295-4272-9138-f99709370657
2011-06-06 22:48:53 +00:00
Michael Hohmuth
bc315ad731 FS#12076 - DB stats resurrection: If the filename was changed, require
all three of album, artist, and title tags to match for resurrection
to take place.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29858 a1c6a512-1295-4272-9138-f99709370657
2011-05-11 22:37:46 +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
Andree Buschmann
f19d6a5e1d Fix even more 'variable set but not used' warnings reported from GCC 4.6.0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29819 a1c6a512-1295-4272-9138-f99709370657
2011-05-03 20:28:56 +00:00
Michael Hohmuth
cf223b98ad Do not attempt to remove the temporary database twice during a database update.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29716 a1c6a512-1295-4272-9138-f99709370657
2011-04-15 21:45:45 +00:00
Fred Bauer
71e4b03ed6 Follow symlink dirs on UI simulator
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29530 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 23:19:06 +00:00
Michael Hohmuth
b016ab9d86 DB import: Correctly import previously exported resume offsets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29469 a1c6a512-1295-4272-9138-f99709370657
2011-02-28 23:47:11 +00:00
Michael Hohmuth
1a23e0ca19 Fix database import and export
Correct an omission that happened when the DB schema was changed last
time.  Add a comment to enum tag_type to prevent this from happening
in the future.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29435 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 20:25:11 +00:00
Thomas Jarosch
29e4a2d90d Fix buffer size used for realpath() call
Thanks to kugel for pointing this out.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29320 a1c6a512-1295-4272-9138-f99709370657
2011-02-16 18:40:44 +00:00
Thomas Jarosch
1dbea9d959 No need to cast away const. Thanks to sideral
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29318 a1c6a512-1295-4272-9138-f99709370657
2011-02-16 17:58:57 +00:00
Thomas Jarosch
0060fed451 RaaA: Fix tagcache filename lookups for paths containing symbolic links
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29317 a1c6a512-1295-4272-9138-f99709370657
2011-02-16 01:01:49 +00:00
Michael Sevakis
b15aa47c56 All kernel objects in code shared amongs targets (core, plugins, codecs) should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29305 a1c6a512-1295-4272-9138-f99709370657
2011-02-14 11:27:45 +00:00
Thomas Martitz
4aec8ef059 Fix SDL app build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29159 a1c6a512-1295-4272-9138-f99709370657
2011-01-29 01:26:43 +00:00
Thomas Martitz
b703d251be Workaround the brokenness of realpath() a bit more.
At least on android it blindly writes to the end of the buffer passed to it assuming it's sufficiently. It wasn't in our case, resulting in a buffer overflow (and breakage).
This should fix strange problems relating to database initialization on application targets.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29147 a1c6a512-1295-4272-9138-f99709370657
2011-01-27 20:17:55 +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
Thomas Martitz
87c8be4a08 RaaA: Improve tagcache search to make the database built.
First, it add the ability to tagcache to walk through multiple search roots.
Second, it adds symlinks targets to the search roots if they're are not inside any of the current search roots, otherwise the symlink is ignored (unless it's a file).

The default search root is still /, so no search root will be actually added.
But the tagcache now isn't trapped by recursive symlinks anymore and successfully builds, and it's prepared for a future music directory setting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28884 a1c6a512-1295-4272-9138-f99709370657
2010-12-23 19:02:18 +00:00
Alexander Levin
871af160f3 Fix a typo in a comment
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28777 a1c6a512-1295-4272-9138-f99709370657
2010-12-08 22:08:08 +00:00
Thomas Martitz
2c2416094f Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-12-06 22:26:31 +00:00
Jonathan Gordon
efba7d8c30 once more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28647 a1c6a512-1295-4272-9138-f99709370657
2010-11-23 00:27:54 +00:00
Jonathan Gordon
1e0006b008 fix red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28646 a1c6a512-1295-4272-9138-f99709370657
2010-11-23 00:25:48 +00:00
Jonathan Gordon
893d2f37ba Accept FS#11723 by Michael Hohmuth
Tagcache returns stale numeric (runtime statistics) data


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28645 a1c6a512-1295-4272-9138-f99709370657
2010-11-23 00:15:13 +00:00
Rafaël Carré
961b5dd4c1 tagcache open_files(): open the correct file (missed in r27656)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28114 a1c6a512-1295-4272-9138-f99709370657
2010-09-19 08:17:15 +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