author | Lawrence Mok <lawrence.mok@amlogic.com> | 2013-12-11 20:04:35 (GMT) |
---|---|---|
committer | Lawrence Mok <lawrence.mok@amlogic.com> | 2013-12-11 20:04:35 (GMT) |
commit | cd6b68a95c6c45e8ab751b668123c416d3debba1 (patch) | |
tree | abb46e4ae2b36672d1946dd8161f73f219d27d1a | |
parent | 0a0c9740659dd3aaad18c6a764844dadb171c93b (diff) | |
parent | 3272967c49f26125e776b2f820c20bbcff7177aa (diff) | |
download | camera-cd6b68a95c6c45e8ab751b668123c416d3debba1.zip camera-cd6b68a95c6c45e8ab751b668123c416d3debba1.tar.gz camera-cd6b68a95c6c45e8ab751b668123c416d3debba1.tar.bz2 |
Merge remote-tracking branch 'amlogic/jb-mr2-amlogic' into kk-amlogic
-rwxr-xr-x | AppCallbackNotifier.cpp | 22 | ||||
-rwxr-xr-x | V4LCameraAdapter/V4LCameraAdapter.cpp | 38 | ||||
-rwxr-xr-x | utils/DebugUtils.h | 2 | ||||
-rwxr-xr-x | utils/MessageQueue.h | 2 |
4 files changed, 57 insertions, 7 deletions
diff --git a/AppCallbackNotifier.cpp b/AppCallbackNotifier.cpp index 491d696..724cb60 100755 --- a/AppCallbackNotifier.cpp +++ b/AppCallbackNotifier.cpp @@ -322,8 +322,12 @@ void AppCallbackNotifier::notifyEvent() MSGUTILS::Message msg; LOG_FUNCTION_NAME; { - Mutex::Autolock lock(mLock); - mEventQ.get(&msg); + Mutex::Autolock lock(mLock); + if(!mEventQ.isEmpty()){ + mEventQ.get(&msg); + }else{ + return ; + } } bool ret = true; CameraHalEvent *evt = NULL; @@ -449,6 +453,7 @@ void AppCallbackNotifier::notifyEvent() if ( NULL != evt ) { delete evt; + evt = NULL; } @@ -1289,9 +1294,20 @@ void AppCallbackNotifier::eventCallback(CameraHalEvent* chEvt) void AppCallbackNotifier::flushEventQueue() { + MSGUTILS::Message msg; + CameraHalEvent *evt = NULL; { Mutex::Autolock lock(mLock); - mEventQ.clear(); + while (!mEventQ.isEmpty()){ + mEventQ.get(&msg); + evt = (CameraHalEvent *)msg.arg1; + if (NULL != evt){ + delete evt; + evt = NULL; + } + } + + //mEventQ.clear(); } } diff --git a/V4LCameraAdapter/V4LCameraAdapter.cpp b/V4LCameraAdapter/V4LCameraAdapter.cpp index b7d92fa..8ba4e43 100755 --- a/V4LCameraAdapter/V4LCameraAdapter.cpp +++ b/V4LCameraAdapter/V4LCameraAdapter.cpp @@ -133,6 +133,35 @@ static int writefile(char* path,char* content) } return 1; } +#ifndef CAMHAL_USER_MODE +// +//usage +//+ char property1[80]; +//+ +//+ readfile((char*)SYSFILE_CAMERA_SET_MIRROR, property1); +//+ CAMHAL_LOGDB("mirror =%s\n", property1); +// +static int readfile(char *path,char *content) +{ + char *tmp=content; + + FILE *fp = fopen(path,"r"); + + if(fp == NULL) { + CAMHAL_LOGDA("readfile open fail"); + return -1; + } + int ch; + while ((ch=fgetc(fp)) != EOF ) { + *content = (char)ch; + content++; + } + fclose(fp); + *content='\0'; + + return 0; +} +#endif #endif /*--------------------Camera Adapter Class STARTS here-----------------------------*/ status_t V4LCameraAdapter::sendCommand(CameraCommands operation, int value1, int value2, int value3) { @@ -678,7 +707,8 @@ status_t V4LCameraAdapter::useBuffers(CameraMode mode, void* bufArr, int num, si status_t V4LCameraAdapter::setBuffersFormat(int width, int height, int pixelformat) { int ret = NO_ERROR; - CAMHAL_LOGDB("Width * Height %d x %d format 0x%x", width, height, pixelformat); + CAMHAL_LOGIB("Width * Height %d x %d pixelformat:%c%c%c%c", + width, height, pixelformat&0xff, (pixelformat>>8)&0xFF, (pixelformat>>16)&0xFF,(pixelformat>>24)&0xFF); mVideoInfo->width = width; mVideoInfo->height = height; @@ -720,6 +750,7 @@ status_t V4LCameraAdapter::getBuffersFormat(int &width, int &height, int &pixelf status_t V4LCameraAdapter::setCrop(int width, int height) { int ret = NO_ERROR; +#ifndef AMLOGIC_USB_CAMERA_SUPPORT struct v4l2_crop crop; memset (&crop, 0, sizeof(crop)); @@ -727,11 +758,10 @@ status_t V4LCameraAdapter::setCrop(int width, int height) crop.c.height = height; ret = ioctl(mCameraHandle, VIDIOC_S_CROP, &crop); if (ret < 0) { - CAMHAL_LOGEB("VIDIOC_S_CROP Failed: %s, ret=%d\n", strerror(errno), ret); + CAMHAL_LOGVB("VIDIOC_S_CROP Failed: %s, ret=%d\n", strerror(errno), ret); } - CAMHAL_LOGIB("crop w=%d, h=%d\n", width, height); - +#endif return ret; } diff --git a/utils/DebugUtils.h b/utils/DebugUtils.h index f203eaa..56afc00 100755 --- a/utils/DebugUtils.h +++ b/utils/DebugUtils.h @@ -67,6 +67,8 @@ extern volatile int32_t gCamHal_LogLevel; #define LOG_FUNCTION_NAME CAMHAL_LOGVA("ENTER"); #define LOG_FUNCTION_NAME_EXIT CAMHAL_LOGVA("EXIT"); +#define DBG_LOGA(str) ALOGI_IF(gCamHal_LogLevel >=4,"%5d %s - " str, __LINE__,__FUNCTION__); +#define DBG_LOGB(str, ...) ALOGI_IF(gCamHal_LogLevel >=4,"%5d %s - " str, __LINE__,__FUNCTION__, __VA_ARGS__); #endif diff --git a/utils/MessageQueue.h b/utils/MessageQueue.h index ff2c9e3..ebdf584 100755 --- a/utils/MessageQueue.h +++ b/utils/MessageQueue.h @@ -35,6 +35,8 @@ #else +#define MSGQ_LOGVA CAMHAL_LOGVA +#define MSGQ_LOGVB CAMHAL_LOGVB #define MSGQ_LOGDA CAMHAL_LOGDA #define MSGQ_LOGDB CAMHAL_LOGDB |