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