summaryrefslogtreecommitdiff
path: root/apps/codecs/lib/codeclib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/lib/codeclib.c')
-rw-r--r--apps/codecs/lib/codeclib.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/apps/codecs/lib/codeclib.c b/apps/codecs/lib/codeclib.c
index 4aa7d29e86..f6b2131e88 100644
--- a/apps/codecs/lib/codeclib.c
+++ b/apps/codecs/lib/codeclib.c
@@ -24,29 +24,26 @@
24#include "codeclib.h" 24#include "codeclib.h"
25#include "id3.h" 25#include "id3.h"
26 26
27struct codec_api *local_rb;
28
29long mem_ptr; 27long mem_ptr;
30long bufsize; 28long bufsize;
31unsigned char* mp3buf; // The actual MP3 buffer from Rockbox 29unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
32unsigned char* mallocbuf; // 512K from the start of MP3 buffer 30unsigned char* mallocbuf; // 512K from the start of MP3 buffer
33unsigned char* filebuf; // The rest of the MP3 buffer 31unsigned char* filebuf; // The rest of the MP3 buffer
34 32
35int codec_init(struct codec_api* rb) 33int codec_init(void)
36{ 34{
37 local_rb = rb;
38 mem_ptr = 0; 35 mem_ptr = 0;
39 mallocbuf = (unsigned char *)rb->get_codec_memory((size_t *)&bufsize); 36 mallocbuf = (unsigned char *)ci->get_codec_memory((size_t *)&bufsize);
40 37
41 return 0; 38 return 0;
42} 39}
43 40
44void codec_set_replaygain(struct mp3entry* id3) 41void codec_set_replaygain(struct mp3entry* id3)
45{ 42{
46 local_rb->configure(DSP_SET_TRACK_GAIN, (long *) id3->track_gain); 43 ci->configure(DSP_SET_TRACK_GAIN, (long *) id3->track_gain);
47 local_rb->configure(DSP_SET_ALBUM_GAIN, (long *) id3->album_gain); 44 ci->configure(DSP_SET_ALBUM_GAIN, (long *) id3->album_gain);
48 local_rb->configure(DSP_SET_TRACK_PEAK, (long *) id3->track_peak); 45 ci->configure(DSP_SET_TRACK_PEAK, (long *) id3->track_peak);
49 local_rb->configure(DSP_SET_ALBUM_PEAK, (long *) id3->album_peak); 46 ci->configure(DSP_SET_ALBUM_PEAK, (long *) id3->album_peak);
50} 47}
51 48
52/* Various "helper functions" common to all the xxx2wav decoder plugins */ 49/* Various "helper functions" common to all the xxx2wav decoder plugins */
@@ -71,7 +68,7 @@ void* codec_calloc(size_t nmemb, size_t size)
71 x = codec_malloc(nmemb*size); 68 x = codec_malloc(nmemb*size);
72 if (x == NULL) 69 if (x == NULL)
73 return NULL; 70 return NULL;
74 local_rb->memset(x,0,nmemb*size); 71 ci->memset(x,0,nmemb*size);
75 return(x); 72 return(x);
76} 73}
77 74
@@ -89,71 +86,71 @@ void* codec_realloc(void* ptr, size_t size)
89 86
90size_t strlen(const char *s) 87size_t strlen(const char *s)
91{ 88{
92 return(local_rb->strlen(s)); 89 return(ci->strlen(s));
93} 90}
94 91
95char *strcpy(char *dest, const char *src) 92char *strcpy(char *dest, const char *src)
96{ 93{
97 return(local_rb->strcpy(dest,src)); 94 return(ci->strcpy(dest,src));
98} 95}
99 96
100char *strcat(char *dest, const char *src) 97char *strcat(char *dest, const char *src)
101{ 98{
102 return(local_rb->strcat(dest,src)); 99 return(ci->strcat(dest,src));
103} 100}
104 101
105int strcmp(const char *s1, const char *s2) 102int strcmp(const char *s1, const char *s2)
106{ 103{
107 return(local_rb->strcmp(s1,s2)); 104 return(ci->strcmp(s1,s2));
108} 105}
109 106
110int strncasecmp(const char *s1, const char *s2, size_t n) 107int strncasecmp(const char *s1, const char *s2, size_t n)
111{ 108{
112 return(local_rb->strncasecmp(s1,s2,n)); 109 return(ci->strncasecmp(s1,s2,n));
113} 110}
114 111
115void *memcpy(void *dest, const void *src, size_t n) 112void *memcpy(void *dest, const void *src, size_t n)
116{ 113{
117 return(local_rb->memcpy(dest,src,n)); 114 return(ci->memcpy(dest,src,n));
118} 115}
119 116
120void *memset(void *s, int c, size_t n) 117void *memset(void *s, int c, size_t n)
121{ 118{
122 return(local_rb->memset(s,c,n)); 119 return(ci->memset(s,c,n));
123} 120}
124 121
125int memcmp(const void *s1, const void *s2, size_t n) 122int memcmp(const void *s1, const void *s2, size_t n)
126{ 123{
127 return(local_rb->memcmp(s1,s2,n)); 124 return(ci->memcmp(s1,s2,n));
128} 125}
129 126
130void* memchr(const void *s, int c, size_t n) 127void* memchr(const void *s, int c, size_t n)
131{ 128{
132 return(local_rb->memchr(s,c,n)); 129 return(ci->memchr(s,c,n));
133} 130}
134 131
135void *memmove(void *dest, const void *src, size_t n) 132void *memmove(void *dest, const void *src, size_t n)
136{ 133{
137 return(local_rb->memmove(dest,src,n)); 134 return(ci->memmove(dest,src,n));
138} 135}
139 136
140void qsort(void *base, size_t nmemb, size_t size, 137void qsort(void *base, size_t nmemb, size_t size,
141 int(*compar)(const void *, const void *)) 138 int(*compar)(const void *, const void *))
142{ 139{
143 local_rb->qsort(base,nmemb,size,compar); 140 ci->qsort(base,nmemb,size,compar);
144} 141}
145 142
146#ifdef RB_PROFILE 143#ifdef RB_PROFILE
147void __cyg_profile_func_enter(void *this_fn, void *call_site) { 144void __cyg_profile_func_enter(void *this_fn, void *call_site) {
148#ifdef CPU_COLDFIRE 145#ifdef CPU_COLDFIRE
149 (void)call_site; 146 (void)call_site;
150 local_rb->profile_func_enter(this_fn, __builtin_return_address(1)); 147 ci->profile_func_enter(this_fn, __builtin_return_address(1));
151#else 148#else
152 local_rb->profile_func_enter(this_fn, call_site); 149 ci->profile_func_enter(this_fn, call_site);
153#endif 150#endif
154} 151}
155 152
156void __cyg_profile_func_exit(void *this_fn, void *call_site) { 153void __cyg_profile_func_exit(void *this_fn, void *call_site) {
157 local_rb->profile_func_exit(this_fn,call_site); 154 ci->profile_func_exit(this_fn,call_site);
158} 155}
159#endif 156#endif