summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-02-09 20:27:23 +0000
committerThomas Martitz <kugel@rockbox.org>2011-02-09 20:27:23 +0000
commit86cab2e27a0d9f831b39032fd713945659277903 (patch)
tree0ca92955c766098facfa3fa38007022ff8a550a8
parent82eec87dd65442c2a7e134dcb89ffc6d07fe5a4b (diff)
downloadrockbox-86cab2e27a0d9f831b39032fd713945659277903.tar.gz
rockbox-86cab2e27a0d9f831b39032fd713945659277903.zip
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
-rw-r--r--apps/buffering.c6
-rw-r--r--apps/buffering.h1
-rw-r--r--apps/playback.c15
-rw-r--r--firmware/load_code.c20
4 files changed, 28 insertions, 14 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 9c0ad138f7..1482d6790b 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -1012,7 +1012,11 @@ int bufopen(const char *file, size_t offset, enum data_type type,
1012 1012
1013 return h->id; 1013 return h->id;
1014 } 1014 }
1015 1015#ifdef APPLICATION
1016 /* loading code from memory is not supported in application builds */
1017 else if (type == TYPE_CODEC)
1018 return ERR_UNSUPPORTED_TYPE;
1019#endif
1016 /* Other cases: there is a little more work. */ 1020 /* Other cases: there is a little more work. */
1017 int fd = open(file, O_RDONLY); 1021 int fd = open(file, O_RDONLY);
1018 if (fd < 0) 1022 if (fd < 0)
diff --git a/apps/buffering.h b/apps/buffering.h
index 6e17b65d8c..c3a9f928d1 100644
--- a/apps/buffering.h
+++ b/apps/buffering.h
@@ -44,6 +44,7 @@ enum data_type {
44#define ERR_INVALID_VALUE -3 44#define ERR_INVALID_VALUE -3
45#define ERR_FILE_ERROR -4 45#define ERR_FILE_ERROR -4
46#define ERR_HANDLE_NOT_DONE -5 46#define ERR_HANDLE_NOT_DONE -5
47#define ERR_UNSUPPORTED_TYPE -6
47 48
48 49
49/* Initialise the buffering subsystem */ 50/* Initialise the buffering subsystem */
diff --git a/apps/playback.c b/apps/playback.c
index 9030161f4a..3a7faa3d8d 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1066,7 +1066,7 @@ static bool audio_release_tracks(void)
1066 1066
1067static bool audio_loadcodec(bool start_play) 1067static bool audio_loadcodec(bool start_play)
1068{ 1068{
1069 int prev_track; 1069 int prev_track, hid;
1070 char codec_path[MAX_PATH]; /* Full path to codec */ 1070 char codec_path[MAX_PATH]; /* Full path to codec */
1071 const struct mp3entry *id3, *prev_id3; 1071 const struct mp3entry *id3, *prev_id3;
1072 1072
@@ -1121,11 +1121,18 @@ static bool audio_loadcodec(bool start_play)
1121 1121
1122 codec_get_full_path(codec_path, codec_fn); 1122 codec_get_full_path(codec_path, codec_fn);
1123 1123
1124 tracks[track_widx].codec_hid = bufopen(codec_path, 0, TYPE_CODEC, NULL); 1124 hid = tracks[track_widx].codec_hid = bufopen(codec_path, 0, TYPE_CODEC, NULL);
1125 if (tracks[track_widx].codec_hid < 0) 1125
1126 /* not an error if codec load it supported, will load it from disk
1127 * application builds don't support it
1128 */
1129 if (hid < 0 && hid != ERR_UNSUPPORTED_TYPE)
1126 return false; 1130 return false;
1127 1131
1128 logf("Loaded codec"); 1132 if (hid > 0)
1133 logf("Loaded codec");
1134 else
1135 logf("Buffering codec unsupported, load later from disk");
1129 1136
1130 return true; 1137 return true;
1131} 1138}
diff --git a/firmware/load_code.c b/firmware/load_code.c
index 2337ee5cad..59eb7ac0f7 100644
--- a/firmware/load_code.c
+++ b/firmware/load_code.c
@@ -134,6 +134,16 @@ void * _lc_open(const _lc_open_char *filename, unsigned char *buf, size_t buf_si
134 134
135void *lc_open_from_mem(void *addr, size_t blob_size) 135void *lc_open_from_mem(void *addr, size_t blob_size)
136{ 136{
137#ifndef SIMULATOR
138 (void)addr;
139 (void)blob_size;
140 /* we don't support loading code from memory on application builds,
141 * it doesn't make sense (since it means writing the blob to disk again and
142 * then falling back to load from disk) and requires the ability to write
143 * to an executable directory */
144 return NULL;
145#else
146 /* support it in the sim for the sake of simulating */
137 int fd, i; 147 int fd, i;
138 char temp_filename[MAX_PATH]; 148 char temp_filename[MAX_PATH];
139 149
@@ -143,17 +153,8 @@ void *lc_open_from_mem(void *addr, size_t blob_size)
143 to find an unused filename */ 153 to find an unused filename */
144 for (i = 0; i < 10; i++) 154 for (i = 0; i < 10; i++)
145 { 155 {
146#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
147 /* we need that path fixed, since _get_user_file_path()
148 * gives us the folder on the sdcard where we cannot load libraries
149 * from (no exec permissions)
150 */
151 snprintf(temp_filename, sizeof(temp_filename),
152 "/data/data/org.rockbox/app_rockbox/libtemp_binary_%d.so", i);
153#else
154 snprintf(temp_filename, sizeof(temp_filename), 156 snprintf(temp_filename, sizeof(temp_filename),
155 ROCKBOX_DIR "/libtemp_binary_%d.dll", i); 157 ROCKBOX_DIR "/libtemp_binary_%d.dll", i);
156#endif
157 fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700); 158 fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700);
158 if (fd >= 0) 159 if (fd >= 0)
159 break; /* Created a file ok */ 160 break; /* Created a file ok */
@@ -175,6 +176,7 @@ void *lc_open_from_mem(void *addr, size_t blob_size)
175 176
176 close(fd); 177 close(fd);
177 return lc_open(temp_filename, NULL, 0); 178 return lc_open(temp_filename, NULL, 0);
179#endif
178} 180}
179 181
180 182