ae4e205c5b36daae00cf2fae9756fd04cd3fcc09
[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 |                                                                                                                                                                                       |
24 |  INCLUDE FILES                                                                                                                                                        |
25 |                                                                                                                                                                                       |
26 ========================================================================================== */
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include <unistd.h>
31
32 #include "mm_camcorder_internal.h"
33 #include "mm_camcorder_configure.h"
34
35 /*---------------------------------------------------------------------------
36 |    MACRO DEFINITIONS:                                                                                                         |
37 ---------------------------------------------------------------------------*/
38 #define CONFIGURE_PATH          "/opt/etc"
39 #define CONFIGURE_PATH_RETRY    "/usr/etc"
40
41 /*---------------------------------------------------------------------------
42 |    GLOBAL VARIABLE DEFINITIONS                                                                                        |
43 ---------------------------------------------------------------------------*/
44
45 /*---------------------------------------------------------------------------
46 |    LOCAL VARIABLE DEFINITIONS                                                                                         |
47 ---------------------------------------------------------------------------*/
48 static int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM] = { 0, };
49 static int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM] = { 0, };
50
51 static conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM] = { NULL, };
52 static conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM] = { NULL, };
53
54 /*
55  * Videosrc element default value
56  */
57 static type_element _videosrc_element_default = {
58         "VideosrcElement",
59         "videotestsrc",
60         NULL,
61         0,
62         NULL,
63         0,
64 };
65
66 /*
67  * Audiosrc element default value
68  */
69 static type_int  ___audiosrc_default_channel            = { "Channel", 1 };
70 static type_int  ___audiosrc_default_bitrate            = { "BitRate", 8000 };
71 static type_int  ___audiosrc_default_depth              = { "Depth", 16 };
72 static type_int  ___audiosrc_default_blocksize  = { "BlockSize", 1280 };
73 static type_int* __audiosrc_default_int_array[] = {
74         &___audiosrc_default_channel,
75         &___audiosrc_default_bitrate,
76         &___audiosrc_default_depth,
77         &___audiosrc_default_blocksize,
78 };
79 static type_string  ___audiosrc_default_device  = { "Device", "default" };
80 static type_string* __audiosrc_default_string_array[]   = {
81         &___audiosrc_default_device,
82 };
83 static type_element _audiosrc_element_default = {
84         "AudiosrcElement",
85         "audiotestsrc",
86         __audiosrc_default_int_array,
87         sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
88         __audiosrc_default_string_array,
89         sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
90 };
91
92 static type_element _audiomodemsrc_element_default = {
93         "AudiomodemsrcElement",
94         "audiotestsrc",
95         __audiosrc_default_int_array,
96         sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
97         __audiosrc_default_string_array,
98         sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
99 };
100
101
102 /*
103  * Videosink element default value
104  */
105 static type_int  ___videosink_default_display_id        = { "display-id", 3 };
106 static type_int  ___videosink_default_x                 = { "x", 0 };
107 static type_int  ___videosink_default_y                 = { "y", 0 };
108 static type_int  ___videosink_default_width             = { "width", 800 };
109 static type_int  ___videosink_default_height    = { "height", 480 };
110 static type_int  ___videosink_default_rotation  = { "rotation", 1 };
111 static type_int* __videosink_default_int_array[]        = {
112         &___videosink_default_display_id,
113         &___videosink_default_x,
114         &___videosink_default_y,
115         &___videosink_default_width,
116         &___videosink_default_height,
117         &___videosink_default_rotation,
118 };
119 static type_string* __videosink_default_string_array[]  = { NULL };
120 static type_element _videosink_element_x_default = {
121         "VideosinkElementX",
122         "xvimagesink",
123         __videosink_default_int_array,
124         sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
125         __videosink_default_string_array,
126         sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
127 };
128 static type_element _videosink_element_evas_default = {
129         "VideosinkElementEvas",
130         "evasimagesink",
131         __videosink_default_int_array,
132         sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
133         __videosink_default_string_array,
134         sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
135 };
136 static type_element _videosink_element_gl_default = {
137         "VideosinkElementGL",
138         "glimagesink",
139         __videosink_default_int_array,
140         sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
141         __videosink_default_string_array,
142         sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
143 };
144 static type_element _videosink_element_null_default = {
145         "VideosinkElementNull",
146         "fakesink",
147         __videosink_default_int_array,
148         sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
149         __videosink_default_string_array,
150         sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
151 };
152
153 /*
154  * Videoscale element default value
155  */
156 static type_element _videoscale_element_default = {
157         "VideoscaleElement",
158         "videoscale",
159         NULL,
160         0,
161         NULL,
162         0,
163 };
164
165 /*
166  * Record sink element default value
167  */
168 static type_element _recordsink_element_default = {
169         "RecordsinkElement",
170         "fakesink",
171         NULL,
172         0,
173         NULL,
174         0,
175 };
176
177 /*
178  *  H263 element default value
179  */
180 static type_element _h263_element_default = {
181         "H263",
182         "ffenc_h263",
183         NULL,
184         0,
185         NULL,
186         0,
187 };
188
189 /*
190  *  H264 element default value
191  */
192 static type_element _h264_element_default = {
193         "H264",
194         "savsenc_h264",
195         NULL,
196         0,
197         NULL,
198         0,
199 };
200
201 /*
202  *  H26L element default value
203  */
204 static type_element _h26l_element_default = {
205         "H26L",
206         NULL,
207         NULL,
208         0,
209         NULL,
210         0,
211 };
212
213 /*
214  *  MPEG4 element default value
215  */
216 static type_element _mpeg4_element_default = {
217         "MPEG4",
218         "ffenc_mpeg4",
219         NULL,
220         0,
221         NULL,
222         0,
223 };
224
225 /*
226  *  MPEG1 element default value
227  */
228 static type_element _mpeg1_element_default = {
229         "MPEG1",
230         "ffenc_mpeg1video",
231         NULL,
232         0,
233         NULL,
234         0,
235 };
236
237 /*
238  *  THEORA element default value
239  */
240 static type_element _theora_element_default = {
241         "THEORA",
242         "theoraenc",
243         NULL,
244         0,
245         NULL,
246         0,
247 };
248
249 /*
250  *  AMR element default value
251  */
252 static type_element _amr_element_default = {
253         "AMR",
254         "secenc_amr",
255         NULL,
256         0,
257         NULL,
258         0,
259 };
260
261 /*
262  *  G723_1 element default value
263  */
264 static type_element _g723_1_element_default = {
265         "G723_1",
266         NULL,
267         NULL,
268         0,
269         NULL,
270         0,
271 };
272
273 /*
274  *  MP3 element default value
275  */
276 static type_element _mp3_element_default = {
277         "MP3",
278         "lame",
279         NULL,
280         0,
281         NULL,
282         0,
283 };
284
285 /*
286  *  AAC element default value
287  */
288 static type_element _aac_element_default = {
289         "AAC",
290         NULL,
291         NULL,
292         0,
293         NULL,
294         0,
295 };
296
297 /*
298  *  MMF element default value
299  */
300 static type_element _mmf_element_default = {
301         "MMF",
302         NULL,
303         NULL,
304         0,
305         NULL,
306         0,
307 };
308
309 /*
310  *  ADPCM element default value
311  */
312 static type_element _adpcm_element_default = {
313         "ADPCM",
314         "ffenc_adpcm_ima_qt",
315         NULL,
316         0,
317         NULL,
318         0,
319 };
320
321 /*
322  *  WAVE element default value
323  */
324 static type_element _wave_element_default = {
325         "WAVE",
326         "wavenc",
327         NULL,
328         0,
329         NULL,
330         0,
331 };
332
333 static type_element _vorbis_element_default = {
334         "VORBIS",
335         "vorbisenc",
336         NULL,
337         0,
338         NULL,
339         0,
340 };
341
342 /*
343  *  MIDI element default value
344  */
345 static type_element _midi_element_default = {
346         "MIDI",
347         NULL,
348         NULL,
349         0,
350         NULL,
351         0,
352 };
353
354 /*
355  *  IMELODY element default value
356  */
357 static type_element _imelody_element_default = {
358         "IMELODY",
359         NULL,
360         NULL,
361         0,
362         NULL,
363         0,
364 };
365
366 /*
367  *  JPEG element default value
368  */
369 static type_element _jpeg_element_default = {
370         "JPEG",
371         "secjpeg_enc",
372         NULL,
373         0,
374         NULL,
375         0,
376 };
377
378 /*
379  *  PNG element default value
380  */
381 static type_element _png_element_default = {
382         "PNG",
383         "pngenc",
384         NULL,
385         0,
386         NULL,
387         0,
388 };
389
390 /*
391  *  BMP element default value
392  */
393 static type_element _bmp_element_default = {
394         "BMP",
395         NULL,
396         NULL,
397         0,
398         NULL,
399         0,
400 };
401
402 /*
403  *  WBMP element default value
404  */
405 static type_element _wbmp_element_default = {
406         "WBMP",
407         NULL,
408         NULL,
409         0,
410         NULL,
411         0,
412 };
413
414 /*
415  *  TIFF element default value
416  */
417 static type_element _tiff_element_default = {
418         "TIFF",
419         NULL,
420         NULL,
421         0,
422         NULL,
423         0,
424 };
425
426 /*
427  *  PCX element default value
428  */
429 static type_element _pcx_element_default = {
430         "PCX",
431         NULL,
432         NULL,
433         0,
434         NULL,
435         0,
436 };
437
438 /*
439  *  GIF element default value
440  */
441 static type_element _gif_element_default = {
442         "GIF",
443         NULL,
444         NULL,
445         0,
446         NULL,
447         0,
448 };
449
450 /*
451  *  ICO element default value
452  */
453 static type_element _ico_element_default = {
454         "ICO",
455         NULL,
456         NULL,
457         0,
458         NULL,
459         0,
460 };
461
462 /*
463  *  RAS element default value
464  */
465 static type_element _ras_element_default = {
466         "RAS",
467         NULL,
468         NULL,
469         0,
470         NULL,
471         0,
472 };
473
474 /*
475  *  TGA element default value
476  */
477 static type_element _tga_element_default = {
478         "TGA",
479         NULL,
480         NULL,
481         0,
482         NULL,
483         0,
484 };
485
486 /*
487  *  XBM element default value
488  */
489 static type_element _xbm_element_default = {
490         "XBM",
491         NULL,
492         NULL,
493         0,
494         NULL,
495         0,
496 };
497
498 /*
499  *  XPM element default value
500  */
501 static type_element _xpm_element_default = {
502         "XPM",
503         NULL,
504         NULL,
505         0,
506         NULL,
507         0,
508 };
509
510 /*
511  *  3GP element default value
512  */
513 static type_element _3gp_element_default = {
514         "3GP",
515         "ffmux_3gp",
516         NULL,
517         0,
518         NULL,
519         0,
520 };
521
522 /*
523  *  AMR mux element default value
524  */
525 static type_element _amrmux_element_default = {
526         "AMR",
527         "ffmux_amr",
528         NULL,
529         0,
530         NULL,
531         0,
532 };
533
534 /*
535  *  MP4 element default value
536  */
537 static type_element _mp4_element_default = {
538         "MP4",
539         "ffmux_mp4",
540         NULL,
541         0,
542         NULL,
543         0,
544 };
545
546 /*
547  *  AAC mux element default value
548  */
549 static type_element _aacmux_element_default = {
550         "AAC",
551         NULL,
552         NULL,
553         0,
554         NULL,
555         0,
556 };
557
558 /*
559  *  MP3 mux element default value
560  */
561 static type_element _mp3mux_element_default = {
562         "MP3",
563         NULL,
564         NULL,
565         0,
566         NULL,
567         0,
568 };
569
570 /*
571  *  OGG element default value
572  */
573 static type_element _ogg_element_default = {
574         "OGG",
575         "oggmux",
576         NULL,
577         0,
578         NULL,
579         0,
580 };
581
582 /*
583  *  WAV element default value
584  */
585 static type_element _wav_element_default = {
586         "WAV",
587         NULL,
588         NULL,
589         0,
590         NULL,
591         0,
592 };
593
594 /*
595  *  AVI element default value
596  */
597 static type_element _avi_element_default = {
598         "AVI",
599         "avimux",
600         NULL,
601         0,
602         NULL,
603         0,
604 };
605
606 /*
607  *  WMA element default value
608  */
609 static type_element _wma_element_default = {
610         "WMA",
611         NULL,
612         NULL,
613         0,
614         NULL,
615         0,
616 };
617
618 /*
619  *  WMV element default value
620  */
621 static type_element _wmv_element_default = {
622         "WMV",
623         NULL,
624         NULL,
625         0,
626         NULL,
627         0,
628 };
629
630 /*
631  *  MID element default value
632  */
633 static type_element _mid_element_default = {
634         "MID",
635         NULL,
636         NULL,
637         0,
638         NULL,
639         0,
640 };
641
642 /*
643  *  MMF mux element default value
644  */
645 static type_element _mmfmux_element_default = {
646         "MMF",
647         "ffmux_mmf",
648         NULL,
649         0,
650         NULL,
651         0,
652 };
653
654 /*
655  *  MATROSKA element default value
656  */
657 static type_element _matroska_element_default = {
658         "MATROSKA",
659         "matroskamux",
660         NULL,
661         0,
662         NULL,
663         0,
664 };
665
666 /*
667  * [General] matching table
668  */
669 static conf_info_table conf_main_general_table[] = {
670         { "SyncStateChange", CONFIGURE_VALUE_INT,           {1} },
671         { "GSTInitOption",   CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
672         { "ModelName",       CONFIGURE_VALUE_STRING,        {(char*)"Samsung Camera"} },
673         { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY,  {NULL} },
674 };
675
676 /*
677  * [VideoInput] matching table
678  */
679 static conf_info_table conf_main_video_input_table[] = {
680         { "UseConfCtrl",        CONFIGURE_VALUE_INT,            {1} },
681         { "ConfCtrlFile0",      CONFIGURE_VALUE_STRING,         {(char*)"mmfw_camcorder_dev_video_pri.ini"} },
682         { "ConfCtrlFile1",      CONFIGURE_VALUE_STRING,         {(char*)"mmfw_camcorder_dev_video_sec.ini"} },
683         { "VideosrcElement",    CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_videosrc_element_default} },
684         { "UseVideoscale",      CONFIGURE_VALUE_INT,            {0} },
685         { "VideoscaleElement",  CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_videoscale_element_default} },
686         { "UseZeroCopyFormat",  CONFIGURE_VALUE_INT,            {0} },
687 };
688
689 /*
690  * [AudioInput] matching table
691  */
692 static conf_info_table conf_main_audio_input_table[] = {
693         { "AudiosrcElement",    CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_audiosrc_element_default} },
694         { "AudiomodemsrcElement",       CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_audiomodemsrc_element_default} },
695 };
696
697 /*
698  * [VideoOutput] matching table
699  */
700 static conf_info_table conf_main_video_output_table[] = {
701         { "DisplayDevice",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
702         { "Videosink",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
703         { "VideosinkElementX",     CONFIGURE_VALUE_ELEMENT,   {(type_element*)&_videosink_element_x_default} },
704         { "VideosinkElementEvas",  CONFIGURE_VALUE_ELEMENT,   {(type_element*)&_videosink_element_evas_default} },
705         { "VideosinkElementGL",    CONFIGURE_VALUE_ELEMENT,   {(type_element*)&_videosink_element_gl_default} },
706         { "VideosinkElementNull",  CONFIGURE_VALUE_ELEMENT,   {(type_element*)&_videosink_element_null_default} },
707         { "UseVideoscale",         CONFIGURE_VALUE_INT,       {0} },
708         { "VideoscaleElement",     CONFIGURE_VALUE_ELEMENT,   {(type_element*)&_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, {(type_element*)&_videoscale_element_default} },
718 };
719
720 /*
721  * [Record] matching table
722  */
723 static conf_info_table conf_main_record_table[] = {
724         { "UseAudioEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },     
725         { "UseVideoEncoderQueue",   CONFIGURE_VALUE_INT,     {1} },     
726         { "VideoProfile",           CONFIGURE_VALUE_INT,     {0} },
727         { "VideoAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
728         { "VideoAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
729         { "VideoAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
730         { "AudioProfile",           CONFIGURE_VALUE_INT,     {0} },
731         { "AudioAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
732         { "AudioAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
733         { "AudioAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
734         { "ImageProfile",           CONFIGURE_VALUE_INT,     {0} },
735         { "ImageAutoAudioConvert",  CONFIGURE_VALUE_INT,     {0} },
736         { "ImageAutoAudioResample", CONFIGURE_VALUE_INT,     {0} },
737         { "ImageAutoColorSpace",    CONFIGURE_VALUE_INT,     {0} },
738         { "RecordsinkElement",      CONFIGURE_VALUE_ELEMENT, {(type_element*)&_recordsink_element_default} },
739         { "UseNoiseSuppressor",     CONFIGURE_VALUE_INT,     {0} },
740         { "DropVideoFrame",         CONFIGURE_VALUE_INT,     {0} },
741         { "PassFirstVideoFrame",    CONFIGURE_VALUE_INT,     {0} },
742 };
743
744 /*
745  * [VideoEncoder] matching table
746  */
747 static conf_info_table conf_main_video_encoder_table[] = {
748         { "H263",                               CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_h263_element_default} },
749         { "H264",                               CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_h264_element_default} },
750         { "H26L",                               CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_h26l_element_default} },
751         { "MPEG4",                              CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_mpeg4_element_default} },
752         { "MPEG1",                              CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_mpeg1_element_default} },
753         { "THEORA",                             CONFIGURE_VALUE_ELEMENT,        {(type_element*)&_theora_element_default} },
754 };
755
756 /*
757  * [AudioEncoder] matching table
758  */
759 static conf_info_table conf_main_audio_encoder_table[] = {
760         { "AMR",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_amr_element_default} },
761         { "G723_1",                             CONFIGURE_VALUE_ELEMENT, {(type_element*)&_g723_1_element_default} },
762         { "MP3",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mp3_element_default} },
763         { "AAC",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_aac_element_default} },
764         { "MMF",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mmf_element_default} },
765         { "ADPCM",                              CONFIGURE_VALUE_ELEMENT, {(type_element*)&_adpcm_element_default} },
766         { "WAVE",                               CONFIGURE_VALUE_ELEMENT, {(type_element*)&_wave_element_default} },
767         { "MIDI",                               CONFIGURE_VALUE_ELEMENT, {(type_element*)&_midi_element_default} },
768         { "IMELODY",                    CONFIGURE_VALUE_ELEMENT, {(type_element*)&_imelody_element_default} },
769         { "VORBIS",                     CONFIGURE_VALUE_ELEMENT, {(type_element*)&_vorbis_element_default} },
770 };
771
772 /*
773  * [ImageEncoder] matching table
774  */
775 static conf_info_table conf_main_image_encoder_table[] = {
776         { "JPEG",                               CONFIGURE_VALUE_ELEMENT, {(type_element*)&_jpeg_element_default} },
777         { "PNG",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_png_element_default} },
778         { "BMP",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_bmp_element_default} },
779         { "WBMP",                               CONFIGURE_VALUE_ELEMENT, {(type_element*)&_wbmp_element_default} },
780         { "TIFF",                               CONFIGURE_VALUE_ELEMENT, {(type_element*)&_tiff_element_default} },
781         { "PCX",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_pcx_element_default} },
782         { "GIF",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_gif_element_default} },
783         { "ICO",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_ico_element_default} },
784         { "RAS",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_ras_element_default} },
785         { "TGA",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_tga_element_default} },
786         { "XBM",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_xbm_element_default} },
787         { "XPM",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_xpm_element_default} },
788 };
789
790 /*
791  * [Mux] matching table
792  */
793 static conf_info_table conf_main_mux_table[] = {
794         { "3GP",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_3gp_element_default} },
795         { "AMR",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_amrmux_element_default} },
796         { "MP4",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mp4_element_default} },
797         { "AAC",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_aacmux_element_default} },
798         { "MP3",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mp3mux_element_default} },
799         { "OGG",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_ogg_element_default} },
800         { "WAV",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_wav_element_default} },
801         { "AVI",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_avi_element_default} },
802         { "WMA",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_wma_element_default} },
803         { "WMV",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_wmv_element_default} },
804         { "MID",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mid_element_default} },
805         { "MMF",                                CONFIGURE_VALUE_ELEMENT, {(type_element*)&_mmfmux_element_default} },
806         { "MATROSKA",                   CONFIGURE_VALUE_ELEMENT, {(type_element*)&_matroska_element_default} },
807 };
808
809
810 /*******************
811  *  Camera control *
812  *******************/
813
814 /*
815  * [Camera] matching table
816  */
817 static conf_info_table conf_ctrl_camera_table[] = {
818         { "InputIndex",        CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
819         { "DeviceName",        CONFIGURE_VALUE_STRING,         {NULL} },
820         { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
821         { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
822         { "FPS",               CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
823         { "PictureFormat",     CONFIGURE_VALUE_INT_ARRAY,      {NULL} },
824         { "Overlay",           CONFIGURE_VALUE_INT_RANGE,      {NULL} },
825         { "RecommendDisplayRotation", CONFIGURE_VALUE_INT,     {3}    },
826         { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} },
827         { "RecommendPreviewFormatRecord",  CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} },
828 };
829
830 /*
831  * [Strobe] matching table
832  */
833 static conf_info_table conf_ctrl_strobe_table[] = {
834         { "StrobeControl",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
835         { "StrobeMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
836         { "StrobeEV",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
837 };
838
839 /*
840  * [Effect] matching table
841  */
842 static conf_info_table conf_ctrl_effect_table[] = {
843         { "Brightness",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
844         { "Contrast",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
845         { "Saturation",           CONFIGURE_VALUE_INT_RANGE, {NULL} },
846         { "Sharpness",            CONFIGURE_VALUE_INT_RANGE, {NULL} },
847         { "WhiteBalance",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
848         { "ColorTone",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
849         { "Flip",                 CONFIGURE_VALUE_INT_ARRAY, {NULL} },
850         { "WDR",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
851         { "PartColorMode",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
852         { "PartColor",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
853 };
854
855 /*
856  * [Photograph] matching table
857  */
858 static conf_info_table conf_ctrl_photograph_table[] = {
859         { "LensInit",             CONFIGURE_VALUE_INT_ARRAY, {NULL} },
860         { "DigitalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
861         { "OpticalZoom",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
862         { "FocusMode",            CONFIGURE_VALUE_INT_ARRAY, {NULL} },
863         { "AFType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
864         { "AEType",               CONFIGURE_VALUE_INT_ARRAY, {NULL} },
865         { "ExposureValue",        CONFIGURE_VALUE_INT_RANGE, {NULL} },
866         { "FNumber",              CONFIGURE_VALUE_INT_ARRAY, {NULL} },
867         { "ShutterSpeed",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
868         { "ISO",                  CONFIGURE_VALUE_INT_ARRAY, {NULL} },
869         { "ProgramMode",          CONFIGURE_VALUE_INT_ARRAY, {NULL} },
870         { "AntiHandshake",        CONFIGURE_VALUE_INT_ARRAY, {NULL} },
871 };
872
873 /*
874  * [Capture] matching table
875  */
876 static conf_info_table conf_ctrl_capture_table[] = {
877         { "OutputMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
878         { "JpegQuality",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
879         { "MultishotNumber",      CONFIGURE_VALUE_INT_RANGE, {NULL} },
880         { "SensorEncodedCapture", CONFIGURE_VALUE_INT,       {1} },
881 };
882
883 /*
884  * [Detect] matching table
885  */
886 static conf_info_table conf_ctrl_detect_table[] = {
887         { "DetectMode",         CONFIGURE_VALUE_INT_ARRAY, {NULL} },
888         { "DetectNumber",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
889         { "DetectSelect",       CONFIGURE_VALUE_INT_RANGE, {NULL} },
890         { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
891 };
892
893
894
895 char*
896 get_new_string( char* src_string )
897 {
898         return strdup(src_string);
899 }
900
901 void
902 _mmcamcorder_conf_init( int type, camera_conf** configure_info )
903 {
904         int i = 0;
905         int info_table_size = sizeof( conf_info_table );
906         
907         _mmcam_dbg_log( "Entered..." );
908
909         if( type == CONFIGURE_TYPE_MAIN )
910         {
911                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL]       = conf_main_general_table;
912                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = conf_main_video_input_table;
913                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = conf_main_audio_input_table;
914                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = conf_main_video_output_table;
915                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = conf_main_capture_table;
916                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD]        = conf_main_record_table;
917                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
918                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
919                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
920                 conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX]           = conf_main_mux_table;
921
922                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL]       = sizeof( conf_main_general_table ) / info_table_size;
923                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = sizeof( conf_main_video_input_table ) / info_table_size;
924                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = sizeof( conf_main_audio_input_table ) / info_table_size;
925                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = sizeof( conf_main_video_output_table ) / info_table_size;
926                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = sizeof( conf_main_capture_table ) / info_table_size;
927                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD]        = sizeof( conf_main_record_table ) / info_table_size;
928                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
929                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
930                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
931                 conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX]           = sizeof( conf_main_mux_table ) / info_table_size;
932
933                 (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_MAIN_NUM );
934
935                 for( i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++ )
936                 {
937                         (*configure_info)->info[i]      = NULL;
938                 }
939         }
940         else
941         {
942                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA]     = conf_ctrl_camera_table;
943                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE]     = conf_ctrl_strobe_table;
944                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT]     = conf_ctrl_effect_table;
945                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
946                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = conf_ctrl_capture_table;
947                 conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT]     = conf_ctrl_detect_table;
948
949                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA]     = sizeof( conf_ctrl_camera_table ) / info_table_size;
950                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE]     = sizeof( conf_ctrl_strobe_table ) / info_table_size;
951                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT]     = sizeof( conf_ctrl_effect_table ) / info_table_size;
952                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
953                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = sizeof( conf_ctrl_capture_table ) / info_table_size;
954                 conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT]     = sizeof( conf_ctrl_detect_table ) / info_table_size;
955
956                 (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_CTRL_NUM );
957
958                 for( i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++ )
959                 {
960                         (*configure_info)->info[i]      = NULL;
961                 }
962         }
963         
964         _mmcam_dbg_log( "Done." );
965
966 }
967
968
969 int
970 _mmcamcorder_conf_get_info( int type, char* ConfFile, camera_conf** configure_info )
971 {
972         int ret         = MM_ERROR_NONE;
973         FILE* fd        = NULL;
974         char* conf_path = NULL;
975
976         _mmcam_dbg_log( "Opening...[%s]", ConfFile );
977
978         mmf_return_val_if_fail( ConfFile, FALSE );
979
980         conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
981
982         if( conf_path == NULL )
983         {
984                 _mmcam_dbg_err( "malloc failed." );
985                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
986         }
987
988         snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
989         _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
990
991         fd = fopen( conf_path, "r" );
992         if( fd == NULL )
993         {
994                 _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
995                 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
996                 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
997                 fd = fopen( conf_path, "r" );
998                 if( fd == NULL )
999                 {
1000                         _mmcam_dbg_warn( "File open failed.[%s] But keep going... All value will be returned as default.Type[%d]", 
1001                                 conf_path, type );
1002                 }
1003         }
1004
1005         if( fd != NULL )
1006         {
1007                 ret = _mmcamcorder_conf_parse_info( type, fd, configure_info );
1008                 fclose( fd );
1009         }
1010         else
1011         {
1012                 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
1013         }
1014
1015         if( conf_path != NULL )
1016         {
1017                 free( conf_path );
1018                 conf_path = NULL;
1019         }
1020
1021         _mmcam_dbg_log( "Leave..." );
1022
1023         return ret;
1024 }
1025
1026 int
1027 _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
1028 {
1029         const unsigned int BUFFER_NUM_DETAILS = 256;
1030         const unsigned int BUFFER_NUM_TOKEN = 20;
1031         size_t BUFFER_LENGTH_STRING = 256;
1032         const char* delimiters = " |=,\t\n";
1033
1034         int category = 0;
1035         int count_main_category = 0;
1036         int count_details = 0;
1037         int length_read = 0;
1038         int count_token = 0;
1039         int read_main = 0;
1040
1041         char *buffer_string = (char*)g_malloc0(sizeof(char)*BUFFER_LENGTH_STRING);
1042         char *buffer_details[BUFFER_NUM_DETAILS];
1043         char *buffer_token[BUFFER_NUM_TOKEN];
1044         char *token = NULL;
1045         char *category_name = NULL;
1046         char *detail_string = NULL;
1047         char *user_ptr = NULL;
1048
1049         _mmcam_dbg_log( "" );
1050
1051         camera_conf* new_conf = (camera_conf*)g_malloc0(sizeof(camera_conf));
1052
1053         if( new_conf == NULL )
1054         {
1055                 _mmcam_dbg_err( "Failed to create new configure structure.type[%d]", type );
1056                 *configure_info = NULL;
1057
1058                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
1059         }
1060
1061         new_conf->type  = type;
1062         *configure_info = new_conf;
1063
1064         _mmcamcorder_conf_init( type, &new_conf );
1065
1066         mmf_return_val_if_fail( fd > 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
1067         
1068         read_main = 0;
1069         count_main_category = 0;
1070
1071         while( !feof( fd ) )
1072         {
1073                 if( read_main == 0 )
1074                 {
1075                         length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1076                         /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1077
1078                         count_token = 0;
1079                         token = strtok_r( buffer_string, delimiters, &user_ptr );
1080
1081                         if ((token) && (token[0] == ';'))
1082                         {
1083                                 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1084                                 continue;
1085                         }
1086
1087                         while( token )
1088                         {
1089                                 /*_mmcam_dbg_log( "token : [%s]", token );*/
1090                                 buffer_token[count_token] = token;
1091                                 count_token++;
1092                                 token = strtok_r( NULL, delimiters, &user_ptr );
1093                         }
1094
1095                         if( count_token == 0 )
1096                         {
1097                                 continue;
1098                         }
1099                 }
1100
1101                 read_main = 0;
1102
1103                 /* Comment */
1104                 if( *buffer_token[0] == ';' )
1105                 {
1106                         /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1107                 }
1108                 /* Main Category */
1109                 else if( *buffer_token[0] == '[' )
1110                 {       
1111                         category_name = get_new_string( buffer_token[0] );
1112
1113                         count_main_category++;
1114                         count_details = 0;
1115                         
1116                         while( !feof( fd ) )
1117                         {
1118                                 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1119                                 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1120
1121                                 detail_string = get_new_string( buffer_string );
1122
1123                                 token = strtok_r( buffer_string, delimiters, &user_ptr );
1124
1125                                 if( token && token[0] != ';' && length_read > -1 )
1126                                 {
1127                                         /*_mmcam_dbg_log( "token : [%s]", token );*/
1128                                         if( token[0] == '[' )
1129                                         {
1130                                                 read_main = 1;
1131                                                 buffer_token[0] = token;
1132                                                 SAFE_FREE( detail_string );
1133                                                 break;
1134                                         }
1135
1136                                         buffer_details[count_details++] = detail_string;
1137                                 }
1138                                 else
1139                                 {
1140                                         SAFE_FREE( detail_string );
1141                                 }
1142                         }
1143
1144                         _mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );
1145
1146                         if( count_details == 0 )
1147                         {
1148                                 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1149                                 continue;
1150                         }
1151
1152                         category = -1;
1153
1154                         /* Details */
1155                         if( type == CONFIGURE_TYPE_MAIN )
1156                         {       
1157                                 if( !strcmp( "[General]", category_name ) )
1158                                 {
1159                                         category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1160                                 }
1161                                 else if( !strcmp( "[VideoInput]", category_name ) )
1162                                 {
1163                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1164                                 }
1165                                 else if( !strcmp( "[AudioInput]", category_name ) )
1166                                 {
1167                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1168                                 }
1169                                 else if( !strcmp( "[VideoOutput]", category_name ) )
1170                                 {
1171                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1172                                 }
1173                                 else if( !strcmp( "[Capture]", category_name ) )
1174                                 {
1175                                         category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1176                                 }
1177                                 else if( !strcmp( "[Record]", category_name ) )
1178                                 {
1179                                         category = CONFIGURE_CATEGORY_MAIN_RECORD;
1180                                 }
1181                                 else if( !strcmp( "[VideoEncoder]", category_name ) )
1182                                 {
1183                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1184                                 }
1185                                 else if( !strcmp( "[AudioEncoder]", category_name ) )
1186                                 {
1187                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1188                                 }
1189                                 else if( !strcmp( "[ImageEncoder]", category_name ) )
1190                                 {
1191                                         category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1192                                 }
1193                                 else if( !strcmp( "[Mux]", category_name ) )
1194                                 {
1195                                         category = CONFIGURE_CATEGORY_MAIN_MUX;
1196                                 }
1197                         }
1198                         else
1199                         {
1200                                 if( !strcmp( "[Camera]", category_name ) )
1201                                 {
1202                                         category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1203                                 }
1204                                 else if( !strcmp( "[Strobe]", category_name ) )
1205                                 {
1206                                         category = CONFIGURE_CATEGORY_CTRL_STROBE;
1207                                 }
1208                                 else if( !strcmp( "[Effect]", category_name ) )
1209                                 {
1210                                         category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1211                                 }
1212                                 else if( !strcmp( "[Photograph]", category_name ) )
1213                                 {
1214                                         category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1215                                 }
1216                                 else if( !strcmp( "[Capture]", category_name ) )
1217                                 {
1218                                         category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1219                                 }
1220                                 else if( !strcmp( "[Detect]", category_name ) )
1221                                 {
1222                                         category = CONFIGURE_CATEGORY_CTRL_DETECT;
1223                                 }
1224                         }
1225
1226                         if( category != -1 )
1227                         {
1228                                 _mmcamcorder_conf_add_info( type, &(new_conf->info[category]), 
1229                                                 buffer_details, category, count_details );
1230                         }
1231                         else
1232                         {
1233                                 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1234                         }
1235
1236                         // Free memory
1237                         {
1238                                 int i;
1239
1240                                 for( i = 0 ; i < count_details ; i++ )
1241                                 {
1242                                         SAFE_FREE( buffer_details[i] );
1243                                 }
1244                         }
1245                 }
1246
1247                 if( category_name )
1248                 {
1249                         SAFE_FREE( category_name );
1250                 }
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
2997 _mmcamcorder_get_audio_codec_format(MMHandleType handle, char * name)
2998 {
2999         int i = 0;
3000         char* audio_fmt_type[] =        {
3001                 "AMR",              /**< AMR codec*/
3002                 "G723_1",           /**< G723.1 codec*/
3003                 "MP3",              /**< MP3 codec*/
3004                 "OGG",              /**< OGG codec*/
3005                 "AAC",              /**< AAC codec*/
3006                 "WMA",              /**< WMA codec*/
3007                 "MMF",              /**< MMF codec*/
3008                 "ADPCM",            /**< ADPCM codec */
3009                 "WAVE",             /**< WAVE codec */
3010                 "WAVE_NEW",         /**< WAVE codec */
3011                 "MIDI",             /**< MIDI codec */
3012                 "IMELODY",          /**< IMELODY codec */
3013                 "MXMF",             
3014                 "MPA",              /**< MPEG1-Layer1 codec */
3015                 "MP2",              /**< MPEG1-Layer2 codec */
3016                 "G711",             /**< G711 codec */
3017                 "G722",             /**< G722 wideband speech codec */
3018                 "G722_1",           /**< G722.1 codec */
3019                 "G722_2",           /**< G722.2  (AMR-WB) codec */
3020                 "G723",             /**< G723 wideband speech codec */
3021                 "G726",             /**< G726 (ADPCM) codec */
3022                 "G728",             /**< G728 speech codec */
3023                 "G729",             /**< G729 codec */
3024                 "G729A",            /**< G729a codec */
3025                 "G729_1",           /**< G729.1 codec */
3026                 "REAL",             /**< Real audio */
3027                 "AAC_LC",           /**< AAC-Low complexity codec */
3028                 "AAC_MAIN",         /**< AAC-Main profile codec */
3029                 "AAC_SRS",          /**< AAC-Scalable sample rate codec */
3030                 "AAC_LTP",          /**< AAC-Long term prediction codec */
3031                 "AAC_HE_V1",        /**< AAC-High Efficiency v1 codec */
3032                 "AAC_HE_V2",        /**< AAC-High efficiency v2 codec */
3033                 "AC3",              /**< DolbyDigital codec */
3034                 "ALAC",             /**< Apple Lossless audio codec */
3035                 "ATRAC",            /**< Sony audio codec */
3036                 "SPEEX",            /**< SPEEX audio codec */
3037                 "VORBIS",           /**< Vor*/
3038                 "AIFF",             /**< AIFF codec*/
3039                 "AU",               /**< AU codec*/
3040                 "NONE",             /**< None (will be deprecated) */
3041                 "PCM",              /**< PCM codec */
3042                 "ALAW",             /**< ALAW codec */
3043                 "MULAW",            /**< MULAW codec */
3044                 "MS_ADPCM"          /**< MS ADPCM codec */
3045         };
3046
3047         for (i = 0; i < MM_AUDIO_CODEC_NUM; i++)
3048         {
3049                 if (!strcmp(name, audio_fmt_type[i]))
3050                 {
3051 //                      _mmcam_dbg_log( "Audio codec[%d]", i);
3052                         return i;
3053                 }
3054         }
3055
3056         _mmcam_dbg_err( "Not supported audio codec[%s]", name);
3057         return -1;
3058
3059 }
3060
3061
3062
3063 int
3064 _mmcamcorder_get_video_codec_format(MMHandleType handle, char * name)
3065 {
3066         int i = 0;
3067         char* video_fmt_type[] =        {
3068                 "NONE",            /**< None (will be deprecated) */
3069                 "H263",            /**< H263 codec*/
3070                 "H264",            /**< H264 codec*/
3071                 "H26L",            /**< H26L codec*/
3072                 "MPEG4",           /**< MPEG4 codec*/
3073                 "MPEG1",           /**< MPEG1 codec*/
3074                 "WMV",             /**< WMV codec*/
3075                 "DIVX",            /**< DIVX codec*/
3076                 "XVID",            /**< XVID codec*/
3077                 "H261",            /**< H261 codec*/
3078                 "H262",            /**< H262/MPEG2-part2 codec*/
3079                 "H263V2",          /**< H263v2 codec*/
3080                 "H263V3",          /**< H263v3 codec*/
3081                 "MJPEG",           /**< Motion JPEG Video codec*/
3082                 "MPEG2",           /**< MPEG2 codec*/
3083                 "MPEG4_SIMPLE",    /**< MPEG4 part-2 Simple profile codec*/
3084                 "MPEG4_ADV_SIMPLE",/**< MPEG4 part-2 Advanced Simple profile codec*/
3085                 "MPEG4_MAIN",      /**< MPEG4 part-2 Main profile codec*/
3086                 "MPEG4_CORE",      /**< MPEG4 part-2 Core profile codec*/
3087                 "MPEG4_ACE",       /**< MPEG4 part-2 Adv Coding Eff profile codec*/
3088                 "MPEG4_ARTS",      /**< MPEG4 part-2 Adv RealTime Simple profile codec*/
3089                 "MPEG4_AVC",       /**< MPEG4 part-10 (h.264) codec*/
3090                 "REAL",            /**< Real video*/
3091                 "VC1",             /**< VC-1 video*/
3092                 "AVS",             /**< AVS video*/
3093                 "CINEPAK",         /**< Cinepak videocodec */
3094                 "INDEO",           /**< Indeo videocodec */
3095                 "THEORA"           /**< Theora videocodec */
3096         };
3097
3098         for (i = 0; i < MM_VIDEO_CODEC_NUM; i++)
3099         {
3100                 if (!strcmp(name, video_fmt_type[i]))
3101                 {
3102 //                      _mmcam_dbg_log( "Video codec[%d]", i);
3103                         return i;
3104                 }
3105         }
3106
3107         _mmcam_dbg_err( "Not supported Video codec[%s]", name);
3108         return -1;
3109
3110 }
3111
3112
3113
3114 int
3115 _mmcamcorder_get_image_codec_format(MMHandleType handle, char * name)
3116 {
3117         int i = 0;
3118         char* image_fmt_type[] =        {
3119                 "JPEG",            /**< JPEG codec */
3120                 "PNG",             /**< PNG codec */
3121                 "BMP",             /**< BMP codec */
3122                 "WBMP",            /**< WBMP codec */
3123                 "TIFF",            /**< TIFF codec */
3124                 "PCX",             /**< PCX codec */
3125                 "GIF",             /**< GIF codec */
3126                 "ICO",             /**< ICO codec */
3127                 "RAS",             /**< RAS codec */
3128                 "TGA",             /**< TGA codec */
3129                 "XBM",             /**< XBM codec */
3130                 "XPM"              /**< XPM codec */
3131                 "SRW"              /**< SRW (Samsung standard RAW) */
3132                 "JPEG_SRW"         /**< JPEG + SRW */
3133         };
3134
3135         for (i = 0; i < MM_IMAGE_CODEC_NUM; i++)
3136         {
3137                 if (!strcmp(name, image_fmt_type[i]))
3138                 {
3139 //                      _mmcam_dbg_log( "Image codec[%d]", i);
3140                         return i;
3141                 }
3142         }
3143
3144         _mmcam_dbg_err( "Not supported Image codec[%s]", name);
3145         return -1;
3146
3147 }
3148
3149
3150 int
3151 _mmcamcorder_get_mux_format(MMHandleType handle, char * name)
3152 {
3153         int i = 0;
3154         char* mux_fmt_type[] =  {
3155                 "3GP",             /**< 3GP file format */
3156                 "ASF",             /**< Advanced Systems File file format */
3157                 "AVI",             /**< Audio Video Interleaved file format */
3158                 "MATROSKA",        /**< MATROSAK file format */
3159                 "MP4",             /**< MP4 file format */
3160                 "OGG",             /**< OGG file format */
3161                 "NUT",             /**< NUT file format */
3162                 "QT",              /**< MOV file format */
3163                 "REAL",            /**< RealMedia file format */
3164                 "AMR",             /**< AMR file format */
3165                 "AAC",             /**< AAC file format */
3166                 "MP3",             /**< MP3 file format */
3167                 "AIFF",            /**< AIFF file format */
3168                 "AU",              /**< Audio file format */
3169                 "WAV",             /**< WAV file format */
3170                 "MID",             /**< MID file format */
3171                 "MMF",             /**< MMF file format */
3172                 "DIVX",            /**< DivX file format */
3173                 "FLV",             /**< Flash video file format */
3174                 "VOB",             /**< DVD-Video Object file format */
3175                 "IMELODY",         /**< IMelody file format */
3176                 "WMA",             /**< WMA file format */
3177                 "WMV",             /**< WMV file format */
3178                 "JPG"              /**< JPEG file format */
3179         };
3180
3181         for (i = 0; i < MM_FILE_FORMAT_NUM; i++)
3182         {
3183                 if (!strcmp(name, mux_fmt_type[i]))
3184                 {
3185 //                      _mmcam_dbg_log( "Mux[%d]", i);
3186                         return i;
3187                 }
3188         }
3189
3190         _mmcam_dbg_err( "Not supported Mux[%s]", name);
3191         return -1;
3192
3193 }
3194
3195
3196 int
3197 _mmcamcorder_get_format(MMHandleType handle, int conf_category, char * name)
3198 {
3199         int fmt = -1;
3200
3201         mmf_return_val_if_fail(name, -1);
3202
3203         switch(conf_category)
3204         {
3205                 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
3206                         fmt = _mmcamcorder_get_audio_codec_format(handle, name);
3207                         break;
3208                 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
3209                         fmt = _mmcamcorder_get_video_codec_format(handle, name);
3210                         break;
3211                 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
3212                         fmt = _mmcamcorder_get_image_codec_format(handle, name);
3213                         break;
3214                 case CONFIGURE_CATEGORY_MAIN_MUX:
3215                         fmt = _mmcamcorder_get_mux_format(handle, name);
3216                         break;
3217                 default :
3218                         _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
3219         }
3220
3221         return fmt;
3222 }
3223
3224 int
3225 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
3226 {
3227         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
3228         camera_conf* configure_info = NULL;
3229         int *arr = NULL;
3230         int total_count = 0;
3231         
3232         mmf_return_val_if_fail(hcamcorder, 0);
3233         
3234         _mmcam_dbg_log("conf_category:%d", conf_category);
3235
3236         configure_info = hcamcorder->conf_main;
3237
3238         if( configure_info->info[conf_category] )
3239         {
3240                 int count = configure_info->info[conf_category]->count;
3241                 conf_info* info = configure_info->info[conf_category];
3242                 int i = 0;
3243                 int fmt = 0;
3244                 char* name = NULL;
3245
3246                 _mmcam_dbg_log("count[%d], info[%p]", count, info);
3247
3248                 if ((count <= 0) || (!info))
3249                 {
3250                         return total_count;
3251                 }
3252
3253                 arr = (int*) g_malloc0(count * sizeof(int));
3254
3255                 for( i = 0 ; i < count ; i++ )
3256                 {
3257                         if( info->detail_info[i] == NULL )
3258                         {
3259                                 continue;
3260                         }
3261                         
3262                         name = ((type_element*)(info->detail_info[i]))->name;
3263                         
3264                         if ((fmt = _mmcamcorder_get_format(handle, conf_category, name)) >= 0)
3265                         {
3266                                 arr[total_count++] = fmt;
3267                         }
3268                         _mmcam_dbg_log("name:%s, fmt:%d", name, fmt);
3269                 }
3270         }
3271                 
3272         *format = arr;
3273
3274         return total_count;
3275 }
3276