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