diff options
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 6 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXZoom.cpp | 15 | ||||
-rw-r--r-- | camera/inc/OMXCameraAdapter/OMXCameraAdapter.h | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index 18c1c88..493ea2f 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -222,6 +222,12 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps) mEXIFData.mModelValid = false; mEXIFData.mMakeValid = false; + if (mCapabilities->get(CameraProperties::SUPPORTED_ZOOM_STAGES) != NULL) { + mMaxZoomSupported = mCapabilities->getInt(CameraProperties::SUPPORTED_ZOOM_STAGES) + 1; + } else { + mMaxZoomSupported = 1; + } + // initialize command handling thread if(mCommandHandler.get() == NULL) mCommandHandler = new CommandHandler(this); diff --git a/camera/OMXCameraAdapter/OMXZoom.cpp b/camera/OMXCameraAdapter/OMXZoom.cpp index 478fd81..f2775b5 100644 --- a/camera/OMXCameraAdapter/OMXZoom.cpp +++ b/camera/OMXCameraAdapter/OMXZoom.cpp @@ -57,8 +57,7 @@ status_t OMXCameraAdapter::setParametersZoom(const CameraParameters ¶ms, if ( ( ZOOM_ACTIVE & state ) != ZOOM_ACTIVE ) { int zoom = params.getInt(CameraParameters::KEY_ZOOM); - if( ( zoom >= 0 ) && ( zoom < ZOOM_STAGES ) ) - { + if (( zoom >= 0 ) && ( zoom < mMaxZoomSupported )) { mTargetZoomIdx = zoom; //Immediate zoom should be applied instantly ( CTS requirement ) @@ -93,8 +92,7 @@ status_t OMXCameraAdapter::doZoom(int index) ret = -1; } - if ( ( 0 > index) || ( ( ZOOM_STAGES - 1 ) < index ) ) - { + if (( 0 > index) || ((mMaxZoomSupported - 1 ) < index )) { CAMHAL_LOGEB("Zoom index %d out of range", index); ret = -EINVAL; } @@ -243,17 +241,14 @@ status_t OMXCameraAdapter::startSmoothZoom(int targetIdx) targetIdx, mCurrentZoomIdx); - if ( ( targetIdx >= 0 ) && ( targetIdx < ZOOM_STAGES ) ) - { + if (( targetIdx >= 0 ) && ( targetIdx < mMaxZoomSupported )) { mTargetZoomIdx = targetIdx; mZoomParameterIdx = mCurrentZoomIdx; mReturnZoomStatus = false; - } - else - { + } else { CAMHAL_LOGEB("Smooth value out of range %d!", targetIdx); ret = -EINVAL; - } + } LOG_FUNCTION_NAME_EXIT; diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h index 7bce4ae..7c1e7ff 100644 --- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h +++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h @@ -1048,6 +1048,8 @@ private: OMX_TI_DCCDATATYPE mDccData; Mutex mDccDataLock; + + int mMaxZoomSupported; }; }; //// namespace #endif //OMX_CAMERA_ADAPTER_H |