summaryrefslogtreecommitdiff
path: root/apps/codecs.c
diff options
context:
space:
mode:
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;