[Release version 0.10.44] Set stride field for non-zero copy stream
[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                 { "PanMecha",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
812                 { "PanElec",              CONFIGURE_VALUE_INT_RANGE, {NULL} },
813                 { "TiltMecha",            CONFIGURE_VALUE_INT_RANGE, {NULL} },
814                 { "TiltElec",             CONFIGURE_VALUE_INT_RANGE, {NULL} },
815         };
816
817         /* [Capture] matching table */
818         static conf_info_table conf_ctrl_capture_table[] = {
819                 { "OutputMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
820                 { "JpegQuality",          CONFIGURE_VALUE_INT_RANGE, {NULL} },
821                 { "MultishotNumber",      CONFIGURE_VALUE_INT_RANGE, {NULL} },
822                 { "SensorEncodedCapture", CONFIGURE_VALUE_INT,       {.value_int = 1} },
823                 { "SupportHDR",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
824                 { "SupportZSL",           CONFIGURE_VALUE_INT,       {.value_int = FALSE} },
825         };
826
827         /* [Detect] matching table */
828         static conf_info_table conf_ctrl_detect_table[] = {
829                 { "DetectMode",           CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830                 { "DetectNumber",         CONFIGURE_VALUE_INT_RANGE, {NULL} },
831                 { "DetectSelect",         CONFIGURE_VALUE_INT_RANGE, {NULL} },
832                 { "DetectSelectNumber",   CONFIGURE_VALUE_INT_RANGE, {NULL} },
833         };
834
835         if (hcamcorder == NULL) {
836                 _mmcam_dbg_err("handle is NULL");
837                 return;
838         }
839
840         _mmcam_dbg_log("Entered...");
841
842         if (type == CONFIGURE_TYPE_MAIN) {
843                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL]       = conf_main_general_table;
844                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = conf_main_video_input_table;
845                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = conf_main_audio_input_table;
846                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = conf_main_video_output_table;
847                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = conf_main_capture_table;
848                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD]        = conf_main_record_table;
849                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
850                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
851                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
852                 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX]           = conf_main_mux_table;
853
854                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL]       = sizeof( conf_main_general_table ) / info_table_size;
855                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT]   = sizeof( conf_main_video_input_table ) / info_table_size;
856                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT]   = sizeof( conf_main_audio_input_table ) / info_table_size;
857                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT]  = sizeof( conf_main_video_output_table ) / info_table_size;
858                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE]       = sizeof( conf_main_capture_table ) / info_table_size;
859                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD]        = sizeof( conf_main_record_table ) / info_table_size;
860                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
861                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
862                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
863                 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX]           = sizeof( conf_main_mux_table ) / info_table_size;
864
865                 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
866
867                 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
868                         (*configure_info)->info[i] = NULL;
869                 }
870         } else {
871                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA]     = conf_ctrl_camera_table;
872                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE]     = conf_ctrl_strobe_table;
873                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT]     = conf_ctrl_effect_table;
874                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
875                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = conf_ctrl_capture_table;
876                 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT]     = conf_ctrl_detect_table;
877
878                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA]     = sizeof( conf_ctrl_camera_table ) / info_table_size;
879                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE]     = sizeof( conf_ctrl_strobe_table ) / info_table_size;
880                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT]     = sizeof( conf_ctrl_effect_table ) / info_table_size;
881                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
882                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE]    = sizeof( conf_ctrl_capture_table ) / info_table_size;
883                 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT]     = sizeof( conf_ctrl_detect_table ) / info_table_size;
884
885                 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
886
887                 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
888                         (*configure_info)->info[i] = NULL;
889                 }
890         }
891
892         _mmcam_dbg_log("Done.");
893
894         return;
895 }
896
897
898 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
899 {
900         int ret = MM_ERROR_NONE;
901         FILE *fd = NULL;
902         char conf_path[60] = {'\0',};
903
904         _mmcam_dbg_log("Opening...[%s]", ConfFile);
905
906         mmf_return_val_if_fail(ConfFile, FALSE);
907
908         snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
909         _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
910
911         fd = fopen(conf_path, "r");
912         if (fd == NULL) {
913                 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
914
915                 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
916                 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
917                 fd = fopen(conf_path, "r");
918                 if (fd == NULL) {
919                         _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
920                 }
921         }
922
923         if (fd != NULL) {
924                 ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
925                 fclose(fd);
926         } else {
927                 if (errno == ENOENT) {
928                         ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
929                 } else {
930                         ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
931                 }
932         }
933
934         _mmcam_dbg_log("Leave...");
935
936         return ret;
937 }
938
939
940 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
941 {
942         const unsigned int BUFFER_NUM_DETAILS = 256;
943         const unsigned int BUFFER_NUM_TOKEN = 20;
944         size_t BUFFER_LENGTH_STRING = 256;
945         const char* delimiters = " |=,\t\n";
946
947         int category = 0;
948         int count_main_category = 0;
949         int count_details = 0;
950         int length_read = 0;
951         int count_token = 0;
952         int read_main = 0;
953
954         char *buffer_string = NULL;
955         char *buffer_details[BUFFER_NUM_DETAILS];
956         char *buffer_token[BUFFER_NUM_TOKEN];
957         char *token = NULL;
958         char *category_name = NULL;
959         char *detail_string = NULL;
960         char *user_ptr = NULL;
961
962         _mmcam_dbg_log( "" );
963
964         camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
965         if (new_conf == NULL) {
966                 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
967                 *configure_info = NULL;
968                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
969         }
970
971         buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
972         if (buffer_string == NULL) {
973                 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
974                 *configure_info = NULL;
975                 SAFE_G_FREE(new_conf);
976                 return MM_ERROR_CAMCORDER_LOW_MEMORY;
977         }
978
979         new_conf->type  = type;
980         *configure_info = new_conf;
981
982         _mmcamcorder_conf_init(handle, type, &new_conf);
983
984         if (fd == NULL) {
985                 _mmcam_dbg_err("failed file descriptor fail");
986                 *configure_info = NULL;
987                 SAFE_G_FREE(buffer_string);
988                 SAFE_G_FREE(new_conf);
989                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
990         }
991
992         read_main = 0;
993         count_main_category = 0;
994
995         while( !feof( fd ) )
996         {
997                 if( read_main == 0 )
998                 {
999                         length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1000                         /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1001
1002                         count_token = 0;
1003                         token = strtok_r( buffer_string, delimiters, &user_ptr );
1004
1005                         if ((token) && (token[0] == ';') && (length_read > -1))
1006                         {
1007                                 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1008                                 continue;
1009                         }
1010
1011                         while( token )
1012                         {
1013                                 /*_mmcam_dbg_log( "token : [%s]", token );*/
1014                                 buffer_token[count_token] = token;
1015                                 count_token++;
1016                                 token = strtok_r( NULL, delimiters, &user_ptr );
1017                         }
1018
1019                         if( count_token == 0 )
1020                         {
1021                                 continue;
1022                         }
1023                 }
1024
1025                 read_main = 0;
1026
1027                 /* Comment */
1028                 if( *buffer_token[0] == ';' )
1029                 {
1030                         /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1031                 }
1032                 /* Main Category */
1033                 else if( *buffer_token[0] == '[' )
1034                 {
1035                         category_name = get_new_string( buffer_token[0] );
1036                         if (category_name == NULL) {
1037                                 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1038                                 continue;
1039                         }
1040
1041                         count_main_category++;
1042                         count_details = 0;
1043
1044                         while( !feof( fd ) )
1045                         {
1046                                 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1047                                 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1048
1049                                 detail_string = get_new_string( buffer_string );
1050
1051                                 token = strtok_r( buffer_string, delimiters, &user_ptr );
1052
1053                                 if( token && token[0] != ';' && length_read > -1 )
1054                                 {
1055                                         /*_mmcam_dbg_log( "token : [%s]", token );*/
1056                                         if( token[0] == '[' )
1057                                         {
1058                                                 read_main = 1;
1059                                                 buffer_token[0] = token;
1060                                                 SAFE_G_FREE( detail_string );
1061                                                 break;
1062                                         }
1063
1064                                         buffer_details[count_details++] = detail_string;
1065                                 }
1066                                 else
1067                                 {
1068                                         SAFE_G_FREE( detail_string );
1069                                 }
1070                         }
1071
1072                         /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1073
1074                         if( count_details == 0 )
1075                         {
1076                                 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1077                                 SAFE_G_FREE(category_name);
1078                                 continue;
1079                         }
1080
1081                         category = -1;
1082
1083                         /* Details */
1084                         if( type == CONFIGURE_TYPE_MAIN )
1085                         {
1086                                 if( !strcmp( "[General]", category_name ) )
1087                                 {
1088                                         category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1089                                 }
1090                                 else if( !strcmp( "[VideoInput]", category_name ) )
1091                                 {
1092                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1093                                 }
1094                                 else if( !strcmp( "[AudioInput]", category_name ) )
1095                                 {
1096                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1097                                 }
1098                                 else if( !strcmp( "[VideoOutput]", category_name ) )
1099                                 {
1100                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1101                                 }
1102                                 else if( !strcmp( "[Capture]", category_name ) )
1103                                 {
1104                                         category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1105                                 }
1106                                 else if( !strcmp( "[Record]", category_name ) )
1107                                 {
1108                                         category = CONFIGURE_CATEGORY_MAIN_RECORD;
1109                                 }
1110                                 else if( !strcmp( "[VideoEncoder]", category_name ) )
1111                                 {
1112                                         category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1113                                 }
1114                                 else if( !strcmp( "[AudioEncoder]", category_name ) )
1115                                 {
1116                                         category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1117                                 }
1118                                 else if( !strcmp( "[ImageEncoder]", category_name ) )
1119                                 {
1120                                         category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1121                                 }
1122                                 else if( !strcmp( "[Mux]", category_name ) )
1123                                 {
1124                                         category = CONFIGURE_CATEGORY_MAIN_MUX;
1125                                 }
1126                         }
1127                         else
1128                         {
1129                                 if( !strcmp( "[Camera]", category_name ) )
1130                                 {
1131                                         category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1132                                 }
1133                                 else if( !strcmp( "[Strobe]", category_name ) )
1134                                 {
1135                                         category = CONFIGURE_CATEGORY_CTRL_STROBE;
1136                                 }
1137                                 else if( !strcmp( "[Effect]", category_name ) )
1138                                 {
1139                                         category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1140                                 }
1141                                 else if( !strcmp( "[Photograph]", category_name ) )
1142                                 {
1143                                         category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1144                                 }
1145                                 else if( !strcmp( "[Capture]", category_name ) )
1146                                 {
1147                                         category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1148                                 }
1149                                 else if( !strcmp( "[Detect]", category_name ) )
1150                                 {
1151                                         category = CONFIGURE_CATEGORY_CTRL_DETECT;
1152                                 }
1153                         }
1154
1155                         if( category != -1 )
1156                         {
1157                                 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1158                                                 buffer_details, category, count_details );
1159                         }
1160                         else
1161                         {
1162                                 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1163                         }
1164
1165                         // Free memory
1166                         {
1167                                 int i;
1168
1169                                 for( i = 0 ; i < count_details ; i++ )
1170                                 {
1171                                         SAFE_G_FREE( buffer_details[i] );
1172                                 }
1173                         }
1174                 }
1175
1176                 SAFE_G_FREE(category_name);
1177         }
1178
1179         //(*configure_info) = new_conf;
1180
1181         SAFE_G_FREE( buffer_string );
1182
1183         /*_mmcam_dbg_log( "Done." );*/
1184
1185         return MM_ERROR_NONE;
1186 }
1187
1188
1189 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1190 {
1191         int i = 0;
1192         int j = 0;
1193         int k = 0;
1194         int type = CONFIGURE_VALUE_INT;
1195         int count = 0;
1196         int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1197         camera_conf *temp_conf = (*configure_info);
1198
1199         type_int2 *temp_int = NULL;
1200         type_int_range *temp_int_range = NULL;
1201         type_int_array *temp_int_array = NULL;
1202         type_int_pair_array *temp_int_pair_array = NULL;
1203         type_string2 *temp_string = NULL;
1204         type_string_array *temp_string_array = NULL;
1205         type_element2 *temp_element = NULL;
1206
1207         _mmcam_dbg_log("Entered...");
1208
1209         mmf_return_if_fail(temp_conf);
1210
1211         if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1212                 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1213         } else {
1214                 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1215         }
1216
1217         for (i = 0 ; i < category_num ; i++) {
1218                 if (temp_conf->info[i]) {
1219                         for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1220                                 if (temp_conf->info[i]->detail_info[j] == NULL) {
1221                                         continue;
1222                                 }
1223
1224                                 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1225                                         switch (type) {
1226                                         case CONFIGURE_VALUE_INT:
1227                                                 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1228                                                 SAFE_G_FREE(temp_int->name);
1229                                                 break;
1230                                         case CONFIGURE_VALUE_INT_RANGE:
1231                                                 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1232                                                 SAFE_G_FREE(temp_int_range->name);
1233                                                 break;
1234                                         case CONFIGURE_VALUE_INT_ARRAY:
1235                                                 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1236                                                 SAFE_G_FREE(temp_int_array->name);
1237                                                 SAFE_G_FREE(temp_int_array->value);
1238                                                 break;
1239                                         case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1240                                                 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1241                                                 SAFE_G_FREE(temp_int_pair_array->name);
1242                                                 SAFE_G_FREE(temp_int_pair_array->value[0]);
1243                                                 SAFE_G_FREE(temp_int_pair_array->value[1]);
1244                                                 break;
1245                                         case CONFIGURE_VALUE_STRING:
1246                                                 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1247                                                 SAFE_G_FREE(temp_string->name);
1248                                                 SAFE_G_FREE(temp_string->value);
1249                                                 break;
1250                                         case CONFIGURE_VALUE_STRING_ARRAY:
1251                                                 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1252                                                 SAFE_G_FREE(temp_string_array->name);
1253                                                 if (temp_string_array->value) {
1254                                                         count = temp_string_array->count;
1255                                                         for (k = 0 ; k < count ; k++) {
1256                                                                 SAFE_G_FREE(temp_string_array->value[k]);
1257                                                         }
1258                                                         SAFE_G_FREE(temp_string_array->value);
1259                                                 }
1260                                                 SAFE_G_FREE(temp_string_array->default_value);
1261                                                 break;
1262                                         case CONFIGURE_VALUE_ELEMENT:
1263                                                 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1264                                                 SAFE_G_FREE(temp_element->name);
1265                                                 SAFE_G_FREE(temp_element->element_name);
1266
1267                                                 if (temp_element->value_int) {
1268                                                         count = temp_element->count_int;
1269                                                         for (k = 0 ; k < count ; k++) {
1270                                                                 SAFE_G_FREE(temp_element->value_int[k]->name);
1271                                                                 SAFE_G_FREE(temp_element->value_int[k]);
1272                                                         }
1273                                                         SAFE_G_FREE(temp_element->value_int);
1274                                                 }
1275
1276                                                 if (temp_element->value_string) {
1277                                                         count = temp_element->count_string;
1278                                                         for (k = 0 ; k < count ; k++) {
1279                                                                 SAFE_G_FREE(temp_element->value_string[k]->name);
1280                                                                 SAFE_G_FREE(temp_element->value_string[k]->value);
1281                                                                 SAFE_G_FREE(temp_element->value_string[k]);
1282                                                         }
1283                                                         SAFE_G_FREE(temp_element->value_string);
1284                                                 }
1285                                                 break;
1286                                         default:
1287                                                 _mmcam_dbg_warn("unknown type %d", type);
1288                                                 break;
1289                                         }
1290                                 }
1291
1292                                 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1293                         }
1294
1295                         SAFE_G_FREE(temp_conf->info[i]->detail_info);
1296
1297                         SAFE_G_FREE(temp_conf->info[i]);
1298                         temp_conf->info[i] = NULL;
1299                 }
1300         }
1301
1302         SAFE_G_FREE((*configure_info)->info);
1303         SAFE_G_FREE((*configure_info));
1304
1305         _mmcam_dbg_log("Done.");
1306 }
1307
1308 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1309 {
1310         int i = 0;
1311         int count_value = 0;
1312
1313         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1314
1315         if (hcamcorder == NULL) {
1316                 _mmcam_dbg_err("handle is NULL");
1317                 return FALSE;
1318         }
1319
1320         /*_mmcam_dbg_log( "Entered..." );*/
1321
1322         mmf_return_val_if_fail( name, FALSE );
1323
1324         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1325         {
1326                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1327                 return FALSE;
1328         }
1329
1330         /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1331
1332         if( type == CONFIGURE_TYPE_MAIN )
1333         {
1334                 for( i = 0 ; i < count_value ; i++ )
1335                 {
1336                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1337                         {
1338                                 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1339                                 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1340                                 return TRUE;
1341                         }
1342                 }
1343         }
1344         else
1345         {
1346                 for( i = 0 ; i < count_value ; i++ )
1347                 {
1348                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1349                         {
1350                                 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1351                                 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1352                                 return TRUE;
1353                         }
1354                 }
1355         }
1356
1357         return FALSE;
1358 }
1359
1360
1361 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1362 {
1363         const int BUFFER_NUM_TOKEN = 256;
1364
1365         int i = 0;
1366         int j = 0;
1367         int count_token;
1368         int value_type;
1369         char *token = NULL;
1370         char *buffer_token[BUFFER_NUM_TOKEN];
1371         char *user_ptr = NULL;
1372
1373         const char *delimiters     = " |=,\t\n";
1374         const char *delimiters_sub = " |\t\n";
1375         const char *delimiters_3rd = "|\n";
1376
1377         mmf_return_val_if_fail( buffer_details, FALSE );
1378
1379         (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1380         if (*info == NULL) {
1381                 _mmcam_dbg_err("allocation failed");
1382                 return FALSE;
1383         }
1384         (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1385         (*info)->count = count_details;
1386
1387         for ( i = 0 ; i < count_details ; i++ ) {
1388                 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1389                 count_token = 0;
1390                 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1391
1392                 if (token) {
1393                         buffer_token[count_token] = token;
1394                         count_token++;
1395                 } else {
1396                         (*info)->detail_info[i] = NULL;
1397                         _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1398                         continue;
1399                 }
1400
1401                 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1402                         (*info)->detail_info[i] = NULL;
1403                         _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1404                         continue;
1405                 }
1406
1407                 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1408                         token = strtok_r( NULL, delimiters, &user_ptr );
1409                         while (token) {
1410                                 buffer_token[count_token] = token;
1411                                 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1412                                 count_token++;
1413                                 token = strtok_r( NULL, delimiters, &user_ptr );
1414                         }
1415
1416                         if (count_token < 2) {
1417                                 (*info)->detail_info[i] = NULL;
1418                                 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1419                                 continue;
1420                         }
1421                 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1422                         /* skip "=" */
1423                         strtok_r( NULL, delimiters_sub, &user_ptr );
1424
1425                         if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1426                                 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1427                                 while (token) {
1428                                         buffer_token[count_token] = token;
1429                                         /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1430                                         count_token++;
1431                                         token = strtok_r( NULL, delimiters_sub, &user_ptr );
1432                                 }
1433                         } else { /* CONFIGURE_VALUE_STRING */
1434                                 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1435                                 if (token) {
1436                                         g_strchug( token );
1437                                         buffer_token[count_token] = token;
1438                                         /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1439                                         count_token++;
1440                                 }
1441                         }
1442
1443                         if (count_token < 2) {
1444                                 (*info)->detail_info[i] = NULL;
1445                                 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1446                                 continue;
1447                         }
1448                 }
1449
1450                 switch (value_type)
1451                 {
1452                         case CONFIGURE_VALUE_INT:
1453                         {
1454                                 type_int2* new_int;
1455
1456                                 new_int        = (type_int2*)g_malloc0( sizeof(type_int2) );
1457                                 if ( new_int == NULL ) {
1458                                         _mmcam_dbg_err("allocation failed");
1459                                         break;
1460                                 }
1461                                 new_int->name  = get_new_string( buffer_token[0] );
1462                                 new_int->value = atoi( buffer_token[1] );
1463                                 (*info)->detail_info[i] = (void*)new_int;
1464                                 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1465                                 break;
1466                         }
1467                         case CONFIGURE_VALUE_INT_RANGE:
1468                         {
1469                                 type_int_range* new_int_range;
1470
1471                                 new_int_range                = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1472                                 if ( new_int_range == NULL ) {
1473                                         _mmcam_dbg_err("allocation failed");
1474                                         break;
1475                                 }
1476                                 new_int_range->name          = get_new_string( buffer_token[0] );
1477                                 new_int_range->min           = atoi( buffer_token[1] );
1478                                 new_int_range->max           = atoi( buffer_token[2] );
1479                                 new_int_range->default_value = atoi( buffer_token[3] );
1480                                 (*info)->detail_info[i]      = (void*)new_int_range;
1481                                 /*
1482                                 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1483                                                 new_int_range->name,
1484                                                 new_int_range->min,
1485                                                 new_int_range->max,
1486                                                 new_int_range->default_value);
1487                                 */
1488                                 break;
1489                         }
1490                         case CONFIGURE_VALUE_INT_ARRAY:
1491                         {
1492                                 int count_value = count_token - 2;
1493                                 type_int_array* new_int_array;
1494
1495                                 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1496                                 if (new_int_array == NULL) {
1497                                         _mmcam_dbg_err("allocation failed");
1498                                         break;
1499                                 }
1500                                 new_int_array->name = get_new_string( buffer_token[0] );
1501                                 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1502                                 if (new_int_array->value == NULL) {
1503                                         SAFE_G_FREE(new_int_array->name);
1504                                         SAFE_G_FREE(new_int_array);
1505                                         _mmcam_dbg_err("allocation failed");
1506                                         break;
1507                                 }
1508                                 new_int_array->count = count_value;
1509
1510                                 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1511                                 for ( j = 0 ; j < count_value ; j++ ) {
1512                                         new_int_array->value[j] = atoi( buffer_token[j+1] );
1513                                         /*_mmcam_dbg_log("   index[%d] - value[%d]", j, new_int_array->value[j]);*/
1514                                 }
1515
1516                                 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1517                                 /*_mmcam_dbg_log("   default value[%d]", new_int_array->default_value);*/
1518
1519                                 (*info)->detail_info[i] = (void*)new_int_array;
1520                                 break;
1521                         }
1522                         case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1523                         {
1524                                 int count_value = ( count_token - 3 ) >> 1;
1525                                 type_int_pair_array* new_int_pair_array;
1526
1527                                 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1528                                 if ( new_int_pair_array == NULL ) {
1529                                         _mmcam_dbg_err("allocation failed");
1530                                         break;
1531                                 }
1532                                 new_int_pair_array->name     = get_new_string( buffer_token[0] );
1533                                 new_int_pair_array->value[0] = (int*)g_malloc0( sizeof(int)*(count_value) );
1534                                 if ( new_int_pair_array->value[0] == NULL ) {
1535                                         SAFE_G_FREE(new_int_pair_array->name);
1536                                         SAFE_G_FREE(new_int_pair_array);
1537                                         _mmcam_dbg_err("allocation failed");
1538                                         break;
1539                                 }
1540                                 new_int_pair_array->value[1] = (int*)g_malloc0( sizeof(int)*(count_value) );
1541                                 if ( new_int_pair_array->value[1] == NULL ) {
1542                                         SAFE_G_FREE(new_int_pair_array->value[0]);
1543                                         SAFE_G_FREE(new_int_pair_array->name);
1544                                         SAFE_G_FREE(new_int_pair_array);
1545                                         _mmcam_dbg_err("allocation failed");
1546                                         break;
1547                                 }
1548                                 new_int_pair_array->count    = count_value;
1549
1550                                 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1551                                 for ( j = 0 ; j < count_value ; j++ ) {
1552                                         new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1553                                         new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1554                                         /*
1555                                         _mmcam_dbg_log("   index[%d] - value[%d,%d]", j,
1556                                                         new_int_pair_array->value[0][j],
1557                                                         new_int_pair_array->value[1][j]);
1558                                         */
1559                                 }
1560
1561                                 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1562                                 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1563                                 /*
1564                                 _mmcam_dbg_log("   default value[%d,%d]",
1565                                                 new_int_pair_array->default_value[0],
1566                                                 new_int_pair_array->default_value[1]);
1567                                 */
1568                                 (*info)->detail_info[i] = (void*)new_int_pair_array;
1569                                 break;
1570                         }
1571                         case CONFIGURE_VALUE_STRING:
1572                         {
1573                                 type_string2* new_string;
1574
1575                                 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1576                                 if (new_string == NULL) {
1577                                         _mmcam_dbg_err("allocation failed");
1578                                         break;
1579                                 }
1580                                 new_string->name  = get_new_string( buffer_token[0] );
1581                                 new_string->value = get_new_string( buffer_token[1] );
1582                                 (*info)->detail_info[i] = (void*)new_string;
1583
1584                                 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1585                                 break;
1586                         }
1587                         case CONFIGURE_VALUE_STRING_ARRAY:
1588                         {
1589                                 int count_value = count_token - 2;
1590                                 type_string_array* new_string_array;
1591
1592                                 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1593                                 if ( new_string_array == NULL ) {
1594                                         break;
1595                                 }
1596                                 new_string_array->name  = get_new_string( buffer_token[0] );
1597                                 new_string_array->count = count_value;
1598                                 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1599                                 if ( new_string_array->value == NULL ) {
1600                                         SAFE_G_FREE(new_string_array->name);
1601                                         SAFE_G_FREE(new_string_array);
1602                                         _mmcam_dbg_err("allocation failed");
1603                                         break;
1604                                 }
1605                                 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1606                                 for ( j = 0 ; j < count_value ; j++ ) {
1607                                         new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1608                                         /*_mmcam_dbg_log("   index[%d] - value[%s]", j, new_string_array->value[j]);*/
1609                                 }
1610
1611                                 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1612                                 /*_mmcam_dbg_log("   default value[%s]", new_string_array->default_value);*/
1613                                 (*info)->detail_info[i] = (void*)new_string_array;
1614                                 break;
1615                         }
1616                         case CONFIGURE_VALUE_ELEMENT:
1617                         {
1618                                 type_element2* new_element;
1619
1620                                 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1621                                 if ( new_element == NULL ) {
1622                                         _mmcam_dbg_err("allocation failed");
1623                                         break;
1624                                 }
1625                                 new_element->name         = get_new_string( buffer_token[0] );
1626                                 new_element->element_name = get_new_string( buffer_token[1] );
1627                                 new_element->count_int    = atoi( buffer_token[2] );
1628                                 new_element->value_int    = NULL;
1629                                 new_element->count_string = atoi( buffer_token[3] );
1630                                 new_element->value_string = NULL;
1631                                 /*
1632                                 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1633                                                new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1634                                 */
1635
1636                                 /* add int values */
1637                                 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1638                                         new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1639                                         if ( new_element->value_int) {
1640                                                 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1641                                                         new_element->value_int[j]        = (type_int2*)g_malloc0( sizeof(type_int2) );
1642                                                         if ( new_element->value_int[j] ) {
1643                                                                 new_element->value_int[j]->name  = get_new_string( buffer_token[4+(j<<1)] );
1644                                                                 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1645                                                         } else {
1646                                                                 _mmcam_dbg_err("allocation failed");
1647                                                         }
1648                                                         /*
1649                                                         _mmcam_dbg_log("   Element INT[%d] - name[%s],value[%d]",
1650                                                                        j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1651                                                         */
1652                                                 }
1653                                         } else {
1654                                                 _mmcam_dbg_err("allocation failed");
1655                                         }
1656                                 } else {
1657                                         /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1658                                         new_element->value_int = NULL;
1659                                 }
1660
1661                                 /* add string values */
1662                                 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1663                                      new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1664                                         new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1665                                         if (new_element->value_string) {
1666                                                 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1667                                                         new_element->value_string[j-new_element->count_int]     = (type_string2*)g_malloc0( sizeof(type_string2) );
1668                                                         if(new_element->value_string[j-new_element->count_int]) {
1669                                                                 new_element->value_string[j-new_element->count_int]->name       = get_new_string( buffer_token[4+(j<<1)] );
1670                                                                 new_element->value_string[j-new_element->count_int]->value      = get_new_string( buffer_token[5+(j<<1)] );
1671                                                                 /*
1672                                                                 _mmcam_dbg_log("   Element STRING[%d] - name[%s],value[%s]",
1673                                                                                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);
1674                                                                 */
1675                                                         } else {
1676                                                                 _mmcam_dbg_err("allocation failed");
1677                                                         }
1678                                                 }
1679                                         } else {
1680                                                 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1681                                         }
1682                                 } else {
1683                                         /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1684                                         new_element->value_string = NULL;
1685                                 }
1686
1687                                 (*info)->detail_info[i] = (void*)new_element;
1688                                 break;
1689                         }
1690                         default:
1691                                 break;
1692                 }
1693         }
1694
1695         return TRUE;
1696 }
1697
1698
1699 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1700 {
1701         int i, count;
1702         conf_detail* info;
1703
1704         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1705
1706         mmf_return_val_if_fail( configure_info, FALSE );
1707         mmf_return_val_if_fail( name, FALSE );
1708
1709         if( configure_info->info[category] )
1710         {
1711                 count = configure_info->info[category]->count;
1712                 info = configure_info->info[category];
1713
1714                 for( i = 0 ; i < count ; i++ )
1715                 {
1716                         if( info->detail_info[i] == NULL )
1717                         {
1718                                 continue;
1719                         }
1720
1721                         if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1722                         {
1723                                 *value = ((type_int*)(info->detail_info[i]))->value;
1724                                 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1725                                 return TRUE;
1726                         }
1727                 }
1728         }
1729
1730         if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1731         {
1732                 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1733                 return TRUE;
1734         }
1735
1736         _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1737
1738         return FALSE;
1739 }
1740
1741 int
1742 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1743 {
1744         int i, count;
1745         conf_detail* info;
1746
1747         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1748
1749         mmf_return_val_if_fail( configure_info, FALSE );
1750         mmf_return_val_if_fail( name, FALSE );
1751
1752         if( configure_info->info[category] )
1753         {
1754                 count = configure_info->info[category]->count;
1755                 info = configure_info->info[category];
1756
1757                 for( i = 0 ; i < count ; i++ )
1758                 {
1759                         if( info->detail_info[i] == NULL )
1760                         {
1761                                 continue;
1762                         }
1763
1764                         if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1765                         {
1766                                 *value = (type_int_range*)(info->detail_info[i]);
1767                                 /*
1768                                 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1769                                                 name, (*value)->min, (*value)->max, (*value)->default_value );
1770                                 */
1771                                 return TRUE;
1772                         }
1773                 }
1774         }
1775
1776         *value = NULL;
1777
1778         /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1779
1780         return FALSE;
1781 }
1782
1783 int
1784 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1785 {
1786         int i, count;
1787         conf_detail* info;
1788
1789         /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1790
1791         mmf_return_val_if_fail( configure_info, FALSE );
1792         mmf_return_val_if_fail( name, FALSE );
1793
1794         if( configure_info->info[category] )
1795         {
1796                 count   = configure_info->info[category]->count;
1797                 info    = configure_info->info[category];
1798
1799                 for( i = 0 ; i < count ; i++ )
1800                 {
1801                         if( info->detail_info[i] == NULL )
1802                         {
1803                                 continue;
1804                         }
1805
1806                         if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1807                         {
1808                                 *value = (type_int_array*)(info->detail_info[i]);
1809                                 /*
1810                                 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1811                                                 name, (*value)->value, (*value)->count, (*value)->default_value );
1812                                 */
1813                                 return TRUE;
1814                         }
1815                 }
1816         }
1817
1818         *value = NULL;
1819
1820         /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1821
1822         return FALSE;
1823 }
1824
1825 int
1826 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1827 {
1828         int i, count;
1829         conf_detail* info;
1830
1831         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1832
1833         mmf_return_val_if_fail( configure_info, FALSE );
1834         mmf_return_val_if_fail( name, FALSE );
1835
1836         if( configure_info->info[category] )
1837         {
1838                 count = configure_info->info[category]->count;
1839                 info = configure_info->info[category];
1840
1841                 for( i = 0 ; i < count ; i++ )
1842                 {
1843                         if( info->detail_info[i] == NULL )
1844                         {
1845                                 continue;
1846                         }
1847
1848                         if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1849                         {
1850                                 *value = (type_int_pair_array*)(info->detail_info[i]);
1851                                 /*
1852                                 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1853                                                 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1854                                                 (*value)->default_value[0], (*value)->default_value[1] );
1855                                 */
1856                                 return TRUE;
1857                         }
1858                 }
1859         }
1860
1861         *value = NULL;
1862
1863         _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1864
1865         return FALSE;
1866 }
1867
1868 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1869 {
1870         int i, count;
1871         conf_detail* info;
1872
1873         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1874
1875         mmf_return_val_if_fail( configure_info, FALSE );
1876         mmf_return_val_if_fail( name, FALSE );
1877
1878         if( configure_info->info[category] )
1879         {
1880                 count = configure_info->info[category]->count;
1881                 info = configure_info->info[category];
1882
1883                 for( i = 0 ; i < count ; i++ )
1884                 {
1885                         if( info->detail_info[i] == NULL )
1886                         {
1887                                 continue;
1888                         }
1889
1890                         if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1891                         {
1892                                 *value = ((type_string*)(info->detail_info[i]))->value;
1893                                 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1894                                 return TRUE;
1895                         }
1896                 }
1897         }
1898
1899         if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1900         {
1901                 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1902                 return TRUE;
1903         }
1904
1905         _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1906
1907         return FALSE;
1908 }
1909
1910 int
1911 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1912 {
1913         int i, count;
1914         conf_detail* info;
1915
1916         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1917
1918         mmf_return_val_if_fail( configure_info, FALSE );
1919         mmf_return_val_if_fail( name, FALSE );
1920
1921         if( configure_info->info[category] )
1922         {
1923                 count = configure_info->info[category]->count;
1924                 info = configure_info->info[category];
1925
1926                 for( i = 0 ; i < count ; i++ )
1927                 {
1928                         if( info->detail_info[i] == NULL )
1929                         {
1930                                 continue;
1931                         }
1932
1933                         if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1934                         {
1935                                 *value = (type_string_array*)(info->detail_info[i]);
1936                                 /*
1937                                 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1938                                                 name, (*value)->value, (*value)->count, (*value)->default_value );
1939                                 */
1940                                 return TRUE;
1941                         }
1942                 }
1943         }
1944
1945         *value = NULL;
1946
1947         /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1948
1949         return FALSE;
1950 }
1951
1952 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1953 {
1954         int i, count;
1955         conf_detail* info;
1956
1957         //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1958
1959         mmf_return_val_if_fail( configure_info, FALSE );
1960         mmf_return_val_if_fail( name, FALSE );
1961
1962         if( configure_info->info[category] )
1963         {
1964                 count = configure_info->info[category]->count;
1965                 info = configure_info->info[category];
1966
1967                 for( i = 0 ; i < count ; i++ )
1968                 {
1969                         if( info->detail_info[i] == NULL )
1970                         {
1971                                 continue;
1972                         }
1973
1974                         if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1975                         {
1976                                 *element = (type_element*)(info->detail_info[i]);
1977                                 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1978                                 return TRUE;
1979                         }
1980                 }
1981         }
1982
1983         if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1984         {
1985                 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1986                 return TRUE;
1987         }
1988
1989         _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
1990
1991         return FALSE;
1992 }
1993
1994 int
1995 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
1996 {
1997         //_mmcam_dbg_log( "Entered..." );
1998
1999         mmf_return_val_if_fail( element, FALSE );
2000
2001         *value = element->element_name;
2002
2003         //_mmcam_dbg_log( "Get element name : [%s]", *value );
2004
2005         return TRUE;
2006 }
2007
2008 int
2009 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2010 {
2011         int i;
2012
2013         //_mmcam_dbg_log( "Entered..." );
2014
2015         mmf_return_val_if_fail( element, FALSE );
2016         mmf_return_val_if_fail( name, FALSE );
2017
2018         for( i = 0 ; i < element->count_int ; i++ )
2019         {
2020                 if( !strcmp( element->value_int[i]->name , name ) )
2021                 {
2022                         *value = element->value_int[i]->value;
2023                         //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2024                         return TRUE;
2025                 }
2026         }
2027
2028         _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2029                 element->name, name, element->count_int );
2030
2031         return FALSE;
2032 }
2033
2034 int
2035 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2036 {
2037         int i;
2038
2039         //_mmcam_dbg_log( "Entered..." );
2040
2041         mmf_return_val_if_fail( element, FALSE );
2042         mmf_return_val_if_fail( name, FALSE );
2043
2044         for( i = 0 ; i < element->count_string ; i++ )
2045         {
2046                 if( !strcmp( element->value_string[i]->name , name ) )
2047                 {
2048                         *value = element->value_string[i]->value;
2049                         //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2050                         return TRUE;
2051                 }
2052         }
2053
2054         _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2055                 element->name, name, element->count_string );
2056
2057         return FALSE;
2058 }
2059
2060 int
2061 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2062 {
2063         int i;
2064
2065         //_mmcam_dbg_log( "Entered..." );
2066
2067         mmf_return_val_if_fail( gst, FALSE );
2068         mmf_return_val_if_fail( element, FALSE );
2069
2070         if( element->count_int == 0 )
2071         {
2072                 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2073         }
2074         else
2075         {
2076                 if( element->value_int == NULL )
2077                 {
2078                         _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2079                         return FALSE;
2080                 }
2081
2082                 for( i = 0 ; i < element->count_int ; i++ )
2083                 {
2084                         MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2085
2086                         /*
2087                         _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2088                                 element->element_name,
2089                                 element->value_int[i]->name,
2090                                 element->value_int[i]->value );
2091                                 */
2092                 }
2093         }
2094
2095         if( element->count_string == 0 )
2096         {
2097                 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2098         }
2099         else
2100         {
2101                 if( element->value_string == NULL )
2102                 {
2103                         _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2104                         return FALSE;
2105                 }
2106
2107                 for( i = 0 ; i < element->count_string ; i++ )
2108                 {
2109                         MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2110
2111                         _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2112                                 element->element_name,
2113                                 element->value_string[i]->name,
2114                                 element->value_string[i]->value );
2115                 }
2116         }
2117
2118         //_mmcam_dbg_log( "Done." );
2119
2120         return TRUE;
2121 }
2122
2123 int
2124 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2125 {
2126         int i = 0;
2127         int count_value = 0;
2128
2129         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2130
2131         if (hcamcorder == NULL) {
2132                 _mmcam_dbg_err("handle is NULL");
2133                 return FALSE;
2134         }
2135
2136         //_mmcam_dbg_log( "Entered..." );
2137
2138         mmf_return_val_if_fail( name, FALSE );
2139
2140         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2141         {
2142                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2143                 return FALSE;
2144         }
2145
2146         if( type == CONFIGURE_TYPE_MAIN )
2147         {
2148                 for( i = 0 ; i < count_value ; i++ )
2149                 {
2150                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2151                         {
2152                                 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2153                                 return TRUE;
2154                         }
2155                 }
2156         }
2157         else
2158         {
2159                 for( i = 0 ; i < count_value ; i++ )
2160                 {
2161                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2162                         {
2163                                 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2164                                 return TRUE;
2165                         }
2166                 }
2167         }
2168
2169         _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2170
2171         return FALSE;
2172 }
2173
2174 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2175 {
2176         int i = 0;
2177         int count_value = 0;
2178
2179         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2180
2181         if (hcamcorder == NULL) {
2182                 _mmcam_dbg_err("handle is NULL");
2183                 return FALSE;
2184         }
2185
2186         //_mmcam_dbg_log( "Entered..." );
2187
2188         mmf_return_val_if_fail( name, FALSE );
2189
2190         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2191         {
2192                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2193                 return FALSE;
2194         }
2195
2196         if( type == CONFIGURE_TYPE_MAIN )
2197         {
2198                 for( i = 0 ; i < count_value ; i++ )
2199                 {
2200                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2201                         {
2202                                 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2203                                 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2204                                 return TRUE;
2205                         }
2206                 }
2207         }
2208         else
2209         {
2210                 for( i = 0 ; i < count_value ; i++ )
2211                 {
2212                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2213                         {
2214                                 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2215                                 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2216                                 return TRUE;
2217                         }
2218                 }
2219         }
2220
2221         _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2222
2223         return FALSE;
2224 }
2225
2226 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2227 {
2228         int i = 0;
2229         int count_value = 0;
2230
2231         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2232
2233         if (hcamcorder == NULL) {
2234                 _mmcam_dbg_err("handle is NULL");
2235                 return FALSE;
2236         }
2237
2238         //_mmcam_dbg_log( "Entered..." );
2239
2240         mmf_return_val_if_fail( name, FALSE );
2241
2242         if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2243         {
2244                 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2245                 return FALSE;
2246         }
2247
2248         if( type == CONFIGURE_TYPE_MAIN )
2249         {
2250                 for( i = 0 ; i < count_value ; i++ )
2251                 {
2252                         if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2253                         {
2254                                 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2255                                 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2256                                 return TRUE;
2257                         }
2258                 }
2259         }
2260         else
2261         {
2262                 for( i = 0 ; i < count_value ; i++ )
2263                 {
2264                         if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2265                         {
2266                                 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2267                                 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2268                                 return TRUE;
2269                         }
2270                 }
2271         }
2272
2273         _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2274
2275         return FALSE;
2276 }
2277
2278 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2279 {
2280         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2281
2282         if (hcamcorder == NULL) {
2283                 _mmcam_dbg_err("handle is NULL");
2284                 return FALSE;
2285         }
2286
2287 //      mmf_return_val_if_fail( conf_main_category_size, FALSE );
2288 //      mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2289
2290         if( type == CONFIGURE_TYPE_MAIN )
2291         {
2292                 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2293
2294                 *size = (int)hcamcorder->conf_main_category_size[category];
2295         }
2296         else
2297         {
2298                 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2299
2300                 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2301         }
2302
2303         return TRUE;
2304 }
2305
2306 void
2307 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2308 {
2309         int i, j, k, type, category_type;
2310
2311         type_int                *temp_int;
2312         type_int_range          *temp_int_range;
2313         type_int_array          *temp_int_array;
2314         type_int_pair_array     *temp_int_pair_array;
2315         type_string             *temp_string;
2316         type_element            *temp_element;
2317
2318         g_print( "[ConfigureInfoPrint] : Entered.\n" );
2319
2320         mmf_return_if_fail( *configure_info );
2321
2322         if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2323         {
2324                 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2325         }
2326         else
2327         {
2328                 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2329         }
2330
2331         for( i = 0 ; i < category_type ; i++ )
2332         {
2333                 if( (*configure_info)->info[i] )
2334                 {
2335                         g_print( "[ConfigureInfo] : Category [%d]\n", i );
2336                         for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2337                         {
2338                                 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2339                                 {
2340                                         switch( type )
2341                                         {
2342                                                 case CONFIGURE_VALUE_INT:
2343                                                         temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2344                                                         g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2345                                                         break;
2346                                                 case CONFIGURE_VALUE_INT_RANGE:
2347                                                         temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2348                                                         g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2349                                                                  temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2350                                                         break;
2351                                                 case CONFIGURE_VALUE_INT_ARRAY:
2352                                                         temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2353                                                         g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n                            - ",
2354                                                                  temp_int_array->name, temp_int_array->default_value );
2355                                                         for( k = 0 ; k < temp_int_array->count ; k++ )
2356                                                         {
2357                                                                 g_print( "[%d] ", temp_int_array->value[k] );
2358                                                         }
2359                                                         g_print( "\n" );
2360                                                         break;
2361                                                 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2362                                                         temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2363                                                         g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n                            - ",
2364                                                                  temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2365                                                         for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2366                                                         {
2367                                                                 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2368                                                         }
2369                                                         g_print( "\n" );
2370                                                         break;
2371                                                 case CONFIGURE_VALUE_STRING:
2372                                                         temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2373                                                         g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2374                                                         break;
2375                                                 case CONFIGURE_VALUE_ELEMENT:
2376                                                         temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2377                                                         g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2378                                                         for( k = 0 ; k < temp_element->count_int ; k++ )
2379                                                         {
2380                                                                 g_print( "                          - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2381                                                         }
2382                                                         for( k = 0 ; k < temp_element->count_string ; k++ )
2383                                                         {
2384                                                                 g_print( "                          - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2385                                                         }
2386                                                         break;
2387                                                 default:
2388                                                         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 );
2389                                                         break;
2390                                         }
2391                                 }
2392                                 else
2393                                 {
2394                                         g_print( "[ConfigureInfo] : Failed to get value type." );
2395                                 }
2396                         }
2397                 }
2398         }
2399
2400         g_print( "[ConfigureInfoPrint] : Done.\n" );
2401 }
2402
2403
2404 static type_element *
2405 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2406 {
2407         type_element *telement = NULL;
2408         const char *codec_type_str = NULL;
2409         int codec_type = MM_AUDIO_CODEC_INVALID;
2410         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2411         _MMCamcorderSubContext *sc = NULL;
2412
2413         mmf_return_val_if_fail(hcamcorder, NULL);
2414         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2415
2416         mmf_return_val_if_fail(sc, NULL);
2417
2418         _mmcam_dbg_log("");
2419
2420         /* Check element availability */
2421         mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2422
2423         switch( codec_type )
2424         {
2425                 case MM_AUDIO_CODEC_AMR:
2426                         codec_type_str = "AMR";
2427                         break;
2428                 case MM_AUDIO_CODEC_G723_1:
2429                         codec_type_str = "G723_1";
2430                         break;
2431                 case MM_AUDIO_CODEC_MP3:
2432                         codec_type_str = "MP3";
2433                         break;
2434                 case MM_AUDIO_CODEC_AAC:
2435                         codec_type_str = "AAC";
2436                         break;
2437                 case MM_AUDIO_CODEC_MMF:
2438                         codec_type_str = "MMF";
2439                         break;
2440                 case MM_AUDIO_CODEC_ADPCM:
2441                         codec_type_str = "ADPCM";
2442                         break;
2443                 case MM_AUDIO_CODEC_WAVE:
2444                         codec_type_str = "WAVE";
2445                         break;
2446                 case MM_AUDIO_CODEC_MIDI:
2447                         codec_type_str = "MIDI";
2448                         break;
2449                 case MM_AUDIO_CODEC_IMELODY:
2450                         codec_type_str = "IMELODY";
2451                         break;
2452                 case MM_AUDIO_CODEC_VORBIS:
2453                         codec_type_str = "VORBIS";
2454                         break;
2455                 default:
2456                         _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2457                         return NULL;
2458         }
2459
2460         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2461                                       CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2462                                       codec_type_str,
2463                                       &telement);
2464
2465         return telement;
2466 }
2467
2468
2469 static type_element *
2470 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2471 {
2472         type_element *telement = NULL;
2473         const char *codec_type_str = NULL;
2474         int codec_type = MM_VIDEO_CODEC_INVALID;
2475         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2476         _MMCamcorderSubContext *sc = NULL;
2477
2478         mmf_return_val_if_fail(hcamcorder, NULL);
2479         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2480
2481         mmf_return_val_if_fail(sc, NULL);
2482
2483         _mmcam_dbg_log("");
2484
2485         /* Check element availability */
2486         mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2487
2488         switch( codec_type )
2489         {
2490                 case MM_VIDEO_CODEC_H263:
2491                         codec_type_str = "H263";
2492                         break;
2493                 case MM_VIDEO_CODEC_H264:
2494                         codec_type_str = "H264";
2495                         break;
2496                 case MM_VIDEO_CODEC_H26L:
2497                         codec_type_str = "H26L";
2498                         break;
2499                 case MM_VIDEO_CODEC_MPEG4:
2500                         codec_type_str = "MPEG4";
2501                         break;
2502                 case MM_VIDEO_CODEC_MPEG1:
2503                         codec_type_str = "MPEG1";
2504                         break;
2505                 case MM_VIDEO_CODEC_THEORA:
2506                         codec_type_str = "THEORA";
2507                         break;
2508                 default:
2509                         _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2510                         return NULL;
2511         }
2512
2513         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2514                                       CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2515                                       codec_type_str,
2516                                       &telement);
2517
2518         return telement;
2519 }
2520
2521
2522 static type_element *
2523 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2524 {
2525         type_element *telement = NULL;
2526         const char *codec_type_str = NULL;
2527         int codec_type = MM_IMAGE_CODEC_INVALID;
2528         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2529         _MMCamcorderSubContext *sc = NULL;
2530
2531         mmf_return_val_if_fail(hcamcorder, NULL);
2532         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2533
2534         mmf_return_val_if_fail(sc, NULL);
2535
2536         _mmcam_dbg_log("");
2537
2538         /* Check element availability */
2539         mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2540
2541         switch( codec_type )
2542         {
2543                 case MM_IMAGE_CODEC_JPEG:
2544                         codec_type_str = "JPEG";
2545                         break;
2546                 case MM_IMAGE_CODEC_SRW:
2547                         codec_type_str = "SRW";
2548                         break;
2549                 case MM_IMAGE_CODEC_JPEG_SRW:
2550                         codec_type_str = "JPEG_SRW";
2551                         break;
2552                 case MM_IMAGE_CODEC_PNG:
2553                         codec_type_str = "PNG";
2554                         break;
2555                 case MM_IMAGE_CODEC_BMP:
2556                         codec_type_str = "BMP";
2557                         break;
2558                 case MM_IMAGE_CODEC_WBMP:
2559                         codec_type_str = "WBMP";
2560                         break;
2561                 case MM_IMAGE_CODEC_TIFF:
2562                         codec_type_str = "TIFF";
2563                         break;
2564                 case MM_IMAGE_CODEC_PCX:
2565                         codec_type_str = "PCX";
2566                         break;
2567                 case MM_IMAGE_CODEC_GIF:
2568                         codec_type_str = "GIF";
2569                         break;
2570                 case MM_IMAGE_CODEC_ICO:
2571                         codec_type_str = "ICO";
2572                         break;
2573                 case MM_IMAGE_CODEC_RAS:
2574                         codec_type_str = "RAS";
2575                         break;
2576                 case MM_IMAGE_CODEC_TGA:
2577                         codec_type_str = "TGA";
2578                         break;
2579                 case MM_IMAGE_CODEC_XBM:
2580                         codec_type_str = "XBM";
2581                         break;
2582                 case MM_IMAGE_CODEC_XPM:
2583                         codec_type_str = "XPM";
2584                         break;
2585                 default:
2586                         _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2587                         return NULL;
2588         }
2589
2590         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2591                                       CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2592                                       codec_type_str,
2593                                       &telement);
2594
2595         return telement;
2596 }
2597
2598
2599 static type_element *
2600 __mmcamcorder_get_file_format_element(MMHandleType handle)
2601 {
2602         type_element *telement = NULL;
2603         const char *mux_type_str = NULL;
2604         int file_type = MM_FILE_FORMAT_INVALID;
2605         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2606         _MMCamcorderSubContext *sc = NULL;
2607
2608         mmf_return_val_if_fail(hcamcorder, NULL);
2609         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2610
2611         mmf_return_val_if_fail(sc, NULL);
2612
2613         _mmcam_dbg_log("");
2614
2615         /* Check element availability */
2616         mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2617
2618         switch( file_type )
2619         {
2620                 case MM_FILE_FORMAT_3GP:
2621                         mux_type_str = "3GP";
2622                         break;
2623                 case MM_FILE_FORMAT_AMR:
2624                         mux_type_str = "AMR";
2625                         break;
2626                 case MM_FILE_FORMAT_MP4:
2627                         mux_type_str = "MP4";
2628                         break;
2629                 case MM_FILE_FORMAT_AAC:
2630                         mux_type_str = "AAC";
2631                         break;
2632                 case MM_FILE_FORMAT_MP3:
2633                         mux_type_str = "MP3";
2634                         break;
2635                 case MM_FILE_FORMAT_OGG:
2636                         mux_type_str = "OGG";
2637                         break;
2638                 case MM_FILE_FORMAT_WAV:
2639                         mux_type_str = "WAV";
2640                         break;
2641                 case MM_FILE_FORMAT_AVI:
2642                         mux_type_str = "AVI";
2643                         break;
2644                 case MM_FILE_FORMAT_WMA:
2645                         mux_type_str = "WMA";
2646                         break;
2647                 case MM_FILE_FORMAT_WMV:
2648                         mux_type_str = "WMV";
2649                         break;
2650                 case MM_FILE_FORMAT_MID:
2651                         mux_type_str = "MID";
2652                         break;
2653                 case MM_FILE_FORMAT_MMF:
2654                         mux_type_str = "MMF";
2655                         break;
2656                 case MM_FILE_FORMAT_MATROSKA:
2657                         mux_type_str = "MATROSKA";
2658                         break;
2659                 case MM_FILE_FORMAT_M2TS:
2660                         mux_type_str = "M2TS";
2661                         break;
2662                 default:
2663                         _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2664                         return NULL;
2665         }
2666
2667         _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2668                                       CONFIGURE_CATEGORY_MAIN_MUX,
2669                                       mux_type_str,
2670                                       &telement);
2671
2672         return telement;
2673 }
2674
2675
2676 type_element *
2677 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2678 {
2679         type_element *telement = NULL;
2680
2681         _mmcam_dbg_log("type:%d", type);
2682
2683         switch(type)
2684         {
2685                 case MM_CAM_AUDIO_ENCODER:
2686                         telement = __mmcamcorder_get_audio_codec_element(handle);
2687                         break;
2688                 case MM_CAM_VIDEO_ENCODER:
2689                         telement = __mmcamcorder_get_video_codec_element(handle);
2690                         break;
2691                 case MM_CAM_IMAGE_ENCODER:
2692                         telement = __mmcamcorder_get_image_codec_element(handle);
2693                         break;
2694                 case MM_CAM_FILE_FORMAT:
2695                         telement = __mmcamcorder_get_file_format_element(handle);
2696                         break;
2697                 default :
2698                         _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2699         }
2700
2701         return telement;
2702 }
2703
2704
2705 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2706 {
2707         int codec_index = MM_AUDIO_CODEC_INVALID;
2708
2709         if (!name) {
2710                 _mmcam_dbg_err("name is NULL");
2711                 return MM_AUDIO_CODEC_INVALID;
2712         }
2713
2714         if (!strcmp(name, "AMR")) {
2715                 codec_index = MM_AUDIO_CODEC_AMR;
2716         } else if (!strcmp(name, "G723_1")) {
2717                 codec_index = MM_AUDIO_CODEC_G723_1;
2718         } else if (!strcmp(name, "MP3")) {
2719                 codec_index = MM_AUDIO_CODEC_MP3;
2720         } else if (!strcmp(name, "AAC")) {
2721                 codec_index = MM_AUDIO_CODEC_AAC;
2722         } else if (!strcmp(name, "MMF")) {
2723                 codec_index = MM_AUDIO_CODEC_MMF;
2724         } else if (!strcmp(name, "ADPCM")) {
2725                 codec_index = MM_AUDIO_CODEC_ADPCM;
2726         } else if (!strcmp(name, "WAVE")) {
2727                 codec_index = MM_AUDIO_CODEC_WAVE;
2728         } else if (!strcmp(name, "MIDI")) {
2729                 codec_index = MM_AUDIO_CODEC_MIDI;
2730         } else if (!strcmp(name, "IMELODY")) {
2731                 codec_index = MM_AUDIO_CODEC_IMELODY;
2732         } else if (!strcmp(name, "VORBIS")) {
2733                 codec_index = MM_AUDIO_CODEC_VORBIS;
2734         }
2735
2736         /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2737
2738         return codec_index;
2739 }
2740
2741
2742
2743 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2744 {
2745         int codec_index = MM_VIDEO_CODEC_INVALID;
2746
2747         if (!name) {
2748                 _mmcam_dbg_err("name is NULL");
2749                 return MM_VIDEO_CODEC_INVALID;
2750         }
2751
2752         if (!strcmp(name, "H263")) {
2753                 codec_index = MM_VIDEO_CODEC_H263;
2754         } else if (!strcmp(name, "H264")) {
2755                 codec_index = MM_VIDEO_CODEC_H264;
2756         } else if (!strcmp(name, "H26L")) {
2757                 codec_index = MM_VIDEO_CODEC_H26L;
2758         } else if (!strcmp(name, "MPEG4")) {
2759                 codec_index = MM_VIDEO_CODEC_MPEG4;
2760         } else if (!strcmp(name, "MPEG1")) {
2761                 codec_index = MM_VIDEO_CODEC_MPEG1;
2762         } else if (!strcmp(name, "THEORA")) {
2763                 codec_index = MM_VIDEO_CODEC_THEORA;
2764         }
2765
2766         /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2767
2768         return codec_index;
2769 }
2770
2771
2772
2773 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2774 {
2775         int codec_index = MM_IMAGE_CODEC_INVALID;
2776
2777         if (!name) {
2778                 _mmcam_dbg_err("name is NULL");
2779                 return MM_IMAGE_CODEC_INVALID;
2780         }
2781
2782         if (!strcmp(name, "JPEG")) {
2783                 codec_index = MM_IMAGE_CODEC_JPEG;
2784         } else if (!strcmp(name, "PNG")) {
2785                 codec_index = MM_IMAGE_CODEC_PNG;
2786         } else if (!strcmp(name, "BMP")) {
2787                 codec_index = MM_IMAGE_CODEC_BMP;
2788         } else if (!strcmp(name, "WBMP")) {
2789                 codec_index = MM_IMAGE_CODEC_WBMP;
2790         } else if (!strcmp(name, "TIFF")) {
2791                 codec_index = MM_IMAGE_CODEC_TIFF;
2792         } else if (!strcmp(name, "PCX")) {
2793                 codec_index = MM_IMAGE_CODEC_PCX;
2794         } else if (!strcmp(name, "GIF")) {
2795                 codec_index = MM_IMAGE_CODEC_GIF;
2796         } else if (!strcmp(name, "ICO")) {
2797                 codec_index = MM_IMAGE_CODEC_ICO;
2798         } else if (!strcmp(name, "RAS")) {
2799                 codec_index = MM_IMAGE_CODEC_RAS;
2800         } else if (!strcmp(name, "TGA")) {
2801                 codec_index = MM_IMAGE_CODEC_TGA;
2802         } else if (!strcmp(name, "XBM")) {
2803                 codec_index = MM_IMAGE_CODEC_XBM;
2804         } else if (!strcmp(name, "XPM")) {
2805                 codec_index = MM_IMAGE_CODEC_XPM;
2806         }
2807
2808         _mmcam_dbg_log("image codec index %d", codec_index);
2809
2810         return codec_index;
2811 }
2812
2813
2814 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2815 {
2816         int mux_index = MM_FILE_FORMAT_INVALID;
2817
2818         if (!name) {
2819                 _mmcam_dbg_err("name is NULL");
2820                 return MM_FILE_FORMAT_INVALID;
2821         }
2822
2823         if (!strcmp(name, "3GP")) {
2824                 mux_index = MM_FILE_FORMAT_3GP;
2825         } else if (!strcmp(name, "AMR")) {
2826                 mux_index = MM_FILE_FORMAT_AMR;
2827         } else if (!strcmp(name, "MP4")) {
2828                 mux_index = MM_FILE_FORMAT_MP4;
2829         } else if (!strcmp(name, "AAC")) {
2830                 mux_index = MM_FILE_FORMAT_AAC;
2831         } else if (!strcmp(name, "MP3")) {
2832                 mux_index = MM_FILE_FORMAT_MP3;
2833         } else if (!strcmp(name, "OGG")) {
2834                 mux_index = MM_FILE_FORMAT_OGG;
2835         } else if (!strcmp(name, "WAV")) {
2836                 mux_index = MM_FILE_FORMAT_WAV;
2837         } else if (!strcmp(name, "AVI")) {
2838                 mux_index = MM_FILE_FORMAT_AVI;
2839         } else if (!strcmp(name, "WMA")) {
2840                 mux_index = MM_FILE_FORMAT_WMA;
2841         } else if (!strcmp(name, "WMV")) {
2842                 mux_index = MM_FILE_FORMAT_WMV;
2843         } else if (!strcmp(name, "MID")) {
2844                 mux_index = MM_FILE_FORMAT_MID;
2845         } else if (!strcmp(name, "MMF")) {
2846                 mux_index = MM_FILE_FORMAT_MMF;
2847         } else if (!strcmp(name, "MATROSKA")) {
2848                 mux_index = MM_FILE_FORMAT_MATROSKA;
2849         } else if (!strcmp(name, "M2TS")) {
2850                 mux_index = MM_FILE_FORMAT_M2TS;
2851
2852         }
2853
2854         /*_mmcam_dbg_log("mux index %d", mux_index);*/
2855
2856         return mux_index;
2857 }
2858
2859
2860 int
2861 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2862 {
2863         int fmt = -1;
2864
2865         mmf_return_val_if_fail(name, -1);
2866
2867         switch(conf_category)
2868         {
2869                 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2870                         fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2871                         break;
2872                 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2873                         fmt = _mmcamcorder_get_video_codec_format(handle, name);
2874                         break;
2875                 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2876                         fmt = _mmcamcorder_get_image_codec_format(handle, name);
2877                         break;
2878                 case CONFIGURE_CATEGORY_MAIN_MUX:
2879                         fmt = _mmcamcorder_get_mux_format(handle, name);
2880                         break;
2881                 default :
2882                         _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2883         }
2884
2885         return fmt;
2886 }
2887
2888 int
2889 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2890 {
2891         mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2892         camera_conf* configure_info = NULL;
2893         int *arr = NULL;
2894         int total_count = 0;
2895
2896         mmf_return_val_if_fail(hcamcorder, 0);
2897
2898         /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2899
2900         configure_info = hcamcorder->conf_main;
2901
2902         if (configure_info->info[conf_category]) {
2903                 int i = 0;
2904                 int fmt = 0;
2905                 const char *name = NULL;
2906                 int count = configure_info->info[conf_category]->count;
2907                 conf_detail *info = configure_info->info[conf_category];
2908
2909                 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2910
2911                 if (count <= 0 || !info) {
2912                         return total_count;
2913                 }
2914
2915                 arr = (int*) g_malloc0(count * sizeof(int));
2916                 if (arr == NULL) {
2917                         _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2918                         return 0;
2919                 }
2920
2921                 for (i = 0 ; i < count ; i++) {
2922                         if (info->detail_info[i] == NULL) {
2923                                 continue;
2924                         }
2925
2926                         name = ((type_element*)(info->detail_info[i]))->name;
2927                         fmt = _mmcamcorder_get_format(handle, conf_category, name);
2928                         if (fmt >= 0) {
2929                                 arr[total_count++] = fmt;
2930                         }
2931
2932                         /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/
2933                 }
2934         }
2935
2936         *format = arr;
2937
2938         return total_count;
2939 }