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
This commit is contained in:
Andree Buschmann 2011-05-08 20:18:35 +00:00
parent b452fa061d
commit d68d02ec11
3 changed files with 23 additions and 21 deletions

View file

@ -208,19 +208,6 @@ void codec_thread_do_callback(void (*fn)(void), unsigned int *id)
/** --- codec API callbacks --- **/
static void * codec_get_buffer(size_t *size)
{
ssize_t s = CODEC_SIZE - codec_size;
void *buf = &codecbuf[codec_size];
ALIGN_BUFFER(buf, s, CACHEALIGN_SIZE);
if (s <= 0)
return NULL;
*size = s;
return buf;
}
static void codec_pcmbuf_insert_callback(
const void *ch1, const void *ch2, int count)
{
@ -420,7 +407,7 @@ void codec_init_codec_api(void)
{
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
CODEC_IDX_AUDIO);
ci.codec_get_buffer = codec_get_buffer;
ci.codec_get_buffer = codeclib_get_buffer;
ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
ci.set_elapsed = audio_codec_update_elapsed;
ci.read_filebuf = codec_filebuf_callback;

View file

@ -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;

View file

@ -235,9 +235,6 @@ struct codec_header {
struct codec_api **api;
};
extern unsigned char codecbuf[];
extern size_t codec_size;
#ifdef CODEC
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* plugin_* is correct, codecs use the plugin linker script */
@ -277,6 +274,9 @@ extern unsigned char plugin_end_addr[];
assumes buffer size is MAX_PATH */
void codec_get_full_path(char *path, const char *codec_root_fn);
/* Returns pointer to and size of free codec RAM */
void *codeclib_get_buffer(size_t *size);
/* defined by the codec loader (codec.c) */
int codec_load_buf(int hid, struct codec_api *api);
int codec_load_file(const char* codec, struct codec_api *api);