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