diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-01-18 00:05:14 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-01-18 00:05:14 +0000 |
commit | b8749fdf219ffcfc17b7781217f388953268af49 (patch) | |
tree | 7369b5cb4f94f0c6589eb8bbf1bf63537c898b62 /uisimulator | |
parent | 507ff53c9c429de6c3bf5bfd6eb1a129cfc12cad (diff) | |
download | rockbox-b8749fdf219ffcfc17b7781217f388953268af49.tar.gz rockbox-b8749fdf219ffcfc17b7781217f388953268af49.zip |
New codec loader, using the same mechanism as the new plugin loader. API version numbering restarted for the new system. Uses the target ID from configure, so don't change that too often. * Fixed sim_plugin_load_ram() to truncate the tempfile. * Reduced plugin buffer size to 512KB for iriver and iPod.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8362 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/io.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 1871b29395..68eb8933a5 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -306,20 +306,20 @@ int sim_fsync(int fd) | |||
306 | void *sim_codec_load_ram(char* codecptr, int size, | 306 | void *sim_codec_load_ram(char* codecptr, int size, |
307 | void* ptr2, int bufwrap, int *pd_fd) | 307 | void* ptr2, int bufwrap, int *pd_fd) |
308 | { | 308 | { |
309 | void *pd; | 309 | void *pd, *hdr; |
310 | char *path = "archos/_temp_codec.dll"; | 310 | const char *path = "archos/_temp_codec.dll"; |
311 | int (*codec_start)(void * api); | ||
312 | int fd; | 311 | int fd; |
313 | int copy_n; | 312 | int copy_n; |
314 | #ifdef WIN32 | 313 | #ifdef WIN32 |
315 | char buf[256]; | 314 | char buf[256]; |
316 | #endif | 315 | #endif |
317 | 316 | ||
317 | *pd_fd = 0; | ||
318 | |||
318 | /* We have to create the dynamic link library file from ram | 319 | /* We have to create the dynamic link library file from ram |
319 | * so we could simulate the codec loading. | 320 | so we could simulate the codec loading. */ |
320 | */ | 321 | |
321 | *pd_fd = -1; | 322 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); |
322 | fd = open(path, O_WRONLY | O_CREAT, S_IRWXU); | ||
323 | if (fd < 0) { | 323 | if (fd < 0) { |
324 | DEBUGF("failed to open for write: %s\n", path); | 324 | DEBUGF("failed to open for write: %s\n", path); |
325 | return NULL; | 325 | return NULL; |
@@ -341,7 +341,7 @@ void *sim_codec_load_ram(char* codecptr, int size, | |||
341 | } | 341 | } |
342 | } | 342 | } |
343 | close(fd); | 343 | close(fd); |
344 | 344 | ||
345 | /* Now load the library. */ | 345 | /* Now load the library. */ |
346 | pd = dlopen(path, RTLD_NOW); | 346 | pd = dlopen(path, RTLD_NOW); |
347 | if (!pd) { | 347 | if (!pd) { |
@@ -357,17 +357,12 @@ void *sim_codec_load_ram(char* codecptr, int size, | |||
357 | return NULL; | 357 | return NULL; |
358 | } | 358 | } |
359 | 359 | ||
360 | codec_start = dlsym(pd, "codec_start"); | 360 | hdr = dlsym(pd, "__header"); |
361 | if (!codec_start) { | 361 | if (!hdr) |
362 | codec_start = dlsym(pd, "_codec_start"); | 362 | hdr = dlsym(pd, "___header"); |
363 | if (!codec_start) { | ||
364 | dlclose(pd); | ||
365 | return NULL; | ||
366 | } | ||
367 | } | ||
368 | 363 | ||
369 | *pd_fd = (int)pd; | 364 | *pd_fd = (int)pd; |
370 | return codec_start; | 365 | return hdr; /* maybe NULL if symbol not present */ |
371 | } | 366 | } |
372 | 367 | ||
373 | void sim_codec_close(int pd) | 368 | void sim_codec_close(int pd) |