4b2889346b544b47d1a47c57d784edc3527b9a83
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_configure.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 |  INCLUDE FILES                                                                        |
24 =======================================================================================*/
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29
30 #include "mm_camcorder_internal.h"
31 #include "mm_camcorder_configure.h"
32
33 /*-----------------------------------------------------------------------
34 |    MACRO DEFINITIONS:                                                 |
35 -----------------------------------------------------------------------*/
36 #define CONFIGURE_PATH          "/usr/etc"
37 #define CONFIGURE_PATH_RETRY    "/opt/etc"
38
39 /*-----------------------------------------------------------------------
40 |    GLOBAL VARIABLE DEFINITIONS                                        |
41 -----------------------------------------------------------------------*/
42
43 /*-----------------------------------------------------------------------
44 |    LOCAL VARIABLE DEFINITIONS                                         |
45 -----------------------------------------------------------------------*/
46
47 char *get_new_string(char* src_string)
48 {
49         return strdup(src_string);
50 }
51
52 void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
53 {
54         int i = 0;
55         int info_table_size = sizeof(conf_info_table);
56
57         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
58
59         /* Videosrc element default value */
60         static type_element _videosrc_element_default = {
61                 "VideosrcElement",
62                 "videotestsrc",
63                 NULL,
64                 0,
65                 NULL,
66                 0,
67         };
68
69         /* Audiosrc element default value */
70         static type_int  ___audiosrc_default_channel = { "Channel", 1 };
71         static type_int  ___audiosrc_default_bitrate = { "BitRate", 8000 };
72         static type_int  ___audiosrc_default_depth = { "Depth", 16 };
73         static type_int  ___audiosrc_default_blocksize = { "BlockSize", 1280 };
74         static type_int* __audiosrc_default_int_array[] = {
75                 &___audiosrc_default_channel,
76                 &___audiosrc_default_bitrate,
77                 &___audiosrc_default_depth,
78                 &___audiosrc_default_blocksize,
79         };
80         static type_string  ___audiosrc_default_device = { "Device", "default" };
81         static type_string* __audiosrc_default_string_array[] = {
82                 &___audiosrc_default_device,
83         };
84         static type_element _audiosrc_element_default = {
85                 "AudiosrcElement",
86                 "audiotestsrc",
87                 __audiosrc_default_int_array,
88                 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
89                 __audiosrc_default_string_array,
90                 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
91         };
92
93         static type_element _audiomodemsrc_element_default = {
94                 "AudiomodemsrcElement",
95                 "audiotestsrc",
96                 __audiosrc_default_int_array,
97                 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
98                 __audiosrc_default_string_array,
99                 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
100         };
101
102
103         /* Videosink element default value */
104         static type_int  ___videosink_default_display_id = { "display-id", 3 };
105         static type_int  ___videosink_default_x = { "x", 0 };
106         static type_int  ___videosink_default_y = { "y", 0 };
107         static type_int  ___videosink_default_width = { "width", 800 };
108         static type_int  ___videosink_default_height = { "height", 480 };
109         static type_int  ___videosink_default_rotation = { "rotation", 1 };
110         static type_int* __videosink_default_int_array[] = {
111                 &___videosink_default_display_id,
112                 &___videosink_default_x,
113                 &___videosink_default_y,
114                 &___videosink_default_width,
115                 &___videosink_default_height,
116                 &___videosink_default_rotation,
117         };
118         static type_string* __videosink_default_string_array[] = { NULL };
119         static type_element _videosink_element_x_default = {
120                 "VideosinkElementX",
121                 "xvimagesink",
122                 __videosink_default_int_array,
123                 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
124                 __videosink_default_string_array,
125                 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
126         };
127         static type_element _videosink_element_evas_default = {
128                 "VideosinkElementEvas",
129                 "evasimagesink",
130                 __videosink_default_int_array,
131                 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
132                 __videosink_default_string_array,
133                 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
134         };
135         static type_element _videosink_element_gl_default = {
136                 "VideosinkElementGL",
137                 "glimagesink",
138                 __videosink_default_int_array,
139                 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
140                 __videosink_default_string_array,
141                 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
142         };
143         static type_element _videosink_element_null_default = {
144                 "VideosinkElementNull",
145                 "fakesink",
146                 __videosink_default_int_array,
147                 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
148                 __videosink_default_string_array,
149                 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
150         };
151
152         /* Videoscale element default value */
153         static type_element _videoscale_element_default = {
154                 "VideoscaleElement",
155                 "videoscale",
156                 NULL,
157                 0,
158                 NULL,
159                 0,
160         };
161
162         /* Videoconvert element default value */
163         static type_element _videoconvert_element_default = {
164                 "VideoconvertElement",
165                 "videoconvert",
166                 NULL,
167                 0,
168                 NULL,
169                 0,
170         };
171
172         /* Record sink element default value */
173         static type_element _recordsink_element_default = {
174                 "RecordsinkElement",
175                 "fakesink",
176                 NULL,
177                 0,
178                 NULL,
179                 0,
180         };
181
182         /* H263 element default value */
183         static type_element _h263_element_default = {
184                 "H263",
185                 "avenc_h263",
186                 NULL,
187                 0,
188                 NULL,
189                 0,
190         };
191
192         /* H264 element default value */
193         static type_element _h264_element_default = {
194                 "H264",
195                 NULL,
196                 NULL,
197                 0,
198                 NULL,
199                 0,
200         };
201
202         /* H26L element default value */
203         static type_element _h26l_element_default = {
204                 "H26L",
205                 NULL,
206                 NULL,
207                 0,
208                 NULL,
209                 0,
210         };
211
212         /* MPEG4 element default value */
213         static type_element _mpeg4_element_default = {
214                 "MPEG4",
215                 "avenc_mpeg4",
216                 NULL,
217                 0,
218                 NULL,
219                 0,
220         };
221
222         /* MPEG1 element default value */
223         static type_element _mpeg1_element_default = {
224                 "MPEG1",
225                 "avenc_mpeg1video",
226                 NULL,
227                 0,
228                 NULL,
229                 0,
230         };
231
232         /* THEORA element default value */
233         static type_element _theora_element_default = {
234                 "THEORA",
235                 "theoraenc",
236                 NULL,
237                 0,
238                 NULL,
239                 0,
240         };
241
242         /* AMR element default value */
243         static type_element _amr_element_default = {
244                 "AMR",
245                 "amrnbenc",
246                 NULL,
247                 0,
248                 NULL,
249                 0,
250         };
251
252         /* G723_1 element default value */
253         static type_element _g723_1_element_default = {
254                 "G723_1",
255                 NULL,
256                 NULL,
257                 0,
258                 NULL,
259                 0,
260         };
261
262         /* MP3 element default value */
263         static type_element _mp3_element_default = {
264                 "MP3",
265                 "lamemp3enc",
266                 NULL,
267                 0,
268                 NULL,
269                 0,
270         };
271
272         /* AAC element default value */
273         static type_element _aac_element_default = {
274                 "AAC",
275                 NULL,
276                 NULL,
277                 0,
278                 NULL,
279                 0,
280         };
281
282         /* MMF element default value */
283         static type_element _mmf_element_default = {
284                 "MMF",
285                 NULL,
286                 NULL,
287                 0,
288                 NULL,
289                 0,
290         };
291
292         /* ADPCM element default value */
293         static type_element _adpcm_element_default = {
294                 "ADPCM",
295                 "avenc_adpcm_ima_qt",
296                 NULL,
297                 0,
298                 NULL,
299                 0,
300         };
301
302         /* WAVE element default value */
303         static type_element _wave_element_default = {
304                 "WAVE",
305                 "wavenc",
306                 NULL,
307                 0,
308                 NULL,
309                 0,
310         };
311
312         /* VORBIS element default value */
313         static type_element _vorbis_element_default = {
314                 "VORBIS",
315                 "vorbisenc",
316                 NULL,
317                 0,
318                 NULL,
319                 0,
320         };
321
322         /* MIDI element default value */
323         static type_element _midi_element_default = {
324                 "MIDI",
325                 NULL,
326                 NULL,
327                 0,
328                 NULL,
329                 0,
330         };
331
332         /* IMELODY element default value */
333         static type_element _imelody_element_default = {
334                 "IMELODY",
335                 NULL,
336                 NULL,
337                 0,
338                 NULL,
339                 0,
340         };
341
342         /* JPEG element default value */
343         static type_element _jpeg_element_default = {
344                 "JPEG",
345                 "jpegenc",
346                 NULL,
347                 0,
348                 NULL,
349                 0,
350         };
351
352         /* PNG element default value */
353         static type_element _png_element_default = {
354                 "PNG",
355                 "pngenc",
356                 NULL,
357                 0,
358                 NULL,
359                 0,
360         };
361
362         /* BMP element default value */
363         static type_element _bmp_element_default = {
364                 "BMP",
365                 NULL,
366                 NULL,
367                 0,
368                 NULL,
369                 0,
370         };
371
372         /* WBMP element default value */
373         static type_element _wbmp_element_default = {
374                 "WBMP",
375                 NULL,
376                 NULL,
377                 0,
378                 NULL,
379                 0,
380         };
381
382         /* TIFF element default value */
383         static type_element _tiff_element_default = {
384                 "TIFF",
385                 NULL,
386                 NULL,
387                 0,
388                 NULL,
389                 0,
390         };
391
392         /* PCX element default value */
393         static type_element _pcx_element_default = {
394                 "PCX",
395                 NULL,
396                 NULL,
397                 0,
398                 NULL,
399                 0,
400         };
401
402         /* GIF element default value */
403         static type_element _gif_element_default = {
404                 "GIF",
405                 NULL,
406                 NULL,
407                 0,
408                 NULL,
409                 0,
410         };
411
412         /* ICO element default value */
413         static type_element _ico_element_default = {
414                 "ICO",
415                 NULL,
416                 NULL,
417                 0,
418                 NULL,
419                 0,
420         };
421
422         /* RAS element default value */
423         static type_element _ras_element_default = {
424                 "RAS",
425                 NULL,
426                 NULL,
427                 0,
428                 NULL,
429                 0,
430         };
431
432         /* TGA element default value */
433         static type_element _tga_element_default = {
434                 "TGA",
435                 NULL,
436                 NULL,
437                 0,
438                 NULL,
439                 0,
440         };
441
442         /* XBM element default value */
443         static type_element _xbm_element_default = {
444                 "XBM",
445                 NULL,
446                 NULL,
447                 0,
448                 NULL,
449                 0,
450         };
451
452         /* XPM element default value */
453         static type_element _xpm_element_default = {
454                 "XPM",
455                 NULL,
456                 NULL,
457                 0,
458                 NULL,
459                 0,
460         };
461
462         /* 3GP element default value */
463         static type_element _3gp_element_default = {
464                 "3GP",
465                 "avmux_3gp",
466                 NULL,
467                 0,
468                 NULL,
469                 0,
470         };
471
472         /* AMR mux element default value */
473         static type_element _amrmux_element_default = {
474                 "AMR",
475                 "avmux_amr",
476                 NULL,
477                 0,
478                 NULL,
479                 0,
480         };
481
482         /* MP4 element default value */
483         static type_element _mp4_element_default = {
484                 "MP4",
485                 "avmux_mp4",
486                 NULL,
487                 0,
488                 NULL,
489                 0,
490         };
491
492         /* AAC mux element default value */
493         static type_element _aacmux_element_default = {
494                 "AAC",
495                 NULL,
496                 NULL,
497                 0,
498                 NULL,
499                 0,
500         };
501
502         /* MP3 mux element default value */
503         static type_element _mp3mux_element_default = {
504                 "MP3",
505                 NULL,
506                 NULL,
507                 0,
508                 NULL,
509                 0,
510         };
511
512         /* OGG element default value */
513         static type_element _ogg_element_default = {
514                 "OGG",
515                 "oggmux",
516                 NULL,
517                 0,
518                 NULL,
519                 0,
520         };
521
522         /* WAV element default value */
523         static type_element _wav_element_default = {
524                 "WAV",
525                 NULL,
526                 NULL,
527                 0,
528                 NULL,
529                 0,
530         };
531
532         /* AVI element default value */
533         static type_element _avi_element_default = {
534                 "AVI",
535                 "avimux",
536                 NULL,
537                 0,
538                 NULL,
539                 0,
540         };
541
542         /* WMA element default value */
543         static type_element _wma_element_default = {
544                 "WMA",
545                 NULL,
546                 NULL,
547                 0,
548                 NULL,
549                 0,
550         };
551
552         /* WMV element default value */
553         static type_element _wmv_element_default = {
554                 "WMV",
555                 NULL,
556                 NULL,
557                 0,
558                 NULL,
559                 0,
560         };
561
562         /* MID element default value */
563         static type_element _mid_element_default = {
564                 "MID",
565                 NULL,
566                 NULL,
567                 0,
568                 NULL,
569                 0,
570         };
571
572         /* MMF mux element default value */
573         static type_element _mmfmux_element_default = {
574                 "MMF",
575                 "avmux_mmf",
576                 NULL,
577                 0,
578                 NULL,
579                 0,
580         };
581
582         /* MATROSKA element default value */
583         static type_element _matroska_element_default = {
584                 "MATROSKA",
585                 "matroskamux",
586                 NULL,
587                 0,
588                 NULL,
589                 0,
590         };
591
592         /* M2TS element default value */
593         static type_element _m2ts_element_default = {
594                 "M2TS",
595                 "mpegtsmux",
596                 NULL,
597                 0,
598                 NULL,
599                 0,
600         };
601
602         /* [General] matching table */
603         static conf_info_table conf_main_general_table[] = {
604                 { "SyncStateChange", CONFIGURE_VALUE_INT,           {.value_int = 1} },
605                 { "GSTInitOption",   CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
606                 { "ModelName",       CONFIGURE_VALUE_STRING,        {NULL} },
607                 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
608         };
609
610         /* [VideoInput] matching table */
611         static conf_info_table conf_main_video_input_table[] = {
612                 { "UseConfCtrl",        CONFIGURE_VALUE_INT,            {.value_int = 1} },
613                 { "ConfCtrlFile0",      CONFIGURE_VALUE_STRING,         {NULL} },
614                 { "ConfCtrlFile1",      CONFIGURE_VALUE_STRING,         {NULL} },
615                 { "VideosrcElement",    CONFIGURE_VALUE_ELEMENT,        {&_videosrc_element_default} },
616                 { "UseVideoscale",      CONFIGURE_VALUE_INT,            {.value_int = 0} },
617                 { "VideoscaleElement",  CONFIGURE_VALUE_ELEMENT,        {&_videoscale_element_default} },
618                 { "UseZeroCopyFormat",  CONFIGURE_VALUE_INT,            {.value_int = 0} },
619                 { "DeviceCount",        CONFIGURE_VALUE_INT,            {.value_int = MM_VIDEO_DEVICE_NUM} },
620                 { "SupportMediaPacketPreviewCb",  CONFIGURE_VALUE_INT,  {.value_int = 0} },
621         };
622
623         /* [AudioInput] matching table */
624         static conf_info_table conf_main_audio_input_table[] = {
625                 { "AudiosrcElement",      CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
626                 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
627         };
628
629         /* [VideoOutput] matching table */
630         static conf_info_table conf_main_video_output_table[] = {
631                 { "DisplayDevice",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
632                 { "DisplayMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
633                 { "Videosink",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
634                 { "VideosinkElementX",     CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_x_default} },
635                 { "VideosinkElementEvas",  CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_evas_default} },
636                 { "VideosinkElementGL",    CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_gl_default} },
637                 { "VideosinkElementNull",  CONFIGURE_VALUE_ELEMENT,   {&_videosink_element_null_default} },
638                 { "UseVideoscale",         CONFIGURE_VALUE_INT,       {.value_int = 0} },
639                 { "VideoscaleElement",     CONFIGURE_VALUE_ELEMENT,   {&_videoscale_element_default} },
640                 { "VideoconvertElement",   CONFIGURE_VALUE_ELEMENT,   {&_videoconvert_element_default} },
641         };
642
643         /* [Capture] matching table */
644         static conf_info_table conf_main_capture_table[] = {
645                 { "UseEncodebin",           CONFIGURE_VALUE_INT,     {.value_int = 0} },
646                 { "UseCaptureMode",         CONFIGURE_VALUE_INT,     {.value_int = 0} },
647                 { "VideoscaleElement",      CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
648                 { "PlayCaptureSound",       CONFIGURE_VALUE_INT,     {.value_int = 1} },
649         };
650
651         /* [Record] matching table */
652         static conf_info_table conf_main_record_table[] = {
653                 { "UseAudioEncoderQueue",   CONFIGURE_VALUE_INT,     {.value_int = 1} },
654                 { "UseVideoEncoderQueue",   CONFIGURE_VALUE_INT,     {.value_int = 1} },
655                 { "VideoProfile",           CONFIGURE_VALUE_INT,     {.value_int = 0} },
656                 { "VideoAutoAudioConvert",  CONFIGURE_VALUE_INT,     {.value_int = 0} },
657                 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT,     {.value_int = 0} },
658                 { "VideoAutoColorSpace",    CONFIGURE_VALUE_INT,     {.value_int = 0} },
659                 { "AudioProfile",           CONFIGURE_VALUE_INT,     {.value_int = 0} },
660                 { "AudioAutoAudioConvert",  CONFIGURE_VALUE_INT,     {.value_int = 0} },
661                 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT,     {.value_int = 0} },
662                 { "AudioAutoColorSpace",    CONFIGURE_VALUE_INT,     {.value_int = 0} },
663                 { "ImageProfile",           CONFIGURE_VALUE_INT,     {.value_int = 0} },
664                 { "ImageAutoAudioConvert",  CONFIGURE_VALUE_INT,     {.value_int = 0} },
665                 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT,     {.value_int = 0} },
666                 { "ImageAutoColorSpace",    CONFIGURE_VALUE_INT,     {.value_int = 0} },
667                 { "RecordsinkElement",      CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
668                 { "UseNoiseSuppressor",     CONFIGURE_VALUE_INT,     {.value_int = 0} },
669                 { "DropVideoFrame",         CONFIGURE_VALUE_INT,     {.value_int = 0} },
670                 { "PassFirstVideoFrame",    CONFIGURE_VALUE_INT,     {.value_int = 0} },
671                 { "SupportDualStream",      CONFIGURE_VALUE_INT,     {.value_int = FALSE} },
672         };
673
674         /* [VideoEncoder] matching table */
675         static conf_info_table conf_main_video_encoder_table[] = {
676                 { "H263",    CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
677                 { "H264",    CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
678                 { "H26L",    CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
679                 { "MPEG4",   CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
680                 { "MPEG1",   CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
681                 { "THEORA",  CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
682         };
683
684         /* [AudioEncoder] matching table */
685         static conf_info_table conf_main_audio_encoder_table[] = {
686                 { "AMR",     CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
687                 { "G723_1",  CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
688                 { "MP3",     CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
689                 { "AAC",     CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
690                 { "MMF",     CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
691                 { "ADPCM",   CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
692                 { "WAVE",    CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
693                 { "MIDI",    CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
694                 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
695                 { "VORBIS",  CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
696         };
697
698         /* [ImageEncoder] matching table */
699         static conf_info_table conf_main_image_encoder_table[] = {
700                 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
701                 { "PNG",  CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
702                 { "BMP",  CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
703                 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
704                 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
705                 { "PCX",  CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
706                 { "GIF",  CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
707                 { "ICO",  CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
708                 { "RAS",  CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
709                 { "TGA",  CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
710                 { "XBM",  CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
711                 { "XPM",  CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
712         };
713
714         /* [Mux] matching table */
715         static conf_info_table conf_main_mux_table[] = {
716                 { "3GP",      CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
717                 { "AMR",      CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
718                 { "MP4",      CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
719                 { "AAC",      CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
720                 { "MP3",      CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
721                 { "OGG",      CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
722                 { "WAV",      CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
723                 { "AVI",      CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
724                 { "WMA",      CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
725                 { "WMV",      CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
726                 { "MID",      CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
727                 { "MMF",      CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
728                 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
729                 { "M2TS",     CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
730         };
731
732
733         /*******************
734         *  Camera control *
735         *******************/
736
737         /* [Camera] matching table */
738         static conf_info_table conf_ctrl_camera_table[] = {
739                 { "InputIndex",        CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
740                 { "DeviceName",        CONFIGURE_VALUE_STRING,         {NULL} },
741                 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
742                 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
743                 { "VideoResolution",   CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
744                 { "FPS",               CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
745                 { "PictureFormat",     CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
746                 { "Overlay",           CONFIGURE_VALUE_INT_RANGE,      {NULL} },
747                 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT,     {.value_int = 3}    },
748                 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
749                 { "RecommendPreviewFormatRecord",  CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
750                 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
751                 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
752         };
753
754         /* [Strobe] matching table */
755         static conf_info_table conf_ctrl_strobe_table[] = {
756                 { "StrobeControl",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
757                 { "StrobeMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
758                 { "StrobeEV",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
759         };
760
761         /* [Effect] matching table */
762         static conf_info_table conf_ctrl_effect_table[] = {
763                 { "Brightness",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
764                 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
765                 { "Contrast",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
766                 { "Saturation",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
767                 { "Sharpness",            CONFIGURE_VALUE_INT_RANGE, {NULL} },
768                 { "WhiteBalance",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
769                 { "ColorTone",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
770                 { "Flip",                 CONFIGURE_VALUE_INT_ARRAY, {NULL} },
771                 { "Rotation",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772                 { "WDR",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773                 { "PartColorMode",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774                 { "PartColor",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775         };
776
777         /* [Photograph] matching table */
778         static conf_info_table conf_ctrl_photograph_table[] = {
779                 { "LensInit",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780                 { "DigitalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
781                 { "OpticalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
782                 { "FocusMode",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
783                 { "AFType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
784                 { "AEType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
785                 { "ExposureValue",        CONFIGURE_VALUE_INT_RANGE, {NULL} },
786                 { "FNumber",              CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787                 { "ShutterSpeed",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788                 { "ISO",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
789                 { "ProgramMode",          CONFIGURE_VALUE_INT_ARRAY, {NULL} },
790                 { "AntiHandshake",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
791                 { "VideoStabilization",   CONFIGURE_VALUE_INT_ARRAY, {NULL} },
792                 { "FaceZoomMode",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
793                 { "FaceZoomLevel",        CONFIGURE_VALUE_INT_RANGE, {NULL} },
794         };
795
796         /* [Capture] matching table */
797         static conf_info_table conf_ctrl_capture_table[] = {
798                 { "OutputMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799                 { "JpegQuality",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
800                 { "MultishotNumber",      CONFIGURE_VALUE_INT_RANGE, {NULL} },
801                 { "SensorEncodedCapture", CONFIGURE_VALUE_INT,       {.value_int = 1} },
802                 { "SupportHDR",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803                 { "SupportZSL",           CONFIGURE_VALUE_INT,       {.value_int = FALSE} },
804         };
805
806         /* [Detect] matching table */
807         static conf_info_table conf_ctrl_detect_table[] = {
808                 { "DetectMode",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809                 { "DetectNumber",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
810                 { "DetectSelect",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
811                 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
812         };
813
814         if (hcamcorder == NULL) {
815                 _mmcam_dbg_err("handle is NULL");
816                 return;
817         }
818
819         _mmcam_dbg_log("Entered...");
820
821         if (type == CONFIGURE_TYPE_MAIN) {
822                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL]       = conf_main_general_table;
823                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = conf_main_video_input_table;
824                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = conf_main_audio_input_table;
825                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = conf_main_video_output_table;
826                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = conf_main_capture_table;
827                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD]        = conf_main_record_table;
828                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
829                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
830                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
831                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX]           = conf_main_mux_table;
832
833                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL]       = sizeof( conf_main_general_table ) / info_table_size;
834                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = sizeof( conf_main_video_input_table ) / info_table_size;
835                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = sizeof( conf_main_audio_input_table ) / info_table_size;
836                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = sizeof( conf_main_video_output_table ) / info_table_size;
837                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = sizeof( conf_main_capture_table ) / info_table_size;
838                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD]        = sizeof( conf_main_record_table ) / info_table_size;
839                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
840                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
841                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
842                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX]           = sizeof( conf_main_mux_table ) / info_table_size;
843
844                 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
845
846                 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
847                         (*configure_info)->info[i]      = NULL;
848                 }
849         } else {
850                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA]     = conf_ctrl_camera_table;
851                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE]     = conf_ctrl_strobe_table;
852                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT]     = conf_ctrl_effect_table;
853                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
854                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = conf_ctrl_capture_table;
855                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT]     = conf_ctrl_detect_table;
856
857                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA]     = sizeof( conf_ctrl_camera_table ) / info_table_size;
858                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE]     = sizeof( conf_ctrl_strobe_table ) / info_table_size;
859                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT]     = sizeof( conf_ctrl_effect_table ) / info_table_size;
860                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
861                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = sizeof( conf_ctrl_capture_table ) / info_table_size;
862                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT]     = sizeof( conf_ctrl_detect_table ) / info_table_size;
863
864                 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
865
866                 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
867                         (*configure_info)->info[i] = NULL;
868                 }
869         }
870
871         _mmcam_dbg_log("Done.");
872
873         return;
874 }
875
876
877 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
878 {
879         int ret         = MM_ERROR_NONE;
880         FILE* fd        = NULL;
881         char* conf_path = NULL;
882
883         _mmcam_dbg_log( "Opening...[%s]", ConfFile );
884
885         mmf_return_val_if_fail( ConfFile, FALSE );
886
887         conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
888
889         if( conf_path == NULL )
890         {
891                 _mmcam_dbg_err( "malloc failed." );
892                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
893         }
894
895         snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
896         _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
897
898         fd = fopen( conf_path, "r" );
899         if( fd == NULL )
900         {
901                 _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
902                 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
903                 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
904                 fd = fopen( conf_path, "r" );
905                 if( fd == NULL )
906                 {
907                         _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
908                 }
909         }
910
911         if( fd != NULL )
912         {
913                 ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
914                 fclose( fd );
915         }
916         else
917         {
918                 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
919         }
920
921         if( conf_path != NULL )
922         {
923                 free( conf_path );
924                 conf_path = NULL;
925         }
926
927         _mmcam_dbg_log( "Leave..." );
928
929         return ret;
930 }
931
932 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
933 {
934         const unsigned int BUFFER_NUM_DETAILS = 256;
935         const unsigned int BUFFER_NUM_TOKEN = 20;
936         size_t BUFFER_LENGTH_STRING = 256;
937         const char* delimiters = " |=,\t\n";
938
939         int category = 0;
940         int count_main_category = 0;
941         int count_details = 0;
942         int length_read = 0;
943         int count_token = 0;
944         int read_main = 0;
945
946         char *buffer_string = NULL;
947         char *buffer_details[BUFFER_NUM_DETAILS];
948         char *buffer_token[BUFFER_NUM_TOKEN];
949         char *token = NULL;
950         char *category_name = NULL;
951         char *detail_string = NULL;
952         char *user_ptr = NULL;
953
954         _mmcam_dbg_log( "" );
955
956         camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
957         if (new_conf == NULL) {
958                 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
959                 *configure_info = NULL;
960                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
961         }
962
963         buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
964         if (buffer_string == NULL) {
965                 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
966                 *configure_info = NULL;
967                 g_free(new_conf);
968                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
969         }
970
971         new_conf->type  = type;
972         *configure_info = new_conf;
973
974         _mmcamcorder_conf_init(handle, type, &new_conf);
975
976         if (fd == NULL) {
977                 _mmcam_dbg_err("failed file descriptor fail");
978                 *configure_info = NULL;
979                 g_free(buffer_string);
980                 g_free(new_conf);
981                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
982         }
983
984         read_main = 0;
985         count_main_category = 0;
986
987         while( !feof( fd ) )
988         {
989                 if( read_main == 0 )
990                 {
991                         length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
992                         /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
993
994                         count_token = 0;
995                         token = strtok_r( buffer_string, delimiters, &user_ptr );
996
997                         if ((token) && (token[0] == ';') && (length_read > -1))
998                         {
999                                 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1000                                 continue;
1001                         }
1002
1003                         while( token )
1004                         {
1005                                 /*_mmcam_dbg_log( "token : [%s]", token );*/
1006                                 buffer_token[count_token] = token;
1007                                 count_token++;
1008                                 token = strtok_r( NULL, delimiters, &user_ptr );
1009                         }
1010
1011                         if( count_token == 0 )
1012                         {
1013                                 continue;
1014                         }
1015                 }
1016
1017                 read_main = 0;
1018
1019                 /* Comment */
1020                 if( *buffer_token[0] == ';' )
1021                 {
1022                         /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1023                 }
1024                 /* Main Category */
1025                 else if( *buffer_token[0] == '[' )
1026                 {
1027                         category_name = get_new_string( buffer_token[0] );
1028
1029                         count_main_category++;
1030                         count_details = 0;
1031
1032                         while( !feof( fd ) )
1033                         {
1034                                 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1035                                 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1036
1037                                 detail_string = get_new_string( buffer_string );
1038
1039                                 token = strtok_r( buffer_string, delimiters, &user_ptr );
1040
1041                                 if( token && token[0] != ';' && length_read > -1 )
1042                                 {
1043                                         /*_mmcam_dbg_log( "token : [%s]", token );*/
1044                                         if( token[0] == '[' )
1045                                         {
1046                                                 read_main = 1;
1047                                                 buffer_token[0] = token;
1048                                                 SAFE_FREE( detail_string );
1049                                                 break;
1050                                         }
1051
1052                                         buffer_details[count_details++] = detail_string;
1053                                 }
1054                                 else
1055                                 {
1056                                         SAFE_FREE( detail_string );
1057                                 }
1058                         }
1059
1060                         /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1061
1062                         if( count_details == 0 )
1063                         {
1064                                 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1065                                 SAFE_FREE(category_name);
1066                                 continue;
1067                         }
1068
1069                         category = -1;
1070
1071                         /* Details */
1072                         if( type == CONFIGURE_TYPE_MAIN )
1073                         {
1074                                 if( !strcmp( "[General]", category_name ) )
1075                                 {
1076                                         category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1077                                 }
1078                                 else if( !strcmp( "[VideoInput]", category_name ) )
1079                                 {
1080                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1081                                 }
1082                                 else if( !strcmp( "[AudioInput]", category_name ) )
1083                                 {
1084                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1085                                 }
1086                                 else if( !strcmp( "[VideoOutput]", category_name ) )
1087                                 {
1088                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1089                                 }
1090                                 else if( !strcmp( "[Capture]", category_name ) )
1091                                 {
1092                                         category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1093                                 }
1094                                 else if( !strcmp( "[Record]", category_name ) )
1095                                 {
1096                                         category = CONFIGURE_CATEGORY_MAIN_RECORD;
1097                                 }
1098                                 else if( !strcmp( "[VideoEncoder]", category_name ) )
1099                                 {
1100                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1101                                 }
1102                                 else if( !strcmp( "[AudioEncoder]", category_name ) )
1103                                 {
1104                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1105                                 }
1106                                 else if( !strcmp( "[ImageEncoder]", category_name ) )
1107                                 {
1108                                         category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1109                                 }
1110                                 else if( !strcmp( "[Mux]", category_name ) )
1111                                 {
1112                                         category = CONFIGURE_CATEGORY_MAIN_MUX;
1113                                 }
1114                         }
1115                         else
1116                         {
1117                                 if( !strcmp( "[Camera]", category_name ) )
1118                                 {
1119                                         category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1120                                 }
1121                                 else if( !strcmp( "[Strobe]", category_name ) )
1122                                 {
1123                                         category = CONFIGURE_CATEGORY_CTRL_STROBE;
1124                                 }
1125                                 else if( !strcmp( "[Effect]", category_name ) )
1126                                 {
1127                                         category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1128                                 }
1129                                 else if( !strcmp( "[Photograph]", category_name ) )
1130                                 {
1131                                         category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1132                                 }
1133                                 else if( !strcmp( "[Capture]", category_name ) )
1134                                 {
1135                                         category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1136                                 }
1137                                 else if( !strcmp( "[Detect]", category_name ) )
1138                                 {
1139                                         category = CONFIGURE_CATEGORY_CTRL_DETECT;
1140                                 }
1141                         }
1142
1143                         if( category != -1 )
1144                         {
1145                                 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1146                                                 buffer_details, category, count_details );
1147                         }
1148                         else
1149                         {
1150                                 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1151                         }
1152
1153                         // Free memory
1154                         {
1155                                 int i;
1156
1157                                 for( i = 0 ; i < count_details ; i++ )
1158                                 {
1159                                         SAFE_FREE( buffer_details[i] );
1160                                 }
1161                         }
1162                 }
1163
1164                 SAFE_FREE(category_name);
1165         }
1166
1167         //(*configure_info) = new_conf;
1168
1169         SAFE_FREE( buffer_string );
1170
1171         /*_mmcam_dbg_log( "Done." );*/
1172
1173         return MM_ERROR_NONE;
1174 }
1175
1176
1177 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1178 {
1179         int i = 0;
1180         int j = 0;
1181         int k = 0;
1182         int type = CONFIGURE_VALUE_INT;
1183         int count = 0;
1184         int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1185         camera_conf *temp_conf = (*configure_info);
1186
1187         type_int2 *temp_int = NULL;
1188         type_int_range *temp_int_range = NULL;
1189         type_int_array *temp_int_array = NULL;
1190         type_int_pair_array *temp_int_pair_array = NULL;
1191         type_string2 *temp_string = NULL;
1192         type_string_array *temp_string_array = NULL;
1193         type_element2 *temp_element = NULL;
1194
1195         _mmcam_dbg_log("Entered...");
1196
1197         mmf_return_if_fail(temp_conf);
1198
1199         if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1200                 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1201         } else {
1202                 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1203         }
1204
1205         for (i = 0 ; i < category_num ; i++) {
1206                 if (temp_conf->info[i]) {
1207                         for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1208                                 if (temp_conf->info[i]->detail_info[j] == NULL) {
1209                                         continue;
1210                                 }
1211
1212                                 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1213                                         switch (type) {
1214                                         case CONFIGURE_VALUE_INT:
1215                                                 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1216                                                 SAFE_FREE(temp_int->name);
1217                                                 break;
1218                                         case CONFIGURE_VALUE_INT_RANGE:
1219                                                 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1220                                                 SAFE_FREE(temp_int_range->name);
1221                                                 break;
1222                                         case CONFIGURE_VALUE_INT_ARRAY:
1223                                                 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1224                                                 SAFE_FREE(temp_int_array->name);
1225                                                 SAFE_FREE(temp_int_array->value);
1226                                                 break;
1227                                         case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1228                                                 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1229                                                 SAFE_FREE(temp_int_pair_array->name);
1230                                                 SAFE_FREE(temp_int_pair_array->value[0]);
1231                                                 SAFE_FREE(temp_int_pair_array->value[1]);
1232                                                 break;
1233                                         case CONFIGURE_VALUE_STRING:
1234                                                 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1235                                                 SAFE_FREE(temp_string->name);
1236                                                 SAFE_FREE(temp_string->value);
1237                                                 break;
1238                                         case CONFIGURE_VALUE_STRING_ARRAY:
1239                                                 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1240                                                 SAFE_FREE(temp_string_array->name);
1241                                                 if (temp_string_array->value) {
1242                                                         count = temp_string_array->count;
1243                                                         for (k = 0 ; k < count ; k++) {
1244                                                                 SAFE_FREE(temp_string_array->value[k]);
1245                                                         }
1246                                                         g_free(temp_string_array->value);
1247                                                         temp_string_array->value = NULL;
1248                                                 }
1249                                                 SAFE_FREE(temp_string_array->default_value);
1250                                                 break;
1251                                         case CONFIGURE_VALUE_ELEMENT:
1252                                                 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1253                                                 SAFE_FREE(temp_element->name);
1254                                                 SAFE_FREE(temp_element->element_name);
1255
1256                                                 if (temp_element->value_int) {
1257                                                         count = temp_element->count_int;
1258                                                         for (k = 0 ; k < count ; k++) {
1259                                                                 SAFE_FREE(temp_element->value_int[k]->name);
1260                                                                 SAFE_FREE(temp_element->value_int[k]);
1261                                                         }
1262                                                         g_free(temp_element->value_int);
1263                                                 }
1264
1265                                                 if (temp_element->value_string) {
1266                                                         count = temp_element->count_string;
1267                                                         for (k = 0 ; k < count ; k++) {
1268                                                                 SAFE_FREE(temp_element->value_string[k]->name);
1269                                                                 SAFE_FREE(temp_element->value_string[k]->value);
1270                                                                 SAFE_FREE(temp_element->value_string[k]);
1271                                                         }
1272                                                         g_free(temp_element->value_string);
1273                                                 }
1274                                                 break;
1275                                         default:
1276                                                 _mmcam_dbg_warn("unknown type %d", type);
1277                                                 break;
1278                                         }
1279                                 }
1280
1281                                 SAFE_FREE(temp_conf->info[i]->detail_info[j]);
1282                                 temp_conf->info[i]->detail_info[j] = NULL;
1283                         }
1284
1285                         SAFE_FREE(temp_conf->info[i]->detail_info);
1286                         temp_conf->info[i]->detail_info = NULL;
1287
1288                         SAFE_FREE(temp_conf->info[i]);
1289                         temp_conf->info[i] = NULL;
1290                 }
1291         }
1292
1293         SAFE_FREE((*configure_info)->info);
1294         SAFE_FREE((*configure_info));
1295
1296         _mmcam_dbg_log("Done.");
1297 }
1298
1299 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1300 {
1301         int i = 0;
1302         int count_value = 0;
1303
1304         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1305
1306         if (hcamcorder == NULL) {
1307                 _mmcam_dbg_err("handle is NULL");
1308                 return FALSE;
1309         }
1310
1311         /*_mmcam_dbg_log( "Entered..." );*/
1312
1313         mmf_return_val_if_fail( name, FALSE );
1314
1315         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1316         {
1317                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1318                 return FALSE;
1319         }
1320
1321         /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1322
1323         if( type == CONFIGURE_TYPE_MAIN )
1324         {
1325                 for( i = 0 ; i < count_value ; i++ )
1326                 {
1327                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1328                         {
1329                                 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1330                                 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1331                                 return TRUE;
1332                         }
1333                 }
1334         }
1335         else
1336         {
1337                 for( i = 0 ; i < count_value ; i++ )
1338                 {
1339                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1340                         {
1341                                 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1342                                 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1343                                 return TRUE;
1344                         }
1345                 }
1346         }
1347
1348         return FALSE;
1349 }
1350
1351
1352 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1353 {
1354         const int BUFFER_NUM_TOKEN = 256;
1355
1356         int i = 0;
1357         int j = 0;
1358         int count_token;
1359         int value_type;
1360         char *token = NULL;
1361         char *buffer_token[BUFFER_NUM_TOKEN];
1362         char *user_ptr = NULL;
1363
1364         const char *delimiters     = " |=,\t\n";
1365         const char *delimiters_sub = " |\t\n";
1366         const char *delimiters_3rd = "|\n";
1367
1368         mmf_return_val_if_fail( buffer_details, FALSE );
1369
1370         (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1371         if (*info == NULL) {
1372                 _mmcam_dbg_err("allocation failed");
1373                 return FALSE;
1374         }
1375         (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1376         (*info)->count = count_details;
1377
1378         for ( i = 0 ; i < count_details ; i++ ) {
1379                 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1380                 count_token = 0;
1381                 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1382
1383                 if (token) {
1384                         buffer_token[count_token] = token;
1385                         count_token++;
1386                 } else {
1387                         (*info)->detail_info[i] = NULL;
1388                         _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1389                         continue;
1390                 }
1391
1392                 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1393                         (*info)->detail_info[i] = NULL;
1394                         _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1395                         continue;
1396                 }
1397
1398                 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1399                         token = strtok_r( NULL, delimiters, &user_ptr );
1400                         while (token) {
1401                                 buffer_token[count_token] = token;
1402                                 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1403                                 count_token++;
1404                                 token = strtok_r( NULL, delimiters, &user_ptr );
1405                         }
1406
1407                         if (count_token < 2) {
1408                                 (*info)->detail_info[i] = NULL;
1409                                 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1410                                 continue;
1411                         }
1412                 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1413                         /* skip "=" */
1414                         strtok_r( NULL, delimiters_sub, &user_ptr );
1415
1416                         if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1417                                 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1418                                 while (token) {
1419                                         buffer_token[count_token] = token;
1420                                         /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1421                                         count_token++;
1422                                         token = strtok_r( NULL, delimiters_sub, &user_ptr );
1423                                 }
1424                         } else { /* CONFIGURE_VALUE_STRING */
1425                                 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1426                                 if (token) {
1427                                         g_strchug( token );
1428                                         buffer_token[count_token] = token;
1429                                         /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1430                                         count_token++;
1431                                 }
1432                         }
1433
1434                         if (count_token < 2) {
1435                                 (*info)->detail_info[i] = NULL;
1436                                 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1437                                 continue;
1438                         }
1439                 }
1440
1441                 switch (value_type)
1442                 {
1443                         case CONFIGURE_VALUE_INT:
1444                         {
1445                                 type_int2* new_int;
1446
1447                                 new_int        = (type_int2*)g_malloc0( sizeof(type_int2) );
1448                                 if ( new_int == NULL ) {
1449                                         _mmcam_dbg_err("allocation failed");
1450                                         break;
1451                                 }
1452                                 new_int->name  = get_new_string( buffer_token[0] );
1453                                 new_int->value = atoi( buffer_token[1] );
1454                                 (*info)->detail_info[i] = (void*)new_int;
1455                                 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1456                                 break;
1457                         }
1458                         case CONFIGURE_VALUE_INT_RANGE:
1459                         {
1460                                 type_int_range* new_int_range;
1461
1462                                 new_int_range                = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1463                                 if ( new_int_range == NULL ) {
1464                                         _mmcam_dbg_err("allocation failed");
1465                                         break;
1466                                 }
1467                                 new_int_range->name          = get_new_string( buffer_token[0] );
1468                                 new_int_range->min           = atoi( buffer_token[1] );
1469                                 new_int_range->max           = atoi( buffer_token[2] );
1470                                 new_int_range->default_value = atoi( buffer_token[3] );
1471                                 (*info)->detail_info[i]      = (void*)new_int_range;
1472                                 /*
1473                                 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1474                                                 new_int_range->name,
1475                                                 new_int_range->min,
1476                                                 new_int_range->max,
1477                                                 new_int_range->default_value);
1478                                 */
1479                                 break;
1480                         }
1481                         case CONFIGURE_VALUE_INT_ARRAY:
1482                         {
1483                                 int count_value = count_token - 2;
1484                                 type_int_array* new_int_array;
1485
1486                                 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1487                                 if (new_int_array == NULL) {
1488                                         _mmcam_dbg_err("allocation failed");
1489                                         break;
1490                                 }
1491                                 new_int_array->name = get_new_string( buffer_token[0] );
1492                                 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1493                                 if (new_int_array->value == NULL) {
1494                                         if (new_int_array->name) {
1495                                                 free(new_int_array->name);
1496                                                 new_int_array->name = NULL;
1497                                         }
1498                                         free(new_int_array);
1499                                         new_int_array = NULL;
1500                                         _mmcam_dbg_err("allocation failed");
1501                                         break;
1502                                 }
1503                                 new_int_array->count = count_value;
1504
1505                                 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1506                                 for ( j = 0 ; j < count_value ; j++ ) {
1507                                         new_int_array->value[j] = atoi( buffer_token[j+1] );
1508                                         /*_mmcam_dbg_log("   index[%d] - value[%d]", j, new_int_array->value[j]);*/
1509                                 }
1510
1511                                 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1512                                 /*_mmcam_dbg_log("   default value[%d]", new_int_array->default_value);*/
1513
1514                                 (*info)->detail_info[i] = (void*)new_int_array;
1515                                 break;
1516                         }
1517                         case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1518                         {
1519                                 int count_value = ( count_token - 3 ) >> 1;
1520                                 type_int_pair_array* new_int_pair_array;
1521
1522                                 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1523                                 if ( new_int_pair_array == NULL ) {
1524                                         _mmcam_dbg_err("allocation failed");
1525                                         break;
1526                                 }
1527                                 new_int_pair_array->name     = get_new_string( buffer_token[0] );
1528                                 new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
1529                                 if ( new_int_pair_array->value[0] == NULL ) {
1530                                         if (new_int_pair_array->name) {
1531                                                 free( new_int_pair_array->name );
1532                                                 new_int_pair_array->name = NULL;
1533                                         }
1534                                         free( new_int_pair_array );
1535                                         new_int_pair_array = NULL;
1536                                         _mmcam_dbg_err("allocation failed");
1537                                         break;
1538                                 }
1539                                 new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) );
1540                                 if ( new_int_pair_array->value[1] == NULL ) {
1541                                         free( new_int_pair_array->value[0] );
1542                                         new_int_pair_array->value[0] = NULL;
1543                                         if (new_int_pair_array->name) {
1544                                                 free( new_int_pair_array->name );
1545                                                 new_int_pair_array->name = NULL;
1546                                         }
1547                                         free( new_int_pair_array );
1548                                         new_int_pair_array = NULL;
1549                                         _mmcam_dbg_err("allocation failed");
1550                                         break;
1551                                 }
1552                                 new_int_pair_array->count    = count_value;
1553
1554                                 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1555                                 for ( j = 0 ; j < count_value ; j++ ) {
1556                                         new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1557                                         new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1558                                         /*
1559                                         _mmcam_dbg_log("   index[%d] - value[%d,%d]", j,
1560                                                         new_int_pair_array->value[0][j],
1561                                                         new_int_pair_array->value[1][j]);
1562                                         */
1563                                 }
1564
1565                                 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1566                                 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1567                                 /*
1568                                 _mmcam_dbg_log("   default value[%d,%d]",
1569                                                 new_int_pair_array->default_value[0],
1570                                                 new_int_pair_array->default_value[1]);
1571                                 */
1572                                 (*info)->detail_info[i] = (void*)new_int_pair_array;
1573                                 break;
1574                         }
1575                         case CONFIGURE_VALUE_STRING:
1576                         {
1577                                 type_string2* new_string;
1578
1579                                 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1580                                 if (new_string == NULL) {
1581                                         _mmcam_dbg_err("allocation failed");
1582                                         break;
1583                                 }
1584                                 new_string->name  = get_new_string( buffer_token[0] );
1585                                 new_string->value = get_new_string( buffer_token[1] );
1586                                 (*info)->detail_info[i] = (void*)new_string;
1587
1588                                 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1589                                 break;
1590                         }
1591                         case CONFIGURE_VALUE_STRING_ARRAY:
1592                         {
1593                                 int count_value = count_token - 2;
1594                                 type_string_array* new_string_array;
1595
1596                                 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1597                                 if ( new_string_array == NULL ) {
1598                                         break;
1599                                 }
1600                                 new_string_array->name  = get_new_string( buffer_token[0] );
1601                                 new_string_array->count = count_value;
1602                                 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1603                                 if ( new_string_array->value == NULL ) {
1604                                         if (new_string_array->name) {
1605                                                 free(new_string_array->name);
1606                                                 new_string_array->name = NULL;
1607                                         }
1608                                         free(new_string_array);
1609                                         new_string_array = NULL;
1610                                         _mmcam_dbg_err("allocation failed");
1611                                         break;
1612                                 }
1613                                 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1614                                 for ( j = 0 ; j < count_value ; j++ ) {
1615                                         new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1616                                         /*_mmcam_dbg_log("   index[%d] - value[%s]", j, new_string_array->value[j]);*/
1617                                 }
1618
1619                                 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1620                                 /*_mmcam_dbg_log("   default value[%s]", new_string_array->default_value);*/
1621                                 (*info)->detail_info[i] = (void*)new_string_array;
1622                                 break;
1623                         }
1624                         case CONFIGURE_VALUE_ELEMENT:
1625                         {
1626                                 type_element2* new_element;
1627
1628                                 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1629                                 if ( new_element == NULL ) {
1630                                         _mmcam_dbg_err("allocation failed");
1631                                         break;
1632                                 }
1633                                 new_element->name         = get_new_string( buffer_token[0] );
1634                                 new_element->element_name = get_new_string( buffer_token[1] );
1635                                 new_element->count_int    = atoi( buffer_token[2] );
1636                                 new_element->value_int    = NULL;
1637                                 new_element->count_string = atoi( buffer_token[3] );
1638                                 new_element->value_string = NULL;
1639                                 /*
1640                                 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1641                                                new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1642                                 */
1643
1644                                 /* add int values */
1645                                 if ( new_element->count_int > 0 ) {
1646                                         new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1647                                         if ( new_element->value_int) {
1648                                                 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1649                                                         new_element->value_int[j]        = (type_int2*)g_malloc( sizeof(type_int2) );
1650                                                         if ( new_element->value_int[j] ) {
1651                                                                 new_element->value_int[j]->name  = get_new_string( buffer_token[4+(j<<1)] );
1652                                                                 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1653                                                         } else {
1654                                                                 _mmcam_dbg_err("allocation failed");
1655                                                         }
1656                                                         /*
1657                                                         _mmcam_dbg_log("   Element INT[%d] - name[%s],value[%d]",
1658                                                                        j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1659                                                         */
1660                                                 }
1661                                         } else {
1662                                                 _mmcam_dbg_err("allocation failed");
1663                                         }
1664                                 }
1665                                 else
1666                                 {
1667                                         new_element->value_int = NULL;
1668                                 }
1669
1670                                 /* add string values */
1671                                 if ( new_element->count_string > 0 ) {
1672                                         new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1673                                         if (new_element->value_string) {
1674                                                 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1675                                                         new_element->value_string[j-new_element->count_int]     = (type_string2*)g_malloc0( sizeof(type_string2) );
1676                                                         if(new_element->value_string[j-new_element->count_int]) {
1677                                                                 new_element->value_string[j-new_element->count_int]->name       = get_new_string( buffer_token[4+(j<<1)] );
1678                                                                 new_element->value_string[j-new_element->count_int]->value      = get_new_string( buffer_token[5+(j<<1)] );
1679                                                                 /*
1680                                                                 _mmcam_dbg_log("   Element STRING[%d] - name[%s],value[%s]",
1681                                                                                j-new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value);
1682                                                                 */
1683                                                         } else {
1684                                                                 _mmcam_dbg_err("allocation failed");
1685                                                         }
1686                                                 }
1687                                         } else {
1688                                                 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1689                                         }
1690                                 } else {
1691                                         new_element->value_string = NULL;
1692                                 }
1693
1694                                 (*info)->detail_info[i] = (void*)new_element;
1695                                 break;
1696                         }
1697                         default:
1698                                 break;
1699                 }
1700         }
1701
1702         return TRUE;
1703 }
1704
1705
1706 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1707 {
1708         int i, count;
1709         conf_detail* info;
1710
1711         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1712
1713         mmf_return_val_if_fail( configure_info, FALSE );
1714         mmf_return_val_if_fail( name, FALSE );
1715
1716         if( configure_info->info[category] )
1717         {
1718                 count = configure_info->info[category]->count;
1719                 info = configure_info->info[category];
1720
1721                 for( i = 0 ; i < count ; i++ )
1722                 {
1723                         if( info->detail_info[i] == NULL )
1724                         {
1725                                 continue;
1726                         }
1727
1728                         if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1729                         {
1730                                 *value = ((type_int*)(info->detail_info[i]))->value;
1731                                 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1732                                 return TRUE;
1733                         }
1734                 }
1735         }
1736
1737         if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1738         {
1739                 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1740                 return TRUE;
1741         }
1742
1743         _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1744
1745         return FALSE;
1746 }
1747
1748 int
1749 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1750 {
1751         int i, count;
1752         conf_detail* info;
1753
1754         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1755
1756         mmf_return_val_if_fail( configure_info, FALSE );
1757         mmf_return_val_if_fail( name, FALSE );
1758
1759         if( configure_info->info[category] )
1760         {
1761                 count = configure_info->info[category]->count;
1762                 info = configure_info->info[category];
1763
1764                 for( i = 0 ; i < count ; i++ )
1765                 {
1766                         if( info->detail_info[i] == NULL )
1767                         {
1768                                 continue;
1769                         }
1770
1771                         if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1772                         {
1773                                 *value = (type_int_range*)(info->detail_info[i]);
1774                                 /*
1775                                 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1776                                                 name, (*value)->min, (*value)->max, (*value)->default_value );
1777                                 */
1778                                 return TRUE;
1779                         }
1780                 }
1781         }
1782
1783         *value = NULL;
1784
1785         /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1786
1787         return FALSE;
1788 }
1789
1790 int
1791 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1792 {
1793         int i, count;
1794         conf_detail* info;
1795
1796         /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1797
1798         mmf_return_val_if_fail( configure_info, FALSE );
1799         mmf_return_val_if_fail( name, FALSE );
1800
1801         if( configure_info->info[category] )
1802         {
1803                 count   = configure_info->info[category]->count;
1804                 info    = configure_info->info[category];
1805
1806                 for( i = 0 ; i < count ; i++ )
1807                 {
1808                         if( info->detail_info[i] == NULL )
1809                         {
1810                                 continue;
1811                         }
1812
1813                         if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1814                         {
1815                                 *value = (type_int_array*)(info->detail_info[i]);
1816                                 /*
1817                                 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1818                                                 name, (*value)->value, (*value)->count, (*value)->default_value );
1819                                 */
1820                                 return TRUE;
1821                         }
1822                 }
1823         }
1824
1825         *value = NULL;
1826
1827         /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1828
1829         return FALSE;
1830 }
1831
1832 int
1833 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1834 {
1835         int i, count;
1836         conf_detail* info;
1837
1838         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1839
1840         mmf_return_val_if_fail( configure_info, FALSE );
1841         mmf_return_val_if_fail( name, FALSE );
1842
1843         if( configure_info->info[category] )
1844         {
1845                 count = configure_info->info[category]->count;
1846                 info = configure_info->info[category];
1847
1848                 for( i = 0 ; i < count ; i++ )
1849                 {
1850                         if( info->detail_info[i] == NULL )
1851                         {
1852                                 continue;
1853                         }
1854
1855                         if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1856                         {
1857                                 *value = (type_int_pair_array*)(info->detail_info[i]);
1858                                 /*
1859                                 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1860                                                 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1861                                                 (*value)->default_value[0], (*value)->default_value[1] );
1862                                 */
1863                                 return TRUE;
1864                         }
1865                 }
1866         }
1867
1868         *value = NULL;
1869
1870         _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1871
1872         return FALSE;
1873 }
1874
1875 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1876 {
1877         int i, count;
1878         conf_detail* info;
1879
1880         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1881
1882         mmf_return_val_if_fail( configure_info, FALSE );
1883         mmf_return_val_if_fail( name, FALSE );
1884
1885         if( configure_info->info[category] )
1886         {
1887                 count = configure_info->info[category]->count;
1888                 info = configure_info->info[category];
1889
1890                 for( i = 0 ; i < count ; i++ )
1891                 {
1892                         if( info->detail_info[i] == NULL )
1893                         {
1894                                 continue;
1895                         }
1896
1897                         if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1898                         {
1899                                 *value = ((type_string*)(info->detail_info[i]))->value;
1900                                 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1901                                 return TRUE;
1902                         }
1903                 }
1904         }
1905
1906         if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1907         {
1908                 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1909                 return TRUE;
1910         }
1911
1912         _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1913
1914         return FALSE;
1915 }
1916
1917 int
1918 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1919 {
1920         int i, count;
1921         conf_detail* info;
1922
1923         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1924
1925         mmf_return_val_if_fail( configure_info, FALSE );
1926         mmf_return_val_if_fail( name, FALSE );
1927
1928         if( configure_info->info[category] )
1929         {
1930                 count = configure_info->info[category]->count;
1931                 info = configure_info->info[category];
1932
1933                 for( i = 0 ; i < count ; i++ )
1934                 {
1935                         if( info->detail_info[i] == NULL )
1936                         {
1937                                 continue;
1938                         }
1939
1940                         if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1941                         {
1942                                 *value = (type_string_array*)(info->detail_info[i]);
1943                                 /*
1944                                 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1945                                                 name, (*value)->value, (*value)->count, (*value)->default_value );
1946                                 */
1947                                 return TRUE;
1948                         }
1949                 }
1950         }
1951
1952         *value = NULL;
1953
1954         /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1955
1956         return FALSE;
1957 }
1958
1959 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1960 {
1961         int i, count;
1962         conf_detail* info;
1963
1964         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1965
1966         mmf_return_val_if_fail( configure_info, FALSE );
1967         mmf_return_val_if_fail( name, FALSE );
1968
1969         if( configure_info->info[category] )
1970         {
1971                 count = configure_info->info[category]->count;
1972                 info = configure_info->info[category];
1973
1974                 for( i = 0 ; i < count ; i++ )
1975                 {
1976                         if( info->detail_info[i] == NULL )
1977                         {
1978                                 continue;
1979                         }
1980
1981                         if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1982                         {
1983                                 *element = (type_element*)(info->detail_info[i]);
1984                                 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1985                                 return TRUE;
1986                         }
1987                 }
1988         }
1989
1990         if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1991         {
1992                 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1993                 return TRUE;
1994         }
1995
1996         _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
1997
1998         return FALSE;
1999 }
2000
2001 int
2002 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2003 {
2004         //_mmcam_dbg_log( "Entered..." );
2005
2006         mmf_return_val_if_fail( element, FALSE );
2007
2008         *value = element->element_name;
2009
2010         //_mmcam_dbg_log( "Get element name : [%s]", *value );
2011
2012         return TRUE;
2013 }
2014
2015 int
2016 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2017 {
2018         int i;
2019
2020         //_mmcam_dbg_log( "Entered..." );
2021
2022         mmf_return_val_if_fail( element, FALSE );
2023         mmf_return_val_if_fail( name, FALSE );
2024
2025         for( i = 0 ; i < element->count_int ; i++ )
2026         {
2027                 if( !strcmp( element->value_int[i]->name , name ) )
2028                 {
2029                         *value = element->value_int[i]->value;
2030                         //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2031                         return TRUE;
2032                 }
2033         }
2034
2035         _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2036                 element->name, name, element->count_int );
2037
2038         return FALSE;
2039 }
2040
2041 int
2042 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2043 {
2044         int i;
2045
2046         //_mmcam_dbg_log( "Entered..." );
2047
2048         mmf_return_val_if_fail( element, FALSE );
2049         mmf_return_val_if_fail( name, FALSE );
2050
2051         for( i = 0 ; i < element->count_string ; i++ )
2052         {
2053                 if( !strcmp( element->value_string[i]->name , name ) )
2054                 {
2055                         *value = element->value_string[i]->value;
2056                         //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2057                         return TRUE;
2058                 }
2059         }
2060
2061         _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2062                 element->name, name, element->count_string );
2063
2064         return FALSE;
2065 }
2066
2067 int
2068 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2069 {
2070         int i;
2071
2072         //_mmcam_dbg_log( "Entered..." );
2073
2074         mmf_return_val_if_fail( gst, FALSE );
2075         mmf_return_val_if_fail( element, FALSE );
2076
2077         if( element->count_int == 0 )
2078         {
2079                 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2080         }
2081         else
2082         {
2083                 if( element->value_int == NULL )
2084                 {
2085                         _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2086                         return FALSE;
2087                 }
2088
2089                 for( i = 0 ; i < element->count_int ; i++ )
2090                 {
2091                         MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2092
2093                         /*
2094                         _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2095                                 element->element_name,
2096                                 element->value_int[i]->name,
2097                                 element->value_int[i]->value );
2098                                 */
2099                 }
2100         }
2101
2102         if( element->count_string == 0 )
2103         {
2104                 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2105         }
2106         else
2107         {
2108                 if( element->value_string == NULL )
2109                 {
2110                         _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2111                         return FALSE;
2112                 }
2113
2114                 for( i = 0 ; i < element->count_string ; i++ )
2115                 {
2116                         MMCAMCORDER_G_OBJECT_SET( gst, element->value_string[i]->name, element->value_string[i]->value );
2117
2118                         _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2119                                 element->element_name,
2120                                 element->value_string[i]->name,
2121                                 element->value_string[i]->value );
2122                 }
2123         }
2124
2125         //_mmcam_dbg_log( "Done." );
2126
2127         return TRUE;
2128 }
2129
2130 int
2131 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2132 {
2133         int i = 0;
2134         int count_value = 0;
2135
2136         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2137
2138         if (hcamcorder == NULL) {
2139                 _mmcam_dbg_err("handle is NULL");
2140                 return FALSE;
2141         }
2142
2143         //_mmcam_dbg_log( "Entered..." );
2144
2145         mmf_return_val_if_fail( name, FALSE );
2146
2147         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2148         {
2149                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2150                 return FALSE;
2151         }
2152
2153         if( type == CONFIGURE_TYPE_MAIN )
2154         {
2155                 for( i = 0 ; i < count_value ; i++ )
2156                 {
2157                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2158                         {
2159                                 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2160                                 return TRUE;
2161                         }
2162                 }
2163         }
2164         else
2165         {
2166                 for( i = 0 ; i < count_value ; i++ )
2167                 {
2168                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2169                         {
2170                                 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2171                                 return TRUE;
2172                         }
2173                 }
2174         }
2175
2176         _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2177
2178         return FALSE;
2179 }
2180
2181 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2182 {
2183         int i = 0;
2184         int count_value = 0;
2185
2186         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2187
2188         if (hcamcorder == NULL) {
2189                 _mmcam_dbg_err("handle is NULL");
2190                 return FALSE;
2191         }
2192
2193         //_mmcam_dbg_log( "Entered..." );
2194
2195         mmf_return_val_if_fail( name, FALSE );
2196
2197         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2198         {
2199                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2200                 return FALSE;
2201         }
2202
2203         if( type == CONFIGURE_TYPE_MAIN )
2204         {
2205                 for( i = 0 ; i < count_value ; i++ )
2206                 {
2207                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2208                         {
2209                                 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2210                                 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2211                                 return TRUE;
2212                         }
2213                 }
2214         }
2215         else
2216         {
2217                 for( i = 0 ; i < count_value ; i++ )
2218                 {
2219                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2220                         {
2221                                 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2222                                 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2223                                 return TRUE;
2224                         }
2225                 }
2226         }
2227
2228         _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2229
2230         return FALSE;
2231 }
2232
2233 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2234 {
2235         int i = 0;
2236         int count_value = 0;
2237
2238         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2239
2240         if (hcamcorder == NULL) {
2241                 _mmcam_dbg_err("handle is NULL");
2242                 return FALSE;
2243         }
2244
2245         //_mmcam_dbg_log( "Entered..." );
2246
2247         mmf_return_val_if_fail( name, FALSE );
2248
2249         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2250         {
2251                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2252                 return FALSE;
2253         }
2254
2255         if( type == CONFIGURE_TYPE_MAIN )
2256         {
2257                 for( i = 0 ; i < count_value ; i++ )
2258                 {
2259                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2260                         {
2261                                 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2262                                 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2263                                 return TRUE;
2264                         }
2265                 }
2266         }
2267         else
2268         {
2269                 for( i = 0 ; i < count_value ; i++ )
2270                 {
2271                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2272                         {
2273                                 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2274                                 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2275                                 return TRUE;
2276                         }
2277                 }
2278         }
2279
2280         _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2281
2282         return FALSE;
2283 }
2284
2285 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2286 {
2287         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2288
2289         if (hcamcorder == NULL) {
2290                 _mmcam_dbg_err("handle is NULL");
2291                 return FALSE;
2292         }
2293
2294 //      mmf_return_val_if_fail( conf_main_category_size, FALSE );
2295 //      mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2296
2297         if( type == CONFIGURE_TYPE_MAIN )
2298         {
2299                 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2300
2301                 *size = (int)hcamcorder->conf_main_category_size[category];
2302         }
2303         else
2304         {
2305                 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2306
2307                 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2308         }
2309
2310         return TRUE;
2311 }
2312
2313 void
2314 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2315 {
2316         int i, j, k, type, category_type;
2317
2318         type_int                *temp_int;
2319         type_int_range          *temp_int_range;
2320         type_int_array          *temp_int_array;
2321         type_int_pair_array     *temp_int_pair_array;
2322         type_string             *temp_string;
2323         type_element            *temp_element;
2324
2325         g_print( "[ConfigureInfoPrint] : Entered.\n" );
2326
2327         mmf_return_if_fail( *configure_info );
2328
2329         if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2330         {
2331                 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2332         }
2333         else
2334         {
2335                 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2336         }
2337
2338         for( i = 0 ; i < category_type ; i++ )
2339         {
2340                 if( (*configure_info)->info[i] )
2341                 {
2342                         g_print( "[ConfigureInfo] : Category [%d]\n", i );
2343                         for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2344                         {
2345                                 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2346                                 {
2347                                         switch( type )
2348                                         {
2349                                                 case CONFIGURE_VALUE_INT:
2350                                                         temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2351                                                         g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2352                                                         break;
2353                                                 case CONFIGURE_VALUE_INT_RANGE:
2354                                                         temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2355                                                         g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2356                                                                  temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2357                                                         break;
2358                                                 case CONFIGURE_VALUE_INT_ARRAY:
2359                                                         temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2360                                                         g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n                            - ",
2361                                                                  temp_int_array->name, temp_int_array->default_value );
2362                                                         for( k = 0 ; k < temp_int_array->count ; k++ )
2363                                                         {
2364                                                                 g_print( "[%d] ", temp_int_array->value[k] );
2365                                                         }
2366                                                         g_print( "\n" );
2367                                                         break;
2368                                                 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2369                                                         temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2370                                                         g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n                            - ",
2371                                                                  temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2372                                                         for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2373                                                         {
2374                                                                 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2375                                                         }
2376                                                         g_print( "\n" );
2377                                                         break;
2378                                                 case CONFIGURE_VALUE_STRING:
2379                                                         temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2380                                                         g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2381                                                         break;
2382                                                 case CONFIGURE_VALUE_ELEMENT:
2383                                                         temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2384                                                         g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2385                                                         for( k = 0 ; k < temp_element->count_int ; k++ )
2386                                                         {
2387                                                                 g_print( "                          - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2388                                                         }
2389                                                         for( k = 0 ; k < temp_element->count_string ; k++ )
2390                                                         {
2391                                                                 g_print( "                          - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2392                                                         }
2393                                                         break;
2394                                                 default:
2395                                                         g_print( "[ConfigureInfo] : Not matched value type... So can not print data... check it... Name[%s],type[%d]\n", ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, type );
2396                                                         break;
2397                                         }
2398                                 }
2399                                 else
2400                                 {
2401                                         g_print( "[ConfigureInfo] : Failed to get value type." );
2402                                 }
2403                         }
2404                 }
2405         }
2406
2407         g_print( "[ConfigureInfoPrint] : Done.\n" );
2408 }
2409
2410
2411 static type_element *
2412 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2413 {
2414         type_element *telement = NULL;
2415         const char *codec_type_str = NULL;
2416         int codec_type = MM_AUDIO_CODEC_INVALID;
2417         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2418         _MMCamcorderSubContext *sc = NULL;
2419
2420         mmf_return_val_if_fail(hcamcorder, NULL);
2421         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2422
2423         mmf_return_val_if_fail(sc, NULL);
2424
2425         _mmcam_dbg_log("");
2426
2427         /* Check element availability */
2428         mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2429
2430         switch( codec_type )
2431         {
2432                 case MM_AUDIO_CODEC_AMR:
2433                         codec_type_str = "AMR";
2434                         break;
2435                 case MM_AUDIO_CODEC_G723_1:
2436                         codec_type_str = "G723_1";
2437                         break;
2438                 case MM_AUDIO_CODEC_MP3:
2439                         codec_type_str = "MP3";
2440                         break;
2441                 case MM_AUDIO_CODEC_AAC:
2442                         codec_type_str = "AAC";
2443                         break;
2444                 case MM_AUDIO_CODEC_MMF:
2445                         codec_type_str = "MMF";
2446                         break;
2447                 case MM_AUDIO_CODEC_ADPCM:
2448                         codec_type_str = "ADPCM";
2449                         break;
2450                 case MM_AUDIO_CODEC_WAVE:
2451                         codec_type_str = "WAVE";
2452                         break;
2453                 case MM_AUDIO_CODEC_MIDI:
2454                         codec_type_str = "MIDI";
2455                         break;
2456                 case MM_AUDIO_CODEC_IMELODY:
2457                         codec_type_str = "IMELODY";
2458                         break;
2459                 case MM_AUDIO_CODEC_VORBIS:
2460                         codec_type_str = "VORBIS";
2461                         break;
2462                 default:
2463                         _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2464                         return NULL;
2465         }
2466
2467         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2468                                       CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2469                                       codec_type_str,
2470                                       &telement);
2471
2472         return telement;
2473 }
2474
2475
2476 static type_element *
2477 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2478 {
2479         type_element *telement = NULL;
2480         const char *codec_type_str = NULL;
2481         int codec_type = MM_VIDEO_CODEC_INVALID;
2482         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2483         _MMCamcorderSubContext *sc = NULL;
2484
2485         mmf_return_val_if_fail(hcamcorder, NULL);
2486         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2487
2488         mmf_return_val_if_fail(sc, NULL);
2489
2490         _mmcam_dbg_log("");
2491
2492         /* Check element availability */
2493         mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2494
2495         switch( codec_type )
2496         {
2497                 case MM_VIDEO_CODEC_H263:
2498                         codec_type_str = "H263";
2499                         break;
2500                 case MM_VIDEO_CODEC_H264:
2501                         codec_type_str = "H264";
2502                         break;
2503                 case MM_VIDEO_CODEC_H26L:
2504                         codec_type_str = "H26L";
2505                         break;
2506                 case MM_VIDEO_CODEC_MPEG4:
2507                         codec_type_str = "MPEG4";
2508                         break;
2509                 case MM_VIDEO_CODEC_MPEG1:
2510                         codec_type_str = "MPEG1";
2511                         break;
2512                 case MM_VIDEO_CODEC_THEORA:
2513                         codec_type_str = "THEORA";
2514                         break;
2515                 default:
2516                         _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2517                         return NULL;
2518         }
2519
2520         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2521                                       CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2522                                       codec_type_str,
2523                                       &telement);
2524
2525         return telement;
2526 }
2527
2528
2529 static type_element *
2530 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2531 {
2532         type_element *telement = NULL;
2533         const char *codec_type_str = NULL;
2534         int codec_type = MM_IMAGE_CODEC_INVALID;
2535         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2536         _MMCamcorderSubContext *sc = NULL;
2537
2538         mmf_return_val_if_fail(hcamcorder, NULL);
2539         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2540
2541         mmf_return_val_if_fail(sc, NULL);
2542
2543         _mmcam_dbg_log("");
2544
2545         /* Check element availability */
2546         mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2547
2548         switch( codec_type )
2549         {
2550                 case MM_IMAGE_CODEC_JPEG:
2551                         codec_type_str = "JPEG";
2552                         break;
2553                 case MM_IMAGE_CODEC_SRW:
2554                         codec_type_str = "SRW";
2555                         break;
2556                 case MM_IMAGE_CODEC_JPEG_SRW:
2557                         codec_type_str = "JPEG_SRW";
2558                         break;
2559                 case MM_IMAGE_CODEC_PNG:
2560                         codec_type_str = "PNG";
2561                         break;
2562                 case MM_IMAGE_CODEC_BMP:
2563                         codec_type_str = "BMP";
2564                         break;
2565                 case MM_IMAGE_CODEC_WBMP:
2566                         codec_type_str = "WBMP";
2567                         break;
2568                 case MM_IMAGE_CODEC_TIFF:
2569                         codec_type_str = "TIFF";
2570                         break;
2571                 case MM_IMAGE_CODEC_PCX:
2572                         codec_type_str = "PCX";
2573                         break;
2574                 case MM_IMAGE_CODEC_GIF:
2575                         codec_type_str = "GIF";
2576                         break;
2577                 case MM_IMAGE_CODEC_ICO:
2578                         codec_type_str = "ICO";
2579                         break;
2580                 case MM_IMAGE_CODEC_RAS:
2581                         codec_type_str = "RAS";
2582                         break;
2583                 case MM_IMAGE_CODEC_TGA:
2584                         codec_type_str = "TGA";
2585                         break;
2586                 case MM_IMAGE_CODEC_XBM:
2587                         codec_type_str = "XBM";
2588                         break;
2589                 case MM_IMAGE_CODEC_XPM:
2590                         codec_type_str = "XPM";
2591                         break;
2592                 default:
2593                         _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2594                         return NULL;
2595         }
2596
2597         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2598                                       CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2599                                       codec_type_str,
2600                                       &telement);
2601
2602         return telement;
2603 }
2604
2605
2606 static type_element *
2607 __mmcamcorder_get_file_format_element(MMHandleType handle)
2608 {
2609         type_element *telement = NULL;
2610         const char *mux_type_str = NULL;
2611         int file_type = MM_FILE_FORMAT_INVALID;
2612         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2613         _MMCamcorderSubContext *sc = NULL;
2614
2615         mmf_return_val_if_fail(hcamcorder, NULL);
2616         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2617
2618         mmf_return_val_if_fail(sc, NULL);
2619
2620         _mmcam_dbg_log("");
2621
2622         /* Check element availability */
2623         mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2624
2625         switch( file_type )
2626         {
2627                 case MM_FILE_FORMAT_3GP:
2628                         mux_type_str = "3GP";
2629                         break;
2630                 case MM_FILE_FORMAT_AMR:
2631                         mux_type_str = "AMR";
2632                         break;
2633                 case MM_FILE_FORMAT_MP4:
2634                         mux_type_str = "MP4";
2635                         break;
2636                 case MM_FILE_FORMAT_AAC:
2637                         mux_type_str = "AAC";
2638                         break;
2639                 case MM_FILE_FORMAT_MP3:
2640                         mux_type_str = "MP3";
2641                         break;
2642                 case MM_FILE_FORMAT_OGG:
2643                         mux_type_str = "OGG";
2644                         break;
2645                 case MM_FILE_FORMAT_WAV:
2646                         mux_type_str = "WAV";
2647                         break;
2648                 case MM_FILE_FORMAT_AVI:
2649                         mux_type_str = "AVI";
2650                         break;
2651                 case MM_FILE_FORMAT_WMA:
2652                         mux_type_str = "WMA";
2653                         break;
2654                 case MM_FILE_FORMAT_WMV:
2655                         mux_type_str = "WMV";
2656                         break;
2657                 case MM_FILE_FORMAT_MID:
2658                         mux_type_str = "MID";
2659                         break;
2660                 case MM_FILE_FORMAT_MMF:
2661                         mux_type_str = "MMF";
2662                         break;
2663                 case MM_FILE_FORMAT_MATROSKA:
2664                         mux_type_str = "MATROSKA";
2665                         break;
2666                 case MM_FILE_FORMAT_M2TS:
2667                         mux_type_str = "M2TS";
2668                         break;
2669                 default:
2670                         _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2671                         return NULL;
2672         }
2673
2674         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2675                                       CONFIGURE_CATEGORY_MAIN_MUX,
2676                                       mux_type_str,
2677                                       &telement);
2678
2679         return telement;
2680 }
2681
2682
2683 type_element *
2684 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2685 {
2686         type_element *telement = NULL;
2687
2688         _mmcam_dbg_log("type:%d", type);
2689
2690         switch(type)
2691         {
2692                 case MM_CAM_AUDIO_ENCODER:
2693                         telement = __mmcamcorder_get_audio_codec_element(handle);
2694                         break;
2695                 case MM_CAM_VIDEO_ENCODER:
2696                         telement = __mmcamcorder_get_video_codec_element(handle);
2697                         break;
2698                 case MM_CAM_IMAGE_ENCODER:
2699                         telement = __mmcamcorder_get_image_codec_element(handle);
2700                         break;
2701                 case MM_CAM_FILE_FORMAT:
2702                         telement = __mmcamcorder_get_file_format_element(handle);
2703                         break;
2704                 default :
2705                         _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2706         }
2707
2708         return telement;
2709 }
2710
2711
2712 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2713 {
2714         int codec_index = MM_AUDIO_CODEC_INVALID;
2715
2716         if (!name) {
2717                 _mmcam_dbg_err("name is NULL");
2718                 return MM_AUDIO_CODEC_INVALID;
2719         }
2720
2721         if (!strcmp(name, "AMR")) {
2722                 codec_index = MM_AUDIO_CODEC_AMR;
2723         } else if (!strcmp(name, "G723_1")) {
2724                 codec_index = MM_AUDIO_CODEC_G723_1;
2725         } else if (!strcmp(name, "MP3")) {
2726                 codec_index = MM_AUDIO_CODEC_MP3;
2727         } else if (!strcmp(name, "AAC")) {
2728                 codec_index = MM_AUDIO_CODEC_AAC;
2729         } else if (!strcmp(name, "MMF")) {
2730                 codec_index = MM_AUDIO_CODEC_MMF;
2731         } else if (!strcmp(name, "ADPCM")) {
2732                 codec_index = MM_AUDIO_CODEC_ADPCM;
2733         } else if (!strcmp(name, "WAVE")) {
2734                 codec_index = MM_AUDIO_CODEC_WAVE;
2735         } else if (!strcmp(name, "MIDI")) {
2736                 codec_index = MM_AUDIO_CODEC_MIDI;
2737         } else if (!strcmp(name, "IMELODY")) {
2738                 codec_index = MM_AUDIO_CODEC_IMELODY;
2739         } else if (!strcmp(name, "VORBIS")) {
2740                 codec_index = MM_AUDIO_CODEC_VORBIS;
2741         }
2742
2743         /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2744
2745         return codec_index;
2746 }
2747
2748
2749
2750 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2751 {
2752         int codec_index = MM_VIDEO_CODEC_INVALID;
2753
2754         if (!name) {
2755                 _mmcam_dbg_err("name is NULL");
2756                 return MM_VIDEO_CODEC_INVALID;
2757         }
2758
2759         if (!strcmp(name, "H263")) {
2760                 codec_index = MM_VIDEO_CODEC_H263;
2761         } else if (!strcmp(name, "H264")) {
2762                 codec_index = MM_VIDEO_CODEC_H264;
2763         } else if (!strcmp(name, "H26L")) {
2764                 codec_index = MM_VIDEO_CODEC_H26L;
2765         } else if (!strcmp(name, "MPEG4")) {
2766                 codec_index = MM_VIDEO_CODEC_MPEG4;
2767         } else if (!strcmp(name, "MPEG1")) {
2768                 codec_index = MM_VIDEO_CODEC_MPEG1;
2769         } else if (!strcmp(name, "THEORA")) {
2770                 codec_index = MM_VIDEO_CODEC_THEORA;
2771         }
2772
2773         /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2774
2775         return codec_index;
2776 }
2777
2778
2779
2780 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2781 {
2782         int codec_index = MM_IMAGE_CODEC_INVALID;
2783
2784         if (!name) {
2785                 _mmcam_dbg_err("name is NULL");
2786                 return MM_IMAGE_CODEC_INVALID;
2787         }
2788
2789         if (!strcmp(name, "JPEG")) {
2790                 codec_index = MM_IMAGE_CODEC_JPEG;
2791         } else if (!strcmp(name, "PNG")) {
2792                 codec_index = MM_IMAGE_CODEC_PNG;
2793         } else if (!strcmp(name, "BMP")) {
2794                 codec_index = MM_IMAGE_CODEC_BMP;
2795         } else if (!strcmp(name, "WBMP")) {
2796                 codec_index = MM_IMAGE_CODEC_WBMP;
2797         } else if (!strcmp(name, "TIFF")) {
2798                 codec_index = MM_IMAGE_CODEC_TIFF;
2799         } else if (!strcmp(name, "PCX")) {
2800                 codec_index = MM_IMAGE_CODEC_PCX;
2801         } else if (!strcmp(name, "GIF")) {
2802                 codec_index = MM_IMAGE_CODEC_GIF;
2803         } else if (!strcmp(name, "ICO")) {
2804                 codec_index = MM_IMAGE_CODEC_ICO;
2805         } else if (!strcmp(name, "RAS")) {
2806                 codec_index = MM_IMAGE_CODEC_RAS;
2807         } else if (!strcmp(name, "TGA")) {
2808                 codec_index = MM_IMAGE_CODEC_TGA;
2809         } else if (!strcmp(name, "XBM")) {
2810                 codec_index = MM_IMAGE_CODEC_XBM;
2811         } else if (!strcmp(name, "XPM")) {
2812                 codec_index = MM_IMAGE_CODEC_XPM;
2813         }
2814
2815         _mmcam_dbg_log("image codec index %d", codec_index);
2816
2817         return codec_index;
2818 }
2819
2820
2821 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2822 {
2823         int mux_index = MM_FILE_FORMAT_INVALID;
2824
2825         if (!name) {
2826                 _mmcam_dbg_err("name is NULL");
2827                 return MM_FILE_FORMAT_INVALID;
2828         }
2829
2830         if (!strcmp(name, "3GP")) {
2831                 mux_index = MM_FILE_FORMAT_3GP;
2832         } else if (!strcmp(name, "AMR")) {
2833                 mux_index = MM_FILE_FORMAT_AMR;
2834         } else if (!strcmp(name, "MP4")) {
2835                 mux_index = MM_FILE_FORMAT_MP4;
2836         } else if (!strcmp(name, "AAC")) {
2837                 mux_index = MM_FILE_FORMAT_AAC;
2838         } else if (!strcmp(name, "MP3")) {
2839                 mux_index = MM_FILE_FORMAT_MP3;
2840         } else if (!strcmp(name, "OGG")) {
2841                 mux_index = MM_FILE_FORMAT_OGG;
2842         } else if (!strcmp(name, "WAV")) {
2843                 mux_index = MM_FILE_FORMAT_WAV;
2844         } else if (!strcmp(name, "AVI")) {
2845                 mux_index = MM_FILE_FORMAT_AVI;
2846         } else if (!strcmp(name, "WMA")) {
2847                 mux_index = MM_FILE_FORMAT_WMA;
2848         } else if (!strcmp(name, "WMV")) {
2849                 mux_index = MM_FILE_FORMAT_WMV;
2850         } else if (!strcmp(name, "MID")) {
2851                 mux_index = MM_FILE_FORMAT_MID;
2852         } else if (!strcmp(name, "MMF")) {
2853                 mux_index = MM_FILE_FORMAT_MMF;
2854         } else if (!strcmp(name, "MATROSKA")) {
2855                 mux_index = MM_FILE_FORMAT_MATROSKA;
2856         } else if (!strcmp(name, "M2TS")) {
2857                 mux_index = MM_FILE_FORMAT_M2TS;
2858
2859         }
2860
2861         /*_mmcam_dbg_log("mux index %d", mux_index);*/
2862
2863         return mux_index;
2864 }
2865
2866
2867 int
2868 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2869 {
2870         int fmt = -1;
2871
2872         mmf_return_val_if_fail(name, -1);
2873
2874         switch(conf_category)
2875         {
2876                 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2877                         fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2878                         break;
2879                 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2880                         fmt = _mmcamcorder_get_video_codec_format(handle, name);
2881                         break;
2882                 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2883                         fmt = _mmcamcorder_get_image_codec_format(handle, name);
2884                         break;
2885                 case CONFIGURE_CATEGORY_MAIN_MUX:
2886                         fmt = _mmcamcorder_get_mux_format(handle, name);
2887                         break;
2888                 default :
2889                         _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2890         }
2891
2892         return fmt;
2893 }
2894
2895 int
2896 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2897 {
2898         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2899         camera_conf* configure_info = NULL;
2900         int *arr = NULL;
2901         int total_count = 0;
2902
2903         mmf_return_val_if_fail(hcamcorder, 0);
2904
2905         /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2906
2907         configure_info = hcamcorder->conf_main;
2908
2909         if (configure_info->info[conf_category]) {
2910                 int i = 0;
2911                 int fmt = 0;
2912                 const char *name = NULL;
2913                 int count = configure_info->info[conf_category]->count;
2914                 conf_detail *info = configure_info->info[conf_category];
2915
2916                 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2917
2918                 if (count <= 0 || !info) {
2919                         return total_count;
2920                 }
2921
2922                 arr = (int*) g_malloc0(count * sizeof(int));
2923                 if (arr == NULL) {
2924                         _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2925                         return 0;
2926                 }
2927
2928                 for (i = 0 ; i < count ; i++) {
2929                         if (info->detail_info[i] == NULL) {
2930                                 continue;
2931                         }
2932
2933                         name = ((type_element*)(info->detail_info[i]))->name;
2934                         fmt = _mmcamcorder_get_format(handle, conf_category, name);
2935                         if (fmt >= 0) {
2936                                 arr[total_count++] = fmt;
2937                         }
2938
2939                         /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/
2940                 }
2941         }
2942
2943         *format = arr;
2944
2945         return total_count;
2946 }