Set missed condition variable for TV product
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_platform.c
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 /*===========================================================================================
23 |                                                                                                                                                                                       |
24 |  INCLUDE FILES                                                                                                                                                        |
25 |                                                                                                                                                                                       |
26 ========================================================================================== */
27 #include "mm_camcorder_internal.h"
28 #include "mm_camcorder_platform.h"
29 #include "mm_camcorder_configure.h"
30 #include "mm_camcorder_capability.h"
31
32 /*---------------------------------------------------------------------------
33 |    GLOBAL VARIABLE DEFINITIONS for internal                                                           |
34 ---------------------------------------------------------------------------*/
35
36 /*---------------------------------------------------------------------------
37 |    LOCAL VARIABLE DEFINITIONS for internal                                                            |
38 ---------------------------------------------------------------------------*/
39
40 /*
41  * Rule 1. 1:1 match except NONE.
42  * Rule 2. MSL should be Superset.
43  * Rule 3. sensor value should not be same as _MMCAMCORDER_SENSOR_ENUM_NONE.
44 */
45
46 static int __enum_conv_whitebalance[MM_CAMCORDER_WHITE_BALANCE_NUM] ;
47
48 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_whitebalance = {
49         MM_CAMCORDER_WHITE_BALANCE_NUM,
50         __enum_conv_whitebalance,
51         CONFIGURE_CATEGORY_CTRL_EFFECT,
52         "WhiteBalance"
53 };
54
55
56 static int __enum_conv_colortone[MM_CAMCORDER_COLOR_TONE_NUM];
57
58 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_colortone = {
59         MM_CAMCORDER_COLOR_TONE_NUM,
60         __enum_conv_colortone,
61         CONFIGURE_CATEGORY_CTRL_EFFECT,
62         "ColorTone"
63 };
64
65
66 static int __enum_conv_iso[MM_CAMCORDER_ISO_NUM];
67
68 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_iso = {
69         MM_CAMCORDER_ISO_NUM,
70         __enum_conv_iso,
71         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
72         "ISO"
73 };
74
75
76 static int __enum_conv_prgrm[MM_CAMCORDER_SCENE_MODE_NUM];
77
78 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_prgrm = {
79         MM_CAMCORDER_SCENE_MODE_NUM,
80         __enum_conv_prgrm,
81         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
82         "ProgramMode"
83 };
84
85
86 static int __enum_conv_focus_mode[MM_CAMCORDER_FOCUS_MODE_NUM];
87
88 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_focus_mode = {
89         MM_CAMCORDER_FOCUS_MODE_NUM,
90         __enum_conv_focus_mode,
91         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
92         "FocusMode"
93 };
94
95
96 static int __enum_conv_focus_type[MM_CAMCORDER_AUTO_FOCUS_NUM];
97
98 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_focus_type = {
99         MM_CAMCORDER_AUTO_FOCUS_NUM,
100         __enum_conv_focus_type,
101         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
102         "AFType"
103 };
104
105
106 static int __enum_conv_ae_type[MM_CAMCORDER_AUTO_EXPOSURE_NUM];
107
108 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_ae_type = {
109         MM_CAMCORDER_AUTO_EXPOSURE_NUM,
110         __enum_conv_ae_type,
111         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
112         "AEType"
113 };
114
115
116 static int __enum_conv_strobe_ctrl[MM_CAMCORDER_STROBE_CONTROL_NUM];
117
118 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_strobe_ctrl = {
119         MM_CAMCORDER_STROBE_CONTROL_NUM,
120         __enum_conv_strobe_ctrl,
121         CONFIGURE_CATEGORY_CTRL_STROBE,
122         "StrobeControl"
123 };
124
125
126 static int __enum_conv_strobe_mode[MM_CAMCORDER_STROBE_MODE_NUM];
127
128 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_strobe_mode = {
129         MM_CAMCORDER_STROBE_MODE_NUM,
130         __enum_conv_strobe_mode,
131         CONFIGURE_CATEGORY_CTRL_STROBE,
132         "StrobeMode"
133 };
134
135
136 static int __enum_conv_wdr_ctrl[MM_CAMCORDER_WDR_NUM];
137
138 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_wdr_ctrl = {
139         MM_CAMCORDER_WDR_NUM,
140         __enum_conv_wdr_ctrl,
141         CONFIGURE_CATEGORY_CTRL_EFFECT,
142         "WDR"
143 };
144
145 static int __enum_conv_flip_ctrl[MM_CAMCORDER_FLIP_NUM];
146
147 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_flip_ctrl = {
148         MM_CAMCORDER_FLIP_NUM,
149         __enum_conv_flip_ctrl,
150         CONFIGURE_CATEGORY_CTRL_EFFECT,
151         "Flip"
152 };
153
154 static int __enum_conv_rotation_ctrl[MM_CAMCORDER_ROTATION_NUM];
155
156 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_rotation_ctrl = {
157         MM_CAMCORDER_ROTATION_NUM,
158         __enum_conv_rotation_ctrl,
159         CONFIGURE_CATEGORY_CTRL_EFFECT,
160         "Rotation"
161 };
162
163
164 static int __enum_conv_ahs[MM_CAMCORDER_AHS_NUM];
165
166 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_ahs = {
167         MM_CAMCORDER_AHS_NUM,
168         __enum_conv_ahs,
169         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
170         "AntiHandshake"
171 };
172
173
174 static int __enum_conv_video_stabilization[MM_CAMCORDER_VIDEO_STABILIZATION_NUM];
175
176 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_video_stabilization = {
177         MM_CAMCORDER_VIDEO_STABILIZATION_NUM,
178         __enum_conv_video_stabilization,
179         CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
180         "VideoStabilization"
181 };
182
183
184 static int __enum_conv_hdr_capture[MM_CAMCORDER_HDR_CAPTURE_NUM];
185
186 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_hdr_capture = {
187         MM_CAMCORDER_HDR_CAPTURE_NUM,
188         __enum_conv_hdr_capture,
189         CONFIGURE_CATEGORY_CTRL_CAPTURE,
190         "SupportHDR"
191 };
192
193 static int __enum_conv_detect_mode[MM_CAMCORDER_DETECT_MODE_NUM];
194
195 static _MMCamcorderEnumConvert _mmcamcorder_enum_conv_detect_mode = {
196         MM_CAMCORDER_DETECT_MODE_NUM,
197         __enum_conv_detect_mode,
198         CONFIGURE_CATEGORY_CTRL_DETECT,
199         "DetectMode"
200 };
201
202
203 /**
204  * Matching table of caminfo index with category enum of attribute.
205  * If predefined item is changed, this static variables should be changed.
206  * For detail information, refer below documents.
207  *
208  */
209 static _MMCamcorderInfoConverting       g_audio_info[] = {
210         {
211                 CONFIGURE_TYPE_MAIN,
212                 CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
213                 MM_CAM_AUDIO_DEVICE,
214                 MM_CAMCORDER_ATTR_NONE,
215                 "AudioDevice",
216                 MM_CAMCONVERT_TYPE_INT_ARRAY,
217                 NULL,
218         }
219 };
220
221 static _MMCamcorderInfoConverting       g_display_info[] = {
222         {
223                 CONFIGURE_TYPE_MAIN,
224                 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
225                 MM_CAM_DISPLAY_DEVICE,
226                 MM_CAMCORDER_ATTR_NONE,
227                 "DisplayDevice",
228                 MM_CAMCONVERT_TYPE_INT_ARRAY,
229                 NULL,
230         },
231         {
232                 CONFIGURE_TYPE_MAIN,
233                 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
234                 MM_CAM_DISPLAY_MODE,
235                 MM_CAMCORDER_ATTR_NONE,
236                 "DisplayMode",
237                 MM_CAMCONVERT_TYPE_INT_ARRAY,
238                 NULL,
239         },
240         {
241                 CONFIGURE_TYPE_MAIN,
242                 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
243                 MM_CAM_DISPLAY_SURFACE,
244                 MM_CAMCORDER_ATTR_NONE,
245                 "Videosink",
246                 MM_CAMCONVERT_TYPE_INT_ARRAY,
247                 NULL,
248         },
249 };
250
251 static _MMCamcorderInfoConverting       g_caminfo_convert[CAMINFO_CONVERT_NUM] = {
252         {
253                 CONFIGURE_TYPE_CTRL,
254                 CONFIGURE_CATEGORY_CTRL_CAMERA,
255                 MM_CAM_CAMERA_DEVICE_NAME,
256                 MM_CAMCORDER_ATTR_NONE,
257                 "DeviceName",
258                 MM_CAMCONVERT_TYPE_STRING,
259                 NULL,
260         },
261         {
262                 CONFIGURE_TYPE_CTRL,
263                 CONFIGURE_CATEGORY_CTRL_CAMERA,
264                 MM_CAM_CAMERA_WIDTH,
265                 MM_CAM_CAMERA_HEIGHT,
266                 "PreviewResolution",
267                 MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
268                 NULL,
269         },
270         {
271                 CONFIGURE_TYPE_CTRL,
272                 CONFIGURE_CATEGORY_CTRL_CAMERA,
273                 MM_CAM_CAPTURE_WIDTH,
274                 MM_CAM_CAPTURE_HEIGHT,
275                 "CaptureResolution",
276                 MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
277                 NULL,
278         },
279         {
280                 CONFIGURE_TYPE_CTRL,
281                 CONFIGURE_CATEGORY_CTRL_CAMERA,
282                 MM_CAM_CAMERA_FORMAT,
283                 MM_CAMCORDER_ATTR_NONE,
284                 "PictureFormat",
285                 MM_CAMCONVERT_TYPE_INT_ARRAY,
286                 NULL,
287         },
288         {
289                 CONFIGURE_TYPE_CTRL,
290                 CONFIGURE_CATEGORY_CTRL_STROBE,
291                 MM_CAM_STROBE_CONTROL,
292                 MM_CAMCORDER_ATTR_NONE,
293                 "StrobeControl",
294                 MM_CAMCONVERT_TYPE_INT_ARRAY,
295                 &_mmcamcorder_enum_conv_strobe_ctrl,
296         },
297         {
298                 CONFIGURE_TYPE_CTRL,
299                 CONFIGURE_CATEGORY_CTRL_STROBE,
300                 MM_CAM_STROBE_CAPABILITIES,
301                 MM_CAMCORDER_ATTR_NONE,
302                 "StrobeCapabilities",
303                 MM_CAMCONVERT_TYPE_INT_ARRAY,
304                 NULL,
305         },
306         {
307                 CONFIGURE_TYPE_CTRL,
308                 CONFIGURE_CATEGORY_CTRL_STROBE,
309                 MM_CAM_STROBE_MODE,
310                 MM_CAMCORDER_ATTR_NONE,
311                 "StrobeMode",
312                 MM_CAMCONVERT_TYPE_INT_ARRAY,
313                 &_mmcamcorder_enum_conv_strobe_mode,
314         },
315         {
316                 CONFIGURE_TYPE_CTRL,
317                 CONFIGURE_CATEGORY_CTRL_EFFECT,
318                 MM_CAM_FILTER_BRIGHTNESS,
319                 MM_CAMCORDER_ATTR_NONE,
320                 "Brightness",
321                 MM_CAMCONVERT_TYPE_INT_RANGE,
322                 NULL,
323         },
324         {
325                 CONFIGURE_TYPE_CTRL,
326                 CONFIGURE_CATEGORY_CTRL_EFFECT,
327                 MM_CAM_FILTER_CONTRAST,
328                 MM_CAMCORDER_ATTR_NONE,
329                 "Contrast",
330                 MM_CAMCONVERT_TYPE_INT_RANGE,
331                 NULL,
332         },
333         {/* 10 */
334                 CONFIGURE_TYPE_CTRL,
335                 CONFIGURE_CATEGORY_CTRL_EFFECT,
336                 MM_CAM_FILTER_SATURATION,
337                 MM_CAMCORDER_ATTR_NONE,
338                 "Saturation",
339                 MM_CAMCONVERT_TYPE_INT_RANGE,
340                 NULL,
341         },
342         {
343                 CONFIGURE_TYPE_CTRL,
344                 CONFIGURE_CATEGORY_CTRL_EFFECT,
345                 MM_CAM_FILTER_HUE,
346                 MM_CAMCORDER_ATTR_NONE,
347                 "Hue",
348                 MM_CAMCONVERT_TYPE_INT_RANGE,
349                 NULL,
350         },
351         {
352                 CONFIGURE_TYPE_CTRL,
353                 CONFIGURE_CATEGORY_CTRL_EFFECT,
354                 MM_CAM_FILTER_SHARPNESS,
355                 MM_CAMCORDER_ATTR_NONE,
356                 "Sharpness",
357                 MM_CAMCONVERT_TYPE_INT_RANGE,
358                 NULL,
359         },
360         {
361                 CONFIGURE_TYPE_CTRL,
362                 CONFIGURE_CATEGORY_CTRL_EFFECT,
363                 MM_CAM_FILTER_WB,
364                 MM_CAMCORDER_ATTR_NONE,
365                 "WhiteBalance",
366                 MM_CAMCONVERT_TYPE_INT_ARRAY,
367                 &_mmcamcorder_enum_conv_whitebalance,
368         },
369         {
370                 CONFIGURE_TYPE_CTRL,
371                 CONFIGURE_CATEGORY_CTRL_EFFECT,
372                 MM_CAM_FILTER_COLOR_TONE,
373                 MM_CAMCORDER_ATTR_NONE,
374                 "ColorTone",
375                 MM_CAMCONVERT_TYPE_INT_ARRAY,
376                 &_mmcamcorder_enum_conv_colortone,
377         },
378         {
379                 CONFIGURE_TYPE_CTRL,
380                 CONFIGURE_CATEGORY_CTRL_EFFECT,
381                 MM_CAM_CAMERA_WDR,
382                 MM_CAMCORDER_ATTR_NONE,
383                 "WDR",
384                 MM_CAMCONVERT_TYPE_INT_ARRAY,
385                 &_mmcamcorder_enum_conv_wdr_ctrl,
386         },
387         {
388                 CONFIGURE_TYPE_CTRL,
389                 CONFIGURE_CATEGORY_CTRL_EFFECT,
390                 MM_CAM_CAMERA_FLIP,
391                 MM_CAMCORDER_ATTR_NONE,
392                 "Flip",
393                 MM_CAMCONVERT_TYPE_INT_ARRAY,
394                 &_mmcamcorder_enum_conv_flip_ctrl,
395         },
396         {
397                 CONFIGURE_TYPE_CTRL,
398                 CONFIGURE_CATEGORY_CTRL_EFFECT,
399                 MM_CAM_CAMERA_ROTATION,
400                 MM_CAMCORDER_ATTR_NONE,
401                 "Rotation",
402                 MM_CAMCONVERT_TYPE_INT_ARRAY,
403                 &_mmcamcorder_enum_conv_rotation_ctrl,
404         },
405         {
406                 CONFIGURE_TYPE_CTRL,
407                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
408                 MM_CAM_CAMERA_DIGITAL_ZOOM,
409                 MM_CAMCORDER_ATTR_NONE,
410                 "DigitalZoom",
411                 MM_CAMCONVERT_TYPE_INT_RANGE,
412                 NULL,
413         },
414         {
415                 CONFIGURE_TYPE_CTRL,
416                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
417                 MM_CAM_CAMERA_OPTICAL_ZOOM,
418                 MM_CAMCORDER_ATTR_NONE,
419                 "OpticalZoom",
420                 MM_CAMCONVERT_TYPE_INT_RANGE,
421                 NULL,
422         },
423         {/* 20 */
424                 CONFIGURE_TYPE_CTRL,
425                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
426                 MM_CAM_CAMERA_FOCUS_MODE,
427                 MM_CAMCORDER_ATTR_NONE,
428                 "FocusMode",
429                 MM_CAMCONVERT_TYPE_INT_ARRAY,
430                 &_mmcamcorder_enum_conv_focus_mode,
431         },
432         {
433                 CONFIGURE_TYPE_CTRL,
434                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
435                 MM_CAM_CAMERA_AF_SCAN_RANGE,
436                 MM_CAMCORDER_ATTR_NONE,
437                 "AFType",
438                 MM_CAMCONVERT_TYPE_INT_ARRAY,
439                 &_mmcamcorder_enum_conv_focus_type,
440         },
441         {
442                 CONFIGURE_TYPE_CTRL,
443                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
444                 MM_CAM_CAMERA_EXPOSURE_MODE,
445                 MM_CAMCORDER_ATTR_NONE,
446                 "AEType",
447                 MM_CAMCONVERT_TYPE_INT_ARRAY,
448                 &_mmcamcorder_enum_conv_ae_type,
449         },
450         {
451                 CONFIGURE_TYPE_CTRL,
452                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
453                 MM_CAM_CAMERA_EXPOSURE_VALUE,
454                 MM_CAMCORDER_ATTR_NONE,
455                 "ExposureValue",
456                 MM_CAMCONVERT_TYPE_INT_RANGE,
457                 NULL,
458         },
459         {
460                 CONFIGURE_TYPE_CTRL,
461                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
462                 MM_CAM_CAMERA_F_NUMBER,
463                 MM_CAMCORDER_ATTR_NONE,
464                 "FNumber",
465                 MM_CAMCONVERT_TYPE_INT_ARRAY,
466                 NULL,
467         },
468         {
469                 CONFIGURE_TYPE_CTRL,
470                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
471                 MM_CAM_CAMERA_SHUTTER_SPEED,
472                 MM_CAMCORDER_ATTR_NONE,
473                 "ShutterSpeed",
474                 MM_CAMCONVERT_TYPE_INT_ARRAY,
475                 NULL,
476         },
477         {
478                 CONFIGURE_TYPE_CTRL,
479                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
480                 MM_CAM_CAMERA_ISO,
481                 MM_CAMCORDER_ATTR_NONE,
482                 "ISO",
483                 MM_CAMCONVERT_TYPE_INT_ARRAY,
484                 &_mmcamcorder_enum_conv_iso,
485         },
486         {
487                 CONFIGURE_TYPE_CTRL,
488                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
489                 MM_CAM_FILTER_SCENE_MODE,
490                 MM_CAMCORDER_ATTR_NONE,
491                 "ProgramMode",
492                 MM_CAMCONVERT_TYPE_INT_ARRAY,
493                 &_mmcamcorder_enum_conv_prgrm,
494         },
495         {
496                 CONFIGURE_TYPE_CTRL,
497                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
498                 MM_CAM_CAMERA_ANTI_HANDSHAKE,
499                 MM_CAMCORDER_ATTR_NONE,
500                 "AntiHandshake",
501                 MM_CAMCONVERT_TYPE_INT_ARRAY,
502                 &_mmcamcorder_enum_conv_ahs,
503         },
504         {
505                 CONFIGURE_TYPE_CTRL,
506                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
507                 MM_CAM_CAMERA_PAN_MECHA,
508                 MM_CAMCORDER_ATTR_NONE,
509                 "PanMecha",
510                 MM_CAMCONVERT_TYPE_INT_RANGE,
511                 NULL,
512         },
513         {/* 30 */
514                 CONFIGURE_TYPE_CTRL,
515                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
516                 MM_CAM_CAMERA_PAN_ELEC,
517                 MM_CAMCORDER_ATTR_NONE,
518                 "PanElec",
519                 MM_CAMCONVERT_TYPE_INT_RANGE,
520                 NULL,
521         },
522         {
523                 CONFIGURE_TYPE_CTRL,
524                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
525                 MM_CAM_CAMERA_TILT_MECHA,
526                 MM_CAMCORDER_ATTR_NONE,
527                 "TiltMecha",
528                 MM_CAMCONVERT_TYPE_INT_RANGE,
529                 NULL,
530         },
531         {
532                 CONFIGURE_TYPE_CTRL,
533                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
534                 MM_CAM_CAMERA_TILT_ELEC,
535                 MM_CAMCORDER_ATTR_NONE,
536                 "TiltElec",
537                 MM_CAMCONVERT_TYPE_INT_RANGE,
538                 NULL,
539         },
540         {
541                 CONFIGURE_TYPE_CTRL,
542                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
543                 MM_CAM_CAMERA_PTZ_TYPE,
544                 MM_CAMCORDER_ATTR_NONE,
545                 "PtzType",
546                 MM_CAMCONVERT_TYPE_INT_ARRAY,
547                 NULL,
548         },
549         {
550                 CONFIGURE_TYPE_CTRL,
551                 CONFIGURE_CATEGORY_CTRL_CAPTURE,
552                 MM_CAM_CAPTURE_FORMAT,
553                 MM_CAMCORDER_ATTR_NONE,
554                 "OutputMode",
555                 MM_CAMCONVERT_TYPE_INT_ARRAY,
556                 NULL,
557         },
558         {
559                 CONFIGURE_TYPE_CTRL,
560                 CONFIGURE_CATEGORY_CTRL_CAPTURE,
561                 MM_CAM_IMAGE_ENCODER_QUALITY,
562                 MM_CAMCORDER_ATTR_NONE,
563                 "JpegQuality",
564                 MM_CAMCONVERT_TYPE_INT_RANGE,
565                 NULL,
566         },
567         {
568                 CONFIGURE_TYPE_CTRL,
569                 CONFIGURE_CATEGORY_CTRL_CAPTURE,
570                 MM_CAM_CAPTURE_COUNT,
571                 MM_CAMCORDER_ATTR_NONE,
572                 "MultishotNumber",
573                 MM_CAMCONVERT_TYPE_INT_RANGE,
574                 NULL,
575         },
576         {
577                 CONFIGURE_TYPE_CTRL,
578                 CONFIGURE_CATEGORY_CTRL_CAPTURE,
579                 MM_CAM_CAMERA_HDR_CAPTURE,
580                 MM_CAMCORDER_ATTR_NONE,
581                 "SupportHDR",
582                 MM_CAMCONVERT_TYPE_INT_ARRAY,
583                 &_mmcamcorder_enum_conv_hdr_capture,
584         },
585         {
586                 CONFIGURE_TYPE_CTRL,
587                 CONFIGURE_CATEGORY_CTRL_DETECT,
588                 MM_CAM_DETECT_MODE,
589                 MM_CAMCORDER_ATTR_NONE,
590                 "DetectMode",
591                 MM_CAMCONVERT_TYPE_INT_ARRAY,
592                 &_mmcamcorder_enum_conv_detect_mode,
593         },
594         {
595                 CONFIGURE_TYPE_CTRL,
596                 CONFIGURE_CATEGORY_CTRL_DETECT,
597                 MM_CAM_DETECT_NUMBER,
598                 MM_CAMCORDER_ATTR_NONE,
599                 "DetectNumber",
600                 MM_CAMCONVERT_TYPE_INT_RANGE,
601                 NULL,
602         },
603         {/* 40 */
604                 CONFIGURE_TYPE_CTRL,
605                 CONFIGURE_CATEGORY_CTRL_DETECT,
606                 MM_CAM_DETECT_FOCUS_SELECT,
607                 MM_CAMCORDER_ATTR_NONE,
608                 "DetectFocusSelect",
609                 MM_CAMCONVERT_TYPE_INT_RANGE,
610                 NULL,
611         },
612         {
613                 CONFIGURE_TYPE_CTRL,
614                 CONFIGURE_CATEGORY_CTRL_DETECT,
615                 MM_CAM_DETECT_SELECT_NUMBER,
616                 MM_CAMCORDER_ATTR_NONE,
617                 "DetectSelectNumber",
618                 MM_CAMCONVERT_TYPE_INT_RANGE,
619                 NULL,
620         },
621         {
622                 CONFIGURE_TYPE_CTRL,
623                 CONFIGURE_CATEGORY_CTRL_DETECT,
624                 MM_CAM_DETECT_STATUS,
625                 MM_CAMCORDER_ATTR_NONE,
626                 "DetectStatus",
627                 MM_CAMCONVERT_TYPE_INT_ARRAY,
628                 NULL,
629         },
630         {
631                 CONFIGURE_TYPE_CTRL,
632                 CONFIGURE_CATEGORY_CTRL_CAMERA,
633                 MM_CAM_RECOMMEND_CAMERA_WIDTH,
634                 MM_CAM_RECOMMEND_CAMERA_HEIGHT,
635                 "RecommendPreviewResolution",
636                 MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
637                 NULL,
638         },
639         {
640                 CONFIGURE_TYPE_CTRL,
641                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
642                 MM_CAM_CAMERA_VIDEO_STABILIZATION,
643                 MM_CAMCORDER_ATTR_NONE,
644                 "VideoStabilization",
645                 MM_CAMCONVERT_TYPE_INT_ARRAY,
646                 &_mmcamcorder_enum_conv_video_stabilization,
647         },
648         {
649                 CONFIGURE_TYPE_CTRL,
650                 CONFIGURE_CATEGORY_CTRL_CAMERA,
651                 MM_CAM_VIDEO_WIDTH,
652                 MM_CAM_VIDEO_HEIGHT,
653                 "VideoResolution",
654                 MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
655                 NULL,
656         },
657         {
658                 CONFIGURE_TYPE_CTRL,
659                 CONFIGURE_CATEGORY_CTRL_STROBE,
660                 MM_CAM_STROBE_BRIGHTNESS,
661                 MM_CAMCORDER_ATTR_NONE,
662                 "StrobeBrightness",
663                 MM_CAMCONVERT_TYPE_INT_RANGE,
664                 NULL,
665         },
666         {
667                 CONFIGURE_TYPE_CTRL,
668                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
669                 MM_CAM_CAMERA_FOCUS_LEVEL,
670                 MM_CAMCORDER_ATTR_NONE,
671                 "FocusLevel",
672                 MM_CAMCONVERT_TYPE_INT_RANGE,
673                 NULL,
674         },
675         {
676                 CONFIGURE_TYPE_CTRL,
677                 CONFIGURE_CATEGORY_CTRL_EFFECT,
678                 MM_CAM_FILTER_WB_TEMPERATURE,
679                 MM_CAMCORDER_ATTR_NONE,
680                 "WhiteBalanceTemperature",
681                 MM_CAMCONVERT_TYPE_INT_RANGE,
682                 NULL,
683         },
684         {
685                 CONFIGURE_TYPE_CTRL,
686                 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
687                 MM_CAM_CAMERA_GAIN,
688                 MM_CAMCORDER_ATTR_NONE,
689                 "Gain",
690                 MM_CAMCONVERT_TYPE_INT_RANGE,
691                 NULL,
692         }
693 };
694
695 /*---------------------------------------------------------------------------
696 |    LOCAL FUNCTION PROTOTYPES:                                                                                         |
697 ---------------------------------------------------------------------------*/
698 /* STATIC INTERNAL FUNCTION */
699 static int  __mmcamcorder_get_valid_array(int *original_array, int original_count, int **valid_array, int *valid_default);
700
701 /*===========================================================================================
702 |                                                                                                                                                                                       |
703 |  FUNCTION DEFINITIONS                                                                                                                                         |
704 |                                                                                                                                                                                       |
705 ========================================================================================== */
706 /*---------------------------------------------------------------------------
707 |    GLOBAL FUNCTION DEFINITIONS:                                                                                       |
708 ---------------------------------------------------------------------------*/
709 /* convert MSL value to sensor value */
710 int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int mslval)
711 {
712         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
713         _MMCamcorderInfoConverting *info = NULL;
714         int i = 0;
715         int size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting);
716
717         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
718
719         info = hcamcorder->caminfo_convert;
720
721         for (i = 0; i < size; i++) {
722                 if (info[i].attr_idx == attr_idx) {
723                         _MMCamcorderEnumConvert * enum_convert = NULL;
724                         enum_convert = info[i].enum_convert;
725
726                         if (enum_convert == NULL) {
727                                 MMCAM_LOG_VERBOSE("[attr:%d] NULL enum_convert, just return original[%d]",
728                                         attr_idx, mslval);
729                                 return mslval;
730                         }
731
732                         if (enum_convert->enum_arr == NULL) {
733                                 MMCAM_LOG_WARNING("[attr:%d] NULL array pointer, just return original[%d]",
734                                         attr_idx, mslval);
735                                 return mslval;
736                         }
737
738                         if (enum_convert->total_enum_num > mslval && mslval >= 0) {
739                                 MMCAM_LOG_VERBOSE("[attr:%d] original[%d] -> converted[%d]",
740                                         attr_idx, mslval, enum_convert->enum_arr[mslval]);
741                                 return enum_convert->enum_arr[mslval];
742                         } else {
743                                 MMCAM_LOG_WARNING("[attr:%d] invalid input mslval[%d][size:%d], just return original.",
744                                         attr_idx, mslval, enum_convert->total_enum_num);
745                                 return mslval;
746                         }
747                 }
748         }
749
750         MMCAM_LOG_WARNING("[attr:%d] no category to match, just return original[%d]",
751                 attr_idx, mslval);
752
753         return mslval;
754 }
755
756 int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int height,  MMCamAttrsInfo* fps_info)
757 {
758         int i = 0;
759         char nameFps[16] = {0, };
760         bool valid_check = false;
761
762         MMCamAttrsInfo infoW;
763         MMCamAttrsInfo infoH;
764         type_int_array *fps_array = NULL;
765
766         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
767
768         MMCAM_LOG_DEBUG("resolution %dx%d", width, height);
769
770         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_WIDTH, &infoW);
771         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_HEIGHT, &infoH);
772
773         for (i = 0; i < infoW.int_array.count; i++) {
774                 MMCAM_LOG_VERBOSE("check resolution %dx%d", infoW.int_array.array[i], infoH.int_array.array[i]);
775                 if (infoW.int_array.array[i] == width && infoH.int_array.array[i] == height) {
776                         valid_check = true;
777                         snprintf(nameFps, sizeof(nameFps), "FPS%d", i);
778                         MMCAM_LOG_INFO("nameFps[%s]", nameFps);
779                         break;
780                 }
781         }
782
783         if (!valid_check) {
784                 MMCAM_LOG_ERROR("FAILED : Can't find the valid resolution from attribute.");
785                 return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
786         }
787
788         /* get fps list from capability first. */
789         if (_mmcamcorder_capability_get_preview_fps_list_by_resolution(handle, width, height,
790                 &fps_info->int_array.array, &fps_info->int_array.count, &fps_info->int_array.def) == MM_ERROR_NONE)
791                 return MM_ERROR_NONE;
792
793         /* get fps list from ini if it's failed from capability. */
794         if (!_mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAMERA, nameFps, &fps_array)) {
795                 MMCAM_LOG_ERROR("FAILED : Can't find the valid FPS array.");
796                 return MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
797         }
798
799         fps_info->int_array.count = fps_array->count;
800         fps_info->int_array.array = fps_array->value;
801         fps_info->int_array.def = fps_array->default_value;
802
803         return MM_ERROR_NONE;
804 }
805
806 /* convert sensor value to MSL value */
807 int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int sensval)
808 {
809         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
810         _MMCamcorderInfoConverting *info = NULL;
811         int i = 0, j = 0;
812         int size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting);
813
814         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
815
816         info = hcamcorder->caminfo_convert;
817
818         for (i = 0 ; i < size ; i++) {
819                 if (info[i].attr_idx == attr_idx) {
820                         _MMCamcorderEnumConvert * enum_convert = NULL;
821                         enum_convert = info[i].enum_convert;
822
823                         if (enum_convert == NULL) {
824                                 MMCAM_LOG_VERBOSE("[attr:%d] NULL enum_convert, just return original[%d]",
825                                         attr_idx, sensval);
826                                 return sensval;
827                         }
828
829                         if (enum_convert->enum_arr == NULL) {
830                                 MMCAM_LOG_WARNING("[attr:%d] NULL array pointer, just return original[%d]",
831                                         attr_idx, sensval);
832                                 return sensval;
833                         }
834
835                         for (j = 0 ; j < enum_convert->total_enum_num ; j++) {
836                                 if (sensval == enum_convert->enum_arr[j]) {
837                                         MMCAM_LOG_VERBOSE("[attr:%d] original[%d] -> converted[%d]",
838                                                 attr_idx, sensval, j);
839                                         return j;
840                                 }
841                         }
842
843                         MMCAM_LOG_WARNING("[attr:%d] no sensor value matched, just return original[%d]",
844                                 attr_idx, sensval);
845
846                         return sensval;
847
848                 }
849         }
850
851         MMCAM_LOG_INFO("[attr:%d] no category to match, just return original[%d]",
852                 attr_idx, sensval);
853
854         return sensval;
855 }
856
857 static int __mmcamcorder_get_valid_array(int *original_array, int original_count, int **valid_array, int *valid_default)
858 {
859         int i = 0;
860         int valid_count = 0;
861         int new_default = _MMCAMCORDER_SENSOR_ENUM_NONE;
862
863         for (i = 0; i < original_count; i++) {
864                 if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE)
865                         valid_count++;
866         }
867
868         if (valid_count > 0) {
869                 *valid_array = (int*)malloc(sizeof(int) * valid_count);
870
871                 if (*valid_array) {
872                         valid_count = 0;
873                         for (i = 0; i < original_count; i++) {
874                                 if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) {
875                                         (*valid_array)[valid_count++] = i;
876                                         MMCAM_LOG_VERBOSE("valid_array[%d] = %d", valid_count-1, (*valid_array)[valid_count-1]);
877
878                                         if (original_array[i] == *valid_default &&
879                                             new_default == _MMCAMCORDER_SENSOR_ENUM_NONE) {
880                                                 new_default = i;
881                                                 MMCAM_LOG_VERBOSE("converted MSL default[%d]", new_default);
882                                         }
883                                 }
884                         }
885                 } else {
886                         valid_count = 0;
887                 }
888         }
889
890         if (new_default != _MMCAMCORDER_SENSOR_ENUM_NONE)
891                 *valid_default = new_default;
892
893         return valid_count;
894 }
895
896
897 int _mmcamcorder_init_attr_from_configure(MMHandleType handle, MMCamConvertingCategory category)
898 {
899         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
900         _MMCamcorderInfoConverting *info = NULL;
901
902         int table_size = 0;
903         int ret = MM_ERROR_NONE;
904
905         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
906
907         MMCAM_LOG_INFO("category : %d", category);
908
909         if (category & MM_CAMCONVERT_CATEGORY_CAMERA) {
910                 /* Initialize attribute related to camera control */
911                 info = hcamcorder->caminfo_convert;
912                 table_size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting);
913                 ret = __mmcamcorder_set_info_to_attr(handle, info, table_size);
914                 if (ret != MM_ERROR_NONE) {
915                         MMCAM_LOG_ERROR("camera info set error : 0x%x", ret);
916                         return ret;
917                 }
918         }
919
920         if (category & MM_CAMCONVERT_CATEGORY_DISPLAY) {
921                 /* Initialize attribute related to display */
922                 info = g_display_info;
923                 table_size = sizeof(g_display_info) / sizeof(_MMCamcorderInfoConverting);
924                 ret = __mmcamcorder_set_info_to_attr(handle, info, table_size);
925                 if (ret != MM_ERROR_NONE) {
926                         MMCAM_LOG_ERROR("display info set error : 0x%x", ret);
927                         return ret;
928                 }
929         }
930
931         if (category & MM_CAMCONVERT_CATEGORY_AUDIO) {
932                 /* Initialize attribute related to audio */
933                 info = g_audio_info;
934                 table_size = sizeof(g_audio_info) / sizeof(_MMCamcorderInfoConverting);
935                 ret = __mmcamcorder_set_info_to_attr(handle, info, table_size);
936                 if (ret != MM_ERROR_NONE) {
937                         MMCAM_LOG_ERROR("audio info set error : 0x%x", ret);
938                         return ret;
939                 }
940         }
941
942         hcamcorder->is_configured = TRUE;
943
944         MMCAM_LOG_INFO("done");
945
946         return ret;
947 }
948
949
950 int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverting *info, int table_size)
951 {
952         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
953         MMHandleType     attrs      = 0;
954
955         int i = 0;
956         int ret = MM_ERROR_NONE;
957
958         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
959
960         attrs = MMF_CAMCORDER_ATTRS(handle);
961         mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
962
963         camera_conf *conf_info = NULL;
964
965         for (i = 0; i < table_size; i++) {
966                 MMCAM_LOG_VERBOSE("[type:%d][cat:%d][attr:%d][attr_pair:%d][key:%s][ctype:%d]",
967                         info[i].type,
968                         info[i].category,
969                         info[i].attr_idx,
970                         info[i].attr_idx_pair,
971                         info[i].keyword,
972                         info[i].conv_type);
973
974                 if (ret != MM_ERROR_NONE)
975                         break;
976
977                 if (info[i].type == CONFIGURE_TYPE_MAIN)
978                         conf_info = hcamcorder->conf_main;
979                 else
980                         conf_info = hcamcorder->conf_ctrl;
981
982                 switch (info[i].conv_type) {
983                 case MM_CAMCONVERT_TYPE_INT:
984                 {
985                         int ivalue = 0;
986
987                         if (!_mmcamcorder_conf_get_value_int(handle, conf_info, info[i].category, info[i].keyword, &ivalue)) {
988                                 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
989                                 break; /* skip to set */
990                         }
991
992                         ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, ivalue);
993                         break;
994                 }
995                 case MM_CAMCONVERT_TYPE_INT_ARRAY:
996                 {
997                         int *iarray = NULL;
998                         int iarray_size = 0;
999                         int idefault = 0;
1000                         type_int_array *tarray = NULL;
1001
1002                         if (!_mmcamcorder_conf_get_value_int_array(conf_info, info[i].category, info[i].keyword, &tarray))
1003                                 break; /* skip to set, but not error */
1004
1005                         if (tarray) {
1006                                 idefault = tarray->default_value;
1007
1008                                 if (info[i].enum_convert) {
1009                                         iarray_size = __mmcamcorder_get_valid_array(tarray->value, tarray->count, &iarray, &idefault);
1010                                 } else {
1011                                         iarray = tarray->value;
1012                                         iarray_size = tarray->count;
1013                                 }
1014
1015                                 if (iarray_size > 0) {
1016                                         MMCAM_LOG_DEBUG("[%s] INT Array - size[%d], default[%d]",
1017                                                 info[i].keyword, iarray_size, idefault);
1018
1019                                         mm_attrs_set_valid_array(attrs, info[i].attr_idx, iarray, iarray_size, idefault);
1020                                         ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, idefault);
1021                                 }
1022                         }
1023
1024                         if (iarray && iarray != tarray->value)
1025                                 free(iarray);
1026
1027                         break;
1028                 }
1029                 case MM_CAMCONVERT_TYPE_INT_RANGE:
1030                 {
1031                         type_int_range *irange = NULL;
1032
1033                         if (!_mmcamcorder_conf_get_value_int_range(conf_info, info[i].category, info[i].keyword, &irange))
1034                                 break; /* skip to set, but not error */
1035
1036                         if (irange) {
1037                                 MMCAM_LOG_DEBUG("[%s] INT Range - min[%d], max[%d]",
1038                                         info[i].keyword, irange->min, irange->max);
1039
1040                                 mm_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max, irange->default_value);
1041                                 ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, irange->default_value);
1042                         }
1043
1044                         break;
1045                 }
1046                 case MM_CAMCONVERT_TYPE_STRING:
1047                 {
1048                         const char *cString = NULL;
1049
1050                         if (!_mmcamcorder_conf_get_value_string(handle, conf_info, info[i].category, info[i].keyword, &cString)) {
1051                                 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
1052                                 break; /* skip to set */
1053                         }
1054
1055                         MMCAM_LOG_DEBUG("[%s] String - string[%s]", info[i].keyword, cString);
1056                         ret = mm_attrs_set_string(attrs, info[i].attr_idx, cString, cString ? strlen(cString) : 0);
1057                         break;
1058                 }
1059                 case MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY:
1060                 {
1061                         type_int_pair_array *pair_array = NULL;
1062
1063                         if (!_mmcamcorder_conf_get_value_int_pair_array(conf_info, info[i].category, info[i].keyword, &pair_array))
1064                                 break; /* skip to set, but not error */
1065
1066                         if (pair_array && pair_array->count > 0) {
1067                                 mm_attrs_set_valid_array(attrs, info[i].attr_idx,
1068                                         pair_array->value[0],
1069                                         pair_array->count,
1070                                         pair_array->default_value[0]);
1071                                 mm_attrs_set_valid_array(attrs, info[i].attr_idx_pair,
1072                                         pair_array->value[1],
1073                                         pair_array->count,
1074                                         pair_array->default_value[1]);
1075
1076                                 MMCAM_LOG_DEBUG("[%s] INT PAIR Array - default[%d,%d]",
1077                                         info[i].keyword, pair_array->default_value[0], pair_array->default_value[1]);
1078
1079                                 mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, pair_array->default_value[0]);
1080                                 mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx_pair, pair_array->default_value[1]);
1081                         }
1082                         break;
1083                 }
1084
1085                 case MM_CAMCONVERT_TYPE_USER:
1086                 default:
1087                         MMCAM_LOG_WARNING("default - [attr:%d]", info[i].attr_idx);
1088                         break;
1089                 }
1090         }
1091
1092         if (ret != MM_ERROR_NONE || mm_attrs_commit_all(attrs) == -1)
1093                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1094         else
1095                 return MM_ERROR_NONE;
1096 }
1097
1098
1099 int _mmcamcorder_set_converted_value(MMHandleType handle, _MMCamcorderEnumConvert * convert)
1100 {
1101         mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
1102         type_int_array *array = NULL;
1103
1104         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
1105
1106         _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl, convert->category, convert->keyword, &array);
1107
1108         if (array)
1109                 convert->enum_arr = array->value;
1110
1111         return MM_ERROR_NONE;
1112 }
1113
1114
1115 int _mmcamcorder_init_convert_table(MMHandleType handle)
1116 {
1117         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1118         size_t enum_conv_size = sizeof(_MMCamcorderEnumConvert);
1119         size_t caminfo_conv_size = sizeof(g_caminfo_convert);
1120         size_t caminfo_conv_length = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting);
1121         size_t i = 0;
1122
1123         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
1124
1125         /* copy default conv data into memory of handle */
1126         memcpy(&(hcamcorder->caminfo_convert), &g_caminfo_convert, caminfo_conv_size);
1127         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE]), &_mmcamcorder_enum_conv_whitebalance, enum_conv_size);
1128         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]), &_mmcamcorder_enum_conv_colortone, enum_conv_size);
1129         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ISO]), &_mmcamcorder_enum_conv_iso, enum_conv_size);
1130         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE]), &_mmcamcorder_enum_conv_prgrm, enum_conv_size);
1131         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE]), &_mmcamcorder_enum_conv_focus_mode, enum_conv_size);
1132         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE]), &_mmcamcorder_enum_conv_focus_type, enum_conv_size);
1133         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]), &_mmcamcorder_enum_conv_ae_type, enum_conv_size);
1134         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]), &_mmcamcorder_enum_conv_strobe_mode, enum_conv_size);
1135         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WDR]), &_mmcamcorder_enum_conv_wdr_ctrl, enum_conv_size);
1136         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]), &_mmcamcorder_enum_conv_flip_ctrl, enum_conv_size);
1137         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]), &_mmcamcorder_enum_conv_rotation_ctrl, enum_conv_size);
1138         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]), &_mmcamcorder_enum_conv_ahs, enum_conv_size);
1139         memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]), &_mmcamcorder_enum_conv_video_stabilization, enum_conv_size);
1140
1141         /* set ini info to conv data */
1142         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE]));
1143         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]));
1144         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ISO]));
1145         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE]));
1146         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE]));
1147         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE]));
1148         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]));
1149         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]));
1150         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]));
1151         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]));
1152         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]));
1153         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]));
1154         _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]));
1155
1156         /* set modified conv data to handle */
1157         for (i = 0 ; i < caminfo_conv_length ; i++) {
1158                 if (hcamcorder->caminfo_convert[i].type == CONFIGURE_TYPE_CTRL) {
1159                         switch (hcamcorder->caminfo_convert[i].category) {
1160                         case CONFIGURE_CATEGORY_CTRL_STROBE:
1161                                 if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "StrobeMode"))
1162                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]);
1163                                 break;
1164                         case CONFIGURE_CATEGORY_CTRL_EFFECT:
1165                                 if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WhiteBalance"))
1166                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE]);
1167                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ColorTone"))
1168                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]);
1169                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WDR"))
1170                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]);
1171                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Flip"))
1172                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]);
1173                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Rotation"))
1174                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]);
1175                                 break;
1176                         case CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH:
1177                                 if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "FocusMode"))
1178                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE]);
1179                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AFType"))
1180                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE]);
1181                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AEType"))
1182                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]);
1183                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ISO"))
1184                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ISO]);
1185                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ProgramMode"))
1186                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE]);
1187                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AntiHandshake"))
1188                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]);
1189                                 else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "VideoStabilization"))
1190                                         hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]);
1191                                 break;
1192                         default:
1193                                 break;
1194                         }
1195                 }
1196         }
1197
1198         return MM_ERROR_NONE;
1199 }
1200
1201
1202 double _mmcamcorder_convert_volume(int mslVal)
1203 {
1204         double newVal = -1;
1205         switch (mslVal) {
1206         case 0:
1207                 newVal = 0;
1208                 break;
1209         case 1:
1210                 newVal = 1;
1211                 break;
1212         default:
1213                 MMCAM_LOG_WARNING("out of range");
1214                 break;
1215         }
1216
1217         return newVal;
1218 }