summaryrefslogtreecommitdiff
path: root/apps/playlist.c
AgeCommit message (Collapse)Author
2012-03-19Option to constrain get_next_dir() to directories below ↵Nick Peskett
global_settings.start_directory. When enabled, if the user has set "Start File Browser Here" (config.cfg: start directory) to anything other than root and "Auto-Change Directory" is set to "Yes" or "Random", the directory returned when an auto change is required will be constrained to the value of "start directory" or below. Change-Id: Iaab773868c4cab5a54f6ae67bdb22e84642a9e4b Reviewed-on: http://gerrit.rockbox.org/182 Reviewed-by: Nick Peskett <rockbox@peskett.co.uk> Tested-by: Nick Peskett <rockbox@peskett.co.uk>
2011-12-31Fix FS#12499 - Directory playback fails after saving playlistBoris Gjenero
This makes playlist_save() properly restore playlist buffer values, so the buffer can be used afterwards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31481 a1c6a512-1295-4272-9138-f99709370657
2011-12-15Add conditionals for functions only needed on SWCODEC targets.Boris Gjenero
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31296 a1c6a512-1295-4272-9138-f99709370657
2011-11-17Simulate usb plugging on the sim better using sim_tasks.Thomas Martitz
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-10-15Changed the FOR_NB_SCREENS macro to always be a for loop that declares its ↵Björn Stenberg
own loop variable. This removes the need to declare this variable in the outer scope. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30756 a1c6a512-1295-4272-9138-f99709370657
2011-08-30GSoC/Buflib: Enable compaction in buflib.Thomas Martitz
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 Martitz
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-25Fix file descriptor leak on errorThomas Jarosch
Credit goes to "cppcheck". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30349 a1c6a512-1295-4272-9138-f99709370657
2011-08-14GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.Thomas Martitz
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-03Cleanup tree.c cache handling a bit.Thomas Martitz
* 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-21Fix FS#8656 - Error saving non-current playlist fileJonathan Gordon
Use the plugin buffer to save the playlist copy if there isnt enough buffer already allocated to the inram copy of the playlist git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30184 a1c6a512-1295-4272-9138-f99709370657
2011-07-17Revert r30030 "Remove unused code path from playlist_create_ex()."Thomas Martitz
It breaks playlist viewing when playback is stopped (the code path wasn't so unused). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30150 a1c6a512-1295-4272-9138-f99709370657
2011-07-06Fix FS#12181 - Playlist re-shuffle does not work (r30122)Thomas Martitz
Dircache IDs can be 0, so to invalidate -1 must be used. Update the memset calls to reflect this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30125 a1c6a512-1295-4272-9138-f99709370657
2011-06-21Try to handle dircache rebuild event properly. Playlist should nowMiika Pekkarinen
cache new pointers to dircache items when dircache goes offline and comes back onlineagain (during tagcache commit). This should prevent wrong filenames to appear in playlist. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30047 a1c6a512-1295-4272-9138-f99709370657
2011-06-20Dircache: Don't expose struct dircache_entry and pointers into the cache, ↵Thomas Martitz
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-20Dircache: Return the size of the result string in dircache_copy_path() so ↵Thomas Martitz
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-20Remove unused code path from playlist_create_ex().Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30030 a1c6a512-1295-4272-9138-f99709370657
2011-04-27Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis
possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-04-09Playlists forget to set playlist.started when creating new playlist on ↵Michael Sevakis
SWCODEC and which leads to flush-and-rebuffer messages never being sent again until playback is restarted. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29697 a1c6a512-1295-4272-9138-f99709370657
2011-04-07Fix red and yellow. Move resume_index from mp3entry to playlist_info struct. ↵Andree Buschmann
Bump codec api. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29691 a1c6a512-1295-4272-9138-f99709370657
2011-04-07Fix regressions of r29682. Update playlist index resume position when ↵Andree Buschmann
playlist changes (e.g. shuffling, inserting, removing, ...). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29690 a1c6a512-1295-4272-9138-f99709370657
2011-04-06Fix FS#12043. Next track was resumed when pausing and shutting down the ↵Andree Buschmann
player in the last seconds of a track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29682 a1c6a512-1295-4272-9138-f99709370657
2011-02-18Make sure we don't read past the end of a C-string in format_track_path. ↵Thomas Jarosch
Second part of FS #11947 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29326 a1c6a512-1295-4272-9138-f99709370657
2011-02-18Don't underflow the buffer in format_track_path() if it consists of whitespacesThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29325 a1c6a512-1295-4272-9138-f99709370657
2011-02-18Fix off-by-one buffer read access in format_track_path(). Part of #11947Thomas Jarosch
We need to check for "i < max" first. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29324 a1c6a512-1295-4272-9138-f99709370657
2011-02-14All kernel objects in code shared amongs targets (core, plugins, codecs) ↵Michael Sevakis
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
2010-12-06Get rid of get_user_file_path and do the path handling in wrappers for ↵Thomas Martitz
open() and friends. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-11-29FS#11725: fix duplicationg slash indicating root in filename.Teruaki Kawashima
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28705 a1c6a512-1295-4272-9138-f99709370657
2010-09-19playlist_shuffle(): remove unused variableRafaël Carré
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28108 a1c6a512-1295-4272-9138-f99709370657
2010-08-11Fix FS#11175. playlist_peek() wasn't thread safe (due to a static filename ↵Magnus Holmgren
buffer), so frequent calls from the main thread would cause the audio thread to buffer the wrong track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27773 a1c6a512-1295-4272-9138-f99709370657
2010-08-01Rockbox as an application: add get_user_file_path().Thomas Martitz
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox). This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local. On the DAPs it's a no-op, returing /.rockbox directly. Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-05-07Minor const police raid.Steve Bavin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25879 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz
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-06Make open() posix compliant api-wise. A few calls (those with O_CREAT) need ↵Thomas Martitz
the additional optional mode parameter so add it. Impact for the core is almost zero, as open() is a wrapper macro for the real open function which doesn't take the variable parameter. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25844 a1c6a512-1295-4272-9138-f99709370657
2010-02-05Aceppt FS#10945 by Tomasz Kowalczyk - Fix playlists not returning to the ↵Jonathan Gordon
origional order after shuffle/unshuffle git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24525 a1c6a512-1295-4272-9138-f99709370657
2010-01-21fix FS#10288 by Tomasz Kowalczyk. Fixes issues where resuming a "insert ↵Jonathan Gordon
shuffled" playlist doesnt recreate the same playlist that was stopped.. (I'm tipsy still... read the task for more info :p ) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24303 a1c6a512-1295-4272-9138-f99709370657
2009-12-21Fix FS#9660 - make warn on playlist erase work correctly when creating a new ↵Jonathan Gordon
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-06FS#10834 by Alex Bennee, fixing off-by-one bug in code calling format_track_pathNils Wallménius
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23879 a1c6a512-1295-4272-9138-f99709370657
2009-10-28Committing FS#10717 by Tomasz Kowalyczyk: add PLAYLIST_INSERT_LAST_SHUFFLED ↵Dave Hooper
(appends the inserted folder into shuffled order to end of playlist) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23385 a1c6a512-1295-4272-9138-f99709370657
2009-10-20Correct wrong usage of event callbacks all over the place. It's not supposed ↵Thomas Martitz
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-07-14FS#10080Nils Wallménius
* 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-08Fix bug in playlist_move where the track would end up one place too early / ↵Dave Hooper
too late if the move wrapped from one end of the playlist indices to the other end git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21708 a1c6a512-1295-4272-9138-f99709370657
2009-05-31playlist start can only have 1 return value (0), so make it return nothing.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21142 a1c6a512-1295-4272-9138-f99709370657
2009-04-07Revert FS#9531 / r19723 - It did not fix the problem, and it caused the ↵Boris Gjenero
index parameter of shuffle and unshuffle .playlist_control commands to be ignored. When those parameters were non-zero, this caused some tracks from the end of the original playlist to instead appear at the beginning of the resumed playlist. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20641 a1c6a512-1295-4272-9138-f99709370657
2009-03-08Fix insert/queue next, last and replace to update the last insert position too,Thomas Martitz
giving well defined behavior and useful interaction with insert, and making things like insert next followed by many inserts work. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20247 a1c6a512-1295-4272-9138-f99709370657
2009-03-08Fix playlist "Insert" a bit.Thomas Martitz
If insert was used to create a new playlist (e.g. inserting without audio playing), the insert position wasn't updated. Thus, the playlist created was in reversed order (except for the first song). This was the reason "Insert last" was actually used as Insert in this case. BUT, this one doesn't update the insert position eiterh, but the order of the songs is fine, at least (due to appending). Now, insert always updates the insert position properly, so that the aforementioned bugs are fixed. Insert is always used now. Other impact: If you create a playlist using insert, every subsequent insert will append songs at the end of the playlist,if you start playback pressing select on songs, every subsequent insert will insert after the current track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20241 a1c6a512-1295-4272-9138-f99709370657
2009-03-08Clean up some #includesBertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20238 a1c6a512-1295-4272-9138-f99709370657
2009-01-08Commit patch by JdGordon to fix FS#9531 (which applied to all targets) - ↵Marianne Arnold
correctly resume shuffled playlists. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19723 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts
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