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