diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-08 20:18:35 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-08 20:18:35 +0000 |
commit | d68d02ec115d464e40ee70fa117d0a43158c9376 (patch) | |
tree | 19c017902a18ce71f63801ab2e040e8cfae4ca78 | |
parent | b452fa061d2f4e88466f9dbadc8f52425dcd2d19 (diff) | |
download | rockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.tar.gz rockbox-d68d02ec115d464e40ee70fa117d0a43158c9376.zip |
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
-rw-r--r-- | apps/codec_thread.c | 15 | ||||
-rw-r--r-- | apps/codecs.c | 23 | ||||
-rw-r--r-- | apps/codecs.h | 6 |
3 files changed, 23 insertions, 21 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c index 7cf45c3490..4801c4aa35 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c | |||
@@ -208,19 +208,6 @@ void codec_thread_do_callback(void (*fn)(void), unsigned int *id) | |||
208 | 208 | ||
209 | /** --- codec API callbacks --- **/ | 209 | /** --- codec API callbacks --- **/ |
210 | 210 | ||
211 | static void * codec_get_buffer(size_t *size) | ||
212 | { | ||
213 | ssize_t s = CODEC_SIZE - codec_size; | ||
214 | void *buf = &codecbuf[codec_size]; | ||
215 | ALIGN_BUFFER(buf, s, CACHEALIGN_SIZE); | ||
216 | |||
217 | if (s <= 0) | ||
218 | return NULL; | ||
219 | |||
220 | *size = s; | ||
221 | return buf; | ||
222 | } | ||
223 | |||
224 | static void codec_pcmbuf_insert_callback( | 211 | static void codec_pcmbuf_insert_callback( |
225 | const void *ch1, const void *ch2, int count) | 212 | const void *ch1, const void *ch2, int count) |
226 | { | 213 | { |
@@ -420,7 +407,7 @@ void codec_init_codec_api(void) | |||
420 | { | 407 | { |
421 | ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, | 408 | ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, |
422 | CODEC_IDX_AUDIO); | 409 | CODEC_IDX_AUDIO); |
423 | ci.codec_get_buffer = codec_get_buffer; | 410 | ci.codec_get_buffer = codeclib_get_buffer; |
424 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; | 411 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; |
425 | ci.set_elapsed = audio_codec_update_elapsed; | 412 | ci.set_elapsed = audio_codec_update_elapsed; |
426 | ci.read_filebuf = codec_filebuf_callback; | 413 | ci.read_filebuf = codec_filebuf_callback; |
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; |
diff --git a/apps/codecs.h b/apps/codecs.h index 5c50116038..07b8cd5d4f 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -235,9 +235,6 @@ struct codec_header { | |||
235 | struct codec_api **api; | 235 | struct codec_api **api; |
236 | }; | 236 | }; |
237 | 237 | ||
238 | extern unsigned char codecbuf[]; | ||
239 | extern size_t codec_size; | ||
240 | |||
241 | #ifdef CODEC | 238 | #ifdef CODEC |
242 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 239 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
243 | /* plugin_* is correct, codecs use the plugin linker script */ | 240 | /* plugin_* is correct, codecs use the plugin linker script */ |
@@ -277,6 +274,9 @@ extern unsigned char plugin_end_addr[]; | |||
277 | assumes buffer size is MAX_PATH */ | 274 | assumes buffer size is MAX_PATH */ |
278 | void codec_get_full_path(char *path, const char *codec_root_fn); | 275 | void codec_get_full_path(char *path, const char *codec_root_fn); |
279 | 276 | ||
277 | /* Returns pointer to and size of free codec RAM */ | ||
278 | void *codeclib_get_buffer(size_t *size); | ||
279 | |||
280 | /* defined by the codec loader (codec.c) */ | 280 | /* defined by the codec loader (codec.c) */ |
281 | int codec_load_buf(int hid, struct codec_api *api); | 281 | int codec_load_buf(int hid, struct codec_api *api); |
282 | int codec_load_file(const char* codec, struct codec_api *api); | 282 | int codec_load_file(const char* codec, struct codec_api *api); |