2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMedia_CameraCapability.cpp
20 * @brief This file contains the implementation of camera/recorder capability header file FMedia_CameraCapability.h
24 #include <unique_ptr.h>
25 #include <FBaseSysLog.h>
26 #include <FBaseInteger.h>
27 #include <FBaseColArrayList.h>
28 #include "FMedia_CameraCoordinator.h"
29 #include "FMedia_CameraCapability.h"
30 #include "FMedia_CameraCapabilitySession.h"
31 #include "FMedia_CameraUtil.h"
32 #include "FMedia_CamPtrUtil.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Collection;
36 using namespace Tizen::Graphics;
38 namespace Tizen { namespace Media
41 _CameraCapabilitySafeHashMapT* _CameraCapability::__pMap = null;
43 _CameraCapabilitySafeHashMapT::_CameraCapabilitySafeHashMapT(void)
47 _CameraCapabilitySafeHashMapT::~_CameraCapabilitySafeHashMapT(void)
50 _CameraCapability::__pMap = null;
54 _CameraCapabilitySafeHashMapT::RemoveItems(void)
58 std::unique_ptr<IListT<_CameraDeviceType>, _ListPtrUtil::Remover> pList (GetKeysN(), _ListPtrUtil::remover);
59 SysTryReturn(NID_MEDIA, pList.get() != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
61 for (int i = 0; i < GetCount(); i++)
63 _CameraDeviceType deviceType = _CAMERA_DEVICE_NONE;
64 r = pList->GetAt(i, deviceType);
65 if (IsFailed(r) && deviceType == _CAMERA_DEVICE_NONE)
70 _CameraCapability* pCapability = null;
71 r = GetValue(deviceType, pCapability);
72 if (IsFailed(r) && pCapability == null)
81 const _CameraCapability::keyServiceMap _CameraCapability::__SERVICE_MAP[] =
84 _COP_NONE, _CAMERA_DEVICE_PRIMARY, null
87 _COP_PRIMARY_CAPTURE_FORMAT, _CAMERA_DEVICE_PRIMARY, GetSupportedCaptureFormatN
90 _COP_PRIMARY_CAPTURE_RESOLUTION, _CAMERA_DEVICE_PRIMARY, GetSupportedCaptureResolutionN
93 _COP_PRIMARY_DIRECTION, _CAMERA_DEVICE_PRIMARY, GetDirectionN
96 _COP_PRIMARY_EFFECT, _CAMERA_DEVICE_PRIMARY, GetSupportedEffectTypeN
99 _COP_PRIMARY_ISO_LEVEL, _CAMERA_DEVICE_PRIMARY, GetSupportedIsoLevelN
102 _COP_PRIMARY_PREVIEW_FORMAT, _CAMERA_DEVICE_PRIMARY, GetSupportedPreviewFormatN
105 _COP_PRIMARY_PREVIEW_FRAMERATE, _CAMERA_DEVICE_PRIMARY, GetSupportedPreviewFrameRateN
108 _COP_PRIMARY_PREVIEW_RESOLUTION, _CAMERA_DEVICE_PRIMARY, GetSupportedPreviewResolutionN
111 _COP_PRIMARY_RECORDING_RESOLUTION, _CAMERA_DEVICE_PRIMARY, GetSupportedRecordingResolutionN
114 _COP_PRIMARY_ROTATION, _CAMERA_DEVICE_PRIMARY, GetPhysicalRotationN
117 _COP_PRIMARY_BRIGHTNESS, _CAMERA_DEVICE_PRIMARY, GetSupportedBrightnessN
120 _COP_PRIMARY_CONTRAST, _CAMERA_DEVICE_PRIMARY, GetSupportedContrastN
123 _COP_PRIMARY_EXPOSURE, _CAMERA_DEVICE_PRIMARY, GetSupportedExposureN
126 _COP_PRIMARY_FLASH_MODE, _CAMERA_DEVICE_PRIMARY, GetSupportedFlashModeN
129 _COP_PRIMARY_FOCUS_MODE, _CAMERA_DEVICE_PRIMARY, GetSupportedFocusModeN
132 _COP_PRIMARY_METERING_MODE, _CAMERA_DEVICE_PRIMARY, GetSupportedMeteringModeN
135 _COP_PRIMARY_WHITE_BALANCE, _CAMERA_DEVICE_PRIMARY, GetSupportedWhiteBalanceN
138 _COP_PRIMARY_ZOOM_TYPE, _CAMERA_DEVICE_PRIMARY, null
141 _COP_PRIMARY_FLIP, _CAMERA_DEVICE_PRIMARY, null
144 _COP_PRIMARY_PREVIEW_ROTATION, _CAMERA_DEVICE_PRIMARY, null
147 _COP_PRIMARY_ZERO_SHUTTER_LAG, _CAMERA_DEVICE_PRIMARY, GetZeroShutterLagN
150 _COP_PRIMARY_ZOOM_LEVEL, _CAMERA_DEVICE_PRIMARY, GetSupportedZoomLevelN
153 _COP_PRIMARY_MAX_FRAMERATE, _CAMERA_DEVICE_PRIMARY, GetSupportedMaxRecordingFrameRateN
156 _COP_SECONDARY_CAPTURE_FORMAT, _CAMERA_DEVICE_SECONDARY, GetSupportedCaptureFormatN
159 _COP_SECONDARY_CAPTURE_RESOLUTION, _CAMERA_DEVICE_SECONDARY, GetSupportedCaptureResolutionN
162 _COP_SECONDARY_DIRECTION, _CAMERA_DEVICE_SECONDARY, GetDirectionN
165 _COP_SECONDARY_EFFECT, _CAMERA_DEVICE_SECONDARY, GetSupportedEffectTypeN
168 _COP_SECONDARY_ISO_LEVEL, _CAMERA_DEVICE_SECONDARY, GetSupportedIsoLevelN
171 _COP_SECONDARY_PREVIEW_FORMAT, _CAMERA_DEVICE_SECONDARY, GetSupportedPreviewFormatN
174 _COP_SECONDARY_PREVIEW_FRAMERATE, _CAMERA_DEVICE_SECONDARY, GetSupportedPreviewFrameRateN
177 _COP_SECONDARY_PREVIEW_RESOLUTION, _CAMERA_DEVICE_SECONDARY, GetSupportedPreviewResolutionN
180 _COP_SECONDARY_RECORDING_RESOLUTION, _CAMERA_DEVICE_SECONDARY, GetSupportedRecordingResolutionN
183 _COP_SECONDARY_ROTATION, _CAMERA_DEVICE_SECONDARY, GetPhysicalRotationN
186 _COP_SECONDARY_BRIGHTNESS, _CAMERA_DEVICE_SECONDARY, GetSupportedBrightnessN
189 _COP_SECONDARY_CONTRAST, _CAMERA_DEVICE_SECONDARY, GetSupportedContrastN
192 _COP_SECONDARY_EXPOSURE, _CAMERA_DEVICE_SECONDARY, GetSupportedExposureN
195 _COP_SECONDARY_FLASH_MODE, _CAMERA_DEVICE_SECONDARY, GetSupportedFlashModeN
198 _COP_SECONDARY_FOCUS_MODE, _CAMERA_DEVICE_SECONDARY, GetSupportedFocusModeN
201 _COP_SECONDARY_METERING_MODE, _CAMERA_DEVICE_SECONDARY, GetSupportedMeteringModeN
204 _COP_SECONDARY_WHITE_BALANCE, _CAMERA_DEVICE_SECONDARY, GetSupportedWhiteBalanceN
207 _COP_SECONDARY_ZOOM_TYPE, _CAMERA_DEVICE_SECONDARY, null
210 _COP_SECONDARY_FLIP, _CAMERA_DEVICE_SECONDARY, null
213 _COP_SECONDARY_PREVIEW_ROTATION, _CAMERA_DEVICE_SECONDARY, null
216 _COP_SECONDARY_ZERO_SHUTTER_LAG, _CAMERA_DEVICE_SECONDARY, GetZeroShutterLagN
219 _COP_SECONDARY_ZOOM_LEVEL, _CAMERA_DEVICE_SECONDARY, GetSupportedZoomLevelN
222 _COP_SECONDARY_MAX_FRAMERATE, _CAMERA_DEVICE_SECONDARY, GetSupportedMaxRecordingFrameRateN
225 _COP_MAX, _CAMERA_DEVICE_SECONDARY, null
229 _CameraCapability::_CameraCapability(void)
230 : __device(_CAMERA_DEVICE_NONE)
231 , __handle(MM_INVALID_HANDLE)
232 , __initPreviewWidth(0)
233 , __initPreviewHeight(0)
234 , __initCaptureWidth(0)
235 , __initCaptureHeight(0)
236 , __initPreviewFormat(::CAMERA_PIXEL_FORMAT_INVALID)
237 , __initCaptureFormat(::CAMERA_PIXEL_FORMAT_INVALID)
238 , __initFlashMode(::CAMERA_ATTR_FLASH_MODE_OFF)
239 , __initEffectMode(::CAMERA_ATTR_EFFECT_NONE)
240 , __initFps(::CAMERA_ATTR_FPS_AUTO)
241 , __initIsoLevel(::CAMERA_ATTR_ISO_AUTO)
242 , __initWb(::CAMERA_ATTR_WHITE_BALANCE_NONE)
243 , __initSceneMode(::CAMERA_ATTR_SCENE_MODE_NORMAL)
244 , __initMeteringMode(::CAMERA_ATTR_EXPOSURE_MODE_OFF)
245 , __initAfMode(::CAMERA_ATTR_AF_NONE)
249 _CameraCapability::~_CameraCapability(void)
251 _CameraCoordinator::Release(__device);
252 SysLog(NID_MEDIA, "Destroyed");
256 _CameraCapability::Construct(_CameraDeviceType cameraDevice)
258 int err = MM_SUCCESS;
259 result r = E_SUCCESS;
260 _CameraCoordinator* pCameraCoordinator = null;
261 SysLog(NID_MEDIA, "Enter. camera device:%d", cameraDevice);
263 pCameraCoordinator = _CameraCoordinator::AddInstance(cameraDevice);
265 SysTryReturn(NID_MEDIA, pCameraCoordinator !=null && r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
267 __handle = pCameraCoordinator->GetCameraHandle();
268 __device = cameraDevice;
270 err = camera_get_preview_resolution(__handle, &__initPreviewWidth, &__initPreviewHeight);
271 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the preview resolution error.");
273 err = camera_get_capture_resolution(__handle, &__initCaptureWidth, &__initCaptureHeight);
274 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the capture resolution error.");
276 err = camera_get_preview_format(__handle, &__initPreviewFormat);
277 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the preview format error.");
279 err = camera_get_capture_format(__handle, &__initCaptureFormat);
280 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the capture format error.");
282 err = camera_attr_get_flash_mode(__handle, &__initFlashMode);
283 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the flash mode error.");
285 err = camera_attr_get_effect(__handle, &__initEffectMode);
286 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the effect mode error.");
288 err = camera_attr_get_preview_fps(__handle, &__initFps);
289 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the fps error.");
291 err = camera_attr_get_iso(__handle, &__initIsoLevel);
292 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the iso error.");
294 err = camera_attr_get_whitebalance(__handle, &__initWb);
295 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the white balance.");
297 err = camera_attr_get_scene_mode(__handle, &__initSceneMode);
298 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the scene mode error.");
300 err = camera_attr_get_exposure_mode(__handle, &__initMeteringMode);
301 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the exposure error.");
303 err = camera_attr_get_af_mode(__handle, &__initAfMode);
304 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Getting the AF mode error.");
310 _CameraCapability::InitSafeHashMapInst()
312 static _CameraCapabilitySafeHashMapT map;
313 result r = E_SUCCESS;
316 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
325 _CameraCapability::AddInstance(_CameraDeviceType cameraDevice)
327 result r = E_SUCCESS;
331 _CameraCapability* pCapability = null;
333 SysTryReturn(NID_MEDIA, cameraDevice > _CAMERA_DEVICE_NONE && cameraDevice < _CAMERA_DEVICE_MAX,
334 null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument. camderDevice:%d.", cameraDevice);
336 static pthread_once_t once_block = PTHREAD_ONCE_INIT;
340 pthread_once(&once_block, InitSafeHashMapInst);
342 SysTryCatch(NID_MEDIA, __pMap != null, , r, "[%s] Propagating.", GetErrorMessage(r));
345 r = __pMap->ContainsKey(cameraDevice, out);
346 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
350 r = __pMap->GetValue(cameraDevice, pCapability);
351 SysTryCatch(NID_MEDIA, r == E_SUCCESS && pCapability != null, , r, "[%s] Propagating.", GetErrorMessage(r));
355 pCapability = new (std::nothrow) _CameraCapability();
356 SysTryCatch(NID_MEDIA, pCapability !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
358 r = pCapability->Construct(cameraDevice);
359 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
361 r = __pMap->Add(cameraDevice, pCapability);
362 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
365 pCapability->AddRefCount();
369 if (pCapability != null)
377 _CameraCapability::Release(_CameraDeviceType cameraDevice)
379 result r = E_SUCCESS;
383 _CameraCapability* pCameraCapability = null;
384 r = __pMap->GetValue(cameraDevice, pCameraCapability);
385 SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
387 if (pCameraCapability->ReleaseRefCount() == 0)
389 delete pCameraCapability;
390 r = __pMap->Remove(cameraDevice);
391 SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
396 Tizen::Base::Collection::ArrayList*
397 _CameraCapability::GetListN(_CameraOperationType key, _ResultType& itemType)
399 //check key boundary condition
400 SysTryReturn(NID_MEDIA, (key > _COP_NONE && key < _COP_MAX), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument. key :%d", key);
402 _CameraDeviceType deviceType = __SERVICE_MAP[key].deviceType;
403 _CameraQueryFunc serviceRoutine = __SERVICE_MAP[key].serviceRoutine;
405 //check service handler for a given key
406 SysTryReturn(NID_MEDIA, serviceRoutine != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The query function is not found.");
408 std::unique_ptr<ArrayList, _ListPtrUtil::Remover> pList (null, _ListPtrUtil::remover);
409 Object* pObj = serviceRoutine(deviceType, _QUERY_LIST, itemType);
412 case _RESULT_INTEGER_LIST:
414 case _RESULT_PAIR_INTEGER_LIST:
416 case _RESULT_DIMENSION_LIST:
418 case _RESULT_DOUBLE_LIST:
420 case _RESULT_STRING_LIST:
422 pList.reset(dynamic_cast<ArrayList*>(pObj));
423 SysTryCatch(NID_MEDIA, pList.get() != null, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
424 SysTryCatch(NID_MEDIA, pList->GetCount() > 0, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Empty data returned for key = [%d]", key);
425 SysLog(NID_MEDIA, "Valid data returned for key = %d count = %d", key, pList->GetCount());
430 SysLogException(NID_MEDIA, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Supported List is not retrieved. key = [%d]", key);
434 return pList.release();
441 _CameraCapability::IsSupported(_CameraOperationType key)
443 //check key boundary condition
444 SysTryReturn(NID_MEDIA, (key > _COP_NONE && key < _COP_MAX), false, E_INVALID_ARG, "[E_INVALID_ARG] The key:%d is invalid.", key);
446 _CameraDeviceType deviceType = __SERVICE_MAP[key].deviceType;
447 _CameraQueryFunc serviceRoutine = __SERVICE_MAP[key].serviceRoutine;
448 _ResultType itemType = _RESULT_NONE;
450 //check service handler for a given key
451 SysTryReturn(NID_MEDIA, serviceRoutine != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
453 std::unique_ptr<ArrayList, _ListPtrUtil::Remover> pList (null, _ListPtrUtil::remover);
454 Object* pObj = serviceRoutine(deviceType, _QUERY_LIST, itemType);
457 case _RESULT_INTEGER_LIST:
459 case _RESULT_DIMENSION_LIST:
461 case _RESULT_DOUBLE_LIST:
463 case _RESULT_STRING_LIST:
465 pList.reset(dynamic_cast<ArrayList*>(pObj));
466 SysTryCatch(NID_MEDIA, pList.get() != null, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
467 SysTryCatch(NID_MEDIA, pList->GetCount()>0, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no valid data in key = [%d].", key);
471 case _RESULT_PAIR_INTEGER_LIST:
473 pList.reset(dynamic_cast<ArrayList*>(pObj));
474 SysTryCatch(NID_MEDIA, pList.get() != null, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
476 Integer* pInteger = null;
477 pInteger = dynamic_cast<Integer*>(pList->GetAt(1)); // Get max value;
478 SysTryCatch(NID_MEDIA, pInteger != null, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Max value is null for key = [%d].", key);
479 SysTryCatch(NID_MEDIA, pInteger->ToInt() > 0, , E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Max value is %d for key = [%d].", pInteger->ToInt(), key);
485 SysLogException(NID_MEDIA, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
489 SysLog(NID_MEDIA, "Valid data returned for key = %d count = %d", key, pList->GetCount());
497 _CameraCapability::GetValueN(_CameraOperationType key, _QueryType queryType, _ResultType& itemType)
499 Tizen::Base::Object* pValue = null;
501 //check key boundary condition
502 SysTryReturn(NID_MEDIA, (key > _COP_NONE && key < _COP_MAX), null, E_INVALID_ARG, "[E_INVALID_ARG] The key:%d is invalid.", key);
503 SysTryReturn(NID_MEDIA, (queryType >= _QUERY_DEFAULT_VALUE && queryType < _QUERY_MAX), null, E_INVALID_ARG, "[E_INVALID_ARG] The query:%d is invalid.", queryType);
505 _CameraDeviceType deviceType = __SERVICE_MAP[key].deviceType;
506 _CameraQueryFunc serviceRoutine = __SERVICE_MAP[key].serviceRoutine;
508 //check service handler for a given key
509 SysTryReturn(NID_MEDIA, serviceRoutine != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The query function is not found.");
511 Object* pObj = serviceRoutine(deviceType, queryType, itemType);
515 case _RESULT_INTEGER:
517 pValue = dynamic_cast<Integer*>(pObj);
518 SysTryReturn(NID_MEDIA, null != pValue, null, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
522 case _RESULT_DIMENSION:
524 pValue = dynamic_cast<Dimension*>(pObj);
525 SysTryReturn(NID_MEDIA, null != pValue, null, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] There is no data list in key = [%d].", key);
529 case _RESULT_INTEGER_LIST:
531 case _RESULT_PAIR_INTEGER_LIST:
533 case _RESULT_DIMENSION_LIST:
535 case _RESULT_DOUBLE_LIST:
537 case _RESULT_STRING_LIST:
540 SysLogException(NID_MEDIA, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Default value cannot be retrived. key = [%d], itemType:%d", key, itemType);
544 SysLog(NID_MEDIA, "Valid data returned for key = %d", key);
552 _CameraCapability::GetHandle(void) const
558 _CameraCapability::GetDevice(void) const
564 _CameraCapability::GetInitResolution(AttributeResType opType, int &width, int &height) const
568 case ATTR_RES_PREVIEW:
570 width = __initPreviewWidth;
571 height = __initPreviewHeight;
575 case ATTR_RES_CAPTURE:
577 width = __initCaptureWidth;
578 height = __initCaptureHeight;
588 _CameraCapability::GetInitValue(AttributeType opType, int& mmAttr) const
592 case ATTR_PREVIEW_FORMAT:
594 mmAttr = __initPreviewFormat;
598 case ATTR_CAPTURE_FORMAT:
600 mmAttr = __initCaptureFormat;
604 case ATTR_FLASH_MODE:
606 mmAttr = __initFlashMode;
610 case ATTR_EFFECT_MODE:
612 mmAttr = __initEffectMode;
624 mmAttr = __initIsoLevel;
628 case ATTR_WHITE_BALANCE:
634 case ATTR_SCENE_MODE:
636 mmAttr = __initSceneMode;
640 case ATTR_EXPOSURE_MODE:
642 mmAttr = __initMeteringMode;
646 case ATTR_AUTO_FOCUS_MODE:
648 mmAttr = __initAfMode;
658 _CameraCapability::GetSupportedPreviewResolutionN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
660 Object* pResolution = null;
661 int err = MM_SUCCESS;
662 result r = E_SUCCESS;
664 _CameraCapabilitySession cameraCapbilitySession;
665 r = cameraCapbilitySession.Construct(deviceType);
666 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
668 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
669 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
671 _CameraHandle cameraHandle = pCapability->GetHandle();
672 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
674 if (queryType == _QUERY_LIST)
676 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pResolutionList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
677 SysTryReturn(NID_MEDIA, pResolutionList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
679 err = camera_foreach_supported_preview_resolution(cameraHandle, SupportedCameraPreviewResolutionCb, pResolutionList.get());
680 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
682 itemType = _RESULT_DIMENSION_LIST;
683 pResolution = pResolutionList.release();
685 else if (queryType == _QUERY_DEFAULT_VALUE)
689 pCapability->GetInitResolution(_CameraCapability::ATTR_RES_PREVIEW, width, height);
691 std::unique_ptr<Dimension> pDimResolution (new (std::nothrow) Dimension(width, height));
692 SysTryReturn(NID_MEDIA, pDimResolution.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
694 itemType = _RESULT_DIMENSION;
695 pResolution = pDimResolution.release();
702 _CameraCapability::GetSupportedCaptureResolutionN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
704 Object* pResolution = null;
705 int err = MM_SUCCESS;
706 result r = E_SUCCESS;
708 _CameraCapabilitySession cameraCapbilitySession;
709 r = cameraCapbilitySession.Construct(deviceType);
710 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
712 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
713 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
715 _CameraHandle cameraHandle = pCapability->GetHandle();
716 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
718 if (queryType == _QUERY_LIST)
720 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pResolutionList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
721 SysTryReturn(NID_MEDIA, pResolutionList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
723 err = camera_foreach_supported_capture_resolution(cameraHandle, SupportedCameraCaptureResolutionCb, pResolutionList.get());
724 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
726 itemType = _RESULT_DIMENSION_LIST;
727 pResolution = pResolutionList.release();
729 else if (queryType == _QUERY_DEFAULT_VALUE)
733 pCapability->GetInitResolution(_CameraCapability::ATTR_RES_CAPTURE, width, height);
735 std::unique_ptr<Dimension> pDimResolution (new (std::nothrow) Dimension(width, height));
736 SysTryReturn(NID_MEDIA, pDimResolution.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
738 itemType = _RESULT_DIMENSION;
739 pResolution = pDimResolution.release();
746 _CameraCapability::GetSupportedRecordingResolutionN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
748 Object* pResolution = null;
749 int err = MM_SUCCESS;
750 result r = E_SUCCESS;
752 _CameraCapabilitySession cameraCapbilitySession;
753 r = cameraCapbilitySession.Construct(deviceType);
754 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
756 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
757 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
759 _CameraHandle cameraHandle = pCapability->GetHandle();
760 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
762 if (queryType == _QUERY_LIST)
764 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pResolutionList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
765 SysTryReturn(NID_MEDIA, pResolutionList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
767 err = camera_foreach_supported_preview_resolution(cameraHandle, SupportedCameraPreviewResolutionCb, pResolutionList.get());
768 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
770 itemType = _RESULT_DIMENSION_LIST;
771 pResolution = pResolutionList.release();
773 else if (queryType == _QUERY_DEFAULT_VALUE)
777 pCapability->GetInitResolution(_CameraCapability::ATTR_RES_PREVIEW, width, height);
779 std::unique_ptr<Dimension> pDimResolution (new (std::nothrow) Dimension(width, height));
780 SysTryReturn(NID_MEDIA, pDimResolution.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
782 itemType = _RESULT_DIMENSION;
783 pResolution = pDimResolution.release();
790 _CameraCapability::GetSupportedPreviewFormatN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
792 Object* pFormat = null;
793 int err = MM_SUCCESS;
794 result r = E_SUCCESS;
796 _CameraCapabilitySession cameraCapbilitySession;
797 r = cameraCapbilitySession.Construct(deviceType);
798 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
800 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
801 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
803 _CameraHandle cameraHandle = pCapability->GetHandle();
804 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
806 if (queryType == _QUERY_LIST)
809 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pFormatList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
810 SysTryReturn(NID_MEDIA, pFormatList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
812 err = camera_foreach_supported_preview_format(cameraHandle, SupportedCameraPreviewFormatCb, pFormatList.get());
813 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
815 itemType = _RESULT_INTEGER_LIST;
816 pFormat = pFormatList.release();
818 else if (queryType == _QUERY_DEFAULT_VALUE)
820 PixelFormat value = PIXEL_FORMAT_YCbCr420_PLANAR;
822 // Camera's PowerOn should be called to initialize the default value with capability's return value.
823 result r = E_SUCCESS;
824 int mmAttr = ::CAMERA_PIXEL_FORMAT_INVALID;
825 pCapability->GetInitValue(_CameraCapability::ATTR_PREVIEW_FORMAT, mmAttr);
827 r = _CameraUtil::GetOspGrpPixelFormat((camera_pixel_format_e)mmAttr, value);
828 //SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
829 //This is temporary code because PIXEL_FORMAT_YUYV is not in the Graphics's PIXEL_FORMAT list.
832 value = PIXEL_FORMAT_YCbCr420_PLANAR;
833 SysLog(NID_MEDIA, "YCbCr420 will be used instead of device default value.");
836 std::unique_ptr<Integer> pFormatValue (new (std::nothrow) Integer((int)value));
837 SysTryReturn(NID_MEDIA, pFormatValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
839 itemType = _RESULT_INTEGER;
840 pFormat = pFormatValue.release();
847 _CameraCapability::GetSupportedCaptureFormatN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
849 Object* pFormat = null;
850 int err = MM_SUCCESS;
851 result r = E_SUCCESS;
853 _CameraCapabilitySession cameraCapbilitySession;
854 r = cameraCapbilitySession.Construct(deviceType);
855 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
857 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
858 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
860 _CameraHandle cameraHandle = pCapability->GetHandle();
861 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
863 if (queryType == _QUERY_LIST)
865 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pFormatList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
866 SysTryReturn(NID_MEDIA, pFormatList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
868 err = camera_foreach_supported_capture_format(cameraHandle, SupportedCameraCaptureFormatCb, pFormatList.get());
869 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
871 itemType = _RESULT_INTEGER_LIST;
872 pFormat = pFormatList.release();
874 else if (queryType == _QUERY_DEFAULT_VALUE)
876 PixelFormat value = PIXEL_FORMAT_JPEG;
878 // This means that the real device's default value is different from the capability's return value.
879 // Camera's PowerOn should be called to initialize the default value with capability's return value.
880 // result r = E_SUCCESS;
881 // int mmAttr = ::CAMERA_PIXEL_FORMAT_INVALID;
882 // pCapability->GetInitValue(_CameraCapability::ATTR_CAPTURE_FORMAT, mmAttr);
884 // r = _CameraUtil::GetOspGrpPixelFormat((camera_pixel_format_e)mmAttr, value);
885 // SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
887 std::unique_ptr<Integer> pFormatValue (new (std::nothrow) Integer((int)value));
888 SysTryReturn(NID_MEDIA, pFormatValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
890 itemType = _RESULT_INTEGER;
891 pFormat = pFormatValue.release();
898 _CameraCapability::GetSupportedFlashModeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
900 Object* pFlash = null;
901 int err = MM_SUCCESS;
902 result r = E_SUCCESS;
904 _CameraCapabilitySession cameraCapbilitySession;
905 r = cameraCapbilitySession.Construct(deviceType);
906 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
908 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
909 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
911 _CameraHandle cameraHandle = pCapability->GetHandle();
912 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
914 if (queryType == _QUERY_LIST)
916 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pFlashList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
917 SysTryReturn(NID_MEDIA, pFlashList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
919 err = camera_attr_foreach_supported_flash_mode(cameraHandle, SupportedCameraAttrFlashModeCb, pFlashList.get());
920 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
922 itemType = _RESULT_INTEGER_LIST;
923 pFlash = pFlashList.release();
925 else if (queryType == _QUERY_DEFAULT_VALUE)
927 int mmAttr = ::CAMERA_ATTR_FLASH_MODE_OFF;
928 CameraFlashMode value = CAMERA_FLASH_MODE_OFF;
930 pCapability->GetInitValue(_CameraCapability::ATTR_FLASH_MODE, mmAttr);
931 r = _CameraUtil::GetOspFlashMode((camera_attr_flash_mode_e)mmAttr, value);
932 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
934 std::unique_ptr<Integer> pFlashValue (new (std::nothrow) Integer((int)value));
935 SysTryReturn(NID_MEDIA, pFlashValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
937 itemType = _RESULT_INTEGER;
938 pFlash = pFlashValue.release();
945 _CameraCapability::GetSupportedEffectTypeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
947 Object* pEffect = null;
948 int err = MM_SUCCESS;
949 result r = E_SUCCESS;
951 _CameraCapabilitySession cameraCapbilitySession;
952 r = cameraCapbilitySession.Construct(deviceType);
953 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
955 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
956 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
958 _CameraHandle cameraHandle = pCapability->GetHandle();
959 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
961 if (queryType == _QUERY_LIST)
963 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pEffectList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
964 SysTryReturn(NID_MEDIA, pEffectList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
966 err = camera_attr_foreach_supported_effect(cameraHandle, SupportedCameraAttrEffectCb, pEffectList.get());
967 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
969 // In the case of including only NONE effect, delete the NONE capability for the application's usability.
970 if (pEffectList->GetCount() == 1)
972 Integer* pInteger = null;
973 pInteger = dynamic_cast<Integer*>(pEffectList->GetAt(0));
974 SysTryReturn(NID_MEDIA, pInteger != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Integer instance is not available.");
976 if (pInteger->ToInt() == (int)CAMERA_EFFECT_NONE)
978 pEffectList->RemoveAll(true);
981 itemType = _RESULT_INTEGER_LIST;
982 pEffect = pEffectList.release();
984 else if (queryType == _QUERY_DEFAULT_VALUE)
986 int mmAttr = ::CAMERA_ATTR_EFFECT_NONE;
987 CameraEffect value = CAMERA_EFFECT_NONE;
989 pCapability->GetInitValue(_CameraCapability::ATTR_EFFECT_MODE, mmAttr);
990 r = _CameraUtil::GetOspEffect((camera_attr_effect_mode_e)mmAttr, value);
991 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
993 std::unique_ptr<Integer> pEffectValue (new (std::nothrow) Integer((int)value));
994 SysTryReturn(NID_MEDIA, pEffectValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
996 itemType = _RESULT_INTEGER;
997 pEffect = pEffectValue.release();
1004 Tizen::Base::Object*
1005 _CameraCapability::GetSupportedPreviewFrameRateN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1007 Object* pFps = null;
1008 int err = MM_SUCCESS;
1009 result r = E_SUCCESS;
1011 _CameraCapabilitySession cameraCapbilitySession;
1012 r = cameraCapbilitySession.Construct(deviceType);
1013 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1015 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1016 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1018 _CameraHandle cameraHandle = pCapability->GetHandle();
1019 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1021 if (queryType == _QUERY_LIST)
1023 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pFpsList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1024 SysTryReturn(NID_MEDIA, pFpsList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1026 err = camera_attr_foreach_supported_fps(cameraHandle, SupportedCameraAttrFpsCb, pFpsList.get());
1027 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1029 itemType = _RESULT_INTEGER_LIST;
1030 pFps = pFpsList.release();
1032 else if (queryType == _QUERY_DEFAULT_VALUE)
1034 int mmAttr = ::CAMERA_ATTR_FPS_AUTO;
1037 pCapability->GetInitValue(_CameraCapability::ATTR_FPS, mmAttr);
1038 r = _CameraUtil::GetOspFps((camera_attr_fps_e)mmAttr, value);
1039 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1041 std::unique_ptr<Integer> pFpsValue (new (std::nothrow) Integer((int)value));
1042 SysTryReturn(NID_MEDIA, pFpsValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1044 itemType = _RESULT_INTEGER;
1045 pFps = pFpsValue.release();
1051 Tizen::Base::Object*
1052 _CameraCapability::GetSupportedPreviewFrameRateN(_CameraDeviceType deviceType, _QueryType queryType, const Tizen::Graphics::Dimension &dim, _ResultType& itemType)
1054 SysLog(NID_MEDIA, "Dim's width : %d, height : %d", dim.width, dim.height);
1055 return GetSupportedPreviewFrameRateN(deviceType, queryType, itemType);
1059 Tizen::Base::Object*
1060 _CameraCapability::GetSupportedMaxRecordingFrameRateN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1062 SysLog(NID_MEDIA, "_QueryType is : %d, will be ignored", queryType);
1064 Object* pPreviewObj = GetSupportedPreviewFrameRateN(deviceType, _QUERY_LIST, itemType);
1065 SysTryReturn(NID_MEDIA, pPreviewObj != null, null, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Preview is not supported.");
1067 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pFpsList (dynamic_cast<_MediaSafeArrayList*>(pPreviewObj), _ListPtrUtil::remover);
1068 SysTryReturn(NID_MEDIA, pFpsList.get() != null, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. List is wrong.");
1070 //the last time of the list shall be the maximum value of the fps
1072 int count = pFpsList->GetCount();
1073 SysTryReturn(NID_MEDIA, count > 0, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. List is wrong.");
1075 Integer* pItemObj = (Integer*) (pFpsList->GetAt(count - 1));
1076 itemType = _RESULT_INTEGER;
1078 std::unique_ptr<Integer> pIntegerObj (new (std::nothrow) Integer(*pItemObj));
1079 SysTryReturn(NID_MEDIA, pIntegerObj.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. out of memory");
1081 return pIntegerObj.release();
1085 Tizen::Base::Object*
1086 _CameraCapability::GetSupportedIsoLevelN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1088 Object* pIsoLevel = null;
1089 int err = MM_SUCCESS;
1090 result r = E_SUCCESS;
1092 _CameraCapabilitySession cameraCapbilitySession;
1093 r = cameraCapbilitySession.Construct(deviceType);
1094 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1096 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1097 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1099 _CameraHandle cameraHandle = pCapability->GetHandle();
1100 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1102 if (queryType == _QUERY_LIST)
1104 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pIsoLevelList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1105 SysTryReturn(NID_MEDIA, pIsoLevelList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1107 err = camera_attr_foreach_supported_iso(cameraHandle, SupportedCameraAttrIsoCb, pIsoLevelList.get());
1108 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1110 // In the case of including only NONE IsoLevel, delete the NONE capability for the application's usability.
1111 if (pIsoLevelList->GetCount() == 1)
1113 Integer* pInteger = null;
1114 pInteger = dynamic_cast<Integer*>(pIsoLevelList->GetAt(0));
1115 SysTryReturn(NID_MEDIA, pInteger != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Integer instance is not available. (0) item is not found.");
1117 if (pInteger->ToInt() == (int)CAMERA_ISO_AUTO)
1119 pIsoLevelList->RemoveAll(true);
1122 itemType = _RESULT_INTEGER_LIST;
1123 pIsoLevel = pIsoLevelList.release();
1125 else if (queryType == _QUERY_DEFAULT_VALUE)
1127 int mmAttr = ::CAMERA_ATTR_ISO_AUTO;
1128 CameraIsoLevel value = CAMERA_ISO_AUTO;
1130 pCapability->GetInitValue(_CameraCapability::ATTR_ISO_LEVEL, mmAttr);
1131 r = _CameraUtil::GetOspIso((camera_attr_iso_e)mmAttr, value);
1132 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1134 std::unique_ptr<Integer> pIsoLevelValue (new (std::nothrow) Integer((int)value));
1135 SysTryReturn(NID_MEDIA, pIsoLevelValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1137 itemType = _RESULT_INTEGER;
1138 pIsoLevel = pIsoLevelValue.release();
1144 Tizen::Base::Object*
1145 _CameraCapability::GetSupportedWhiteBalanceN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1148 int err = MM_SUCCESS;
1149 result r = E_SUCCESS;
1151 _CameraCapabilitySession cameraCapbilitySession;
1152 r = cameraCapbilitySession.Construct(deviceType);
1153 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1155 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1156 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1158 _CameraHandle cameraHandle = pCapability->GetHandle();
1159 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1161 if (queryType == _QUERY_LIST)
1163 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pWbList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1164 SysTryReturn(NID_MEDIA, pWbList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1166 err = camera_attr_foreach_supported_whitebalance(cameraHandle, SupportedCameraAttrWhitebalanceCb, pWbList.get());
1167 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1169 itemType = _RESULT_INTEGER_LIST;
1170 pWb = pWbList.release();
1172 else if (queryType == _QUERY_DEFAULT_VALUE)
1174 int mmAttr = ::CAMERA_ATTR_WHITE_BALANCE_NONE;
1175 CameraWhiteBalance value = CAMERA_WHITE_BALANCE_AUTO;
1177 pCapability->GetInitValue(_CameraCapability::ATTR_WHITE_BALANCE, mmAttr);
1178 r = _CameraUtil::GetOspWhiteBalance((camera_attr_whitebalance_e)mmAttr, value);
1179 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1181 std::unique_ptr<Integer> pWbValue (new (std::nothrow) Integer((int)value));
1182 SysTryReturn(NID_MEDIA, pWbValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1184 itemType = _RESULT_INTEGER;
1185 pWb = pWbValue.release();
1191 // This feature is not implemented. It will be implemented based on the request.
1192 Tizen::Base::Object*
1193 _CameraCapability::GetSupportedShutterSpeedN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1195 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1199 Tizen::Base::Object*
1200 _CameraCapability::GetSupportedSceneN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1202 Object* pScene = null;
1203 int err = MM_SUCCESS;
1204 result r = E_SUCCESS;
1206 _CameraCapabilitySession cameraCapbilitySession;
1207 r = cameraCapbilitySession.Construct(deviceType);
1208 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1210 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1211 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1213 _CameraHandle cameraHandle = pCapability->GetHandle();
1214 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1216 if (queryType == _QUERY_LIST)
1218 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pSceneList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1219 SysTryReturn(NID_MEDIA, pSceneList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1221 err = camera_attr_foreach_supported_scene_mode(cameraHandle, SupportedCameraAttrSceneModeCb, pSceneList.get());
1222 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1224 itemType = _RESULT_INTEGER_LIST;
1225 pScene = pSceneList.release();
1227 else if (queryType == _QUERY_DEFAULT_VALUE)
1229 int mmAttr = ::CAMERA_ATTR_SCENE_MODE_NORMAL;
1230 _CameraSceneMode value = CAMERA_SCENE_NONE;
1232 pCapability->GetInitValue(_CameraCapability::ATTR_SCENE_MODE, mmAttr);
1233 r = _CameraUtil::GetOspScene((camera_attr_scene_mode_e)mmAttr, value);
1234 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1236 std::unique_ptr<Integer> pSceneValue (new (std::nothrow) Integer((int)value));
1237 SysTryReturn(NID_MEDIA, pSceneValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1239 itemType = _RESULT_INTEGER;
1240 pScene = pSceneValue.release();
1246 // This feature is not implemented. It will be implemented based on the request.
1247 Tizen::Base::Object*
1248 _CameraCapability::GetSupportedMeteringN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1250 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1255 // This feature is not implemented. It will be implemented based on the request.
1256 Tizen::Base::Object*
1257 _CameraCapability::GetSupportedApertureN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1259 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1263 Tizen::Base::Object*
1264 _CameraCapability::GetSupportedExposureN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1266 Object* pExposure = null;
1267 int err = MM_SUCCESS;
1268 result r = E_SUCCESS;
1270 _CameraCapabilitySession cameraCapbilitySession;
1271 r = cameraCapbilitySession.Construct(deviceType);
1272 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1274 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1275 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1277 _CameraHandle cameraHandle = pCapability->GetHandle();
1278 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1280 if (queryType == _QUERY_LIST)
1285 err = camera_attr_get_exposure_range(cameraHandle, &mmMin, &mmMax);
1286 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1287 SysTryReturn(NID_MEDIA, mmMax - mmMin > 0, null, E_UNSUPPORTED_OPERATION,
1288 "[E_UNSUPPORTED_OPERATION] This operation is not supported");
1290 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pExposureList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1291 SysTryReturn(NID_MEDIA, pExposureList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1293 std::unique_ptr<Object> pMin (new (std::nothrow) Integer(0));
1294 SysTryReturn(NID_MEDIA, pMin.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1296 r = pExposureList->AddPtr(std::move(pMin));
1297 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1299 std::unique_ptr<Object> pMax (new (std::nothrow) Integer(9));
1300 SysTryReturn(NID_MEDIA, pMax.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1302 r = pExposureList->AddPtr(std::move(pMax));
1303 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1305 itemType = _RESULT_PAIR_INTEGER_LIST;
1306 pExposure = pExposureList.release();
1308 else if (queryType == _QUERY_DEFAULT_VALUE)
1310 std::unique_ptr<Integer> pExposureValue (new (std::nothrow) Integer(5));
1311 SysTryReturn(NID_MEDIA, pExposureValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1313 itemType = _RESULT_INTEGER;
1314 pExposure = pExposureValue.release();
1320 Tizen::Base::Object*
1321 _CameraCapability::GetSupportedMeteringModeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1323 Object* pMeteringMode = null;
1324 int err = MM_SUCCESS;
1325 result r = E_SUCCESS;
1327 _CameraCapabilitySession cameraCapbilitySession;
1328 r = cameraCapbilitySession.Construct(deviceType);
1329 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1331 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1332 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1334 _CameraHandle cameraHandle = pCapability->GetHandle();
1335 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1337 if (queryType == _QUERY_LIST)
1339 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pMeteringModeList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1340 SysTryReturn(NID_MEDIA, pMeteringModeList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] out of memory");
1342 err = camera_attr_foreach_supported_exposure_mode(cameraHandle, SupportedCameraAttrMeteringModeCb, pMeteringModeList.get());
1343 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1345 itemType = _RESULT_INTEGER_LIST;
1346 pMeteringMode = pMeteringModeList.release();
1348 else if (queryType == _QUERY_DEFAULT_VALUE)
1350 int mmAttr = ::CAMERA_ATTR_EXPOSURE_MODE_OFF;
1351 CameraMeteringMode value = CAMERA_METERING_MODE_NONE;
1353 pCapability->GetInitValue(_CameraCapability::ATTR_EXPOSURE_MODE, mmAttr);
1354 r = _CameraUtil::GetOspMeteringMode((camera_attr_exposure_mode_e)mmAttr, value);
1355 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1357 std::unique_ptr<Integer> pMeteringModeValue (new (std::nothrow) Integer((int)value));
1358 SysTryReturn(NID_MEDIA, pMeteringModeValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] out of memory");
1360 itemType = _RESULT_INTEGER;
1361 pMeteringMode = pMeteringModeValue.release();
1364 return pMeteringMode;
1367 Tizen::Base::Object*
1368 _CameraCapability::GetSupportedFocusModeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1370 Object* pAutoFocus = null;
1371 int err = MM_SUCCESS;
1372 result r = E_SUCCESS;
1374 _CameraCapabilitySession cameraCapbilitySession;
1375 r = cameraCapbilitySession.Construct(deviceType);
1376 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1378 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1379 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1381 _CameraHandle cameraHandle = pCapability->GetHandle();
1382 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1384 if (queryType == _QUERY_LIST)
1386 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pAutoFocusRangeList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1387 SysTryReturn(NID_MEDIA, pAutoFocusRangeList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1389 err = camera_attr_foreach_supported_af_mode(cameraHandle, SupportedCameraAttrAfModeCb, pAutoFocusRangeList.get());
1390 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1392 itemType = _RESULT_INTEGER_LIST;
1393 pAutoFocus = pAutoFocusRangeList.release();
1395 else if (queryType == _QUERY_DEFAULT_VALUE)
1397 int mmAttr = ::CAMERA_ATTR_AF_NONE;
1398 CameraFocusMode value = CAMERA_FOCUS_MODE_NONE;
1400 pCapability->GetInitValue(_CameraCapability::ATTR_AUTO_FOCUS_MODE, mmAttr);
1401 r = _CameraUtil::GetOspFocusMode((camera_attr_af_mode_e)mmAttr, value);
1402 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1404 std::unique_ptr<Integer> pAutoFocusRange (new (std::nothrow) Integer((int)value));
1405 SysTryReturn(NID_MEDIA, pAutoFocusRange.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1407 itemType = _RESULT_INTEGER;
1408 pAutoFocus = pAutoFocusRange.release();
1414 Tizen::Base::Object*
1415 _CameraCapability::GetSupportedZoomTypeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1417 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1421 Tizen::Base::Object*
1422 _CameraCapability::GetSupportedFlipTypeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1424 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1428 Tizen::Base::Object*
1429 _CameraCapability::GetSupportedPreviewRotationN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1431 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1435 Tizen::Base::Object*
1436 _CameraCapability::GetZeroShutterLagN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1438 Object* pZeroShutterLag = null;
1439 result r = E_SUCCESS;
1441 _CameraCapabilitySession cameraCapbilitySession;
1442 r = cameraCapbilitySession.Construct(deviceType);
1443 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1445 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1446 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1448 _CameraHandle cameraHandle = pCapability->GetHandle();
1449 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1451 if (queryType == _QUERY_LIST)
1453 SysLogException(NID_MEDIA, E_INVALID_ARG, "[E_INVALID_ARG] This key doesn't give the list.");
1454 itemType = _RESULT_NONE;
1455 pZeroShutterLag = null;
1457 else if (queryType == _QUERY_DEFAULT_VALUE)
1459 bool supported = false;
1460 supported = camera_is_supported_zero_shutter_lag(cameraHandle);
1462 std::unique_ptr<Integer> pInteger (new (std::nothrow) Integer((int)supported));
1463 SysTryReturn(NID_MEDIA, pInteger.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] out of memory");
1465 itemType = _RESULT_INTEGER;
1466 pZeroShutterLag = pInteger.release();
1469 return pZeroShutterLag;
1472 Tizen::Base::Object*
1473 _CameraCapability::GetSupportedContrastN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1475 Object* pContrast = null;
1476 int err = MM_SUCCESS;
1477 result r = E_SUCCESS;
1479 _CameraCapabilitySession cameraCapbilitySession;
1480 r = cameraCapbilitySession.Construct(deviceType);
1481 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1483 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1484 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1486 _CameraHandle cameraHandle = pCapability->GetHandle();
1487 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1489 if (queryType == _QUERY_LIST)
1494 err = camera_attr_get_contrast_range(cameraHandle, &mmMin, &mmMax);
1495 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1496 SysTryReturn(NID_MEDIA, mmMax - mmMin > 0, null, E_UNSUPPORTED_OPERATION,
1497 "[E_UNSUPPORTED_OPERATION] This operation is not supported");
1499 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pContrastList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1500 SysTryReturn(NID_MEDIA, pContrastList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1502 std::unique_ptr<Object> pMin (new (std::nothrow) Integer(0));
1503 SysTryReturn(NID_MEDIA, pMin.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1505 r = pContrastList->AddPtr(std::move(pMin));
1506 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1508 std::unique_ptr<Object> pMax (new (std::nothrow) Integer(9));
1509 SysTryReturn(NID_MEDIA, pMax.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1511 r = pContrastList->AddPtr(std::move(pMax));
1512 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1514 itemType = _RESULT_PAIR_INTEGER_LIST;
1515 pContrast = pContrastList.release();
1517 else if (queryType == _QUERY_DEFAULT_VALUE)
1519 std::unique_ptr<Integer> pContrastValue (new (std::nothrow) Integer(5));
1520 SysTryReturn(NID_MEDIA, pContrastValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1522 itemType = _RESULT_INTEGER;
1523 pContrast = pContrastValue.release();
1529 Tizen::Base::Object*
1530 _CameraCapability::GetSupportedBrightnessN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1532 Object* pBrightness = null;
1533 int err = MM_SUCCESS;
1534 result r = E_SUCCESS;
1536 _CameraCapabilitySession cameraCapbilitySession;
1537 r = cameraCapbilitySession.Construct(deviceType);
1538 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1540 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1541 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1543 _CameraHandle cameraHandle = pCapability->GetHandle();
1544 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1546 if (queryType == _QUERY_LIST)
1551 err = camera_attr_get_brightness_range(cameraHandle, &mmMin, &mmMax);
1552 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1553 SysTryReturn(NID_MEDIA, mmMax - mmMin > 0, null, E_UNSUPPORTED_OPERATION,
1554 "[E_UNSUPPORTED_OPERATION] This operation is not supported");
1556 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pBrightnessList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1557 SysTryReturn(NID_MEDIA, pBrightnessList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1559 std::unique_ptr<Object> pMin (new (std::nothrow) Integer(0));
1560 SysTryReturn(NID_MEDIA, pMin.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1562 r = pBrightnessList->AddPtr(std::move(pMin));
1563 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1565 std::unique_ptr<Object> pMax (new (std::nothrow) Integer(9));
1566 SysTryReturn(NID_MEDIA, pMax.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1568 r = pBrightnessList->AddPtr(std::move(pMax));
1569 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1571 itemType = _RESULT_PAIR_INTEGER_LIST;
1572 pBrightness = pBrightnessList.release();
1574 else if (queryType == _QUERY_DEFAULT_VALUE)
1576 std::unique_ptr<Integer> pBrightnessValue (new (std::nothrow) Integer(5));
1577 SysTryReturn(NID_MEDIA, pBrightnessValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1579 itemType = _RESULT_INTEGER;
1580 pBrightness = pBrightnessValue.release();
1586 Tizen::Base::Object*
1587 _CameraCapability::GetSupportedZoomLevelN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1589 Object* pZoom = null;
1590 int err = MM_SUCCESS;
1593 result r = E_SUCCESS;
1595 _CameraCapabilitySession cameraCapbilitySession;
1596 r = cameraCapbilitySession.Construct(deviceType);
1597 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1599 _CameraCapability* pCapability = cameraCapbilitySession.GetCameraCapability();
1600 SysTryReturn(NID_MEDIA, pCapability != null, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] A capability instance is not found.");
1602 _CameraHandle cameraHandle = pCapability->GetHandle();
1603 SysTryReturn(NID_MEDIA, cameraHandle != MM_INVALID_HANDLE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Valid handle is not found.");
1605 err = camera_attr_get_zoom_range(cameraHandle, &mmMin, &mmMax);
1606 SysTryReturn(NID_MEDIA, err == MM_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Getting the capability failed.");
1607 SysTryReturn(NID_MEDIA, mmMax - mmMin > 0, null, E_UNSUPPORTED_OPERATION,
1608 "[E_UNSUPPORTED_OPERATION] This operation is not supported");
1610 if (queryType == _QUERY_LIST)
1612 std::unique_ptr<_MediaSafeArrayList, _ListPtrUtil::Remover> pZoomList (new (std::nothrow) _MediaSafeArrayList(), _ListPtrUtil::remover);
1613 SysTryReturn(NID_MEDIA, pZoomList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1615 std::unique_ptr<Object> pMin (new (std::nothrow) Integer(mmMin));
1616 SysTryReturn(NID_MEDIA, pMin.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1618 r = pZoomList->AddPtr(std::move(pMin));
1619 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1621 std::unique_ptr<Object> pMax (new (std::nothrow) Integer(mmMax));
1622 SysTryReturn(NID_MEDIA, pMax.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1624 r = pZoomList->AddPtr(std::move(pMax));
1625 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1627 itemType = _RESULT_PAIR_INTEGER_LIST;
1628 pZoom = pZoomList.release();
1630 else if (queryType == _QUERY_DEFAULT_VALUE)
1632 std::unique_ptr<Integer> pZoomValue (new (std::nothrow) Integer(mmMin));
1633 SysTryReturn(NID_MEDIA, pZoomValue.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1635 itemType = _RESULT_INTEGER;
1636 pZoom = pZoomValue.release();
1642 Tizen::Base::Object*
1643 _CameraCapability::GetDirectionN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1645 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1650 Tizen::Base::Object*
1651 _CameraCapability::GetPhysicalRotationN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
1653 SysLog(NID_MEDIA, "DeviceType is : %d, queryType is : %d itemType is : %d", deviceType, queryType, itemType);
1658 _CameraCapability::SupportedCameraPreviewResolutionCb(int width, int height, void* pUserData)
1660 result r = E_SUCCESS;
1662 //In Redwood Target, If both width and height are lager than 1088, Video Recordingis not supported because of MFC limmitation.
1663 if (width >= 1088 && height >= 1088)
1667 //If Preview resolution ratio is not same Capture resolution ratio, Capture do not performed because of camera hw module's limmitation in RedWood target.
1668 if ((width == 176 && height == 144) || (width == 1280 && height == 720))
1673 _MediaSafeArrayList* pResolutionList = static_cast<_MediaSafeArrayList*>(pUserData);
1674 SysTryReturn(NID_MEDIA, pResolutionList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1676 std::unique_ptr<Object> pDim (new (std::nothrow) Dimension(width, height));
1677 SysTryReturn(NID_MEDIA, pDim.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1679 r = pResolutionList->AddPtr(std::move(pDim));
1680 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1685 _CameraCapability::SupportedCameraCaptureResolutionCb(int width, int height, void* pUserData)
1687 result r = E_SUCCESS;
1689 // This means that 1080 HD resolution capture is not supported.
1690 // In Redwood Target, 1392X1392 Resolution is not supported because of MFC limmitation.
1691 if ((height == 1080) || (width == 1392 && height == 1392))
1696 _MediaSafeArrayList* pResolutionList = static_cast<_MediaSafeArrayList*>(pUserData);
1697 SysTryReturn(NID_MEDIA, pResolutionList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1699 std::unique_ptr<Object> pDim (new (std::nothrow) Dimension(width, height));
1700 SysTryReturn(NID_MEDIA, pDim.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1702 r = pResolutionList->AddPtr(std::move(pDim));
1703 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1709 _CameraCapability::SupportedCameraPreviewFormatCb(camera_pixel_format_e format, void *pUserData)
1711 result r = E_SUCCESS;
1712 Tizen::Graphics::PixelFormat previewPixelValue = (Tizen::Graphics::PixelFormat)MEDIA_INVALID_VALUE;
1714 _MediaSafeArrayList* pFormatList = static_cast<_MediaSafeArrayList*>(pUserData);
1715 SysTryReturn(NID_MEDIA, pFormatList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1717 r = _CameraUtil::GetOspGrpPixelFormat(format, previewPixelValue);
1720 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(previewPixelValue));
1721 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1723 r = pFormatList->AddPtr(std::move(pInteger));
1724 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1730 _CameraCapability::SupportedCameraCaptureFormatCb(camera_pixel_format_e format, void *pUserData)
1732 result r = E_SUCCESS;
1733 Tizen::Graphics::PixelFormat capturePixelValue = (Tizen::Graphics::PixelFormat)MEDIA_INVALID_VALUE;
1735 // This means that the raw format capture is not supported yet.
1736 if ( format == ::CAMERA_PIXEL_FORMAT_I420 || format == ::CAMERA_PIXEL_FORMAT_YUYV )
1741 _MediaSafeArrayList* pFormatList = static_cast<_MediaSafeArrayList*>(pUserData);
1742 SysTryReturn(NID_MEDIA, pFormatList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1744 r = _CameraUtil::GetOspGrpPixelFormat(format, capturePixelValue);
1747 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(capturePixelValue));
1748 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1750 r = pFormatList->AddPtr(std::move(pInteger));
1751 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1757 _CameraCapability::SupportedCameraAttrFlashModeCb(camera_attr_flash_mode_e mode, void *pUserData)
1759 result r = E_SUCCESS;
1760 CameraFlashMode flashMode = (CameraFlashMode)MEDIA_INVALID_VALUE;
1762 // This means that the flash-off mode is not included to the supported list.
1763 if ( mode == ::CAMERA_ATTR_FLASH_MODE_OFF )
1768 _MediaSafeArrayList* pFlashList = static_cast<_MediaSafeArrayList*>(pUserData);
1769 SysTryReturn(NID_MEDIA, pFlashList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1771 r = _CameraUtil::GetOspFlashMode(mode, flashMode);
1774 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(flashMode));
1775 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1777 r = pFlashList->AddPtr(std::move(pInteger));
1778 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1785 _CameraCapability::SupportedCameraAttrEffectCb(camera_attr_effect_mode_e effect, void *pUserData)
1787 result r = E_SUCCESS;
1788 CameraEffect effectValue = (CameraEffect)MEDIA_INVALID_VALUE;
1790 _MediaSafeArrayList* pEffectList = static_cast<_MediaSafeArrayList*>(pUserData);
1791 SysTryReturn(NID_MEDIA, pEffectList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1793 r = _CameraUtil::GetOspEffect(effect, effectValue);
1796 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(effectValue));
1797 SysTryReturn(NID_MEDIA, pInteger.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1799 r = pEffectList->AddPtr(std::move(pInteger));
1800 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1806 _CameraCapability::SupportedCameraAttrFpsCb(camera_attr_fps_e fps, void *pUserData)
1808 result r = E_SUCCESS;
1809 int framePerSec = 0;
1811 _MediaSafeArrayList* pfpsList = static_cast<_MediaSafeArrayList*>(pUserData);
1812 SysTryReturn(NID_MEDIA, pfpsList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1814 r = _CameraUtil::GetOspFps(fps, framePerSec);
1817 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(framePerSec));
1818 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1820 r = pfpsList->AddPtr(std::move(pInteger));
1821 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1828 _CameraCapability::SupportedCameraAttrWhitebalanceCb(camera_attr_whitebalance_e wb, void *pUserData)
1830 result r = E_SUCCESS;
1831 CameraWhiteBalance wbValue = (CameraWhiteBalance)MEDIA_INVALID_VALUE;
1833 _MediaSafeArrayList* pWhitebalanceList = static_cast<_MediaSafeArrayList*>(pUserData);
1834 SysTryReturn(NID_MEDIA, pWhitebalanceList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1836 r = _CameraUtil::GetOspWhiteBalance(wb, wbValue);
1839 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(wbValue));
1840 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1842 r = pWhitebalanceList->AddPtr(std::move(pInteger));
1843 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1849 _CameraCapability::SupportedCameraAttrSceneModeCb(camera_attr_scene_mode_e mode, void *pUserData)
1851 result r = E_SUCCESS;
1852 _CameraSceneMode sceneModeValue = (_CameraSceneMode)MEDIA_INVALID_VALUE;
1854 _MediaSafeArrayList* pSceneList = static_cast<_MediaSafeArrayList*>(pUserData);
1855 SysTryReturn(NID_MEDIA, pSceneList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1857 r = _CameraUtil::GetOspScene(mode, sceneModeValue);
1860 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(sceneModeValue));
1861 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1863 r = pSceneList->AddPtr(std::move(pInteger));
1864 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1870 _CameraCapability::SupportedCameraAttrIsoCb(camera_attr_iso_e iso, void *pUserData)
1872 result r = E_SUCCESS;
1873 CameraIsoLevel isoValue = (CameraIsoLevel)MEDIA_INVALID_VALUE;
1875 _MediaSafeArrayList* pIsoLevelList = static_cast<_MediaSafeArrayList*>(pUserData);
1876 SysTryReturn(NID_MEDIA, pIsoLevelList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1878 r = _CameraUtil::GetOspIso(iso, isoValue);
1881 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(isoValue));
1882 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1884 r = pIsoLevelList->AddPtr(std::move(pInteger));
1885 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1891 _CameraCapability::SupportedCameraAttrMeteringModeCb(camera_attr_exposure_mode_e mode, void *pUserData)
1893 result r = E_SUCCESS;
1894 CameraMeteringMode exposureModeValue = (CameraMeteringMode)MEDIA_INVALID_VALUE;
1896 _MediaSafeArrayList* pExposureList = static_cast<_MediaSafeArrayList*>(pUserData);
1897 SysTryReturn(NID_MEDIA, pExposureList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1899 r = _CameraUtil::GetOspMeteringMode(mode,exposureModeValue);
1902 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(exposureModeValue));
1903 SysTryReturn(NID_MEDIA, pInteger.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1905 r = pExposureList->AddPtr(std::move(pInteger));
1906 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1912 _CameraCapability::SupportedCameraAttrAfModeCb(camera_attr_af_mode_e mode, void *pUserData)
1914 result r = E_SUCCESS;
1915 CameraFocusMode afModeValue = CAMERA_FOCUS_MODE_NONE;
1916 bool additionalMode = false;
1917 CameraFocusMode additionalAfModeValue = CAMERA_FOCUS_MODE_NONE;
1919 _MediaSafeArrayList* pAutoFocusList = static_cast<_MediaSafeArrayList*>(pUserData);
1920 SysTryReturn(NID_MEDIA, pAutoFocusList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
1922 r = _CameraUtil::GetOspFocusMode(mode,afModeValue, additionalMode, additionalAfModeValue);
1925 std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(afModeValue));
1926 SysTryReturn(NID_MEDIA, pInteger.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1928 r = pAutoFocusList->AddPtr(std::move(pInteger));
1929 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1931 //if there is any specific Osp mode which is not defined in the mm layer, add the additional value to the list based on the mm mode.
1932 //For example, CAMERA_FOCUS_MODE_NORMAL and CAMERA_FOCUS_MODE_CONTINUOUS_AUTO are from mm's ::CAMERA_ATTR_AF_NORMAL.
1935 std::unique_ptr<Object> pInteger2 (new (std::nothrow) Integer(additionalAfModeValue));
1936 SysTryReturn(NID_MEDIA, pInteger2.get() != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1938 r = pAutoFocusList->AddPtr(std::move(pInteger2));
1939 SysTryReturn(NID_MEDIA, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));