Tizen 2.0 Release
[framework/osp/media.git] / src / FMedia_CapabilityImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FMedia_CapabilityImpl.cpp
20  * @brief               This file contains the implementation for header file FMedia_CapabilityImpl.h
21  *
22  */
23
24 #include <unique_ptr.h>
25 #include <pthread.h>
26 #include <libxml/parser.h>
27 #include <libxml/tree.h>
28 #include <FBaseInteger.h>
29 #include <FBaseSysLog.h>
30 #include <FBaseColIList.h>
31 #include <FBaseColHashMap.h>
32 #include <FIoFile.h>
33 #include <FGrpDimension.h>
34 #include <FGrpPixelFormat.h>
35 #include <FSys_EnvironmentImpl.h>
36 #include <FSys_SystemInfoImpl.h>
37 #include <FMediaTypes.h>
38 #include <FMediaCapabilityTypes.h>
39 #include <FMediaCameraTypes.h>
40 #include <FMediaAudioTypes.h>
41 #include "FMedia_CapabilityImpl.h"
42 #include "FMedia_CameraCapability.h"
43 #include "FMedia_CameraCapabilitySession.h"
44 #include "FMedia_CameraUtil.h"
45 #include "FMedia_RecorderCapability.h"
46 #include "FMedia_RecorderSession.h"
47
48 using namespace Tizen::Base;
49 using namespace Tizen::Base::Collection;
50 using namespace Tizen::Graphics;
51 using namespace Tizen::Base::Utility;
52 using namespace Tizen::System;
53 using namespace Tizen::Io;
54
55 namespace Tizen { namespace Media
56 {
57 const wchar_t* const AUDIORECORDER_CODEC_TYPE = L"AudioRecorder.AudioCodecType";
58 const wchar_t* const AUDIORECORDER_MEDIA_CONTAINER_TYPE = L"AudioRecorder.MediaContainerType";
59 const wchar_t* const VIDEORECORDER_AUDIO_CODEC_TYPE = L"VideoRecorder.AudioCodecType";
60 const wchar_t* const VIDEORECORDER_VIDEO_CODEC_TYPE = L"VideoRecorder.VideoCodecType";
61 const wchar_t* const VIDEORECORDER_MEDIA_CONTAINER_TYPE = L"VideoRecorder.MediaContainerType";
62 const wchar_t* const VIDEORECORDER_CODEC = L"VideoRecorder.Codec";
63
64 const wchar_t* const CAMERA_PRIMARY_ZOOM_LEVEL = L"Camera.Primary.ZoomLevel";
65 const wchar_t* const CAMERA_SECONDARY_ZOOM_LEVEL = L"Camera.Secondary.ZoomLevel";
66
67 _CapabilityImpl* _CapabilityImpl::__pCapabilityImplInst = null;
68
69 void
70 _CapabilityImpl::InitCapabilityImpl()
71 {
72         static _CapabilityImpl capabilityImpl;
73         result r = E_SUCCESS;
74
75         r = capabilityImpl.Construct();
76         SysTryCatch(NID_MEDIA, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating.");
77
78         __pCapabilityImplInst = &capabilityImpl;
79         return;
80 CATCH:
81         __pCapabilityImplInst = null;
82 }
83
84 _CapabilityImpl*
85 _CapabilityImpl::GetInstance(void)
86 {
87         static pthread_once_t once_block = PTHREAD_ONCE_INIT;
88
89         if (!__pCapabilityImplInst)
90         {
91                 pthread_once(&once_block, InitCapabilityImpl);
92         }
93
94         return __pCapabilityImplInst;
95 }
96
97 _CapabilityImpl::_CapabilityImpl(void)
98         : __pMap(null)
99         , __cameraCount(0)
100         , __primaryCameraDone(false)
101         , __secondaryCameraDone(false)
102         , __videoRecorderDone(false)
103         , __audioRecorderDone(false)
104 {
105 }
106
107
108 _CapabilityImpl::~_CapabilityImpl(void)
109 {
110         if (__pMap != null)
111         {
112                 __pMap->RemoveAll(true);
113                 delete __pMap;
114         }
115 }
116
117 result
118 _CapabilityImpl::Construct(void)
119 {
120         result r = E_SUCCESS;
121         long long length = 0;
122         int readLen = 0;
123         std::unique_ptr<char[]> pXmlBuffer;
124         FileAttributes attributes;
125         File fileObj;
126         const String mediaCapabilityFilePath(L"/usr/etc/media-capability.xml");
127         SysLog(NID_MEDIA, "Enter ");
128
129         __pMap = new (std::nothrow) HashMap();
130         SysTryCatch(NID_MEDIA, null != __pMap, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
131
132         r = __pMap->Construct();
133         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
134
135         SysLog(NID_MEDIA, "Capability XML path:%ls", mediaCapabilityFilePath.GetPointer());
136
137         r = File::GetAttributes( mediaCapabilityFilePath, attributes);
138         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. File path is %ls", GetErrorMessage(r), mediaCapabilityFilePath.GetPointer());
139
140         length = attributes.GetFileSize();
141         SysTryCatch(NID_MEDIA, length > 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating.");
142
143         pXmlBuffer.reset(new (std::nothrow) char[length]);
144         SysTryCatch(NID_MEDIA, null != pXmlBuffer.get(), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
145
146         r = fileObj.Construct(mediaCapabilityFilePath, L"r");
147         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
148
149 //      read the capability xml file content as parse the capability
150         readLen = fileObj.Read(pXmlBuffer.get(), length);
151         SysTryCatch(NID_MEDIA, readLen == length, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating. length:%d, readLen:%d", length,
152                            readLen);
153
154 //      parse the capability file buffer all the parse key value pair shall be added in __pMap object
155         r = ParseCapability(pXmlBuffer.get(), readLen);
156         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
157
158         //      Get the camera count
159         {
160                 int cameraCount = 0;
161                 bool flag = false;
162
163                 r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.back", flag);
164                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
165                 if (flag)
166                 {
167                         cameraCount++;
168                 }
169
170                 r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.front", flag);
171                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
172                 if (flag)
173                 {
174                         cameraCount++;
175                 }
176                 __cameraCount = cameraCount;
177         }
178         return E_SUCCESS;
179
180 CATCH:
181         SysLog(NID_MEDIA, "[%s]", GetErrorMessage(r));
182
183         if (__pMap != null)
184         {
185                 __pMap->RemoveAll(true);
186                 delete __pMap;
187                 __pMap = 0;
188         }
189         return r;
190 }
191
192 typedef void (_CapabilityImpl::* KeyConvertFunc)(const String& key, String& newKey);
193 typedef result (*_ValueCopyFunc)(int type, Object* pObj, void* value);
194
195 typedef struct
196 {
197         const wchar_t* pKey;
198         _ValueCopyFunc copy;
199         _MediaCapCategoryType category;
200 } _CapabilityCopyMap;
201
202
203 result
204 _CapabilityImpl::CopyListInteger(int type, Object* pObj, void* value)
205 {
206         result r = E_SUCCESS;
207
208         SysTryReturn(NID_MEDIA, type == _MEDIA_CAP_VALUE_TYPE_LIST, E_INVALID_ARG, E_INVALID_ARG,
209                                 "[E_INVALID_ARG] Invalid argument(Type) is used. type:%d",
210                                 type);
211
212         IList* pSrc = dynamic_cast <IList*>(pObj);
213         IList* pDst = static_cast <IList*>(value);
214
215         SysTryReturn(NID_MEDIA, pSrc != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc is null.");
216         SysTryReturn(NID_MEDIA, pDst != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pDest is null.");
217         SysTryReturn(NID_MEDIA,
218                                 pSrc->GetCount() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc->GetCount() is %d", pSrc->GetCount());
219
220         for (int i = 0; i < pSrc->GetCount(); i++)
221         {
222                 Integer* pInt = (Integer*) pSrc->GetAt(i);
223                 if (pInt)
224                 {
225                         Integer* pInteger = null;
226
227                         pInteger = new (std::nothrow) Integer(*pInt);
228                         SysTryReturn(NID_MEDIA, pInteger !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
229
230                         r = pDst->Add(*pInteger);
231                         SysTryReturn(NID_MEDIA, E_SUCCESS == r, r, r, "[%s] Propagating.");
232                 }
233         }
234
235         return E_SUCCESS;
236 }
237
238 result
239 _CapabilityImpl::CopyListString(int type, Object* pObj, void* value)
240 {
241         result r = E_SUCCESS;
242
243         SysTryReturn(NID_MEDIA, type == _MEDIA_CAP_VALUE_TYPE_LIST, E_INVALID_ARG, E_INVALID_ARG,
244                                 "[E_INVALID_ARG] Invalid argument(Type) is used. type:%d",
245                                 type);
246
247         IList* pSrc = dynamic_cast <IList*>(pObj);
248         IList* pDst = static_cast <IList*>(value);
249
250         SysTryReturn(NID_MEDIA, pSrc != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc is null.");
251         SysTryReturn(NID_MEDIA, pDst != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pDest is null.");
252         SysTryReturn(NID_MEDIA,
253                                 pSrc->GetCount() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc->GetCount() is %d", pSrc->GetCount());
254
255         for (int i = 0; i < pSrc->GetCount(); i++)
256         {
257                 String* pStr = (String*) pSrc->GetAt(i);
258                 if (pStr)
259                 {
260                         String* pString = null;
261
262                         pString = new (std::nothrow) String(*pStr);
263                         SysTryReturn(NID_MEDIA, pString !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
264
265                         r = pDst->Add(*pString);
266                         SysTryReturn(NID_MEDIA, E_SUCCESS == r, r, r, "[%s] Propagating.");
267                 }
268         }
269         return E_SUCCESS;
270 }
271
272
273 result
274 _CapabilityImpl::CopyListDimension(int type, Object* pObj, void* value)
275 {
276         result r = E_SUCCESS;
277
278         SysTryReturn(NID_MEDIA, type == _MEDIA_CAP_VALUE_TYPE_LIST, E_INVALID_ARG, E_INVALID_ARG,
279                                 "[E_INVALID_ARG] Invalid argument(Type) is used. type:%d",
280                                 type);
281
282         IList* pSrc = dynamic_cast <IList*>(pObj);
283         IList* pDst = static_cast <IList*>(value);
284
285         SysTryReturn(NID_MEDIA, pSrc != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc is null.");
286         SysTryReturn(NID_MEDIA, pDst != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pDest is null.");
287         SysTryReturn(NID_MEDIA,
288                                 pSrc->GetCount() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] IList instance is not available. pSrc->GetCount() is %d", pSrc->GetCount());
289
290         for (int i = 0; i < pSrc->GetCount(); i++)
291         {
292                 Dimension* pDim = (Dimension*) pSrc->GetAt(i);
293                 if (pDim)
294                 {
295                         Dimension* pDimension = null;
296
297                         pDimension = new (std::nothrow) Dimension(*pDim);
298                         SysTryReturn(NID_MEDIA, pDimension !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
299
300                         r = pDst->Add(*pDimension);
301                         SysTryReturn(NID_MEDIA, E_SUCCESS == r, r, r, "[%s] Propagating.");
302                 }
303         }
304         return E_SUCCESS;
305 }
306
307 result
308 _CapabilityImpl::CopyInteger(int type, Object* pObj, void* value)
309 {
310         SysTryReturn(NID_MEDIA, type == _MEDIA_CAP_VALUE_TYPE_INT, E_INVALID_ARG, E_INVALID_ARG,
311                                 "[E_INVALID_ARG] Invalid argument(Type) is used. type:%d",
312                                 type);
313
314         Integer* pSrc = dynamic_cast <Integer*>(pObj);
315         int* pDst = (int*) value;
316
317         SysTryReturn(NID_MEDIA, pSrc != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Integer instance is not available. pSrc is null.");
318
319         *pDst = pSrc->ToInt();
320
321         return E_SUCCESS;
322 }
323
324 result
325 _CapabilityImpl::CopyBool(int type, Object* pObj, void* value)
326 {
327         SysTryReturn(NID_MEDIA, type == _MEDIA_CAP_VALUE_TYPE_BOOL, E_INVALID_ARG, E_INVALID_ARG,
328                                 "[E_INVALID_ARG] Invalid argument(Type) is used. type:%d",
329                                 type);
330
331         Integer* pSrc = dynamic_cast <Integer*>(pObj);
332         bool* pDst = (bool*) value;
333
334         SysTryReturn(NID_MEDIA, pSrc != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Integer instance is not available. pSrc is null.");
335
336         *pDst = (pSrc->ToInt()) ? true : false;
337
338         return E_SUCCESS;
339 }
340
341 static _CapabilityCopyMap _COPY_MAP[] =
342 {
343         { AUDIOIN_SAMPLE_RATE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO},
344         { AUDIOIN_SAMPLE_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO },
345
346         { AUDIOOUT_COUNT_MAX, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_AUDIO },
347         { AUDIOOUT_SAMPLE_RATE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO },
348         { AUDIOOUT_SAMPLE_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO },
349
350         { AUDIORECORDER_FORMAT, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_AUDIO_RECORDER },
351
352         { AUDIORECORDER_CODEC_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO_RECORDER },
353         { AUDIORECORDER_MEDIA_CONTAINER_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_AUDIO_RECORDER },
354
355         { CAMERA_COUNT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
356
357         { CAMERA_PRIMARY_CAPTURE_FORMAT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
358         { CAMERA_PRIMARY_CAPTURE_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
359         { CAMERA_PRIMARY_DIRECTION, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
360         { CAMERA_PRIMARY_EFFECT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
361         { CAMERA_PRIMARY_ISO_LEVEL, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
362         { CAMERA_PRIMARY_PREVIEW_FORMAT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
363         { CAMERA_PRIMARY_PREVIEW_FRAMERATE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
364         { CAMERA_PRIMARY_PREVIEW_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
365         { CAMERA_PRIMARY_RECORDING_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
366         { CAMERA_PRIMARY_ROTATION, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
367         { CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
368         { CAMERA_PRIMARY_SUPPORT_CAPTURE, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
369         { CAMERA_PRIMARY_SUPPORT_CONTRAST, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
370         { CAMERA_PRIMARY_SUPPORT_EXPOSURE, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
371         { CAMERA_PRIMARY_SUPPORT_FLASH, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
372         { CAMERA_PRIMARY_SUPPORT_FOCUS, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
373         { CAMERA_PRIMARY_SUPPORT_PREVIEW, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
374         { CAMERA_PRIMARY_SUPPORT_RECORDING, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
375         { CAMERA_PRIMARY_SUPPORT_ZOOM, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
376         { CAMERA_PRIMARY_SUPPORT_ZERO_SHUTTER_LAG, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
377         { CAMERA_PRIMARY_WHITE_BALANCE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
378         { CAMERA_PRIMARY_ZOOM_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
379         { CAMERA_PRIMARY_FOCUS_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
380         { CAMERA_PRIMARY_FLIP, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
381         { CAMERA_PRIMARY_PREVIEW_ROTATION, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
382         { CAMERA_PRIMARY_FOCUS_POINT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
383         { CAMERA_PRIMARY_FLASH_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
384         { CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
385         { CAMERA_PRIMARY_METERING_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
386
387         { CAMERA_SECONDARY_CAPTURE_FORMAT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
388         { CAMERA_SECONDARY_CAPTURE_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
389         { CAMERA_SECONDARY_DIRECTION, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
390         { CAMERA_SECONDARY_EFFECT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
391         { CAMERA_SECONDARY_ISO_LEVEL, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
392         { CAMERA_SECONDARY_PREVIEW_FORMAT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
393         { CAMERA_SECONDARY_PREVIEW_FRAMERATE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
394         { CAMERA_SECONDARY_PREVIEW_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
395         { CAMERA_SECONDARY_RECORDING_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
396         { CAMERA_SECONDARY_ROTATION, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
397         { CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
398         { CAMERA_SECONDARY_SUPPORT_CAPTURE, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
399         { CAMERA_SECONDARY_SUPPORT_CONTRAST, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
400         { CAMERA_SECONDARY_SUPPORT_EXPOSURE, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
401         { CAMERA_SECONDARY_SUPPORT_FLASH, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
402         { CAMERA_SECONDARY_SUPPORT_FOCUS, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
403         { CAMERA_SECONDARY_SUPPORT_PREVIEW, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
404         { CAMERA_SECONDARY_SUPPORT_RECORDING, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
405         { CAMERA_SECONDARY_SUPPORT_ZOOM, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
406         { CAMERA_SECONDARY_SUPPORT_ZERO_SHUTTER_LAG, _CapabilityImpl::CopyBool, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
407         { CAMERA_SECONDARY_WHITE_BALANCE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
408         { CAMERA_SECONDARY_ZOOM_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
409         { CAMERA_SECONDARY_FOCUS_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
410         { CAMERA_SECONDARY_FLIP, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
411         { CAMERA_SECONDARY_PREVIEW_ROTATION, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
412         { CAMERA_SECONDARY_FOCUS_POINT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
413         { CAMERA_SECONDARY_FLASH_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
414         { CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
415         { CAMERA_SECONDARY_METERING_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
416
417         { PLAYER_AUDIO_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_PLAYER },
418         { PLAYER_COUNT_MAX, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PLAYER },
419         { PLAYER_PROTOCOL, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_PLAYER },
420         { PLAYER_VIDEO_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_PLAYER },
421         { PLAYER_VIDEO_HEIGHT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PLAYER },
422         { PLAYER_VIDEO_WIDTH, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PLAYER },
423
424         { VIDEORECORDER_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_CODEC },
425
426         { VIDEORECORDER_AUDIO_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
427         { VIDEORECORDER_FORMAT, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
428         { VIDEORECORDER_VIDEO_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
429
430         { VIDEORECORDER_AUDIO_CODEC_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
431         { VIDEORECORDER_VIDEO_CODEC_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
432         { VIDEORECORDER_MEDIA_CONTAINER_TYPE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_VIDEO_RECORDER },
433 };
434
435 result
436 _CapabilityImpl::GetValue(const Tizen::Base::String& key, int type, void* value)
437 {
438         result r = E_SUCCESS;
439         bool found = false;
440
441         for (int i = 0; i < (int)sizeof(_COPY_MAP) / (int)sizeof(_COPY_MAP[0]); i++)
442         {
443                 _CapabilityCopyMap* pInfo = (_CapabilityCopyMap*) &(_COPY_MAP[i]);
444
445                 if (pInfo == 0)
446                 {
447                         continue;
448                 }
449                 //check for valid key value and then get the corresponding value from the hash map
450                 if (key.Equals(pInfo->pKey, true))
451                 {
452                         // Get the value
453                         Object* pObj = __pMap->GetValue(key);
454
455                         // If not yet retrieved
456                         if ( pObj == null )
457                         {
458                                 ClearLastResult();
459                                 //Set the value
460                                 switch (pInfo->category)
461                                 {
462                                         case _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA:
463                                                 if (!__primaryCameraDone && __cameraCount > 0)
464                                                 {
465                                                         r = ParseCapability(_MEDIA_CAP_CATEGORY_PRIMARY_CAMERA);
466                                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
467                                                         __primaryCameraDone = true;
468                                                 }
469                                                 break;
470
471                                         case _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA:
472                                                 if (!__secondaryCameraDone && __cameraCount > 1)
473                                                 {
474                                                         r = ParseCapability(_MEDIA_CAP_CATEGORY_SECONDARY_CAMERA);
475                                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
476                                                         __secondaryCameraDone = true;
477                                                 }
478                                                 break;
479
480                                         case _MEDIA_CAP_CATEGORY_VIDEO_RECORDER:
481                                                 if (!__videoRecorderDone)
482                                                 {
483                                                         r = ParseCapability(_MEDIA_CAP_CATEGORY_VIDEO_RECORDER);
484                                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
485                                                         __videoRecorderDone = true;
486                                                 }
487                                                 break;
488
489                                         case _MEDIA_CAP_CATEGORY_AUDIO_RECORDER:
490                                                 if (!__audioRecorderDone)
491                                                 {
492                                                         r = ParseCapability(_MEDIA_CAP_CATEGORY_AUDIO_RECORDER);
493                                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
494                                                         __audioRecorderDone = true;
495                                                 }
496                                                 break;
497
498                                         default:
499                                                 break;
500                                 }
501                                 // Retrieve again.
502                                 pObj = __pMap->GetValue(key);
503                                 SysTryReturn(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Object instance is not available. Value is not found. key:%ls", key.GetPointer());
504                         }
505                         SysTryReturn(NID_MEDIA, pInfo->copy != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Copy function is not found.");
506
507                         r = (pInfo->copy)(type, pObj, value);
508                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. key:%ls", GetErrorMessage(r), key.GetPointer());
509
510                         found = true;
511                         break;
512                 }
513         }
514         SysTryCatch(NID_MEDIA, found, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] String instance is not available. key is not found. key:%ls", key.GetPointer());
515         return r;
516
517 CATCH:
518         return r;
519 }
520
521 result
522 _CapabilityImpl::GetValue(const Tizen::Base::String& key, bool& value)
523 {
524         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_BOOL, (void*) &value);
525 }
526
527
528 result
529 _CapabilityImpl::GetValue(const Tizen::Base::String& key, int& value)
530 {
531         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_INT, (void*) &value);
532 }
533
534
535 result
536 _CapabilityImpl::GetValue(const Tizen::Base::String& key, long long& value)
537 {
538         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_LONG_LONG, (void*) &value);
539 }
540
541 result
542 _CapabilityImpl::GetValue(const Tizen::Base::String& key, double& value)
543 {
544         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_DOUBLE, (void*) &value);
545 }
546
547 result
548 _CapabilityImpl::GetValue(const Tizen::Base::String& key, Tizen::Base::String& value)
549 {
550         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_STRING, (void*) &value);
551 }
552
553 result
554 _CapabilityImpl::GetValueN(const Tizen::Base::String& key, Tizen::Base::Collection::IList& value)
555 {
556         return GetValue(key, _MEDIA_CAP_VALUE_TYPE_LIST, (void*) &value);
557 }
558
559 typedef Tizen::Base::Object* (*_ValueConvertFunc)(const char* input, Object* pObj, const void* param);
560
561 typedef struct
562 {
563         const char* pKey;
564         int value;
565 } _CharToEnumMap;
566
567 static const _CharToEnumMap _AUDIO_SAMPLE_TYPE_MAP[] =
568 {
569         { "PCM_U8", AUDIO_TYPE_PCM_U8 },
570         { "PCM_S8", AUDIO_TYPE_PCM_S8 },
571         { "PCM_U16_LE", AUDIO_TYPE_PCM_U16_LE },
572         { "PCM_U16_BE", AUDIO_TYPE_PCM_U16_BE },
573         { "PCM_S16_LE", AUDIO_TYPE_PCM_S16_LE },
574         { "PCM_S16_BE", AUDIO_TYPE_PCM_S16_BE },
575         { 0, 0 }
576 };
577 /*
578 static const _CharToEnumMap _PIXEL_FORMAT_MAP[] =
579 {
580         { "RGB565", PIXEL_FORMAT_RGB565 },
581         { "ARGB8888", PIXEL_FORMAT_ARGB8888 },
582         { "R8G8B8A8", PIXEL_FORMAT_R8G8B8A8 },
583         { "YUV420", PIXEL_FORMAT_YCbCr420_PLANAR },
584         { "JPEG", PIXEL_FORMAT_JPEG },
585         { 0, 0 },
586 };
587 */
588 static const _CharToEnumMap _CAMERA_DIRECTION_MAP[] =
589 {
590         { "Front", CAMERA_DIRECTION_FRONT },
591         { "Back", CAMERA_DIRECTION_BACK },
592         { 0, 0 },
593 };
594
595 static const _CharToEnumMap _CAMERA_ZOOM_TYPE_MAP[] =
596 {
597         { "Digital", CAMERA_ZOOM_TYPE_DIGITAL },
598         { "Smart", CAMERA_ZOOM_TYPE_SMART },
599         { 0, 0 },
600 };
601 /*
602 static const _CharToEnumMap _CAMERA_FOCUS_MODE_MAP[] =
603 {
604         { "None", CAMERA_FOCUS_MODE_NONE },
605         { "Normal", CAMERA_FOCUS_MODE_NORMAL },
606         { "Macro", CAMERA_FOCUS_MODE_MACRO },
607         { "ContinuousAuto", CAMERA_FOCUS_MODE_CONTINUOUS_AUTO },
608         { "Infinite", CAMERA_FOCUS_MODE_INFINITE },
609         { 0, 0 },
610 };
611 */
612 static const _CharToEnumMap _CAMERA_FLIP_TYPE_MAP[] =
613 {
614         { "None", CAMERA_FLIP_NONE },
615         { "Horizontal", CAMERA_FLIP_HORIZONTAL },
616         { "Vertical", CAMERA_FLIP_VERTICAL },
617         { 0, 0 },
618 };
619 /*
620 static const _CharToEnumMap _CAMERA_EFFECT_MAP[] =
621 {
622         { "COLOR", CAMERA_EFFECT_COLOR},
623         { "BW", CAMERA_EFFECT_BW},
624         { "SEPIA", CAMERA_EFFECT_SEPIA},
625         { "SOLARIZE", CAMERA_EFFECT_SOLARIZE},
626         { "NEGATIVE", CAMERA_EFFECT_NEGATIVE},
627         { "NIGHT", CAMERA_EFFECT_NIGHT},
628         { 0, 0 },
629 };
630
631 static const _CharToEnumMap _CAMERA_ISO_LEVEL_MAP[] =
632 {
633         { "AUTO", CAMERA_ISO_AUTO},
634         { "50", CAMERA_ISO_50},
635         { "100", CAMERA_ISO_100},
636         { "200", CAMERA_ISO_200},
637         { "400", CAMERA_ISO_400},
638         { "800", CAMERA_ISO_800},
639         { "1600", CAMERA_ISO_1600},
640         { 0, 0 },
641 };
642 */
643 static const _CharToEnumMap _CAMERA_ROTATION_MAP[] =
644 {
645         { "0", CAMERA_ROTATION_NONE},
646         { "90", CAMERA_ROTATION_90},
647         { "180", CAMERA_ROTATION_180},
648         { "270", CAMERA_ROTATION_270},
649         { 0, 0 },
650 };
651 /*
652 static const _CharToEnumMap _CAMERA_WB_MAP[] =
653 {
654         { "AUTO", CAMERA_WHITE_BALANCE_AUTO},
655         { "SUNNY", CAMERA_WHITE_BALANCE_SUNNY},
656         { "CLOUDY", CAMERA_WHITE_BALANCE_CLOUDY},
657         { "FLUORESCENT", CAMERA_WHITE_BALANCE_FLUORESCENT},
658         { "TUNGSTEN", CAMERA_WHITE_BALANCE_TUNGSTEN},
659         { 0, 0 },
660 };
661
662 static const _CharToEnumMap _BOOL_MAP[] =
663 {
664         { "true", true },
665         { "false", false },
666         { 0, 0 },
667 };
668
669 static const _CharToEnumMap _CODEC_TYPE_MAP[] =
670 {
671         { "LPCM", CODEC_LPCM },
672         { "ALAW", CODEC_ALAW },
673         { "uLAW", CODEC_ULAW },
674         { "IMAD", CODEC_IMA_ADPCM },
675         { "MSAD", CODEC_MS_ADPCM },
676         { "AMR", CODEC_AMR_NB },
677         { "FLAC", CODEC_FLAC },
678         { "MP3", CODEC_MP3 },
679         { "AAC", CODEC_AAC },
680         { "AACH", CODEC_HEAAC },
681         { "AACP", CODEC_HEAAC_V2 },
682         { "AC-3", CODEC_AC3 },
683         { "VORB", CODEC_VORBIS },
684         { "WMA", CODEC_WMA },
685         { "MIDI", CODEC_MIDI },
686         { "H263", CODEC_H263 },
687         { "MPG4", CODEC_MPEG4 },
688         { "H264", CODEC_H264 },
689         { "THRA", CODEC_THEORA },
690         { "WMV", CODEC_WMV },
691         { 0, 0 }
692 };
693
694 static const _CharToEnumMap _MEDIA_CONTAINER_TYPE_MAP[] =
695 {
696         { "WAV", MEDIA_CONTAINER_WAV },
697         { "AMR", MEDIA_CONTAINER_AMR },
698         { "AAC", MEDIA_CONTAINER_AAC },
699         { "MP3", MEDIA_CONTAINER_MP3 },
700         { "FLAC", MEDIA_CONTAINER_FLAC },
701         { "3GP", MEDIA_CONTAINER_3GP },
702         { "MP4", MEDIA_CONTAINER_MP4 },
703         { "AVI", MEDIA_CONTAINER_AVI },
704         { "ASF", MEDIA_CONTAINER_ASF },
705         { "MKV", MEDIA_CONTAINER_MKV },
706         { "MOV", MEDIA_CONTAINER_MOV },
707         { "OGG", MEDIA_CONTAINER_OGG },
708         { 0, 0 }
709 };
710 */
711
712 typedef Tizen::Base::Object* (*_ValueParsingFunc)(xmlNode* pRoot, Tizen::Base::Object* pObj, _ValueConvertFunc func,
713                                                                                            const void* param);
714
715 typedef struct
716 {
717         const wchar_t* pKey;
718         _ValueParsingFunc parser;
719         _ValueConvertFunc convert;
720         const void* param;
721 } _SectionParsingInfo;
722
723 Tizen::Base::Object*
724 _CapabilityImpl::ConvertCharToInteger(const char* input, Object* pObj, const void* param)
725 {
726         Tizen::Base::String str(input);
727         Integer* pInt = 0;
728         int i = 0;
729         result res = E_SUCCESS;
730 //      bool integerCreated = false;
731
732         res = Tizen::Base::Integer::Parse(str, i);
733         SysTryReturn(NID_MEDIA, res == E_SUCCESS, pInt, res, "[%s] Propagating.", res);
734
735         if (pObj)
736         {
737                 pInt = dynamic_cast <Integer*>(pObj);
738         }
739         else
740         {
741                 pInt = new (std::nothrow) Integer();
742 //              integerCreated = true;
743         }
744
745         SysTryCatch(NID_MEDIA, null != pInt, res = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.  Integer is null");
746
747         *pInt = i;
748
749         return pInt;
750
751 CATCH:
752         return null;
753 }
754
755 Tizen::Base::Object*
756 _CapabilityImpl::ConvertCharToString(const char* input, Object* pObj, const void* param)
757 {
758         String* pStr = pObj ? (String*) pObj : new (std::nothrow) String();
759         SysTryReturn(NID_MEDIA, pStr !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
760
761         *pStr = input;
762
763         return pStr;
764 }
765
766
767 Tizen::Base::Object*
768 _CapabilityImpl::ConvertCharToEnum(const char* input, Object* pObj, const void* param)
769 {
770         Tizen::Base::String str(input);
771         Integer* pInt = null;
772         _CharToEnumMap* pMap = (_CharToEnumMap*) param;
773         bool found = false;
774         bool integerCreated = false;
775
776         if (pObj != null)
777         {
778                 pInt = (Integer*) pObj;
779         }
780         else
781         {
782                 pInt = new (std::nothrow) Integer();
783                 integerCreated = true;
784         }
785
786         SysTryCatch(NID_MEDIA, null != pInt, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred.  Integer is null");
787
788         while (pMap != null && pMap->pKey)
789         {
790                 if (str.Equals(pMap->pKey, false))
791                 {
792                         *pInt = pMap->value;
793                         found = true;
794                         break;
795                 }
796                 pMap++;
797         }
798
799         if (found)
800         {
801                 return pInt;
802         }
803         else
804         {
805                 SysLog(NID_MEDIA, "Failed : %s pMap=0x%x", input, param);
806                 if (integerCreated)
807                 {
808                         delete pInt;
809                 }
810
811                 return 0;
812         }
813
814 CATCH:
815         return null;
816 }
817
818 Tizen::Base::Object*
819 _CapabilityImpl::ConvertCharToDimension(const char* input, Object* pObj, const void* param)
820 {
821         Tizen::Base::String str;
822         Dimension* pDim = null;
823         StringTokenizer tok(input, L" x");
824         int w = 0;
825         int h = 0;
826         int count = 0;
827         result res = E_SUCCESS;
828
829         pDim = pObj ? (Dimension*) pObj : new (std::nothrow) Dimension();
830         SysTryReturn(NID_MEDIA, pDim !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
831
832         count = tok.GetTokenCount();
833         SysTryReturn(NID_MEDIA, count == 2, pDim, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.  Token should be two, token count:%d", count);
834
835         tok.GetNextToken(str);
836         res = Tizen::Base::Integer::Parse(str, w);
837         SysTryReturn(NID_MEDIA, res == E_SUCCESS, pDim, res, "[%s] Propagating.");
838
839         tok.GetNextToken(str);
840         res = Tizen::Base::Integer::Parse(str, h);
841         SysTryReturn(NID_MEDIA, res == E_SUCCESS, pDim, res, "[%s] Propagating.");
842
843         pDim->width = w;
844         pDim->height = h;
845
846         return pDim;
847 }
848
849 Tizen::Base::Object*
850 ParseValueList(xmlNode* pRoot, Tizen::Base::Object* pObj, _ValueConvertFunc func, const void* param)
851 {
852         xmlNode* pNode = null;
853         xmlNode* pChild = null;
854         _MediaSafeArrayList* pList = null;
855
856         pList = pObj ? (_MediaSafeArrayList*) pObj : new (std::nothrow) _MediaSafeArrayList();
857         SysTryReturn(NID_MEDIA, pList !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
858
859         for (pNode = pRoot->children; pNode; pNode = pNode->next)
860         {
861                 if (pNode->type == XML_ELEMENT_NODE && pNode->children)
862                 {
863                         pChild = pNode->children;
864
865                         if (pChild->type == XML_TEXT_NODE && pChild->content)
866                         {
867                                 Object* pRet = func((const char*) pChild->content, 0, param);
868                                 if (pRet)
869                                 {
870                                         pList->Add(*pRet);
871                                 }
872                         }
873                 }
874         }
875
876         return pList;
877 }
878
879 Tizen::Base::Object*
880 ParseContent(xmlNode* pRoot, Tizen::Base::Object* pObj, _ValueConvertFunc func, const void* param)
881 {
882         xmlNode* pNode = null;
883
884         for (pNode = pRoot->children; pNode; pNode = pNode->next)
885         {
886                 if (pNode->type == XML_TEXT_NODE && pNode->content)
887                 {
888                         pObj = func((const char*) pNode->content, pObj, param);
889                 }
890         }
891
892         return pObj;
893 }
894
895 //key to corresponding value conversion function map
896 static _SectionParsingInfo _PARSING_INFO[] =
897 {
898         { AUDIOIN_SAMPLE_RATE, ParseValueList, _CapabilityImpl::ConvertCharToInteger, 0 },
899         { AUDIOIN_SAMPLE_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _AUDIO_SAMPLE_TYPE_MAP },
900
901         { AUDIOOUT_COUNT_MAX, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
902         { AUDIOOUT_SAMPLE_RATE, ParseValueList, _CapabilityImpl::ConvertCharToInteger, 0 },
903         { AUDIOOUT_SAMPLE_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _AUDIO_SAMPLE_TYPE_MAP },
904
905         { AUDIORECORDER_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
906
907 //      { AUDIORECORDER_CODEC_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CODEC_TYPE_MAP},
908 //      { AUDIORECORDER_MEDIA_CONTAINER_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _MEDIA_CONTAINER_TYPE_MAP},
909
910 //      { CAMERA_PRIMARY_CAPTURE_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
911 //      { CAMERA_PRIMARY_CAPTURE_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0 },
912         { CAMERA_PRIMARY_DIRECTION, ParseContent, _CapabilityImpl::ConvertCharToEnum, _CAMERA_DIRECTION_MAP },
913 //      { CAMERA_PRIMARY_EFFECT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_EFFECT_MAP },
914 //      { CAMERA_PRIMARY_ISO_LEVEL, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ISO_LEVEL_MAP },
915 //      { CAMERA_PRIMARY_PREVIEW_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
916 //      { CAMERA_PRIMARY_PREVIEW_FRAMERATE, ParseValueList, _CapabilityImpl::ConvertCharToInteger, 0 },
917 //      { CAMERA_PRIMARY_PREVIEW_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0 },
918         { CAMERA_PRIMARY_ROTATION, ParseContent, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ROTATION_MAP },
919 //      { CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
920 //      { CAMERA_PRIMARY_SUPPORT_CAPTURE, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
921 //      { CAMERA_PRIMARY_SUPPORT_CONTRAST, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
922 //      { CAMERA_PRIMARY_SUPPORT_EXPOSURE, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
923 //      { CAMERA_PRIMARY_SUPPORT_FLASH, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
924 //      { CAMERA_PRIMARY_SUPPORT_FOCUS, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
925 //      { CAMERA_PRIMARY_SUPPORT_PREVIEW, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
926 //      { CAMERA_PRIMARY_SUPPORT_RECORDING, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
927 //      { CAMERA_PRIMARY_SUPPORT_ZOOM, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
928 //      { CAMERA_PRIMARY_SUPPORT_ZERO_SHUTTER_LAG, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
929 //      { CAMERA_PRIMARY_WHITE_BALANCE, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
930         { CAMERA_PRIMARY_ZOOM_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ZOOM_TYPE_MAP },
931 //      { CAMERA_PRIMARY_RECORDING_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0},
932 //      { CAMERA_PRIMARY_FOCUS_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FOCUS_MODE_MAP },
933         { CAMERA_PRIMARY_FLIP, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLIP_TYPE_MAP },
934         { CAMERA_PRIMARY_PREVIEW_ROTATION, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ROTATION_MAP },
935 //      { CAMERA_PRIMARY_ZOOM_LEVEL, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0},
936         { CAMERA_PRIMARY_FOCUS_POINT, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
937 //      { CAMERA_PRIMARY_FLASH_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLASH_MODE_MAP },
938 //      { CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT, ParseContent, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
939 //      { CAMERA_PRIMARY_METERING_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_METERING_MODE_MAP },
940
941 //      { CAMERA_SECONDARY_CAPTURE_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
942 //      { CAMERA_SECONDARY_CAPTURE_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0 },
943         { CAMERA_SECONDARY_DIRECTION, ParseContent, _CapabilityImpl::ConvertCharToEnum, _CAMERA_DIRECTION_MAP },
944 //      { CAMERA_SECONDARY_EFFECT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_EFFECT_MAP },
945 //      { CAMERA_SECONDARY_ISO_LEVEL, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ISO_LEVEL_MAP },
946 //      { CAMERA_SECONDARY_PREVIEW_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
947 //      { CAMERA_SECONDARY_PREVIEW_FRAMERATE, ParseValueList, _CapabilityImpl::ConvertCharToInteger, 0 },
948 //      { CAMERA_SECONDARY_PREVIEW_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0 },
949         { CAMERA_SECONDARY_ROTATION, ParseContent, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ROTATION_MAP },
950 //      { CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
951 //      { CAMERA_SECONDARY_SUPPORT_CAPTURE, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
952 //      { CAMERA_SECONDARY_SUPPORT_CONTRAST, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
953 //      { CAMERA_SECONDARY_SUPPORT_EXPOSURE, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
954 //      { CAMERA_SECONDARY_SUPPORT_FLASH, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
955 //      { CAMERA_SECONDARY_SUPPORT_FOCUS, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
956 //      { CAMERA_SECONDARY_SUPPORT_PREVIEW, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
957 //      { CAMERA_SECONDARY_SUPPORT_RECORDING, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
958 //      { CAMERA_SECONDARY_SUPPORT_ZOOM, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
959 //      { CAMERA_SECONDARY_SUPPORT_ZERO_SHUTTER_LAG, ParseContent, _CapabilityImpl::ConvertCharToEnum, _BOOL_MAP },
960 //      { CAMERA_SECONDARY_WHITE_BALANCE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_WB_MAP },
961         { CAMERA_SECONDARY_ZOOM_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ZOOM_TYPE_MAP },
962 //      { CAMERA_SECONDARY_RECORDING_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0},
963 //      { CAMERA_SECONDARY_FOCUS_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FOCUS_MODE_MAP },
964         { CAMERA_SECONDARY_FLIP, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLIP_TYPE_MAP },
965         { CAMERA_SECONDARY_PREVIEW_ROTATION, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_ROTATION_MAP },
966 //      { CAMERA_SECONDARY_ZOOM_LEVEL, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0},
967         { CAMERA_SECONDARY_FOCUS_POINT, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
968 //      { CAMERA_SECONDARY_FLASH_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLASH_MODE_MAP },
969 //      { CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT, ParseContent, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
970 //      { CAMERA_SECONDARY_METERING_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_METERING_MODE_MAP },
971
972         { PLAYER_AUDIO_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
973         { PLAYER_COUNT_MAX, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
974         { PLAYER_PROTOCOL, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
975         { PLAYER_VIDEO_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
976         { PLAYER_VIDEO_HEIGHT, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
977         { PLAYER_VIDEO_WIDTH, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
978
979         { VIDEORECORDER_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
980
981         { VIDEORECORDER_AUDIO_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
982         { VIDEORECORDER_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
983         { VIDEORECORDER_VIDEO_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
984
985 //      { VIDEORECORDER_AUDIO_CODEC_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CODEC_TYPE_MAP},
986 //      { VIDEORECORDER_VIDEO_CODEC_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CODEC_TYPE_MAP},
987 //      { VIDEORECORDER_MEDIA_CONTAINER_TYPE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _MEDIA_CONTAINER_TYPE_MAP},
988 };
989
990
991 void
992 _CapabilityImpl::ParseSection(xmlNode* pRoot, const String& section)
993 {
994         xmlNode* pNode = null;
995         result r = E_SUCCESS;
996
997         //capability xml buffer parsing loop
998         for (pNode = pRoot->children; pNode; pNode = pNode->next)
999         {
1000                 if (pNode->type == XML_ELEMENT_NODE)
1001                 {
1002                         String name((char*) pNode->name);
1003                         String key(section);
1004                         Object* pValue = 0;
1005                         key += "." + name;
1006
1007                         if (key.Equals(L"Camera.Primary", true) || key.Equals(L"Camera.Secondary", true))
1008                         {
1009                                 ParseSection(pNode, key);
1010                         }
1011                         else
1012                         {
1013                                 pValue = __pMap->GetValue(key);
1014
1015                                 for (int i = 0; i < (int)sizeof(_PARSING_INFO) / (int)sizeof(_PARSING_INFO[0]); i++)
1016                                 {
1017                                         if (key.Equals(_PARSING_INFO[i].pKey, true))
1018                                         {
1019                                                 Object* pRet = (_PARSING_INFO[i].parser)(pNode, pValue, _PARSING_INFO[i].convert, _PARSING_INFO[i].param);
1020                                                 if (pValue == null)
1021                                                 {
1022                                                         String* pKey = null;
1023                                                         pKey = new (std::nothrow) Tizen::Base::String(key);
1024                                                         SysTryReturn(NID_MEDIA, pKey !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1025
1026                                                         r = __pMap->Add(*pKey, *pRet);
1027                                                         SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1028                                                 }
1029                                                 break;
1030                                         }
1031                                 }
1032                         }
1033                 }
1034         }
1035 }
1036
1037 result
1038 _CapabilityImpl::ParseCapability(const char* pXmlBuffer, int length)
1039 {
1040         xmlDoc* pDoc = null;
1041         xmlNode* pRoot = null;
1042         xmlNode* pNode = null;
1043         result r = E_SUCCESS;
1044         String name;
1045
1046         pDoc = xmlParseMemory(pXmlBuffer, length);
1047         SysTryCatch(NID_MEDIA, pDoc != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. xmlParseMemory failed %s %d", pXmlBuffer, length);
1048
1049         pRoot = xmlDocGetRootElement(pDoc);
1050         SysTryCatch(NID_MEDIA, pRoot != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. xmlDocGetRootElement failed : %d %d", pDoc, pRoot);
1051
1052         name = (const char*) (pRoot->name);
1053         SysTryCatch(NID_MEDIA, name.Equals("MediaCapability", true), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid Root Name %ls", name.GetPointer());
1054
1055         for (pNode = pRoot->children; pNode; pNode = pNode->next)
1056         {
1057                 String countryName;
1058
1059                 if (pNode->type == XML_ELEMENT_NODE)
1060                 {
1061                         String name((char*) pNode->name);
1062                         ParseSection(pNode, name);
1063                 }
1064         }
1065
1066         xmlFreeDoc(pDoc);
1067         return E_SUCCESS;
1068
1069 CATCH:
1070         if (pDoc != null)
1071         {
1072                 xmlFreeDoc(pDoc);
1073         }
1074
1075         return r;
1076 }
1077
1078 result _CapabilityImpl::ParseCapability(_MediaCapCategoryType category)
1079 {
1080         result r = E_SUCCESS;
1081         SysTryCatch(NID_MEDIA, category > _MEDIA_CAP_CATEGORY_NONE && category <= _MEDIA_CAP_CATEGORY_CODEC
1082                 , r = E_INVALID_ARG, r, "[E_INVALID_ARG] Invalid argument(category) is used. category:%d", category);
1083         SysLog(NID_MEDIA, "Enter. category : %d", category);
1084
1085         switch(category)
1086         {
1087                 case _MEDIA_CAP_CATEGORY_AUDIO:
1088                         break;
1089
1090                 case _MEDIA_CAP_CATEGORY_IMAGE:
1091                         break;
1092
1093                 case _MEDIA_CAP_CATEGORY_PLAYER:
1094                         break;
1095
1096                 case _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA:
1097                 {
1098                         // For the performance, prevent the repeat camera object creation and deletion.
1099                         // This session will hold the ref count +1.
1100                         _ResultType itemType = _RESULT_NONE;
1101                         _CameraCapabilitySession cameraSession;
1102                         r = cameraSession.Construct(_CAMERA_DEVICE_PRIMARY);
1103                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1104
1105                         {
1106                                         String* pKey = null;
1107                                         Integer* pInteger = null;
1108
1109                                         pKey = new (std::nothrow) String(CAMERA_COUNT);
1110                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1111
1112                                         pInteger = new (std::nothrow) Integer(__cameraCount);
1113                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1114
1115                                         r = __pMap->Add(*pKey, *pInteger);
1116                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1117                         }
1118
1119                         {
1120                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_CAPTURE_FORMAT, itemType);
1121                                 if (pList)
1122                                 {
1123                                         String* pKey = null;
1124                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_CAPTURE_FORMAT);
1125                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1126
1127                                         r = __pMap->Add(*pKey, *pList);
1128                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1129                                 }
1130                                 if (pList == null || pList->GetCount() == 0)
1131                                 {
1132                                         String* pKey = null;
1133                                         Integer* pInteger = null;
1134
1135                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_CAPTURE);
1136                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1137
1138                                         pInteger = new (std::nothrow) Integer(false);
1139                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1140
1141                                         r = __pMap->Add(*pKey, *pInteger);
1142                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1143                                 }
1144                                 else
1145                                 {
1146                                         String* pKey = null;
1147                                         Integer* pInteger = null;
1148
1149                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_CAPTURE);
1150                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1151
1152                                         pInteger = new (std::nothrow) Integer(true);
1153                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1154
1155                                         r = __pMap->Add(*pKey, *pInteger);
1156                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1157                                 }
1158                         }
1159
1160                         {
1161                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_CAPTURE_RESOLUTION, itemType);
1162                                 if (pList)
1163                                 {
1164                                         String* pKey = null;
1165                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_CAPTURE_RESOLUTION);
1166                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1167
1168                                         r = __pMap->Add(*pKey, *pList);
1169                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1170                                 }
1171                         }
1172
1173                         {
1174                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_EFFECT, itemType);
1175                                 if (pList)
1176                                 {
1177                                         String* pKey = null;
1178                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_EFFECT);
1179                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1180
1181                                         r = __pMap->Add(*pKey, *pList);
1182                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1183                                 }
1184                         }
1185
1186                         {
1187                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_ISO_LEVEL, itemType);
1188                                 if (pList)
1189                                 {
1190                                         String* pKey = null;
1191                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_ISO_LEVEL);
1192                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1193
1194                                         r = __pMap->Add(*pKey, *pList);
1195                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1196                                 }
1197                         }
1198
1199                         {
1200                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_PREVIEW_FORMAT, itemType);
1201                                 if (pList)
1202                                 {
1203                                         String* pKey = null;
1204                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_PREVIEW_FORMAT);
1205                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1206
1207                                         r = __pMap->Add(*pKey, *pList);
1208                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1209                                 }
1210                                 if (pList == null || pList->GetCount() == 0)
1211                                 {
1212                                         String* pKey = null;
1213                                         Integer* pInteger = null;
1214
1215                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_PREVIEW);
1216                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1217
1218                                         pInteger = new (std::nothrow) Integer(false);
1219                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1220
1221                                         r = __pMap->Add(*pKey, *pInteger);
1222                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1223                                 }
1224                                 else
1225                                 {
1226                                         String* pKey = null;
1227                                         Integer* pInteger = null;
1228
1229                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_PREVIEW);
1230                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1231
1232                                         pInteger = new (std::nothrow) Integer(true);
1233                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1234
1235                                         r = __pMap->Add(*pKey, *pInteger);
1236                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1237                                 }
1238                         }
1239
1240                         {
1241                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_PREVIEW_FRAMERATE, itemType);
1242                                 if (pList)
1243                                 {
1244                                         String* pKey = null;
1245                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_PREVIEW_FRAMERATE);
1246                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1247
1248                                         r = __pMap->Add(*pKey, *pList);
1249                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1250                                 }
1251                         }
1252
1253                         {
1254                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_PREVIEW_RESOLUTION, itemType);
1255                                 if (pList)
1256                                 {
1257                                         String* pKey = null;
1258                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_PREVIEW_RESOLUTION);
1259                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1260
1261                                         r = __pMap->Add(*pKey, *pList);
1262                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1263                                 }
1264                         }
1265
1266                         {
1267                                 String* pKey = null;
1268                                 Integer *pInteger = null;
1269
1270                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_FLASH);
1271                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1272
1273                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_FLASH_MODE));
1274                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1275
1276                                 r = __pMap->Add(*pKey, *pInteger);
1277                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1278                         }
1279
1280                         {
1281                                 String* pKey = null;
1282                                 Integer *pInteger = null;
1283
1284                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_FOCUS);
1285                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1286
1287                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_FOCUS_MODE));
1288                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1289
1290                                 r = __pMap->Add(*pKey, *pInteger);
1291                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1292                         }
1293
1294                         {
1295                                 String* pKey = null;
1296                                 Integer* pInteger = null;
1297
1298                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS);
1299                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1300
1301                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_BRIGHTNESS));
1302                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1303
1304                                 r = __pMap->Add(*pKey, *pInteger);
1305                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1306                         }
1307
1308                         {
1309                                 String* pKey = null;
1310                                 Integer* pInteger = null;
1311
1312                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_CONTRAST);
1313                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1314
1315                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_CONTRAST));
1316                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1317
1318                                 r = __pMap->Add(*pKey, *pInteger);
1319                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1320                         }
1321
1322                         {
1323                                 String* pKey = null;
1324                                 Integer* pInteger = null;
1325
1326                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_EXPOSURE);
1327                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1328
1329                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_EXPOSURE));
1330                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1331
1332                                 r = __pMap->Add(*pKey, *pInteger);
1333                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1334                         }
1335 #if 0
1336                         {
1337                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_ZOOM_TYPE, itemType);
1338                                 if (pList)
1339                                 {
1340                                         String* pKey = null;
1341
1342                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_ZOOM_TYPE);
1343                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1344
1345                                         r = __pMap->Add(*pKey, *pList);
1346                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1347                                 }
1348                         }
1349 #endif
1350                         {
1351                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_FOCUS_MODE, itemType);
1352                                 if (pList)
1353                                 {
1354                                         String* pKey = null;
1355
1356                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_FOCUS_MODE);
1357                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1358
1359                                         r = __pMap->Add(*pKey, *pList);
1360                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1361                                 }
1362                         }
1363
1364                         {
1365                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_FLASH_MODE, itemType);
1366                                 if (pList)
1367                                 {
1368                                         String* pKey = null;
1369                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_FLASH_MODE);
1370                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1371
1372                                         r = __pMap->Add(*pKey, *pList);
1373                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1374                                 }
1375                         }
1376
1377                         {
1378                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_METERING_MODE, itemType);
1379                                 if (pList)
1380                                 {
1381                                         String* pKey = null;
1382
1383                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_METERING_MODE);
1384                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1385
1386                                         r = __pMap->Add(*pKey, *pList);
1387                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1388                                 }
1389                         }
1390
1391                         {
1392                                 Object* pObj = _CameraCapability::GetValueN(_COP_PRIMARY_PREVIEW_FORMAT, _QUERY_DEFAULT_VALUE, itemType);
1393                                 if (pObj != null)
1394                                 {
1395                                         String* pKey = null;
1396                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT);
1397                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1398
1399                                         r = __pMap->Add(*pKey, *pObj);
1400                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1401                                 }
1402                         }
1403
1404                         {
1405                                 String* pKey = null;
1406                                 Integer* pInteger = null;
1407
1408                                 pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_ZOOM);
1409                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1410
1411                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_PRIMARY_ZOOM_LEVEL));
1412                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1413
1414                                 r = __pMap->Add(*pKey, *pInteger);
1415                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1416                         }
1417
1418                         {
1419                                 Object* pObj = _CameraCapability::GetValueN(_COP_PRIMARY_ZERO_SHUTTER_LAG, _QUERY_DEFAULT_VALUE, itemType);
1420                                 if (pObj != null)
1421                                 {
1422                                         String* pKey = null;
1423                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_ZERO_SHUTTER_LAG);
1424                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1425
1426                                         r = __pMap->Add(*pKey, *pObj);
1427                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1428                                 }
1429                         }
1430
1431                         {
1432                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_WHITE_BALANCE, itemType);
1433                                 if (pList)
1434                                 {
1435                                         String* pKey = null;
1436                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_WHITE_BALANCE);
1437                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1438
1439                                         r = __pMap->Add(*pKey, *pList);
1440                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1441                                 }
1442                         }
1443
1444                         {
1445                                 bool exist = false;
1446                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_RECORDING_RESOLUTION, itemType);
1447
1448                                 if (pList)
1449                                 {
1450                                         String* pKey = null;
1451                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_RECORDING_RESOLUTION);
1452                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1453
1454                                         r = __pMap->Add(*pKey, *pList);
1455                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1456                                         exist = true;
1457                                 }
1458
1459                                 if (exist)
1460                                 {
1461                                         String* pKey = null;
1462                                         Integer* pInteger = null;
1463
1464                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_RECORDING);
1465                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1466
1467                                         pInteger = new (std::nothrow) Integer(true);
1468                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1469
1470                                         r = __pMap->Add(*pKey, *pInteger);
1471                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1472                                 }
1473                                 else
1474                                 {
1475                                         String* pKey = null;
1476                                         Integer* pInteger = null;
1477
1478                                         pKey = new (std::nothrow) String(CAMERA_PRIMARY_SUPPORT_RECORDING);
1479                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1480
1481                                         pInteger = new (std::nothrow) Integer(false);
1482                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1483
1484                                         r = __pMap->Add(*pKey, *pInteger);
1485                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1486                                 }
1487                         }
1488                 }
1489                         break;
1490
1491                 case _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA:
1492                 {
1493                         // For the performance, prevent the repeat camera object creation and deletion.
1494                         // This session will hold the ref count +1.
1495                         _ResultType itemType = _RESULT_NONE;
1496                         _CameraCapabilitySession cameraSession;
1497                         r = cameraSession.Construct(_CAMERA_DEVICE_SECONDARY);
1498                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1499
1500                         {
1501                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_CAPTURE_FORMAT, itemType);
1502                                 if (pList)
1503                                 {
1504                                         String* pKey = null;
1505                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_CAPTURE_FORMAT);
1506                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1507
1508                                         r = __pMap->Add(*pKey, *pList);
1509                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1510                                 }
1511                                 if (pList == null || pList->GetCount() == 0)
1512                                 {
1513                                         String* pKey = null;
1514                                         Integer* pInteger = null;
1515
1516                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_CAPTURE);
1517                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1518
1519                                         pInteger = new (std::nothrow) Integer(false);
1520                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1521
1522                                         r = __pMap->Add(*pKey, *pInteger);
1523                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1524                                 }
1525                                 else
1526                                 {
1527                                         String* pKey = null;
1528                                         Integer* pInteger = null;
1529
1530                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_CAPTURE);
1531                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1532
1533                                         pInteger = new (std::nothrow) Integer(true);
1534                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1535
1536                                         r = __pMap->Add(*pKey, *pInteger);
1537                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1538                                 }
1539                         }
1540
1541                         {
1542                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_CAPTURE_RESOLUTION, itemType);
1543                                 if (pList)
1544                                 {
1545                                         String* pKey = null;
1546                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_CAPTURE_RESOLUTION);
1547                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1548
1549                                         r = __pMap->Add(*pKey, *pList);
1550                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1551                                 }
1552                         }
1553
1554                         {
1555                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_EFFECT, itemType);
1556                                 if (pList)
1557                                 {
1558                                         String* pKey = null;
1559                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_EFFECT);
1560                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1561
1562                                         r = __pMap->Add(*pKey, *pList);
1563                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1564                                 }
1565                         }
1566
1567                         {
1568                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_ISO_LEVEL, itemType);
1569                                 if (pList)
1570                                 {
1571                                         String* pKey = null;
1572                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_ISO_LEVEL);
1573                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1574
1575                                         r = __pMap->Add(*pKey, *pList);
1576                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1577                                 }
1578                         }
1579
1580                         {
1581                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_PREVIEW_FORMAT, itemType);
1582                                 if (pList)
1583                                 {
1584                                         String* pKey = null;
1585                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_PREVIEW_FORMAT);
1586                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1587
1588                                         r = __pMap->Add(*pKey, *pList);
1589                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1590                                 }
1591                                 if (pList == null || pList->GetCount() == 0)
1592                                 {
1593                                         String* pKey = null;
1594                                         Integer* pInteger = null;
1595
1596                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_PREVIEW);
1597                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1598
1599                                         pInteger = new (std::nothrow) Integer(false);
1600                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1601
1602                                         r = __pMap->Add(*pKey, *pInteger);
1603                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1604                                 }
1605                                 else
1606                                 {
1607                                         String* pKey = null;
1608                                         Integer* pInteger = null;
1609
1610                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_PREVIEW);
1611                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1612
1613                                         pInteger = new (std::nothrow) Integer(true);
1614                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1615
1616                                         r = __pMap->Add(*pKey, *pInteger);
1617                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1618                                 }
1619                         }
1620
1621                         {
1622                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_PREVIEW_FRAMERATE, itemType);
1623                                 if (pList)
1624                                 {
1625                                         String* pKey = null;
1626                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_PREVIEW_FRAMERATE);
1627                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1628
1629                                         r = __pMap->Add(*pKey, *pList);
1630                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1631                                 }
1632                         }
1633
1634                         {
1635                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_PREVIEW_RESOLUTION, itemType);
1636                                 if (pList)
1637                                 {
1638                                         String* pKey = null;
1639                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_PREVIEW_RESOLUTION);
1640                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1641
1642                                         r = __pMap->Add(*pKey, *pList);
1643                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1644                                 }
1645                         }
1646
1647                         {
1648                                 String* pKey = null;
1649                                 Integer *pInteger = null;
1650
1651                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_FLASH);
1652                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1653
1654                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_FLASH_MODE));
1655                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1656
1657                                 r = __pMap->Add(*pKey, *pInteger);
1658                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1659                         }
1660
1661                         {
1662                                 String* pKey = null;
1663                                 Integer *pInteger = null;
1664
1665                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_FOCUS);
1666                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1667
1668                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_FOCUS_MODE));
1669                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1670
1671                                 r = __pMap->Add(*pKey, *pInteger);
1672                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1673                         }
1674
1675                         {
1676                                 String* pKey = null;
1677                                 Integer* pInteger = null;
1678
1679                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS);
1680                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1681
1682                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_BRIGHTNESS));
1683                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1684
1685                                 r = __pMap->Add(*pKey, *pInteger);
1686                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1687                         }
1688
1689                         {
1690                                 String* pKey = null;
1691                                 Integer* pInteger = null;
1692
1693                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_CONTRAST);
1694                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1695
1696                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_CONTRAST));
1697                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1698
1699                                 r = __pMap->Add(*pKey, *pInteger);
1700                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1701                         }
1702
1703                         {
1704                                 String* pKey = null;
1705                                 Integer* pInteger = null;
1706
1707                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_EXPOSURE);
1708                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1709
1710                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_EXPOSURE));
1711                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1712
1713                                 r = __pMap->Add(*pKey, *pInteger);
1714                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1715                         }
1716
1717                         {
1718                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_FOCUS_MODE, itemType);
1719                                 if (pList)
1720                                 {
1721                                         String* pKey = null;
1722
1723                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_FOCUS_MODE);
1724                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1725
1726                                         r = __pMap->Add(*pKey, *pList);
1727                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1728                                 }
1729                         }
1730
1731                         {
1732                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_FLASH_MODE, itemType);
1733                                 if (pList)
1734                                 {
1735                                         String* pKey = null;
1736                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_FLASH_MODE);
1737                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1738
1739                                         r = __pMap->Add(*pKey, *pList);
1740                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1741                                 }
1742                         }
1743
1744                         {
1745                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_METERING_MODE, itemType);
1746                                 if (pList)
1747                                 {
1748                                         String* pKey = null;
1749
1750                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_METERING_MODE);
1751                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1752
1753                                         r = __pMap->Add(*pKey, *pList);
1754                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1755                                 }
1756                         }
1757
1758                         {
1759                                 Object* pObj = _CameraCapability::GetValueN(_COP_SECONDARY_PREVIEW_FORMAT, _QUERY_DEFAULT_VALUE, itemType);
1760                                 if (pObj != null)
1761                                 {
1762                                         String* pKey = null;
1763                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT);
1764                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1765
1766                                         r = __pMap->Add(*pKey, *pObj);
1767                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1768                                 }
1769                         }
1770
1771                         {
1772                                 String* pKey = null;
1773                                 Integer* pInteger = null;
1774
1775                                 pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_ZOOM);
1776                                 SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1777
1778                                 pInteger = new (std::nothrow) Integer(_CameraCapability::IsSupported(_COP_SECONDARY_ZOOM_LEVEL));
1779                                 SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1780
1781                                 r = __pMap->Add(*pKey, *pInteger);
1782                                 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1783                         }
1784
1785                         {
1786                                 Object* pObj = _CameraCapability::GetValueN(_COP_SECONDARY_ZERO_SHUTTER_LAG, _QUERY_DEFAULT_VALUE, itemType);
1787                                 if (pObj != null)
1788                                 {
1789                                         String* pKey = null;
1790                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_ZERO_SHUTTER_LAG);
1791                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
1792
1793                                         r = __pMap->Add(*pKey, *pObj);
1794                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1795                                 }
1796                         }
1797
1798                         {
1799                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_WHITE_BALANCE, itemType);
1800                                 if (pList)
1801                                 {
1802                                         String* pKey = null;
1803                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_WHITE_BALANCE);
1804                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1805
1806                                         r = __pMap->Add(*pKey, *pList);
1807                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1808                                 }
1809                         }
1810
1811                         {
1812                                 bool exist = false;
1813                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_RECORDING_RESOLUTION, itemType);
1814
1815                                 if (pList)
1816                                 {
1817                                         String* pKey = null;
1818                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_RECORDING_RESOLUTION);
1819                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1820
1821                                         r = __pMap->Add(*pKey, *pList);
1822                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1823                                         exist = true;
1824                                 }
1825
1826                                 if (exist)
1827                                 {
1828                                         String* pKey = null;
1829                                         Integer* pInteger = null;
1830
1831                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_RECORDING);
1832                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1833
1834                                         pInteger = new (std::nothrow) Integer(true);
1835                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1836
1837                                         r = __pMap->Add(*pKey, *pInteger);
1838                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1839                                 }
1840                                 else
1841                                 {
1842                                         String* pKey = null;
1843                                         Integer* pInteger = null;
1844
1845                                         pKey = new (std::nothrow) String(CAMERA_SECONDARY_SUPPORT_RECORDING);
1846                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1847
1848                                         pInteger = new (std::nothrow) Integer(false);
1849                                         SysTryCatch(NID_MEDIA, pInteger !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The value is not created.");
1850
1851                                         r = __pMap->Add(*pKey, *pInteger);
1852                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1853                                 }
1854                         }
1855                 }
1856                         break;
1857
1858                 case _MEDIA_CAP_CATEGORY_VIDEO_RECORDER:
1859                 {
1860                         _ResultType itemType = _RESULT_NONE;
1861                         {
1862                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _RecorderCapability::GetListN(_VROP_FILE_FORMAT, itemType);
1863
1864                                 if (pList)
1865                                 {
1866                                         String* pKey = null;
1867
1868                                         pKey = new (std::nothrow) String(VIDEORECORDER_MEDIA_CONTAINER_TYPE);
1869                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1870
1871                                         r = __pMap->Add(*pKey, *pList);
1872                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1873                                 }
1874                         }
1875
1876                         {
1877                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _RecorderCapability::GetListN(_VROP_VIDEO_ENCODER, itemType);
1878
1879                                 if (pList)
1880                                 {
1881                                         String* pKey = null;
1882
1883                                         pKey = new (std::nothrow) String(VIDEORECORDER_VIDEO_CODEC_TYPE);
1884                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1885
1886                                         r = __pMap->Add(*pKey, *pList);
1887                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1888                                 }
1889                         }
1890
1891                         {
1892                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _RecorderCapability::GetListN(_VROP_AUDIO_ENCODER, itemType);
1893
1894                                 if (pList)
1895                                 {
1896                                         String* pKey = null;
1897
1898                                         pKey = new (std::nothrow) String(VIDEORECORDER_AUDIO_CODEC_TYPE);
1899                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1900
1901                                         r = __pMap->Add(*pKey, *pList);
1902                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1903                                 }
1904                         }
1905                 }
1906                         break;
1907
1908                 case _MEDIA_CAP_CATEGORY_AUDIO_RECORDER:
1909                 {
1910                         _ResultType itemType = _RESULT_NONE;
1911                         _RecorderSession recorderSession;
1912                         r = recorderSession.Construct(_RECORDER_SOURCE_AUDIO);
1913                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1914
1915                         {
1916                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _RecorderCapability::GetListN(_AROP_FILE_FORMAT, itemType);
1917
1918                                 if (pList)
1919                                 {
1920                                         String* pKey = null;
1921
1922                                         pKey = new (std::nothrow) String(AUDIORECORDER_MEDIA_CONTAINER_TYPE);
1923                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1924
1925                                         r = __pMap->Add(*pKey, *pList);
1926                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1927                                 }
1928                         }
1929
1930                         {
1931                                 _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _RecorderCapability::GetListN(_AROP_AUDIO_ENCODER, itemType);
1932
1933                                 if (pList)
1934                                 {
1935                                         String* pKey = null;
1936
1937                                         pKey = new (std::nothrow) String(AUDIORECORDER_CODEC_TYPE);
1938                                         SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The key is not created.");
1939
1940                                         r = __pMap->Add(*pKey, *pList);
1941                                         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1942                                 }
1943                         }
1944                 }
1945                         break;
1946
1947                 case _MEDIA_CAP_CATEGORY_CODEC:
1948                         break;
1949
1950                 default:
1951                         break;
1952         }
1953
1954         return r;
1955 CATCH:
1956         return r;
1957 }
1958
1959 }}// Tizen::Media
1960