diff options
-rw-r--r-- | camera/CameraHal.cpp | 63 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXAlgo.cpp | 7 | ||||
-rw-r--r-- | camera/TICameraParameters.cpp | 1 | ||||
-rw-r--r-- | camera/inc/TICameraParameters.h | 3 |
4 files changed, 55 insertions, 19 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 84c6da7..99b11f1 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -444,6 +444,25 @@ int CameraHal::setParameters(const CameraParameters& params) params.getPreviewSize(&mVideoWidth, &mVideoHeight); } + if ((valstr = params.get(CameraParameters::KEY_FOCUS_MODE)) != NULL) { + if (isParameterValid(valstr, mCameraProperties->get(CameraProperties::SUPPORTED_FOCUS_MODES))) { + CAMHAL_LOGDB("Focus mode set %s", params.get(CameraParameters::KEY_FOCUS_MODE)); + + // we need to take a decision on the capture mode based on whether CAF picture or + // video is chosen so the behavior of each is consistent to the application + if(strcmp(valstr, CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE) == 0){ + restartPreviewRequired |= resetVideoModeParameters(); + } else if (strcmp(valstr, CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO) == 0){ + restartPreviewRequired |= setVideoModeParameters(params); + } + + mParameters.set(CameraParameters::KEY_FOCUS_MODE, valstr); + } else { + CAMHAL_LOGEB("ERROR: Invalid FOCUS mode = %s", valstr); + ret = -EINVAL; + } + } + ///Below parameters can be changed when the preview is running if ( (valstr = params.getPictureFormat()) != NULL ) { if (isParameterValid(params.getPictureFormat(),mCameraProperties->get(CameraProperties::SUPPORTED_PICTURE_FORMATS))) { @@ -672,16 +691,6 @@ int CameraHal::setParameters(const CameraParameters& params) } } - if ((valstr = params.get(CameraParameters::KEY_FOCUS_MODE)) != NULL) { - if (isParameterValid(valstr, mCameraProperties->get(CameraProperties::SUPPORTED_FOCUS_MODES))) { - CAMHAL_LOGDB("Focus mode set %s", params.get(CameraParameters::KEY_FOCUS_MODE)); - mParameters.set(CameraParameters::KEY_FOCUS_MODE, valstr); - } else { - CAMHAL_LOGEB("ERROR: Invalid FOCUS mode = %s", valstr); - ret = -EINVAL; - } - } - if( (valstr = params.get(CameraParameters::KEY_FOCUS_AREAS)) != NULL ) { CAMHAL_LOGEB("Focus areas position set %s", params.get(CameraParameters::KEY_FOCUS_AREAS)); @@ -1815,17 +1824,27 @@ status_t CameraHal::startRecording( ) return NO_INIT; } + // set internal recording hint in case camera adapter needs to make some + // decisions....(will only be sent to camera adapter if camera restart is required) + mParameters.set(TICameraParameters::KEY_RECORDING_HINT, CameraParameters::TRUE); + + // if application starts recording in continuous focus picture mode... + // then we need to force default capture mode (as opposed to video mode) + if ( ((valstr = mParameters.get(CameraParameters::KEY_FOCUS_MODE)) != NULL) && + (strcmp(valstr, CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE) == 0) ){ + restartPreviewRequired = resetVideoModeParameters(); + } + + // only need to check recording hint if preview restart is not already needed valstr = mParameters.get(CameraParameters::KEY_RECORDING_HINT); - if ( (valstr == NULL) || - ( (valstr != NULL) && (strcmp(valstr, CameraParameters::TRUE) != 0) ) ) - { + if ( !restartPreviewRequired && + (!valstr || (valstr && (strcmp(valstr, CameraParameters::TRUE) != 0))) ) { restartPreviewRequired = setVideoModeParameters(mParameters); + } - if(restartPreviewRequired) - { - ret = restartPreview(); - } - } + if (restartPreviewRequired) { + ret = restartPreview(); + } if ( NO_ERROR == ret ) { @@ -1839,6 +1858,7 @@ status_t CameraHal::startRecording( ) if ( NO_ERROR != ret ) { CAMHAL_LOGEB("allocImageBufs returned error 0x%x", ret); + mParameters.remove(TICameraParameters::KEY_RECORDING_HINT); return ret; } @@ -2077,6 +2097,10 @@ void CameraHal::stopRecording() mVideoBufs = NULL; } + // reset internal recording hint in case camera adapter needs to make some + // decisions....(will only be sent to camera adapter if camera restart is required) + mParameters.remove(TICameraParameters::KEY_RECORDING_HINT); + LOG_FUNCTION_NAME_EXIT; } @@ -2610,6 +2634,9 @@ char* CameraHal::getParameters() } } + // do not send internal parameters to upper layers + mParams.remove(TICameraParameters::KEY_RECORDING_HINT); + params_str8 = mParams.flatten(); // camera service frees this string... diff --git a/camera/OMXCameraAdapter/OMXAlgo.cpp b/camera/OMXCameraAdapter/OMXAlgo.cpp index 9287f2a..c19e046 100644 --- a/camera/OMXCameraAdapter/OMXAlgo.cpp +++ b/camera/OMXCameraAdapter/OMXAlgo.cpp @@ -632,9 +632,14 @@ status_t OMXCameraAdapter::setCaptureMode(OMXCameraAdapter::CaptureMode mode) } else if( OMXCameraAdapter::HIGH_QUALITY_ZSL== mode ) { + const char* valstr = NULL; CAMHAL_LOGDA("Camera mode: HIGH QUALITY_ZSL"); camMode.eCamOperatingMode = OMX_TI_CaptureImageProfileZeroShutterLag; - zslHistoryLen.nHistoryLen = 5; + + valstr = mParams.get(TICameraParameters::KEY_RECORDING_HINT); + if (!valstr || (valstr && (strcmp(valstr, "false")))) { + zslHistoryLen.nHistoryLen = 5; + } } else if( OMXCameraAdapter::VIDEO_MODE == mode ) { diff --git a/camera/TICameraParameters.cpp b/camera/TICameraParameters.cpp index 862edc8..720d72a 100644 --- a/camera/TICameraParameters.cpp +++ b/camera/TICameraParameters.cpp @@ -68,6 +68,7 @@ const char TICameraParameters::KEY_SENSOR_ORIENTATION[] = "sensor-orientation"; const char TICameraParameters::KEY_SENSOR_ORIENTATION_VALUES[] = "sensor-orientation-values"; const char TICameraParameters::KEY_MINFRAMERATE[] = "min-framerate"; const char TICameraParameters::KEY_MAXFRAMERATE[] = "max-framerate"; +const char TICameraParameters::KEY_RECORDING_HINT[] = "internal-recording-hint"; //TI extensions for enabling/disabling GLBCE const char TICameraParameters::GLBCE_ENABLE[] = "enable"; diff --git a/camera/inc/TICameraParameters.h b/camera/inc/TICameraParameters.h index e01b38d..3150398 100644 --- a/camera/inc/TICameraParameters.h +++ b/camera/inc/TICameraParameters.h @@ -66,6 +66,9 @@ static const char KEY_GLBCE[]; static const char KEY_MINFRAMERATE[];
static const char KEY_MAXFRAMERATE[];
+// TI recording hint to notify camera adapters of possible recording
+static const char KEY_RECORDING_HINT[];
+
static const char KEY_CURRENT_ISO[];
static const char KEY_SENSOR_ORIENTATION[];
|