diff options
Diffstat (limited to 'apps/codecs.c')
-rw-r--r-- | apps/codecs.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index 400e7fbfcf..dd87ddf0ed 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -56,8 +56,9 @@ | |||
56 | #if CONFIG_HWCODEC == MASNONE | 56 | #if CONFIG_HWCODEC == MASNONE |
57 | static unsigned char codecbuf[CODEC_SIZE]; | 57 | static unsigned char codecbuf[CODEC_SIZE]; |
58 | #endif | 58 | #endif |
59 | void *sim_codec_load(char *plugin, int *fd); | 59 | void *sim_codec_load_ram(char* codecptr, int size, |
60 | void sim_codec_close(int fd); | 60 | void* ptr2, int bufwrap, int *pd); |
61 | void sim_codec_close(int pd); | ||
61 | #else | 62 | #else |
62 | #define sim_codec_close(x) | 63 | #define sim_codec_close(x) |
63 | extern unsigned char codecbuf[]; | 64 | extern unsigned char codecbuf[]; |
@@ -245,11 +246,12 @@ struct codec_api ci = { | |||
245 | memchr, | 246 | memchr, |
246 | }; | 247 | }; |
247 | 248 | ||
248 | int codec_load_ram(char* codecptr, size_t size, void* ptr2, size_t bufwrap) | 249 | int codec_load_ram(char* codecptr, int size, void* ptr2, int bufwrap) |
249 | { | 250 | { |
250 | enum codec_status (*codec_start)(const struct codec_api* api); | 251 | enum codec_status (*codec_start)(const struct codec_api* api); |
251 | int copy_n; | ||
252 | int status; | 252 | int status; |
253 | #ifndef SIMULATOR | ||
254 | int copy_n; | ||
253 | 255 | ||
254 | if ((char *)&codecbuf[0] != codecptr) { | 256 | if ((char *)&codecbuf[0] != codecptr) { |
255 | /* zero out codec buffer to ensure a properly zeroed bss area */ | 257 | /* zero out codec buffer to ensure a properly zeroed bss area */ |
@@ -265,8 +267,19 @@ int codec_load_ram(char* codecptr, size_t size, void* ptr2, size_t bufwrap) | |||
265 | } | 267 | } |
266 | codec_start = (void*)&codecbuf; | 268 | codec_start = (void*)&codecbuf; |
267 | 269 | ||
270 | #else /* SIMULATOR */ | ||
271 | int pd; | ||
272 | |||
273 | codec_start = sim_codec_load_ram(codecptr, size, ptr2, bufwrap, &pd); | ||
274 | if (pd < 0) | ||
275 | return CODEC_ERROR; | ||
276 | #endif /* SIMULATOR */ | ||
277 | |||
268 | invalidate_icache(); | 278 | invalidate_icache(); |
269 | status = codec_start(&ci); | 279 | status = codec_start(&ci); |
280 | #ifdef SIMULATOR | ||
281 | sim_codec_close(pd); | ||
282 | #endif | ||
270 | 283 | ||
271 | return status; | 284 | return status; |
272 | } | 285 | } |
@@ -294,7 +307,7 @@ int codec_load_file(const char *plugin) | |||
294 | logf("Codec read error"); | 307 | logf("Codec read error"); |
295 | return CODEC_ERROR; | 308 | return CODEC_ERROR; |
296 | } | 309 | } |
297 | 310 | ||
298 | return codec_load_ram(codecbuf, (size_t)rc, NULL, 0); | 311 | return codec_load_ram(codecbuf, (size_t)rc, NULL, 0); |
299 | } | 312 | } |
300 | 313 | ||