summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
Diffstat (limited to 'camera')
-rw-r--r--camera/CameraHal.cpp103
-rw-r--r--camera/CameraParameters.cpp2
-rw-r--r--camera/OMXCameraAdapter/OMXAlgo.cpp6
-rw-r--r--camera/OMXCameraAdapter/OMXCapabilities.cpp1
-rw-r--r--camera/OMXCameraAdapter/OMXDefaults.cpp3
-rw-r--r--camera/TICameraParameters.cpp2
-rw-r--r--camera/inc/CameraHal.h24
-rw-r--r--camera/inc/CameraProperties.h2
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h1
-rw-r--r--camera/inc/TICameraParameters.h2
10 files changed, 69 insertions, 77 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index ee8267c..73d16de 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -291,13 +291,21 @@ int CameraHal::setParameters(const CameraParameters& params)
}
}
- if ((valstr = params.get(TICameraParameters::KEY_VSTAB)) != NULL) {
- if ((params.getInt(TICameraParameters::KEY_VSTAB)==0) || (params.getInt(TICameraParameters::KEY_VSTAB)==1)) {
- CAMHAL_LOGDB("VSTAB set %s", params.get(TICameraParameters::KEY_VSTAB));
- mParameters.set(TICameraParameters::KEY_VSTAB, valstr);
- } else {
+ if ((valstr = params.get(CameraParameters::KEY_VIDEO_STABILIZATION)) != NULL) {
+ // make sure we support vstab...if we don't and application is trying to set
+ // vstab then return an error
+ if (strcmp(mCameraProperties->get(CameraProperties::VSTAB_SUPPORTED),
+ CameraParameters::TRUE) == 0) {
+ CAMHAL_LOGDB("VSTAB %s",
+ params.get(CameraParameters::KEY_VIDEO_STABILIZATION));
+ mParameters.set(CameraParameters::KEY_VIDEO_STABILIZATION,
+ params.get(CameraParameters::KEY_VIDEO_STABILIZATION));
+ } else if (strcmp(valstr, CameraParameters::TRUE) == 0) {
CAMHAL_LOGEB("ERROR: Invalid VSTAB: %s", valstr);
ret = -EINVAL;
+ } else {
+ mParameters.set(CameraParameters::KEY_VIDEO_STABILIZATION,
+ CameraParameters::FALSE);
}
}
@@ -395,7 +403,7 @@ int CameraHal::setParameters(const CameraParameters& params)
{
CAMHAL_LOGDB("Recording Hint is set to %s", valstr);
mParameters.set(CameraParameters::KEY_RECORDING_HINT, valstr);
- restartPreviewRequired = setVideoModeParameters();
+ restartPreviewRequired = setVideoModeParameters(params);
videoMode = true;
int w, h;
@@ -1817,7 +1825,7 @@ status_t CameraHal::startRecording( )
if ( (valstr == NULL) ||
( (valstr != NULL) && (strcmp(valstr, CameraParameters::TRUE) != 0) ) )
{
- restartPreviewRequired = setVideoModeParameters();
+ restartPreviewRequired = setVideoModeParameters(mParameters);
if(restartPreviewRequired)
{
@@ -1885,7 +1893,7 @@ status_t CameraHal::startRecording( )
@todo Modify the policies for enabling VSTAB & VNF usecase based later.
*/
-bool CameraHal::setVideoModeParameters()
+bool CameraHal::setVideoModeParameters(const CameraParameters& params)
{
const char *valstr = NULL;
bool restartPreviewRequired = false;
@@ -1905,40 +1913,50 @@ bool CameraHal::setVideoModeParameters()
// Check if CAPTURE_MODE is VIDEO_MODE, since VSTAB & VNF work only in VIDEO_MODE.
valstr = mParameters.get(TICameraParameters::KEY_CAP_MODE);
- if (strcmp(valstr, (const char *) TICameraParameters::VIDEO_MODE) == 0)
- {
- // Enable VSTAB, if not enabled already
- valstr = mParameters.get(TICameraParameters::KEY_VSTAB);
- if ( (valstr == NULL) ||
- ( (valstr != NULL) && (strcmp(valstr, "1") != 0) ) )
- {
- CAMHAL_LOGDA("Enable VSTAB");
- mParameters.set(TICameraParameters::KEY_VSTAB, "1");
- restartPreviewRequired = true;
+ if (strcmp(valstr, (const char *) TICameraParameters::VIDEO_MODE) == 0) {
+ // set VSTAB. restart is required if vstab value has changed
+ if (params.get(CameraParameters::KEY_VIDEO_STABILIZATION) != NULL) {
+ // make sure we support vstab
+ if (strcmp(mCameraProperties->get(CameraProperties::VSTAB_SUPPORTED),
+ CameraParameters::TRUE) == 0) {
+ valstr = mParameters.get(CameraParameters::KEY_VIDEO_STABILIZATION);
+ // vstab value has changed
+ if ((valstr != NULL) &&
+ strcmp(valstr, params.get(CameraParameters::KEY_VIDEO_STABILIZATION)) != 0) {
+ restartPreviewRequired = true;
+ }
+ mParameters.set(CameraParameters::KEY_VIDEO_STABILIZATION,
+ params.get(CameraParameters::KEY_VIDEO_STABILIZATION));
}
+ } else if (mParameters.get(CameraParameters::KEY_VIDEO_STABILIZATION)) {
+ // vstab was configured but now unset
+ restartPreviewRequired = true;
+ mParameters.remove(CameraParameters::KEY_VIDEO_STABILIZATION);
+ }
- // Enable VNF, if not enabled already
- valstr = mParameters.get(TICameraParameters::KEY_VNF);
- if ( (valstr == NULL) ||
- ( (valstr != NULL) && (strcmp(valstr, "1") != 0) ) )
- {
+ // Set VNF
+ if (params.get(TICameraParameters::KEY_VNF) == NULL) {
CAMHAL_LOGDA("Enable VNF");
mParameters.set(TICameraParameters::KEY_VNF, "1");
restartPreviewRequired = true;
+ } else {
+ valstr = mParameters.get(TICameraParameters::KEY_VNF);
+ if (valstr && strcmp(valstr, params.get(TICameraParameters::KEY_VNF)) != 0) {
+ restartPreviewRequired = true;
}
+ mParameters.set(TICameraParameters::KEY_VNF, params.get(TICameraParameters::KEY_VNF));
+ }
// For VSTAB alone for 1080p resolution, padded width goes > 2048, which cannot be rendered by GPU.
// In such case, there is support in Ducati for combination of VSTAB & VNF requiring padded width < 2048.
// So we are forcefully enabling VNF, if VSTAB is enabled for 1080p resolution.
- valstr = mParameters.get(TICameraParameters::KEY_VSTAB);
- if ((valstr != NULL) && (strcmp(valstr, "1") == 0) && (mPreviewWidth == 1920))
- {
+ valstr = mParameters.get(CameraParameters::KEY_VIDEO_STABILIZATION);
+ if (valstr && (strcmp(valstr, CameraParameters::TRUE) == 0) && (mPreviewWidth == 1920)) {
CAMHAL_LOGDA("Force Enable VNF for 1080p");
mParameters.set(TICameraParameters::KEY_VNF, "1");
restartPreviewRequired = true;
- }
}
-
+ }
LOG_FUNCTION_NAME_EXIT;
return restartPreviewRequired;
@@ -1968,30 +1986,11 @@ bool CameraHal::resetVideoModeParameters()
// Set CAPTURE_MODE to VIDEO_MODE, if not set already and Restart Preview
valstr = mParameters.get(TICameraParameters::KEY_CAP_MODE);
- if ( (valstr != NULL) && (strcmp(valstr, (const char *) TICameraParameters::VIDEO_MODE) == 0) )
- {
+ if ((valstr != NULL) && (strcmp(valstr, TICameraParameters::VIDEO_MODE) == 0)) {
CAMHAL_LOGDA("Reset Capture-Mode to default");
mParameters.set(TICameraParameters::KEY_CAP_MODE, "");
restartPreviewRequired = true;
- }
-
- // Enable VSTAB, if not enabled already
- valstr = mParameters.get(TICameraParameters::KEY_VSTAB);
- if ( (valstr != NULL) && (strcmp(valstr, "1") == 0) )
- {
- CAMHAL_LOGDA("Disable VSTAB");
- mParameters.set(TICameraParameters::KEY_VSTAB, "0");
- restartPreviewRequired = true;
- }
-
- // Enable VNF, if not enabled already
- valstr = mParameters.get(TICameraParameters::KEY_VNF);
- if ( (valstr != NULL) && (strcmp(valstr, "1") == 0) )
- {
- CAMHAL_LOGDA("Disable VNF");
- mParameters.set(TICameraParameters::KEY_VNF, "0");
- restartPreviewRequired = true;
- }
+ }
LOG_FUNCTION_NAME_EXIT;
@@ -3221,8 +3220,7 @@ void CameraHal::insertSupportedParams()
p.set(TICameraParameters::KEY_S3D2D_PREVIEW_MODE,mCameraProperties->get(CameraProperties::S3D2D_PREVIEW_MODES));
p.set(TICameraParameters::KEY_AUTOCONVERGENCE_MODE, mCameraProperties->get(CameraProperties::AUTOCONVERGENCE_MODE));
p.set(TICameraParameters::KEY_MANUALCONVERGENCE_VALUES, mCameraProperties->get(CameraProperties::MANUALCONVERGENCE_VALUES));
- p.set(TICameraParameters::KEY_VSTAB,mCameraProperties->get(CameraProperties::VSTAB));
- p.set(TICameraParameters::KEY_VSTAB_VALUES,mCameraProperties->get(CameraProperties::VSTAB_VALUES));
+ p.set(CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED, mCameraProperties->get(CameraProperties::VSTAB_SUPPORTED));
p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, mCameraProperties->get(CameraProperties::FRAMERATE_RANGE_SUPPORTED));
p.set(TICameraParameters::KEY_SENSOR_ORIENTATION, mCameraProperties->get(CameraProperties::SENSOR_ORIENTATION));
p.set(TICameraParameters::KEY_SENSOR_ORIENTATION_VALUES, mCameraProperties->get(CameraProperties::SENSOR_ORIENTATION_VALUES));
@@ -3308,8 +3306,7 @@ void CameraHal::initDefaultParameters()
p.set(TICameraParameters::KEY_S3D2D_PREVIEW, mCameraProperties->get(CameraProperties::S3D2D_PREVIEW));
p.set(TICameraParameters::KEY_AUTOCONVERGENCE, mCameraProperties->get(CameraProperties::AUTOCONVERGENCE));
p.set(TICameraParameters::KEY_MANUALCONVERGENCE_VALUES, mCameraProperties->get(CameraProperties::MANUALCONVERGENCE_VALUES));
- p.set(TICameraParameters::KEY_VSTAB,mCameraProperties->get(CameraProperties::VSTAB));
- p.set(TICameraParameters::KEY_VSTAB_VALUES,mCameraProperties->get(CameraProperties::VSTAB_VALUES));
+ p.set(CameraParameters::KEY_VIDEO_STABILIZATION, mCameraProperties->get(CameraProperties::VSTAB));
p.set(CameraParameters::KEY_FOCAL_LENGTH, mCameraProperties->get(CameraProperties::FOCAL_LENGTH));
p.set(CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE, mCameraProperties->get(CameraProperties::HOR_ANGLE));
p.set(CameraParameters::KEY_VERTICAL_VIEW_ANGLE, mCameraProperties->get(CameraProperties::VER_ANGLE));
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp
index eb5f746..527b7c2 100644
--- a/camera/CameraParameters.cpp
+++ b/camera/CameraParameters.cpp
@@ -85,7 +85,7 @@ const char CameraProperties::AUTOCONVERGENCE[] = "prop-auto-convergence";
const char CameraProperties::AUTOCONVERGENCE_MODE[] = "prop-auto-convergence-mode";
const char CameraProperties::MANUALCONVERGENCE_VALUES[] = "prop-manual-convergence-values";
const char CameraProperties::VSTAB[] = "prop-vstab-default";
-const char CameraProperties::VSTAB_VALUES[] = "prop-vstab-values";
+const char CameraProperties::VSTAB_SUPPORTED[] = "prop-vstab-supported";
const char CameraProperties::REVISION[] = "prop-revision";
const char CameraProperties::FOCAL_LENGTH[] = "prop-focal-length";
const char CameraProperties::HOR_ANGLE[] = "prop-horizontal-angle";
diff --git a/camera/OMXCameraAdapter/OMXAlgo.cpp b/camera/OMXCameraAdapter/OMXAlgo.cpp
index 5b9014e..9287f2a 100644
--- a/camera/OMXCameraAdapter/OMXAlgo.cpp
+++ b/camera/OMXCameraAdapter/OMXAlgo.cpp
@@ -29,6 +29,8 @@
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
+#undef TRUE
+
namespace android {
status_t OMXCameraAdapter::setParametersAlgo(const CameraParameters &params,
@@ -220,8 +222,8 @@ status_t OMXCameraAdapter::setParametersAlgo(const CameraParameters &params,
///Set VSTAB Configuration
bool vstabEnabled = false;
- if ( params.getInt(TICameraParameters::KEY_VSTAB) > 0 )
- {
+ valstr = params.get(CameraParameters::KEY_VIDEO_STABILIZATION);
+ if (valstr && strcmp(valstr, CameraParameters::TRUE) == 0) {
CAMHAL_LOGDA("VSTAB Enabled");
vstabEnabled = true;
}
diff --git a/camera/OMXCameraAdapter/OMXCapabilities.cpp b/camera/OMXCameraAdapter/OMXCapabilities.cpp
index 4e8ea2f..5d381e4 100644
--- a/camera/OMXCameraAdapter/OMXCapabilities.cpp
+++ b/camera/OMXCameraAdapter/OMXCapabilities.cpp
@@ -1052,6 +1052,7 @@ status_t OMXCameraAdapter::insertDefaults(CameraProperties::Properties* params,
params->set(CameraProperties::SCENE_MODE, DEFAULT_SCENE_MODE);
params->set(CameraProperties::SHARPNESS, DEFAULT_SHARPNESS);
params->set(CameraProperties::VSTAB, DEFAULT_VSTAB);
+ params->set(CameraProperties::VSTAB_SUPPORTED, DEFAULT_VSTAB_SUPPORTED);
params->set(CameraProperties::WHITEBALANCE, DEFAULT_WB);
params->set(CameraProperties::ZOOM, DEFAULT_ZOOM);
params->set(CameraProperties::MAX_FD_HW_FACES, DEFAULT_MAX_FD_HW_FACES);
diff --git a/camera/OMXCameraAdapter/OMXDefaults.cpp b/camera/OMXCameraAdapter/OMXDefaults.cpp
index 8a6d681..5e6fe8e 100644
--- a/camera/OMXCameraAdapter/OMXDefaults.cpp
+++ b/camera/OMXCameraAdapter/OMXDefaults.cpp
@@ -61,7 +61,8 @@ const char OMXCameraAdapter::DEFAULT_MAX_FOCUS_AREAS[] = "1";
const char OMXCameraAdapter::DEFAULT_SATURATION[] = "100";
const char OMXCameraAdapter::DEFAULT_SCENE_MODE[] = "auto";
const char OMXCameraAdapter::DEFAULT_SHARPNESS[] = "100";
-const char OMXCameraAdapter::DEFAULT_VSTAB[] = "0";
+const char OMXCameraAdapter::DEFAULT_VSTAB[] = "false";
+const char OMXCameraAdapter::DEFAULT_VSTAB_SUPPORTED[] = "true";
const char OMXCameraAdapter::DEFAULT_WB[] = "auto";
const char OMXCameraAdapter::DEFAULT_ZOOM[] = "0";
const char OMXCameraAdapter::DEFAULT_MAX_FD_HW_FACES[] = __STRINGIFY(MAX_NUM_FACES_SUPPORTED);
diff --git a/camera/TICameraParameters.cpp b/camera/TICameraParameters.cpp
index 2980645..862edc8 100644
--- a/camera/TICameraParameters.cpp
+++ b/camera/TICameraParameters.cpp
@@ -40,8 +40,6 @@ const char TICameraParameters::KEY_SHUTTER_ENABLE[] = "shutter-enable";
const char TICameraParameters::KEY_CAMERA_NAME[] = "camera-name";
const char TICameraParameters::KEY_BURST[] = "burst-capture";
const char TICameraParameters::KEY_CAP_MODE[] = "mode";
-const char TICameraParameters::KEY_VSTAB[] = "vstab";
-const char TICameraParameters::KEY_VSTAB_VALUES[] = "vstab-values";
const char TICameraParameters::KEY_VNF[] = "vnf";
const char TICameraParameters::KEY_SATURATION[] = "saturation";
const char TICameraParameters::KEY_BRIGHTNESS[] = "brightness";
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index aaea2a7..e44c1b6 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -985,21 +985,6 @@ public:
void releaseRecordingFrame(const void *opaque);
/**
- * Set the camera parameters specific to Video Recording.
- */
- bool setVideoModeParameters();
-
- /**
- * Reset the camera parameters specific to Video Recording.
- */
- bool resetVideoModeParameters();
-
- /**
- * Restart the preview with setParameter.
- */
- status_t restartPreview();
-
- /**
* Start auto focus, the notification callback routine is called
* with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus()
* will be called again if another auto focus is needed.
@@ -1100,6 +1085,15 @@ private:
/** @name internalFunctionsPrivate */
//@{
+ /** Set the camera parameters specific to Video Recording. */
+ bool setVideoModeParameters(const CameraParameters&);
+
+ /** Reset the camera parameters specific to Video Recording. */
+ bool resetVideoModeParameters();
+
+ /** Restart the preview with setParameter. */
+ status_t restartPreview();
+
status_t parseResolution(const char *resStr, int &width, int &height);
void insertSupportedParams();
diff --git a/camera/inc/CameraProperties.h b/camera/inc/CameraProperties.h
index 7b9dbd2..a220af7 100644
--- a/camera/inc/CameraProperties.h
+++ b/camera/inc/CameraProperties.h
@@ -118,7 +118,7 @@ public:
static const char S3D2D_PREVIEW[];
static const char S3D2D_PREVIEW_MODES[];
static const char VSTAB[];
- static const char VSTAB_VALUES[];
+ static const char VSTAB_SUPPORTED[];
static const char FRAMERATE_RANGE[];
static const char FRAMERATE_RANGE_IMAGE[];
static const char FRAMERATE_RANGE_VIDEO[];
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index 9f938be..4b82109 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -732,6 +732,7 @@ private:
static const char DEFAULT_SCENE_MODE[];
static const char DEFAULT_SHARPNESS[];
static const char DEFAULT_VSTAB[];
+ static const char DEFAULT_VSTAB_SUPPORTED[];
static const char DEFAULT_WB[];
static const char DEFAULT_ZOOM[];
static const char DEFAULT_MAX_FD_HW_FACES[];
diff --git a/camera/inc/TICameraParameters.h b/camera/inc/TICameraParameters.h
index 1886d0c..e01b38d 100644
--- a/camera/inc/TICameraParameters.h
+++ b/camera/inc/TICameraParameters.h
@@ -39,8 +39,6 @@ static const char KEY_CAMERA_NAME[];
static const char KEY_S3D_SUPPORTED[];
static const char KEY_BURST[];
static const char KEY_CAP_MODE[];
-static const char KEY_VSTAB[];
-static const char KEY_VSTAB_VALUES[];
static const char KEY_VNF[];
static const char KEY_SATURATION[];
static const char KEY_BRIGHTNESS[];