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} },
632 { "NetworkCameraHALName", CONFIGURE_VALUE_STRING, {NULL} },
635 /* [VideoInput] matching table */
636 static conf_info_table conf_main_video_input_table[] = {
637 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
638 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
639 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
640 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
641 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
642 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
643 { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
644 { "MeasurePreviewFPS", CONFIGURE_VALUE_INT, {.value_int = 0} },
645 { "SupportExtraPreview", CONFIGURE_VALUE_INT, {.value_int = 0} },
648 /* [AudioInput] matching table */
649 static conf_info_table conf_main_audio_input_table[] = {
650 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
651 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
652 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
653 { "AudioBufferInterval", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_AUDIO_BUFFER_INTERVAL} },
656 /* [VideoOutput] matching table */
657 static conf_info_table conf_main_video_output_table[] = {
658 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
659 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
660 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
661 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
662 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
663 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
664 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
665 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
666 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
668 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
669 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
670 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
671 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
674 /* [Capture] matching table */
675 static conf_info_table conf_main_capture_table[] = {
676 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
677 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
678 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
679 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
682 /* [Record] matching table */
683 static conf_info_table conf_main_record_table[] = {
684 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
685 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
686 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
688 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
689 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
692 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
693 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
694 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
695 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
696 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
697 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
698 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
699 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
700 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
701 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
702 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = 0} },
703 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
704 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} }
707 /* [VideoEncoder] matching table */
708 static conf_info_table conf_main_video_encoder_table[] = {
709 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
710 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
711 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
712 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
713 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
714 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
717 /* [AudioEncoder] matching table */
718 static conf_info_table conf_main_audio_encoder_table[] = {
719 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
720 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
721 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
722 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
723 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
724 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
725 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
726 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
727 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
728 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
731 /* [ImageEncoder] matching table */
732 static conf_info_table conf_main_image_encoder_table[] = {
733 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
734 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
735 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
736 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
737 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
738 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
739 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
740 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
741 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
742 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
743 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
744 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
747 /* [Mux] matching table */
748 static conf_info_table conf_main_mux_table[] = {
749 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
750 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
751 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
752 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
753 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
754 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
755 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
756 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
757 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
758 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
759 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
760 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
761 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
762 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
770 /* [Camera] matching table */
771 static conf_info_table conf_ctrl_camera_table[] = {
772 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
774 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
775 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
776 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
777 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
778 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
779 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
781 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
782 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
783 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
784 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
785 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
786 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
789 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
790 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
791 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
792 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
793 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
794 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
797 /* [Strobe] matching table */
798 static conf_info_table conf_ctrl_strobe_table[] = {
799 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
800 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
801 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
802 { "StrobeBrightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
805 /* [Effect] matching table */
806 static conf_info_table conf_ctrl_effect_table[] = {
807 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
808 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
809 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
810 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
812 { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
813 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
814 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
816 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
817 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
819 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 /* [Photograph] matching table */
823 static conf_info_table conf_ctrl_photograph_table[] = {
824 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
825 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
826 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
827 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
828 { "FocusLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
829 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
831 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
832 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
833 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
834 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
835 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
836 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
837 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
838 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
839 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
840 { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
841 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
842 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
843 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
844 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
847 /* [Capture] matching table */
848 static conf_info_table conf_ctrl_capture_table[] = {
849 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
850 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
851 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
852 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
853 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
854 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
855 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
858 /* [Detect] matching table */
859 static conf_info_table conf_ctrl_detect_table[] = {
860 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
861 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
862 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
863 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
866 MMCAM_LOG_INFO("Entered...");
868 if (type == CONFIGURE_TYPE_MAIN) {
869 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
870 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
871 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
872 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
873 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
874 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
875 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
876 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
877 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
878 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
880 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
881 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
882 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
883 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
884 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
885 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
886 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
887 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
888 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
889 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
891 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
893 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
894 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
895 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
896 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
897 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
898 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
900 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
901 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
902 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
903 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
904 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
905 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
907 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
910 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
912 MMCAM_LOG_INFO("Done.");
914 return MM_ERROR_NONE;
918 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
920 int ret = MM_ERROR_NONE;
922 char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
924 MMCAM_LOG_INFO("Opening...[%s]", ConfFile);
926 mmf_return_val_if_fail(ConfFile, FALSE);
928 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
929 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
931 fp = fopen(conf_path, "r");
933 MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path);
935 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
936 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
937 fp = fopen(conf_path, "r");
939 MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno);
940 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
945 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
949 MMCAM_LOG_INFO("Leave [0x%x]", ret);
955 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
957 const unsigned int BUFFER_NUM_DETAILS = 256;
958 const unsigned int BUFFER_NUM_TOKEN = 20;
959 size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
960 const char* delimiters = " |=,\t\n";
963 int ret = MM_ERROR_NONE;
965 int count_main_category = 0;
966 int count_details = 0;
971 char *buffer_string = NULL;
972 char *buffer_details[BUFFER_NUM_DETAILS];
973 char *buffer_token[BUFFER_NUM_TOKEN];
975 char *category_name = NULL;
976 char *detail_string = NULL;
977 char *user_ptr = NULL;
979 camera_conf *new_conf = NULL;
983 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
985 *configure_info = NULL;
987 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
988 buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size);
990 new_conf->type = type;
992 ret = _mmcamcorder_conf_init(handle, type, new_conf);
993 if (ret != MM_ERROR_NONE) {
994 MMCAM_LOG_ERROR("conf init failed 0x%x", ret);
996 g_free(buffer_string);
1000 *configure_info = new_conf;
1003 count_main_category = 0;
1006 if (read_main == 0) {
1007 buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
1008 length_read = getline(&buffer_string, &buffer_line_size, fp);
1009 if (length_read < 1) {
1010 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1014 buffer_string[--length_read] = '\0'; /* remove new line character */
1016 MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string);
1019 token = strtok_r(buffer_string, delimiters, &user_ptr);
1021 if ((token) && (token[0] == ';') && (length_read > -1)) {
1022 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1027 MMCAM_LOG_VERBOSE("token : \"%s\"", token);
1028 buffer_token[count_token] = token;
1030 token = strtok_r(NULL, delimiters, &user_ptr);
1033 if (count_token == 0)
1039 if (*buffer_token[0] == ';') {
1041 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1042 } else if (*buffer_token[0] == '[') {
1044 category_name = get_new_string(buffer_token[0]);
1045 if (category_name == NULL) {
1046 MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]);
1050 count_main_category++;
1054 length_read = getline(&buffer_string, &buffer_line_size, fp);
1055 if (length_read < 1) {
1056 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1060 buffer_string[--length_read] = '\0'; /* remove new line character */
1062 MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read);
1064 detail_string = get_new_string(buffer_string);
1066 token = strtok_r(buffer_string, delimiters, &user_ptr);
1068 if (token && token[0] != ';' && length_read > -1) {
1069 MMCAM_LOG_VERBOSE("token : [%s]", token);
1070 if (token[0] == '[') {
1072 buffer_token[0] = token;
1073 SAFE_G_FREE(detail_string);
1077 buffer_details[count_details++] = detail_string;
1079 SAFE_G_FREE(detail_string);
1083 MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);
1085 if (count_details == 0) {
1086 MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name);
1087 SAFE_G_FREE(category_name);
1094 if (type == CONFIGURE_TYPE_MAIN) {
1095 if (!strcmp("[General]", category_name))
1096 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1097 else if (!strcmp("[VideoInput]", category_name))
1098 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1099 else if (!strcmp("[AudioInput]", category_name))
1100 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1101 else if (!strcmp("[VideoOutput]", category_name))
1102 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1103 else if (!strcmp("[Capture]", category_name))
1104 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1105 else if (!strcmp("[Record]", category_name))
1106 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1107 else if (!strcmp("[VideoEncoder]", category_name))
1108 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1109 else if (!strcmp("[AudioEncoder]", category_name))
1110 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1111 else if (!strcmp("[ImageEncoder]", category_name))
1112 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1113 else if (!strcmp("[Mux]", category_name))
1114 category = CONFIGURE_CATEGORY_MAIN_MUX;
1116 if (!strcmp("[Camera]", category_name))
1117 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1118 else if (!strcmp("[Strobe]", category_name))
1119 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1120 else if (!strcmp("[Effect]", category_name))
1121 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1122 else if (!strcmp("[Photograph]", category_name))
1123 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1124 else if (!strcmp("[Capture]", category_name))
1125 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1126 else if (!strcmp("[Detect]", category_name))
1127 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1130 if (category != -1) {
1131 _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
1132 buffer_details, category, count_details);
1134 MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type);
1138 for (i = 0 ; i < count_details ; i++)
1139 SAFE_G_FREE(buffer_details[i]);
1142 SAFE_G_FREE(category_name);
1145 /* (*configure_info) = new_conf; */
1147 SAFE_G_FREE(buffer_string);
1149 /*MMCAM_LOG_INFO("Done.");*/
1151 return MM_ERROR_NONE;
1155 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1160 int type = CONFIGURE_VALUE_INT;
1162 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1163 camera_conf *temp_conf = (*configure_info);
1165 type_int2 *temp_int = NULL;
1166 type_int_range *temp_int_range = NULL;
1167 type_int_array *temp_int_array = NULL;
1168 type_int_pair_array *temp_int_pair_array = NULL;
1169 type_string2 *temp_string = NULL;
1170 type_string_array *temp_string_array = NULL;
1171 type_element2 *temp_element = NULL;
1173 MMCAM_LOG_INFO("Entered...");
1175 mmf_return_if_fail(temp_conf);
1177 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1178 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1180 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1182 for (i = 0 ; i < category_num ; i++) {
1183 if (temp_conf->info[i]) {
1184 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1185 if (temp_conf->info[i]->detail_info[j] == NULL)
1188 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1190 case CONFIGURE_VALUE_INT:
1191 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1192 SAFE_G_FREE(temp_int->name);
1194 case CONFIGURE_VALUE_INT_RANGE:
1195 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1196 SAFE_G_FREE(temp_int_range->name);
1198 case CONFIGURE_VALUE_INT_ARRAY:
1199 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1200 SAFE_G_FREE(temp_int_array->name);
1201 SAFE_G_FREE(temp_int_array->value);
1203 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1204 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1205 SAFE_G_FREE(temp_int_pair_array->name);
1206 SAFE_G_FREE(temp_int_pair_array->value[0]);
1207 SAFE_G_FREE(temp_int_pair_array->value[1]);
1209 case CONFIGURE_VALUE_STRING:
1210 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1211 SAFE_G_FREE(temp_string->name);
1212 SAFE_G_FREE(temp_string->value);
1214 case CONFIGURE_VALUE_STRING_ARRAY:
1215 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1216 SAFE_G_FREE(temp_string_array->name);
1217 if (temp_string_array->value) {
1218 count = temp_string_array->count;
1220 for (k = 0 ; k < count ; k++)
1221 SAFE_G_FREE(temp_string_array->value[k]);
1223 SAFE_G_FREE(temp_string_array->value);
1225 SAFE_G_FREE(temp_string_array->default_value);
1227 case CONFIGURE_VALUE_ELEMENT:
1228 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1229 SAFE_G_FREE(temp_element->name);
1230 SAFE_G_FREE(temp_element->element_name);
1232 if (temp_element->value_int) {
1233 count = temp_element->count_int;
1234 for (k = 0 ; k < count ; k++) {
1235 SAFE_G_FREE(temp_element->value_int[k]->name);
1236 SAFE_G_FREE(temp_element->value_int[k]);
1238 SAFE_G_FREE(temp_element->value_int);
1241 if (temp_element->value_string) {
1242 count = temp_element->count_string;
1243 for (k = 0 ; k < count ; k++) {
1244 SAFE_G_FREE(temp_element->value_string[k]->name);
1245 SAFE_G_FREE(temp_element->value_string[k]->value);
1246 SAFE_G_FREE(temp_element->value_string[k]);
1248 SAFE_G_FREE(temp_element->value_string);
1252 MMCAM_LOG_WARNING("unknown type %d", type);
1257 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1260 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1262 SAFE_G_FREE(temp_conf->info[i]);
1263 temp_conf->info[i] = NULL;
1267 SAFE_G_FREE((*configure_info)->info);
1268 SAFE_G_FREE((*configure_info));
1270 MMCAM_LOG_INFO("Done.");
1273 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1276 int count_value = 0;
1278 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1280 if (hcamcorder == NULL) {
1281 MMCAM_LOG_ERROR("handle is NULL");
1285 /*MMCAM_LOG_INFO("Entered...");*/
1287 mmf_return_val_if_fail(name, FALSE);
1289 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1290 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1294 /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/
1296 if (type == CONFIGURE_TYPE_MAIN) {
1297 for (i = 0 ; i < count_value ; i++) {
1298 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1299 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1300 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1305 for (i = 0 ; i < count_value ; i++) {
1306 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1307 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1308 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1318 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1320 const int BUFFER_NUM_TOKEN = 256;
1327 char *buffer_token[BUFFER_NUM_TOKEN];
1328 char *user_ptr = NULL;
1330 const char *delimiters = " |=,\t\n";
1331 const char *delimiters_sub = " |\t\n";
1332 const char *delimiters_3rd = "|\n";
1334 mmf_return_val_if_fail(info && buffer_details, FALSE);
1336 (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail));
1337 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1338 (*info)->count = count_details;
1340 for (i = 0 ; i < count_details ; i++) {
1341 MMCAM_LOG_VERBOSE("Read line\"%s\"", buffer_details[i]);
1343 token = strtok_r(buffer_details[i], delimiters, &user_ptr);
1346 buffer_token[count_token] = token;
1349 (*info)->detail_info[i] = NULL;
1350 MMCAM_LOG_WARNING("No token... check it.[%s]", buffer_details[i]);
1354 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1355 (*info)->detail_info[i] = NULL;
1356 MMCAM_LOG_WARNING("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
1360 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1361 token = strtok_r(NULL, delimiters, &user_ptr);
1363 buffer_token[count_token] = token;
1364 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1366 token = strtok_r(NULL, delimiters, &user_ptr);
1369 if (count_token < 2) {
1370 (*info)->detail_info[i] = NULL;
1371 MMCAM_LOG_WARNING("Number of token is too small... check it.[%s]", buffer_details[i]);
1374 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1376 strtok_r(NULL, delimiters_sub, &user_ptr);
1378 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1379 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1381 buffer_token[count_token] = token;
1382 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1384 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1386 } else { /* CONFIGURE_VALUE_STRING */
1387 token = strtok_r(NULL, delimiters_3rd, &user_ptr);
1390 buffer_token[count_token] = token;
1391 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1396 if (count_token < 2) {
1397 (*info)->detail_info[i] = NULL;
1398 MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]);
1403 switch (value_type) {
1404 case CONFIGURE_VALUE_INT:
1408 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1409 new_int->name = get_new_string(buffer_token[0]);
1410 new_int->value = atoi(buffer_token[1]);
1411 (*info)->detail_info[i] = (void*)new_int;
1412 MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value);
1415 case CONFIGURE_VALUE_INT_RANGE:
1417 type_int_range* new_int_range;
1419 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1420 new_int_range->name = get_new_string(buffer_token[0]);
1421 new_int_range->min = atoi(buffer_token[1]);
1422 new_int_range->max = atoi(buffer_token[2]);
1423 new_int_range->default_value = atoi(buffer_token[3]);
1424 (*info)->detail_info[i] = (void*)new_int_range;
1426 MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1427 new_int_range->name,
1430 new_int_range->default_value);
1433 case CONFIGURE_VALUE_INT_ARRAY:
1435 int count_value = count_token - 2;
1436 type_int_array* new_int_array;
1438 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1439 new_int_array->name = get_new_string(buffer_token[0]);
1440 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1441 new_int_array->count = count_value;
1443 MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name);
1444 for (j = 0 ; j < count_value ; j++) {
1445 new_int_array->value[j] = atoi(buffer_token[j+1]);
1446 MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]);
1449 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1450 MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value);
1452 (*info)->detail_info[i] = (void*)new_int_array;
1455 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1457 int count_value = (count_token - 3) >> 1;
1458 type_int_pair_array* new_int_pair_array;
1460 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1461 new_int_pair_array->name = get_new_string(buffer_token[0]);
1462 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1463 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1464 new_int_pair_array->count = count_value;
1466 MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);
1467 for (j = 0 ; j < count_value ; j++) {
1468 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1469 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1471 MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j,
1472 new_int_pair_array->value[0][j],
1473 new_int_pair_array->value[1][j]);
1476 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1477 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1479 MMCAM_LOG_VERBOSE(" default value[%d,%d]",
1480 new_int_pair_array->default_value[0],
1481 new_int_pair_array->default_value[1]);
1483 (*info)->detail_info[i] = (void*)new_int_pair_array;
1486 case CONFIGURE_VALUE_STRING:
1488 type_string2* new_string;
1490 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1491 new_string->name = get_new_string(buffer_token[0]);
1492 new_string->value = get_new_string(buffer_token[1]);
1493 (*info)->detail_info[i] = (void*)new_string;
1495 MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value);
1498 case CONFIGURE_VALUE_STRING_ARRAY:
1500 int count_value = count_token - 2;
1501 type_string_array* new_string_array;
1503 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1504 new_string_array->name = get_new_string(buffer_token[0]);
1505 new_string_array->count = count_value;
1506 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1508 MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name);
1510 for (j = 0 ; j < count_value ; j++) {
1511 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1512 MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]);
1515 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1517 MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value);
1519 (*info)->detail_info[i] = (void*)new_string_array;
1522 case CONFIGURE_VALUE_ELEMENT:
1524 type_element2* new_element;
1526 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1527 new_element->name = get_new_string(buffer_token[0]);
1528 new_element->element_name = get_new_string(buffer_token[1]);
1529 new_element->count_int = atoi(buffer_token[2]);
1530 new_element->value_int = NULL;
1531 new_element->count_string = atoi(buffer_token[3]);
1532 new_element->value_string = NULL;
1534 MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1535 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1537 /* add int values */
1538 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1539 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1540 for (j = 0 ; j < new_element->count_int ; j++) {
1541 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1542 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1543 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1545 MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]",
1546 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1550 /* add string values */
1551 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1552 new_element->count_int >= 0 && new_element->count_int <= 30) {
1553 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1554 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1555 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1556 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1557 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1559 MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]",
1560 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);
1564 (*info)->detail_info[i] = (void*)new_element;
1576 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1581 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1583 mmf_return_val_if_fail(configure_info, FALSE);
1584 mmf_return_val_if_fail(name, FALSE);
1586 if (configure_info->info[category]) {
1587 count = configure_info->info[category]->count;
1588 info = configure_info->info[category];
1590 for (i = 0 ; i < count ; i++) {
1591 if (info->detail_info[i] == NULL)
1594 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1595 *value = ((type_int*)(info->detail_info[i]))->value;
1596 MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value);
1602 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1603 MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value);
1607 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1613 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1618 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1620 mmf_return_val_if_fail(configure_info, FALSE);
1621 mmf_return_val_if_fail(name, FALSE);
1623 if (configure_info->info[category]) {
1624 count = configure_info->info[category]->count;
1625 info = configure_info->info[category];
1627 for (i = 0 ; i < count ; i++) {
1628 if (info->detail_info[i] == NULL)
1631 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1632 *value = (type_int_range*)(info->detail_info[i]);
1633 MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]",
1634 name, (*value)->min, (*value)->max, (*value)->default_value);
1642 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1647 int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1652 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1654 mmf_return_val_if_fail(configure_info, FALSE);
1655 mmf_return_val_if_fail(name, FALSE);
1657 if (configure_info->info[category]) {
1658 count = configure_info->info[category]->count;
1659 info = configure_info->info[category];
1661 for (i = 0 ; i < count ; i++) {
1662 if (info->detail_info[i] == NULL)
1665 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1666 *value = (type_int_array*)(info->detail_info[i]);
1667 MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]",
1668 name, (*value)->value, (*value)->count, (*value)->default_value);
1676 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1682 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1687 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1689 mmf_return_val_if_fail(configure_info, FALSE);
1690 mmf_return_val_if_fail(name, FALSE);
1692 if (configure_info->info[category]) {
1693 count = configure_info->info[category]->count;
1694 info = configure_info->info[category];
1696 for (i = 0 ; i < count ; i++) {
1697 if (info->detail_info[i] == NULL)
1700 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1701 *value = (type_int_pair_array*)(info->detail_info[i]);
1702 MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]",
1703 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1704 (*value)->default_value[0], (*value)->default_value[1]);
1712 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1717 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1722 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1724 mmf_return_val_if_fail(configure_info, FALSE);
1725 mmf_return_val_if_fail(name, FALSE);
1727 if (configure_info->info[category]) {
1728 count = configure_info->info[category]->count;
1729 info = configure_info->info[category];
1731 for (i = 0 ; i < count ; i++) {
1732 if (info->detail_info[i] == NULL)
1735 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1736 *value = ((type_string*)(info->detail_info[i]))->value;
1737 MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL");
1743 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1744 MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL");
1748 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1753 int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1758 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1760 mmf_return_val_if_fail(configure_info, FALSE);
1761 mmf_return_val_if_fail(name, FALSE);
1763 if (configure_info->info[category]) {
1764 count = configure_info->info[category]->count;
1765 info = configure_info->info[category];
1767 for (i = 0 ; i < count ; i++) {
1768 if (info->detail_info[i] == NULL)
1771 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1772 *value = (type_string_array*)(info->detail_info[i]);
1773 MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]",
1774 name, (*value)->value, (*value)->count, (*value)->default_value);
1782 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1787 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1792 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1794 mmf_return_val_if_fail(configure_info, FALSE);
1795 mmf_return_val_if_fail(name, FALSE);
1797 if (configure_info->info[category]) {
1798 count = configure_info->info[category]->count;
1799 info = configure_info->info[category];
1801 for (i = 0 ; i < count ; i++) {
1802 if (info->detail_info[i] == NULL)
1805 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1806 *element = (type_element*)(info->detail_info[i]);
1807 MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element);
1813 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1814 MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element);
1818 MMCAM_LOG_ERROR("Failed to get [%s]", name);
1823 int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1825 mmf_return_val_if_fail(element, FALSE);
1827 *value = element->element_name;
1829 MMCAM_LOG_DEBUG("Get element name : [%s]", *value);
1834 int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1838 mmf_return_val_if_fail(element, FALSE);
1839 mmf_return_val_if_fail(name, FALSE);
1841 for (i = 0 ; i < element->count_int ; i++) {
1842 if (!strcmp(element->value_int[i]->name, name)) {
1843 *value = element->value_int[i]->value;
1844 MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value);
1849 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1850 element->name, name, element->count_int);
1855 int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1859 mmf_return_val_if_fail(element, FALSE);
1860 mmf_return_val_if_fail(name, FALSE);
1862 for (i = 0 ; i < element->count_string ; i++) {
1863 if (!strcmp(element->value_string[i]->name, name)) {
1864 *value = element->value_string[i]->value;
1865 MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value);
1870 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1871 element->name, name, element->count_string);
1876 int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1880 mmf_return_val_if_fail(gst, FALSE);
1881 mmf_return_val_if_fail(element, FALSE);
1883 if (element->count_int == 0) {
1884 MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name );
1886 if (element->value_int == NULL) {
1887 MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1891 for (i = 0 ; i < element->count_int ; i++) {
1892 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1894 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [i:%d]",
1895 element->element_name,
1896 element->value_int[i]->name,
1897 element->value_int[i]->value);
1901 if (element->count_string == 0) {
1902 MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name);
1904 if (element->value_string == NULL) {
1905 MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
1909 for (i = 0 ; i < element->count_string ; i++) {
1910 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
1912 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [s:%s]",
1913 element->element_name,
1914 element->value_string[i]->name,
1915 element->value_string[i]->value);
1922 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
1925 int count_value = 0;
1927 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1929 if (hcamcorder == NULL) {
1930 MMCAM_LOG_ERROR("handle is NULL");
1934 mmf_return_val_if_fail(name, FALSE);
1936 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1937 MMCAM_LOG_WARNING("No matched category. categoty[%d]", category);
1941 if (type == CONFIGURE_TYPE_MAIN) {
1942 for (i = 0 ; i < count_value ; i++) {
1943 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1944 *value = hcamcorder->conf_main_info_table[category][i].value_int;
1949 for (i = 0 ; i < count_value ; i++) {
1950 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1951 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
1957 MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name);
1962 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
1965 int count_value = 0;
1967 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1969 if (hcamcorder == NULL) {
1970 MMCAM_LOG_ERROR("handle is NULL");
1974 mmf_return_val_if_fail(name, FALSE);
1976 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1977 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1981 if (type == CONFIGURE_TYPE_MAIN) {
1982 for (i = 0 ; i < count_value ; i++) {
1983 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1984 *value = hcamcorder->conf_main_info_table[category][i].value_string;
1989 for (i = 0 ; i < count_value ; i++) {
1990 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1991 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
1997 MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name);
2002 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2005 int count_value = 0;
2007 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2009 if (hcamcorder == NULL) {
2010 MMCAM_LOG_ERROR("handle is NULL");
2014 mmf_return_val_if_fail(name, FALSE);
2016 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2017 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
2021 if (type == CONFIGURE_TYPE_MAIN) {
2022 for (i = 0 ; i < count_value ; i++) {
2023 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2024 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2029 for (i = 0 ; i < count_value ; i++) {
2030 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2031 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2037 MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name);
2042 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2044 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2046 if (hcamcorder == NULL) {
2047 MMCAM_LOG_ERROR("handle is NULL");
2051 if (type == CONFIGURE_TYPE_MAIN) {
2052 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2053 *size = (int)hcamcorder->conf_main_category_size[category];
2055 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2056 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2062 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2064 int i, j, k, type, category_type;
2067 type_int_range *temp_int_range;
2068 type_int_array *temp_int_array;
2069 type_int_pair_array *temp_int_pair_array;
2070 type_string *temp_string;
2071 type_element *temp_element;
2073 g_print("[ConfigureInfoPrint] : Entered.\n");
2075 mmf_return_if_fail(*configure_info);
2077 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2078 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2080 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2082 for (i = 0 ; i < category_type ; i++) {
2084 if ((*configure_info)->info[i]) {
2085 g_print("[ConfigureInfo] : Category [%d]\n", i);
2087 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2089 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2091 case CONFIGURE_VALUE_INT:
2092 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2093 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2095 case CONFIGURE_VALUE_INT_RANGE:
2096 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2097 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2098 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2100 case CONFIGURE_VALUE_INT_ARRAY:
2101 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2102 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2103 temp_int_array->name, temp_int_array->default_value);
2105 for (k = 0 ; k < temp_int_array->count ; k++)
2106 g_print("[%d] ", temp_int_array->value[k]);
2110 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2111 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2112 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2113 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2115 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2116 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2120 case CONFIGURE_VALUE_STRING:
2121 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2122 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2124 case CONFIGURE_VALUE_ELEMENT:
2125 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2126 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2128 for (k = 0 ; k < temp_element->count_int ; k++)
2129 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2131 for (k = 0 ; k < temp_element->count_string ; k++)
2132 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2136 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);
2140 g_print("[ConfigureInfo] : Failed to get value type.");
2146 g_print("[ConfigureInfoPrint] : Done.\n");
2150 static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle)
2152 type_element *telement = NULL;
2153 const char *codec_type_str = NULL;
2154 int codec_type = MM_AUDIO_CODEC_INVALID;
2155 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2156 _MMCamcorderSubContext *sc = NULL;
2158 mmf_return_val_if_fail(hcamcorder, NULL);
2159 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2161 mmf_return_val_if_fail(sc, NULL);
2165 /* Check element availability */
2166 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2168 switch (codec_type) {
2169 case MM_AUDIO_CODEC_AMR:
2170 codec_type_str = "AMR";
2172 case MM_AUDIO_CODEC_G723_1:
2173 codec_type_str = "G723_1";
2175 case MM_AUDIO_CODEC_MP3:
2176 codec_type_str = "MP3";
2178 case MM_AUDIO_CODEC_AAC:
2179 codec_type_str = "AAC";
2181 case MM_AUDIO_CODEC_MMF:
2182 codec_type_str = "MMF";
2184 case MM_AUDIO_CODEC_ADPCM:
2185 codec_type_str = "ADPCM";
2187 case MM_AUDIO_CODEC_WAVE:
2188 codec_type_str = "WAVE";
2190 case MM_AUDIO_CODEC_MIDI:
2191 codec_type_str = "MIDI";
2193 case MM_AUDIO_CODEC_IMELODY:
2194 codec_type_str = "IMELODY";
2196 case MM_AUDIO_CODEC_VORBIS:
2197 codec_type_str = "VORBIS";
2200 MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type);
2204 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2205 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2213 static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle)
2215 type_element *telement = NULL;
2216 const char *codec_type_str = NULL;
2217 int codec_type = MM_VIDEO_CODEC_INVALID;
2218 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2219 _MMCamcorderSubContext *sc = NULL;
2221 mmf_return_val_if_fail(hcamcorder, NULL);
2222 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2224 mmf_return_val_if_fail(sc, NULL);
2226 /* Check element availability */
2227 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2229 switch (codec_type) {
2230 case MM_VIDEO_CODEC_H263:
2231 codec_type_str = "H263";
2233 case MM_VIDEO_CODEC_H264:
2234 codec_type_str = "H264";
2236 case MM_VIDEO_CODEC_H26L:
2237 codec_type_str = "H26L";
2239 case MM_VIDEO_CODEC_MPEG4:
2240 codec_type_str = "MPEG4";
2242 case MM_VIDEO_CODEC_MPEG1:
2243 codec_type_str = "MPEG1";
2245 case MM_VIDEO_CODEC_THEORA:
2246 codec_type_str = "THEORA";
2249 MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type);
2253 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2254 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2262 static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle)
2264 type_element *telement = NULL;
2265 const char *codec_type_str = NULL;
2266 int codec_type = MM_IMAGE_CODEC_INVALID;
2267 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2268 _MMCamcorderSubContext *sc = NULL;
2270 mmf_return_val_if_fail(hcamcorder, NULL);
2271 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2273 mmf_return_val_if_fail(sc, NULL);
2275 /* Check element availability */
2276 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2278 switch (codec_type) {
2279 case MM_IMAGE_CODEC_JPEG:
2280 codec_type_str = "JPEG";
2282 case MM_IMAGE_CODEC_SRW:
2283 codec_type_str = "SRW";
2285 case MM_IMAGE_CODEC_JPEG_SRW:
2286 codec_type_str = "JPEG_SRW";
2288 case MM_IMAGE_CODEC_PNG:
2289 codec_type_str = "PNG";
2291 case MM_IMAGE_CODEC_BMP:
2292 codec_type_str = "BMP";
2294 case MM_IMAGE_CODEC_WBMP:
2295 codec_type_str = "WBMP";
2297 case MM_IMAGE_CODEC_TIFF:
2298 codec_type_str = "TIFF";
2300 case MM_IMAGE_CODEC_PCX:
2301 codec_type_str = "PCX";
2303 case MM_IMAGE_CODEC_GIF:
2304 codec_type_str = "GIF";
2306 case MM_IMAGE_CODEC_ICO:
2307 codec_type_str = "ICO";
2309 case MM_IMAGE_CODEC_RAS:
2310 codec_type_str = "RAS";
2312 case MM_IMAGE_CODEC_TGA:
2313 codec_type_str = "TGA";
2315 case MM_IMAGE_CODEC_XBM:
2316 codec_type_str = "XBM";
2318 case MM_IMAGE_CODEC_XPM:
2319 codec_type_str = "XPM";
2322 MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type);
2326 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2327 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2335 static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle)
2337 type_element *telement = NULL;
2338 const char *mux_type_str = NULL;
2339 int file_type = MM_FILE_FORMAT_INVALID;
2340 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2341 _MMCamcorderSubContext *sc = NULL;
2343 mmf_return_val_if_fail(hcamcorder, NULL);
2344 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2346 mmf_return_val_if_fail(sc, NULL);
2348 /* Check element availability */
2349 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2351 switch (file_type) {
2352 case MM_FILE_FORMAT_3GP:
2353 mux_type_str = "3GP";
2355 case MM_FILE_FORMAT_AMR:
2356 mux_type_str = "AMR";
2358 case MM_FILE_FORMAT_MP4:
2359 mux_type_str = "MP4";
2361 case MM_FILE_FORMAT_AAC:
2362 mux_type_str = "AAC";
2364 case MM_FILE_FORMAT_MP3:
2365 mux_type_str = "MP3";
2367 case MM_FILE_FORMAT_OGG:
2368 mux_type_str = "OGG";
2370 case MM_FILE_FORMAT_WAV:
2371 mux_type_str = "WAV";
2373 case MM_FILE_FORMAT_AVI:
2374 mux_type_str = "AVI";
2376 case MM_FILE_FORMAT_WMA:
2377 mux_type_str = "WMA";
2379 case MM_FILE_FORMAT_WMV:
2380 mux_type_str = "WMV";
2382 case MM_FILE_FORMAT_MID:
2383 mux_type_str = "MID";
2385 case MM_FILE_FORMAT_MMF:
2386 mux_type_str = "MMF";
2388 case MM_FILE_FORMAT_MATROSKA:
2389 mux_type_str = "MATROSKA";
2391 case MM_FILE_FORMAT_M2TS:
2392 mux_type_str = "M2TS";
2395 MMCAM_LOG_ERROR("Not supported file format[%d]", file_type);
2399 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2400 CONFIGURE_CATEGORY_MAIN_MUX,
2408 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type)
2410 type_element *telement = NULL;
2413 case MM_CAM_AUDIO_ENCODER:
2414 telement = __mmcamcorder_get_audio_codec_element(handle);
2416 case MM_CAM_VIDEO_ENCODER:
2417 telement = __mmcamcorder_get_video_codec_element(handle);
2419 case MM_CAM_IMAGE_ENCODER:
2420 telement = __mmcamcorder_get_image_codec_element(handle);
2422 case MM_CAM_FILE_FORMAT:
2423 telement = __mmcamcorder_get_file_format_element(handle);
2426 MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type);
2433 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2435 int codec_index = MM_AUDIO_CODEC_INVALID;
2438 MMCAM_LOG_ERROR("name is NULL");
2439 return MM_AUDIO_CODEC_INVALID;
2442 if (!strcmp(name, "AMR"))
2443 codec_index = MM_AUDIO_CODEC_AMR;
2444 else if (!strcmp(name, "G723_1"))
2445 codec_index = MM_AUDIO_CODEC_G723_1;
2446 else if (!strcmp(name, "MP3"))
2447 codec_index = MM_AUDIO_CODEC_MP3;
2448 else if (!strcmp(name, "AAC"))
2449 codec_index = MM_AUDIO_CODEC_AAC;
2450 else if (!strcmp(name, "MMF"))
2451 codec_index = MM_AUDIO_CODEC_MMF;
2452 else if (!strcmp(name, "ADPCM"))
2453 codec_index = MM_AUDIO_CODEC_ADPCM;
2454 else if (!strcmp(name, "WAVE"))
2455 codec_index = MM_AUDIO_CODEC_WAVE;
2456 else if (!strcmp(name, "MIDI"))
2457 codec_index = MM_AUDIO_CODEC_MIDI;
2458 else if (!strcmp(name, "IMELODY"))
2459 codec_index = MM_AUDIO_CODEC_IMELODY;
2460 else if (!strcmp(name, "VORBIS"))
2461 codec_index = MM_AUDIO_CODEC_VORBIS;
2463 MMCAM_LOG_DEBUG("audio codec index %d", codec_index);
2470 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2472 int codec_index = MM_VIDEO_CODEC_INVALID;
2475 MMCAM_LOG_ERROR("name is NULL");
2476 return MM_VIDEO_CODEC_INVALID;
2479 if (!strcmp(name, "H263"))
2480 codec_index = MM_VIDEO_CODEC_H263;
2481 else if (!strcmp(name, "H264"))
2482 codec_index = MM_VIDEO_CODEC_H264;
2483 else if (!strcmp(name, "H26L"))
2484 codec_index = MM_VIDEO_CODEC_H26L;
2485 else if (!strcmp(name, "MPEG4"))
2486 codec_index = MM_VIDEO_CODEC_MPEG4;
2487 else if (!strcmp(name, "MPEG1"))
2488 codec_index = MM_VIDEO_CODEC_MPEG1;
2489 else if (!strcmp(name, "THEORA"))
2490 codec_index = MM_VIDEO_CODEC_THEORA;
2492 MMCAM_LOG_DEBUG("video codec index %d", codec_index);
2499 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2501 int codec_index = MM_IMAGE_CODEC_INVALID;
2504 MMCAM_LOG_ERROR("name is NULL");
2505 return MM_IMAGE_CODEC_INVALID;
2508 if (!strcmp(name, "JPEG"))
2509 codec_index = MM_IMAGE_CODEC_JPEG;
2510 else if (!strcmp(name, "PNG"))
2511 codec_index = MM_IMAGE_CODEC_PNG;
2512 else if (!strcmp(name, "BMP"))
2513 codec_index = MM_IMAGE_CODEC_BMP;
2514 else if (!strcmp(name, "WBMP"))
2515 codec_index = MM_IMAGE_CODEC_WBMP;
2516 else if (!strcmp(name, "TIFF"))
2517 codec_index = MM_IMAGE_CODEC_TIFF;
2518 else if (!strcmp(name, "PCX"))
2519 codec_index = MM_IMAGE_CODEC_PCX;
2520 else if (!strcmp(name, "GIF"))
2521 codec_index = MM_IMAGE_CODEC_GIF;
2522 else if (!strcmp(name, "ICO"))
2523 codec_index = MM_IMAGE_CODEC_ICO;
2524 else if (!strcmp(name, "RAS"))
2525 codec_index = MM_IMAGE_CODEC_RAS;
2526 else if (!strcmp(name, "TGA"))
2527 codec_index = MM_IMAGE_CODEC_TGA;
2528 else if (!strcmp(name, "XBM"))
2529 codec_index = MM_IMAGE_CODEC_XBM;
2530 else if (!strcmp(name, "XPM"))
2531 codec_index = MM_IMAGE_CODEC_XPM;
2533 MMCAM_LOG_DEBUG("image codec index %d", codec_index);
2539 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2541 int mux_index = MM_FILE_FORMAT_INVALID;
2544 MMCAM_LOG_ERROR("name is NULL");
2545 return MM_FILE_FORMAT_INVALID;
2548 if (!strcmp(name, "3GP"))
2549 mux_index = MM_FILE_FORMAT_3GP;
2550 else if (!strcmp(name, "AMR"))
2551 mux_index = MM_FILE_FORMAT_AMR;
2552 else if (!strcmp(name, "MP4"))
2553 mux_index = MM_FILE_FORMAT_MP4;
2554 else if (!strcmp(name, "AAC"))
2555 mux_index = MM_FILE_FORMAT_AAC;
2556 else if (!strcmp(name, "MP3"))
2557 mux_index = MM_FILE_FORMAT_MP3;
2558 else if (!strcmp(name, "OGG"))
2559 mux_index = MM_FILE_FORMAT_OGG;
2560 else if (!strcmp(name, "WAV"))
2561 mux_index = MM_FILE_FORMAT_WAV;
2562 else if (!strcmp(name, "AVI"))
2563 mux_index = MM_FILE_FORMAT_AVI;
2564 else if (!strcmp(name, "WMA"))
2565 mux_index = MM_FILE_FORMAT_WMA;
2566 else if (!strcmp(name, "WMV"))
2567 mux_index = MM_FILE_FORMAT_WMV;
2568 else if (!strcmp(name, "MID"))
2569 mux_index = MM_FILE_FORMAT_MID;
2570 else if (!strcmp(name, "MMF"))
2571 mux_index = MM_FILE_FORMAT_MMF;
2572 else if (!strcmp(name, "MATROSKA"))
2573 mux_index = MM_FILE_FORMAT_MATROSKA;
2574 else if (!strcmp(name, "M2TS"))
2575 mux_index = MM_FILE_FORMAT_M2TS;
2577 MMCAM_LOG_DEBUG("mux index %d", mux_index);
2583 int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2587 mmf_return_val_if_fail(name, -1);
2589 switch (conf_category) {
2590 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2591 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2593 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2594 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2596 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2597 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2599 case CONFIGURE_CATEGORY_MAIN_MUX:
2600 fmt = _mmcamcorder_get_mux_format(handle, name);
2603 MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category);
2609 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format)
2611 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2612 camera_conf* configure_info = NULL;
2614 int total_count = 0;
2616 mmf_return_val_if_fail(hcamcorder, 0);
2618 configure_info = hcamcorder->conf_main;
2620 if (configure_info->info[conf_category]) {
2623 const char *name = NULL;
2624 int count = configure_info->info[conf_category]->count;
2625 conf_detail *info = configure_info->info[conf_category];
2627 MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]",
2628 conf_category, count, info);
2630 if (count <= 0 || !info)
2633 arr = (int*)g_malloc0(count * sizeof(int));
2635 for (i = 0 ; i < count ; i++) {
2636 if (info->detail_info[i] == NULL)
2639 name = ((type_element*)(info->detail_info[i]))->name;
2640 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2642 arr[total_count++] = fmt;
2644 MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt);