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