diff options
-rw-r--r-- | camera/BaseCameraAdapter.cpp | 2 | ||||
-rw-r--r-- | camera/CameraHal.cpp | 139 | ||||
-rw-r--r-- | camera/CameraParameters.cpp | 6 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapabilities.cpp | 6 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXDefaults.cpp | 3 | ||||
-rw-r--r-- | camera/inc/CameraHal.h | 5 | ||||
-rw-r--r-- | camera/inc/CameraProperties.h | 3 | ||||
-rw-r--r-- | camera/inc/OMXCameraAdapter/OMXCameraAdapter.h | 3 |
8 files changed, 84 insertions, 83 deletions
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp index 45e5027..32084ad 100644 --- a/camera/BaseCameraAdapter.cpp +++ b/camera/BaseCameraAdapter.cpp @@ -1209,7 +1209,7 @@ int BaseCameraAdapter::setInitFrameRefCount(void* buf, unsigned int mask) case CameraFrame::IMAGE_FRAME: { - setFrameRefCount(buf, CameraFrame::IMAGE_FRAME, (int) mRawSubscribers.size()); + setFrameRefCount(buf, CameraFrame::IMAGE_FRAME, (int) mImageSubscribers.size()); } break; case CameraFrame::RAW_FRAME: diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 7da6af4..794297a 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -255,6 +255,7 @@ int CameraHal::setParameters(const CameraParameters& params) bool updateRequired = false; CameraParameters oldParams(mParameters.flatten()); bool videoMode = false; + char range[MAX_PROP_VALUE_LENGTH]; { Mutex::Autolock lock(mLock); @@ -443,98 +444,94 @@ int CameraHal::setParameters(const CameraParameters& params) } framerate = params.getPreviewFrameRate(); + valstr = params.get(CameraParameters::KEY_PREVIEW_FPS_RANGE); CAMHAL_LOGDB("FRAMERATE %d", framerate); + CAMHAL_LOGVB("Passed FRR: %s, Supported FRR %s", valstr + , mCameraProperties->get(CameraProperties::FRAMERATE_RANGE_SUPPORTED)); + CAMHAL_LOGVB("Passed FR: %d, Supported FR %s", framerate + , mCameraProperties->get(CameraProperties::SUPPORTED_PREVIEW_FRAME_RATES)); + + + //Perform parameter validation + if(!isParameterValid(valstr + , mCameraProperties->get(CameraProperties::FRAMERATE_RANGE_SUPPORTED)) + || !isParameterValid(framerate, + mCameraProperties->get(CameraProperties::SUPPORTED_PREVIEW_FRAME_RATES))) + { + CAMHAL_LOGEA("Invalid frame rate range or frame rate"); + return -EINVAL; + } + // Variable framerate ranges have higher priority over // deprecated constant FPS. "KEY_PREVIEW_FPS_RANGE" should // be cleared by the client in order for constant FPS to get // applied. - if ( (valstr = params.get(CameraParameters::KEY_PREVIEW_FPS_RANGE) ) != NULL ) + if ( strcmp(valstr, mCameraProperties->get(CameraProperties::FRAMERATE_RANGE)) != 0) { - CAMHAL_LOGDB("FPS Range = %s", valstr); - CAMHAL_LOGDB("DEFAULT FPS Range = %s", mCameraProperties->get(CameraProperties::FRAMERATE_RANGE)); - + // APP wants to set FPS range + //Set framerate = MAXFPS + CAMHAL_LOGDA("APP IS CHANGING FRAME RATE RANGE"); params.getPreviewFpsRange(&minFPS, &maxFPS); - if (videoMode) - { - mCameraProperties->set(CameraProperties::FRAMERATE_RANGE, CameraProperties::DEFAULT_VIDEO_FPS_RANGE); - valstr = mCameraProperties->get(CameraProperties::FRAMERATE_RANGE); - mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, valstr); - mParameters.getPreviewFpsRange(&minFPS, &maxFPS); - } - if ( ( 0 > minFPS ) || ( 0 > maxFPS ) ) { CAMHAL_LOGEA("ERROR: FPS Range is negative!"); - ret = -EINVAL; + return -EINVAL; } - minFPS /= CameraHal::VFR_SCALE; - maxFPS /= CameraHal::VFR_SCALE; + framerate = maxFPS /CameraHal::VFR_SCALE; - if ( ( 0 == minFPS ) || ( 0 == maxFPS ) ) + } + else + { + if ( framerate != atoi(mCameraProperties->get(CameraProperties::PREVIEW_FRAME_RATE)) ) { - CAMHAL_LOGEA("ERROR: FPS Range is invalid!"); - ret = -EINVAL; + selectFPSRange(framerate, &minFPS, &maxFPS); } + else + { + if (videoMode) { + valstr = mCameraProperties->get(CameraProperties::FRAMERATE_RANGE_VIDEO); + CameraParameters temp; + temp.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, valstr); + temp.getPreviewFpsRange(&minFPS, &maxFPS); + } + else { + valstr = mCameraProperties->get(CameraProperties::FRAMERATE_RANGE_IMAGE); + CameraParameters temp; + temp.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, valstr); + temp.getPreviewFpsRange(&minFPS, &maxFPS); + } - if ( maxFPS < minFPS ) - { - CAMHAL_LOGEA("ERROR: Max FPS is smaller than Min FPS!"); - ret = -EINVAL; - } + framerate = maxFPS / CameraHal::VFR_SCALE; + } - if ( strcmp(valstr, mCameraProperties->get(CameraProperties::FRAMERATE_RANGE)) != 0) - { - // APP wants to set FPS range - //Set framerate = MAXFPS - CAMHAL_LOGDA("APP IS CHANGING FRAME RATE RANGE"); - framerate = maxFPS ; - } - else if ( framerate != atoi(mCameraProperties->get(CameraProperties::PREVIEW_FRAME_RATE)) ) - { - //APP wants to set framerate - //Change FPS range to match framerate - //MAXFPS = Framerate - if ( isParameterValid(framerate, - mCameraProperties->get(CameraProperties::SUPPORTED_PREVIEW_FRAME_RATES)) ) - { - CAMHAL_LOGDA("APP IS CHANGING FRAME RATE"); - selectFPSRange(framerate, &minFPS, &maxFPS); - } - else - { - CAMHAL_LOGEA("Framerate NOT Supported!"); - return -EINVAL; - } - } + } - CAMHAL_LOGDB("SET FRAMERATE %d", framerate); - mParameters.setPreviewFrameRate(framerate); + CAMHAL_LOGDB("FPS Range = %s", valstr); + CAMHAL_LOGDB("DEFAULT FPS Range = %s", mCameraProperties->get(CameraProperties::FRAMERATE_RANGE)); - CAMHAL_LOGDB("FPS Range [%d, %d]", minFPS, maxFPS); - mParameters.set(TICameraParameters::KEY_MINFRAMERATE, minFPS); - mParameters.set(TICameraParameters::KEY_MAXFRAMERATE, maxFPS); - mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, valstr); - } - else if ( isParameterValid(framerate, - mCameraProperties->get(CameraProperties::SUPPORTED_PREVIEW_FRAME_RATES)) ) + minFPS /= CameraHal::VFR_SCALE; + maxFPS /= CameraHal::VFR_SCALE; + + if ( ( 0 == minFPS ) || ( 0 == maxFPS ) ) { - minFPS = framerate; - maxFPS = framerate; - mParameters.setPreviewFrameRate(framerate); - - CAMHAL_LOGDB("FPS Range [%d, %d]", minFPS, maxFPS); - mParameters.set(TICameraParameters::KEY_MINFRAMERATE, minFPS); - mParameters.set(TICameraParameters::KEY_MAXFRAMERATE, maxFPS); - mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, - params.get(CameraParameters::KEY_PREVIEW_FPS_RANGE)); + CAMHAL_LOGEA("ERROR: FPS Range is invalid!"); + ret = -EINVAL; } - else + + if ( maxFPS < minFPS ) { - return -EINVAL; + CAMHAL_LOGEA("ERROR: Max FPS is smaller than Min FPS!"); + ret = -EINVAL; } + CAMHAL_LOGDB("SET FRAMERATE %d", framerate); + mParameters.setPreviewFrameRate(framerate); + + CAMHAL_LOGDB("FPS Range [%d, %d]", minFPS, maxFPS); + mParameters.set(TICameraParameters::KEY_MINFRAMERATE, minFPS); + mParameters.set(TICameraParameters::KEY_MAXFRAMERATE, maxFPS); if( ( valstr = params.get(TICameraParameters::KEY_GBCE) ) != NULL ) { @@ -555,12 +552,6 @@ int CameraHal::setParameters(const CameraParameters& params) mParameters.set(TICameraParameters::KEY_AUTOCONVERGENCE, valstr); } - // if(params.get(TICameraParameters::KEY_AUTOCONVERGENCE_MODE)!=NULL) - // { - // CAMHAL_LOGDB("AutoConvergence Mode is set = %s", params.get(TICameraParameters::KEY_AUTOCONVERGENCE_MODE)); - // mParameters.set(TICameraParameters::KEY_AUTOCONVERGENCE_MODE, params.get(TICameraParameters::KEY_AUTOCONVERGENCE_MODE)); - // } - if( (valstr = params.get(TICameraParameters::KEY_MANUALCONVERGENCE_VALUES)) !=NULL ) { CAMHAL_LOGDB("ManualConvergence Value = %s", params.get(TICameraParameters::KEY_MANUALCONVERGENCE_VALUES)); @@ -2465,7 +2456,9 @@ char* CameraHal::getParameters() mCameraAdapter->getParameters(mParameters); } + params_str8 = mParameters.flatten(); + // camera service frees this string... params_string = (char*) malloc(sizeof(char) * (params_str8.length()+1)); strcpy(params_string, params_str8.string()); diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp index 092a20c..60c3dc0 100644 --- a/camera/CameraParameters.cpp +++ b/camera/CameraParameters.cpp @@ -90,7 +90,9 @@ const char CameraProperties::REVISION[] = "prop-revision"; const char CameraProperties::FOCAL_LENGTH[] = "prop-focal-length"; const char CameraProperties::HOR_ANGLE[] = "prop-horizontal-angle"; const char CameraProperties::VER_ANGLE[] = "prop-vertical-angle"; -const char CameraProperties::FRAMERATE_RANGE[]="prop-framerate-range-default"; +const char CameraProperties::FRAMERATE_RANGE[] = "prop-framerate-range-default"; +const char CameraProperties::FRAMERATE_RANGE_IMAGE[] = "prop-framerate-range-image-default"; +const char CameraProperties::FRAMERATE_RANGE_VIDEO[]="prop-framerate-range-video-default"; const char CameraProperties::FRAMERATE_RANGE_SUPPORTED[]="prop-framerate-range-values"; const char CameraProperties::SENSOR_ORIENTATION[]= "sensor-orientation"; const char CameraProperties::SENSOR_ORIENTATION_VALUES[]= "sensor-orientation-values"; @@ -112,8 +114,6 @@ const char CameraProperties::DEFAULT_VALUE[] = ""; const char CameraProperties::PARAMS_DELIMITER []= ","; -const char CameraProperties::DEFAULT_VIDEO_FPS_RANGE[]="24000,30000"; - // Returns the properties class for a specific Camera // Each value is indexed by the CameraProperties::CameraPropertyIndex enum int CameraProperties::getProperties(int cameraIndex, CameraProperties::Properties** properties) diff --git a/camera/OMXCameraAdapter/OMXCapabilities.cpp b/camera/OMXCameraAdapter/OMXCapabilities.cpp index acca1cf..ba897cc 100644 --- a/camera/OMXCameraAdapter/OMXCapabilities.cpp +++ b/camera/OMXCameraAdapter/OMXCapabilities.cpp @@ -640,8 +640,10 @@ status_t OMXCameraAdapter::insertVFramerates(CameraProperties::Properties* param } else { params->set(CameraProperties::FRAMERATE_RANGE_SUPPORTED, supported); CAMHAL_LOGDB("framerate ranges %s", supported); - params->set(CameraProperties::FRAMERATE_RANGE, DEFAULT_FRAMERATE_RANGE); - CAMHAL_LOGDB("Default framerate range: [%s]", DEFAULT_FRAMERATE_RANGE); + params->set(CameraProperties::FRAMERATE_RANGE, DEFAULT_FRAMERATE_RANGE_IMAGE); + params->set(CameraProperties::FRAMERATE_RANGE_VIDEO, DEFAULT_FRAMERATE_RANGE_VIDEO); + params->set(CameraProperties::FRAMERATE_RANGE_IMAGE, DEFAULT_FRAMERATE_RANGE_IMAGE); + CAMHAL_LOGDB("Default framerate range: [%s]", DEFAULT_FRAMERATE_RANGE_IMAGE); } LOG_FUNCTION_NAME; diff --git a/camera/OMXCameraAdapter/OMXDefaults.cpp b/camera/OMXCameraAdapter/OMXDefaults.cpp index 695a874..fa36c06 100644 --- a/camera/OMXCameraAdapter/OMXDefaults.cpp +++ b/camera/OMXCameraAdapter/OMXDefaults.cpp @@ -40,7 +40,8 @@ const char OMXCameraAdapter::DEFAULT_EXPOSURE_MODE[] = "auto"; const char OMXCameraAdapter::DEFAULT_FLASH_MODE[] = "off"; const char OMXCameraAdapter::DEFAULT_FOCUS_MODE_PREFERRED[] = "continuous-picture"; const char OMXCameraAdapter::DEFAULT_FOCUS_MODE[] = "infinity"; -const char OMXCameraAdapter::DEFAULT_FRAMERATE_RANGE[] = "15000,30000"; +const char OMXCameraAdapter::DEFAULT_FRAMERATE_RANGE_IMAGE[] = "15000,30000"; +const char OMXCameraAdapter::DEFAULT_FRAMERATE_RANGE_VIDEO[]="24000,30000"; const char OMXCameraAdapter::DEFAULT_IPP[] = "ldc-nsf"; const char OMXCameraAdapter::DEFAULT_GBCE[] = "enable"; const char OMXCameraAdapter::DEFAULT_ISO_MODE[] = "auto"; diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index ca42a17..873fb59 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -1142,7 +1142,10 @@ public: sp<IMemoryHeap> mPictureHeap; - int* mGrallocHandles; + int* mGrallocHandles; + bool mFpsRangeChangedByApp; + + diff --git a/camera/inc/CameraProperties.h b/camera/inc/CameraProperties.h index 27824f3..7a2eb54 100644 --- a/camera/inc/CameraProperties.h +++ b/camera/inc/CameraProperties.h @@ -117,6 +117,8 @@ public: static const char VSTAB[];
static const char VSTAB_VALUES[];
static const char FRAMERATE_RANGE[];
+ static const char FRAMERATE_RANGE_IMAGE[];
+ static const char FRAMERATE_RANGE_VIDEO[];
static const char FRAMERATE_RANGE_SUPPORTED[];
static const char DEFAULT_VALUE[];
@@ -130,7 +132,6 @@ public: static const char MAX_NUM_FOCUS_AREAS[];
static const char VIDEO_SNAPSHOT_SUPPORTED[];
- static const char DEFAULT_VIDEO_FPS_RANGE[];
CameraProperties();
~CameraProperties();
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h index 4c85be4..e33746e 100644 --- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h +++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h @@ -687,7 +687,8 @@ private: static const char DEFAULT_FLASH_MODE[]; static const char DEFAULT_FOCUS_MODE_PREFERRED[]; static const char DEFAULT_FOCUS_MODE[]; - static const char DEFAULT_FRAMERATE_RANGE[]; + static const char DEFAULT_FRAMERATE_RANGE_IMAGE[]; + static const char DEFAULT_FRAMERATE_RANGE_VIDEO[]; static const char DEFAULT_IPP[]; static const char DEFAULT_GBCE[]; static const char DEFAULT_ISO_MODE[]; |