static const int _RELOAD_FOCUS_MODE = 0x1 << 21;
static const int _RELOAD_ZERO_SHUTTER_LAG = 0x1 << 22;
static const int _RELOAD_METERING_MODE = 0x1 << 23;
-static const int _RELOAD_SCENE_MODE_SET = 0x1 << 24;
+static const int _RELOAD_SCENE_MODE = 0x1 << 24;
static const int _RELOAD_EXTRA = 0x1 << 25;
-static const int _RELOAD_SCEN_MODE_OFF = _RELOAD_BRIGHTNESS | _RELOAD_WB |_RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FOCUS_MODE | _RELOAD_FLASH;
+static const int _RELOAD_NO_SCEN_MODE = _RELOAD_BRIGHTNESS | _RELOAD_WB |_RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FLASH;
+static const int _RELOAD_NO_SCEN_MODE_AFTER_PREVIEW = _RELOAD_FOCUS_MODE;
static const int _PREVIEW_PRE_PROCESSING = 0x01;
static const int _PREVIEW_POST_PROCESSING = 0x01 << 1;
, __fps(DEFAULT_CAMERA_PREVIEW_FPS)
#endif
, __focusMode(CAMERA_FOCUS_MODE_NONE)
+ , __currentFocusMode(CAMERA_FOCUS_MODE_NONE)
, __previewProcessing(0)
, __previewRegionHandle(_BufferInfoImpl::INVALID_BUFFER_HANDLE)
, __previewDisplayType(::CAMERA_DISPLAY_TYPE_NONE)
// re-configuration for new camera handle. active conf.
if (__sceneMode == CAMERA_SCENE_OFF)
{
- r = ReloadConfiguration(_RELOAD_SCEN_MODE_OFF);
+ r = ReloadConfiguration(_RELOAD_NO_SCEN_MODE);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, r=E_DEVICE_FAILED, E_DEVICE_FAILED, "[E_DEVICE_FAILED] Scen off mode configuration failed. Converted from [%s]", GetErrorMessage(r));
}
else
{
- r = ReloadConfiguration(_RELOAD_SCENE_MODE_SET);
+ r = ReloadConfiguration(_RELOAD_SCENE_MODE);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, r=E_DEVICE_FAILED, E_DEVICE_FAILED, "[E_DEVICE_FAILED] Scen on mode configuration failed. Converted from [%s]", GetErrorMessage(r));
}
int tempDisplayHandle = _BufferInfoImpl::INVALID_BUFFER_HANDLE;
CameraRotation tempDisplayRotationType = CAMERA_ROTATION_NONE;
camera_display_type_e tempDisplayType = ::CAMERA_DISPLAY_TYPE_NONE;
+ bool previewStarted = false;
SysLog(NID_MEDIA, "Camera StartPreview. pBufferInfo:%d, previewedData:%d", (int) pBufferInfo, previewedData);
SysTryReturn(NID_MEDIA, __isPoweredOn == true, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Camera is in an invalid state. Camera was not powered on");
case ::CAMERA_STATE_CAPTURED:
r = __pCoordinator->StartMmPreview();
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] camera start.", GetErrorMessage(r));
+ previewStarted = true;
break;
default:
break;
}
+ if (__sceneMode == CAMERA_SCENE_OFF)
+ {
+ r = ReloadConfiguration(_RELOAD_NO_SCEN_MODE_AFTER_PREVIEW);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, r=E_DEVICE_FAILED, E_DEVICE_FAILED, "[E_DEVICE_FAILED] Scen off mode configuration failed. Converted from [%s]", GetErrorMessage(r));
+ }
+
if (previewedData)
{
__previewProcessing = __previewProcessing | _PREVIEW_POST_PROCESSING;
{
__previewProcessing = __previewProcessing & (~_PREVIEW_POST_PROCESSING);
}
-
-
SetState(CAMERA_STATE_PREVIEW);
+
return r;
CATCH:
+ if (previewStarted)
+ {
+ __pCoordinator->StopMmPreview();
+ }
err = camera_unset_preview_cb(__handle);
__previewRegionHandle = _BufferInfoImpl::INVALID_BUFFER_HANDLE;
__previewDisplayType = ::CAMERA_DISPLAY_TYPE_NONE;
{
if(__sceneMode != CAMERA_SCENE_OFF)
{//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_BRIGHTNESS));
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_BRIGHTNESS));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_BRIGHTNESS : _COP_SECONDARY_BRIGHTNESS);
if(__sceneMode != CAMERA_SCENE_OFF)
{//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_FLASH));
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_FLASH));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = _CameraUtil::GetMmFlashMode(flashMode, attr);
if(__sceneMode != CAMERA_SCENE_OFF)
{//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_WB));
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_WB));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
camera_attr_whitebalance_e attr = ::CAMERA_ATTR_WHITE_BALANCE_NONE;
, r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This mode(%d) is not supported in the device.\n", focusMode);
if(__sceneMode != CAMERA_SCENE_OFF)
- {//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_FOCUS_MODE));
+ {
+ //because this attribute is related to scene mode.
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_FOCUS_MODE));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
- // Set the __focusCallback to false not to call the focus callback in case of CAF.
- r = ChangeFocusModeTo(__focusMode, focusMode);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. current focus mode is %d, new focus mode is %d", GetErrorMessage(r), __focusMode, focusMode);
+ if (__state == CAMERA_STATE_PREVIEW)
+ {
+ // Set the __focusCallback to false not to call the focus callback in case of CAF.
+ r = ChangeFocusModeTo(focusMode);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. New focus mode is %d", GetErrorMessage(r), focusMode);
+ }
__focusCallback = false;
__focusMode = focusMode;
if(__sceneMode != CAMERA_SCENE_OFF)
{//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_ISO));
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_ISO));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = _CameraUtil::GetMmIso(isoLevel, attr);
if(__sceneMode != CAMERA_SCENE_OFF)
{//because this attribute is related to scene mode.
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF & (~_RELOAD_METERING_MODE));
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE & (~_RELOAD_METERING_MODE));
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = _CameraUtil::GetMmMeteringMode(meteringMode, attr);
if ((sceneMode == CAMERA_SCENE_OFF) && (__sceneMode != CAMERA_SCENE_OFF))
{
- r = SetSceneModeOff(_RELOAD_SCEN_MODE_OFF);
+ r = SetSceneModeOff(_RELOAD_NO_SCEN_MODE);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
__sceneMode = CAMERA_SCENE_OFF;
}
if ( _CameraCapability::IsSupported(operation))
{
- r = ChangeFocusModeTo(__focusMode, __focusMode);
+ r = ChangeFocusModeTo(__focusMode);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. focus mode is %d", GetErrorMessage(r), __focusMode);
}
}
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. metering:%d", GetErrorMessage(r), __meteringMode);
}
}
- if (reload & _RELOAD_SCENE_MODE_SET)
+ if (reload & _RELOAD_SCENE_MODE)
{
_CameraOperationType operation = _COP_NONE;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_SCENE_MODE : _COP_SECONDARY_SCENE_MODE);
}
result
-_CameraImpl::ChangeFocusModeTo(CameraFocusMode currentMode, CameraFocusMode destMode)
+_CameraImpl::ChangeFocusModeTo(CameraFocusMode focusMode)
{
result r = E_SUCCESS;
int tableTotalCount = 0;
int err = MM_SUCCESS;
tableTotalCount = sizeof(_CAMERA_FOCUS_MODE_TRANSIT) / sizeof(_CAMERA_FOCUS_MODE_TRANSIT[0]);
- SysLog(NID_MEDIA, " currentMode:%d, destMode:%d, tableTotalCount:%d", currentMode, destMode, tableTotalCount);
+ SysLog(NID_MEDIA, " currentMode:%d, focusMode:%d, tableTotalCount:%d", __currentFocusMode, focusMode, tableTotalCount);
for (i = 0; i < tableTotalCount; i++)
{
- if (currentMode == _CAMERA_FOCUS_MODE_TRANSIT[i].currentMode && destMode == _CAMERA_FOCUS_MODE_TRANSIT[i].destMode)
+ if (__currentFocusMode == _CAMERA_FOCUS_MODE_TRANSIT[i].currentMode && focusMode == _CAMERA_FOCUS_MODE_TRANSIT[i].destMode)
{
- SysLog(NID_MEDIA, "Exist the matching mode field. loop i:%d, current mode:%d, destMode:%d, operation0:%d", i, currentMode, destMode, _CAMERA_FOCUS_MODE_TRANSIT[i].focusOperation0);
+ SysLog(NID_MEDIA, "Exist the matching mode field. loop i:%d, current mode:%d, focusMode:%d, operation0:%d", i, __currentFocusMode, focusMode, _CAMERA_FOCUS_MODE_TRANSIT[i].focusOperation0);
switch (_CAMERA_FOCUS_MODE_TRANSIT[i].focusOperation0)
{
case _FOCUS_MODE_OP_NONE:
// Set the mm's focus mode.
camera_attr_af_mode_e attr = ::CAMERA_ATTR_AF_NONE;
- r = _CameraUtil::GetMmFocusMode(destMode, attr);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. focus mode:%d", GetErrorMessage(r), destMode);
+ r = _CameraUtil::GetMmFocusMode(focusMode, attr);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. focus mode:%d", GetErrorMessage(r), focusMode);
err = camera_attr_set_af_mode (__handle, attr);
r = ConvertResult(err);
}
}
SysTryCatch(NID_MEDIA, i != tableTotalCount, r = E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Not found. ");
+
+ __currentFocusMode = focusMode;
return r;
CATCH:
- SysLog(NID_MEDIA, "[%s] Real currentMode:%d, param destMode:%d", GetErrorMessage(r), currentMode, destMode);
+ SysLog(NID_MEDIA, "[%s] Real currentMode:%d, param focusMode:%d", GetErrorMessage(r), __currentFocusMode, focusMode);
return r;
}
if (__sceneMode == CAMERA_SCENE_OFF)
{
- r = ReloadConfiguration(_RELOAD_SCEN_MODE_OFF);
+ r = ReloadConfiguration(_RELOAD_NO_SCEN_MODE);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
}
else
{
- r = ReloadConfiguration(_RELOAD_SCENE_MODE_SET);
+ r = ReloadConfiguration(_RELOAD_SCENE_MODE);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
}