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