summaryrefslogtreecommitdiffstats
path: root/camera/CameraHal.cpp
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-10-18 15:01:30 -0500
committerIliyan Malchev <malchev@google.com>2011-10-19 13:02:35 -0700
commitd381939b078af9a190e4a7669e85e47f2560af1f (patch)
tree5f941ce2e1c44dd760d0da1958f408dbc22c272a /camera/CameraHal.cpp
parentcfdffd5b9adc409370099fb5cfb47f1197f3edfe (diff)
downloadhardware_ti_omap4-d381939b078af9a190e4a7669e85e47f2560af1f.zip
hardware_ti_omap4-d381939b078af9a190e4a7669e85e47f2560af1f.tar.gz
hardware_ti_omap4-d381939b078af9a190e4a7669e85e47f2560af1f.tar.bz2
CameraHAL: Make CAF mode APIs consistent
Make FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE consistent to the user. For us, this means we need to make some decision on which capture mode to select based on which CAF mode is selected by the application. b/5441086 Change-Id: I39e51ea916e1baa263b6dcc88f76a4940809ecb9 Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'camera/CameraHal.cpp')
-rw-r--r--camera/CameraHal.cpp63
1 files changed, 45 insertions, 18 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...