diff --git a/camera/Android.mk b/camera/Android.mk index c504a2d..dc5b2a8 100755 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +#ifeq ($(SW_BOARD_USES_CAMERA),true ) + + LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -37,6 +40,7 @@ LOCAL_C_INCLUDES += \ external/jpeg \ external/skia/include/core \ frameworks/base/core/jni/android/graphics \ + frameworks/native/include \ device/allwinner/common/include \ external/cedarx/CedarX/include/include_camera \ @@ -58,4 +62,4 @@ LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) - +#endif diff --git a/camera/CCameraConfig.cpp b/camera/CCameraConfig.cpp index 1fdcdde..7732cd7 100755 --- a/camera/CCameraConfig.cpp +++ b/camera/CCameraConfig.cpp @@ -7,11 +7,11 @@ #define READ_KEY_VALUE(key, val) \ val = (char*)::malloc(KEY_LENGTH); \ if (val == 0){ \ - LOGV("malloc %s failed", val); \ + ALOGV("malloc %s failed", val); \ } \ memset(val, 0, KEY_LENGTH); \ if (readKey(key, val)){ \ - LOGV("read key: %s = %s", key, val); \ + ALOGV("read key: %s = %s", key, val); \ } #define INIT_PARAMETER(KEY, key) \ @@ -27,7 +27,7 @@ } \ else \ { \ - LOGV("\"%s\" not support", kUSED_##KEY); \ + ALOGV("\"%s\" not support", kUSED_##KEY); \ } \ } @@ -44,9 +44,9 @@ #define _DUMP_PARAMETERS(key, value) \ if (value != 0){ \ - LOGV("%s = %s", key, value); \ + ALOGV("%s = %s", key, value); \ }else{ \ - LOGV("%s not support", key); \ + ALOGV("%s not support", key); \ } #define DUMP_PARAMETERS(kused, key) \ @@ -84,12 +84,12 @@ CCameraConfig::CCameraConfig(int id) mhKeyFile = ::fopen(CAMERA_KEY_CONFIG_PATH, "rb"); if (mhKeyFile <= 0) { - LOGV("open file %s failed", CAMERA_KEY_CONFIG_PATH); + ALOGV("open file %s failed", CAMERA_KEY_CONFIG_PATH); return; } else { - LOGV("open file %s OK", CAMERA_KEY_CONFIG_PATH); + ALOGV("open file %s OK", CAMERA_KEY_CONFIG_PATH); } // get number of camera @@ -97,7 +97,7 @@ CCameraConfig::CCameraConfig(int id) if(readKey(kNUMBER_OF_CAMERA, numberOfCamera)) { mNumberOfCamera = atoi(numberOfCamera); - LOGV("read number: %d", mNumberOfCamera); + ALOGV("read number: %d", mNumberOfCamera); } // get camera facing @@ -105,14 +105,14 @@ CCameraConfig::CCameraConfig(int id) if(readKey(kCAMERA_FACING, cameraFacing)) { mCameraFacing = atoi(cameraFacing); - LOGV("camera facing %s", (mCameraFacing == 0) ? "back" : "front"); + ALOGV("camera facing %s", (mCameraFacing == 0) ? "back" : "front"); } // get camera device driver memset(mCameraDevice, 0, sizeof(mCameraDevice)); if(readKey(kCAMERA_DEVICE, mCameraDevice)) { - LOGV("camera device %s", mCameraDevice); + ALOGV("camera device %s", mCameraDevice); } // get device id @@ -120,7 +120,7 @@ CCameraConfig::CCameraConfig(int id) if(readKey(kDEVICE_ID, deviceID)) { mDeviceID = atoi(deviceID); - LOGV("camera device id %d", mDeviceID); + ALOGV("camera device id %d", mDeviceID); } } @@ -151,7 +151,7 @@ void CCameraConfig::initParameters() { if (mhKeyFile == 0) { - LOGW("invalid camera config file hadle"); + ALOGW("invalid camera config file hadle"); return ; } @@ -181,7 +181,7 @@ void CCameraConfig::initParameters() } else { - LOGV("\"%s\" not support", kUSED_EXPOSURE_COMPENSATION); + ALOGV("\"%s\" not support", kUSED_EXPOSURE_COMPENSATION); } } @@ -204,7 +204,7 @@ void CCameraConfig::initParameters() } else { - LOGV("\"%s\" not support", kUSED_ZOOM); + ALOGV("\"%s\" not support", kUSED_ZOOM); } } } @@ -213,14 +213,14 @@ void CCameraConfig::dumpParameters() { if (mhKeyFile == 0) { - LOGW("invalid camera config file hadle"); + ALOGW("invalid camera config file hadle"); return ; } - LOGV("/*------------------------------------------------------*/"); - LOGV("camrea id: %d", mCurCameraId); - LOGV("camera facing %s", (mCameraFacing == 0) ? "back" : "front"); - LOGV("camera device %s", mCameraDevice); + ALOGV("/*------------------------------------------------------*/"); + ALOGV("camrea id: %d", mCurCameraId); + ALOGV("camera facing %s", (mCameraFacing == 0) ? "back" : "front"); + ALOGV("camera device %s", mCameraDevice); DUMP_PARAMETERS(PREVIEW_SIZE, PreviewSize) DUMP_PARAMETERS(PICTURE_SIZE, PictureSize) DUMP_PARAMETERS(FLASH_MODE, FlashMode) @@ -242,7 +242,7 @@ void CCameraConfig::dumpParameters() _DUMP_PARAMETERS(kZOOM_RATIOS, mZoomRatios) _DUMP_PARAMETERS(kMAX_ZOOM, mMaxZoom) _DUMP_PARAMETERS(kDEFAULT_ZOOM, mDefaultZoom) - LOGV("/*------------------------------------------------------*/"); + ALOGV("/*------------------------------------------------------*/"); } void CCameraConfig::getValue(char *line, char *value) @@ -278,13 +278,13 @@ bool CCameraConfig::readKey(char *key, char *value) if (key == 0 || value == 0) { - LOGV("error input para"); + ALOGV("error input para"); return false; } if (mhKeyFile == 0) { - LOGV("error key file handle"); + ALOGV("error key file handle"); return false; } diff --git a/camera/CallbackNotifier.cpp b/camera/CallbackNotifier.cpp index bfabe56..477bc37 100755 --- a/camera/CallbackNotifier.cpp +++ b/camera/CallbackNotifier.cpp @@ -22,7 +22,7 @@ #define LOG_TAG "CallbackNotifier" #include "CameraDebug.h" -#include +#include #include #include "V4L2Camera.h" #include "CallbackNotifier.h" @@ -83,7 +83,7 @@ static void PrintMessages(uint32_t msg) const char* strs[lCameraMessagesNum]; const int translated = GetMessageStrings(msg, strs, lCameraMessagesNum); for (int n = 0; n < translated; n++) { - LOGV(" %s", strs[n]); + ALOGV(" %s", strs[n]); } } @@ -125,7 +125,7 @@ void CallbackNotifier::setCallbacks(camera_notify_callback notify_cb, camera_request_memory get_memory, void* user) { - LOGV("%s: %p, %p, %p, %p (%p)", + ALOGV("%s: %p, %p, %p, %p (%p)", __FUNCTION__, notify_cb, data_cb, data_cb_timestamp, get_memory, user); Mutex::Autolock locker(&mObjectLock); @@ -138,29 +138,29 @@ void CallbackNotifier::setCallbacks(camera_notify_callback notify_cb, void CallbackNotifier::enableMessage(uint msg_type) { - LOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type); + ALOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type); PrintMessages(msg_type); Mutex::Autolock locker(&mObjectLock); mMessageEnabler |= msg_type; - LOGV("**** Currently enabled messages:"); + ALOGV("**** Currently enabled messages:"); PrintMessages(mMessageEnabler); } void CallbackNotifier::disableMessage(uint msg_type) { - LOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type); + ALOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type); PrintMessages(msg_type); Mutex::Autolock locker(&mObjectLock); mMessageEnabler &= ~msg_type; - LOGV("**** Currently enabled messages:"); + ALOGV("**** Currently enabled messages:"); PrintMessages(mMessageEnabler); } status_t CallbackNotifier::enableVideoRecording(int fps) { - LOGV("%s: FPS = %d", __FUNCTION__, fps); + ALOGV("%s: FPS = %d", __FUNCTION__, fps); Mutex::Autolock locker(&mObjectLock); mVideoRecEnabled = true; @@ -172,7 +172,7 @@ status_t CallbackNotifier::enableVideoRecording(int fps) void CallbackNotifier::disableVideoRecording() { - LOGV("%s:", __FUNCTION__); + ALOGV("%s:", __FUNCTION__); Mutex::Autolock locker(&mObjectLock); mVideoRecEnabled = false; @@ -192,7 +192,7 @@ status_t CallbackNotifier::storeMetaDataInBuffers(bool enable) * return actual frame data with CAMERA_MSG_VIDEO_FRAME. Return * INVALID_OPERATION to mean metadata is not supported. */ - LOGD("storeMetaDataInBuffers, %s", enable ? "true" : "false"); + ALOGD("storeMetaDataInBuffers, %s", enable ? "true" : "false"); mUseMetaDataBufferMode = enable; return NO_ERROR; @@ -250,7 +250,7 @@ void CallbackNotifier::onNextFrameHW(const void* frame, } else { - LOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__); } } @@ -265,7 +265,7 @@ void CallbackNotifier::onNextFrameHW(const void* frame, } else { - LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); } } } @@ -284,7 +284,7 @@ void CallbackNotifier::onNextFrameSW(const void* frame, cam_buff, 0, mCallbackCookie); cam_buff->release(cam_buff); // star add } else { - LOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__); } } @@ -296,7 +296,7 @@ void CallbackNotifier::onNextFrameSW(const void* frame, mDataCB(CAMERA_MSG_PREVIEW_FRAME, cam_buff, 0, NULL, mCallbackCookie); cam_buff->release(cam_buff); } else { - LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); } } } @@ -327,7 +327,7 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) return ; } - LOGD("%s, taking photo begin", __FUNCTION__); + ALOGD("%s, taking photo begin", __FUNCTION__); /* This happens just once. */ mTakingPicture = false; /* The sequence of callbacks during picture taking is: @@ -356,7 +356,7 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) } else { - LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); } } @@ -402,7 +402,7 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) jpeg_enc.enable_gps = 0; } - LOGD("addrY: %x, src: %dx%d, pic: %dx%d, quality: %d, rotate: %d,Gps method: %s, thumbW: %d, thumbH: %d", + ALOGD("addrY: %x, src: %dx%d, pic: %dx%d, quality: %d, rotate: %d,Gps method: %s, thumbW: %d, thumbH: %d", jpeg_enc.addrY, jpeg_enc.src_w, jpeg_enc.src_h, jpeg_enc.pic_w, jpeg_enc.pic_h, @@ -414,14 +414,14 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) pOutBuf = (void *)malloc(jpeg_enc.pic_w * jpeg_enc.pic_h << 2); if (pOutBuf == NULL) { - LOGE("malloc picture memory failed"); + ALOGE("malloc picture memory failed"); return ; } int ret = JpegEnc(pOutBuf, &bufSize, &jpeg_enc); if (ret < 0) { - LOGE("JpegEnc failed"); + ALOGE("JpegEnc failed"); return ; } @@ -434,7 +434,7 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) } else { - LOGE("%s: Memory failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); } if(pOutBuf != NULL) @@ -444,7 +444,7 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) } } - LOGD("taking photo to CAMERA_MSG_POSTVIEW_FRAME"); + ALOGD("taking photo to CAMERA_MSG_POSTVIEW_FRAME"); if (isMessageEnabled(CAMERA_MSG_POSTVIEW_FRAME) ) { @@ -459,11 +459,11 @@ void CallbackNotifier::takePictureHW(const void* frame, V4L2Camera* camera_dev) } else { - LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__); } } - LOGD("taking photo end"); + ALOGD("taking photo end"); } void CallbackNotifier::takePictureSW(const void* frame, V4L2Camera* camera_dev) @@ -473,7 +473,7 @@ void CallbackNotifier::takePictureSW(const void* frame, V4L2Camera* camera_dev) return ; } - LOGD("%s, taking photo begin", __FUNCTION__); + ALOGD("%s, taking photo begin", __FUNCTION__); /* This happens just once. */ mTakingPicture = false; /* The sequence of callbacks during picture taking is: @@ -503,10 +503,10 @@ void CallbackNotifier::takePictureSW(const void* frame, V4L2Camera* camera_dev) mDataCB(CAMERA_MSG_COMPRESSED_IMAGE, jpeg_buff, 0, NULL, mCallbackCookie); jpeg_buff->release(jpeg_buff); } else { - LOGE("%s: Memory failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); + ALOGE("%s: Memory failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); } } else { - LOGE("%s: Compression failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); + ALOGE("%s: Compression failure in CAMERA_MSG_COMPRESSED_IMAGE", __FUNCTION__); } } } diff --git a/camera/CameraCommon.h b/camera/CameraCommon.h index 907985a..c1d575c 100755 --- a/camera/CameraCommon.h +++ b/camera/CameraCommon.h @@ -34,12 +34,12 @@ class HWERoutineTracker { /* Constructor that prints an "entry" trace message. */ explicit HWERoutineTracker(const char* name) : mName(name) { - LOGV("Entering %s", mName); + ALOGV("Entering %s", mName); } /* Destructor that prints a "leave" trace message. */ ~HWERoutineTracker() { - LOGV("Leaving %s", mName); + ALOGV("Leaving %s", mName); } private: diff --git a/camera/CameraDebug.h b/camera/CameraDebug.h index f58bad0..61426f9 100755 --- a/camera/CameraDebug.h +++ b/camera/CameraDebug.h @@ -4,7 +4,7 @@ // #define LOG_NDEBUG 0 #include -#define F_LOG LOGV("%s, line: %d", __FUNCTION__, __LINE__); +#define F_LOG ALOGV("%s, line: %d", __FUNCTION__, __LINE__); #endif // CAMERA_DEBUG_H diff --git a/camera/CameraHardware.cpp b/camera/CameraHardware.cpp index 9442a4f..4312640 100755 --- a/camera/CameraHardware.cpp +++ b/camera/CameraHardware.cpp @@ -85,7 +85,7 @@ CameraHardware::CameraHardware(int cameraId, struct hw_module_t* module) mCameraConfig = new CCameraConfig(cameraId); if (mCameraConfig == NULL) { - LOGE("create CCameraConfig failed"); + ALOGE("create CCameraConfig failed"); } mCameraConfig->initParameters(); @@ -120,28 +120,28 @@ void CameraHardware::initDefaultParameters() String8 parameterString; char * value; - LOGV("CameraHardware::initDefaultParameters"); + ALOGV("CameraHardware::initDefaultParameters"); if (mCameraConfig->cameraFacing() == CAMERA_FACING_BACK) { p.set(CameraHardware::FACING_KEY, CameraHardware::FACING_BACK); - LOGV("%s: camera is facing %s", __FUNCTION__, CameraHardware::FACING_BACK); + ALOGV("%s: camera is facing %s", __FUNCTION__, CameraHardware::FACING_BACK); } else { p.set(CameraHardware::FACING_KEY, CameraHardware::FACING_FRONT); - LOGV("%s: camera is facing %s", __FUNCTION__, CameraHardware::FACING_FRONT); + ALOGV("%s: camera is facing %s", __FUNCTION__, CameraHardware::FACING_FRONT); } p.set(CameraHardware::ORIENTATION_KEY, 0); - LOGV("to init preview size"); + ALOGV("to init preview size"); // preview size if (mCameraConfig->supportPreviewSize()) { value = mCameraConfig->supportPreviewSizeValue(); p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, value); - LOGV("supportPreviewSizeValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, value); + ALOGV("supportPreviewSizeValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, value); p.set(CameraParameters::KEY_SUPPORTED_VIDEO_SIZES, value); value = mCameraConfig->defaultPreviewSizeValue(); @@ -150,13 +150,13 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO, value); } - LOGV("to init picture size"); + ALOGV("to init picture size"); // picture size if (mCameraConfig->supportPictureSize()) { value = mCameraConfig->supportPictureSizeValue(); p.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, value); - LOGV("supportPreviewSizeValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, value); + ALOGV("supportPreviewSizeValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, value); value = mCameraConfig->defaultPictureSizeValue(); p.set(CameraParameters::KEY_PICTURE_SIZE, value); @@ -164,13 +164,13 @@ void CameraHardware::initDefaultParameters() p.setPictureFormat(CameraParameters::PIXEL_FORMAT_JPEG); } - LOGV("to init frame rate"); + ALOGV("to init frame rate"); // frame rate if (mCameraConfig->supportFrameRate()) { value = mCameraConfig->supportFrameRateValue(); p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES, value); - LOGV("supportFrameRateValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES, value); + ALOGV("supportFrameRateValue: [%s] %s", CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES, value); p.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "5000,30000"); // add temp for CTS p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(5000,30000)"); // add temp for CTS @@ -179,7 +179,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_PREVIEW_FRAME_RATE, value); } - LOGV("to init focus"); + ALOGV("to init focus"); // focus if (mCameraConfig->supportFocusMode()) { @@ -198,7 +198,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_FOCUS_DISTANCES, "0.10,1.20,Infinity"); } - LOGV("to init color effect"); + ALOGV("to init color effect"); // color effect if (mCameraConfig->supportColorEffect()) { @@ -208,7 +208,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_EFFECT, value); } - LOGV("to init flash mode"); + ALOGV("to init flash mode"); // flash mode if (mCameraConfig->supportFlashMode()) { @@ -218,7 +218,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_FLASH_MODE, value); } - LOGV("to init scene mode"); + ALOGV("to init scene mode"); // scene mode if (mCameraConfig->supportSceneMode()) { @@ -228,7 +228,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_SCENE_MODE, value); } - LOGV("to init white balance"); + ALOGV("to init white balance"); // white balance if (mCameraConfig->supportWhiteBalance()) { @@ -238,7 +238,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_WHITE_BALANCE, value); } - LOGV("to init exposure compensation"); + ALOGV("to init exposure compensation"); // exposure compensation if (mCameraConfig->supportExposureCompensation()) { @@ -262,7 +262,7 @@ void CameraHardware::initDefaultParameters() p.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, "0"); } - LOGV("to init zoom"); + ALOGV("to init zoom"); // zoom if (mCameraConfig->supportZoom()) { @@ -312,7 +312,7 @@ void CameraHardware::initDefaultParameters() mParameters = p; - LOGV("CameraHardware::initDefaultParameters ok"); + ALOGV("CameraHardware::initDefaultParameters ok"); } bool CameraHardware::onNextFrameAvailable(const void* frame, @@ -373,11 +373,11 @@ void CameraHardware::onCameraDeviceError(int err) status_t CameraHardware::connectCamera(hw_device_t** device) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); status_t res = EINVAL; V4L2Camera* const camera_dev = getCameraDevice(); - LOGE_IF(camera_dev == NULL, "%s: No camera device instance.", __FUNCTION__); + ALOGE_IF(camera_dev == NULL, "%s: No camera device instance.", __FUNCTION__); if (camera_dev != NULL) { /* Connect to the camera device. */ @@ -392,14 +392,14 @@ status_t CameraHardware::connectCamera(hw_device_t** device) status_t CameraHardware::closeCamera() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); return cleanupCamera(); } status_t CameraHardware::getCameraInfo(struct camera_info* info) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); const char* valstr = NULL; @@ -525,7 +525,7 @@ void CameraHardware::stopRecording() mParameters.getVideoSize(&new_video_width, &new_video_height); // do not use high size for preview - LOGV("last preview size: %dx%d", mLastPreviewWidth, mLastPreviewHeight); + ALOGV("last preview size: %dx%d", mLastPreviewWidth, mLastPreviewHeight); mParameters.setPreviewSize(mLastPreviewWidth, mLastPreviewHeight); mParameters.setVideoSize(mLastPreviewWidth, mLastPreviewHeight); @@ -552,14 +552,14 @@ void CameraHardware::releaseRecordingFrame(const void* opaque) status_t CameraHardware::setAutoFocus() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); return mCallbackNotifier.autoFocus(); } status_t CameraHardware::cancelAutoFocus() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); /* TODO: Future enhancements. */ return NO_ERROR; @@ -567,7 +567,7 @@ status_t CameraHardware::cancelAutoFocus() status_t CameraHardware::takePicture() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); status_t res; int pic_width, pic_height, frame_width, frame_height; @@ -583,7 +583,7 @@ status_t CameraHardware::takePicture() frame_height = pic_height; getCameraDevice()->tryFmtSize(&frame_width, &frame_height); // mParameters.setPreviewSize(frame_width, frame_height); - LOGD("%s, pic_size: %dx%d, frame_size: %dx%d", + ALOGD("%s, pic_size: %dx%d, frame_size: %dx%d", __FUNCTION__, pic_width, pic_height, frame_width, frame_height); getCameraDevice()->setPictureSize(pic_width, pic_height); @@ -599,7 +599,7 @@ status_t CameraHardware::takePicture() /* We only have JPEG converted for NV21 format. */ org_fmt = V4L2_PIX_FMT_NV12; } else { - LOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt); + ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt); return EINVAL; } /* Get JPEG quality. */ @@ -628,7 +628,7 @@ status_t CameraHardware::takePicture() * enabled. */ V4L2Camera* const camera_dev = getCameraDevice(); if (camera_dev->isStarted()) { - LOGW("%s: Camera device is started", __FUNCTION__); + ALOGW("%s: Camera device is started", __FUNCTION__); camera_dev->stopDeliveringFrames(); camera_dev->stopDevice(); } @@ -642,7 +642,7 @@ status_t CameraHardware::takePicture() camera_dev->setTakingPicture(true); /* Start camera device for the picture frame. */ - LOGD("Starting camera for picture: %.4s(%s)[%dx%d]", + ALOGD("Starting camera for picture: %.4s(%s)[%dx%d]", reinterpret_cast(&org_fmt), pix_fmt, frame_width, frame_height); res = camera_dev->startDevice(frame_width, frame_height, org_fmt); if (res != NO_ERROR) { @@ -670,14 +670,14 @@ status_t CameraHardware::takePicture() status_t CameraHardware::cancelPicture() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); return NO_ERROR; } status_t CameraHardware::setParameters(const char* p) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); int ret = UNKNOWN_ERROR; PrintParamDiff(mParameters, p); @@ -689,13 +689,13 @@ status_t CameraHardware::setParameters(const char* p) V4L2CameraDevice* pV4L2Device = getCameraDevice(); if (pV4L2Device == NULL) { - LOGE("%s, getCameraDevice failed", __FUNCTION__); + ALOGE("%s, getCameraDevice failed", __FUNCTION__); return UNKNOWN_ERROR; } // preview format const char * new_preview_format = params.getPreviewFormat(); - LOGD("new_preview_format : %s", new_preview_format); + ALOGD("new_preview_format : %s", new_preview_format); if (strcmp(new_preview_format, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0 || strcmp(new_preview_format, CameraParameters::PIXEL_FORMAT_YUV420P) == 0) { @@ -703,13 +703,13 @@ status_t CameraHardware::setParameters(const char* p) } else { - LOGE("Only yuv420sp or yuv420p preview is supported"); + ALOGE("Only yuv420sp or yuv420p preview is supported"); return -EINVAL; } if (strcmp(params.getPictureFormat(), CameraParameters::PIXEL_FORMAT_JPEG) != 0) { - LOGE("Only jpeg still pictures are supported"); + ALOGE("Only jpeg still pictures are supported"); return -EINVAL; } @@ -717,14 +717,14 @@ status_t CameraHardware::setParameters(const char* p) int new_picture_width = 0; int new_picture_height = 0; params.getPictureSize(&new_picture_width, &new_picture_height); - LOGV("%s : new_picture_width x new_picture_height = %dx%d", __FUNCTION__, new_picture_width, new_picture_height); + ALOGV("%s : new_picture_width x new_picture_height = %dx%d", __FUNCTION__, new_picture_width, new_picture_height); if (0 < new_picture_width && 0 < new_picture_height) { mParameters.setPictureSize(new_picture_width, new_picture_height); } else { - LOGE("error picture size"); + ALOGE("error picture size"); return -EINVAL; } @@ -732,7 +732,7 @@ status_t CameraHardware::setParameters(const char* p) int new_preview_width = 0; int new_preview_height = 0; params.getPreviewSize(&new_preview_width, &new_preview_height); - LOGV("%s : new_preview_width x new_preview_height = %dx%d", + ALOGV("%s : new_preview_width x new_preview_height = %dx%d", __FUNCTION__, new_preview_width, new_preview_height); if (0 < new_preview_width && 0 < new_preview_height) { @@ -751,7 +751,7 @@ status_t CameraHardware::setParameters(const char* p) } else { - LOGE("error preview size"); + ALOGE("error preview size"); return -EINVAL; } @@ -766,33 +766,33 @@ status_t CameraHardware::setParameters(const char* p) } else { - LOGE("error preview frame rate"); + ALOGE("error preview frame rate"); return -EINVAL; } // JPEG image quality int new_jpeg_quality = params.getInt(CameraParameters::KEY_JPEG_QUALITY); - LOGV("%s : new_jpeg_quality %d", __FUNCTION__, new_jpeg_quality); + ALOGV("%s : new_jpeg_quality %d", __FUNCTION__, new_jpeg_quality); if (new_jpeg_quality >=1 && new_jpeg_quality <= 100) { mParameters.set(CameraParameters::KEY_JPEG_QUALITY, new_jpeg_quality); } else { - LOGE("error picture quality"); + ALOGE("error picture quality"); return -EINVAL; } // rotation int new_rotation = params.getInt(CameraParameters::KEY_ROTATION); - LOGV("%s : new_rotation %d", __FUNCTION__, new_rotation); + ALOGV("%s : new_rotation %d", __FUNCTION__, new_rotation); if (0 <= new_rotation) { mParameters.set(CameraParameters::KEY_ROTATION, new_rotation); } else { - LOGE("error rotate"); + ALOGE("error rotate"); return -EINVAL; } @@ -816,13 +816,13 @@ status_t CameraHardware::setParameters(const char* p) new_image_effect = V4L2_COLORFX_NEGATIVE; else { //posterize, whiteboard, blackboard, solarize - LOGE("ERR(%s):Invalid effect(%s)", __FUNCTION__, new_image_effect_str); + ALOGE("ERR(%s):Invalid effect(%s)", __FUNCTION__, new_image_effect_str); ret = UNKNOWN_ERROR; } if (new_image_effect >= 0) { if (pV4L2Device->setImageEffect(new_image_effect) < 0) { - LOGE("ERR(%s):Fail on mV4L2Camera->setImageEffect(effect(%d))", __FUNCTION__, new_image_effect); + ALOGE("ERR(%s):Fail on mV4L2Camera->setImageEffect(effect(%d))", __FUNCTION__, new_image_effect); ret = UNKNOWN_ERROR; } else { mParameters.set(CameraParameters::KEY_EFFECT, new_image_effect_str); @@ -835,7 +835,7 @@ status_t CameraHardware::setParameters(const char* p) if (mCameraConfig->supportWhiteBalance()) { const char *new_white_str = params.get(CameraParameters::KEY_WHITE_BALANCE); - LOGV("%s : new_white_str %s", __FUNCTION__, new_white_str); + ALOGV("%s : new_white_str %s", __FUNCTION__, new_white_str); if (new_white_str != NULL) { int new_white = -1; @@ -857,7 +857,7 @@ status_t CameraHardware::setParameters(const char* p) CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT)) new_white = V4L2_WB_TUNGSTEN; else{ - LOGE("ERR(%s):Invalid white balance(%s)", __FUNCTION__, new_white_str); //twilight, shade + ALOGE("ERR(%s):Invalid white balance(%s)", __FUNCTION__, new_white_str); //twilight, shade ret = UNKNOWN_ERROR; } @@ -865,7 +865,7 @@ status_t CameraHardware::setParameters(const char* p) { if (pV4L2Device->setWhiteBalance(new_white) < 0) { - LOGE("ERR(%s):Fail on mV4L2Camera->setWhiteBalance(white(%d))", __FUNCTION__, new_white); + ALOGE("ERR(%s):Fail on mV4L2Camera->setWhiteBalance(white(%d))", __FUNCTION__, new_white); ret = UNKNOWN_ERROR; } else @@ -882,11 +882,11 @@ status_t CameraHardware::setParameters(const char* p) int new_exposure_compensation = params.getInt(CameraParameters::KEY_EXPOSURE_COMPENSATION); int max_exposure_compensation = params.getInt(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION); int min_exposure_compensation = params.getInt(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION); - LOGV("%s : new_exposure_compensation %d", __FUNCTION__, new_exposure_compensation); + ALOGV("%s : new_exposure_compensation %d", __FUNCTION__, new_exposure_compensation); if ((min_exposure_compensation <= new_exposure_compensation) && (max_exposure_compensation >= new_exposure_compensation)) { if (pV4L2Device->setExposure(new_exposure_compensation) < 0) { - LOGE("ERR(%s):Fail on mV4L2Camera->setBrightness(brightness(%d))", __FUNCTION__, new_exposure_compensation); + ALOGE("ERR(%s):Fail on mV4L2Camera->setBrightness(brightness(%d))", __FUNCTION__, new_exposure_compensation); ret = UNKNOWN_ERROR; } else { mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, new_exposure_compensation); @@ -905,7 +905,7 @@ status_t CameraHardware::setParameters(const char* p) if (mCameraConfig->supportZoom()) { int new_zoom = params.getInt(CameraParameters::KEY_ZOOM); - LOGV("new_zoom: %d", new_zoom); + ALOGV("new_zoom: %d", new_zoom); mParameters.set(CameraParameters::KEY_ZOOM, new_zoom); } @@ -913,7 +913,7 @@ status_t CameraHardware::setParameters(const char* p) const char *new_focus_mode_str = params.get(CameraParameters::KEY_FOCUS_MODE); if (strcmp(new_focus_mode_str, CameraParameters::FOCUS_MODE_AUTO)) { - LOGE("invalid focus mode: %s", new_focus_mode_str); + ALOGE("invalid focus mode: %s", new_focus_mode_str); return -EINVAL; } @@ -965,7 +965,7 @@ status_t CameraHardware::setParameters(const char* p) // JPEG thumbnail size int new_jpeg_thumbnail_width = params.getInt(CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH); int new_jpeg_thumbnail_height= params.getInt(CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT); - LOGV("new_jpeg_thumbnail_width: %d, new_jpeg_thumbnail_height: %d", + ALOGV("new_jpeg_thumbnail_width: %d, new_jpeg_thumbnail_height: %d", new_jpeg_thumbnail_width, new_jpeg_thumbnail_height); if (0 <= new_jpeg_thumbnail_width && 0 <= new_jpeg_thumbnail_height) { mCallbackNotifier.setJpegThumbnailSize(new_jpeg_thumbnail_width, new_jpeg_thumbnail_height); @@ -990,7 +990,7 @@ char* CameraHardware::getParameters() strncpy(ret_str, params.string(), params.length()+1); return ret_str; } else { - LOGE("%s: Unable to allocate string for %s", __FUNCTION__, params.string()); + ALOGE("%s: Unable to allocate string for %s", __FUNCTION__, params.string()); /* Apparently, we can't return NULL fron this routine. */ return &lNoParam; } @@ -1007,7 +1007,7 @@ void CameraHardware::putParameters(char* params) status_t CameraHardware::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) { - LOGV("%s: cmd = %d, arg1 = %d, arg2 = %d", __FUNCTION__, cmd, arg1, arg2); + ALOGV("%s: cmd = %d, arg1 = %d, arg2 = %d", __FUNCTION__, cmd, arg1, arg2); /* TODO: Future enhancements. */ @@ -1026,14 +1026,14 @@ status_t CameraHardware::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) void CameraHardware::releaseCamera() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); cleanupCamera(); } status_t CameraHardware::dumpCamera(int fd) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); /* TODO: Future enhancements. */ return -EINVAL; @@ -1045,7 +1045,7 @@ status_t CameraHardware::dumpCamera(int fd) status_t CameraHardware::doStartPreview() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); V4L2Camera* camera_dev = getCameraDevice(); if (camera_dev->isStarted()) { @@ -1096,7 +1096,7 @@ status_t CameraHardware::doStartPreview() pix_fmt = mParameters.getPreviewFormat(); } if (pix_fmt == NULL) { - LOGE("%s: Unable to obtain video format", __FUNCTION__); + ALOGE("%s: Unable to obtain video format", __FUNCTION__); mPreviewWindow.stopPreview(); return EINVAL; } @@ -1109,21 +1109,21 @@ status_t CameraHardware::doStartPreview() org_fmt = V4L2_PIX_FMT_RGB32; } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) { if (bPixFmtNV12) { - LOGV("============== DISP_SEQ_UVUV"); + ALOGV("============== DISP_SEQ_UVUV"); mPreviewWindow.setLayerFormat(DISP_SEQ_UVUV); org_fmt = V4L2_PIX_FMT_NV12; // for HW encoder } else { - LOGV("============== DISP_SEQ_VUVU"); + ALOGV("============== DISP_SEQ_VUVU"); mPreviewWindow.setLayerFormat(DISP_SEQ_VUVU); org_fmt = V4L2_PIX_FMT_NV21; // for some apps } } else { - LOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt); + ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt); mPreviewWindow.stopPreview(); return EINVAL; } - LOGD("Starting camera: %dx%d -> %.4s(%s)", + ALOGD("Starting camera: %dx%d -> %.4s(%s)", width, height, reinterpret_cast(&org_fmt), pix_fmt); res = camera_dev->startDevice(width, height, org_fmt); if (res != NO_ERROR) { @@ -1146,7 +1146,7 @@ status_t CameraHardware::doStartPreview() status_t CameraHardware::doStopPreview() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); // set layer off can avoid Flicker // mPreviewWindow.showLayer(false); @@ -1226,7 +1226,7 @@ int CameraHardware::set_preview_window(struct camera_device* dev, CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->setPreviewWindow(window); @@ -1244,7 +1244,7 @@ void CameraHardware::set_callbacks( CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->setCallbacks(notify_cb, data_cb, data_cb_timestamp, get_memory, user); @@ -1256,7 +1256,7 @@ void CameraHardware::enable_msg_type(struct camera_device* dev, int32_t msg_type CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->enableMsgType(msg_type); @@ -1268,7 +1268,7 @@ void CameraHardware::disable_msg_type(struct camera_device* dev, int32_t msg_typ CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->disableMsgType(msg_type); @@ -1280,7 +1280,7 @@ int CameraHardware::msg_type_enabled(struct camera_device* dev, int32_t msg_type CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->isMsgTypeEnabled(msg_type); @@ -1292,7 +1292,7 @@ int CameraHardware::start_preview(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->startPreview(); @@ -1304,7 +1304,7 @@ void CameraHardware::stop_preview(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->stopPreview(); @@ -1316,7 +1316,7 @@ int CameraHardware::preview_enabled(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->isPreviewEnabled(); @@ -1329,7 +1329,7 @@ int CameraHardware::store_meta_data_in_buffers(struct camera_device* dev, CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->storeMetaDataInBuffers(enable); @@ -1341,7 +1341,7 @@ int CameraHardware::start_recording(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->startRecording(); @@ -1353,7 +1353,7 @@ void CameraHardware::stop_recording(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->stopRecording(); @@ -1365,7 +1365,7 @@ int CameraHardware::recording_enabled(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->isRecordingEnabled(); @@ -1378,7 +1378,7 @@ void CameraHardware::release_recording_frame(struct camera_device* dev, CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->releaseRecordingFrame(opaque); @@ -1390,7 +1390,7 @@ int CameraHardware::auto_focus(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->setAutoFocus(); @@ -1402,7 +1402,7 @@ int CameraHardware::cancel_auto_focus(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->cancelAutoFocus(); @@ -1414,7 +1414,7 @@ int CameraHardware::take_picture(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->takePicture(); @@ -1426,7 +1426,7 @@ int CameraHardware::cancel_picture(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->cancelPicture(); @@ -1438,7 +1438,7 @@ int CameraHardware::set_parameters(struct camera_device* dev, const char* parms) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->setParameters(parms); @@ -1450,7 +1450,7 @@ char* CameraHardware::get_parameters(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return NULL; } return ec->getParameters(); @@ -1462,7 +1462,7 @@ void CameraHardware::put_parameters(struct camera_device* dev, char* params) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->putParameters(params); @@ -1477,7 +1477,7 @@ int CameraHardware::send_command(struct camera_device* dev, CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->sendCommand(cmd, arg1, arg2); @@ -1489,7 +1489,7 @@ void CameraHardware::release(struct camera_device* dev) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return; } ec->releaseCamera(); @@ -1501,7 +1501,7 @@ int CameraHardware::dump(struct camera_device* dev, int fd) CameraHardware* ec = reinterpret_cast(dev->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->dumpCamera(fd); @@ -1514,7 +1514,7 @@ int CameraHardware::close(struct hw_device_t* device) CameraHardware* ec = reinterpret_cast(reinterpret_cast(device)->priv); if (ec == NULL) { - LOGE("%s: Unexpected NULL camera device", __FUNCTION__); + ALOGE("%s: Unexpected NULL camera device", __FUNCTION__); return -EINVAL; } return ec->closeCamera(); @@ -1583,7 +1583,7 @@ static char* AddValue(const char* param, const char* val) const size_t len1 = strlen(param); const size_t len2 = strlen(val); char* ret = reinterpret_cast(malloc(len1 + len2 + 2)); - LOGE_IF(ret == NULL, "%s: Memory failure", __FUNCTION__); + ALOGE_IF(ret == NULL, "%s: Memory failure", __FUNCTION__); if (ret != NULL) { memcpy(ret, param, len1); ret[len1] = ','; @@ -1615,13 +1615,13 @@ static void PrintParamDiff(const CameraParameters& current, const char* in_current = current.get(tmp); if (in_current != NULL) { if (strcmp(in_current, val)) { - LOGD("=== Value changed: %s: %s -> %s", tmp, in_current, val); + ALOGD("=== Value changed: %s: %s -> %s", tmp, in_current, val); } } else { - LOGD("+++ New parameter: %s=%s", tmp, val); + ALOGD("+++ New parameter: %s=%s", tmp, val); } } else { - LOGW("No value separator in %s", tmp); + ALOGW("No value separator in %s", tmp); } wrk = next + 1; next = strchr(wrk, ';'); diff --git a/camera/CameraHardwareDevice.cpp b/camera/CameraHardwareDevice.cpp index bd5de00..4755d4a 100755 --- a/camera/CameraHardwareDevice.cpp +++ b/camera/CameraHardwareDevice.cpp @@ -57,7 +57,7 @@ status_t CameraHardwareDevice::Initialize() mV4L2CameraDevice = new V4L2CameraDevice(this, mCameraID); if (mV4L2CameraDevice == NULL) { - LOGE("Failed to create V4L2Camera instance"); + ALOGE("Failed to create V4L2Camera instance"); return NO_MEMORY; } diff --git a/camera/HALCameraFactory.cpp b/camera/HALCameraFactory.cpp index a36faa7..7a1f406 100755 --- a/camera/HALCameraFactory.cpp +++ b/camera/HALCameraFactory.cpp @@ -47,7 +47,7 @@ HALCameraFactory::HALCameraFactory() mCameraConfig = new CCameraConfig(0); if(mCameraConfig == 0) { - LOGE("create CCameraConfig failed"); + ALOGE("create CCameraConfig failed"); return ; } @@ -61,7 +61,7 @@ HALCameraFactory::HALCameraFactory() if (mHardwareCameras == NULL) { mHardwareCameras = new CameraHardware*[mCameraHardwareNum]; if (mHardwareCameras == NULL) { - LOGE("%s: Unable to allocate V4L2Camera array for %d entries", + ALOGE("%s: Unable to allocate V4L2Camera array for %d entries", __FUNCTION__, mCameraHardwareNum); return; } @@ -84,12 +84,12 @@ HALCameraFactory::HALCameraFactory() else { mHardwareCameras--; - LOGE("%s: Unable to instantiate fake camera class", __FUNCTION__); + ALOGE("%s: Unable to instantiate fake camera class", __FUNCTION__); return; } } - LOGV("%d cameras are being created.", mCameraHardwareNum); + ALOGV("%d cameras are being created.", mCameraHardwareNum); mConstructedOK = true; } @@ -117,17 +117,17 @@ HALCameraFactory::~HALCameraFactory() int HALCameraFactory::cameraDeviceOpen(int camera_id, hw_device_t** device) { - LOGV("%s: id = %d", __FUNCTION__, camera_id); + ALOGV("%s: id = %d", __FUNCTION__, camera_id); *device = NULL; if (!isConstructedOK()) { - LOGE("%s: HALCameraFactory has failed to initialize", __FUNCTION__); + ALOGE("%s: HALCameraFactory has failed to initialize", __FUNCTION__); return -EINVAL; } if (camera_id < 0 || camera_id >= getCameraHardwareNum()) { - LOGE("%s: Camera id %d is out of bounds (%d)", + ALOGE("%s: Camera id %d is out of bounds (%d)", __FUNCTION__, camera_id, getCameraHardwareNum()); return -EINVAL; } @@ -137,15 +137,15 @@ int HALCameraFactory::cameraDeviceOpen(int camera_id, hw_device_t** device) int HALCameraFactory::getCameraInfo(int camera_id, struct camera_info* info) { - LOGV("%s: id = %d", __FUNCTION__, camera_id); + ALOGV("%s: id = %d", __FUNCTION__, camera_id); if (!isConstructedOK()) { - LOGE("%s: HALCameraFactory has failed to initialize", __FUNCTION__); + ALOGE("%s: HALCameraFactory has failed to initialize", __FUNCTION__); return -EINVAL; } if (camera_id < 0 || camera_id >= getCameraHardwareNum()) { - LOGE("%s: Camera id %d is out of bounds (%d)", + ALOGE("%s: Camera id %d is out of bounds (%d)", __FUNCTION__, camera_id, getCameraHardwareNum()); return -EINVAL; } @@ -168,12 +168,12 @@ int HALCameraFactory::device_open(const hw_module_t* module, */ if (module != &HAL_MODULE_INFO_SYM.common) { - LOGE("%s: Invalid module %p expected %p", + ALOGE("%s: Invalid module %p expected %p", __FUNCTION__, module, &HAL_MODULE_INFO_SYM.common); return -EINVAL; } if (name == NULL) { - LOGE("%s: NULL name is not expected here", __FUNCTION__); + ALOGE("%s: NULL name is not expected here", __FUNCTION__); return -EINVAL; } diff --git a/camera/JpegCompressor.cpp b/camera/JpegCompressor.cpp index e1c9cb8..b80a93c 100755 --- a/camera/JpegCompressor.cpp +++ b/camera/JpegCompressor.cpp @@ -21,6 +21,7 @@ #define LOG_TAG "Camera_JPEG" #include "CameraDebug.h" +#include #include "JpegCompressor.h" @@ -44,7 +45,7 @@ status_t NV21JpegCompressor::compressRawImage(const void* image, int height, int quality) { - LOGV("%s: %p[%dx%d]", __FUNCTION__, image, width, height); + ALOGV("%s: %p[%dx%d]", __FUNCTION__, image, width, height); void* pY = const_cast(image); int offsets[2]; offsets[0] = 0; @@ -52,11 +53,11 @@ status_t NV21JpegCompressor::compressRawImage(const void* image, mStrides[0] = width; mStrides[1] = width; if (encode(&mStream, pY, width, height, offsets, quality)) { - LOGV("%s: Compressed JPEG: %d[%dx%d] -> %d bytes", + ALOGV("%s: Compressed JPEG: %d[%dx%d] -> %d bytes", __FUNCTION__, (width * height * 12) / 8, width, height, mStream.getOffset()); return NO_ERROR; } else { - LOGE("%s: JPEG compression failed", __FUNCTION__); + ALOGE("%s: JPEG compression failed", __FUNCTION__); return errno ? errno : EINVAL; } } diff --git a/camera/PreviewWindow.cpp b/camera/PreviewWindow.cpp index d1ca3d9..6343881 100755 --- a/camera/PreviewWindow.cpp +++ b/camera/PreviewWindow.cpp @@ -56,7 +56,7 @@ PreviewWindow::~PreviewWindow() status_t PreviewWindow::setPreviewWindow(struct preview_stream_ops* window, int preview_fps) { - LOGV("%s: current: %p -> new: %p", __FUNCTION__, mPreviewWindow, window); + ALOGV("%s: current: %p -> new: %p", __FUNCTION__, mPreviewWindow, window); status_t res = NO_ERROR; Mutex::Autolock locker(&mObjectLock); @@ -72,7 +72,7 @@ status_t PreviewWindow::setPreviewWindow(struct preview_stream_ops* window, if (res != NO_ERROR) { window = NULL; res = -res; // set_usage returns a negative errno. - LOGE("%s: Error setting preview window usage %d -> %s", + ALOGE("%s: Error setting preview window usage %d -> %s", __FUNCTION__, res, strerror(res)); } } @@ -83,7 +83,7 @@ status_t PreviewWindow::setPreviewWindow(struct preview_stream_ops* window, status_t PreviewWindow::startPreview() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); Mutex::Autolock locker(&mObjectLock); mPreviewEnabled = true; @@ -94,7 +94,7 @@ status_t PreviewWindow::startPreview() void PreviewWindow::stopPreview() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); Mutex::Autolock locker(&mObjectLock); mPreviewEnabled = false; @@ -136,7 +136,7 @@ bool PreviewWindow::onNextFrameAvailableHW(const void* frame, /* Make sure that preview window dimensions are OK with the camera device */ if (adjustPreviewDimensions(camera_dev) || mShouldAdjustDimensions) { - LOGD("%s: Adjusting preview windows %p geometry to %dx%d", + ALOGD("%s: Adjusting preview windows %p geometry to %dx%d", __FUNCTION__, mPreviewWindow, mPreviewFrameWidth, mPreviewFrameHeight); res = mPreviewWindow->set_buffers_geometryex(mPreviewWindow, @@ -145,7 +145,7 @@ bool PreviewWindow::onNextFrameAvailableHW(const void* frame, HWC_FORMAT_DEFAULT, 0); if (res != NO_ERROR) { - LOGE("%s: Error in set_buffers_geometry %d -> %s", + ALOGE("%s: Error in set_buffers_geometry %d -> %s", __FUNCTION__, -res, strerror(-res)); mShouldAdjustDimensions = true; @@ -170,7 +170,7 @@ bool PreviewWindow::onNextFrameAvailableHW(const void* frame, if (mOverlayFirstFrame) { - LOGD("first frame true"); + ALOGD("first frame true"); overlay_para.first_frame_flg = 1; mOverlayFirstFrame = false; } @@ -179,12 +179,12 @@ bool PreviewWindow::onNextFrameAvailableHW(const void* frame, overlay_para.first_frame_flg = 0; } - // LOGV("addrY: %x, addrC: %x, WXH: %dx%d", overlay_para.top_y, overlay_para.top_c, mPreviewFrameWidth, mPreviewFrameHeight); + // ALOGV("addrY: %x, addrC: %x, WXH: %dx%d", overlay_para.top_y, overlay_para.top_c, mPreviewFrameWidth, mPreviewFrameHeight); res = mPreviewWindow->perform(mPreviewWindow, NATIVE_WINDOW_SETPARAMETER, HWC_LAYER_SETFRAMEPARA, (uint32_t)&overlay_para); if (res != OK) { - LOGE("NATIVE_WINDOW_SETPARAMETER failed"); + ALOGE("NATIVE_WINDOW_SETPARAMETER failed"); return false; } @@ -203,7 +203,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, int res; Mutex::Autolock locker(&mObjectLock); - // LOGD("%s, timestamp: %lld", __FUNCTION__, timestamp); + // ALOGD("%s, timestamp: %lld", __FUNCTION__, timestamp); if (!isPreviewEnabled() || mPreviewWindow == NULL) { @@ -215,7 +215,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, /* Need to set / adjust buffer geometry for the preview window. * Note that in the emulator preview window uses only RGB for pixel * formats. */ - LOGD("%s: Adjusting preview windows %p geometry to %dx%d", + ALOGD("%s: Adjusting preview windows %p geometry to %dx%d", __FUNCTION__, mPreviewWindow, mPreviewFrameWidth, mPreviewFrameHeight); res = mPreviewWindow->set_buffers_geometry(mPreviewWindow, @@ -223,7 +223,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, mPreviewFrameHeight, HAL_PIXEL_FORMAT_RGBA_8888); if (res != NO_ERROR) { - LOGE("%s: Error in set_buffers_geometry %d -> %s", + ALOGE("%s: Error in set_buffers_geometry %d -> %s", __FUNCTION__, -res, strerror(-res)); // return false; } @@ -239,7 +239,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, int stride = 0; res = mPreviewWindow->dequeue_buffer(mPreviewWindow, &buffer, &stride); if (res != NO_ERROR || buffer == NULL) { - LOGE("%s: Unable to dequeue preview window buffer: %d -> %s", + ALOGE("%s: Unable to dequeue preview window buffer: %d -> %s", __FUNCTION__, -res, strerror(-res)); return false; } @@ -247,7 +247,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, /* Let the preview window to lock the buffer. */ res = mPreviewWindow->lock_buffer(mPreviewWindow, buffer); if (res != NO_ERROR) { - LOGE("%s: Unable to lock preview window buffer: %d -> %s", + ALOGE("%s: Unable to lock preview window buffer: %d -> %s", __FUNCTION__, -res, strerror(-res)); mPreviewWindow->cancel_buffer(mPreviewWindow, buffer); return false; @@ -260,7 +260,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, GraphicBufferMapper& grbuffer_mapper(GraphicBufferMapper::get()); res = grbuffer_mapper.lock(*buffer, GRALLOC_USAGE_SW_WRITE_OFTEN, rect, &img); if (res != NO_ERROR) { - LOGE("%s: grbuffer_mapper.lock failure: %d -> %s", + ALOGE("%s: grbuffer_mapper.lock failure: %d -> %s", __FUNCTION__, res, strerror(res)); mPreviewWindow->cancel_buffer(mPreviewWindow, buffer); return false; @@ -273,7 +273,7 @@ bool PreviewWindow::onNextFrameAvailableSW(const void* frame, /* Show it. */ mPreviewWindow->enqueue_buffer(mPreviewWindow, buffer); } else { - LOGE("%s: Unable to obtain preview frame: %d", __FUNCTION__, res); + ALOGE("%s: Unable to obtain preview frame: %d", __FUNCTION__, res); mPreviewWindow->cancel_buffer(mPreviewWindow, buffer); } grbuffer_mapper.unlock(*buffer); @@ -305,7 +305,7 @@ bool PreviewWindow::adjustPreviewDimensions(V4L2Camera* camera_dev) int PreviewWindow::showLayer(bool on) { - LOGV("%s, %s", __FUNCTION__, on ? "on" : "off"); + ALOGV("%s, %s", __FUNCTION__, on ? "on" : "off"); mLayerShowHW = on ? 1 : 0; if (mPreviewWindow != NULL) { @@ -316,7 +316,7 @@ int PreviewWindow::showLayer(bool on) int PreviewWindow::setLayerFormat(int fmt) { - LOGV("%s, %d", __FUNCTION__, fmt); + ALOGV("%s, %d", __FUNCTION__, fmt); mLayerFormat = fmt; mShouldAdjustDimensions = true; return OK; @@ -324,7 +324,7 @@ int PreviewWindow::setLayerFormat(int fmt) int PreviewWindow::setScreenID(int id) { - LOGV("%s, id: %d", __FUNCTION__, id); + ALOGV("%s, id: %d", __FUNCTION__, id); mScreenID = id; if (mPreviewWindow != NULL) { diff --git a/camera/V4L2Camera.cpp b/camera/V4L2Camera.cpp index ab5692e..fa93a44 100755 --- a/camera/V4L2Camera.cpp +++ b/camera/V4L2Camera.cpp @@ -61,7 +61,7 @@ status_t V4L2Camera::Initialize() { F_LOG; if (isInitialized()) { - LOGW("%s: V4L2Camera device is already initialized: mState = %d", + ALOGW("%s: V4L2Camera device is already initialized: mState = %d", __FUNCTION__, mState); return NO_ERROR; } @@ -69,7 +69,7 @@ status_t V4L2Camera::Initialize() /* Instantiate worker thread object. */ mWorkerThread = new WorkerThread(this); if (getWorkerThread() == NULL) { - LOGE("%s: Unable to instantiate worker thread object", __FUNCTION__); + ALOGE("%s: Unable to instantiate worker thread object", __FUNCTION__); return ENOMEM; } @@ -80,51 +80,51 @@ status_t V4L2Camera::Initialize() status_t V4L2Camera::startDeliveringFrames(bool one_burst) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); mStartDeliverTimeUs = systemTime() / 1000; if (!isStarted()) { - LOGE("%s: Device is not started", __FUNCTION__); + ALOGE("%s: Device is not started", __FUNCTION__); return EINVAL; } /* Frames will be delivered from the thread routine. */ const status_t res = startWorkerThread(one_burst); - LOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__); + ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__); return res; } status_t V4L2Camera::stopDeliveringFrames() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); // for CTS, V4L2Camera::WorkerThread::readyToRun must be called before stopDeliveringFrames int64_t nowTimeUs = systemTime() / 1000; if (nowTimeUs - mStartDeliverTimeUs < 1000000) { - LOGW("should not stop preview so quickly, to delay 1 sec ......"); + ALOGW("should not stop preview so quickly, to delay 1 sec ......"); // usleep(1000000); } if (!isStarted()) { - LOGW("%s: Device is not started", __FUNCTION__); + ALOGW("%s: Device is not started", __FUNCTION__); return NO_ERROR; } const status_t res = stopWorkerThread(); - LOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__); + ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__); return res; } status_t V4L2Camera::getCurrentPreviewFrame(void* buffer) { if (!isStarted()) { - LOGE("%s: Device is not started", __FUNCTION__); + ALOGE("%s: Device is not started", __FUNCTION__); return EINVAL; } if (mCurrentFrame == NULL || buffer == NULL) { - LOGE("%s: No framebuffer", __FUNCTION__); + ALOGE("%s: No framebuffer", __FUNCTION__); return EINVAL; } @@ -144,7 +144,7 @@ status_t V4L2Camera::getCurrentPreviewFrame(void* buffer) return NO_ERROR; default: - LOGE("%s: Unknown pixel format %.4s", + ALOGE("%s: Unknown pixel format %.4s", __FUNCTION__, reinterpret_cast(&mPixelFormat)); return EINVAL; } @@ -170,7 +170,7 @@ status_t V4L2Camera::commonStartDevice(int width, break; default: - LOGE("%s: Unknown pixel format %.4s", + ALOGE("%s: Unknown pixel format %.4s", __FUNCTION__, reinterpret_cast(&pix_fmt)); return EINVAL; } @@ -184,10 +184,10 @@ status_t V4L2Camera::commonStartDevice(int width, /* Allocate framebuffer. */ mCurrentFrame = new uint8_t[mFrameBufferSize]; if (mCurrentFrame == NULL) { - LOGE("%s: Unable to allocate framebuffer", __FUNCTION__); + ALOGE("%s: Unable to allocate framebuffer", __FUNCTION__); return ENOMEM; } - LOGV("%s: Allocated %p %d bytes for %d pixels in %.4s[%dx%d] frame", + ALOGV("%s: Allocated %p %d bytes for %d pixels in %.4s[%dx%d] frame", __FUNCTION__, mCurrentFrame, mFrameBufferSize, mTotalPixels, reinterpret_cast(&mPixelFormat), mFrameWidth, mFrameHeight); @@ -212,29 +212,29 @@ void V4L2Camera::commonStopDevice() status_t V4L2Camera::startWorkerThread(bool one_burst) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (!isInitialized()) { - LOGE("%s: V4L2Camera device is not initialized", __FUNCTION__); + ALOGE("%s: V4L2Camera device is not initialized", __FUNCTION__); return EINVAL; } const status_t res = getWorkerThread()->startThread(one_burst); - LOGE_IF(res != NO_ERROR, "%s: Unable to start worker thread", __FUNCTION__); + ALOGE_IF(res != NO_ERROR, "%s: Unable to start worker thread", __FUNCTION__); return res; } status_t V4L2Camera::stopWorkerThread() { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (!isInitialized()) { - LOGE("%s: V4L2Camera device is not initialized", __FUNCTION__); + ALOGE("%s: V4L2Camera device is not initialized", __FUNCTION__); return EINVAL; } const status_t res = getWorkerThread()->stopThread(); - LOGE_IF(res != NO_ERROR, "%s: Unable to stop worker thread", __FUNCTION__); + ALOGE_IF(res != NO_ERROR, "%s: Unable to stop worker thread", __FUNCTION__); return res; } @@ -252,19 +252,19 @@ bool V4L2Camera::inWorkerThread() status_t V4L2Camera::WorkerThread::readyToRun() { - LOGV("Starting V4L2Camera device worker thread..."); + ALOGV("Starting V4L2Camera device worker thread..."); - LOGW_IF(mThreadControl >= 0 || mControlFD >= 0, + ALOGW_IF(mThreadControl >= 0 || mControlFD >= 0, "%s: Thread control FDs are opened", __FUNCTION__); /* Create a pair of FDs that would be used to control the thread. */ int thread_fds[2]; if (pipe(thread_fds) == 0) { mThreadControl = thread_fds[1]; mControlFD = thread_fds[0]; - LOGV("V4L2Camera's worker thread has been started."); + ALOGV("V4L2Camera's worker thread has been started."); return NO_ERROR; } else { - LOGE("%s: Unable to create thread control FDs: %d -> %s", + ALOGE("%s: Unable to create thread control FDs: %d -> %s", __FUNCTION__, errno, strerror(errno)); return errno; } @@ -272,7 +272,7 @@ status_t V4L2Camera::WorkerThread::readyToRun() status_t V4L2Camera::WorkerThread::stopThread() { - LOGV("Stopping V4L2Camera device's worker thread..."); + ALOGV("Stopping V4L2Camera device's worker thread..."); status_t res = EINVAL; if (mThreadControl >= 0) { @@ -293,21 +293,21 @@ status_t V4L2Camera::WorkerThread::stopThread() close(mControlFD); mControlFD = -1; } - LOGV("V4L2Camera device's worker thread has been stopped."); + ALOGV("V4L2Camera device's worker thread has been stopped."); } else { - LOGE("%s: requestExitAndWait failed: %d -> %s", + ALOGE("%s: requestExitAndWait failed: %d -> %s", __FUNCTION__, res, strerror(-res)); } } else { - LOGE("%s: Unable to send THREAD_STOP message: %d -> %s", + ALOGE("%s: Unable to send THREAD_STOP message: %d -> %s", __FUNCTION__, errno, strerror(errno)); res = errno ? errno : EINVAL; } } else { - LOGE("%s: Thread control FDs are not opened", __FUNCTION__); + ALOGE("%s: Thread control FDs are not opened", __FUNCTION__); } - LOGV("Stopping V4L2Camera device's worker thread... OK"); + ALOGV("Stopping V4L2Camera device's worker thread... OK"); return res; } @@ -333,7 +333,7 @@ V4L2Camera::WorkerThread::Select(int fd, int timeout) } int res = TEMP_FAILURE_RETRY(select(fd_num, fds, NULL, NULL, tvp)); if (res < 0) { - LOGE("%s: select returned %d and failed: %d -> %s", + ALOGE("%s: select returned %d and failed: %d -> %s", __FUNCTION__, res, errno, strerror(errno)); return ERROR; } else if (res == 0) { @@ -344,21 +344,21 @@ V4L2Camera::WorkerThread::Select(int fd, int timeout) ControlMessage msg; res = TEMP_FAILURE_RETRY(read(mControlFD, &msg, sizeof(msg))); if (res != sizeof(msg)) { - LOGE("%s: Unexpected message size %d, or an error %d -> %s", + ALOGE("%s: Unexpected message size %d, or an error %d -> %s", __FUNCTION__, res, errno, strerror(errno)); return ERROR; } /* THREAD_STOP is the only message expected here. */ if (msg == THREAD_STOP) { - LOGV("%s: THREAD_STOP message is received", __FUNCTION__); + ALOGV("%s: THREAD_STOP message is received", __FUNCTION__); return EXIT_THREAD; } else { - LOGE("Unknown worker thread message %d", msg); + ALOGE("Unknown worker thread message %d", msg); return ERROR; } } else { /* Must be an FD. */ - LOGW_IF(fd < 0 || !FD_ISSET(fd, fds), "%s: Undefined 'select' result", + ALOGW_IF(fd < 0 || !FD_ISSET(fd, fds), "%s: Undefined 'select' result", __FUNCTION__); return READY; } diff --git a/camera/V4L2Camera.h b/camera/V4L2Camera.h index e6dfdc9..5962a13 100755 --- a/camera/V4L2Camera.h +++ b/camera/V4L2Camera.h @@ -170,7 +170,7 @@ class V4L2Camera { */ inline int getFrameWidth() const { - LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); + ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); return mFrameWidth; } @@ -182,7 +182,7 @@ class V4L2Camera { */ inline int getFrameHeight() const { - LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); + ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); return mFrameHeight; } @@ -193,7 +193,7 @@ class V4L2Camera { */ inline size_t getFrameBufferSize() const { - LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); + ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); return mFrameBufferSize; } @@ -204,7 +204,7 @@ class V4L2Camera { */ inline int getPixelNum() const { - LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); + ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); return mTotalPixels; } @@ -230,7 +230,7 @@ class V4L2Camera { */ inline uint32_t getOriginalPixelFormat() const { - LOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); + ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__); return mPixelFormat; } @@ -332,7 +332,7 @@ class V4L2Camera { inline ~WorkerThread() { - LOGW_IF(mThreadControl >= 0 || mControlFD >= 0, + ALOGW_IF(mThreadControl >= 0 || mControlFD >= 0, "%s: Control FDs are opened in the destructor", __FUNCTION__); if (mThreadControl >= 0) { diff --git a/camera/V4L2CameraDevice.cpp b/camera/V4L2CameraDevice.cpp index 682fe98..2b07ce8 100755 --- a/camera/V4L2CameraDevice.cpp +++ b/camera/V4L2CameraDevice.cpp @@ -81,11 +81,11 @@ status_t V4L2CameraDevice::connectDevice() Mutex::Autolock locker(&mObjectLock); if (!isInitialized()) { - LOGE("%s: Fake camera device is not initialized.", __FUNCTION__); + ALOGE("%s: Fake camera device is not initialized.", __FUNCTION__); return EINVAL; } if (isConnected()) { - LOGW("%s: Fake camera device is already connected.", __FUNCTION__); + ALOGW("%s: Fake camera device is already connected.", __FUNCTION__); return NO_ERROR; } @@ -99,10 +99,10 @@ status_t V4L2CameraDevice::connectDevice() ret = cedarx_hardware_init(2);// CEDARX_HARDWARE_MODE_VIDEO if (ret < 0) { - LOGE("cedarx_hardware_init failed"); + ALOGE("cedarx_hardware_init failed"); return -1; } - LOGD("cedarx_hardware_init ok"); + ALOGD("cedarx_hardware_init ok"); for (int i = 0; i < 2; i++) { @@ -110,7 +110,7 @@ status_t V4L2CameraDevice::connectDevice() mPreviewBuffer.buf_vir_addr[i] = (int)cedara_phymalloc_map(buffer_len, 1024); mPreviewBuffer.buf_phy_addr[i] = cedarv_address_vir2phy((void*)mPreviewBuffer.buf_vir_addr[i]); mPreviewBuffer.buf_phy_addr[i] |= 0x40000000; - LOGD("preview buffer: index: %d, vir: %x, phy: %x, len: %x", + ALOGD("preview buffer: index: %d, vir: %x, phy: %x, len: %x", i, mPreviewBuffer.buf_vir_addr[i], mPreviewBuffer.buf_phy_addr[i], buffer_len); memset((void*)mPreviewBuffer.buf_vir_addr[i], 0x10, MAX_PREVIEW_WIDTH * MAX_PREVIEW_HEIGHT); @@ -130,11 +130,11 @@ status_t V4L2CameraDevice::disconnectDevice() Mutex::Autolock locker(&mObjectLock); if (!isConnected()) { - LOGW("%s: Fake camera device is already disconnected.", __FUNCTION__); + ALOGW("%s: Fake camera device is already disconnected.", __FUNCTION__); return NO_ERROR; } if (isStarted()) { - LOGE("%s: Cannot disconnect from the started device.", __FUNCTION__); + ALOGE("%s: Cannot disconnect from the started device.", __FUNCTION__); return EINVAL; } @@ -150,9 +150,9 @@ status_t V4L2CameraDevice::disconnectDevice() int ret = cedarx_hardware_exit(2);// CEDARX_HARDWARE_MODE_VIDEO if (ret < 0) { - LOGE("cedarx_hardware_exit failed\n"); + ALOGE("cedarx_hardware_exit failed\n"); } - LOGD("cedarx_hardware_exit ok"); + ALOGD("cedarx_hardware_exit ok"); /* There is no device to disconnect from. */ mState = ECDS_INITIALIZED; @@ -164,15 +164,15 @@ status_t V4L2CameraDevice::startDevice(int width, int height, uint32_t pix_fmt) { - LOGD("%s, wxh: %dx%d, fmt: %d", __FUNCTION__, width, height, pix_fmt); + ALOGD("%s, wxh: %dx%d, fmt: %d", __FUNCTION__, width, height, pix_fmt); Mutex::Autolock locker(&mObjectLock); if (!isConnected()) { - LOGE("%s: Fake camera device is not connected.", __FUNCTION__); + ALOGE("%s: Fake camera device is not connected.", __FUNCTION__); return EINVAL; } if (isStarted()) { - LOGE("%s: Fake camera device is already started.", __FUNCTION__); + ALOGE("%s: Fake camera device is already started.", __FUNCTION__); return EINVAL; } @@ -201,7 +201,7 @@ status_t V4L2CameraDevice::startDevice(int width, // front camera do not use hw preview, SW preview will mirror it if (mCameraFacing == CAMERA_FACING_FRONT) { - LOGD("do not us hw preview"); + ALOGD("do not us hw preview"); mPreviewUseHW = false; int pix = mFrameWidth * mFrameHeight; @@ -221,11 +221,11 @@ status_t V4L2CameraDevice::startDevice(int width, status_t V4L2CameraDevice::stopDevice() { - LOGD("stopDevice"); + ALOGD("stopDevice"); Mutex::Autolock locker(&mObjectLock); if (!isStarted()) { - LOGW("%s: camera device is not started.", __FUNCTION__); + ALOGW("%s: camera device is not started.", __FUNCTION__); return NO_ERROR; } @@ -254,7 +254,7 @@ bool V4L2CameraDevice::inWorkerThread() WorkerThread::SelectRes res = getWorkerThread()->Select(mCamFd, 2000); if (res == WorkerThread::EXIT_THREAD) { - LOGV("%s: Worker thread has been terminated.", __FUNCTION__); + ALOGV("%s: Worker thread has been terminated.", __FUNCTION__); return false; } @@ -278,12 +278,12 @@ bool V4L2CameraDevice::inWorkerThread() v4l2_buf.index = buf.index; v4l2_buf.timeStamp = mCurFrameTimestamp; - // LOGV("DQBUF: addrPhyY: %x, id: %d, time: %lld", v4l2_buf.addrPhyY, buf.index, mCurFrameTimestamp); + // ALOGV("DQBUF: addrPhyY: %x, id: %d, time: %lld", v4l2_buf.addrPhyY, buf.index, mCurFrameTimestamp); #define __HW_PICTURE__ 1 if (mTakingPicture) { - LOGD("%s, taking picture", __FUNCTION__); + ALOGD("%s, taking picture", __FUNCTION__); int64_t lastTime = systemTime() / 1000; #if __HW_PICTURE__ @@ -295,7 +295,7 @@ bool V4L2CameraDevice::inWorkerThread() #endif // __HW_PICTURE__ int64_t nowTime = systemTime() / 1000; - LOGD("%s picture size: %dx%d takes %lld (ms)", (__HW_PICTURE__ == 1) ? "hw" : "sw", + ALOGD("%s picture size: %dx%d takes %lld (ms)", (__HW_PICTURE__ == 1) ? "hw" : "sw", mFrameWidth, mFrameHeight, (nowTime - lastTime) / 1000); mTakingPicture = false; @@ -402,7 +402,7 @@ void V4L2CameraDevice::dealWithVideoFrameTest(V4L2BUF_t * pBuf) // copy buffer memcpy(mCurrentFrame, mMapMem.mem[pBuf->index], mMapMem.length); // mCurrentFrame = (uint8_t*)mMapMem.mem[pBuf->index]; - // LOGV("mCurrentFrame: %x", mCurrentFrame); + // ALOGV("mCurrentFrame: %x", mCurrentFrame); mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this, false); releasePreviewFrame(pBuf->index); @@ -417,7 +417,7 @@ int V4L2CameraDevice::openCameraDev() mCamFd = open(mDeviceName, O_RDWR | O_NONBLOCK, 0); if (mCamFd == -1) { - LOGE("ERROR opening V4L interface: %s", strerror(errno)); + ALOGE("ERROR opening V4L interface: %s", strerror(errno)); return -1; } @@ -427,7 +427,7 @@ int V4L2CameraDevice::openCameraDev() inp.index = 1; if (-1 == ioctl (mCamFd, VIDIOC_S_INPUT, &inp)) { - LOGE("VIDIOC_S_INPUT error!\n"); + ALOGE("VIDIOC_S_INPUT error!\n"); return -1; } } @@ -438,19 +438,19 @@ int V4L2CameraDevice::openCameraDev() ret = ioctl (mCamFd, VIDIOC_QUERYCAP, &cap); if (ret < 0) { - LOGE("Error opening device: unable to query device."); + ALOGE("Error opening device: unable to query device."); return -1; } if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { - LOGE("Error opening device: video capture not supported."); + ALOGE("Error opening device: video capture not supported."); return -1; } if ((cap.capabilities & V4L2_CAP_STREAMING) == 0) { - LOGE("Capture device does not support streaming i/o"); + ALOGE("Capture device does not support streaming i/o"); return -1; } @@ -473,7 +473,7 @@ int V4L2CameraDevice::v4l2SetVideoParams(int width, int height, uint32_t pix_fmt int ret = UNKNOWN_ERROR; struct v4l2_format format; - LOGV("%s, line: %d, w: %d, h: %d, pfmt: %d", + ALOGV("%s, line: %d, w: %d, h: %d, pfmt: %d", __FUNCTION__, __LINE__, width, height, pix_fmt); memset(&format, 0, sizeof(format)); @@ -486,13 +486,13 @@ int V4L2CameraDevice::v4l2SetVideoParams(int width, int height, uint32_t pix_fmt ret = ioctl(mCamFd, VIDIOC_S_FMT, &format); if (ret < 0) { - LOGE("VIDIOC_S_FMT Failed: %s", strerror(errno)); + ALOGE("VIDIOC_S_FMT Failed: %s", strerror(errno)); return ret; } mFrameWidth = format.fmt.pix.width; mFrameHeight= format.fmt.pix.height; - LOGV("camera params: w: %d, h: %d, pfmt: %d, pfield: %d", + ALOGV("camera params: w: %d, h: %d, pfmt: %d, pfield: %d", mFrameWidth, mFrameHeight, pix_fmt, V4L2_FIELD_NONE); return OK; @@ -513,7 +513,7 @@ int V4L2CameraDevice::v4l2ReqBufs() mBufferCnt = NB_BUFFER; } - LOGD("TO VIDIOC_REQBUFS count: %d", mBufferCnt); + ALOGD("TO VIDIOC_REQBUFS count: %d", mBufferCnt); memset(&rb, 0, sizeof(rb)); rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -523,14 +523,14 @@ int V4L2CameraDevice::v4l2ReqBufs() ret = ioctl(mCamFd, VIDIOC_REQBUFS, &rb); if (ret < 0) { - LOGE("Init: VIDIOC_REQBUFS failed: %s", strerror(errno)); + ALOGE("Init: VIDIOC_REQBUFS failed: %s", strerror(errno)); return ret; } if (mBufferCnt != rb.count) { mBufferCnt = rb.count; - LOGD("VIDIOC_REQBUFS count: %d", mBufferCnt); + ALOGD("VIDIOC_REQBUFS count: %d", mBufferCnt); } return OK; @@ -552,7 +552,7 @@ int V4L2CameraDevice::v4l2QueryBuf() ret = ioctl (mCamFd, VIDIOC_QUERYBUF, &buf); if (ret < 0) { - LOGE("Unable to query buffer (%s)", strerror(errno)); + ALOGE("Unable to query buffer (%s)", strerror(errno)); return ret; } @@ -562,11 +562,11 @@ int V4L2CameraDevice::v4l2QueryBuf() mCamFd, buf.m.offset); mMapMem.length = buf.length; - LOGV("index: %d, mem: %x, len: %x, offset: %x", i, (int)mMapMem.mem[i], buf.length, buf.m.offset); + ALOGV("index: %d, mem: %x, len: %x, offset: %x", i, (int)mMapMem.mem[i], buf.length, buf.m.offset); if (mMapMem.mem[i] == MAP_FAILED) { - LOGE("Unable to map buffer (%s)", strerror(errno)); + ALOGE("Unable to map buffer (%s)", strerror(errno)); return -1; } @@ -574,7 +574,7 @@ int V4L2CameraDevice::v4l2QueryBuf() ret = ioctl(mCamFd, VIDIOC_QBUF, &buf); if (ret < 0) { - LOGE("VIDIOC_QBUF Failed"); + ALOGE("VIDIOC_QBUF Failed"); return ret; } } @@ -591,7 +591,7 @@ int V4L2CameraDevice::v4l2StartStreaming() ret = ioctl (mCamFd, VIDIOC_STREAMON, &type); if (ret < 0) { - LOGE("StartStreaming: Unable to start capture: %s", strerror(errno)); + ALOGE("StartStreaming: Unable to start capture: %s", strerror(errno)); return ret; } @@ -607,10 +607,10 @@ int V4L2CameraDevice::v4l2StopStreaming() ret = ioctl (mCamFd, VIDIOC_STREAMOFF, &type); if (ret < 0) { - LOGE("StopStreaming: Unable to stop capture: %s", strerror(errno)); + ALOGE("StopStreaming: Unable to stop capture: %s", strerror(errno)); return ret; } - LOGV("V4L2Camera::v4l2StopStreaming OK"); + ALOGV("V4L2Camera::v4l2StopStreaming OK"); return OK; } @@ -625,7 +625,7 @@ int V4L2CameraDevice::v4l2UnmapBuf() ret = munmap(mMapMem.mem[i], mMapMem.length); if (ret < 0) { - LOGE("v4l2CloseBuf Unmap failed"); + ALOGE("v4l2CloseBuf Unmap failed"); return ret; } } @@ -643,12 +643,12 @@ void V4L2CameraDevice::releasePreviewFrame(int index) buf.memory = V4L2_MEMORY_MMAP; buf.index = index; - // LOGV("r ID: %d", buf.index); + // ALOGV("r ID: %d", buf.index); ret = ioctl(mCamFd, VIDIOC_QBUF, &buf); if (ret != 0) { // comment for temp, to do - // LOGE("releasePreviewFrame: VIDIOC_QBUF Failed: index = %d, ret = %d, %s", + // ALOGE("releasePreviewFrame: VIDIOC_QBUF Failed: index = %d, ret = %d, %s", // buf.index, ret, strerror(errno)); } } @@ -663,7 +663,7 @@ int V4L2CameraDevice::getPreviewFrame(v4l2_buffer *buf) ret = ioctl(mCamFd, VIDIOC_DQBUF, buf); if (ret < 0) { - // LOGE("GetPreviewFrame: VIDIOC_DQBUF Failed"); + // ALOGE("GetPreviewFrame: VIDIOC_DQBUF Failed"); return __LINE__; // can not return false } @@ -676,7 +676,7 @@ int V4L2CameraDevice::tryFmtSize(int * width, int * height) int ret = -1; struct v4l2_format fmt; - LOGV("V4L2Camera::TryFmtSize: w: %d, h: %d", *width, *height); + ALOGV("V4L2Camera::TryFmtSize: w: %d, h: %d", *width, *height); memset(&fmt, 0, sizeof(fmt)); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -688,7 +688,7 @@ int V4L2CameraDevice::tryFmtSize(int * width, int * height) ret = ioctl(mCamFd, VIDIOC_TRY_FMT, &fmt); if (ret < 0) { - LOGE("VIDIOC_TRY_FMT Failed: %s", strerror(errno)); + ALOGE("VIDIOC_TRY_FMT Failed: %s", strerror(errno)); return ret; } @@ -709,7 +709,7 @@ int V4L2CameraDevice::setV4L2DeviceName(char * pname) } strncpy(mDeviceName, pname, strlen(pname)); - LOGV("%s: %s", __FUNCTION__, mDeviceName); + ALOGV("%s: %s", __FUNCTION__, mDeviceName); return OK; } @@ -733,14 +733,14 @@ int V4L2CameraDevice::getFrameRate() ret = ioctl (mCamFd, VIDIOC_G_PARM, &parms); if (ret < 0) { - LOGE("VIDIOC_G_PARM getFrameRate error\n"); + ALOGE("VIDIOC_G_PARM getFrameRate error\n"); return ret; } int numerator = parms.parm.capture.timeperframe.numerator; int denominator = parms.parm.capture.timeperframe.denominator; - LOGV("frame rate: numerator = %d, denominator = %d\n", numerator, denominator); + ALOGV("frame rate: numerator = %d, denominator = %d\n", numerator, denominator); return denominator / numerator; } @@ -762,9 +762,9 @@ int V4L2CameraDevice::setImageEffect(int effect) ctrl.value = effect; ret = ioctl(mCamFd, VIDIOC_S_CTRL, &ctrl); if (ret < 0) - LOGV("setImageEffect failed!"); + ALOGV("setImageEffect failed!"); else - LOGV("setImageEffect ok"); + ALOGV("setImageEffect ok"); return ret; } @@ -778,9 +778,9 @@ int V4L2CameraDevice::setWhiteBalance(int wb) ctrl.value = wb; ret = ioctl(mCamFd, VIDIOC_S_CTRL, &ctrl); if (ret < 0) - LOGV("setWhiteBalance failed!"); + ALOGV("setWhiteBalance failed!"); else - LOGV("setWhiteBalance ok"); + ALOGV("setWhiteBalance ok"); return ret; } @@ -795,9 +795,9 @@ int V4L2CameraDevice::setExposure(int exp) ctrl.value = exp; ret = ioctl(mCamFd, VIDIOC_S_CTRL, &ctrl); if (ret < 0) - LOGV("setExposure failed!"); + ALOGV("setExposure failed!"); else - LOGV("setExposure ok"); + ALOGV("setExposure ok"); return ret; } @@ -813,9 +813,9 @@ int V4L2CameraDevice::setFlashMode(int mode) ctrl.value = mode; ret = ioctl(mCamFd, VIDIOC_S_CTRL, &ctrl); if (ret < 0) - LOGV("setFlashMode failed!"); + ALOGV("setFlashMode failed!"); else - LOGV("setFlashMode ok"); + ALOGV("setFlashMode ok"); return ret; }