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