From 2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sun, 19 Oct 2008 12:35:53 +0000 Subject: Codec memory reorganization Based on a patch by Tomasz Malesinski * Merge Codec buffer and Malloc buffer into one large buffer. * The new merged buffer is now 1MB on targets with lots of memory. * Renamed codec_get_memory to codec_get_buffer and made it behave more. like plugin_get_buffer. * Bumped Codec api and min api versions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18834 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apps/codecs.c') diff --git a/apps/codecs.c b/apps/codecs.c index 417b546391..8e9e55a5d4 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -66,6 +66,8 @@ void sim_codec_close(void *pd); extern unsigned char codecbuf[]; #endif +size_t codec_size; + extern void* plugin_get_audio_buffer(size_t *buffer_size); struct codec_api ci = { @@ -78,7 +80,7 @@ struct codec_api ci = { 0, /* new_track */ 0, /* seek_time */ NULL, /* struct dsp_config *dsp */ - NULL, /* get_codec_memory */ + NULL, /* codec_get_buffer */ NULL, /* pcmbuf_insert */ NULL, /* set_elapsed */ NULL, /* read_filebuf */ @@ -193,6 +195,9 @@ static int codec_load_ram(int size, struct codec_api *api) logf("codec header error"); return CODEC_ERROR; } + + codec_size = hdr->end_addr - codecbuf; + #else /* SIMULATOR */ void *pd; @@ -211,6 +216,9 @@ static int codec_load_ram(int size, struct codec_api *api) sim_codec_close(pd); return CODEC_ERROR; } + + codec_size = codecbuf - codecbuf; + #endif /* SIMULATOR */ if (hdr->api_version > CODEC_API_VERSION || hdr->api_version < CODEC_MIN_API_VERSION) { @@ -226,7 +234,8 @@ static int codec_load_ram(int size, struct codec_api *api) return status; } -int codec_load_buf(unsigned int hid, struct codec_api *api) { +int codec_load_buf(unsigned int hid, struct codec_api *api) +{ int rc; rc = bufread(hid, CODEC_SIZE, codecbuf); if (rc < 0) { -- cgit v1.2.3