4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /*=======================================================================================
24 =======================================================================================*/
30 #include "mm_camcorder_internal.h"
31 #include "mm_camcorder_configure.h"
33 /*-----------------------------------------------------------------------
34 | MACRO DEFINITIONS: |
35 -----------------------------------------------------------------------*/
36 #define CONFIGURE_PATH "/usr/etc"
37 #define CONFIGURE_PATH_RETRY "/opt/etc"
39 /*-----------------------------------------------------------------------
40 | GLOBAL VARIABLE DEFINITIONS |
41 -----------------------------------------------------------------------*/
43 /*-----------------------------------------------------------------------
44 | LOCAL VARIABLE DEFINITIONS |
45 -----------------------------------------------------------------------*/
47 char *get_new_string(char* src_string)
49 return strdup(src_string);
52 void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
55 int info_table_size = sizeof(conf_info_table);
57 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
59 /* Videosrc element default value */
60 static type_element _videosrc_element_default = {
69 /* Audiosrc element default value */
70 static type_int ___audiosrc_default_channel = { "Channel", 1 };
71 static type_int ___audiosrc_default_bitrate = { "BitRate", 8000 };
72 static type_int ___audiosrc_default_depth = { "Depth", 16 };
73 static type_int ___audiosrc_default_blocksize = { "BlockSize", 1280 };
74 static type_int* __audiosrc_default_int_array[] = {
75 &___audiosrc_default_channel,
76 &___audiosrc_default_bitrate,
77 &___audiosrc_default_depth,
78 &___audiosrc_default_blocksize,
80 static type_string ___audiosrc_default_device = { "Device", "default" };
81 static type_string* __audiosrc_default_string_array[] = {
82 &___audiosrc_default_device,
84 static type_element _audiosrc_element_default = {
87 __audiosrc_default_int_array,
88 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
89 __audiosrc_default_string_array,
90 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
93 static type_element _audiomodemsrc_element_default = {
94 "AudiomodemsrcElement",
96 __audiosrc_default_int_array,
97 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
98 __audiosrc_default_string_array,
99 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
103 /* Videosink element default value */
104 static type_int ___videosink_default_display_id = { "display-id", 3 };
105 static type_int ___videosink_default_x = { "x", 0 };
106 static type_int ___videosink_default_y = { "y", 0 };
107 static type_int ___videosink_default_width = { "width", 800 };
108 static type_int ___videosink_default_height = { "height", 480 };
109 static type_int ___videosink_default_rotation = { "rotation", 1 };
110 static type_int* __videosink_default_int_array[] = {
111 &___videosink_default_display_id,
112 &___videosink_default_x,
113 &___videosink_default_y,
114 &___videosink_default_width,
115 &___videosink_default_height,
116 &___videosink_default_rotation,
118 static type_string* __videosink_default_string_array[] = { NULL };
119 static type_element _videosink_element_x_default = {
122 __videosink_default_int_array,
123 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
124 __videosink_default_string_array,
125 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
127 static type_element _videosink_element_evas_default = {
128 "VideosinkElementEvas",
130 __videosink_default_int_array,
131 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
132 __videosink_default_string_array,
133 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
135 static type_element _videosink_element_gl_default = {
136 "VideosinkElementGL",
138 __videosink_default_int_array,
139 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
140 __videosink_default_string_array,
141 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
143 static type_element _videosink_element_remote_default = {
144 "VideosinkElementRemote",
146 __videosink_default_int_array,
147 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
148 __videosink_default_string_array,
149 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
151 static type_element _videosink_element_null_default = {
152 "VideosinkElementNull",
154 __videosink_default_int_array,
155 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
156 __videosink_default_string_array,
157 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
160 /* Videoscale element default value */
161 static type_element _videoscale_element_default = {
170 /* Videoconvert element default value */
171 static type_element _videoconvert_element_default = {
172 "VideoconvertElement",
180 /* Record sink element default value */
181 static type_element _recordsink_element_default = {
190 /* H263 element default value */
191 static type_element _h263_element_default = {
200 /* H264 element default value */
201 static type_element _h264_element_default = {
210 /* H26L element default value */
211 static type_element _h26l_element_default = {
220 /* MPEG4 element default value */
221 static type_element _mpeg4_element_default = {
230 /* MPEG1 element default value */
231 static type_element _mpeg1_element_default = {
240 /* THEORA element default value */
241 static type_element _theora_element_default = {
250 /* AMR element default value */
251 static type_element _amr_element_default = {
260 /* G723_1 element default value */
261 static type_element _g723_1_element_default = {
270 /* MP3 element default value */
271 static type_element _mp3_element_default = {
280 /* AAC element default value */
281 static type_element _aac_element_default = {
290 /* MMF element default value */
291 static type_element _mmf_element_default = {
300 /* ADPCM element default value */
301 static type_element _adpcm_element_default = {
303 "avenc_adpcm_ima_qt",
310 /* WAVE element default value */
311 static type_element _wave_element_default = {
320 /* VORBIS element default value */
321 static type_element _vorbis_element_default = {
330 /* MIDI element default value */
331 static type_element _midi_element_default = {
340 /* IMELODY element default value */
341 static type_element _imelody_element_default = {
350 /* JPEG element default value */
351 static type_element _jpeg_element_default = {
360 /* PNG element default value */
361 static type_element _png_element_default = {
370 /* BMP element default value */
371 static type_element _bmp_element_default = {
380 /* WBMP element default value */
381 static type_element _wbmp_element_default = {
390 /* TIFF element default value */
391 static type_element _tiff_element_default = {
400 /* PCX element default value */
401 static type_element _pcx_element_default = {
410 /* GIF element default value */
411 static type_element _gif_element_default = {
420 /* ICO element default value */
421 static type_element _ico_element_default = {
430 /* RAS element default value */
431 static type_element _ras_element_default = {
440 /* TGA element default value */
441 static type_element _tga_element_default = {
450 /* XBM element default value */
451 static type_element _xbm_element_default = {
460 /* XPM element default value */
461 static type_element _xpm_element_default = {
470 /* 3GP element default value */
471 static type_element _3gp_element_default = {
480 /* AMR mux element default value */
481 static type_element _amrmux_element_default = {
490 /* MP4 element default value */
491 static type_element _mp4_element_default = {
500 /* AAC mux element default value */
501 static type_element _aacmux_element_default = {
510 /* MP3 mux element default value */
511 static type_element _mp3mux_element_default = {
520 /* OGG element default value */
521 static type_element _ogg_element_default = {
530 /* WAV element default value */
531 static type_element _wav_element_default = {
540 /* AVI element default value */
541 static type_element _avi_element_default = {
550 /* WMA element default value */
551 static type_element _wma_element_default = {
560 /* WMV element default value */
561 static type_element _wmv_element_default = {
570 /* MID element default value */
571 static type_element _mid_element_default = {
580 /* MMF mux element default value */
581 static type_element _mmfmux_element_default = {
590 /* MATROSKA element default value */
591 static type_element _matroska_element_default = {
600 /* M2TS element default value */
601 static type_element _m2ts_element_default = {
610 /* [General] matching table */
611 static conf_info_table conf_main_general_table[] = {
612 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
613 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
614 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
615 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
618 /* [VideoInput] matching table */
619 static conf_info_table conf_main_video_input_table[] = {
620 { "UseConfCtrl", CONFIGURE_VALUE_INT, {.value_int = 1} },
621 { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {NULL} },
622 { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {NULL} },
623 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
624 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
625 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
626 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
627 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
628 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
631 /* [AudioInput] matching table */
632 static conf_info_table conf_main_audio_input_table[] = {
633 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
634 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
635 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
638 /* [VideoOutput] matching table */
639 static conf_info_table conf_main_video_output_table[] = {
640 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
641 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
642 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
643 { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_x_default} },
644 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
645 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
646 { "VideosinkElementRemote",CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
647 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
648 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
649 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
650 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
653 /* [Capture] matching table */
654 static conf_info_table conf_main_capture_table[] = {
655 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
656 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
657 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
658 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
661 /* [Record] matching table */
662 static conf_info_table conf_main_record_table[] = {
663 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
664 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
665 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
668 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
669 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
670 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
673 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
674 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
675 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
676 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
677 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
678 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
679 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
680 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
681 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
684 /* [VideoEncoder] matching table */
685 static conf_info_table conf_main_video_encoder_table[] = {
686 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
687 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
688 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
689 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
690 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
691 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
694 /* [AudioEncoder] matching table */
695 static conf_info_table conf_main_audio_encoder_table[] = {
696 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
697 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
698 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
699 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
700 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
701 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
702 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
703 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
704 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
705 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
708 /* [ImageEncoder] matching table */
709 static conf_info_table conf_main_image_encoder_table[] = {
710 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
711 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
712 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
713 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
714 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
715 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
716 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
717 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
718 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
719 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
720 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
721 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
724 /* [Mux] matching table */
725 static conf_info_table conf_main_mux_table[] = {
726 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
727 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
728 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
729 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
730 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
731 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
732 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
733 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
734 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
735 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
736 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
737 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
738 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
739 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
747 /* [Camera] matching table */
748 static conf_info_table conf_ctrl_camera_table[] = {
749 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
750 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
751 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
752 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
753 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
754 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
755 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
756 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
757 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
758 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
759 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
760 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
761 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
762 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
763 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
764 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
765 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
766 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
767 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
768 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
769 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
770 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
773 /* [Strobe] matching table */
774 static conf_info_table conf_ctrl_strobe_table[] = {
775 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
776 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
777 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
780 /* [Effect] matching table */
781 static conf_info_table conf_ctrl_effect_table[] = {
782 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
783 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
784 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
785 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
786 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
787 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
789 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
790 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
791 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
792 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
793 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
796 /* [Photograph] matching table */
797 static conf_info_table conf_ctrl_photograph_table[] = {
798 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
800 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
801 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
802 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
804 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
805 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
806 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
807 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
808 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
811 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
815 /* [Capture] matching table */
816 static conf_info_table conf_ctrl_capture_table[] = {
817 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
819 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
820 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
821 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
825 /* [Detect] matching table */
826 static conf_info_table conf_ctrl_detect_table[] = {
827 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
828 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
829 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
830 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
833 if (hcamcorder == NULL) {
834 _mmcam_dbg_err("handle is NULL");
838 _mmcam_dbg_log("Entered...");
840 if (type == CONFIGURE_TYPE_MAIN) {
841 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
842 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
843 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
844 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
845 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
846 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
847 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
848 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
849 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
850 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
852 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
853 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
854 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
855 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
856 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
857 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
858 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
859 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
860 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
861 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
863 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
865 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
866 (*configure_info)->info[i] = NULL;
869 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
870 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
871 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
872 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
873 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
874 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
876 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
877 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
878 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
879 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
880 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
881 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
883 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
885 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
886 (*configure_info)->info[i] = NULL;
890 _mmcam_dbg_log("Done.");
896 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
898 int ret = MM_ERROR_NONE;
900 char* conf_path = NULL;
902 _mmcam_dbg_log( "Opening...[%s]", ConfFile );
904 mmf_return_val_if_fail( ConfFile, FALSE );
906 conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
908 if( conf_path == NULL )
910 _mmcam_dbg_err( "malloc failed." );
911 return MM_ERROR_CAMCORDER_LOW_MEMORY;
914 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
915 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
917 fd = fopen( conf_path, "r" );
920 _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
921 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
922 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
923 fd = fopen( conf_path, "r" );
926 _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
932 ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
937 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
940 if( conf_path != NULL )
946 _mmcam_dbg_log( "Leave..." );
951 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
953 const unsigned int BUFFER_NUM_DETAILS = 256;
954 const unsigned int BUFFER_NUM_TOKEN = 20;
955 size_t BUFFER_LENGTH_STRING = 256;
956 const char* delimiters = " |=,\t\n";
959 int count_main_category = 0;
960 int count_details = 0;
965 char *buffer_string = NULL;
966 char *buffer_details[BUFFER_NUM_DETAILS];
967 char *buffer_token[BUFFER_NUM_TOKEN];
969 char *category_name = NULL;
970 char *detail_string = NULL;
971 char *user_ptr = NULL;
973 _mmcam_dbg_log( "" );
975 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
976 if (new_conf == NULL) {
977 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
978 *configure_info = NULL;
979 return MM_ERROR_CAMCORDER_LOW_MEMORY;
982 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
983 if (buffer_string == NULL) {
984 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
985 *configure_info = NULL;
987 return MM_ERROR_CAMCORDER_LOW_MEMORY;
990 new_conf->type = type;
991 *configure_info = new_conf;
993 _mmcamcorder_conf_init(handle, type, &new_conf);
996 _mmcam_dbg_err("failed file descriptor fail");
997 *configure_info = NULL;
998 g_free(buffer_string);
1000 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1004 count_main_category = 0;
1006 while( !feof( fd ) )
1008 if( read_main == 0 )
1010 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1011 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1014 token = strtok_r( buffer_string, delimiters, &user_ptr );
1016 if ((token) && (token[0] == ';') && (length_read > -1))
1018 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1024 /*_mmcam_dbg_log( "token : [%s]", token );*/
1025 buffer_token[count_token] = token;
1027 token = strtok_r( NULL, delimiters, &user_ptr );
1030 if( count_token == 0 )
1039 if( *buffer_token[0] == ';' )
1041 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1044 else if( *buffer_token[0] == '[' )
1046 category_name = get_new_string( buffer_token[0] );
1047 if (category_name == NULL) {
1048 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1052 count_main_category++;
1055 while( !feof( fd ) )
1057 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1058 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1060 detail_string = get_new_string( buffer_string );
1062 token = strtok_r( buffer_string, delimiters, &user_ptr );
1064 if( token && token[0] != ';' && length_read > -1 )
1066 /*_mmcam_dbg_log( "token : [%s]", token );*/
1067 if( token[0] == '[' )
1070 buffer_token[0] = token;
1071 SAFE_FREE( detail_string );
1075 buffer_details[count_details++] = detail_string;
1079 SAFE_FREE( detail_string );
1083 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1085 if( count_details == 0 )
1087 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1088 SAFE_FREE(category_name);
1095 if( type == CONFIGURE_TYPE_MAIN )
1097 if( !strcmp( "[General]", category_name ) )
1099 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1101 else if( !strcmp( "[VideoInput]", category_name ) )
1103 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1105 else if( !strcmp( "[AudioInput]", category_name ) )
1107 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1109 else if( !strcmp( "[VideoOutput]", category_name ) )
1111 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1113 else if( !strcmp( "[Capture]", category_name ) )
1115 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1117 else if( !strcmp( "[Record]", category_name ) )
1119 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1121 else if( !strcmp( "[VideoEncoder]", category_name ) )
1123 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1125 else if( !strcmp( "[AudioEncoder]", category_name ) )
1127 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1129 else if( !strcmp( "[ImageEncoder]", category_name ) )
1131 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1133 else if( !strcmp( "[Mux]", category_name ) )
1135 category = CONFIGURE_CATEGORY_MAIN_MUX;
1140 if( !strcmp( "[Camera]", category_name ) )
1142 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1144 else if( !strcmp( "[Strobe]", category_name ) )
1146 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1148 else if( !strcmp( "[Effect]", category_name ) )
1150 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1152 else if( !strcmp( "[Photograph]", category_name ) )
1154 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1156 else if( !strcmp( "[Capture]", category_name ) )
1158 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1160 else if( !strcmp( "[Detect]", category_name ) )
1162 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1166 if( category != -1 )
1168 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1169 buffer_details, category, count_details );
1173 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1180 for( i = 0 ; i < count_details ; i++ )
1182 SAFE_FREE( buffer_details[i] );
1187 SAFE_FREE(category_name);
1190 //(*configure_info) = new_conf;
1192 SAFE_FREE( buffer_string );
1194 /*_mmcam_dbg_log( "Done." );*/
1196 return MM_ERROR_NONE;
1200 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1205 int type = CONFIGURE_VALUE_INT;
1207 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1208 camera_conf *temp_conf = (*configure_info);
1210 type_int2 *temp_int = NULL;
1211 type_int_range *temp_int_range = NULL;
1212 type_int_array *temp_int_array = NULL;
1213 type_int_pair_array *temp_int_pair_array = NULL;
1214 type_string2 *temp_string = NULL;
1215 type_string_array *temp_string_array = NULL;
1216 type_element2 *temp_element = NULL;
1218 _mmcam_dbg_log("Entered...");
1220 mmf_return_if_fail(temp_conf);
1222 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1223 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1225 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1228 for (i = 0 ; i < category_num ; i++) {
1229 if (temp_conf->info[i]) {
1230 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1231 if (temp_conf->info[i]->detail_info[j] == NULL) {
1235 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1237 case CONFIGURE_VALUE_INT:
1238 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1239 SAFE_FREE(temp_int->name);
1241 case CONFIGURE_VALUE_INT_RANGE:
1242 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1243 SAFE_FREE(temp_int_range->name);
1245 case CONFIGURE_VALUE_INT_ARRAY:
1246 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1247 SAFE_FREE(temp_int_array->name);
1248 SAFE_FREE(temp_int_array->value);
1250 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1251 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1252 SAFE_FREE(temp_int_pair_array->name);
1253 SAFE_FREE(temp_int_pair_array->value[0]);
1254 SAFE_FREE(temp_int_pair_array->value[1]);
1256 case CONFIGURE_VALUE_STRING:
1257 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1258 SAFE_FREE(temp_string->name);
1259 SAFE_FREE(temp_string->value);
1261 case CONFIGURE_VALUE_STRING_ARRAY:
1262 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1263 SAFE_FREE(temp_string_array->name);
1264 if (temp_string_array->value) {
1265 count = temp_string_array->count;
1266 for (k = 0 ; k < count ; k++) {
1267 SAFE_FREE(temp_string_array->value[k]);
1269 g_free(temp_string_array->value);
1270 temp_string_array->value = NULL;
1272 SAFE_FREE(temp_string_array->default_value);
1274 case CONFIGURE_VALUE_ELEMENT:
1275 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1276 SAFE_FREE(temp_element->name);
1277 SAFE_FREE(temp_element->element_name);
1279 if (temp_element->value_int) {
1280 count = temp_element->count_int;
1281 for (k = 0 ; k < count ; k++) {
1282 SAFE_FREE(temp_element->value_int[k]->name);
1283 SAFE_FREE(temp_element->value_int[k]);
1285 g_free(temp_element->value_int);
1288 if (temp_element->value_string) {
1289 count = temp_element->count_string;
1290 for (k = 0 ; k < count ; k++) {
1291 SAFE_FREE(temp_element->value_string[k]->name);
1292 SAFE_FREE(temp_element->value_string[k]->value);
1293 SAFE_FREE(temp_element->value_string[k]);
1295 g_free(temp_element->value_string);
1299 _mmcam_dbg_warn("unknown type %d", type);
1304 SAFE_FREE(temp_conf->info[i]->detail_info[j]);
1305 temp_conf->info[i]->detail_info[j] = NULL;
1308 SAFE_FREE(temp_conf->info[i]->detail_info);
1309 temp_conf->info[i]->detail_info = NULL;
1311 SAFE_FREE(temp_conf->info[i]);
1312 temp_conf->info[i] = NULL;
1316 SAFE_FREE((*configure_info)->info);
1317 SAFE_FREE((*configure_info));
1319 _mmcam_dbg_log("Done.");
1322 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1325 int count_value = 0;
1327 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1329 if (hcamcorder == NULL) {
1330 _mmcam_dbg_err("handle is NULL");
1334 /*_mmcam_dbg_log( "Entered..." );*/
1336 mmf_return_val_if_fail( name, FALSE );
1338 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1340 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1344 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1346 if( type == CONFIGURE_TYPE_MAIN )
1348 for( i = 0 ; i < count_value ; i++ )
1350 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1352 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1353 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1360 for( i = 0 ; i < count_value ; i++ )
1362 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1364 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1365 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1375 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1377 const int BUFFER_NUM_TOKEN = 256;
1384 char *buffer_token[BUFFER_NUM_TOKEN];
1385 char *user_ptr = NULL;
1387 const char *delimiters = " |=,\t\n";
1388 const char *delimiters_sub = " |\t\n";
1389 const char *delimiters_3rd = "|\n";
1391 mmf_return_val_if_fail( buffer_details, FALSE );
1393 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1394 if (*info == NULL) {
1395 _mmcam_dbg_err("allocation failed");
1398 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1399 (*info)->count = count_details;
1401 for ( i = 0 ; i < count_details ; i++ ) {
1402 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1404 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1407 buffer_token[count_token] = token;
1410 (*info)->detail_info[i] = NULL;
1411 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1415 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1416 (*info)->detail_info[i] = NULL;
1417 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1421 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1422 token = strtok_r( NULL, delimiters, &user_ptr );
1424 buffer_token[count_token] = token;
1425 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1427 token = strtok_r( NULL, delimiters, &user_ptr );
1430 if (count_token < 2) {
1431 (*info)->detail_info[i] = NULL;
1432 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1435 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1437 strtok_r( NULL, delimiters_sub, &user_ptr );
1439 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1440 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1442 buffer_token[count_token] = token;
1443 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1445 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1447 } else { /* CONFIGURE_VALUE_STRING */
1448 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1451 buffer_token[count_token] = token;
1452 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1457 if (count_token < 2) {
1458 (*info)->detail_info[i] = NULL;
1459 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1466 case CONFIGURE_VALUE_INT:
1470 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1471 if ( new_int == NULL ) {
1472 _mmcam_dbg_err("allocation failed");
1475 new_int->name = get_new_string( buffer_token[0] );
1476 new_int->value = atoi( buffer_token[1] );
1477 (*info)->detail_info[i] = (void*)new_int;
1478 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1481 case CONFIGURE_VALUE_INT_RANGE:
1483 type_int_range* new_int_range;
1485 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1486 if ( new_int_range == NULL ) {
1487 _mmcam_dbg_err("allocation failed");
1490 new_int_range->name = get_new_string( buffer_token[0] );
1491 new_int_range->min = atoi( buffer_token[1] );
1492 new_int_range->max = atoi( buffer_token[2] );
1493 new_int_range->default_value = atoi( buffer_token[3] );
1494 (*info)->detail_info[i] = (void*)new_int_range;
1496 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1497 new_int_range->name,
1500 new_int_range->default_value);
1504 case CONFIGURE_VALUE_INT_ARRAY:
1506 int count_value = count_token - 2;
1507 type_int_array* new_int_array;
1509 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1510 if (new_int_array == NULL) {
1511 _mmcam_dbg_err("allocation failed");
1514 new_int_array->name = get_new_string( buffer_token[0] );
1515 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1516 if (new_int_array->value == NULL) {
1517 if (new_int_array->name) {
1518 free(new_int_array->name);
1519 new_int_array->name = NULL;
1521 free(new_int_array);
1522 new_int_array = NULL;
1523 _mmcam_dbg_err("allocation failed");
1526 new_int_array->count = count_value;
1528 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1529 for ( j = 0 ; j < count_value ; j++ ) {
1530 new_int_array->value[j] = atoi( buffer_token[j+1] );
1531 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1534 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1535 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1537 (*info)->detail_info[i] = (void*)new_int_array;
1540 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1542 int count_value = ( count_token - 3 ) >> 1;
1543 type_int_pair_array* new_int_pair_array;
1545 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1546 if ( new_int_pair_array == NULL ) {
1547 _mmcam_dbg_err("allocation failed");
1550 new_int_pair_array->name = get_new_string( buffer_token[0] );
1551 new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
1552 if ( new_int_pair_array->value[0] == NULL ) {
1553 if (new_int_pair_array->name) {
1554 free( new_int_pair_array->name );
1555 new_int_pair_array->name = NULL;
1557 g_free( new_int_pair_array );
1558 new_int_pair_array = NULL;
1559 _mmcam_dbg_err("allocation failed");
1562 new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) );
1563 if ( new_int_pair_array->value[1] == NULL ) {
1564 g_free( new_int_pair_array->value[0] );
1565 new_int_pair_array->value[0] = NULL;
1566 if (new_int_pair_array->name) {
1567 free( new_int_pair_array->name );
1568 new_int_pair_array->name = NULL;
1570 g_free( new_int_pair_array );
1571 new_int_pair_array = NULL;
1572 _mmcam_dbg_err("allocation failed");
1575 new_int_pair_array->count = count_value;
1577 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1578 for ( j = 0 ; j < count_value ; j++ ) {
1579 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1580 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1582 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1583 new_int_pair_array->value[0][j],
1584 new_int_pair_array->value[1][j]);
1588 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1589 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1591 _mmcam_dbg_log(" default value[%d,%d]",
1592 new_int_pair_array->default_value[0],
1593 new_int_pair_array->default_value[1]);
1595 (*info)->detail_info[i] = (void*)new_int_pair_array;
1598 case CONFIGURE_VALUE_STRING:
1600 type_string2* new_string;
1602 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1603 if (new_string == NULL) {
1604 _mmcam_dbg_err("allocation failed");
1607 new_string->name = get_new_string( buffer_token[0] );
1608 new_string->value = get_new_string( buffer_token[1] );
1609 (*info)->detail_info[i] = (void*)new_string;
1611 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1614 case CONFIGURE_VALUE_STRING_ARRAY:
1616 int count_value = count_token - 2;
1617 type_string_array* new_string_array;
1619 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1620 if ( new_string_array == NULL ) {
1623 new_string_array->name = get_new_string( buffer_token[0] );
1624 new_string_array->count = count_value;
1625 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1626 if ( new_string_array->value == NULL ) {
1627 if (new_string_array->name) {
1628 free(new_string_array->name);
1629 new_string_array->name = NULL;
1631 free(new_string_array);
1632 new_string_array = NULL;
1633 _mmcam_dbg_err("allocation failed");
1636 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1637 for ( j = 0 ; j < count_value ; j++ ) {
1638 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1639 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1642 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1643 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1644 (*info)->detail_info[i] = (void*)new_string_array;
1647 case CONFIGURE_VALUE_ELEMENT:
1649 type_element2* new_element;
1651 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1652 if ( new_element == NULL ) {
1653 _mmcam_dbg_err("allocation failed");
1656 new_element->name = get_new_string( buffer_token[0] );
1657 new_element->element_name = get_new_string( buffer_token[1] );
1658 new_element->count_int = atoi( buffer_token[2] );
1659 new_element->value_int = NULL;
1660 new_element->count_string = atoi( buffer_token[3] );
1661 new_element->value_string = NULL;
1663 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1664 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1667 /* add int values */
1668 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1669 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1670 if ( new_element->value_int) {
1671 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1672 new_element->value_int[j] = (type_int2*)g_malloc( sizeof(type_int2) );
1673 if ( new_element->value_int[j] ) {
1674 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1675 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1677 _mmcam_dbg_err("allocation failed");
1680 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1681 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1685 _mmcam_dbg_err("allocation failed");
1690 _mmcam_dbg_err("invalid count - %d", new_element->count_int);
1691 new_element->value_int = NULL;
1694 /* add string values */
1695 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1696 new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1697 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1698 if (new_element->value_string) {
1699 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1700 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1701 if(new_element->value_string[j-new_element->count_int]) {
1702 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1703 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1705 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1706 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);
1709 _mmcam_dbg_err("allocation failed");
1713 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1716 _mmcam_dbg_err("invalid count - %d", new_element->count_string);
1717 new_element->value_string = NULL;
1720 (*info)->detail_info[i] = (void*)new_element;
1732 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1737 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1739 mmf_return_val_if_fail( configure_info, FALSE );
1740 mmf_return_val_if_fail( name, FALSE );
1742 if( configure_info->info[category] )
1744 count = configure_info->info[category]->count;
1745 info = configure_info->info[category];
1747 for( i = 0 ; i < count ; i++ )
1749 if( info->detail_info[i] == NULL )
1754 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1756 *value = ((type_int*)(info->detail_info[i]))->value;
1757 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1763 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1765 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1769 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1775 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1780 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1782 mmf_return_val_if_fail( configure_info, FALSE );
1783 mmf_return_val_if_fail( name, FALSE );
1785 if( configure_info->info[category] )
1787 count = configure_info->info[category]->count;
1788 info = configure_info->info[category];
1790 for( i = 0 ; i < count ; i++ )
1792 if( info->detail_info[i] == NULL )
1797 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1799 *value = (type_int_range*)(info->detail_info[i]);
1801 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1802 name, (*value)->min, (*value)->max, (*value)->default_value );
1811 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1817 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1822 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1824 mmf_return_val_if_fail( configure_info, FALSE );
1825 mmf_return_val_if_fail( name, FALSE );
1827 if( configure_info->info[category] )
1829 count = configure_info->info[category]->count;
1830 info = configure_info->info[category];
1832 for( i = 0 ; i < count ; i++ )
1834 if( info->detail_info[i] == NULL )
1839 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1841 *value = (type_int_array*)(info->detail_info[i]);
1843 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1844 name, (*value)->value, (*value)->count, (*value)->default_value );
1853 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1859 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1864 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1866 mmf_return_val_if_fail( configure_info, FALSE );
1867 mmf_return_val_if_fail( name, FALSE );
1869 if( configure_info->info[category] )
1871 count = configure_info->info[category]->count;
1872 info = configure_info->info[category];
1874 for( i = 0 ; i < count ; i++ )
1876 if( info->detail_info[i] == NULL )
1881 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1883 *value = (type_int_pair_array*)(info->detail_info[i]);
1885 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1886 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1887 (*value)->default_value[0], (*value)->default_value[1] );
1896 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1901 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1906 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1908 mmf_return_val_if_fail( configure_info, FALSE );
1909 mmf_return_val_if_fail( name, FALSE );
1911 if( configure_info->info[category] )
1913 count = configure_info->info[category]->count;
1914 info = configure_info->info[category];
1916 for( i = 0 ; i < count ; i++ )
1918 if( info->detail_info[i] == NULL )
1923 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1925 *value = ((type_string*)(info->detail_info[i]))->value;
1926 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1932 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1934 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1938 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1944 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1949 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1951 mmf_return_val_if_fail( configure_info, FALSE );
1952 mmf_return_val_if_fail( name, FALSE );
1954 if( configure_info->info[category] )
1956 count = configure_info->info[category]->count;
1957 info = configure_info->info[category];
1959 for( i = 0 ; i < count ; i++ )
1961 if( info->detail_info[i] == NULL )
1966 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1968 *value = (type_string_array*)(info->detail_info[i]);
1970 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1971 name, (*value)->value, (*value)->count, (*value)->default_value );
1980 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1985 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1990 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1992 mmf_return_val_if_fail( configure_info, FALSE );
1993 mmf_return_val_if_fail( name, FALSE );
1995 if( configure_info->info[category] )
1997 count = configure_info->info[category]->count;
1998 info = configure_info->info[category];
2000 for( i = 0 ; i < count ; i++ )
2002 if( info->detail_info[i] == NULL )
2007 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
2009 *element = (type_element*)(info->detail_info[i]);
2010 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2016 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
2018 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2022 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2028 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2030 //_mmcam_dbg_log( "Entered..." );
2032 mmf_return_val_if_fail( element, FALSE );
2034 *value = element->element_name;
2036 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2042 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2046 //_mmcam_dbg_log( "Entered..." );
2048 mmf_return_val_if_fail( element, FALSE );
2049 mmf_return_val_if_fail( name, FALSE );
2051 for( i = 0 ; i < element->count_int ; i++ )
2053 if( !strcmp( element->value_int[i]->name , name ) )
2055 *value = element->value_int[i]->value;
2056 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2061 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2062 element->name, name, element->count_int );
2068 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2072 //_mmcam_dbg_log( "Entered..." );
2074 mmf_return_val_if_fail( element, FALSE );
2075 mmf_return_val_if_fail( name, FALSE );
2077 for( i = 0 ; i < element->count_string ; i++ )
2079 if( !strcmp( element->value_string[i]->name , name ) )
2081 *value = element->value_string[i]->value;
2082 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2087 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2088 element->name, name, element->count_string );
2094 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2098 //_mmcam_dbg_log( "Entered..." );
2100 mmf_return_val_if_fail( gst, FALSE );
2101 mmf_return_val_if_fail( element, FALSE );
2103 if( element->count_int == 0 )
2105 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2109 if( element->value_int == NULL )
2111 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2115 for( i = 0 ; i < element->count_int ; i++ )
2117 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2120 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2121 element->element_name,
2122 element->value_int[i]->name,
2123 element->value_int[i]->value );
2128 if( element->count_string == 0 )
2130 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2134 if( element->value_string == NULL )
2136 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2140 for( i = 0 ; i < element->count_string ; i++ )
2142 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2144 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2145 element->element_name,
2146 element->value_string[i]->name,
2147 element->value_string[i]->value );
2151 //_mmcam_dbg_log( "Done." );
2157 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2160 int count_value = 0;
2162 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2164 if (hcamcorder == NULL) {
2165 _mmcam_dbg_err("handle is NULL");
2169 //_mmcam_dbg_log( "Entered..." );
2171 mmf_return_val_if_fail( name, FALSE );
2173 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2175 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2179 if( type == CONFIGURE_TYPE_MAIN )
2181 for( i = 0 ; i < count_value ; i++ )
2183 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2185 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2192 for( i = 0 ; i < count_value ; i++ )
2194 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2196 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2202 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2207 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2210 int count_value = 0;
2212 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2214 if (hcamcorder == NULL) {
2215 _mmcam_dbg_err("handle is NULL");
2219 //_mmcam_dbg_log( "Entered..." );
2221 mmf_return_val_if_fail( name, FALSE );
2223 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2225 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2229 if( type == CONFIGURE_TYPE_MAIN )
2231 for( i = 0 ; i < count_value ; i++ )
2233 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2235 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2236 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2243 for( i = 0 ; i < count_value ; i++ )
2245 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2247 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2248 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2254 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2259 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2262 int count_value = 0;
2264 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2266 if (hcamcorder == NULL) {
2267 _mmcam_dbg_err("handle is NULL");
2271 //_mmcam_dbg_log( "Entered..." );
2273 mmf_return_val_if_fail( name, FALSE );
2275 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2277 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2281 if( type == CONFIGURE_TYPE_MAIN )
2283 for( i = 0 ; i < count_value ; i++ )
2285 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2287 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2288 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2295 for( i = 0 ; i < count_value ; i++ )
2297 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2299 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2300 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2306 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2311 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2313 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2315 if (hcamcorder == NULL) {
2316 _mmcam_dbg_err("handle is NULL");
2320 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2321 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2323 if( type == CONFIGURE_TYPE_MAIN )
2325 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2327 *size = (int)hcamcorder->conf_main_category_size[category];
2331 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2333 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2340 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2342 int i, j, k, type, category_type;
2345 type_int_range *temp_int_range;
2346 type_int_array *temp_int_array;
2347 type_int_pair_array *temp_int_pair_array;
2348 type_string *temp_string;
2349 type_element *temp_element;
2351 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2353 mmf_return_if_fail( *configure_info );
2355 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2357 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2361 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2364 for( i = 0 ; i < category_type ; i++ )
2366 if( (*configure_info)->info[i] )
2368 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2369 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2371 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2375 case CONFIGURE_VALUE_INT:
2376 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2377 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2379 case CONFIGURE_VALUE_INT_RANGE:
2380 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2381 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2382 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2384 case CONFIGURE_VALUE_INT_ARRAY:
2385 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2386 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2387 temp_int_array->name, temp_int_array->default_value );
2388 for( k = 0 ; k < temp_int_array->count ; k++ )
2390 g_print( "[%d] ", temp_int_array->value[k] );
2394 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2395 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2396 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2397 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2398 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2400 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2404 case CONFIGURE_VALUE_STRING:
2405 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2406 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2408 case CONFIGURE_VALUE_ELEMENT:
2409 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2410 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2411 for( k = 0 ; k < temp_element->count_int ; k++ )
2413 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2415 for( k = 0 ; k < temp_element->count_string ; k++ )
2417 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2421 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 );
2427 g_print( "[ConfigureInfo] : Failed to get value type." );
2433 g_print( "[ConfigureInfoPrint] : Done.\n" );
2437 static type_element *
2438 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2440 type_element *telement = NULL;
2441 const char *codec_type_str = NULL;
2442 int codec_type = MM_AUDIO_CODEC_INVALID;
2443 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2444 _MMCamcorderSubContext *sc = NULL;
2446 mmf_return_val_if_fail(hcamcorder, NULL);
2447 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2449 mmf_return_val_if_fail(sc, NULL);
2453 /* Check element availability */
2454 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2456 switch( codec_type )
2458 case MM_AUDIO_CODEC_AMR:
2459 codec_type_str = "AMR";
2461 case MM_AUDIO_CODEC_G723_1:
2462 codec_type_str = "G723_1";
2464 case MM_AUDIO_CODEC_MP3:
2465 codec_type_str = "MP3";
2467 case MM_AUDIO_CODEC_AAC:
2468 codec_type_str = "AAC";
2470 case MM_AUDIO_CODEC_MMF:
2471 codec_type_str = "MMF";
2473 case MM_AUDIO_CODEC_ADPCM:
2474 codec_type_str = "ADPCM";
2476 case MM_AUDIO_CODEC_WAVE:
2477 codec_type_str = "WAVE";
2479 case MM_AUDIO_CODEC_MIDI:
2480 codec_type_str = "MIDI";
2482 case MM_AUDIO_CODEC_IMELODY:
2483 codec_type_str = "IMELODY";
2485 case MM_AUDIO_CODEC_VORBIS:
2486 codec_type_str = "VORBIS";
2489 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2493 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2494 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2502 static type_element *
2503 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2505 type_element *telement = NULL;
2506 const char *codec_type_str = NULL;
2507 int codec_type = MM_VIDEO_CODEC_INVALID;
2508 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2509 _MMCamcorderSubContext *sc = NULL;
2511 mmf_return_val_if_fail(hcamcorder, NULL);
2512 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2514 mmf_return_val_if_fail(sc, NULL);
2518 /* Check element availability */
2519 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2521 switch( codec_type )
2523 case MM_VIDEO_CODEC_H263:
2524 codec_type_str = "H263";
2526 case MM_VIDEO_CODEC_H264:
2527 codec_type_str = "H264";
2529 case MM_VIDEO_CODEC_H26L:
2530 codec_type_str = "H26L";
2532 case MM_VIDEO_CODEC_MPEG4:
2533 codec_type_str = "MPEG4";
2535 case MM_VIDEO_CODEC_MPEG1:
2536 codec_type_str = "MPEG1";
2538 case MM_VIDEO_CODEC_THEORA:
2539 codec_type_str = "THEORA";
2542 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2546 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2547 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2555 static type_element *
2556 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2558 type_element *telement = NULL;
2559 const char *codec_type_str = NULL;
2560 int codec_type = MM_IMAGE_CODEC_INVALID;
2561 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2562 _MMCamcorderSubContext *sc = NULL;
2564 mmf_return_val_if_fail(hcamcorder, NULL);
2565 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2567 mmf_return_val_if_fail(sc, NULL);
2571 /* Check element availability */
2572 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2574 switch( codec_type )
2576 case MM_IMAGE_CODEC_JPEG:
2577 codec_type_str = "JPEG";
2579 case MM_IMAGE_CODEC_SRW:
2580 codec_type_str = "SRW";
2582 case MM_IMAGE_CODEC_JPEG_SRW:
2583 codec_type_str = "JPEG_SRW";
2585 case MM_IMAGE_CODEC_PNG:
2586 codec_type_str = "PNG";
2588 case MM_IMAGE_CODEC_BMP:
2589 codec_type_str = "BMP";
2591 case MM_IMAGE_CODEC_WBMP:
2592 codec_type_str = "WBMP";
2594 case MM_IMAGE_CODEC_TIFF:
2595 codec_type_str = "TIFF";
2597 case MM_IMAGE_CODEC_PCX:
2598 codec_type_str = "PCX";
2600 case MM_IMAGE_CODEC_GIF:
2601 codec_type_str = "GIF";
2603 case MM_IMAGE_CODEC_ICO:
2604 codec_type_str = "ICO";
2606 case MM_IMAGE_CODEC_RAS:
2607 codec_type_str = "RAS";
2609 case MM_IMAGE_CODEC_TGA:
2610 codec_type_str = "TGA";
2612 case MM_IMAGE_CODEC_XBM:
2613 codec_type_str = "XBM";
2615 case MM_IMAGE_CODEC_XPM:
2616 codec_type_str = "XPM";
2619 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2623 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2624 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2632 static type_element *
2633 __mmcamcorder_get_file_format_element(MMHandleType handle)
2635 type_element *telement = NULL;
2636 const char *mux_type_str = NULL;
2637 int file_type = MM_FILE_FORMAT_INVALID;
2638 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2639 _MMCamcorderSubContext *sc = NULL;
2641 mmf_return_val_if_fail(hcamcorder, NULL);
2642 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2644 mmf_return_val_if_fail(sc, NULL);
2648 /* Check element availability */
2649 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2653 case MM_FILE_FORMAT_3GP:
2654 mux_type_str = "3GP";
2656 case MM_FILE_FORMAT_AMR:
2657 mux_type_str = "AMR";
2659 case MM_FILE_FORMAT_MP4:
2660 mux_type_str = "MP4";
2662 case MM_FILE_FORMAT_AAC:
2663 mux_type_str = "AAC";
2665 case MM_FILE_FORMAT_MP3:
2666 mux_type_str = "MP3";
2668 case MM_FILE_FORMAT_OGG:
2669 mux_type_str = "OGG";
2671 case MM_FILE_FORMAT_WAV:
2672 mux_type_str = "WAV";
2674 case MM_FILE_FORMAT_AVI:
2675 mux_type_str = "AVI";
2677 case MM_FILE_FORMAT_WMA:
2678 mux_type_str = "WMA";
2680 case MM_FILE_FORMAT_WMV:
2681 mux_type_str = "WMV";
2683 case MM_FILE_FORMAT_MID:
2684 mux_type_str = "MID";
2686 case MM_FILE_FORMAT_MMF:
2687 mux_type_str = "MMF";
2689 case MM_FILE_FORMAT_MATROSKA:
2690 mux_type_str = "MATROSKA";
2692 case MM_FILE_FORMAT_M2TS:
2693 mux_type_str = "M2TS";
2696 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2700 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2701 CONFIGURE_CATEGORY_MAIN_MUX,
2710 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2712 type_element *telement = NULL;
2714 _mmcam_dbg_log("type:%d", type);
2718 case MM_CAM_AUDIO_ENCODER:
2719 telement = __mmcamcorder_get_audio_codec_element(handle);
2721 case MM_CAM_VIDEO_ENCODER:
2722 telement = __mmcamcorder_get_video_codec_element(handle);
2724 case MM_CAM_IMAGE_ENCODER:
2725 telement = __mmcamcorder_get_image_codec_element(handle);
2727 case MM_CAM_FILE_FORMAT:
2728 telement = __mmcamcorder_get_file_format_element(handle);
2731 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2738 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2740 int codec_index = MM_AUDIO_CODEC_INVALID;
2743 _mmcam_dbg_err("name is NULL");
2744 return MM_AUDIO_CODEC_INVALID;
2747 if (!strcmp(name, "AMR")) {
2748 codec_index = MM_AUDIO_CODEC_AMR;
2749 } else if (!strcmp(name, "G723_1")) {
2750 codec_index = MM_AUDIO_CODEC_G723_1;
2751 } else if (!strcmp(name, "MP3")) {
2752 codec_index = MM_AUDIO_CODEC_MP3;
2753 } else if (!strcmp(name, "AAC")) {
2754 codec_index = MM_AUDIO_CODEC_AAC;
2755 } else if (!strcmp(name, "MMF")) {
2756 codec_index = MM_AUDIO_CODEC_MMF;
2757 } else if (!strcmp(name, "ADPCM")) {
2758 codec_index = MM_AUDIO_CODEC_ADPCM;
2759 } else if (!strcmp(name, "WAVE")) {
2760 codec_index = MM_AUDIO_CODEC_WAVE;
2761 } else if (!strcmp(name, "MIDI")) {
2762 codec_index = MM_AUDIO_CODEC_MIDI;
2763 } else if (!strcmp(name, "IMELODY")) {
2764 codec_index = MM_AUDIO_CODEC_IMELODY;
2765 } else if (!strcmp(name, "VORBIS")) {
2766 codec_index = MM_AUDIO_CODEC_VORBIS;
2769 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2776 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2778 int codec_index = MM_VIDEO_CODEC_INVALID;
2781 _mmcam_dbg_err("name is NULL");
2782 return MM_VIDEO_CODEC_INVALID;
2785 if (!strcmp(name, "H263")) {
2786 codec_index = MM_VIDEO_CODEC_H263;
2787 } else if (!strcmp(name, "H264")) {
2788 codec_index = MM_VIDEO_CODEC_H264;
2789 } else if (!strcmp(name, "H26L")) {
2790 codec_index = MM_VIDEO_CODEC_H26L;
2791 } else if (!strcmp(name, "MPEG4")) {
2792 codec_index = MM_VIDEO_CODEC_MPEG4;
2793 } else if (!strcmp(name, "MPEG1")) {
2794 codec_index = MM_VIDEO_CODEC_MPEG1;
2795 } else if (!strcmp(name, "THEORA")) {
2796 codec_index = MM_VIDEO_CODEC_THEORA;
2799 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2806 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2808 int codec_index = MM_IMAGE_CODEC_INVALID;
2811 _mmcam_dbg_err("name is NULL");
2812 return MM_IMAGE_CODEC_INVALID;
2815 if (!strcmp(name, "JPEG")) {
2816 codec_index = MM_IMAGE_CODEC_JPEG;
2817 } else if (!strcmp(name, "PNG")) {
2818 codec_index = MM_IMAGE_CODEC_PNG;
2819 } else if (!strcmp(name, "BMP")) {
2820 codec_index = MM_IMAGE_CODEC_BMP;
2821 } else if (!strcmp(name, "WBMP")) {
2822 codec_index = MM_IMAGE_CODEC_WBMP;
2823 } else if (!strcmp(name, "TIFF")) {
2824 codec_index = MM_IMAGE_CODEC_TIFF;
2825 } else if (!strcmp(name, "PCX")) {
2826 codec_index = MM_IMAGE_CODEC_PCX;
2827 } else if (!strcmp(name, "GIF")) {
2828 codec_index = MM_IMAGE_CODEC_GIF;
2829 } else if (!strcmp(name, "ICO")) {
2830 codec_index = MM_IMAGE_CODEC_ICO;
2831 } else if (!strcmp(name, "RAS")) {
2832 codec_index = MM_IMAGE_CODEC_RAS;
2833 } else if (!strcmp(name, "TGA")) {
2834 codec_index = MM_IMAGE_CODEC_TGA;
2835 } else if (!strcmp(name, "XBM")) {
2836 codec_index = MM_IMAGE_CODEC_XBM;
2837 } else if (!strcmp(name, "XPM")) {
2838 codec_index = MM_IMAGE_CODEC_XPM;
2841 _mmcam_dbg_log("image codec index %d", codec_index);
2847 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2849 int mux_index = MM_FILE_FORMAT_INVALID;
2852 _mmcam_dbg_err("name is NULL");
2853 return MM_FILE_FORMAT_INVALID;
2856 if (!strcmp(name, "3GP")) {
2857 mux_index = MM_FILE_FORMAT_3GP;
2858 } else if (!strcmp(name, "AMR")) {
2859 mux_index = MM_FILE_FORMAT_AMR;
2860 } else if (!strcmp(name, "MP4")) {
2861 mux_index = MM_FILE_FORMAT_MP4;
2862 } else if (!strcmp(name, "AAC")) {
2863 mux_index = MM_FILE_FORMAT_AAC;
2864 } else if (!strcmp(name, "MP3")) {
2865 mux_index = MM_FILE_FORMAT_MP3;
2866 } else if (!strcmp(name, "OGG")) {
2867 mux_index = MM_FILE_FORMAT_OGG;
2868 } else if (!strcmp(name, "WAV")) {
2869 mux_index = MM_FILE_FORMAT_WAV;
2870 } else if (!strcmp(name, "AVI")) {
2871 mux_index = MM_FILE_FORMAT_AVI;
2872 } else if (!strcmp(name, "WMA")) {
2873 mux_index = MM_FILE_FORMAT_WMA;
2874 } else if (!strcmp(name, "WMV")) {
2875 mux_index = MM_FILE_FORMAT_WMV;
2876 } else if (!strcmp(name, "MID")) {
2877 mux_index = MM_FILE_FORMAT_MID;
2878 } else if (!strcmp(name, "MMF")) {
2879 mux_index = MM_FILE_FORMAT_MMF;
2880 } else if (!strcmp(name, "MATROSKA")) {
2881 mux_index = MM_FILE_FORMAT_MATROSKA;
2882 } else if (!strcmp(name, "M2TS")) {
2883 mux_index = MM_FILE_FORMAT_M2TS;
2887 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2894 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2898 mmf_return_val_if_fail(name, -1);
2900 switch(conf_category)
2902 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2903 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2905 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2906 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2908 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2909 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2911 case CONFIGURE_CATEGORY_MAIN_MUX:
2912 fmt = _mmcamcorder_get_mux_format(handle, name);
2915 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2922 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2924 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2925 camera_conf* configure_info = NULL;
2927 int total_count = 0;
2929 mmf_return_val_if_fail(hcamcorder, 0);
2931 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2933 configure_info = hcamcorder->conf_main;
2935 if (configure_info->info[conf_category]) {
2938 const char *name = NULL;
2939 int count = configure_info->info[conf_category]->count;
2940 conf_detail *info = configure_info->info[conf_category];
2942 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2944 if (count <= 0 || !info) {
2948 arr = (int*) g_malloc0(count * sizeof(int));
2950 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2954 for (i = 0 ; i < count ; i++) {
2955 if (info->detail_info[i] == NULL) {
2959 name = ((type_element*)(info->detail_info[i]))->name;
2960 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2962 arr[total_count++] = fmt;
2965 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/