Replace all direct accesses to audiobuf with buffer API functions.
commitd5a59301968cf98d739f6dbb167832a8ec2fb943
authorThomas Martitz <kugel@rockbox.org>
Mon, 1 Aug 2011 14:59:49 +0000 (1 16:59 +0200)
committerThomas Martitz <kugel@rockbox.org>
Mon, 8 Aug 2011 16:42:06 +0000 (8 18:42 +0200)
treebee1f47096044c8cdda61783e1733d7c364304fa
parent80a6f548e59e1e0482a411c54486a22c49c510fa
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.

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 mp3dat and talk mess with the buffer.
mpeg.c now implements some buffer related functions of playback.h, that no

audiobuf and audiobufend are local to buffer.c now.
24 files changed:
apps/filetree.c
apps/main.c
apps/menus/main_menu.c
apps/misc.c
apps/mp3data.c
apps/mp3data.h
apps/mpeg.c
apps/playback.c
apps/playback.h
apps/playlist.c
apps/playlist_viewer.c
apps/plugin.c
apps/plugin.h
apps/plugins/vbrfix.c
apps/recorder/pcm_record.c
apps/tagcache.c
apps/talk.c
apps/talk.h
firmware/buffer.c
firmware/common/dircache.c
firmware/export/audio.h
firmware/include/buffer.h
firmware/include/dircache.h
firmware/rolo.c