summaryrefslogtreecommitdiff
path: root/firmware/export/audio.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-14 15:13:00 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-14 15:13:00 +0000
commitd1322b71595336740eb5e18e5deed056ddb71c7a (patch)
tree812db6a9c2e9d78405ec0ed38465fd88dc5be748 /firmware/export/audio.h
parent9b9bd73dfb212d4192fccc5fc5e269fc6499139c (diff)
downloadrockbox-d1322b71595336740eb5e18e5deed056ddb71c7a.tar.gz
rockbox-d1322b71595336740eb5e18e5deed056ddb71c7a.zip
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
Diffstat (limited to 'firmware/export/audio.h')
-rw-r--r--firmware/export/audio.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 910791c7fd..6757bf143b 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -51,6 +51,8 @@
51void audio_init(void) INIT_ATTR; 51void audio_init(void) INIT_ATTR;
52void audio_play(long offset); 52void audio_play(long offset);
53void audio_stop(void); 53void audio_stop(void);
54/* Stops audio from serving playback and frees resources*/
55void audio_hard_stop(void);
54void audio_pause(void); 56void audio_pause(void);
55void audio_resume(void); 57void audio_resume(void);
56void audio_next(void); 58void audio_next(void);
@@ -68,11 +70,11 @@ void audio_error_clear(void);
68int audio_get_file_pos(void); 70int audio_get_file_pos(void);
69void audio_beep(int duration); 71void audio_beep(int duration);
70 72
71#if CONFIG_CODEC == SWCODEC
72/* Required call when audio buffer is required for some other purpose */ 73/* Required call when audio buffer is required for some other purpose */
74/* implemented in apps but called from firmware(!) */
73unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size); 75unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size);
74/* only implemented in playback.c, but called from firmware */
75 76
77#if CONFIG_CODEC == SWCODEC
76void audio_next_dir(void); 78void audio_next_dir(void);
77void audio_prev_dir(void); 79void audio_prev_dir(void);
78 80