summaryrefslogtreecommitdiff
path: root/apps/codecs.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-10-19 12:35:53 +0000
committerNils Wallménius <nils@rockbox.org>2008-10-19 12:35:53 +0000
commit2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f (patch)
tree880a25472bfa6ce2fcda13a334c17607aa1ad419 /apps/codecs.c
parent01177055425776fadbdd6cf167111105b118754a (diff)
downloadrockbox-2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f.zip
rockbox-2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f.tar.gz
rockbox-2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f.tar.bz2
rockbox-2f50cd58b9fb7cd75448622b5ac222cdcad6bc6f.tar.xz
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
Diffstat (limited to 'apps/codecs.c')
-rw-r--r--apps/codecs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 417b546..8e9e55a 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) {