From d1322b71595336740eb5e18e5deed056ddb71c7a Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 14 Aug 2011 15:13:00 +0000 Subject: 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 --- apps/plugin.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps/plugin.h') diff --git a/apps/plugin.h b/apps/plugin.h index a53df90d67..e2a5771b5c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -828,12 +828,14 @@ struct plugin_api { #endif /* CONFIG_CODEC == SWCODEC */ bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); bool (*mp3info)(struct mp3entry *entry, const char *filename); - int (*count_mp3_frames)(int fd, int startpos, int filesize, - void (*progressfunc)(int)); + int (*count_mp3_frames)(int fd, int startpos, int filesize, + void (*progressfunc)(int), + unsigned char* buf, size_t buflen); int (*create_xing_header)(int fd, long startpos, long filesize, unsigned char *buf, unsigned long num_frames, unsigned long rec_time, unsigned long header_template, - void (*progressfunc)(int), bool generate_toc); + void (*progressfunc)(int), bool generate_toc, + unsigned char* tempbuf, size_t tempbuf_len); unsigned long (*find_next_frame)(int fd, long *offset, long max_offset, unsigned long reference_header); -- cgit v1.2.3