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