Camera
vendor/mediatek/proprietary/hardware/mtkcam/mtkcam.mk
定义所属模块路径属性
MTK_MTKCAM_PLATFORM := $(MTK_PATH_SOURCE)/hardware/mtkcam/legacy/platform/$(PLATFORM)
定义log等级
ifeq ($(TARGET_BUILD_VARIANT), user)
MTKCAM_LOG_LEVEL_DEFAULT := 2
else ifeq ($(TARGET_BUILD_VARIANT), userdebug)
MTKCAM_LOG_LEVEL_DEFAULT := 3
else
MTKCAM_LOG_LEVEL_DEFAULT := 4
endif
模块使用
module:libcam_utils.common.imagebuffer
path:vendor/mediatek/proprietary/hardware/mtkcam/legacy/utils/ImageBuffer
class:vendor/mediatek/proprietary/hardware/mtkcam/legacy/utils/ImageBuffer/BaseImageBufferHeap.cpp
#define MY_LOGV(fmt, arg...) CAM_LOGV("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGD(fmt, arg...) CAM_LOGD("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGI(fmt, arg...) CAM_LOGI("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGW(fmt, arg...) CAM_LOGW("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGE(fmt, arg...) CAM_LOGE("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGA(fmt, arg...) CAM_LOGA("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
#define MY_LOGF(fmt, arg...) CAM_LOGF("[%s::%s] " fmt, getMagicName(), __FUNCTION__, ##arg)
//
#define MY_LOGV_IF(cond, ...) do { if ( (cond) ) { MY_LOGV(__VA_ARGS__); } }while(0)
#define MY_LOGD_IF(cond, ...) do { if ( (cond) ) { MY_LOGD(__VA_ARGS__); } }while(0)
#define MY_LOGI_IF(cond, ...) do { if ( (cond) ) { MY_LOGI(__VA_ARGS__); } }while(0)
#define MY_LOGW_IF(cond, ...) do { if ( (cond) ) { MY_LOGW(__VA_ARGS__); } }while(0)
#define MY_LOGE_IF(cond, ...) do { if ( (cond) ) { MY_LOGE(__VA_ARGS__); } }while(0)
#define MY_LOGA_IF(cond, ...) do { if ( (cond) ) { MY_LOGA(__VA_ARGS__); } }while(0)
#define MY_LOGF_IF(cond, ...) do { if ( (cond) ) { MY_LOGF(__VA_ARGS__); } }while(0)
头文件
#include "MyUtils.h"
==>
vendor/mediatek/proprietary/hardware/mtkcam/legacy/utils/ImageBuffer/MyUtils.h
#include <Log.h>
==>
vendor/mediatek/proprietary/hardware/mtkcam/legacy/include/mtkcam/Log.h
#if defined(MTKCAM_LOG_LEVEL)
#define CAM_LOG_LEVEL MTKCAM_LOG_LEVEL
#elif defined(MTKCAM_LOG_LEVEL_DEFAULT)
#define CAM_LOG_LEVEL MTKCAM_LOG_LEVEL_DEFAULT
#else
#define CAM_LOG_LEVEL 4
#endif
//
#include <cutils/log.h>
#define CAM_LOGV(fmt, arg...) do{ if(CAM_LOG_LEVEL >= 4) ALOGV(fmt, ##arg); } while(0)
#define CAM_LOGD(fmt, arg...) do{ if(CAM_LOG_LEVEL >= 3) ALOGD(fmt, ##arg); } while(0)
#define CAM_LOGI(fmt, arg...) do{ if(CAM_LOG_LEVEL >= 2) ALOGI(fmt, ##arg); } while(0)
#define CAM_LOGW(fmt, arg...) do{ if(CAM_LOG_LEVEL >= 1) ALOGW(fmt, ##arg); } while(0)
#define CAM_LOGE(fmt, arg...) ALOGE(fmt" (%s){#%d:%s}", ##arg, __FUNCTION__, __LINE__, __FILE__)