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
This commit is contained in:
parent
1aadfb2229
commit
70b81e65cc
5 changed files with 26 additions and 4 deletions
|
@ -46,6 +46,7 @@ JAVA_OBJ := $(call java2class,$(subst $(ANDROID)/src/$(PACKAGE_PATH),$(ANDROID)/
|
|||
|
||||
|
||||
LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so
|
||||
LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS))))
|
||||
TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk
|
||||
TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk
|
||||
DEX := $(BUILDDIR)/bin/classes.dex
|
||||
|
@ -107,6 +108,9 @@ $(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY)
|
|||
$(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip
|
||||
$(call PRINTS,CP rockbox.zip)cp $^ $@
|
||||
|
||||
$(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec
|
||||
$(call PRINTS,CP $(@F))cp $^ $@
|
||||
|
||||
libs: $(LIBS)
|
||||
|
||||
$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS)
|
||||
|
|
|
@ -169,8 +169,8 @@ struct codec_api ci = {
|
|||
|
||||
void codec_get_full_path(char *path, const char *codec_root_fn)
|
||||
{
|
||||
snprintf(path, MAX_PATH-1, "%s/%s." CODEC_EXTENSION,
|
||||
CODECS_DIR, codec_root_fn);
|
||||
snprintf(path, MAX_PATH-1, CODECS_DIR "/" CODEC_PREFIX "%s."
|
||||
CODEC_EXTENSION, codec_root_fn);
|
||||
}
|
||||
|
||||
/* Returns pointer to and size of free codec RAM. Aligns to CACHEALIGN_SIZE. */
|
||||
|
|
|
@ -107,7 +107,13 @@ enum
|
|||
};
|
||||
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||
#define CODEC_EXTENSION "so"
|
||||
#define CODEC_PREFIX "lib"
|
||||
#else
|
||||
#define CODEC_EXTENSION "codec"
|
||||
#define CODEC_PREFIX ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
enum rec_format_indexes
|
||||
|
|
|
@ -60,7 +60,11 @@
|
|||
#else /* application */
|
||||
|
||||
#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
|
||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||
#define CODECS_DIR ROCKBOX_BINARY_PATH
|
||||
#else
|
||||
#define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
|
||||
#endif
|
||||
|
||||
#define REC_BASE_DIR ROCKBOX_DIR "/"
|
||||
#define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
|
||||
|
|
|
@ -150,7 +150,11 @@ sub make_install {
|
|||
unless (glob_mkdir("$libdir/codecs")) {
|
||||
return 0;
|
||||
}
|
||||
glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755");
|
||||
# Android has codecs installed as native libraries so they are not needed
|
||||
# in the zip.
|
||||
if ($modelname !~ /android/) {
|
||||
glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755");
|
||||
}
|
||||
|
||||
# plugins
|
||||
unless (glob_mkdir("$libdir/rocks")) {
|
||||
|
@ -473,7 +477,11 @@ STOP
|
|||
|
||||
glob_mkdir("$temp_dir/codecs");
|
||||
|
||||
find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs');
|
||||
# Android has codecs installed as native libraries so they are not needed
|
||||
# in the zip.
|
||||
if ($modelname !~ /android/) {
|
||||
find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs');
|
||||
}
|
||||
|
||||
# remove directory again if no codec was copied
|
||||
rmdir("$temp_dir/codecs");
|
||||
|
|
Loading…
Reference in a new issue