[Libva] [android-build 2/3] android: fix build for Android Jelly-Bean

Daniel Charles daniel.charles at intel.com
Fri Aug 17 09:50:19 PDT 2012


Android has shuffled around its header files on jelly-bean. For this
reason the version selector logic was moved one level up on the Android.mk
heirarchy so that the header file affected can pick up the correct version.

Renamed ANDROID_ALOG and ANDRIOD_LOG as they are used for various purposes

Signed-off-by: Daniel Charles <daniel.charles at intel.com>
---
 Android.mk      |   13 +++++++++++++
 va/Android.mk   |   23 +++++++----------------
 va/sysdeps.h    |    4 ++--
 va/va_android.h |    4 ++++
 4 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/Android.mk b/Android.mk
index 5cbb9d8..4e28d3e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,4 +1,17 @@
 # Recursive call sub-folder Android.mk
 #
 
+# Version set to Android Jelly Bean
+ALOG_VERSION_REQ := 4.1
+ALOG_VERSION := $(filter $(ALOG_VERSION_REQ),$(firstword $(sort $(PLATFORM_VERSION) \
+                                   $(ALOG_VERSION_REQ))))
+
+# Android Jelly Bean defined ALOGx, older versions use LOGx
+# Android Jelly Bean does not use surfaceflinger_client dependency
+ifeq ($(ALOG_VERSION), $(ALOG_VERSION_REQ))
+VERSION_CFLAGS := -DANDROID_JB
+else
+VERSION_CFLAGS := -DANDROID_PRE_JB
+endif
+
  include $(call all-subdir-makefiles)
diff --git a/va/Android.mk b/va/Android.mk
index 0951ab5..e05e9af 100755
--- a/va/Android.mk
+++ b/va/Android.mk
@@ -27,11 +27,6 @@ LOCAL_PATH:= $(call my-dir)
 
 LIBVA_DRIVERS_PATH = /system/lib
 
-# Version set to Android Jelly Bean
-ALOG_VERSION_REQ := 4.1
-ALOG_VERSION := $(filter $(ALOG_VERSION_REQ),$(firstword $(sort $(PLATFORM_VERSION) \
-                                   $(ALOG_VERSION_REQ))))
-
 include $(CLEAR_VARS)
 
 #LIBVA_MINOR_VERSION := 31
@@ -43,17 +38,10 @@ LOCAL_SRC_FILES := \
 	va_fool.c
 
 LOCAL_CFLAGS += \
-	-DANDROID \
+	-DANDROID $(VERSION_CFLAGS)\
 	-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\"" \
 	-DLOG_TAG=\"libva\"
 
-# Android Jelly Bean defined ALOGx, older versions use LOGx
-ifeq ($(ALOG_VERSION), $(ALOG_VERSION_REQ))
-LOCAL_CFLAGS += -DANDROID_ALOG
-else
-LOCAL_CFLAGS += -DANDROID_LOG
-endif
-
 LOCAL_C_INCLUDES += \
 	$(TARGET_OUT_HEADERS)/libva \
 	$(LOCAL_PATH)/x11 \
@@ -96,7 +84,8 @@ LOCAL_SRC_FILES := \
 	android/va_android.cpp
 
 LOCAL_CFLAGS += \
-	-DANDROID -DLOG_TAG=\"libva-android\"
+	-DANDROID $(VERSION_CFLAGS) \
+	-DLOG_TAG=\"libva-android\"
 
 LOCAL_C_INCLUDES += \
 	$(TARGET_OUT_HEADERS)/libva \
@@ -124,7 +113,8 @@ LOCAL_SRC_FILES :=    \
 	egl/va_egl_impl.c
 
 LOCAL_CFLAGS += \
-	-DANDROID -DLOG_TAG=\"libva-egl\"
+	-DANDROID $(VERSION_CFLAGS) \
+	-DLOG_TAG=\"libva-egl\"
 
 LOCAL_C_INCLUDES += \
 	$(TARGET_OUT_HEADERS)/libva \
@@ -149,7 +139,8 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := va_tpi.c
 
-LOCAL_CFLAGS += -DANDROID -DLOG_TAG=\"libva-tpi\"
+LOCAL_CFLAGS += -DANDROID $(VERSION_FLAGS) \
+		-DLOG_TAG=\"libva-tpi\"
 
 LOCAL_C_INCLUDES += \
 	$(TARGET_OUT_HEADERS)/libva \
diff --git a/va/sysdeps.h b/va/sysdeps.h
index ec2153d..e49d034 100644
--- a/va/sysdeps.h
+++ b/va/sysdeps.h
@@ -46,10 +46,10 @@
 /* Android logging utilities */
 # include <utils/Log.h>
 
-# ifdef ANDROID_ALOG
+# ifdef ANDROID_JB
 #  define va_log_error(buffer)  do { ALOGE("%s", buffer); } while (0)
 #  define va_log_info(buffer)   do { ALOGI("%s", buffer); } while (0)
-# elif ANDROID_LOG
+# elif ANDROID_PRE_JB
 #  define va_log_error(buffer)  do { LOGE("%s", buffer); } while (0)
 #  define va_log_info(buffer)   do { LOGI("%s", buffer); } while (0)
 # endif
diff --git a/va/va_android.h b/va/va_android.h
index ca73b84..0607bf7 100644
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -43,7 +43,11 @@ VADisplay vaGetDisplay (
 
 #ifdef __cplusplus
 #ifdef ANDROID
+#ifdef ANDROID_JB
+#include <gui/ISurface.h>
+#elif ANDROID_PRE_JB
 #include <surfaceflinger/ISurface.h>
+#endif /* ANDROID_JB */
 using namespace android;
 
 /*
-- 
1.7.7.6



More information about the Libva mailing list