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 -----------------------------------------------------------------------*/
37 /*-----------------------------------------------------------------------
38 | GLOBAL VARIABLE DEFINITIONS |
39 -----------------------------------------------------------------------*/
41 /*-----------------------------------------------------------------------
42 | LOCAL VARIABLE DEFINITIONS |
43 -----------------------------------------------------------------------*/
44 #define DEFAULT_AUDIO_BUFFER_INTERVAL 50
46 #define MMCAMCORDER_CONF_FILEPATH_LENGTH 128
47 #define MMCAMCORDER_BUFFER_LINE_MAX 256
49 char *get_new_string(char* src_string)
51 return g_strdup(src_string);
54 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info)
57 int info_table_size = sizeof(conf_info_table);
59 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
61 mmf_return_val_if_fail(hcamcorder && configure_info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
63 /* Videosrc element default value */
64 static type_element _videosrc_element_default = {
73 /* Audiosrc element default value */
74 static type_int ___audiosrc_default_channel = {"Channel", 1};
75 static type_int ___audiosrc_default_bitrate = {"BitRate", 8000};
76 static type_int ___audiosrc_default_depth = {"Depth", 16};
77 static type_int ___audiosrc_default_blocksize = {"BlockSize", 1280};
78 static type_int* __audiosrc_default_int_array[] = {
79 &___audiosrc_default_channel,
80 &___audiosrc_default_bitrate,
81 &___audiosrc_default_depth,
82 &___audiosrc_default_blocksize,
84 static type_string ___audiosrc_default_device = {"Device", "default"};
85 static type_string* __audiosrc_default_string_array[] = {
86 &___audiosrc_default_device,
88 static type_element _audiosrc_element_default = {
91 __audiosrc_default_int_array,
92 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
93 __audiosrc_default_string_array,
94 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
97 static type_element _audiomodemsrc_element_default = {
98 "AudiomodemsrcElement",
100 __audiosrc_default_int_array,
101 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
102 __audiosrc_default_string_array,
103 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
107 /* Videosink element default value */
108 static type_int ___videosink_default_display_id = {"display-id", 3};
109 static type_int ___videosink_default_x = {"x", 0};
110 static type_int ___videosink_default_y = {"y", 0};
111 static type_int ___videosink_default_width = {"width", 800};
112 static type_int ___videosink_default_height = {"height", 480};
113 static type_int ___videosink_default_rotation = {"rotation", 1};
114 static type_int* __videosink_default_int_array[] = {
115 &___videosink_default_display_id,
116 &___videosink_default_x,
117 &___videosink_default_y,
118 &___videosink_default_width,
119 &___videosink_default_height,
120 &___videosink_default_rotation,
122 static type_string* __videosink_default_string_array[] = {NULL};
123 static type_element _videosink_element_overlay_default = {
124 "VideosinkElementOverlay",
126 __videosink_default_int_array,
127 sizeof(__videosink_default_int_array) / sizeof(type_int*),
128 __videosink_default_string_array,
129 sizeof(__videosink_default_string_array) / sizeof(type_string*),
131 static type_element _videosink_element_evas_default = {
132 "VideosinkElementEvas",
134 __videosink_default_int_array,
135 sizeof(__videosink_default_int_array) / sizeof(type_int*),
136 __videosink_default_string_array,
137 sizeof(__videosink_default_string_array) / sizeof(type_string*),
139 static type_element _videosink_element_gl_default = {
140 "VideosinkElementGL",
142 __videosink_default_int_array,
143 sizeof(__videosink_default_int_array) / sizeof(type_int*),
144 __videosink_default_string_array,
145 sizeof(__videosink_default_string_array) / sizeof(type_string*),
147 static type_element _videosink_element_remote_default = {
148 "VideosinkElementRemote",
150 __videosink_default_int_array,
151 sizeof(__videosink_default_int_array) / sizeof(type_int*),
152 __videosink_default_string_array,
153 sizeof(__videosink_default_string_array) / sizeof(type_string*),
155 static type_element _videosink_element_null_default = {
156 "VideosinkElementNull",
158 __videosink_default_int_array,
159 sizeof(__videosink_default_int_array) / sizeof(type_int*),
160 __videosink_default_string_array,
161 sizeof(__videosink_default_string_array) / sizeof(type_string*),
164 /* Videoscale element default value */
165 static type_element _videoscale_element_default = {
174 /* Videoconvert element default value */
175 static type_element _videoconvert_element_default = {
176 "VideoconvertElement",
184 /* H.264 decoder element default value */
185 static type_element _videodecoder_element_h264_default = {
186 "VideodecoderElementH264",
194 /* Record sink element default value */
195 static type_element _recordsink_element_default = {
204 /* H263 element default value */
205 static type_element _h263_element_default = {
214 /* H264 element default value */
215 static type_element _h264_element_default = {
224 /* H26L element default value */
225 static type_element _h26l_element_default = {
234 /* MPEG4 element default value */
235 static type_element _mpeg4_element_default = {
244 /* MPEG1 element default value */
245 static type_element _mpeg1_element_default = {
254 /* THEORA element default value */
255 static type_element _theora_element_default = {
264 /* AMR element default value */
265 static type_element _amr_element_default = {
274 /* G723_1 element default value */
275 static type_element _g723_1_element_default = {
284 /* MP3 element default value */
285 static type_element _mp3_element_default = {
294 /* AAC element default value */
295 static type_element _aac_element_default = {
304 /* MMF element default value */
305 static type_element _mmf_element_default = {
314 /* ADPCM element default value */
315 static type_element _adpcm_element_default = {
317 "avenc_adpcm_ima_qt",
324 /* WAVE element default value */
325 static type_element _wave_element_default = {
334 /* VORBIS element default value */
335 static type_element _vorbis_element_default = {
344 /* MIDI element default value */
345 static type_element _midi_element_default = {
354 /* IMELODY element default value */
355 static type_element _imelody_element_default = {
364 /* JPEG element default value */
365 static type_element _jpeg_element_default = {
374 /* PNG element default value */
375 static type_element _png_element_default = {
384 /* BMP element default value */
385 static type_element _bmp_element_default = {
394 /* WBMP element default value */
395 static type_element _wbmp_element_default = {
404 /* TIFF element default value */
405 static type_element _tiff_element_default = {
414 /* PCX element default value */
415 static type_element _pcx_element_default = {
424 /* GIF element default value */
425 static type_element _gif_element_default = {
434 /* ICO element default value */
435 static type_element _ico_element_default = {
444 /* RAS element default value */
445 static type_element _ras_element_default = {
454 /* TGA element default value */
455 static type_element _tga_element_default = {
464 /* XBM element default value */
465 static type_element _xbm_element_default = {
474 /* XPM element default value */
475 static type_element _xpm_element_default = {
484 /* 3GP element default value */
485 static type_element _3gp_element_default = {
494 /* AMR mux element default value */
495 static type_element _amrmux_element_default = {
504 /* MP4 element default value */
505 static type_element _mp4_element_default = {
514 /* AAC mux element default value */
515 static type_element _aacmux_element_default = {
524 /* MP3 mux element default value */
525 static type_element _mp3mux_element_default = {
534 /* OGG element default value */
535 static type_element _ogg_element_default = {
544 /* WAV element default value */
545 static type_element _wav_element_default = {
554 /* AVI element default value */
555 static type_element _avi_element_default = {
564 /* WMA element default value */
565 static type_element _wma_element_default = {
574 /* WMV element default value */
575 static type_element _wmv_element_default = {
584 /* MID element default value */
585 static type_element _mid_element_default = {
594 /* MMF mux element default value */
595 static type_element _mmfmux_element_default = {
604 /* MATROSKA element default value */
605 static type_element _matroska_element_default = {
614 /* M2TS element default value */
615 static type_element _m2ts_element_default = {
624 /* [General] matching table */
625 static conf_info_table conf_main_general_table[] = {
626 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
627 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
628 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
629 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
630 { "PlatformPrivilegeCamera", CONFIGURE_VALUE_STRING, {NULL} },
631 { "LogLevel", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_LOG_LEVEL_INFO} },
634 /* [VideoInput] matching table */
635 static conf_info_table conf_main_video_input_table[] = {
636 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
637 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
638 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
639 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
640 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
641 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
642 { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
645 /* [AudioInput] matching table */
646 static conf_info_table conf_main_audio_input_table[] = {
647 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
648 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
649 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
650 { "AudioBufferInterval", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_AUDIO_BUFFER_INTERVAL} },
653 /* [VideoOutput] matching table */
654 static conf_info_table conf_main_video_output_table[] = {
655 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
656 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
657 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
658 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
659 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
660 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
661 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
662 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
663 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
664 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
665 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
667 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
668 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
671 /* [Capture] matching table */
672 static conf_info_table conf_main_capture_table[] = {
673 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
674 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
675 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
676 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
679 /* [Record] matching table */
680 static conf_info_table conf_main_record_table[] = {
681 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
682 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
683 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
684 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
685 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
686 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
688 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
689 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
692 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
693 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
694 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
695 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
696 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
697 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
698 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
699 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = 0} },
700 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
701 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} }
704 /* [VideoEncoder] matching table */
705 static conf_info_table conf_main_video_encoder_table[] = {
706 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
707 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
708 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
709 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
710 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
711 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
714 /* [AudioEncoder] matching table */
715 static conf_info_table conf_main_audio_encoder_table[] = {
716 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
717 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
718 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
719 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
720 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
721 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
722 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
723 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
724 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
725 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
728 /* [ImageEncoder] matching table */
729 static conf_info_table conf_main_image_encoder_table[] = {
730 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
731 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
732 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
733 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
734 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
735 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
736 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
737 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
738 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
739 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
740 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
741 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
744 /* [Mux] matching table */
745 static conf_info_table conf_main_mux_table[] = {
746 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
747 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
748 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
749 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
750 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
751 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
752 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
753 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
754 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
755 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
756 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
757 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
758 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
759 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
767 /* [Camera] matching table */
768 static conf_info_table conf_ctrl_camera_table[] = {
769 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
770 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
771 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
772 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
773 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
774 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
776 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
777 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
778 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
779 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
781 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
782 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
783 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
784 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
785 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
786 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
787 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
788 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
789 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
790 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
791 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
794 /* [Strobe] matching table */
795 static conf_info_table conf_ctrl_strobe_table[] = {
796 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
797 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
798 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
801 /* [Effect] matching table */
802 static conf_info_table conf_ctrl_effect_table[] = {
803 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
804 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
805 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
806 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
807 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
808 { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
809 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
811 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
813 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
814 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 /* [Photograph] matching table */
819 static conf_info_table conf_ctrl_photograph_table[] = {
820 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
821 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
822 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
823 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
824 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
825 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
826 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
827 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
828 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
829 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
831 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
832 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
833 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
834 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
835 { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
836 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
837 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
838 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
839 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
842 /* [Capture] matching table */
843 static conf_info_table conf_ctrl_capture_table[] = {
844 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
845 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
846 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
847 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
848 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
849 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
850 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
853 /* [Detect] matching table */
854 static conf_info_table conf_ctrl_detect_table[] = {
855 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
856 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
857 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
858 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
861 MMCAM_LOG_INFO("Entered...");
863 if (type == CONFIGURE_TYPE_MAIN) {
864 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
865 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
866 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
867 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
868 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
869 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
870 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
871 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
872 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
873 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
875 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
876 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
877 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
878 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
879 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
880 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
881 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
882 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
883 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
884 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
886 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
888 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
889 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
890 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
891 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
892 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
893 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
895 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
896 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
897 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
898 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
899 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
900 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
902 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
905 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
907 MMCAM_LOG_INFO("Done.");
909 return MM_ERROR_NONE;
913 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
915 int ret = MM_ERROR_NONE;
917 char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
919 MMCAM_LOG_INFO("Opening...[%s]", ConfFile);
921 mmf_return_val_if_fail(ConfFile, FALSE);
923 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
924 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
926 fp = fopen(conf_path, "r");
928 MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path);
930 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
931 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
932 fp = fopen(conf_path, "r");
934 MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno);
935 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
940 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
944 MMCAM_LOG_INFO("Leave [0x%x]", ret);
950 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
952 const unsigned int BUFFER_NUM_DETAILS = 256;
953 const unsigned int BUFFER_NUM_TOKEN = 20;
954 size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
955 const char* delimiters = " |=,\t\n";
958 int ret = MM_ERROR_NONE;
960 int count_main_category = 0;
961 int count_details = 0;
966 char *buffer_string = NULL;
967 char *buffer_details[BUFFER_NUM_DETAILS];
968 char *buffer_token[BUFFER_NUM_TOKEN];
970 char *category_name = NULL;
971 char *detail_string = NULL;
972 char *user_ptr = NULL;
974 camera_conf *new_conf = NULL;
978 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
980 *configure_info = NULL;
982 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
983 buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size);
985 new_conf->type = type;
987 ret = _mmcamcorder_conf_init(handle, type, new_conf);
988 if (ret != MM_ERROR_NONE) {
989 MMCAM_LOG_ERROR("conf init failed 0x%x", ret);
991 g_free(buffer_string);
995 *configure_info = new_conf;
998 count_main_category = 0;
1001 if (read_main == 0) {
1002 buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
1003 length_read = getline(&buffer_string, &buffer_line_size, fp);
1004 if (length_read < 1) {
1005 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1009 buffer_string[--length_read] = '\0'; /* remove new line character */
1011 MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string);
1014 token = strtok_r(buffer_string, delimiters, &user_ptr);
1016 if ((token) && (token[0] == ';') && (length_read > -1)) {
1017 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1022 MMCAM_LOG_VERBOSE("token : \"%s\"", token);
1023 buffer_token[count_token] = token;
1025 token = strtok_r(NULL, delimiters, &user_ptr);
1028 if (count_token == 0)
1034 if (*buffer_token[0] == ';') {
1036 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1037 } else if (*buffer_token[0] == '[') {
1039 category_name = get_new_string(buffer_token[0]);
1040 if (category_name == NULL) {
1041 MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]);
1045 count_main_category++;
1049 length_read = getline(&buffer_string, &buffer_line_size, fp);
1050 if (length_read < 1) {
1051 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1055 buffer_string[--length_read] = '\0'; /* remove new line character */
1057 MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read);
1059 detail_string = get_new_string(buffer_string);
1061 token = strtok_r(buffer_string, delimiters, &user_ptr);
1063 if (token && token[0] != ';' && length_read > -1) {
1064 MMCAM_LOG_VERBOSE("token : [%s]", token);
1065 if (token[0] == '[') {
1067 buffer_token[0] = token;
1068 SAFE_G_FREE(detail_string);
1072 buffer_details[count_details++] = detail_string;
1074 SAFE_G_FREE(detail_string);
1078 MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);
1080 if (count_details == 0) {
1081 MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name);
1082 SAFE_G_FREE(category_name);
1089 if (type == CONFIGURE_TYPE_MAIN) {
1090 if (!strcmp("[General]", category_name))
1091 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1092 else if (!strcmp("[VideoInput]", category_name))
1093 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1094 else if (!strcmp("[AudioInput]", category_name))
1095 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1096 else if (!strcmp("[VideoOutput]", category_name))
1097 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1098 else if (!strcmp("[Capture]", category_name))
1099 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1100 else if (!strcmp("[Record]", category_name))
1101 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1102 else if (!strcmp("[VideoEncoder]", category_name))
1103 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1104 else if (!strcmp("[AudioEncoder]", category_name))
1105 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1106 else if (!strcmp("[ImageEncoder]", category_name))
1107 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1108 else if (!strcmp("[Mux]", category_name))
1109 category = CONFIGURE_CATEGORY_MAIN_MUX;
1111 if (!strcmp("[Camera]", category_name))
1112 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1113 else if (!strcmp("[Strobe]", category_name))
1114 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1115 else if (!strcmp("[Effect]", category_name))
1116 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1117 else if (!strcmp("[Photograph]", category_name))
1118 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1119 else if (!strcmp("[Capture]", category_name))
1120 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1121 else if (!strcmp("[Detect]", category_name))
1122 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1125 if (category != -1) {
1126 _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
1127 buffer_details, category, count_details);
1129 MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type);
1133 for (i = 0 ; i < count_details ; i++)
1134 SAFE_G_FREE(buffer_details[i]);
1137 SAFE_G_FREE(category_name);
1140 /* (*configure_info) = new_conf; */
1142 SAFE_G_FREE(buffer_string);
1144 /*MMCAM_LOG_INFO("Done.");*/
1146 return MM_ERROR_NONE;
1150 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1155 int type = CONFIGURE_VALUE_INT;
1157 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1158 camera_conf *temp_conf = (*configure_info);
1160 type_int2 *temp_int = NULL;
1161 type_int_range *temp_int_range = NULL;
1162 type_int_array *temp_int_array = NULL;
1163 type_int_pair_array *temp_int_pair_array = NULL;
1164 type_string2 *temp_string = NULL;
1165 type_string_array *temp_string_array = NULL;
1166 type_element2 *temp_element = NULL;
1168 MMCAM_LOG_INFO("Entered...");
1170 mmf_return_if_fail(temp_conf);
1172 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1173 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1175 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1177 for (i = 0 ; i < category_num ; i++) {
1178 if (temp_conf->info[i]) {
1179 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1180 if (temp_conf->info[i]->detail_info[j] == NULL)
1183 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1185 case CONFIGURE_VALUE_INT:
1186 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1187 SAFE_G_FREE(temp_int->name);
1189 case CONFIGURE_VALUE_INT_RANGE:
1190 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1191 SAFE_G_FREE(temp_int_range->name);
1193 case CONFIGURE_VALUE_INT_ARRAY:
1194 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1195 SAFE_G_FREE(temp_int_array->name);
1196 SAFE_G_FREE(temp_int_array->value);
1198 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1199 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1200 SAFE_G_FREE(temp_int_pair_array->name);
1201 SAFE_G_FREE(temp_int_pair_array->value[0]);
1202 SAFE_G_FREE(temp_int_pair_array->value[1]);
1204 case CONFIGURE_VALUE_STRING:
1205 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1206 SAFE_G_FREE(temp_string->name);
1207 SAFE_G_FREE(temp_string->value);
1209 case CONFIGURE_VALUE_STRING_ARRAY:
1210 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1211 SAFE_G_FREE(temp_string_array->name);
1212 if (temp_string_array->value) {
1213 count = temp_string_array->count;
1215 for (k = 0 ; k < count ; k++)
1216 SAFE_G_FREE(temp_string_array->value[k]);
1218 SAFE_G_FREE(temp_string_array->value);
1220 SAFE_G_FREE(temp_string_array->default_value);
1222 case CONFIGURE_VALUE_ELEMENT:
1223 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1224 SAFE_G_FREE(temp_element->name);
1225 SAFE_G_FREE(temp_element->element_name);
1227 if (temp_element->value_int) {
1228 count = temp_element->count_int;
1229 for (k = 0 ; k < count ; k++) {
1230 SAFE_G_FREE(temp_element->value_int[k]->name);
1231 SAFE_G_FREE(temp_element->value_int[k]);
1233 SAFE_G_FREE(temp_element->value_int);
1236 if (temp_element->value_string) {
1237 count = temp_element->count_string;
1238 for (k = 0 ; k < count ; k++) {
1239 SAFE_G_FREE(temp_element->value_string[k]->name);
1240 SAFE_G_FREE(temp_element->value_string[k]->value);
1241 SAFE_G_FREE(temp_element->value_string[k]);
1243 SAFE_G_FREE(temp_element->value_string);
1247 MMCAM_LOG_WARNING("unknown type %d", type);
1252 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1255 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1257 SAFE_G_FREE(temp_conf->info[i]);
1258 temp_conf->info[i] = NULL;
1262 SAFE_G_FREE((*configure_info)->info);
1263 SAFE_G_FREE((*configure_info));
1265 MMCAM_LOG_INFO("Done.");
1268 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1271 int count_value = 0;
1273 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1275 if (hcamcorder == NULL) {
1276 MMCAM_LOG_ERROR("handle is NULL");
1280 /*MMCAM_LOG_INFO("Entered...");*/
1282 mmf_return_val_if_fail(name, FALSE);
1284 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1285 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1289 /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/
1291 if (type == CONFIGURE_TYPE_MAIN) {
1292 for (i = 0 ; i < count_value ; i++) {
1293 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1294 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1295 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1300 for (i = 0 ; i < count_value ; i++) {
1301 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1302 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1303 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1313 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1315 const int BUFFER_NUM_TOKEN = 256;
1322 char *buffer_token[BUFFER_NUM_TOKEN];
1323 char *user_ptr = NULL;
1325 const char *delimiters = " |=,\t\n";
1326 const char *delimiters_sub = " |\t\n";
1327 const char *delimiters_3rd = "|\n";
1329 mmf_return_val_if_fail(info && buffer_details, FALSE);
1331 (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail));
1332 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1333 (*info)->count = count_details;
1335 for (i = 0 ; i < count_details ; i++) {
1336 MMCAM_LOG_VERBOSE("Read line\"%s\"", buffer_details[i]);
1338 token = strtok_r(buffer_details[i], delimiters, &user_ptr);
1341 buffer_token[count_token] = token;
1344 (*info)->detail_info[i] = NULL;
1345 MMCAM_LOG_WARNING("No token... check it.[%s]", buffer_details[i]);
1349 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1350 (*info)->detail_info[i] = NULL;
1351 MMCAM_LOG_WARNING("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
1355 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1356 token = strtok_r(NULL, delimiters, &user_ptr);
1358 buffer_token[count_token] = token;
1359 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1361 token = strtok_r(NULL, delimiters, &user_ptr);
1364 if (count_token < 2) {
1365 (*info)->detail_info[i] = NULL;
1366 MMCAM_LOG_WARNING("Number of token is too small... check it.[%s]", buffer_details[i]);
1369 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1371 strtok_r(NULL, delimiters_sub, &user_ptr);
1373 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1374 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1376 buffer_token[count_token] = token;
1377 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1379 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1381 } else { /* CONFIGURE_VALUE_STRING */
1382 token = strtok_r(NULL, delimiters_3rd, &user_ptr);
1385 buffer_token[count_token] = token;
1386 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1391 if (count_token < 2) {
1392 (*info)->detail_info[i] = NULL;
1393 MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]);
1398 switch (value_type) {
1399 case CONFIGURE_VALUE_INT:
1403 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1404 new_int->name = get_new_string(buffer_token[0]);
1405 new_int->value = atoi(buffer_token[1]);
1406 (*info)->detail_info[i] = (void*)new_int;
1407 MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value);
1410 case CONFIGURE_VALUE_INT_RANGE:
1412 type_int_range* new_int_range;
1414 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1415 new_int_range->name = get_new_string(buffer_token[0]);
1416 new_int_range->min = atoi(buffer_token[1]);
1417 new_int_range->max = atoi(buffer_token[2]);
1418 new_int_range->default_value = atoi(buffer_token[3]);
1419 (*info)->detail_info[i] = (void*)new_int_range;
1421 MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1422 new_int_range->name,
1425 new_int_range->default_value);
1428 case CONFIGURE_VALUE_INT_ARRAY:
1430 int count_value = count_token - 2;
1431 type_int_array* new_int_array;
1433 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1434 new_int_array->name = get_new_string(buffer_token[0]);
1435 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1436 new_int_array->count = count_value;
1438 MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name);
1439 for (j = 0 ; j < count_value ; j++) {
1440 new_int_array->value[j] = atoi(buffer_token[j+1]);
1441 MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]);
1444 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1445 MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value);
1447 (*info)->detail_info[i] = (void*)new_int_array;
1450 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1452 int count_value = (count_token - 3) >> 1;
1453 type_int_pair_array* new_int_pair_array;
1455 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1456 new_int_pair_array->name = get_new_string(buffer_token[0]);
1457 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1458 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1459 new_int_pair_array->count = count_value;
1461 MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);
1462 for (j = 0 ; j < count_value ; j++) {
1463 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1464 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1466 MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j,
1467 new_int_pair_array->value[0][j],
1468 new_int_pair_array->value[1][j]);
1471 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1472 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1474 MMCAM_LOG_VERBOSE(" default value[%d,%d]",
1475 new_int_pair_array->default_value[0],
1476 new_int_pair_array->default_value[1]);
1478 (*info)->detail_info[i] = (void*)new_int_pair_array;
1481 case CONFIGURE_VALUE_STRING:
1483 type_string2* new_string;
1485 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1486 new_string->name = get_new_string(buffer_token[0]);
1487 new_string->value = get_new_string(buffer_token[1]);
1488 (*info)->detail_info[i] = (void*)new_string;
1490 MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value);
1493 case CONFIGURE_VALUE_STRING_ARRAY:
1495 int count_value = count_token - 2;
1496 type_string_array* new_string_array;
1498 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1499 new_string_array->name = get_new_string(buffer_token[0]);
1500 new_string_array->count = count_value;
1501 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1503 MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name);
1505 for (j = 0 ; j < count_value ; j++) {
1506 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1507 MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]);
1510 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1512 MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value);
1514 (*info)->detail_info[i] = (void*)new_string_array;
1517 case CONFIGURE_VALUE_ELEMENT:
1519 type_element2* new_element;
1521 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1522 new_element->name = get_new_string(buffer_token[0]);
1523 new_element->element_name = get_new_string(buffer_token[1]);
1524 new_element->count_int = atoi(buffer_token[2]);
1525 new_element->value_int = NULL;
1526 new_element->count_string = atoi(buffer_token[3]);
1527 new_element->value_string = NULL;
1529 MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1530 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1532 /* add int values */
1533 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1534 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1535 for (j = 0 ; j < new_element->count_int ; j++) {
1536 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1537 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1538 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1540 MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]",
1541 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1545 /* add string values */
1546 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1547 new_element->count_int >= 0 && new_element->count_int <= 30) {
1548 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1549 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1550 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1551 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1552 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1554 MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]",
1555 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);
1559 (*info)->detail_info[i] = (void*)new_element;
1571 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1576 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1578 mmf_return_val_if_fail(configure_info, FALSE);
1579 mmf_return_val_if_fail(name, FALSE);
1581 if (configure_info->info[category]) {
1582 count = configure_info->info[category]->count;
1583 info = configure_info->info[category];
1585 for (i = 0 ; i < count ; i++) {
1586 if (info->detail_info[i] == NULL)
1589 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1590 *value = ((type_int*)(info->detail_info[i]))->value;
1591 MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value);
1597 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1598 MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value);
1602 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1608 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1613 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1615 mmf_return_val_if_fail(configure_info, FALSE);
1616 mmf_return_val_if_fail(name, FALSE);
1618 if (configure_info->info[category]) {
1619 count = configure_info->info[category]->count;
1620 info = configure_info->info[category];
1622 for (i = 0 ; i < count ; i++) {
1623 if (info->detail_info[i] == NULL)
1626 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1627 *value = (type_int_range*)(info->detail_info[i]);
1628 MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]",
1629 name, (*value)->min, (*value)->max, (*value)->default_value);
1637 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1642 int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1647 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1649 mmf_return_val_if_fail(configure_info, FALSE);
1650 mmf_return_val_if_fail(name, FALSE);
1652 if (configure_info->info[category]) {
1653 count = configure_info->info[category]->count;
1654 info = configure_info->info[category];
1656 for (i = 0 ; i < count ; i++) {
1657 if (info->detail_info[i] == NULL)
1660 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1661 *value = (type_int_array*)(info->detail_info[i]);
1662 MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]",
1663 name, (*value)->value, (*value)->count, (*value)->default_value);
1671 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1677 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1682 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1684 mmf_return_val_if_fail(configure_info, FALSE);
1685 mmf_return_val_if_fail(name, FALSE);
1687 if (configure_info->info[category]) {
1688 count = configure_info->info[category]->count;
1689 info = configure_info->info[category];
1691 for (i = 0 ; i < count ; i++) {
1692 if (info->detail_info[i] == NULL)
1695 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1696 *value = (type_int_pair_array*)(info->detail_info[i]);
1697 MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]",
1698 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1699 (*value)->default_value[0], (*value)->default_value[1]);
1707 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1712 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1717 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1719 mmf_return_val_if_fail(configure_info, FALSE);
1720 mmf_return_val_if_fail(name, FALSE);
1722 if (configure_info->info[category]) {
1723 count = configure_info->info[category]->count;
1724 info = configure_info->info[category];
1726 for (i = 0 ; i < count ; i++) {
1727 if (info->detail_info[i] == NULL)
1730 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1731 *value = ((type_string*)(info->detail_info[i]))->value;
1732 MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL");
1738 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1739 MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL");
1743 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1748 int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1753 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1755 mmf_return_val_if_fail(configure_info, FALSE);
1756 mmf_return_val_if_fail(name, FALSE);
1758 if (configure_info->info[category]) {
1759 count = configure_info->info[category]->count;
1760 info = configure_info->info[category];
1762 for (i = 0 ; i < count ; i++) {
1763 if (info->detail_info[i] == NULL)
1766 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1767 *value = (type_string_array*)(info->detail_info[i]);
1768 MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]",
1769 name, (*value)->value, (*value)->count, (*value)->default_value);
1777 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1782 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1787 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1789 mmf_return_val_if_fail(configure_info, FALSE);
1790 mmf_return_val_if_fail(name, FALSE);
1792 if (configure_info->info[category]) {
1793 count = configure_info->info[category]->count;
1794 info = configure_info->info[category];
1796 for (i = 0 ; i < count ; i++) {
1797 if (info->detail_info[i] == NULL)
1800 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1801 *element = (type_element*)(info->detail_info[i]);
1802 MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element);
1808 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1809 MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element);
1813 MMCAM_LOG_ERROR("Failed to get [%s]", name);
1818 int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1820 mmf_return_val_if_fail(element, FALSE);
1822 *value = element->element_name;
1824 MMCAM_LOG_DEBUG("Get element name : [%s]", *value);
1829 int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1833 mmf_return_val_if_fail(element, FALSE);
1834 mmf_return_val_if_fail(name, FALSE);
1836 for (i = 0 ; i < element->count_int ; i++) {
1837 if (!strcmp(element->value_int[i]->name, name)) {
1838 *value = element->value_int[i]->value;
1839 MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value);
1844 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1845 element->name, name, element->count_int);
1850 int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1854 mmf_return_val_if_fail(element, FALSE);
1855 mmf_return_val_if_fail(name, FALSE);
1857 for (i = 0 ; i < element->count_string ; i++) {
1858 if (!strcmp(element->value_string[i]->name, name)) {
1859 *value = element->value_string[i]->value;
1860 MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value);
1865 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1866 element->name, name, element->count_string);
1871 int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1875 mmf_return_val_if_fail(gst, FALSE);
1876 mmf_return_val_if_fail(element, FALSE);
1878 if (element->count_int == 0) {
1879 MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name );
1881 if (element->value_int == NULL) {
1882 MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1886 for (i = 0 ; i < element->count_int ; i++) {
1887 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1889 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [i:%d]",
1890 element->element_name,
1891 element->value_int[i]->name,
1892 element->value_int[i]->value);
1896 if (element->count_string == 0) {
1897 MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name);
1899 if (element->value_string == NULL) {
1900 MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
1904 for (i = 0 ; i < element->count_string ; i++) {
1905 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
1907 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [s:%s]",
1908 element->element_name,
1909 element->value_string[i]->name,
1910 element->value_string[i]->value);
1917 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
1920 int count_value = 0;
1922 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1924 if (hcamcorder == NULL) {
1925 MMCAM_LOG_ERROR("handle is NULL");
1929 mmf_return_val_if_fail(name, FALSE);
1931 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1932 MMCAM_LOG_WARNING("No matched category. categoty[%d]", category);
1936 if (type == CONFIGURE_TYPE_MAIN) {
1937 for (i = 0 ; i < count_value ; i++) {
1938 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1939 *value = hcamcorder->conf_main_info_table[category][i].value_int;
1944 for (i = 0 ; i < count_value ; i++) {
1945 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1946 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
1952 MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name);
1957 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
1960 int count_value = 0;
1962 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1964 if (hcamcorder == NULL) {
1965 MMCAM_LOG_ERROR("handle is NULL");
1969 mmf_return_val_if_fail(name, FALSE);
1971 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1972 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1976 if (type == CONFIGURE_TYPE_MAIN) {
1977 for (i = 0 ; i < count_value ; i++) {
1978 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1979 *value = hcamcorder->conf_main_info_table[category][i].value_string;
1984 for (i = 0 ; i < count_value ; i++) {
1985 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1986 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
1992 MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name);
1997 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2000 int count_value = 0;
2002 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2004 if (hcamcorder == NULL) {
2005 MMCAM_LOG_ERROR("handle is NULL");
2009 mmf_return_val_if_fail(name, FALSE);
2011 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2012 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
2016 if (type == CONFIGURE_TYPE_MAIN) {
2017 for (i = 0 ; i < count_value ; i++) {
2018 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2019 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2024 for (i = 0 ; i < count_value ; i++) {
2025 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2026 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2032 MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name);
2037 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2039 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2041 if (hcamcorder == NULL) {
2042 MMCAM_LOG_ERROR("handle is NULL");
2046 if (type == CONFIGURE_TYPE_MAIN) {
2047 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2048 *size = (int)hcamcorder->conf_main_category_size[category];
2050 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2051 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2057 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2059 int i, j, k, type, category_type;
2062 type_int_range *temp_int_range;
2063 type_int_array *temp_int_array;
2064 type_int_pair_array *temp_int_pair_array;
2065 type_string *temp_string;
2066 type_element *temp_element;
2068 g_print("[ConfigureInfoPrint] : Entered.\n");
2070 mmf_return_if_fail(*configure_info);
2072 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2073 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2075 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2077 for (i = 0 ; i < category_type ; i++) {
2079 if ((*configure_info)->info[i]) {
2080 g_print("[ConfigureInfo] : Category [%d]\n", i);
2082 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2084 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2086 case CONFIGURE_VALUE_INT:
2087 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2088 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2090 case CONFIGURE_VALUE_INT_RANGE:
2091 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2092 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2093 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2095 case CONFIGURE_VALUE_INT_ARRAY:
2096 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2097 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2098 temp_int_array->name, temp_int_array->default_value);
2100 for (k = 0 ; k < temp_int_array->count ; k++)
2101 g_print("[%d] ", temp_int_array->value[k]);
2105 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2106 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2107 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2108 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2110 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2111 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2115 case CONFIGURE_VALUE_STRING:
2116 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2117 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2119 case CONFIGURE_VALUE_ELEMENT:
2120 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2121 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2123 for (k = 0 ; k < temp_element->count_int ; k++)
2124 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2126 for (k = 0 ; k < temp_element->count_string ; k++)
2127 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2131 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);
2135 g_print("[ConfigureInfo] : Failed to get value type.");
2141 g_print("[ConfigureInfoPrint] : Done.\n");
2145 static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle)
2147 type_element *telement = NULL;
2148 const char *codec_type_str = NULL;
2149 int codec_type = MM_AUDIO_CODEC_INVALID;
2150 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2151 _MMCamcorderSubContext *sc = NULL;
2153 mmf_return_val_if_fail(hcamcorder, NULL);
2154 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2156 mmf_return_val_if_fail(sc, NULL);
2160 /* Check element availability */
2161 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2163 switch (codec_type) {
2164 case MM_AUDIO_CODEC_AMR:
2165 codec_type_str = "AMR";
2167 case MM_AUDIO_CODEC_G723_1:
2168 codec_type_str = "G723_1";
2170 case MM_AUDIO_CODEC_MP3:
2171 codec_type_str = "MP3";
2173 case MM_AUDIO_CODEC_AAC:
2174 codec_type_str = "AAC";
2176 case MM_AUDIO_CODEC_MMF:
2177 codec_type_str = "MMF";
2179 case MM_AUDIO_CODEC_ADPCM:
2180 codec_type_str = "ADPCM";
2182 case MM_AUDIO_CODEC_WAVE:
2183 codec_type_str = "WAVE";
2185 case MM_AUDIO_CODEC_MIDI:
2186 codec_type_str = "MIDI";
2188 case MM_AUDIO_CODEC_IMELODY:
2189 codec_type_str = "IMELODY";
2191 case MM_AUDIO_CODEC_VORBIS:
2192 codec_type_str = "VORBIS";
2195 MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type);
2199 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2200 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2208 static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle)
2210 type_element *telement = NULL;
2211 const char *codec_type_str = NULL;
2212 int codec_type = MM_VIDEO_CODEC_INVALID;
2213 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2214 _MMCamcorderSubContext *sc = NULL;
2216 mmf_return_val_if_fail(hcamcorder, NULL);
2217 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2219 mmf_return_val_if_fail(sc, NULL);
2221 /* Check element availability */
2222 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2224 switch (codec_type) {
2225 case MM_VIDEO_CODEC_H263:
2226 codec_type_str = "H263";
2228 case MM_VIDEO_CODEC_H264:
2229 codec_type_str = "H264";
2231 case MM_VIDEO_CODEC_H26L:
2232 codec_type_str = "H26L";
2234 case MM_VIDEO_CODEC_MPEG4:
2235 codec_type_str = "MPEG4";
2237 case MM_VIDEO_CODEC_MPEG1:
2238 codec_type_str = "MPEG1";
2240 case MM_VIDEO_CODEC_THEORA:
2241 codec_type_str = "THEORA";
2244 MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type);
2248 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2249 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2257 static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle)
2259 type_element *telement = NULL;
2260 const char *codec_type_str = NULL;
2261 int codec_type = MM_IMAGE_CODEC_INVALID;
2262 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2263 _MMCamcorderSubContext *sc = NULL;
2265 mmf_return_val_if_fail(hcamcorder, NULL);
2266 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2268 mmf_return_val_if_fail(sc, NULL);
2270 /* Check element availability */
2271 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2273 switch (codec_type) {
2274 case MM_IMAGE_CODEC_JPEG:
2275 codec_type_str = "JPEG";
2277 case MM_IMAGE_CODEC_SRW:
2278 codec_type_str = "SRW";
2280 case MM_IMAGE_CODEC_JPEG_SRW:
2281 codec_type_str = "JPEG_SRW";
2283 case MM_IMAGE_CODEC_PNG:
2284 codec_type_str = "PNG";
2286 case MM_IMAGE_CODEC_BMP:
2287 codec_type_str = "BMP";
2289 case MM_IMAGE_CODEC_WBMP:
2290 codec_type_str = "WBMP";
2292 case MM_IMAGE_CODEC_TIFF:
2293 codec_type_str = "TIFF";
2295 case MM_IMAGE_CODEC_PCX:
2296 codec_type_str = "PCX";
2298 case MM_IMAGE_CODEC_GIF:
2299 codec_type_str = "GIF";
2301 case MM_IMAGE_CODEC_ICO:
2302 codec_type_str = "ICO";
2304 case MM_IMAGE_CODEC_RAS:
2305 codec_type_str = "RAS";
2307 case MM_IMAGE_CODEC_TGA:
2308 codec_type_str = "TGA";
2310 case MM_IMAGE_CODEC_XBM:
2311 codec_type_str = "XBM";
2313 case MM_IMAGE_CODEC_XPM:
2314 codec_type_str = "XPM";
2317 MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type);
2321 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2322 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2330 static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle)
2332 type_element *telement = NULL;
2333 const char *mux_type_str = NULL;
2334 int file_type = MM_FILE_FORMAT_INVALID;
2335 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2336 _MMCamcorderSubContext *sc = NULL;
2338 mmf_return_val_if_fail(hcamcorder, NULL);
2339 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2341 mmf_return_val_if_fail(sc, NULL);
2343 /* Check element availability */
2344 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2346 switch (file_type) {
2347 case MM_FILE_FORMAT_3GP:
2348 mux_type_str = "3GP";
2350 case MM_FILE_FORMAT_AMR:
2351 mux_type_str = "AMR";
2353 case MM_FILE_FORMAT_MP4:
2354 mux_type_str = "MP4";
2356 case MM_FILE_FORMAT_AAC:
2357 mux_type_str = "AAC";
2359 case MM_FILE_FORMAT_MP3:
2360 mux_type_str = "MP3";
2362 case MM_FILE_FORMAT_OGG:
2363 mux_type_str = "OGG";
2365 case MM_FILE_FORMAT_WAV:
2366 mux_type_str = "WAV";
2368 case MM_FILE_FORMAT_AVI:
2369 mux_type_str = "AVI";
2371 case MM_FILE_FORMAT_WMA:
2372 mux_type_str = "WMA";
2374 case MM_FILE_FORMAT_WMV:
2375 mux_type_str = "WMV";
2377 case MM_FILE_FORMAT_MID:
2378 mux_type_str = "MID";
2380 case MM_FILE_FORMAT_MMF:
2381 mux_type_str = "MMF";
2383 case MM_FILE_FORMAT_MATROSKA:
2384 mux_type_str = "MATROSKA";
2386 case MM_FILE_FORMAT_M2TS:
2387 mux_type_str = "M2TS";
2390 MMCAM_LOG_ERROR("Not supported file format[%d]", file_type);
2394 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2395 CONFIGURE_CATEGORY_MAIN_MUX,
2403 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type)
2405 type_element *telement = NULL;
2408 case MM_CAM_AUDIO_ENCODER:
2409 telement = __mmcamcorder_get_audio_codec_element(handle);
2411 case MM_CAM_VIDEO_ENCODER:
2412 telement = __mmcamcorder_get_video_codec_element(handle);
2414 case MM_CAM_IMAGE_ENCODER:
2415 telement = __mmcamcorder_get_image_codec_element(handle);
2417 case MM_CAM_FILE_FORMAT:
2418 telement = __mmcamcorder_get_file_format_element(handle);
2421 MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type);
2428 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2430 int codec_index = MM_AUDIO_CODEC_INVALID;
2433 MMCAM_LOG_ERROR("name is NULL");
2434 return MM_AUDIO_CODEC_INVALID;
2437 if (!strcmp(name, "AMR"))
2438 codec_index = MM_AUDIO_CODEC_AMR;
2439 else if (!strcmp(name, "G723_1"))
2440 codec_index = MM_AUDIO_CODEC_G723_1;
2441 else if (!strcmp(name, "MP3"))
2442 codec_index = MM_AUDIO_CODEC_MP3;
2443 else if (!strcmp(name, "AAC"))
2444 codec_index = MM_AUDIO_CODEC_AAC;
2445 else if (!strcmp(name, "MMF"))
2446 codec_index = MM_AUDIO_CODEC_MMF;
2447 else if (!strcmp(name, "ADPCM"))
2448 codec_index = MM_AUDIO_CODEC_ADPCM;
2449 else if (!strcmp(name, "WAVE"))
2450 codec_index = MM_AUDIO_CODEC_WAVE;
2451 else if (!strcmp(name, "MIDI"))
2452 codec_index = MM_AUDIO_CODEC_MIDI;
2453 else if (!strcmp(name, "IMELODY"))
2454 codec_index = MM_AUDIO_CODEC_IMELODY;
2455 else if (!strcmp(name, "VORBIS"))
2456 codec_index = MM_AUDIO_CODEC_VORBIS;
2458 MMCAM_LOG_DEBUG("audio codec index %d", codec_index);
2465 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2467 int codec_index = MM_VIDEO_CODEC_INVALID;
2470 MMCAM_LOG_ERROR("name is NULL");
2471 return MM_VIDEO_CODEC_INVALID;
2474 if (!strcmp(name, "H263"))
2475 codec_index = MM_VIDEO_CODEC_H263;
2476 else if (!strcmp(name, "H264"))
2477 codec_index = MM_VIDEO_CODEC_H264;
2478 else if (!strcmp(name, "H26L"))
2479 codec_index = MM_VIDEO_CODEC_H26L;
2480 else if (!strcmp(name, "MPEG4"))
2481 codec_index = MM_VIDEO_CODEC_MPEG4;
2482 else if (!strcmp(name, "MPEG1"))
2483 codec_index = MM_VIDEO_CODEC_MPEG1;
2484 else if (!strcmp(name, "THEORA"))
2485 codec_index = MM_VIDEO_CODEC_THEORA;
2487 MMCAM_LOG_DEBUG("video codec index %d", codec_index);
2494 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2496 int codec_index = MM_IMAGE_CODEC_INVALID;
2499 MMCAM_LOG_ERROR("name is NULL");
2500 return MM_IMAGE_CODEC_INVALID;
2503 if (!strcmp(name, "JPEG"))
2504 codec_index = MM_IMAGE_CODEC_JPEG;
2505 else if (!strcmp(name, "PNG"))
2506 codec_index = MM_IMAGE_CODEC_PNG;
2507 else if (!strcmp(name, "BMP"))
2508 codec_index = MM_IMAGE_CODEC_BMP;
2509 else if (!strcmp(name, "WBMP"))
2510 codec_index = MM_IMAGE_CODEC_WBMP;
2511 else if (!strcmp(name, "TIFF"))
2512 codec_index = MM_IMAGE_CODEC_TIFF;
2513 else if (!strcmp(name, "PCX"))
2514 codec_index = MM_IMAGE_CODEC_PCX;
2515 else if (!strcmp(name, "GIF"))
2516 codec_index = MM_IMAGE_CODEC_GIF;
2517 else if (!strcmp(name, "ICO"))
2518 codec_index = MM_IMAGE_CODEC_ICO;
2519 else if (!strcmp(name, "RAS"))
2520 codec_index = MM_IMAGE_CODEC_RAS;
2521 else if (!strcmp(name, "TGA"))
2522 codec_index = MM_IMAGE_CODEC_TGA;
2523 else if (!strcmp(name, "XBM"))
2524 codec_index = MM_IMAGE_CODEC_XBM;
2525 else if (!strcmp(name, "XPM"))
2526 codec_index = MM_IMAGE_CODEC_XPM;
2528 MMCAM_LOG_DEBUG("image codec index %d", codec_index);
2534 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2536 int mux_index = MM_FILE_FORMAT_INVALID;
2539 MMCAM_LOG_ERROR("name is NULL");
2540 return MM_FILE_FORMAT_INVALID;
2543 if (!strcmp(name, "3GP"))
2544 mux_index = MM_FILE_FORMAT_3GP;
2545 else if (!strcmp(name, "AMR"))
2546 mux_index = MM_FILE_FORMAT_AMR;
2547 else if (!strcmp(name, "MP4"))
2548 mux_index = MM_FILE_FORMAT_MP4;
2549 else if (!strcmp(name, "AAC"))
2550 mux_index = MM_FILE_FORMAT_AAC;
2551 else if (!strcmp(name, "MP3"))
2552 mux_index = MM_FILE_FORMAT_MP3;
2553 else if (!strcmp(name, "OGG"))
2554 mux_index = MM_FILE_FORMAT_OGG;
2555 else if (!strcmp(name, "WAV"))
2556 mux_index = MM_FILE_FORMAT_WAV;
2557 else if (!strcmp(name, "AVI"))
2558 mux_index = MM_FILE_FORMAT_AVI;
2559 else if (!strcmp(name, "WMA"))
2560 mux_index = MM_FILE_FORMAT_WMA;
2561 else if (!strcmp(name, "WMV"))
2562 mux_index = MM_FILE_FORMAT_WMV;
2563 else if (!strcmp(name, "MID"))
2564 mux_index = MM_FILE_FORMAT_MID;
2565 else if (!strcmp(name, "MMF"))
2566 mux_index = MM_FILE_FORMAT_MMF;
2567 else if (!strcmp(name, "MATROSKA"))
2568 mux_index = MM_FILE_FORMAT_MATROSKA;
2569 else if (!strcmp(name, "M2TS"))
2570 mux_index = MM_FILE_FORMAT_M2TS;
2572 MMCAM_LOG_DEBUG("mux index %d", mux_index);
2578 int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2582 mmf_return_val_if_fail(name, -1);
2584 switch (conf_category) {
2585 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2586 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2588 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2589 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2591 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2592 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2594 case CONFIGURE_CATEGORY_MAIN_MUX:
2595 fmt = _mmcamcorder_get_mux_format(handle, name);
2598 MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category);
2604 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format)
2606 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2607 camera_conf* configure_info = NULL;
2609 int total_count = 0;
2611 mmf_return_val_if_fail(hcamcorder, 0);
2613 configure_info = hcamcorder->conf_main;
2615 if (configure_info->info[conf_category]) {
2618 const char *name = NULL;
2619 int count = configure_info->info[conf_category]->count;
2620 conf_detail *info = configure_info->info[conf_category];
2622 MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]",
2623 conf_category, count, info);
2625 if (count <= 0 || !info)
2628 arr = (int*)g_malloc0(count * sizeof(int));
2630 for (i = 0 ; i < count ; i++) {
2631 if (info->detail_info[i] == NULL)
2634 name = ((type_element*)(info->detail_info[i]))->name;
2635 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2637 arr[total_count++] = fmt;
2639 MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt);