summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-05-31 21:26:18 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-05-31 21:26:18 +0000
commit70b81e65cceb83b8933c7da7bdae2ce709404998 (patch)
treea9415ac980bd144dfd08e9eda41b8d6066de47e0
parent1aadfb2229d7105d19d321079acaede1e4f63a3f (diff)
downloadrockbox-70b81e65cceb83b8933c7da7bdae2ce709404998.tar.gz
rockbox-70b81e65cceb83b8933c7da7bdae2ce709404998.zip
Android: install codecs as native libs instead of extracting them (FS#12134).
Codec files are loaded as dynamic libraries. Instead of extracting them from the packaged libmisc.so and therefore having them present twice on the device put them into the apk as native libraries. Decreases the size of the installed Rockbox by the compressed size of the codecs. Also, the extraction on first Rockbox startup gets notably faster since it's less data to extract. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29940 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--android/android.make4
-rw-r--r--apps/codecs.c4
-rw-r--r--apps/metadata.h6
-rw-r--r--firmware/export/rbpaths.h4
-rwxr-xr-xtools/buildzip.pl12
5 files changed, 26 insertions, 4 deletions
diff --git a/android/android.make b/android/android.make
index fa3b48eaf8..f12b79750d 100644
--- a/android/android.make
+++ b/android/android.make
@@ -46,6 +46,7 @@ JAVA_OBJ := $(call java2class,$(subst $(ANDROID)/src/$(PACKAGE_PATH),$(ANDROID)/
46 46
47 47
48LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so 48LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so
49LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS))))
49TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk 50TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk
50TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk 51TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk
51DEX := $(BUILDDIR)/bin/classes.dex 52DEX := $(BUILDDIR)/bin/classes.dex
@@ -107,6 +108,9 @@ $(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY)
107$(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip 108$(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip
108 $(call PRINTS,CP rockbox.zip)cp $^ $@ 109 $(call PRINTS,CP rockbox.zip)cp $^ $@
109 110
111$(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec
112 $(call PRINTS,CP $(@F))cp $^ $@
113
110libs: $(LIBS) 114libs: $(LIBS)
111 115
112$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS) 116$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS)
diff --git a/apps/codecs.c b/apps/codecs.c
index 249cd8f5c1..cd4a9d50eb 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -169,8 +169,8 @@ struct codec_api ci = {
169 169
170void codec_get_full_path(char *path, const char *codec_root_fn) 170void codec_get_full_path(char *path, const char *codec_root_fn)
171{ 171{
172 snprintf(path, MAX_PATH-1, "%s/%s." CODEC_EXTENSION, 172 snprintf(path, MAX_PATH-1, CODECS_DIR "/" CODEC_PREFIX "%s."
173 CODECS_DIR, codec_root_fn); 173 CODEC_EXTENSION, codec_root_fn);
174} 174}
175 175
176/* Returns pointer to and size of free codec RAM. Aligns to CACHEALIGN_SIZE. */ 176/* Returns pointer to and size of free codec RAM. Aligns to CACHEALIGN_SIZE. */
diff --git a/apps/metadata.h b/apps/metadata.h
index 3499e13f47..a191e43219 100644
--- a/apps/metadata.h
+++ b/apps/metadata.h
@@ -107,7 +107,13 @@ enum
107}; 107};
108 108
109#if CONFIG_CODEC == SWCODEC 109#if CONFIG_CODEC == SWCODEC
110#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
111#define CODEC_EXTENSION "so"
112#define CODEC_PREFIX "lib"
113#else
110#define CODEC_EXTENSION "codec" 114#define CODEC_EXTENSION "codec"
115#define CODEC_PREFIX ""
116#endif
111 117
112#ifdef HAVE_RECORDING 118#ifdef HAVE_RECORDING
113enum rec_format_indexes 119enum rec_format_indexes
diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
index ade7894091..74d26f93d3 100644
--- a/firmware/export/rbpaths.h
+++ b/firmware/export/rbpaths.h
@@ -60,7 +60,11 @@
60#else /* application */ 60#else /* application */
61 61
62#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks" 62#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
63#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
64#define CODECS_DIR ROCKBOX_BINARY_PATH
65#else
63#define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs" 66#define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
67#endif
64 68
65#define REC_BASE_DIR ROCKBOX_DIR "/" 69#define REC_BASE_DIR ROCKBOX_DIR "/"
66#define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists" 70#define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 2337dbe729..ed937d42e4 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -150,7 +150,11 @@ sub make_install {
150 unless (glob_mkdir("$libdir/codecs")) { 150 unless (glob_mkdir("$libdir/codecs")) {
151 return 0; 151 return 0;
152 } 152 }
153 glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755"); 153 # Android has codecs installed as native libraries so they are not needed
154 # in the zip.
155 if ($modelname !~ /android/) {
156 glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755");
157 }
154 158
155 # plugins 159 # plugins
156 unless (glob_mkdir("$libdir/rocks")) { 160 unless (glob_mkdir("$libdir/rocks")) {
@@ -473,7 +477,11 @@ STOP
473 477
474 glob_mkdir("$temp_dir/codecs"); 478 glob_mkdir("$temp_dir/codecs");
475 479
476 find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs'); 480 # Android has codecs installed as native libraries so they are not needed
481 # in the zip.
482 if ($modelname !~ /android/) {
483 find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs');
484 }
477 485
478 # remove directory again if no codec was copied 486 # remove directory again if no codec was copied
479 rmdir("$temp_dir/codecs"); 487 rmdir("$temp_dir/codecs");