diff options
Diffstat (limited to 'camera')
-rw-r--r-- | camera/OMXCameraAdapter/OMX3A.cpp | 62 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 2 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapture.cpp | 2 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXFocus.cpp | 10 | ||||
-rw-r--r-- | camera/inc/General3A_Settings.h | 1 | ||||
-rw-r--r-- | camera/inc/OMXCameraAdapter/OMXCameraAdapter.h | 3 |
6 files changed, 67 insertions, 13 deletions
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp index eb87645..ad82398 100644 --- a/camera/OMXCameraAdapter/OMX3A.cpp +++ b/camera/OMXCameraAdapter/OMX3A.cpp @@ -366,6 +366,9 @@ status_t OMXCameraAdapter::apply3ADefaults(Gen3A_settings &Gen3A) Gen3A.ExposureLock = OMX_FALSE; ret |= setExposureLock(Gen3A); + Gen3A.FocusLock = OMX_FALSE; + ret |= setFocusLock(Gen3A); + Gen3A.WhiteBalanceLock = OMX_FALSE; ret |= setWhiteBalanceLock(Gen3A); @@ -1056,11 +1059,41 @@ status_t OMXCameraAdapter::setExposureLock(Gen3A_settings& Gen3A) return ErrorUtils::omxToAndroidError(eError); } -status_t OMXCameraAdapter::set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb) +status_t OMXCameraAdapter::setFocusLock(Gen3A_settings& Gen3A) +{ + OMX_ERRORTYPE eError = OMX_ErrorNone; + OMX_IMAGE_CONFIG_LOCKTYPE lock; + + LOG_FUNCTION_NAME + + if ( OMX_StateInvalid == mComponentState ) { + CAMHAL_LOGEA("OMX component is in invalid state"); + return NO_INIT; + } + + OMX_INIT_STRUCT_PTR (&lock, OMX_IMAGE_CONFIG_LOCKTYPE); + lock.nPortIndex = mCameraAdapterParameters.mPrevPortIndex; + + lock.bLock = Gen3A.FocusLock; + eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, + (OMX_INDEXTYPE)OMX_IndexConfigImageFocusLock, + &lock); + + if ( OMX_ErrorNone != eError ) { + CAMHAL_LOGEB("Error while configuring Focus Lock error = 0x%x", eError); + } else { + CAMHAL_LOGDB("Focus Lock configured successfully %d ", lock.bLock); + } + + LOG_FUNCTION_NAME_EXIT + + return ErrorUtils::omxToAndroidError(eError); +} + +status_t OMXCameraAdapter::set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb, OMX_BOOL toggleFocus) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_IMAGE_CONFIG_LOCKTYPE lock; - char* index = FALSE; LOG_FUNCTION_NAME @@ -1074,6 +1107,7 @@ status_t OMXCameraAdapter::set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb) lock.nPortIndex = mCameraAdapterParameters.mPrevPortIndex; mParameters3A.ExposureLock = toggleExp; + mParameters3A.FocusLock = toggleFocus; mParameters3A.WhiteBalanceLock = toggleWb; eError = OMX_GetConfig( mCameraAdapterParameters.mHandleComp, @@ -1099,6 +1133,30 @@ status_t OMXCameraAdapter::set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb) mParams.set(CameraParameters::KEY_AUTO_EXPOSURE_LOCK, lock_state_exp); } + OMX_INIT_STRUCT_PTR (&lock, OMX_IMAGE_CONFIG_LOCKTYPE); + lock.nPortIndex = mCameraAdapterParameters.mPrevPortIndex; + eError = OMX_GetConfig( mCameraAdapterParameters.mHandleComp, + (OMX_INDEXTYPE)OMX_IndexConfigImageFocusLock, + &lock); + + if ( OMX_ErrorNone != eError ) + { + CAMHAL_LOGEB("Error GetConfig Focus Lock error = 0x%x", eError); + goto EXIT; + } + else + { + CAMHAL_LOGDB("Focus Lock GetConfig successfull bLock(%d)", lock.bLock); + + /* Apply locks only when not applied already */ + if ( lock.bLock != toggleFocus ) + { + setFocusLock(mParameters3A); + } + } + + OMX_INIT_STRUCT_PTR (&lock, OMX_IMAGE_CONFIG_LOCKTYPE); + lock.nPortIndex = mCameraAdapterParameters.mPrevPortIndex; eError = OMX_GetConfig( mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE)OMX_IndexConfigImageWhiteBalanceLock, &lock); diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index 3282072..d56bd41 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -1914,7 +1914,7 @@ status_t OMXCameraAdapter::stopPreview() } //Release 3A locks - ret = set3ALock(OMX_FALSE, OMX_FALSE); + ret = set3ALock(OMX_FALSE, OMX_FALSE, OMX_FALSE); if(ret!=NO_ERROR) { CAMHAL_LOGEB("Error Releaseing 3A locks%d", ret); diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp index 02cabc4..07c57b0 100644 --- a/camera/OMXCameraAdapter/OMXCapture.cpp +++ b/camera/OMXCameraAdapter/OMXCapture.cpp @@ -878,7 +878,7 @@ status_t OMXCameraAdapter::stopImageCapture() } //release any 3A locks if locked - ret = set3ALock(OMX_FALSE, OMX_FALSE); + ret = set3ALock(OMX_FALSE, OMX_FALSE, OMX_FALSE); if(ret!=NO_ERROR) { CAMHAL_LOGEB("Error Releaseing 3A locks%d", ret); diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp index 5d2e6ef..5600a4a 100644 --- a/camera/OMXCameraAdapter/OMXFocus.cpp +++ b/camera/OMXCameraAdapter/OMXFocus.cpp @@ -272,7 +272,7 @@ status_t OMXCameraAdapter::cancelAutoFocus() LOG_FUNCTION_NAME; // Unlock 3A locks since they were locked by AF conditionally - if( set3ALock(mUserSetExpLock, mUserSetWbLock) != NO_ERROR) { + if( set3ALock(mUserSetExpLock, mUserSetWbLock, OMX_FALSE) != NO_ERROR) { CAMHAL_LOGEA("Error Unlocking 3A locks"); } else{ @@ -397,12 +397,6 @@ status_t OMXCameraAdapter::returnFocusStatus(bool timeoutReached) { focusStatus = false; } - ///FIXME: The ducati seems to return focus as false always if continuous focus is enabled - ///So, return focus as locked always until this is fixed. - else if(mParameters3A.Focus == OMX_IMAGE_FocusControlAuto ) - { - focusStatus = true; - } else { switch (eFocusStatus.eFocusStatus) @@ -423,7 +417,7 @@ status_t OMXCameraAdapter::returnFocusStatus(bool timeoutReached) } //Lock the AE and AWB here // Apply 3A locks after AF - if( set3ALock(OMX_TRUE, OMX_TRUE) != NO_ERROR) { + if( set3ALock(OMX_TRUE, OMX_TRUE, OMX_TRUE) != NO_ERROR) { CAMHAL_LOGEA("Error Applying 3A locks"); } else diff --git a/camera/inc/General3A_Settings.h b/camera/inc/General3A_Settings.h index 8267c04..9dbe10f 100644 --- a/camera/inc/General3A_Settings.h +++ b/camera/inc/General3A_Settings.h @@ -229,6 +229,7 @@ class Gen3A_settings{ unsigned int Brightness; OMX_BOOL ExposureLock; + OMX_BOOL FocusLock; OMX_BOOL WhiteBalanceLock; }; diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h index e33746e..6ec32ad 100644 --- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h +++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h @@ -478,8 +478,9 @@ private: status_t setEffect(Gen3A_settings& Gen3A); status_t setExposureLock(Gen3A_settings& Gen3A); + status_t setFocusLock(Gen3A_settings& Gen3A); status_t setWhiteBalanceLock(Gen3A_settings& Gen3A); - status_t set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb); + status_t set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb, OMX_BOOL toggleFocus); status_t setMeteringAreas(Gen3A_settings& Gen3A); //API to set FrameRate using VFR interface |