diff options
Diffstat (limited to 'apps/codecs.c')
-rw-r--r-- | apps/codecs.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index 25ace4969b..0fe848ecd3 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -61,12 +61,14 @@ | |||
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) | 63 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
64 | #if CONFIG_CODEC == SWCODEC | 64 | /* For PLATFORM_HOSTED this buffer must be define here. */ |
65 | unsigned char codecbuf[CODEC_SIZE]; | 65 | static unsigned char codecbuf[CODEC_SIZE]; |
66 | #endif | 66 | #else |
67 | /* For PLATFORM_NATIVE this buffer is defined in *.lds files. */ | ||
68 | extern unsigned char codecbuf[]; | ||
67 | #endif | 69 | #endif |
68 | 70 | ||
69 | size_t codec_size; | 71 | static size_t codec_size; |
70 | 72 | ||
71 | extern void* plugin_get_audio_buffer(size_t *buffer_size); | 73 | extern void* plugin_get_audio_buffer(size_t *buffer_size); |
72 | 74 | ||
@@ -171,6 +173,19 @@ void codec_get_full_path(char *path, const char *codec_root_fn) | |||
171 | CODECS_DIR, codec_root_fn); | 173 | CODECS_DIR, codec_root_fn); |
172 | } | 174 | } |
173 | 175 | ||
176 | /* Returns pointer to and size of free codec RAM. Aligns to CACHEALIGN_SIZE. */ | ||
177 | void *codeclib_get_buffer(size_t *size) | ||
178 | { | ||
179 | void *buf = &codecbuf[codec_size]; | ||
180 | *size = CODEC_SIZE - codec_size; | ||
181 | ALIGN_BUFFER(buf, *size, CACHEALIGN_SIZE); | ||
182 | |||
183 | if (*size <= 0) | ||
184 | return NULL; | ||
185 | |||
186 | return buf; | ||
187 | } | ||
188 | |||
174 | /** codec loading and call interface **/ | 189 | /** codec loading and call interface **/ |
175 | static void *curr_handle = NULL; | 190 | static void *curr_handle = NULL; |
176 | static struct codec_header *c_hdr = NULL; | 191 | static struct codec_header *c_hdr = NULL; |