shithub: openh264

Download patch

ref: ab2e5fe20760049c97f9d40af55353c4c2819056
parent: 46b9d5d0da23d128f911e5feb7ffdefcb7413b7b
parent: 23ea23e7c124acf4268f9c1e80b759786ab2f0a5
author: volvet <[email protected]>
date: Thu Feb 20 09:40:27 EST 2014

Merge pull request #321 from licaiguo/add-android-target-option

Add android target option

--- a/README.md
+++ b/README.md
@@ -59,11 +59,12 @@
 
 The codec and demo can be built by
 
-'make OS=android NDKROOT=**ANDROID_NDK**'
+'make OS=android NDKROOT=**ANDROID_NDK** TARGET= **ANDROID_TARGET**'
 
-You can also set ARCH, APILEVEL, GCCVERSION according to your device and NDK version.
+Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as android-12. 
+You can also set ARCH, NDKLEVEL, GCCVERSION according to your device and NDK version.
 ARCH specifies the architecture of android device. Currently only arm and x86 are supported, the default is arm.
-APILEVEL specifies android api level, the api level can be 12-19, the default is 19.
+NDKLEVEL specifies android api level, the api level can be 12-19, the default is 12.
 GCCVERSION specifies which gcc in NDK is used, the default is 4.8.
 
 For Windows Builds
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -2,7 +2,7 @@
 ARCH = arm
 SHAREDLIBSUFFIX = so
 GCCVERSION = 4.8
-APILEVEL = 19
+NDKLEVEL = 12
 HOSTOS = $(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
 HOSTARCH = $(shell uname -m)
 ifeq ($(ARCH), arm)
@@ -25,7 +25,14 @@
 endif
 endif
 
-SYSROOT = $(NDKROOT)/platforms/android-$(APILEVEL)/arch-$(ARCH)
+ifndef NDKROOT
+$(error NDKROOT is not set)
+endif
+ifndef TARGET
+$(error TARGET is not set)
+endif
+
+SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH)
 CXX = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-g++
 CFLAGS += -DLINUX -fpic --sysroot=$(SYSROOT) -fno-rtti -fno-exceptions
 LDFLAGS += --sysroot=$(SYSROOT) -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,libwels.so
@@ -34,7 +41,7 @@
 binaries : decdemo encdemo
 
 decdemo: libraries
-	sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
+	sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'
 
 encdemo: libraries
-	sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
+	sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'
--- a/codec/build/android/dec/project.properties
+++ /dev/null
@@ -1,14 +1,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-12
--- a/codec/build/android/enc/project.properties
+++ /dev/null
@@ -1,14 +1,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-12