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