diff options
author | Sundar Raman <sunds@ti.com> | 2011-09-12 15:03:33 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-09-12 19:15:47 -0700 |
commit | ec6434c4a6448e0e9e08eddae15a108b0744b0cf (patch) | |
tree | d844d3618cb9e676e02f2e33df4519e6c9c4d5ac /camera/AppCallbackNotifier.cpp | |
parent | 99a8dcfd6b79a55c1bf253e577d55f93b25b9ab5 (diff) | |
download | hardware_ti_omap4-ec6434c4a6448e0e9e08eddae15a108b0744b0cf.zip hardware_ti_omap4-ec6434c4a6448e0e9e08eddae15a108b0744b0cf.tar.gz hardware_ti_omap4-ec6434c4a6448e0e9e08eddae15a108b0744b0cf.tar.bz2 |
CameraHAL: Updates related to multiple MTS,CTS tests
- Test '#testTakePicture' in both the MTS suite and
the CTS package, require raw callbacks to be
generated when 'takePicture()' is provided with an
appropriate handler for it. Unfortunately, raw
data is not always provided by the CameraAdapters.
This modification adds the necessary functionality
in order to enable raw callbacks, when needed.
Change-Id: I1369f7a6edbc54195c5a71b35e0096c72d6ed368
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Change-Id: I2b963f5c23d31b02f3d59e1ee8c36cf3cd195bb6
Signed-off-by: Sundar Raman <sunds@ti.com>
Diffstat (limited to 'camera/AppCallbackNotifier.cpp')
-rw-r--r-- | camera/AppCallbackNotifier.cpp | 95 |
1 files changed, 77 insertions, 18 deletions
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp index 4302988..57332bf 100644 --- a/camera/AppCallbackNotifier.cpp +++ b/camera/AppCallbackNotifier.cpp @@ -147,6 +147,7 @@ status_t AppCallbackNotifier::initialize() } mUseMetaDataBufferMode = true; + mRawAvailable = false; LOG_FUNCTION_NAME_EXIT; @@ -294,6 +295,7 @@ void AppCallbackNotifier::notifyEvent() { mNotifyCb(CAMERA_MSG_SHUTTER, 0, 0, mCallbackCookie); } + mRawAvailable = false; break; @@ -570,6 +572,40 @@ static void copy2Dto1D(void *dst, mapper.unlock((buffer_handle_t)src); } +status_t AppCallbackNotifier::dummyRaw() +{ + LOG_FUNCTION_NAME; + + if ( NULL == mRequestMemory ) { + CAMHAL_LOGEA("Can't allocate memory for dummy raw callback!"); + return NO_INIT; + } + + if ( ( NULL != mCameraHal ) && + ( NULL != mDataCb) && + ( NULL != mNotifyCb ) ){ + + if ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE) ) { + camera_memory_t *dummyRaw = mRequestMemory(-1, 1, 1, NULL); + + if ( NULL == dummyRaw ) { + CAMHAL_LOGEA("Dummy raw buffer allocation failed!"); + return NO_MEMORY; + } + + mDataCb(CAMERA_MSG_RAW_IMAGE, dummyRaw, 0, NULL, mCallbackCookie); + + dummyRaw->release(dummyRaw); + } else if ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE_NOTIFY) ) { + mNotifyCb(CAMERA_MSG_RAW_IMAGE_NOTIFY, 0, 0, mCallbackCookie); + } + } + + LOG_FUNCTION_NAME_EXIT; + + return NO_ERROR; +} + void AppCallbackNotifier::notifyFrame() { ///Receive and send the frame notifications to app @@ -612,37 +648,47 @@ void AppCallbackNotifier::notifyFrame() if ( (CameraFrame::RAW_FRAME == frame->mFrameType )&& ( NULL != mCameraHal ) && ( NULL != mDataCb) && - ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE) ) ) + ( NULL != mNotifyCb ) ) { + if ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE) ) + { #ifdef COPY_IMAGE_BUFFER - camera_memory_t* raw_picture = mRequestMemory(-1, frame->mLength, 1, NULL); + camera_memory_t* raw_picture = mRequestMemory(-1, frame->mLength, 1, NULL); - if ( NULL != raw_picture ) - { - buf = raw_picture->data; - if ( NULL != buf ) - { - memcpy(buf, - ( void * ) ( (unsigned int) frame->mBuffer + frame->mOffset), - frame->mLength); - } - mFrameProvider->returnFrame(frame->mBuffer, - ( CameraFrame::FrameType ) frame->mFrameType); - } + if ( NULL != raw_picture ) + { + buf = raw_picture->data; + if ( NULL != buf ) + { + memcpy(buf, + ( void * ) ( (unsigned int) frame->mBuffer + frame->mOffset), + frame->mLength); + } + mFrameProvider->returnFrame(frame->mBuffer, + ( CameraFrame::FrameType ) frame->mFrameType); + } + + mDataCb(CAMERA_MSG_RAW_IMAGE, raw_picture, 0, NULL, mCallbackCookie); - mDataCb(CAMERA_MSG_RAW_IMAGE, raw_picture, 0, NULL, mCallbackCookie); #else - //TODO: Find a way to map a Tiler buffer to a MemoryHeapBase + //TODO: Find a way to map a Tiler buffer to a MemoryHeapBase #endif - if(raw_picture) + if(raw_picture) + { + raw_picture->release(raw_picture); + } + } + else if ( mCameraHal->msgTypeEnabled(CAMERA_MSG_RAW_IMAGE_NOTIFY) ) { - raw_picture->release(raw_picture); + mNotifyCb(CAMERA_MSG_RAW_IMAGE_NOTIFY, 0, 0, mCallbackCookie); } + mRawAvailable = true; + } else if ( (CameraFrame::IMAGE_FRAME == frame->mFrameType) && (NULL != mCameraHal) && @@ -708,6 +754,19 @@ void AppCallbackNotifier::notifyFrame() { Mutex::Autolock lock(mLock); + // CTS, MTS requirements: Every 'takePicture()' call + // who registers a raw callback should receive one + // as well. This is not always the case with + // CameraAdapters though. + if ( !mRawAvailable ) + { + dummyRaw(); + } + else + { + mRawAvailable = false; + } + #ifdef COPY_IMAGE_BUFFER camera_memory_t* raw_picture = mRequestMemory(-1, frame->mLength, 1, NULL); |