log: fix for log redirection to logcat
you can see libmix log throw logcat by declaring MIX*_LOG_ENABLE true
in Android.mk
for audio
MIXAUDIO_LOG_ENABLE := true
for video
MIXVIDEO_LOG_ENABLE := true
for vbp
MIXVBP_LOG_ENABLE := true
diff --git a/mix_audio/src/Android.mk b/mix_audio/src/Android.mk
index c108526..466e3ce 100644
--- a/mix_audio/src/Android.mk
+++ b/mix_audio/src/Android.mk
@@ -1,6 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+#MIXAUDIO_LOG_ENABLE := true
+
LOCAL_SRC_FILES := \
mixaip.c \
mixacp.c \
@@ -25,6 +27,11 @@
libgmodule-2.0 \
libmixcommon
+ifeq ($(strip $(MIXAUDIO_LOG_ENABLE)),true)
+LOCAL_CFLAGS += -DMIX_LOG_ENABLE
+LOCAL_SHARED_LIBRARIES += liblog
+endif
+
LOCAL_COPY_HEADERS_TO := libmixaudio
LOCAL_COPY_HEADERS := \
diff --git a/mix_common/src/mixlog.c b/mix_common/src/mixlog.c
index a9dd359..0d306e4 100644
--- a/mix_common/src/mixlog.c
+++ b/mix_common/src/mixlog.c
@@ -18,6 +18,8 @@
#define MIX_LOG_LEVEL "MIX_LOG_LEVEL"
+#ifndef ANDROID
+
static GStaticMutex g_mutex = G_STATIC_MUTEX_INIT;
#ifdef MIX_LOG_USE_HT
@@ -254,4 +256,4 @@
#endif /* MIX_LOG_USE_HT */
-
+#endif /* !ANDROID */
diff --git a/mix_common/src/mixlog.h b/mix_common/src/mixlog.h
index 2fe60fd..906e6c9 100644
--- a/mix_common/src/mixlog.h
+++ b/mix_common/src/mixlog.h
@@ -31,13 +31,34 @@
#define MIX_LOG_LEVEL_INFO 3
#define MIX_LOG_LEVEL_VERBOSE 4
-
/* MACROS for mixlog */
#ifdef MIX_LOG_ENABLE
+#ifdef ANDROID
+
+#include <utils/Log.h>
+
+#undef MIX_LOG_LEVEL_ERROR
+#undef MIX_LOG_LEVEL_WARNING
+#undef MIX_LOG_LEVEL_INFO
+#undef MIX_LOG_LEVEL_VERBOSE
+
+#define MIX_LOG_LEVEL_ERROR ANDROID_LOG_ERROR
+#define MIX_LOG_LEVEL_WARNING ANDROID_LOG_WARN
+#define MIX_LOG_LEVEL_INFO ANDROID_LOG_INFO
+#define MIX_LOG_LEVEL_VERBOSE ANDROID_LOG_VERBOSE
+
+#define mix_log(comp, level, format, ...) \
+ __android_log_print(level, comp, "%s():%d: "format, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#else
+
#define mix_log(comp, level, format, ...) \
mix_log_func(comp, level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__)
+#endif /* ANDROID */
+
#else
#define mix_log(comp, level, format, ...)
diff --git a/mix_vbp/viddec_fw/fw/parser/Android.mk b/mix_vbp/viddec_fw/fw/parser/Android.mk
index 1cdf50d..797c640 100644
--- a/mix_vbp/viddec_fw/fw/parser/Android.mk
+++ b/mix_vbp/viddec_fw/fw/parser/Android.mk
@@ -2,6 +2,8 @@
include $(CLEAR_VARS)
+#MIXVBP_LOG_ENABLE := true
+
LOCAL_SRC_FILES := \
vbp_h264_parser.c \
vbp_vc1_parser.c \
@@ -51,4 +53,9 @@
libgthread-2.0 \
libgmodule-2.0
+ifeq ($(strip $(MIXVBP_LOG_ENABLE)),true)
+LOCAL_CFLAGS += -DVBP_TRACE
+LOCAL_SHARED_LIBRARIES += liblog
+endif
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/mix_vbp/viddec_fw/fw/parser/vbp_trace.h b/mix_vbp/viddec_fw/fw/parser/vbp_trace.h
index 9f2a21c..c532b67 100644
--- a/mix_vbp/viddec_fw/fw/parser/vbp_trace.h
+++ b/mix_vbp/viddec_fw/fw/parser/vbp_trace.h
@@ -17,6 +17,25 @@
#ifdef VBP_TRACE /* if VBP_TRACE is defined*/
+#ifdef ANDROID
+
+#include <utils/Log.h>
+
+#define ETRACE(format, ...) \
+ __android_log_print(ANDROID_LOG_ERROR, "mixvbp", "%s():%d: "format, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define WTRACE(format, ...) \
+ __android_log_print(ANDROID_LOG_WARN, "mixvbp", "%s():%d: "format, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define ITRACE(format, ...) \
+ __android_log_print(ANDROID_LOG_INFO, "mixvbp", "%s():%d: "format, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define VTRACE(format, ...) \
+ __android_log_print(ANDROID_LOG_VERBOSE, "mixvbp", "%s():%d: "format, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#else
+
#include <stdio.h>
#include <stdarg.h>
@@ -31,6 +50,8 @@
#define ITRACE(format, ...) VBP_TRACE_UTIL("INFO: ", format, ##__VA_ARGS__)
#define VTRACE(format, ...) VBP_TRACE_UTIL("VERBOSE: ", format, ##__VA_ARGS__)
+#endif /* ANDROID */
+
#else /* if VBP_TRACE is not defined */
#define ETRACE(format, ...)
@@ -38,7 +59,6 @@
#define ITRACE(format, ...)
#define VTRACE(format, ...)
-
#endif /* VBP_TRACE*/
diff --git a/mix_video/src/Android.mk b/mix_video/src/Android.mk
index 614ac4b..d60919c 100644
--- a/mix_video/src/Android.mk
+++ b/mix_video/src/Android.mk
@@ -1,6 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+#MIXVIDEO_LOG_ENABLE := true
+
LOCAL_SRC_FILES := \
mixbuffer.c \
mixbufferpool.c \
@@ -61,6 +63,11 @@
libmixvbp \
libva
+ifeq ($(strip $(MIXVIDEO_LOG_ENABLE)),true)
+LOCAL_CFLAGS += -DMIX_LOG_ENABLE
+LOCAL_SHARED_LIBRARIES += liblog
+endif
+
LOCAL_COPY_HEADERS_TO := libmixvideo
LOCAL_COPY_HEADERS := \