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 g_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_overlay_default = {
120 "VideosinkElementOverlay",
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 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
644 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
645 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
646 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
647 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
648 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
649 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
650 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
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);
907 if (conf_path == NULL) {
908 _mmcam_dbg_err("malloc failed.");
909 return MM_ERROR_CAMCORDER_LOW_MEMORY;
912 snprintf(conf_path, strlen(ConfFile) + strlen(CONFIGURE_PATH) + 2, "%s/%s", CONFIGURE_PATH, ConfFile);
913 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
915 fd = fopen(conf_path, "r");
917 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
918 snprintf(conf_path, strlen(ConfFile) + strlen(CONFIGURE_PATH_RETRY) + 2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile);
919 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
920 fd = fopen(conf_path, "r");
922 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
927 ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
930 if (errno == ENOENT) {
931 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
933 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
937 if (conf_path != NULL) {
942 _mmcam_dbg_log("Leave...");
948 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
950 const unsigned int BUFFER_NUM_DETAILS = 256;
951 const unsigned int BUFFER_NUM_TOKEN = 20;
952 size_t BUFFER_LENGTH_STRING = 256;
953 const char* delimiters = " |=,\t\n";
956 int count_main_category = 0;
957 int count_details = 0;
962 char *buffer_string = NULL;
963 char *buffer_details[BUFFER_NUM_DETAILS];
964 char *buffer_token[BUFFER_NUM_TOKEN];
966 char *category_name = NULL;
967 char *detail_string = NULL;
968 char *user_ptr = NULL;
970 _mmcam_dbg_log( "" );
972 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
973 if (new_conf == NULL) {
974 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
975 *configure_info = NULL;
976 return MM_ERROR_CAMCORDER_LOW_MEMORY;
979 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
980 if (buffer_string == NULL) {
981 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
982 *configure_info = NULL;
983 SAFE_G_FREE(new_conf);
984 return MM_ERROR_CAMCORDER_LOW_MEMORY;
987 new_conf->type = type;
988 *configure_info = new_conf;
990 _mmcamcorder_conf_init(handle, type, &new_conf);
993 _mmcam_dbg_err("failed file descriptor fail");
994 *configure_info = NULL;
995 SAFE_G_FREE(buffer_string);
996 SAFE_G_FREE(new_conf);
997 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1001 count_main_category = 0;
1003 while( !feof( fd ) )
1005 if( read_main == 0 )
1007 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1008 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1011 token = strtok_r( buffer_string, delimiters, &user_ptr );
1013 if ((token) && (token[0] == ';') && (length_read > -1))
1015 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1021 /*_mmcam_dbg_log( "token : [%s]", token );*/
1022 buffer_token[count_token] = token;
1024 token = strtok_r( NULL, delimiters, &user_ptr );
1027 if( count_token == 0 )
1036 if( *buffer_token[0] == ';' )
1038 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1041 else if( *buffer_token[0] == '[' )
1043 category_name = get_new_string( buffer_token[0] );
1044 if (category_name == NULL) {
1045 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1049 count_main_category++;
1052 while( !feof( fd ) )
1054 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1055 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1057 detail_string = get_new_string( buffer_string );
1059 token = strtok_r( buffer_string, delimiters, &user_ptr );
1061 if( token && token[0] != ';' && length_read > -1 )
1063 /*_mmcam_dbg_log( "token : [%s]", token );*/
1064 if( token[0] == '[' )
1067 buffer_token[0] = token;
1068 SAFE_G_FREE( detail_string );
1072 buffer_details[count_details++] = detail_string;
1076 SAFE_G_FREE( detail_string );
1080 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1082 if( count_details == 0 )
1084 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1085 SAFE_G_FREE(category_name);
1092 if( type == CONFIGURE_TYPE_MAIN )
1094 if( !strcmp( "[General]", category_name ) )
1096 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1098 else if( !strcmp( "[VideoInput]", category_name ) )
1100 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1102 else if( !strcmp( "[AudioInput]", category_name ) )
1104 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1106 else if( !strcmp( "[VideoOutput]", category_name ) )
1108 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1110 else if( !strcmp( "[Capture]", category_name ) )
1112 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1114 else if( !strcmp( "[Record]", category_name ) )
1116 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1118 else if( !strcmp( "[VideoEncoder]", category_name ) )
1120 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1122 else if( !strcmp( "[AudioEncoder]", category_name ) )
1124 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1126 else if( !strcmp( "[ImageEncoder]", category_name ) )
1128 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1130 else if( !strcmp( "[Mux]", category_name ) )
1132 category = CONFIGURE_CATEGORY_MAIN_MUX;
1137 if( !strcmp( "[Camera]", category_name ) )
1139 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1141 else if( !strcmp( "[Strobe]", category_name ) )
1143 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1145 else if( !strcmp( "[Effect]", category_name ) )
1147 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1149 else if( !strcmp( "[Photograph]", category_name ) )
1151 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1153 else if( !strcmp( "[Capture]", category_name ) )
1155 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1157 else if( !strcmp( "[Detect]", category_name ) )
1159 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1163 if( category != -1 )
1165 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1166 buffer_details, category, count_details );
1170 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1177 for( i = 0 ; i < count_details ; i++ )
1179 SAFE_G_FREE( buffer_details[i] );
1184 SAFE_G_FREE(category_name);
1187 //(*configure_info) = new_conf;
1189 SAFE_G_FREE( buffer_string );
1191 /*_mmcam_dbg_log( "Done." );*/
1193 return MM_ERROR_NONE;
1197 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1202 int type = CONFIGURE_VALUE_INT;
1204 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1205 camera_conf *temp_conf = (*configure_info);
1207 type_int2 *temp_int = NULL;
1208 type_int_range *temp_int_range = NULL;
1209 type_int_array *temp_int_array = NULL;
1210 type_int_pair_array *temp_int_pair_array = NULL;
1211 type_string2 *temp_string = NULL;
1212 type_string_array *temp_string_array = NULL;
1213 type_element2 *temp_element = NULL;
1215 _mmcam_dbg_log("Entered...");
1217 mmf_return_if_fail(temp_conf);
1219 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1220 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1222 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1225 for (i = 0 ; i < category_num ; i++) {
1226 if (temp_conf->info[i]) {
1227 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1228 if (temp_conf->info[i]->detail_info[j] == NULL) {
1232 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1234 case CONFIGURE_VALUE_INT:
1235 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1236 SAFE_G_FREE(temp_int->name);
1238 case CONFIGURE_VALUE_INT_RANGE:
1239 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1240 SAFE_G_FREE(temp_int_range->name);
1242 case CONFIGURE_VALUE_INT_ARRAY:
1243 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1244 SAFE_G_FREE(temp_int_array->name);
1245 SAFE_G_FREE(temp_int_array->value);
1247 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1248 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1249 SAFE_G_FREE(temp_int_pair_array->name);
1250 SAFE_G_FREE(temp_int_pair_array->value[0]);
1251 SAFE_G_FREE(temp_int_pair_array->value[1]);
1253 case CONFIGURE_VALUE_STRING:
1254 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1255 SAFE_G_FREE(temp_string->name);
1256 SAFE_G_FREE(temp_string->value);
1258 case CONFIGURE_VALUE_STRING_ARRAY:
1259 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1260 SAFE_G_FREE(temp_string_array->name);
1261 if (temp_string_array->value) {
1262 count = temp_string_array->count;
1263 for (k = 0 ; k < count ; k++) {
1264 SAFE_G_FREE(temp_string_array->value[k]);
1266 SAFE_G_FREE(temp_string_array->value);
1268 SAFE_G_FREE(temp_string_array->default_value);
1270 case CONFIGURE_VALUE_ELEMENT:
1271 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1272 SAFE_G_FREE(temp_element->name);
1273 SAFE_G_FREE(temp_element->element_name);
1275 if (temp_element->value_int) {
1276 count = temp_element->count_int;
1277 for (k = 0 ; k < count ; k++) {
1278 SAFE_G_FREE(temp_element->value_int[k]->name);
1279 SAFE_G_FREE(temp_element->value_int[k]);
1281 SAFE_G_FREE(temp_element->value_int);
1284 if (temp_element->value_string) {
1285 count = temp_element->count_string;
1286 for (k = 0 ; k < count ; k++) {
1287 SAFE_G_FREE(temp_element->value_string[k]->name);
1288 SAFE_G_FREE(temp_element->value_string[k]->value);
1289 SAFE_G_FREE(temp_element->value_string[k]);
1291 SAFE_G_FREE(temp_element->value_string);
1295 _mmcam_dbg_warn("unknown type %d", type);
1300 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1303 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1305 SAFE_G_FREE(temp_conf->info[i]);
1306 temp_conf->info[i] = NULL;
1310 SAFE_G_FREE((*configure_info)->info);
1311 SAFE_G_FREE((*configure_info));
1313 _mmcam_dbg_log("Done.");
1316 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1319 int count_value = 0;
1321 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1323 if (hcamcorder == NULL) {
1324 _mmcam_dbg_err("handle is NULL");
1328 /*_mmcam_dbg_log( "Entered..." );*/
1330 mmf_return_val_if_fail( name, FALSE );
1332 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1334 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1338 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1340 if( type == CONFIGURE_TYPE_MAIN )
1342 for( i = 0 ; i < count_value ; i++ )
1344 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1346 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1347 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1354 for( i = 0 ; i < count_value ; i++ )
1356 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1358 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1359 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1369 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1371 const int BUFFER_NUM_TOKEN = 256;
1378 char *buffer_token[BUFFER_NUM_TOKEN];
1379 char *user_ptr = NULL;
1381 const char *delimiters = " |=,\t\n";
1382 const char *delimiters_sub = " |\t\n";
1383 const char *delimiters_3rd = "|\n";
1385 mmf_return_val_if_fail( buffer_details, FALSE );
1387 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1388 if (*info == NULL) {
1389 _mmcam_dbg_err("allocation failed");
1392 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1393 (*info)->count = count_details;
1395 for ( i = 0 ; i < count_details ; i++ ) {
1396 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1398 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1401 buffer_token[count_token] = token;
1404 (*info)->detail_info[i] = NULL;
1405 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1409 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1410 (*info)->detail_info[i] = NULL;
1411 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1415 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1416 token = strtok_r( NULL, delimiters, &user_ptr );
1418 buffer_token[count_token] = token;
1419 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1421 token = strtok_r( NULL, delimiters, &user_ptr );
1424 if (count_token < 2) {
1425 (*info)->detail_info[i] = NULL;
1426 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1429 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1431 strtok_r( NULL, delimiters_sub, &user_ptr );
1433 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1434 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1436 buffer_token[count_token] = token;
1437 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1439 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1441 } else { /* CONFIGURE_VALUE_STRING */
1442 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1445 buffer_token[count_token] = token;
1446 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1451 if (count_token < 2) {
1452 (*info)->detail_info[i] = NULL;
1453 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1460 case CONFIGURE_VALUE_INT:
1464 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1465 if ( new_int == NULL ) {
1466 _mmcam_dbg_err("allocation failed");
1469 new_int->name = get_new_string( buffer_token[0] );
1470 new_int->value = atoi( buffer_token[1] );
1471 (*info)->detail_info[i] = (void*)new_int;
1472 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1475 case CONFIGURE_VALUE_INT_RANGE:
1477 type_int_range* new_int_range;
1479 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1480 if ( new_int_range == NULL ) {
1481 _mmcam_dbg_err("allocation failed");
1484 new_int_range->name = get_new_string( buffer_token[0] );
1485 new_int_range->min = atoi( buffer_token[1] );
1486 new_int_range->max = atoi( buffer_token[2] );
1487 new_int_range->default_value = atoi( buffer_token[3] );
1488 (*info)->detail_info[i] = (void*)new_int_range;
1490 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1491 new_int_range->name,
1494 new_int_range->default_value);
1498 case CONFIGURE_VALUE_INT_ARRAY:
1500 int count_value = count_token - 2;
1501 type_int_array* new_int_array;
1503 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1504 if (new_int_array == NULL) {
1505 _mmcam_dbg_err("allocation failed");
1508 new_int_array->name = get_new_string( buffer_token[0] );
1509 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1510 if (new_int_array->value == NULL) {
1511 SAFE_G_FREE(new_int_array->name);
1512 SAFE_G_FREE(new_int_array);
1513 _mmcam_dbg_err("allocation failed");
1516 new_int_array->count = count_value;
1518 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1519 for ( j = 0 ; j < count_value ; j++ ) {
1520 new_int_array->value[j] = atoi( buffer_token[j+1] );
1521 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1524 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1525 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1527 (*info)->detail_info[i] = (void*)new_int_array;
1530 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1532 int count_value = ( count_token - 3 ) >> 1;
1533 type_int_pair_array* new_int_pair_array;
1535 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1536 if ( new_int_pair_array == NULL ) {
1537 _mmcam_dbg_err("allocation failed");
1540 new_int_pair_array->name = get_new_string( buffer_token[0] );
1541 new_int_pair_array->value[0] = (int*)g_malloc0( sizeof(int)*(count_value) );
1542 if ( new_int_pair_array->value[0] == NULL ) {
1543 SAFE_G_FREE(new_int_pair_array->name);
1544 SAFE_G_FREE(new_int_pair_array);
1545 _mmcam_dbg_err("allocation failed");
1548 new_int_pair_array->value[1] = (int*)g_malloc0( sizeof(int)*(count_value) );
1549 if ( new_int_pair_array->value[1] == NULL ) {
1550 SAFE_G_FREE(new_int_pair_array->value[0]);
1551 SAFE_G_FREE(new_int_pair_array->name);
1552 SAFE_G_FREE(new_int_pair_array);
1553 _mmcam_dbg_err("allocation failed");
1556 new_int_pair_array->count = count_value;
1558 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1559 for ( j = 0 ; j < count_value ; j++ ) {
1560 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1561 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1563 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1564 new_int_pair_array->value[0][j],
1565 new_int_pair_array->value[1][j]);
1569 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1570 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1572 _mmcam_dbg_log(" default value[%d,%d]",
1573 new_int_pair_array->default_value[0],
1574 new_int_pair_array->default_value[1]);
1576 (*info)->detail_info[i] = (void*)new_int_pair_array;
1579 case CONFIGURE_VALUE_STRING:
1581 type_string2* new_string;
1583 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1584 if (new_string == NULL) {
1585 _mmcam_dbg_err("allocation failed");
1588 new_string->name = get_new_string( buffer_token[0] );
1589 new_string->value = get_new_string( buffer_token[1] );
1590 (*info)->detail_info[i] = (void*)new_string;
1592 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1595 case CONFIGURE_VALUE_STRING_ARRAY:
1597 int count_value = count_token - 2;
1598 type_string_array* new_string_array;
1600 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1601 if ( new_string_array == NULL ) {
1604 new_string_array->name = get_new_string( buffer_token[0] );
1605 new_string_array->count = count_value;
1606 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1607 if ( new_string_array->value == NULL ) {
1608 SAFE_G_FREE(new_string_array->name);
1609 SAFE_G_FREE(new_string_array);
1610 _mmcam_dbg_err("allocation failed");
1613 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1614 for ( j = 0 ; j < count_value ; j++ ) {
1615 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1616 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1619 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1620 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1621 (*info)->detail_info[i] = (void*)new_string_array;
1624 case CONFIGURE_VALUE_ELEMENT:
1626 type_element2* new_element;
1628 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1629 if ( new_element == NULL ) {
1630 _mmcam_dbg_err("allocation failed");
1633 new_element->name = get_new_string( buffer_token[0] );
1634 new_element->element_name = get_new_string( buffer_token[1] );
1635 new_element->count_int = atoi( buffer_token[2] );
1636 new_element->value_int = NULL;
1637 new_element->count_string = atoi( buffer_token[3] );
1638 new_element->value_string = NULL;
1640 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1641 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1644 /* add int values */
1645 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1646 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1647 if ( new_element->value_int) {
1648 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1649 new_element->value_int[j] = (type_int2*)g_malloc0( sizeof(type_int2) );
1650 if ( new_element->value_int[j] ) {
1651 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1652 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1654 _mmcam_dbg_err("allocation failed");
1657 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1658 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1662 _mmcam_dbg_err("allocation failed");
1665 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1666 new_element->value_int = NULL;
1669 /* add string values */
1670 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1671 new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1672 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1673 if (new_element->value_string) {
1674 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1675 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1676 if(new_element->value_string[j-new_element->count_int]) {
1677 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1678 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1680 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1681 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);
1684 _mmcam_dbg_err("allocation failed");
1688 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1691 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1692 new_element->value_string = NULL;
1695 (*info)->detail_info[i] = (void*)new_element;
1707 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1712 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1714 mmf_return_val_if_fail( configure_info, FALSE );
1715 mmf_return_val_if_fail( name, FALSE );
1717 if( configure_info->info[category] )
1719 count = configure_info->info[category]->count;
1720 info = configure_info->info[category];
1722 for( i = 0 ; i < count ; i++ )
1724 if( info->detail_info[i] == NULL )
1729 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1731 *value = ((type_int*)(info->detail_info[i]))->value;
1732 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1738 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1740 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1744 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1750 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1755 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1757 mmf_return_val_if_fail( configure_info, FALSE );
1758 mmf_return_val_if_fail( name, FALSE );
1760 if( configure_info->info[category] )
1762 count = configure_info->info[category]->count;
1763 info = configure_info->info[category];
1765 for( i = 0 ; i < count ; i++ )
1767 if( info->detail_info[i] == NULL )
1772 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1774 *value = (type_int_range*)(info->detail_info[i]);
1776 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1777 name, (*value)->min, (*value)->max, (*value)->default_value );
1786 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1792 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1797 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1799 mmf_return_val_if_fail( configure_info, FALSE );
1800 mmf_return_val_if_fail( name, FALSE );
1802 if( configure_info->info[category] )
1804 count = configure_info->info[category]->count;
1805 info = configure_info->info[category];
1807 for( i = 0 ; i < count ; i++ )
1809 if( info->detail_info[i] == NULL )
1814 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1816 *value = (type_int_array*)(info->detail_info[i]);
1818 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1819 name, (*value)->value, (*value)->count, (*value)->default_value );
1828 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1834 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1839 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1841 mmf_return_val_if_fail( configure_info, FALSE );
1842 mmf_return_val_if_fail( name, FALSE );
1844 if( configure_info->info[category] )
1846 count = configure_info->info[category]->count;
1847 info = configure_info->info[category];
1849 for( i = 0 ; i < count ; i++ )
1851 if( info->detail_info[i] == NULL )
1856 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1858 *value = (type_int_pair_array*)(info->detail_info[i]);
1860 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1861 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1862 (*value)->default_value[0], (*value)->default_value[1] );
1871 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1876 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1881 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1883 mmf_return_val_if_fail( configure_info, FALSE );
1884 mmf_return_val_if_fail( name, FALSE );
1886 if( configure_info->info[category] )
1888 count = configure_info->info[category]->count;
1889 info = configure_info->info[category];
1891 for( i = 0 ; i < count ; i++ )
1893 if( info->detail_info[i] == NULL )
1898 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1900 *value = ((type_string*)(info->detail_info[i]))->value;
1901 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1907 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1909 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1913 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1919 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1924 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1926 mmf_return_val_if_fail( configure_info, FALSE );
1927 mmf_return_val_if_fail( name, FALSE );
1929 if( configure_info->info[category] )
1931 count = configure_info->info[category]->count;
1932 info = configure_info->info[category];
1934 for( i = 0 ; i < count ; i++ )
1936 if( info->detail_info[i] == NULL )
1941 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1943 *value = (type_string_array*)(info->detail_info[i]);
1945 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1946 name, (*value)->value, (*value)->count, (*value)->default_value );
1955 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1960 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1965 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1967 mmf_return_val_if_fail( configure_info, FALSE );
1968 mmf_return_val_if_fail( name, FALSE );
1970 if( configure_info->info[category] )
1972 count = configure_info->info[category]->count;
1973 info = configure_info->info[category];
1975 for( i = 0 ; i < count ; i++ )
1977 if( info->detail_info[i] == NULL )
1982 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1984 *element = (type_element*)(info->detail_info[i]);
1985 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1991 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1993 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1997 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2003 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2005 //_mmcam_dbg_log( "Entered..." );
2007 mmf_return_val_if_fail( element, FALSE );
2009 *value = element->element_name;
2011 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2017 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2021 //_mmcam_dbg_log( "Entered..." );
2023 mmf_return_val_if_fail( element, FALSE );
2024 mmf_return_val_if_fail( name, FALSE );
2026 for( i = 0 ; i < element->count_int ; i++ )
2028 if( !strcmp( element->value_int[i]->name , name ) )
2030 *value = element->value_int[i]->value;
2031 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2036 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2037 element->name, name, element->count_int );
2043 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2047 //_mmcam_dbg_log( "Entered..." );
2049 mmf_return_val_if_fail( element, FALSE );
2050 mmf_return_val_if_fail( name, FALSE );
2052 for( i = 0 ; i < element->count_string ; i++ )
2054 if( !strcmp( element->value_string[i]->name , name ) )
2056 *value = element->value_string[i]->value;
2057 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2062 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2063 element->name, name, element->count_string );
2069 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2073 //_mmcam_dbg_log( "Entered..." );
2075 mmf_return_val_if_fail( gst, FALSE );
2076 mmf_return_val_if_fail( element, FALSE );
2078 if( element->count_int == 0 )
2080 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2084 if( element->value_int == NULL )
2086 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2090 for( i = 0 ; i < element->count_int ; i++ )
2092 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2095 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2096 element->element_name,
2097 element->value_int[i]->name,
2098 element->value_int[i]->value );
2103 if( element->count_string == 0 )
2105 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2109 if( element->value_string == NULL )
2111 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2115 for( i = 0 ; i < element->count_string ; i++ )
2117 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2119 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2120 element->element_name,
2121 element->value_string[i]->name,
2122 element->value_string[i]->value );
2126 //_mmcam_dbg_log( "Done." );
2132 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2135 int count_value = 0;
2137 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2139 if (hcamcorder == NULL) {
2140 _mmcam_dbg_err("handle is NULL");
2144 //_mmcam_dbg_log( "Entered..." );
2146 mmf_return_val_if_fail( name, FALSE );
2148 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2150 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2154 if( type == CONFIGURE_TYPE_MAIN )
2156 for( i = 0 ; i < count_value ; i++ )
2158 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2160 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2167 for( i = 0 ; i < count_value ; i++ )
2169 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2171 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2177 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2182 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2185 int count_value = 0;
2187 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2189 if (hcamcorder == NULL) {
2190 _mmcam_dbg_err("handle is NULL");
2194 //_mmcam_dbg_log( "Entered..." );
2196 mmf_return_val_if_fail( name, FALSE );
2198 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2200 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2204 if( type == CONFIGURE_TYPE_MAIN )
2206 for( i = 0 ; i < count_value ; i++ )
2208 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2210 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2211 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2218 for( i = 0 ; i < count_value ; i++ )
2220 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2222 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2223 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2229 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2234 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2237 int count_value = 0;
2239 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2241 if (hcamcorder == NULL) {
2242 _mmcam_dbg_err("handle is NULL");
2246 //_mmcam_dbg_log( "Entered..." );
2248 mmf_return_val_if_fail( name, FALSE );
2250 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2252 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2256 if( type == CONFIGURE_TYPE_MAIN )
2258 for( i = 0 ; i < count_value ; i++ )
2260 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2262 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2263 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2270 for( i = 0 ; i < count_value ; i++ )
2272 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2274 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2275 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2281 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2286 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2288 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2290 if (hcamcorder == NULL) {
2291 _mmcam_dbg_err("handle is NULL");
2295 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2296 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2298 if( type == CONFIGURE_TYPE_MAIN )
2300 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2302 *size = (int)hcamcorder->conf_main_category_size[category];
2306 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2308 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2315 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2317 int i, j, k, type, category_type;
2320 type_int_range *temp_int_range;
2321 type_int_array *temp_int_array;
2322 type_int_pair_array *temp_int_pair_array;
2323 type_string *temp_string;
2324 type_element *temp_element;
2326 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2328 mmf_return_if_fail( *configure_info );
2330 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2332 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2336 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2339 for( i = 0 ; i < category_type ; i++ )
2341 if( (*configure_info)->info[i] )
2343 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2344 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2346 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2350 case CONFIGURE_VALUE_INT:
2351 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2352 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2354 case CONFIGURE_VALUE_INT_RANGE:
2355 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2356 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2357 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2359 case CONFIGURE_VALUE_INT_ARRAY:
2360 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2361 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2362 temp_int_array->name, temp_int_array->default_value );
2363 for( k = 0 ; k < temp_int_array->count ; k++ )
2365 g_print( "[%d] ", temp_int_array->value[k] );
2369 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2370 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2371 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2372 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2373 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2375 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2379 case CONFIGURE_VALUE_STRING:
2380 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2381 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2383 case CONFIGURE_VALUE_ELEMENT:
2384 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2385 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2386 for( k = 0 ; k < temp_element->count_int ; k++ )
2388 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2390 for( k = 0 ; k < temp_element->count_string ; k++ )
2392 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2396 g_print( "[ConfigureInfo] : Not matched value type... So can not print data... check it... Name[%s],type[%d]\n", ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, type );
2402 g_print( "[ConfigureInfo] : Failed to get value type." );
2408 g_print( "[ConfigureInfoPrint] : Done.\n" );
2412 static type_element *
2413 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2415 type_element *telement = NULL;
2416 const char *codec_type_str = NULL;
2417 int codec_type = MM_AUDIO_CODEC_INVALID;
2418 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2419 _MMCamcorderSubContext *sc = NULL;
2421 mmf_return_val_if_fail(hcamcorder, NULL);
2422 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2424 mmf_return_val_if_fail(sc, NULL);
2428 /* Check element availability */
2429 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2431 switch( codec_type )
2433 case MM_AUDIO_CODEC_AMR:
2434 codec_type_str = "AMR";
2436 case MM_AUDIO_CODEC_G723_1:
2437 codec_type_str = "G723_1";
2439 case MM_AUDIO_CODEC_MP3:
2440 codec_type_str = "MP3";
2442 case MM_AUDIO_CODEC_AAC:
2443 codec_type_str = "AAC";
2445 case MM_AUDIO_CODEC_MMF:
2446 codec_type_str = "MMF";
2448 case MM_AUDIO_CODEC_ADPCM:
2449 codec_type_str = "ADPCM";
2451 case MM_AUDIO_CODEC_WAVE:
2452 codec_type_str = "WAVE";
2454 case MM_AUDIO_CODEC_MIDI:
2455 codec_type_str = "MIDI";
2457 case MM_AUDIO_CODEC_IMELODY:
2458 codec_type_str = "IMELODY";
2460 case MM_AUDIO_CODEC_VORBIS:
2461 codec_type_str = "VORBIS";
2464 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2468 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2469 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2477 static type_element *
2478 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2480 type_element *telement = NULL;
2481 const char *codec_type_str = NULL;
2482 int codec_type = MM_VIDEO_CODEC_INVALID;
2483 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2484 _MMCamcorderSubContext *sc = NULL;
2486 mmf_return_val_if_fail(hcamcorder, NULL);
2487 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2489 mmf_return_val_if_fail(sc, NULL);
2493 /* Check element availability */
2494 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2496 switch( codec_type )
2498 case MM_VIDEO_CODEC_H263:
2499 codec_type_str = "H263";
2501 case MM_VIDEO_CODEC_H264:
2502 codec_type_str = "H264";
2504 case MM_VIDEO_CODEC_H26L:
2505 codec_type_str = "H26L";
2507 case MM_VIDEO_CODEC_MPEG4:
2508 codec_type_str = "MPEG4";
2510 case MM_VIDEO_CODEC_MPEG1:
2511 codec_type_str = "MPEG1";
2513 case MM_VIDEO_CODEC_THEORA:
2514 codec_type_str = "THEORA";
2517 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2521 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2522 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2530 static type_element *
2531 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2533 type_element *telement = NULL;
2534 const char *codec_type_str = NULL;
2535 int codec_type = MM_IMAGE_CODEC_INVALID;
2536 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2537 _MMCamcorderSubContext *sc = NULL;
2539 mmf_return_val_if_fail(hcamcorder, NULL);
2540 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2542 mmf_return_val_if_fail(sc, NULL);
2546 /* Check element availability */
2547 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2549 switch( codec_type )
2551 case MM_IMAGE_CODEC_JPEG:
2552 codec_type_str = "JPEG";
2554 case MM_IMAGE_CODEC_SRW:
2555 codec_type_str = "SRW";
2557 case MM_IMAGE_CODEC_JPEG_SRW:
2558 codec_type_str = "JPEG_SRW";
2560 case MM_IMAGE_CODEC_PNG:
2561 codec_type_str = "PNG";
2563 case MM_IMAGE_CODEC_BMP:
2564 codec_type_str = "BMP";
2566 case MM_IMAGE_CODEC_WBMP:
2567 codec_type_str = "WBMP";
2569 case MM_IMAGE_CODEC_TIFF:
2570 codec_type_str = "TIFF";
2572 case MM_IMAGE_CODEC_PCX:
2573 codec_type_str = "PCX";
2575 case MM_IMAGE_CODEC_GIF:
2576 codec_type_str = "GIF";
2578 case MM_IMAGE_CODEC_ICO:
2579 codec_type_str = "ICO";
2581 case MM_IMAGE_CODEC_RAS:
2582 codec_type_str = "RAS";
2584 case MM_IMAGE_CODEC_TGA:
2585 codec_type_str = "TGA";
2587 case MM_IMAGE_CODEC_XBM:
2588 codec_type_str = "XBM";
2590 case MM_IMAGE_CODEC_XPM:
2591 codec_type_str = "XPM";
2594 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2598 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2599 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2607 static type_element *
2608 __mmcamcorder_get_file_format_element(MMHandleType handle)
2610 type_element *telement = NULL;
2611 const char *mux_type_str = NULL;
2612 int file_type = MM_FILE_FORMAT_INVALID;
2613 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2614 _MMCamcorderSubContext *sc = NULL;
2616 mmf_return_val_if_fail(hcamcorder, NULL);
2617 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2619 mmf_return_val_if_fail(sc, NULL);
2623 /* Check element availability */
2624 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2628 case MM_FILE_FORMAT_3GP:
2629 mux_type_str = "3GP";
2631 case MM_FILE_FORMAT_AMR:
2632 mux_type_str = "AMR";
2634 case MM_FILE_FORMAT_MP4:
2635 mux_type_str = "MP4";
2637 case MM_FILE_FORMAT_AAC:
2638 mux_type_str = "AAC";
2640 case MM_FILE_FORMAT_MP3:
2641 mux_type_str = "MP3";
2643 case MM_FILE_FORMAT_OGG:
2644 mux_type_str = "OGG";
2646 case MM_FILE_FORMAT_WAV:
2647 mux_type_str = "WAV";
2649 case MM_FILE_FORMAT_AVI:
2650 mux_type_str = "AVI";
2652 case MM_FILE_FORMAT_WMA:
2653 mux_type_str = "WMA";
2655 case MM_FILE_FORMAT_WMV:
2656 mux_type_str = "WMV";
2658 case MM_FILE_FORMAT_MID:
2659 mux_type_str = "MID";
2661 case MM_FILE_FORMAT_MMF:
2662 mux_type_str = "MMF";
2664 case MM_FILE_FORMAT_MATROSKA:
2665 mux_type_str = "MATROSKA";
2667 case MM_FILE_FORMAT_M2TS:
2668 mux_type_str = "M2TS";
2671 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2675 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2676 CONFIGURE_CATEGORY_MAIN_MUX,
2685 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2687 type_element *telement = NULL;
2689 _mmcam_dbg_log("type:%d", type);
2693 case MM_CAM_AUDIO_ENCODER:
2694 telement = __mmcamcorder_get_audio_codec_element(handle);
2696 case MM_CAM_VIDEO_ENCODER:
2697 telement = __mmcamcorder_get_video_codec_element(handle);
2699 case MM_CAM_IMAGE_ENCODER:
2700 telement = __mmcamcorder_get_image_codec_element(handle);
2702 case MM_CAM_FILE_FORMAT:
2703 telement = __mmcamcorder_get_file_format_element(handle);
2706 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2713 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2715 int codec_index = MM_AUDIO_CODEC_INVALID;
2718 _mmcam_dbg_err("name is NULL");
2719 return MM_AUDIO_CODEC_INVALID;
2722 if (!strcmp(name, "AMR")) {
2723 codec_index = MM_AUDIO_CODEC_AMR;
2724 } else if (!strcmp(name, "G723_1")) {
2725 codec_index = MM_AUDIO_CODEC_G723_1;
2726 } else if (!strcmp(name, "MP3")) {
2727 codec_index = MM_AUDIO_CODEC_MP3;
2728 } else if (!strcmp(name, "AAC")) {
2729 codec_index = MM_AUDIO_CODEC_AAC;
2730 } else if (!strcmp(name, "MMF")) {
2731 codec_index = MM_AUDIO_CODEC_MMF;
2732 } else if (!strcmp(name, "ADPCM")) {
2733 codec_index = MM_AUDIO_CODEC_ADPCM;
2734 } else if (!strcmp(name, "WAVE")) {
2735 codec_index = MM_AUDIO_CODEC_WAVE;
2736 } else if (!strcmp(name, "MIDI")) {
2737 codec_index = MM_AUDIO_CODEC_MIDI;
2738 } else if (!strcmp(name, "IMELODY")) {
2739 codec_index = MM_AUDIO_CODEC_IMELODY;
2740 } else if (!strcmp(name, "VORBIS")) {
2741 codec_index = MM_AUDIO_CODEC_VORBIS;
2744 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2751 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2753 int codec_index = MM_VIDEO_CODEC_INVALID;
2756 _mmcam_dbg_err("name is NULL");
2757 return MM_VIDEO_CODEC_INVALID;
2760 if (!strcmp(name, "H263")) {
2761 codec_index = MM_VIDEO_CODEC_H263;
2762 } else if (!strcmp(name, "H264")) {
2763 codec_index = MM_VIDEO_CODEC_H264;
2764 } else if (!strcmp(name, "H26L")) {
2765 codec_index = MM_VIDEO_CODEC_H26L;
2766 } else if (!strcmp(name, "MPEG4")) {
2767 codec_index = MM_VIDEO_CODEC_MPEG4;
2768 } else if (!strcmp(name, "MPEG1")) {
2769 codec_index = MM_VIDEO_CODEC_MPEG1;
2770 } else if (!strcmp(name, "THEORA")) {
2771 codec_index = MM_VIDEO_CODEC_THEORA;
2774 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2781 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2783 int codec_index = MM_IMAGE_CODEC_INVALID;
2786 _mmcam_dbg_err("name is NULL");
2787 return MM_IMAGE_CODEC_INVALID;
2790 if (!strcmp(name, "JPEG")) {
2791 codec_index = MM_IMAGE_CODEC_JPEG;
2792 } else if (!strcmp(name, "PNG")) {
2793 codec_index = MM_IMAGE_CODEC_PNG;
2794 } else if (!strcmp(name, "BMP")) {
2795 codec_index = MM_IMAGE_CODEC_BMP;
2796 } else if (!strcmp(name, "WBMP")) {
2797 codec_index = MM_IMAGE_CODEC_WBMP;
2798 } else if (!strcmp(name, "TIFF")) {
2799 codec_index = MM_IMAGE_CODEC_TIFF;
2800 } else if (!strcmp(name, "PCX")) {
2801 codec_index = MM_IMAGE_CODEC_PCX;
2802 } else if (!strcmp(name, "GIF")) {
2803 codec_index = MM_IMAGE_CODEC_GIF;
2804 } else if (!strcmp(name, "ICO")) {
2805 codec_index = MM_IMAGE_CODEC_ICO;
2806 } else if (!strcmp(name, "RAS")) {
2807 codec_index = MM_IMAGE_CODEC_RAS;
2808 } else if (!strcmp(name, "TGA")) {
2809 codec_index = MM_IMAGE_CODEC_TGA;
2810 } else if (!strcmp(name, "XBM")) {
2811 codec_index = MM_IMAGE_CODEC_XBM;
2812 } else if (!strcmp(name, "XPM")) {
2813 codec_index = MM_IMAGE_CODEC_XPM;
2816 _mmcam_dbg_log("image codec index %d", codec_index);
2822 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2824 int mux_index = MM_FILE_FORMAT_INVALID;
2827 _mmcam_dbg_err("name is NULL");
2828 return MM_FILE_FORMAT_INVALID;
2831 if (!strcmp(name, "3GP")) {
2832 mux_index = MM_FILE_FORMAT_3GP;
2833 } else if (!strcmp(name, "AMR")) {
2834 mux_index = MM_FILE_FORMAT_AMR;
2835 } else if (!strcmp(name, "MP4")) {
2836 mux_index = MM_FILE_FORMAT_MP4;
2837 } else if (!strcmp(name, "AAC")) {
2838 mux_index = MM_FILE_FORMAT_AAC;
2839 } else if (!strcmp(name, "MP3")) {
2840 mux_index = MM_FILE_FORMAT_MP3;
2841 } else if (!strcmp(name, "OGG")) {
2842 mux_index = MM_FILE_FORMAT_OGG;
2843 } else if (!strcmp(name, "WAV")) {
2844 mux_index = MM_FILE_FORMAT_WAV;
2845 } else if (!strcmp(name, "AVI")) {
2846 mux_index = MM_FILE_FORMAT_AVI;
2847 } else if (!strcmp(name, "WMA")) {
2848 mux_index = MM_FILE_FORMAT_WMA;
2849 } else if (!strcmp(name, "WMV")) {
2850 mux_index = MM_FILE_FORMAT_WMV;
2851 } else if (!strcmp(name, "MID")) {
2852 mux_index = MM_FILE_FORMAT_MID;
2853 } else if (!strcmp(name, "MMF")) {
2854 mux_index = MM_FILE_FORMAT_MMF;
2855 } else if (!strcmp(name, "MATROSKA")) {
2856 mux_index = MM_FILE_FORMAT_MATROSKA;
2857 } else if (!strcmp(name, "M2TS")) {
2858 mux_index = MM_FILE_FORMAT_M2TS;
2862 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2869 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2873 mmf_return_val_if_fail(name, -1);
2875 switch(conf_category)
2877 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2878 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2880 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2881 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2883 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2884 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2886 case CONFIGURE_CATEGORY_MAIN_MUX:
2887 fmt = _mmcamcorder_get_mux_format(handle, name);
2890 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2897 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2899 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2900 camera_conf* configure_info = NULL;
2902 int total_count = 0;
2904 mmf_return_val_if_fail(hcamcorder, 0);
2906 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2908 configure_info = hcamcorder->conf_main;
2910 if (configure_info->info[conf_category]) {
2913 const char *name = NULL;
2914 int count = configure_info->info[conf_category]->count;
2915 conf_detail *info = configure_info->info[conf_category];
2917 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2919 if (count <= 0 || !info) {
2923 arr = (int*) g_malloc0(count * sizeof(int));
2925 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2929 for (i = 0 ; i < count ; i++) {
2930 if (info->detail_info[i] == NULL) {
2934 name = ((type_element*)(info->detail_info[i]))->name;
2935 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2937 arr[total_count++] = fmt;
2940 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/