Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update a10 camera source #1

Open
wants to merge 1 commit into
base: jellybean
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion camera/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 \

Expand All @@ -58,4 +62,4 @@ LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)

LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)

#endif
44 changes: 22 additions & 22 deletions camera/CCameraConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -27,7 +27,7 @@
} \
else \
{ \
LOGV("\"%s\" not support", kUSED_##KEY); \
ALOGV("\"%s\" not support", kUSED_##KEY); \
} \
}

Expand All @@ -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) \
Expand Down Expand Up @@ -84,43 +84,43 @@ 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
char numberOfCamera[2];
if(readKey(kNUMBER_OF_CAMERA, numberOfCamera))
{
mNumberOfCamera = atoi(numberOfCamera);
LOGV("read number: %d", mNumberOfCamera);
ALOGV("read number: %d", mNumberOfCamera);
}

// get camera facing
char cameraFacing[2];
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
char deviceID[2];
if(readKey(kDEVICE_ID, deviceID))
{
mDeviceID = atoi(deviceID);
LOGV("camera device id %d", mDeviceID);
ALOGV("camera device id %d", mDeviceID);
}
}

Expand Down Expand Up @@ -151,7 +151,7 @@ void CCameraConfig::initParameters()
{
if (mhKeyFile == 0)
{
LOGW("invalid camera config file hadle");
ALOGW("invalid camera config file hadle");
return ;
}

Expand Down Expand Up @@ -181,7 +181,7 @@ void CCameraConfig::initParameters()
}
else
{
LOGV("\"%s\" not support", kUSED_EXPOSURE_COMPENSATION);
ALOGV("\"%s\" not support", kUSED_EXPOSURE_COMPENSATION);
}
}

Expand All @@ -204,7 +204,7 @@ void CCameraConfig::initParameters()
}
else
{
LOGV("\"%s\" not support", kUSED_ZOOM);
ALOGV("\"%s\" not support", kUSED_ZOOM);
}
}
}
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
52 changes: 26 additions & 26 deletions camera/CallbackNotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define LOG_TAG "CallbackNotifier"
#include "CameraDebug.h"

#include <media/stagefright/MetadataBufferType.h>
#include <media/hardware/MetadataBufferType.h>
#include <type_camera.h>
#include "V4L2Camera.h"
#include "CallbackNotifier.h"
Expand Down Expand Up @@ -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]);
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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__);
}
}

Expand All @@ -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__);
}
}
}
Expand All @@ -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__);
}
}

Expand All @@ -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__);
}
}
}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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__);
}
}

Expand Down Expand Up @@ -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,
Expand All @@ -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 ;
}

Expand All @@ -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)
Expand All @@ -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) )
{
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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__);
}
}
}
Expand Down
Loading