summaryrefslogtreecommitdiff
path: root/apps/codecs.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-08 20:18:35 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-08 20:18:35 +0000
commitd68d02ec115d464e40ee70fa117d0a43158c9376 (patch)
tree19c017902a18ce71f63801ab2e040e8cfae4ca78 /apps/codecs.c
parentb452fa061d2f4e88466f9dbadc8f52425dcd2d19 (diff)
downloadrockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.zip
rockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.tar.gz
rockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.tar.bz2
rockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.tar.xz
Move implementation of codec_get_buffer() to codec.c, make related variables static.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29839 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs.c')
-rw-r--r--apps/codecs.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 25ace49..0fe848e 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -61,12 +61,14 @@
#endif
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
-#if CONFIG_CODEC == SWCODEC
-unsigned char codecbuf[CODEC_SIZE];
-#endif
+/* For PLATFORM_HOSTED this buffer must be define here. */
+static unsigned char codecbuf[CODEC_SIZE];
+#else
+/* For PLATFORM_NATIVE this buffer is defined in *.lds files. */
+extern unsigned char codecbuf[];
#endif
-size_t codec_size;
+static size_t codec_size;
extern void* plugin_get_audio_buffer(size_t *buffer_size);
@@ -171,6 +173,19 @@ void codec_get_full_path(char *path, const char *codec_root_fn)
CODECS_DIR, codec_root_fn);
}
+/* Returns pointer to and size of free codec RAM. Aligns to CACHEALIGN_SIZE. */
+void *codeclib_get_buffer(size_t *size)
+{
+ void *buf = &codecbuf[codec_size];
+ *size = CODEC_SIZE - codec_size;
+ ALIGN_BUFFER(buf, *size, CACHEALIGN_SIZE);
+
+ if (*size <= 0)
+ return NULL;
+
+ return buf;
+}
+
/** codec loading and call interface **/
static void *curr_handle = NULL;
static struct codec_header *c_hdr = NULL;