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