Disable buffering codecs (and code generally) on RaaA.

It's not useful to do it since you need to write back the code to disk to be able to load it from memory, it also requires writing to an executable directory.
Keep it for the simulator for the sake of simulating.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29261 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-02-09 20:27:23 +00:00
parent 82eec87dd6
commit 86cab2e27a
4 changed files with 28 additions and 14 deletions

View file

@ -1012,7 +1012,11 @@ int bufopen(const char *file, size_t offset, enum data_type type,
return h->id; return h->id;
} }
#ifdef APPLICATION
/* loading code from memory is not supported in application builds */
else if (type == TYPE_CODEC)
return ERR_UNSUPPORTED_TYPE;
#endif
/* Other cases: there is a little more work. */ /* Other cases: there is a little more work. */
int fd = open(file, O_RDONLY); int fd = open(file, O_RDONLY);
if (fd < 0) if (fd < 0)

View file

@ -44,6 +44,7 @@ enum data_type {
#define ERR_INVALID_VALUE -3 #define ERR_INVALID_VALUE -3
#define ERR_FILE_ERROR -4 #define ERR_FILE_ERROR -4
#define ERR_HANDLE_NOT_DONE -5 #define ERR_HANDLE_NOT_DONE -5
#define ERR_UNSUPPORTED_TYPE -6
/* Initialise the buffering subsystem */ /* Initialise the buffering subsystem */

View file

@ -1066,7 +1066,7 @@ static bool audio_release_tracks(void)
static bool audio_loadcodec(bool start_play) static bool audio_loadcodec(bool start_play)
{ {
int prev_track; int prev_track, hid;
char codec_path[MAX_PATH]; /* Full path to codec */ char codec_path[MAX_PATH]; /* Full path to codec */
const struct mp3entry *id3, *prev_id3; const struct mp3entry *id3, *prev_id3;
@ -1121,11 +1121,18 @@ static bool audio_loadcodec(bool start_play)
codec_get_full_path(codec_path, codec_fn); codec_get_full_path(codec_path, codec_fn);
tracks[track_widx].codec_hid = bufopen(codec_path, 0, TYPE_CODEC, NULL); hid = tracks[track_widx].codec_hid = bufopen(codec_path, 0, TYPE_CODEC, NULL);
if (tracks[track_widx].codec_hid < 0)
/* not an error if codec load it supported, will load it from disk
* application builds don't support it
*/
if (hid < 0 && hid != ERR_UNSUPPORTED_TYPE)
return false; return false;
logf("Loaded codec"); if (hid > 0)
logf("Loaded codec");
else
logf("Buffering codec unsupported, load later from disk");
return true; return true;
} }

View file

@ -134,6 +134,16 @@ void * _lc_open(const _lc_open_char *filename, unsigned char *buf, size_t buf_si
void *lc_open_from_mem(void *addr, size_t blob_size) void *lc_open_from_mem(void *addr, size_t blob_size)
{ {
#ifndef SIMULATOR
(void)addr;
(void)blob_size;
/* we don't support loading code from memory on application builds,
* it doesn't make sense (since it means writing the blob to disk again and
* then falling back to load from disk) and requires the ability to write
* to an executable directory */
return NULL;
#else
/* support it in the sim for the sake of simulating */
int fd, i; int fd, i;
char temp_filename[MAX_PATH]; char temp_filename[MAX_PATH];
@ -143,17 +153,8 @@ void *lc_open_from_mem(void *addr, size_t blob_size)
to find an unused filename */ to find an unused filename */
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
/* we need that path fixed, since _get_user_file_path()
* gives us the folder on the sdcard where we cannot load libraries
* from (no exec permissions)
*/
snprintf(temp_filename, sizeof(temp_filename),
"/data/data/org.rockbox/app_rockbox/libtemp_binary_%d.so", i);
#else
snprintf(temp_filename, sizeof(temp_filename), snprintf(temp_filename, sizeof(temp_filename),
ROCKBOX_DIR "/libtemp_binary_%d.dll", i); ROCKBOX_DIR "/libtemp_binary_%d.dll", i);
#endif
fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700); fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700);
if (fd >= 0) if (fd >= 0)
break; /* Created a file ok */ break; /* Created a file ok */
@ -175,6 +176,7 @@ void *lc_open_from_mem(void *addr, size_t blob_size)
close(fd); close(fd);
return lc_open(temp_filename, NULL, 0); return lc_open(temp_filename, NULL, 0);
#endif
} }