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 FMediaCapability.cpp
20 * @brief This file contains the implementation of subsystem's Camera.
23 #include <FMediaCapability.h>
24 #include <FMediaCameraTypes.h>
25 #include <FBaseSysLog.h>
26 #include "FMedia_CapabilityImpl.h"
27 #include "FMedia_CamPtrUtil.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
32 namespace Tizen { namespace Media
35 const wchar_t* const AUDIOIN_SAMPLE_RATE = L"AudioIn.SampleRate";
36 const wchar_t* const AUDIOIN_SAMPLE_TYPE = L"AudioIn.SampleType";
38 const wchar_t* const AUDIOOUT_COUNT_MAX = L"AudioOut.CountMax";
39 const wchar_t* const AUDIOOUT_SAMPLE_RATE = L"AudioOut.SampleRate";
40 const wchar_t* const AUDIOOUT_SAMPLE_TYPE = L"AudioOut.SampleType";
42 const wchar_t* const AUDIORECORDER_FORMAT = L"AudioRecorder.Format";
44 const wchar_t* const CAMERA_COUNT = L"Camera.Count";
45 const wchar_t* const CAMERA_PRIMARY_CAPTURE_FORMAT = L"Camera.Primary.CaptureFormat";
46 const wchar_t* const CAMERA_PRIMARY_CAPTURE_RESOLUTION = L"Camera.Primary.CaptureResolution";
47 const wchar_t* const CAMERA_PRIMARY_DIRECTION = L"Camera.Primary.Direction";
48 const wchar_t* const CAMERA_PRIMARY_EFFECT = L"Camera.Primary.Effect";
49 const wchar_t* const CAMERA_PRIMARY_ISO_LEVEL = L"Camera.Primary.IsoLevel";
50 const wchar_t* const CAMERA_PRIMARY_PREVIEW_FORMAT = L"Camera.Primary.PreviewFormat";
51 const wchar_t* const CAMERA_PRIMARY_PREVIEW_FRAMERATE = L"Camera.Primary.PreviewFrameRate";
52 const wchar_t* const CAMERA_PRIMARY_PREVIEW_RESOLUTION = L"Camera.Primary.PreviewResolution";
53 const wchar_t* const CAMERA_PRIMARY_RECORDING_RESOLUTION = L"Camera.Primary.RecordingResolution";
54 const wchar_t* const CAMERA_PRIMARY_ROTATION = L"Camera.Primary.Rotation";
55 const wchar_t* const CAMERA_PRIMARY_SUPPORT_BRIGHTNESS = L"Camera.Primary.SupportBrightness";
56 const wchar_t* const CAMERA_PRIMARY_SUPPORT_CAPTURE = L"Camera.Primary.SupportCapture";
57 const wchar_t* const CAMERA_PRIMARY_SUPPORT_CONTRAST = L"Camera.Primary.SupportContrast";
58 const wchar_t* const CAMERA_PRIMARY_SUPPORT_EXPOSURE = L"Camera.Primary.SupportExposure";
59 const wchar_t* const CAMERA_PRIMARY_SUPPORT_FLASH = L"Camera.Primary.SupportFlash";
60 const wchar_t* const CAMERA_PRIMARY_SUPPORT_FOCUS = L"Camera.Primary.SupportFocus";
61 const wchar_t* const CAMERA_PRIMARY_SUPPORT_PREVIEW = L"Camera.Primary.SupportPreview";
62 const wchar_t* const CAMERA_PRIMARY_SUPPORT_RECORDING = L"Camera.Primary.SupportRecording";
63 const wchar_t* const CAMERA_PRIMARY_SUPPORT_ZOOM = L"Camera.Primary.SupportZoom";
64 const wchar_t* const CAMERA_PRIMARY_SUPPORT_ZERO_SHUTTER_LAG = L"Camera.Primary.SupportZeroShutterLag";
65 const wchar_t* const CAMERA_PRIMARY_WHITE_BALANCE = L"Camera.Primary.WhiteBalance";
66 const wchar_t* const CAMERA_PRIMARY_ZOOM_TYPE = L"Camera.Primary.ZoomType";
67 const wchar_t* const CAMERA_PRIMARY_FLIP = L"Camera.Primary.Flip";
68 const wchar_t* const CAMERA_PRIMARY_PREVIEW_ROTATION = L"Camera.Primary.PreviewRotation";
69 const wchar_t* const CAMERA_PRIMARY_FOCUS_MODE = L"Camera.Primary.FocusMode";
70 const wchar_t* const CAMERA_PRIMARY_FOCUS_POINT = L"Camera.Primary.FocusPoint";
71 const wchar_t* const CAMERA_PRIMARY_FLASH_MODE = L"Camera.Primary.FlashMode";
72 const wchar_t* const CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Primary.DefaultPreviewFormat";
73 const wchar_t* const CAMERA_PRIMARY_METERING_MODE = L"Camera.Primary.MeteringMode";
74 const wchar_t* const CAMERA_PRIMARY_SCENE_MODE = L"Camera.Primary.SceneMode";
76 const wchar_t* const CAMERA_SECONDARY_CAPTURE_FORMAT = L"Camera.Secondary.CaptureFormat";
77 const wchar_t* const CAMERA_SECONDARY_CAPTURE_RESOLUTION = L"Camera.Secondary.CaptureResolution";
78 const wchar_t* const CAMERA_SECONDARY_DIRECTION = L"Camera.Secondary.Direction";
79 const wchar_t* const CAMERA_SECONDARY_EFFECT = L"Camera.Secondary.Effect";
80 const wchar_t* const CAMERA_SECONDARY_ISO_LEVEL = L"Camera.Secondary.IsoLevel";
81 const wchar_t* const CAMERA_SECONDARY_PREVIEW_FORMAT = L"Camera.Secondary.PreviewFormat";
82 const wchar_t* const CAMERA_SECONDARY_PREVIEW_FRAMERATE = L"Camera.Secondary.PreviewFrameRate";
83 const wchar_t* const CAMERA_SECONDARY_PREVIEW_RESOLUTION = L"Camera.Secondary.PreviewResolution";
84 const wchar_t* const CAMERA_SECONDARY_RECORDING_RESOLUTION = L"Camera.Secondary.RecordingResolution";
85 const wchar_t* const CAMERA_SECONDARY_ROTATION = L"Camera.Secondary.Rotation";
86 const wchar_t* const CAMERA_SECONDARY_SUPPORT_BRIGHTNESS = L"Camera.Secondary.SupportBrightness";
87 const wchar_t* const CAMERA_SECONDARY_SUPPORT_CAPTURE = L"Camera.Secondary.SupportCapture";
88 const wchar_t* const CAMERA_SECONDARY_SUPPORT_CONTRAST = L"Camera.Secondary.SupportContrast";
89 const wchar_t* const CAMERA_SECONDARY_SUPPORT_EXPOSURE = L"Camera.Secondary.SupportExposure";
90 const wchar_t* const CAMERA_SECONDARY_SUPPORT_FLASH = L"Camera.Secondary.SupportFlash";
91 const wchar_t* const CAMERA_SECONDARY_SUPPORT_FOCUS = L"Camera.Secondary.SupportFocus";
92 const wchar_t* const CAMERA_SECONDARY_SUPPORT_PREVIEW = L"Camera.Secondary.SupportPreview";
93 const wchar_t* const CAMERA_SECONDARY_SUPPORT_RECORDING = L"Camera.Secondary.SupportRecording";
94 const wchar_t* const CAMERA_SECONDARY_SUPPORT_ZOOM = L"Camera.Secondary.SupportZoom";
95 const wchar_t* const CAMERA_SECONDARY_SUPPORT_ZERO_SHUTTER_LAG = L"Camera.Secondary.SupportZeroShutterLag";
96 const wchar_t* const CAMERA_SECONDARY_WHITE_BALANCE = L"Camera.Secondary.WhiteBalance";
97 const wchar_t* const CAMERA_SECONDARY_ZOOM_TYPE = L"Camera.Secondary.ZoomType";
98 const wchar_t* const CAMERA_SECONDARY_FLIP = L"Camera.Secondary.Flip";
99 const wchar_t* const CAMERA_SECONDARY_PREVIEW_ROTATION = L"Camera.Secondary.PreviewRotation";
100 const wchar_t* const CAMERA_SECONDARY_FOCUS_MODE = L"Camera.Secondary.FocusMode";
101 const wchar_t* const CAMERA_SECONDARY_FOCUS_POINT = L"Camera.Secondary.FocusPoint";
102 const wchar_t* const CAMERA_SECONDARY_FLASH_MODE = L"Camera.Secondary.FlashMode";
103 const wchar_t* const CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Secondary.DefaultPreviewFormat";
104 const wchar_t* const CAMERA_SECONDARY_METERING_MODE = L"Camera.Secondary.MeteringMode";
105 const wchar_t* const CAMERA_SECONDARY_SCENE_MODE = L"Camera.Secondary.SceneMode";
107 const wchar_t* const PLAYER_AUDIO_CODEC = L"Player.AudioCodec";
108 const wchar_t* const PLAYER_COUNT_MAX = L"Player.CountMax";
109 const wchar_t* const PLAYER_PROTOCOL = L"Player.Protocol";
110 const wchar_t* const PLAYER_VIDEO_CODEC = L"Player.VideoCodec";
111 const wchar_t* const PLAYER_VIDEO_HEIGHT = L"Player.VideoHeight";
112 const wchar_t* const PLAYER_VIDEO_WIDTH = L"Player.VideoWidth";
114 const wchar_t* const VIDEORECORDER_AUDIO_CODEC = L"VideoRecorder.AudioCodec";
115 const wchar_t* const VIDEORECORDER_FORMAT = L"VideoRecorder.Format";
116 const wchar_t* const VIDEORECORDER_VIDEO_CODEC = L"VideoRecorder.VideoCodec";
118 MediaCapability::MediaCapability()
123 MediaCapability::~MediaCapability()
128 MediaCapability::GetValue(const Tizen::Base::String& key, bool& value)
130 result r = E_SUCCESS;
132 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
134 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
136 return pImpl->GetValue(key, value);
143 MediaCapability::GetValue(const Tizen::Base::String& key, int& value)
145 result r = E_SUCCESS;
147 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
148 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
150 return pImpl->GetValue(key, value);
156 MediaCapability::GetValue(const Tizen::Base::String& key, long long& value)
158 result r = E_SUCCESS;
160 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
161 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
163 return pImpl->GetValue(key, value);
169 MediaCapability::GetValue(const Tizen::Base::String& key, double& value)
171 result r = E_SUCCESS;
173 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
174 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
176 return pImpl->GetValue(key, value);
182 MediaCapability::GetValue(const Tizen::Base::String& key, Tizen::Base::String& value)
184 result r = E_SUCCESS;
186 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
187 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
189 return pImpl->GetValue(key, value);
194 Tizen::Base::Collection::IList*
195 MediaCapability::GetValueN(const Tizen::Base::String& key)
197 result r = E_SUCCESS;
200 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
201 SysTryReturn(NID_MEDIA, pImpl != null, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
203 std::unique_ptr <ArrayList, _ListPtrUtil::Remover> pList (new (std::nothrow) Tizen::Base::Collection::ArrayList(), _ListPtrUtil::remover);
204 SysTryReturn(NID_MEDIA, pList.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
206 r = pList->Construct();
207 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
209 r = pImpl->GetValueN(key, *pList);
210 SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
212 return pList.release();