summaryrefslogtreecommitdiff
path: root/apps/mpeg.c
AgeCommit message (Collapse)Author
2011-11-17Buflib: Make shrinking and buflib_available() smarter.Thomas Martitz
* shrinking now considers freespace just before the alloc-to-be-shrinked, that means less (or sometimes none at all) is taken from the audio buffer. * core_available() now searches for the best free space, instead of simply the end, i.e. it will not return 0 if the audio buffer is allocated and there's free space before it. It also runs a compaction to ensure maximum contiguous memory. audio_buffer_available() is also enhanced. It now considers the 256K reserve buffer, and returns free buflib space instead if the audio buffer is short. This all fixes the root problem of FS#12344 (Sansa Clip+: PANIC occurred when dircache is enabled), that alloced from the audio buffer, even if it was very short and buflib had many more available as free space before it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31006 a1c6a512-1295-4272-9138-f99709370657
2011-11-06Fix warning and typos.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30912 a1c6a512-1295-4272-9138-f99709370657
2011-11-06hwcodec: fix shrink_callback resuming playback wrongly, and add checksThomas Martitz
if the voice is bigger than the audiobuffer. NOTE: This is the case on the sim so voice doesn't appear to work currently on hwcodec. Someone needs to verify on a real target. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30910 a1c6a512-1295-4272-9138-f99709370657
2011-10-09Another fix for audio_get_buffer() on hwcodec by Thomas Martitz.Jens Arnold
Some functions must only be called when audio is already initialized, due to talk <-> audio interdependency, same as on swcodec. This makes hwcodec boot and play music again. Voice menus also working again, talk clips not yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30738 a1c6a512-1295-4272-9138-f99709370657
2011-10-09Fix audio_get_buffer() implementation on hwcodec, to be similar to the ↵Thomas Martitz
swcodec one. Should make hwcodec bood again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30737 a1c6a512-1295-4272-9138-f99709370657
2011-08-30Fix h100 red and other warnings.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30384 a1c6a512-1295-4272-9138-f99709370657
2011-08-30Fix hwcodec red.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30383 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-14Fix remaining problems.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30311 a1c6a512-1295-4272-9138-f99709370657
2011-08-14Fix errors and warnings.Thomas Martitz
The buffer_offset paramter of audio_init_recording() is removed as it was unused in both implementations. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30310 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-05-23Remove next reported 'set but unused' warnings.Andree Buschmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29920 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-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
2011-02-02Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM ↵Andree Buschmann
(code), use the already defined MEMORYSIZE instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
2010-10-31Separate mas35xx lowlevel stuff. Move SH specific bits to target tree. ↵Marcin Bukat
FS#11189 by me. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28425 a1c6a512-1295-4272-9138-f99709370657
2010-08-22Fix HWCODEC playback broken in r27773. mpeg.c declared playlist functions on ↵Jens Arnold
its own instead of including playlist.h due to its history, and now they got out of sync... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27860 a1c6a512-1295-4272-9138-f99709370657
2010-06-06Change cuesheet handling so the id3 info is not spoofed anymore. If ↵Jonathan Gordon
something wants the subtracks info it is easy to get to. This makes next track display in the skins show the next subtrack if we are in a cuesheet git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26611 a1c6a512-1295-4272-9138-f99709370657
2010-05-07Fix yellow.Steve Bavin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25880 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-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-07Remove more tabsAndree Buschmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24550 a1c6a512-1295-4272-9138-f99709370657
2010-01-09Make a few global variables static instead of global where possibleBertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24206 a1c6a512-1295-4272-9138-f99709370657
2009-11-16mpeg.h/c cleanupJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23652 a1c6a512-1295-4272-9138-f99709370657
2009-11-16Cleanup audio.h, related functionsJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
2009-10-31Fix yellow, definesJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23446 a1c6a512-1295-4272-9138-f99709370657
2009-10-31FS#10739: playback.c code splitJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657
2009-07-20fix FS#10453 - the cuesheet changes broke playback on swcodec, rework it so ↵Jonathan Gordon
it uses the audio buffer instead of a temp buffer from the start (which also removes one pretty big memcpy) also remove the audio_filename from the cuesheet struct as its useless git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21982 a1c6a512-1295-4272-9138-f99709370657
2009-07-20woops, remove that sim code which I forgot to remove from the older versions ↵Jonathan Gordon
of the patch... ordinarily I would have just said fix red, but that would have been boring, and because rasher asked so nicley that we stop it, I thought I'd do him the curtosy... this is also part of my on going goal to increase global warming using the Rockbox botnet^H^H^H^H^H^Hbuild system... also, maybe its bed time? git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21979 a1c6a512-1295-4272-9138-f99709370657
2009-07-20rework cuesheet support:Jonathan Gordon
swcodec: search for a .cue during buffering (with the possibility of adding embedded cuesheets later) hwcodec: search for a .cue when the id3 info for the current track is requested for the first time (disk should be spining so non issue) major beenfit from this is simplofy cuesheet handling code a bit... if mp3entry.cuesheet != NULL then there is a valid cuesheet.. no need to worry about if its enabled and preloaded. There is the possibility of putting the next/prev subtrack handling inside the playback code (as well as the id3 updating stuff (see FS#9789 for more info), but thats probably not a good idea. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21978 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-05-21Simplify some redundant boolean expressionsBertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21013 a1c6a512-1295-4272-9138-f99709370657
2009-05-09Remove unused function audio_has_changed_track from apps/mpeg.cBertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20893 a1c6a512-1295-4272-9138-f99709370657
2009-04-06FS9795 - some playback cleanup. Jonathan Gordon
* Use events to notify things when the track has changed instead of the nasty has_track_changed() * Event for when the mp3entry for the next track is avilable (which allows alot more tags to be static which means less redrawing in the WPS) * virtually guarentee that the mp3entry sturct returned by audio_current/next_track() is going to be valid for the duration of the current track. The only time it wont be now is during the time between the codec finishing the previous track and the next track actually starting (~2s), but this is not an issue as long as it is called again when the TRACK_CHANGED event happens (or just use the pointer that gives) It is still possible to confuse the WPS with the next tracks id3 info being displayed but this should fix itself up faster than it used to (and be harder to do) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20633 a1c6a512-1295-4272-9138-f99709370657
2009-03-04Cosmetic fix: remove duplicate semicolonsBertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20198 a1c6a512-1295-4272-9138-f99709370657
2009-03-02Fix some memset calls that use the wrong order for arguments.Tom Ross
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20165 a1c6a512-1295-4272-9138-f99709370657
2009-02-16Don't send a trackchange event at end of playlist. Fixes 'Follow Playlist' ↵Jens Arnold
on hwcodec at end-of-playlist, including the related null pointer access. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20014 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
2008-10-31cleanup storage definesFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18950 a1c6a512-1295-4272-9138-f99709370657
2008-10-16Accept FS#9480 - centralise and organise the events in the apps/ layer. Jonathan Gordon
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18819 a1c6a512-1295-4272-9138-f99709370657
2008-10-15Split id3.c/h into metadata.c/h and metadata/mp3.c. Updated all references. ↵Björn Stenberg
Moved mp3data.c/h from firmware to apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18814 a1c6a512-1295-4272-9138-f99709370657
2008-10-14Moved pcm_record from firmware to apps. Cleaned up some. Now all code using ↵Björn Stenberg
struct mp3entry is in apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18807 a1c6a512-1295-4272-9138-f99709370657
2008-10-10Moved id3.c, mpeg.c and replaygain.c from firmware/ to apps/. This is the ↵Björn Stenberg
first step in separating the generic metadata code and the id3-specific code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18760 a1c6a512-1295-4272-9138-f99709370657