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"
28 using namespace Tizen::Base;
30 namespace Tizen { namespace Media
33 const wchar_t* const AUDIOIN_SAMPLE_RATE = L"AudioIn.SampleRate";
34 const wchar_t* const AUDIOIN_SAMPLE_TYPE = L"AudioIn.SampleType";
36 const wchar_t* const AUDIOOUT_COUNT_MAX = L"AudioOut.CountMax";
37 const wchar_t* const AUDIOOUT_SAMPLE_RATE = L"AudioOut.SampleRate";
38 const wchar_t* const AUDIOOUT_SAMPLE_TYPE = L"AudioOut.SampleType";
40 const wchar_t* const AUDIORECORDER_FORMAT = L"AudioRecorder.Format";
42 const wchar_t* const CAMERA_COUNT = L"Camera.Count";
43 const wchar_t* const CAMERA_PRIMARY_CAPTURE_FORMAT = L"Camera.Primary.CaptureFormat";
44 const wchar_t* const CAMERA_PRIMARY_CAPTURE_RESOLUTION = L"Camera.Primary.CaptureResolution";
45 const wchar_t* const CAMERA_PRIMARY_DIRECTION = L"Camera.Primary.Direction";
46 const wchar_t* const CAMERA_PRIMARY_EFFECT = L"Camera.Primary.Effect";
47 const wchar_t* const CAMERA_PRIMARY_ISO_LEVEL = L"Camera.Primary.IsoLevel";
48 const wchar_t* const CAMERA_PRIMARY_PREVIEW_FORMAT = L"Camera.Primary.PreviewFormat";
49 const wchar_t* const CAMERA_PRIMARY_PREVIEW_FRAMERATE = L"Camera.Primary.PreviewFrameRate";
50 const wchar_t* const CAMERA_PRIMARY_PREVIEW_RESOLUTION = L"Camera.Primary.PreviewResolution";
51 const wchar_t* const CAMERA_PRIMARY_RECORDING_RESOLUTION = L"Camera.Primary.RecordingResolution";
52 const wchar_t* const CAMERA_PRIMARY_ROTATION = L"Camera.Primary.Rotation";
53 const wchar_t* const CAMERA_PRIMARY_SUPPORT_BRIGHTNESS = L"Camera.Primary.SupportBrightness";
54 const wchar_t* const CAMERA_PRIMARY_SUPPORT_CAPTURE = L"Camera.Primary.SupportCapture";
55 const wchar_t* const CAMERA_PRIMARY_SUPPORT_CONTRAST = L"Camera.Primary.SupportContrast";
56 const wchar_t* const CAMERA_PRIMARY_SUPPORT_EXPOSURE = L"Camera.Primary.SupportExposure";
57 const wchar_t* const CAMERA_PRIMARY_SUPPORT_FLASH = L"Camera.Primary.SupportFlash";
58 const wchar_t* const CAMERA_PRIMARY_SUPPORT_FOCUS = L"Camera.Primary.SupportFocus";
59 const wchar_t* const CAMERA_PRIMARY_SUPPORT_PREVIEW = L"Camera.Primary.SupportPreview";
60 const wchar_t* const CAMERA_PRIMARY_SUPPORT_RECORDING = L"Camera.Primary.SupportRecording";
61 const wchar_t* const CAMERA_PRIMARY_SUPPORT_ZOOM = L"Camera.Primary.SupportZoom";
62 const wchar_t* const CAMERA_PRIMARY_SUPPORT_ZERO_SHUTTER_LAG = L"Camera.Primary.SupportZeroShutterLag";
63 const wchar_t* const CAMERA_PRIMARY_WHITE_BALANCE = L"Camera.Primary.WhiteBalance";
64 const wchar_t* const CAMERA_PRIMARY_ZOOM_TYPE = L"Camera.Primary.ZoomType";
65 const wchar_t* const CAMERA_PRIMARY_FLIP = L"Camera.Primary.Flip";
66 const wchar_t* const CAMERA_PRIMARY_PREVIEW_ROTATION = L"Camera.Primary.PreviewRotation";
67 const wchar_t* const CAMERA_PRIMARY_FOCUS_MODE = L"Camera.Primary.FocusMode";
68 const wchar_t* const CAMERA_PRIMARY_FOCUS_POINT = L"Camera.Primary.FocusPoint";
69 const wchar_t* const CAMERA_PRIMARY_FLASH_MODE = L"Camera.Primary.FlashMode";
70 const wchar_t* const CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Primary.DefaultPreviewFormat";
71 const wchar_t* const CAMERA_PRIMARY_METERING_MODE = L"Camera.Primary.MeteringMode";
73 const wchar_t* const CAMERA_SECONDARY_CAPTURE_FORMAT = L"Camera.Secondary.CaptureFormat";
74 const wchar_t* const CAMERA_SECONDARY_CAPTURE_RESOLUTION = L"Camera.Secondary.CaptureResolution";
75 const wchar_t* const CAMERA_SECONDARY_DIRECTION = L"Camera.Secondary.Direction";
76 const wchar_t* const CAMERA_SECONDARY_EFFECT = L"Camera.Secondary.Effect";
77 const wchar_t* const CAMERA_SECONDARY_ISO_LEVEL = L"Camera.Secondary.IsoLevel";
78 const wchar_t* const CAMERA_SECONDARY_PREVIEW_FORMAT = L"Camera.Secondary.PreviewFormat";
79 const wchar_t* const CAMERA_SECONDARY_PREVIEW_FRAMERATE = L"Camera.Secondary.PreviewFrameRate";
80 const wchar_t* const CAMERA_SECONDARY_PREVIEW_RESOLUTION = L"Camera.Secondary.PreviewResolution";
81 const wchar_t* const CAMERA_SECONDARY_RECORDING_RESOLUTION = L"Camera.Secondary.RecordingResolution";
82 const wchar_t* const CAMERA_SECONDARY_ROTATION = L"Camera.Secondary.Rotation";
83 const wchar_t* const CAMERA_SECONDARY_SUPPORT_BRIGHTNESS = L"Camera.Secondary.SupportBrightness";
84 const wchar_t* const CAMERA_SECONDARY_SUPPORT_CAPTURE = L"Camera.Secondary.SupportCapture";
85 const wchar_t* const CAMERA_SECONDARY_SUPPORT_CONTRAST = L"Camera.Secondary.SupportContrast";
86 const wchar_t* const CAMERA_SECONDARY_SUPPORT_EXPOSURE = L"Camera.Secondary.SupportExposure";
87 const wchar_t* const CAMERA_SECONDARY_SUPPORT_FLASH = L"Camera.Secondary.SupportFlash";
88 const wchar_t* const CAMERA_SECONDARY_SUPPORT_FOCUS = L"Camera.Secondary.SupportFocus";
89 const wchar_t* const CAMERA_SECONDARY_SUPPORT_PREVIEW = L"Camera.Secondary.SupportPreview";
90 const wchar_t* const CAMERA_SECONDARY_SUPPORT_RECORDING = L"Camera.Secondary.SupportRecording";
91 const wchar_t* const CAMERA_SECONDARY_SUPPORT_ZOOM = L"Camera.Secondary.SupportZoom";
92 const wchar_t* const CAMERA_SECONDARY_SUPPORT_ZERO_SHUTTER_LAG = L"Camera.Secondary.SupportZeroShutterLag";
93 const wchar_t* const CAMERA_SECONDARY_WHITE_BALANCE = L"Camera.Secondary.WhiteBalance";
94 const wchar_t* const CAMERA_SECONDARY_ZOOM_TYPE = L"Camera.Secondary.ZoomType";
95 const wchar_t* const CAMERA_SECONDARY_FLIP = L"Camera.Secondary.Flip";
96 const wchar_t* const CAMERA_SECONDARY_PREVIEW_ROTATION = L"Camera.Secondary.PreviewRotation";
97 const wchar_t* const CAMERA_SECONDARY_FOCUS_MODE = L"Camera.Secondary.FocusMode";
98 const wchar_t* const CAMERA_SECONDARY_FOCUS_POINT = L"Camera.Secondary.FocusPoint";
99 const wchar_t* const CAMERA_SECONDARY_FLASH_MODE = L"Camera.Secondary.FlashMode";
100 const wchar_t* const CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Secondary.DefaultPreviewFormat";
101 const wchar_t* const CAMERA_SECONDARY_METERING_MODE = L"Camera.Secondary.MeteringMode";
103 const wchar_t* const PLAYER_AUDIO_CODEC = L"Player.AudioCodec";
104 const wchar_t* const PLAYER_COUNT_MAX = L"Player.CountMax";
105 const wchar_t* const PLAYER_PROTOCOL = L"Player.Protocol";
106 const wchar_t* const PLAYER_VIDEO_CODEC = L"Player.VideoCodec";
107 const wchar_t* const PLAYER_VIDEO_HEIGHT = L"Player.VideoHeight";
108 const wchar_t* const PLAYER_VIDEO_WIDTH = L"Player.VideoWidth";
110 const wchar_t* const VIDEORECORDER_AUDIO_CODEC = L"VideoRecorder.AudioCodec";
111 const wchar_t* const VIDEORECORDER_FORMAT = L"VideoRecorder.Format";
112 const wchar_t* const VIDEORECORDER_VIDEO_CODEC = L"VideoRecorder.VideoCodec";
114 MediaCapability::MediaCapability()
119 MediaCapability::~MediaCapability()
124 MediaCapability::GetValue(const Tizen::Base::String& key, bool& value)
126 result r = E_SUCCESS;
128 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
130 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
132 return pImpl->GetValue(key, value);
139 MediaCapability::GetValue(const Tizen::Base::String& key, int& value)
141 result r = E_SUCCESS;
143 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
144 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
146 return pImpl->GetValue(key, value);
152 MediaCapability::GetValue(const Tizen::Base::String& key, long long& value)
154 result r = E_SUCCESS;
156 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
157 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
159 return pImpl->GetValue(key, value);
165 MediaCapability::GetValue(const Tizen::Base::String& key, double& value)
167 result r = E_SUCCESS;
169 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
170 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
172 return pImpl->GetValue(key, value);
178 MediaCapability::GetValue(const Tizen::Base::String& key, Tizen::Base::String& value)
180 result r = E_SUCCESS;
182 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
183 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
185 return pImpl->GetValue(key, value);
190 Tizen::Base::Collection::IList*
191 MediaCapability::GetValueN(const Tizen::Base::String& key)
193 result r = E_SUCCESS;
194 Tizen::Base::Collection::ArrayList* pList = null;
197 _CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
198 SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
200 pList = new (std::nothrow) Tizen::Base::Collection::ArrayList();
201 SysTryCatch(NID_MEDIA, pList !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
203 r = pList->Construct();
204 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
206 r = pImpl->GetValueN(key, *pList);
207 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));