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 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
829 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
831 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
832 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
833 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
834 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
835 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
836 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
837 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
838 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
839 { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
840 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
841 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
842 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
843 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
846 /* [Capture] matching table */
847 static conf_info_table conf_ctrl_capture_table[] = {
848 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
849 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
850 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
851 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
852 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
853 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
854 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
857 /* [Detect] matching table */
858 static conf_info_table conf_ctrl_detect_table[] = {
859 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
860 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
861 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
862 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
865 MMCAM_LOG_INFO("Entered...");
867 if (type == CONFIGURE_TYPE_MAIN) {
868 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
869 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
870 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
871 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
872 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
873 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
874 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
875 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
876 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
877 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
879 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
880 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
881 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
882 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
883 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
884 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
885 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
886 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
887 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
888 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
890 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
892 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
893 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
894 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
895 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
896 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
897 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
899 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
900 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
901 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
902 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
903 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
904 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
906 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
909 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
911 MMCAM_LOG_INFO("Done.");
913 return MM_ERROR_NONE;
917 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
919 int ret = MM_ERROR_NONE;
921 char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
923 MMCAM_LOG_INFO("Opening...[%s]", ConfFile);
925 mmf_return_val_if_fail(ConfFile, FALSE);
927 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
928 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
930 fp = fopen(conf_path, "r");
932 MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path);
934 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
935 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
936 fp = fopen(conf_path, "r");
938 MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno);
939 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
944 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
948 MMCAM_LOG_INFO("Leave [0x%x]", ret);
954 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
956 const unsigned int BUFFER_NUM_DETAILS = 256;
957 const unsigned int BUFFER_NUM_TOKEN = 20;
958 size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
959 const char* delimiters = " |=,\t\n";
962 int ret = MM_ERROR_NONE;
964 int count_main_category = 0;
965 int count_details = 0;
970 char *buffer_string = NULL;
971 char *buffer_details[BUFFER_NUM_DETAILS];
972 char *buffer_token[BUFFER_NUM_TOKEN];
974 char *category_name = NULL;
975 char *detail_string = NULL;
976 char *user_ptr = NULL;
978 camera_conf *new_conf = NULL;
982 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
984 *configure_info = NULL;
986 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
987 buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size);
989 new_conf->type = type;
991 ret = _mmcamcorder_conf_init(handle, type, new_conf);
992 if (ret != MM_ERROR_NONE) {
993 MMCAM_LOG_ERROR("conf init failed 0x%x", ret);
995 g_free(buffer_string);
999 *configure_info = new_conf;
1002 count_main_category = 0;
1005 if (read_main == 0) {
1006 buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
1007 length_read = getline(&buffer_string, &buffer_line_size, fp);
1008 if (length_read < 1) {
1009 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1013 buffer_string[--length_read] = '\0'; /* remove new line character */
1015 MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string);
1018 token = strtok_r(buffer_string, delimiters, &user_ptr);
1020 if ((token) && (token[0] == ';') && (length_read > -1)) {
1021 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1026 MMCAM_LOG_VERBOSE("token : \"%s\"", token);
1027 buffer_token[count_token] = token;
1029 token = strtok_r(NULL, delimiters, &user_ptr);
1032 if (count_token == 0)
1038 if (*buffer_token[0] == ';') {
1040 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1041 } else if (*buffer_token[0] == '[') {
1043 category_name = get_new_string(buffer_token[0]);
1044 if (category_name == NULL) {
1045 MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]);
1049 count_main_category++;
1053 length_read = getline(&buffer_string, &buffer_line_size, fp);
1054 if (length_read < 1) {
1055 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1059 buffer_string[--length_read] = '\0'; /* remove new line character */
1061 MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read);
1063 detail_string = get_new_string(buffer_string);
1065 token = strtok_r(buffer_string, delimiters, &user_ptr);
1067 if (token && token[0] != ';' && length_read > -1) {
1068 MMCAM_LOG_VERBOSE("token : [%s]", token);
1069 if (token[0] == '[') {
1071 buffer_token[0] = token;
1072 SAFE_G_FREE(detail_string);
1076 buffer_details[count_details++] = detail_string;
1078 SAFE_G_FREE(detail_string);
1082 MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);
1084 if (count_details == 0) {
1085 MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name);
1086 SAFE_G_FREE(category_name);
1093 if (type == CONFIGURE_TYPE_MAIN) {
1094 if (!strcmp("[General]", category_name))
1095 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1096 else if (!strcmp("[VideoInput]", category_name))
1097 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1098 else if (!strcmp("[AudioInput]", category_name))
1099 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1100 else if (!strcmp("[VideoOutput]", category_name))
1101 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1102 else if (!strcmp("[Capture]", category_name))
1103 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1104 else if (!strcmp("[Record]", category_name))
1105 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1106 else if (!strcmp("[VideoEncoder]", category_name))
1107 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1108 else if (!strcmp("[AudioEncoder]", category_name))
1109 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1110 else if (!strcmp("[ImageEncoder]", category_name))
1111 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1112 else if (!strcmp("[Mux]", category_name))
1113 category = CONFIGURE_CATEGORY_MAIN_MUX;
1115 if (!strcmp("[Camera]", category_name))
1116 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1117 else if (!strcmp("[Strobe]", category_name))
1118 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1119 else if (!strcmp("[Effect]", category_name))
1120 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1121 else if (!strcmp("[Photograph]", category_name))
1122 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1123 else if (!strcmp("[Capture]", category_name))
1124 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1125 else if (!strcmp("[Detect]", category_name))
1126 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1129 if (category != -1) {
1130 _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
1131 buffer_details, category, count_details);
1133 MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type);
1137 for (i = 0 ; i < count_details ; i++)
1138 SAFE_G_FREE(buffer_details[i]);
1141 SAFE_G_FREE(category_name);
1144 /* (*configure_info) = new_conf; */
1146 SAFE_G_FREE(buffer_string);
1148 /*MMCAM_LOG_INFO("Done.");*/
1150 return MM_ERROR_NONE;
1154 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1159 int type = CONFIGURE_VALUE_INT;
1161 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1162 camera_conf *temp_conf = (*configure_info);
1164 type_int2 *temp_int = NULL;
1165 type_int_range *temp_int_range = NULL;
1166 type_int_array *temp_int_array = NULL;
1167 type_int_pair_array *temp_int_pair_array = NULL;
1168 type_string2 *temp_string = NULL;
1169 type_string_array *temp_string_array = NULL;
1170 type_element2 *temp_element = NULL;
1172 MMCAM_LOG_INFO("Entered...");
1174 mmf_return_if_fail(temp_conf);
1176 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1177 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1179 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1181 for (i = 0 ; i < category_num ; i++) {
1182 if (temp_conf->info[i]) {
1183 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1184 if (temp_conf->info[i]->detail_info[j] == NULL)
1187 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1189 case CONFIGURE_VALUE_INT:
1190 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1191 SAFE_G_FREE(temp_int->name);
1193 case CONFIGURE_VALUE_INT_RANGE:
1194 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1195 SAFE_G_FREE(temp_int_range->name);
1197 case CONFIGURE_VALUE_INT_ARRAY:
1198 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1199 SAFE_G_FREE(temp_int_array->name);
1200 SAFE_G_FREE(temp_int_array->value);
1202 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1203 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1204 SAFE_G_FREE(temp_int_pair_array->name);
1205 SAFE_G_FREE(temp_int_pair_array->value[0]);
1206 SAFE_G_FREE(temp_int_pair_array->value[1]);
1208 case CONFIGURE_VALUE_STRING:
1209 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1210 SAFE_G_FREE(temp_string->name);
1211 SAFE_G_FREE(temp_string->value);
1213 case CONFIGURE_VALUE_STRING_ARRAY:
1214 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1215 SAFE_G_FREE(temp_string_array->name);
1216 if (temp_string_array->value) {
1217 count = temp_string_array->count;
1219 for (k = 0 ; k < count ; k++)
1220 SAFE_G_FREE(temp_string_array->value[k]);
1222 SAFE_G_FREE(temp_string_array->value);
1224 SAFE_G_FREE(temp_string_array->default_value);
1226 case CONFIGURE_VALUE_ELEMENT:
1227 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1228 SAFE_G_FREE(temp_element->name);
1229 SAFE_G_FREE(temp_element->element_name);
1231 if (temp_element->value_int) {
1232 count = temp_element->count_int;
1233 for (k = 0 ; k < count ; k++) {
1234 SAFE_G_FREE(temp_element->value_int[k]->name);
1235 SAFE_G_FREE(temp_element->value_int[k]);
1237 SAFE_G_FREE(temp_element->value_int);
1240 if (temp_element->value_string) {
1241 count = temp_element->count_string;
1242 for (k = 0 ; k < count ; k++) {
1243 SAFE_G_FREE(temp_element->value_string[k]->name);
1244 SAFE_G_FREE(temp_element->value_string[k]->value);
1245 SAFE_G_FREE(temp_element->value_string[k]);
1247 SAFE_G_FREE(temp_element->value_string);
1251 MMCAM_LOG_WARNING("unknown type %d", type);
1256 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1259 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1261 SAFE_G_FREE(temp_conf->info[i]);
1262 temp_conf->info[i] = NULL;
1266 SAFE_G_FREE((*configure_info)->info);
1267 SAFE_G_FREE((*configure_info));
1269 MMCAM_LOG_INFO("Done.");
1272 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1275 int count_value = 0;
1277 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1279 if (hcamcorder == NULL) {
1280 MMCAM_LOG_ERROR("handle is NULL");
1284 /*MMCAM_LOG_INFO("Entered...");*/
1286 mmf_return_val_if_fail(name, FALSE);
1288 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1289 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1293 /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/
1295 if (type == CONFIGURE_TYPE_MAIN) {
1296 for (i = 0 ; i < count_value ; i++) {
1297 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1298 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1299 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1304 for (i = 0 ; i < count_value ; i++) {
1305 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1306 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1307 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1317 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1319 const int BUFFER_NUM_TOKEN = 256;
1326 char *buffer_token[BUFFER_NUM_TOKEN];
1327 char *user_ptr = NULL;
1329 const char *delimiters = " |=,\t\n";
1330 const char *delimiters_sub = " |\t\n";
1331 const char *delimiters_3rd = "|\n";
1333 mmf_return_val_if_fail(info && buffer_details, FALSE);
1335 (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail));
1336 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1337 (*info)->count = count_details;
1339 for (i = 0 ; i < count_details ; i++) {
1340 MMCAM_LOG_VERBOSE("Read line\"%s\"", buffer_details[i]);
1342 token = strtok_r(buffer_details[i], delimiters, &user_ptr);
1345 buffer_token[count_token] = token;
1348 (*info)->detail_info[i] = NULL;
1349 MMCAM_LOG_WARNING("No token... check it.[%s]", buffer_details[i]);
1353 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1354 (*info)->detail_info[i] = NULL;
1355 MMCAM_LOG_WARNING("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
1359 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1360 token = strtok_r(NULL, delimiters, &user_ptr);
1362 buffer_token[count_token] = token;
1363 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1365 token = strtok_r(NULL, delimiters, &user_ptr);
1368 if (count_token < 2) {
1369 (*info)->detail_info[i] = NULL;
1370 MMCAM_LOG_WARNING("Number of token is too small... check it.[%s]", buffer_details[i]);
1373 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1375 strtok_r(NULL, delimiters_sub, &user_ptr);
1377 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1378 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1380 buffer_token[count_token] = token;
1381 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1383 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1385 } else { /* CONFIGURE_VALUE_STRING */
1386 token = strtok_r(NULL, delimiters_3rd, &user_ptr);
1389 buffer_token[count_token] = token;
1390 MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1395 if (count_token < 2) {
1396 (*info)->detail_info[i] = NULL;
1397 MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]);
1402 switch (value_type) {
1403 case CONFIGURE_VALUE_INT:
1407 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1408 new_int->name = get_new_string(buffer_token[0]);
1409 new_int->value = atoi(buffer_token[1]);
1410 (*info)->detail_info[i] = (void*)new_int;
1411 MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value);
1414 case CONFIGURE_VALUE_INT_RANGE:
1416 type_int_range* new_int_range;
1418 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1419 new_int_range->name = get_new_string(buffer_token[0]);
1420 new_int_range->min = atoi(buffer_token[1]);
1421 new_int_range->max = atoi(buffer_token[2]);
1422 new_int_range->default_value = atoi(buffer_token[3]);
1423 (*info)->detail_info[i] = (void*)new_int_range;
1425 MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1426 new_int_range->name,
1429 new_int_range->default_value);
1432 case CONFIGURE_VALUE_INT_ARRAY:
1434 int count_value = count_token - 2;
1435 type_int_array* new_int_array;
1437 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1438 new_int_array->name = get_new_string(buffer_token[0]);
1439 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1440 new_int_array->count = count_value;
1442 MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name);
1443 for (j = 0 ; j < count_value ; j++) {
1444 new_int_array->value[j] = atoi(buffer_token[j+1]);
1445 MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]);
1448 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1449 MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value);
1451 (*info)->detail_info[i] = (void*)new_int_array;
1454 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1456 int count_value = (count_token - 3) >> 1;
1457 type_int_pair_array* new_int_pair_array;
1459 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1460 new_int_pair_array->name = get_new_string(buffer_token[0]);
1461 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1462 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1463 new_int_pair_array->count = count_value;
1465 MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);
1466 for (j = 0 ; j < count_value ; j++) {
1467 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1468 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1470 MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j,
1471 new_int_pair_array->value[0][j],
1472 new_int_pair_array->value[1][j]);
1475 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1476 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1478 MMCAM_LOG_VERBOSE(" default value[%d,%d]",
1479 new_int_pair_array->default_value[0],
1480 new_int_pair_array->default_value[1]);
1482 (*info)->detail_info[i] = (void*)new_int_pair_array;
1485 case CONFIGURE_VALUE_STRING:
1487 type_string2* new_string;
1489 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1490 new_string->name = get_new_string(buffer_token[0]);
1491 new_string->value = get_new_string(buffer_token[1]);
1492 (*info)->detail_info[i] = (void*)new_string;
1494 MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value);
1497 case CONFIGURE_VALUE_STRING_ARRAY:
1499 int count_value = count_token - 2;
1500 type_string_array* new_string_array;
1502 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1503 new_string_array->name = get_new_string(buffer_token[0]);
1504 new_string_array->count = count_value;
1505 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1507 MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name);
1509 for (j = 0 ; j < count_value ; j++) {
1510 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1511 MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]);
1514 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1516 MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value);
1518 (*info)->detail_info[i] = (void*)new_string_array;
1521 case CONFIGURE_VALUE_ELEMENT:
1523 type_element2* new_element;
1525 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1526 new_element->name = get_new_string(buffer_token[0]);
1527 new_element->element_name = get_new_string(buffer_token[1]);
1528 new_element->count_int = atoi(buffer_token[2]);
1529 new_element->value_int = NULL;
1530 new_element->count_string = atoi(buffer_token[3]);
1531 new_element->value_string = NULL;
1533 MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1534 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1536 /* add int values */
1537 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1538 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1539 for (j = 0 ; j < new_element->count_int ; j++) {
1540 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1541 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1542 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1544 MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]",
1545 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1549 /* add string values */
1550 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1551 new_element->count_int >= 0 && new_element->count_int <= 30) {
1552 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1553 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1554 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1555 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1556 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1558 MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]",
1559 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);
1563 (*info)->detail_info[i] = (void*)new_element;
1575 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1580 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1582 mmf_return_val_if_fail(configure_info, FALSE);
1583 mmf_return_val_if_fail(name, FALSE);
1585 if (configure_info->info[category]) {
1586 count = configure_info->info[category]->count;
1587 info = configure_info->info[category];
1589 for (i = 0 ; i < count ; i++) {
1590 if (info->detail_info[i] == NULL)
1593 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1594 *value = ((type_int*)(info->detail_info[i]))->value;
1595 MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value);
1601 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1602 MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value);
1606 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1612 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1617 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1619 mmf_return_val_if_fail(configure_info, FALSE);
1620 mmf_return_val_if_fail(name, FALSE);
1622 if (configure_info->info[category]) {
1623 count = configure_info->info[category]->count;
1624 info = configure_info->info[category];
1626 for (i = 0 ; i < count ; i++) {
1627 if (info->detail_info[i] == NULL)
1630 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1631 *value = (type_int_range*)(info->detail_info[i]);
1632 MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]",
1633 name, (*value)->min, (*value)->max, (*value)->default_value);
1641 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1646 int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1651 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1653 mmf_return_val_if_fail(configure_info, FALSE);
1654 mmf_return_val_if_fail(name, FALSE);
1656 if (configure_info->info[category]) {
1657 count = configure_info->info[category]->count;
1658 info = configure_info->info[category];
1660 for (i = 0 ; i < count ; i++) {
1661 if (info->detail_info[i] == NULL)
1664 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1665 *value = (type_int_array*)(info->detail_info[i]);
1666 MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]",
1667 name, (*value)->value, (*value)->count, (*value)->default_value);
1675 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1681 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1686 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1688 mmf_return_val_if_fail(configure_info, FALSE);
1689 mmf_return_val_if_fail(name, FALSE);
1691 if (configure_info->info[category]) {
1692 count = configure_info->info[category]->count;
1693 info = configure_info->info[category];
1695 for (i = 0 ; i < count ; i++) {
1696 if (info->detail_info[i] == NULL)
1699 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1700 *value = (type_int_pair_array*)(info->detail_info[i]);
1701 MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]",
1702 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1703 (*value)->default_value[0], (*value)->default_value[1]);
1711 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1716 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1721 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1723 mmf_return_val_if_fail(configure_info, FALSE);
1724 mmf_return_val_if_fail(name, FALSE);
1726 if (configure_info->info[category]) {
1727 count = configure_info->info[category]->count;
1728 info = configure_info->info[category];
1730 for (i = 0 ; i < count ; i++) {
1731 if (info->detail_info[i] == NULL)
1734 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1735 *value = ((type_string*)(info->detail_info[i]))->value;
1736 MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL");
1742 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1743 MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL");
1747 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1752 int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1757 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1759 mmf_return_val_if_fail(configure_info, FALSE);
1760 mmf_return_val_if_fail(name, FALSE);
1762 if (configure_info->info[category]) {
1763 count = configure_info->info[category]->count;
1764 info = configure_info->info[category];
1766 for (i = 0 ; i < count ; i++) {
1767 if (info->detail_info[i] == NULL)
1770 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1771 *value = (type_string_array*)(info->detail_info[i]);
1772 MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]",
1773 name, (*value)->value, (*value)->count, (*value)->default_value);
1781 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1786 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1791 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1793 mmf_return_val_if_fail(configure_info, FALSE);
1794 mmf_return_val_if_fail(name, FALSE);
1796 if (configure_info->info[category]) {
1797 count = configure_info->info[category]->count;
1798 info = configure_info->info[category];
1800 for (i = 0 ; i < count ; i++) {
1801 if (info->detail_info[i] == NULL)
1804 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1805 *element = (type_element*)(info->detail_info[i]);
1806 MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element);
1812 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1813 MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element);
1817 MMCAM_LOG_ERROR("Failed to get [%s]", name);
1822 int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1824 mmf_return_val_if_fail(element, FALSE);
1826 *value = element->element_name;
1828 MMCAM_LOG_DEBUG("Get element name : [%s]", *value);
1833 int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1837 mmf_return_val_if_fail(element, FALSE);
1838 mmf_return_val_if_fail(name, FALSE);
1840 for (i = 0 ; i < element->count_int ; i++) {
1841 if (!strcmp(element->value_int[i]->name, name)) {
1842 *value = element->value_int[i]->value;
1843 MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value);
1848 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1849 element->name, name, element->count_int);
1854 int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1858 mmf_return_val_if_fail(element, FALSE);
1859 mmf_return_val_if_fail(name, FALSE);
1861 for (i = 0 ; i < element->count_string ; i++) {
1862 if (!strcmp(element->value_string[i]->name, name)) {
1863 *value = element->value_string[i]->value;
1864 MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value);
1869 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1870 element->name, name, element->count_string);
1875 int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1879 mmf_return_val_if_fail(gst, FALSE);
1880 mmf_return_val_if_fail(element, FALSE);
1882 if (element->count_int == 0) {
1883 MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name );
1885 if (element->value_int == NULL) {
1886 MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1890 for (i = 0 ; i < element->count_int ; i++) {
1891 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1893 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [i:%d]",
1894 element->element_name,
1895 element->value_int[i]->name,
1896 element->value_int[i]->value);
1900 if (element->count_string == 0) {
1901 MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name);
1903 if (element->value_string == NULL) {
1904 MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
1908 for (i = 0 ; i < element->count_string ; i++) {
1909 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
1911 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [s:%s]",
1912 element->element_name,
1913 element->value_string[i]->name,
1914 element->value_string[i]->value);
1921 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
1924 int count_value = 0;
1926 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1928 if (hcamcorder == NULL) {
1929 MMCAM_LOG_ERROR("handle is NULL");
1933 mmf_return_val_if_fail(name, FALSE);
1935 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1936 MMCAM_LOG_WARNING("No matched category. categoty[%d]", category);
1940 if (type == CONFIGURE_TYPE_MAIN) {
1941 for (i = 0 ; i < count_value ; i++) {
1942 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1943 *value = hcamcorder->conf_main_info_table[category][i].value_int;
1948 for (i = 0 ; i < count_value ; i++) {
1949 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1950 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
1956 MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name);
1961 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
1964 int count_value = 0;
1966 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1968 if (hcamcorder == NULL) {
1969 MMCAM_LOG_ERROR("handle is NULL");
1973 mmf_return_val_if_fail(name, FALSE);
1975 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1976 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1980 if (type == CONFIGURE_TYPE_MAIN) {
1981 for (i = 0 ; i < count_value ; i++) {
1982 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1983 *value = hcamcorder->conf_main_info_table[category][i].value_string;
1988 for (i = 0 ; i < count_value ; i++) {
1989 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1990 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
1996 MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name);
2001 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2004 int count_value = 0;
2006 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2008 if (hcamcorder == NULL) {
2009 MMCAM_LOG_ERROR("handle is NULL");
2013 mmf_return_val_if_fail(name, FALSE);
2015 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2016 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
2020 if (type == CONFIGURE_TYPE_MAIN) {
2021 for (i = 0 ; i < count_value ; i++) {
2022 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2023 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2028 for (i = 0 ; i < count_value ; i++) {
2029 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2030 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2036 MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name);
2041 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2043 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2045 if (hcamcorder == NULL) {
2046 MMCAM_LOG_ERROR("handle is NULL");
2050 if (type == CONFIGURE_TYPE_MAIN) {
2051 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2052 *size = (int)hcamcorder->conf_main_category_size[category];
2054 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2055 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2061 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2063 int i, j, k, type, category_type;
2066 type_int_range *temp_int_range;
2067 type_int_array *temp_int_array;
2068 type_int_pair_array *temp_int_pair_array;
2069 type_string *temp_string;
2070 type_element *temp_element;
2072 g_print("[ConfigureInfoPrint] : Entered.\n");
2074 mmf_return_if_fail(*configure_info);
2076 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2077 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2079 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2081 for (i = 0 ; i < category_type ; i++) {
2083 if ((*configure_info)->info[i]) {
2084 g_print("[ConfigureInfo] : Category [%d]\n", i);
2086 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2088 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2090 case CONFIGURE_VALUE_INT:
2091 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2092 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2094 case CONFIGURE_VALUE_INT_RANGE:
2095 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2096 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2097 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2099 case CONFIGURE_VALUE_INT_ARRAY:
2100 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2101 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2102 temp_int_array->name, temp_int_array->default_value);
2104 for (k = 0 ; k < temp_int_array->count ; k++)
2105 g_print("[%d] ", temp_int_array->value[k]);
2109 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2110 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2111 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2112 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2114 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2115 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2119 case CONFIGURE_VALUE_STRING:
2120 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2121 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2123 case CONFIGURE_VALUE_ELEMENT:
2124 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2125 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2127 for (k = 0 ; k < temp_element->count_int ; k++)
2128 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2130 for (k = 0 ; k < temp_element->count_string ; k++)
2131 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2135 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);
2139 g_print("[ConfigureInfo] : Failed to get value type.");
2145 g_print("[ConfigureInfoPrint] : Done.\n");
2149 static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle)
2151 type_element *telement = NULL;
2152 const char *codec_type_str = NULL;
2153 int codec_type = MM_AUDIO_CODEC_INVALID;
2154 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2155 _MMCamcorderSubContext *sc = NULL;
2157 mmf_return_val_if_fail(hcamcorder, NULL);
2158 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2160 mmf_return_val_if_fail(sc, NULL);
2164 /* Check element availability */
2165 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2167 switch (codec_type) {
2168 case MM_AUDIO_CODEC_AMR:
2169 codec_type_str = "AMR";
2171 case MM_AUDIO_CODEC_G723_1:
2172 codec_type_str = "G723_1";
2174 case MM_AUDIO_CODEC_MP3:
2175 codec_type_str = "MP3";
2177 case MM_AUDIO_CODEC_AAC:
2178 codec_type_str = "AAC";
2180 case MM_AUDIO_CODEC_MMF:
2181 codec_type_str = "MMF";
2183 case MM_AUDIO_CODEC_ADPCM:
2184 codec_type_str = "ADPCM";
2186 case MM_AUDIO_CODEC_WAVE:
2187 codec_type_str = "WAVE";
2189 case MM_AUDIO_CODEC_MIDI:
2190 codec_type_str = "MIDI";
2192 case MM_AUDIO_CODEC_IMELODY:
2193 codec_type_str = "IMELODY";
2195 case MM_AUDIO_CODEC_VORBIS:
2196 codec_type_str = "VORBIS";
2199 MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type);
2203 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2204 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2212 static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle)
2214 type_element *telement = NULL;
2215 const char *codec_type_str = NULL;
2216 int codec_type = MM_VIDEO_CODEC_INVALID;
2217 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2218 _MMCamcorderSubContext *sc = NULL;
2220 mmf_return_val_if_fail(hcamcorder, NULL);
2221 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2223 mmf_return_val_if_fail(sc, NULL);
2225 /* Check element availability */
2226 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2228 switch (codec_type) {
2229 case MM_VIDEO_CODEC_H263:
2230 codec_type_str = "H263";
2232 case MM_VIDEO_CODEC_H264:
2233 codec_type_str = "H264";
2235 case MM_VIDEO_CODEC_H26L:
2236 codec_type_str = "H26L";
2238 case MM_VIDEO_CODEC_MPEG4:
2239 codec_type_str = "MPEG4";
2241 case MM_VIDEO_CODEC_MPEG1:
2242 codec_type_str = "MPEG1";
2244 case MM_VIDEO_CODEC_THEORA:
2245 codec_type_str = "THEORA";
2248 MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type);
2252 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2253 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2261 static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle)
2263 type_element *telement = NULL;
2264 const char *codec_type_str = NULL;
2265 int codec_type = MM_IMAGE_CODEC_INVALID;
2266 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2267 _MMCamcorderSubContext *sc = NULL;
2269 mmf_return_val_if_fail(hcamcorder, NULL);
2270 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2272 mmf_return_val_if_fail(sc, NULL);
2274 /* Check element availability */
2275 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2277 switch (codec_type) {
2278 case MM_IMAGE_CODEC_JPEG:
2279 codec_type_str = "JPEG";
2281 case MM_IMAGE_CODEC_SRW:
2282 codec_type_str = "SRW";
2284 case MM_IMAGE_CODEC_JPEG_SRW:
2285 codec_type_str = "JPEG_SRW";
2287 case MM_IMAGE_CODEC_PNG:
2288 codec_type_str = "PNG";
2290 case MM_IMAGE_CODEC_BMP:
2291 codec_type_str = "BMP";
2293 case MM_IMAGE_CODEC_WBMP:
2294 codec_type_str = "WBMP";
2296 case MM_IMAGE_CODEC_TIFF:
2297 codec_type_str = "TIFF";
2299 case MM_IMAGE_CODEC_PCX:
2300 codec_type_str = "PCX";
2302 case MM_IMAGE_CODEC_GIF:
2303 codec_type_str = "GIF";
2305 case MM_IMAGE_CODEC_ICO:
2306 codec_type_str = "ICO";
2308 case MM_IMAGE_CODEC_RAS:
2309 codec_type_str = "RAS";
2311 case MM_IMAGE_CODEC_TGA:
2312 codec_type_str = "TGA";
2314 case MM_IMAGE_CODEC_XBM:
2315 codec_type_str = "XBM";
2317 case MM_IMAGE_CODEC_XPM:
2318 codec_type_str = "XPM";
2321 MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type);
2325 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2326 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2334 static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle)
2336 type_element *telement = NULL;
2337 const char *mux_type_str = NULL;
2338 int file_type = MM_FILE_FORMAT_INVALID;
2339 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2340 _MMCamcorderSubContext *sc = NULL;
2342 mmf_return_val_if_fail(hcamcorder, NULL);
2343 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2345 mmf_return_val_if_fail(sc, NULL);
2347 /* Check element availability */
2348 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2350 switch (file_type) {
2351 case MM_FILE_FORMAT_3GP:
2352 mux_type_str = "3GP";
2354 case MM_FILE_FORMAT_AMR:
2355 mux_type_str = "AMR";
2357 case MM_FILE_FORMAT_MP4:
2358 mux_type_str = "MP4";
2360 case MM_FILE_FORMAT_AAC:
2361 mux_type_str = "AAC";
2363 case MM_FILE_FORMAT_MP3:
2364 mux_type_str = "MP3";
2366 case MM_FILE_FORMAT_OGG:
2367 mux_type_str = "OGG";
2369 case MM_FILE_FORMAT_WAV:
2370 mux_type_str = "WAV";
2372 case MM_FILE_FORMAT_AVI:
2373 mux_type_str = "AVI";
2375 case MM_FILE_FORMAT_WMA:
2376 mux_type_str = "WMA";
2378 case MM_FILE_FORMAT_WMV:
2379 mux_type_str = "WMV";
2381 case MM_FILE_FORMAT_MID:
2382 mux_type_str = "MID";
2384 case MM_FILE_FORMAT_MMF:
2385 mux_type_str = "MMF";
2387 case MM_FILE_FORMAT_MATROSKA:
2388 mux_type_str = "MATROSKA";
2390 case MM_FILE_FORMAT_M2TS:
2391 mux_type_str = "M2TS";
2394 MMCAM_LOG_ERROR("Not supported file format[%d]", file_type);
2398 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2399 CONFIGURE_CATEGORY_MAIN_MUX,
2407 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type)
2409 type_element *telement = NULL;
2412 case MM_CAM_AUDIO_ENCODER:
2413 telement = __mmcamcorder_get_audio_codec_element(handle);
2415 case MM_CAM_VIDEO_ENCODER:
2416 telement = __mmcamcorder_get_video_codec_element(handle);
2418 case MM_CAM_IMAGE_ENCODER:
2419 telement = __mmcamcorder_get_image_codec_element(handle);
2421 case MM_CAM_FILE_FORMAT:
2422 telement = __mmcamcorder_get_file_format_element(handle);
2425 MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type);
2432 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2434 int codec_index = MM_AUDIO_CODEC_INVALID;
2437 MMCAM_LOG_ERROR("name is NULL");
2438 return MM_AUDIO_CODEC_INVALID;
2441 if (!strcmp(name, "AMR"))
2442 codec_index = MM_AUDIO_CODEC_AMR;
2443 else if (!strcmp(name, "G723_1"))
2444 codec_index = MM_AUDIO_CODEC_G723_1;
2445 else if (!strcmp(name, "MP3"))
2446 codec_index = MM_AUDIO_CODEC_MP3;
2447 else if (!strcmp(name, "AAC"))
2448 codec_index = MM_AUDIO_CODEC_AAC;
2449 else if (!strcmp(name, "MMF"))
2450 codec_index = MM_AUDIO_CODEC_MMF;
2451 else if (!strcmp(name, "ADPCM"))
2452 codec_index = MM_AUDIO_CODEC_ADPCM;
2453 else if (!strcmp(name, "WAVE"))
2454 codec_index = MM_AUDIO_CODEC_WAVE;
2455 else if (!strcmp(name, "MIDI"))
2456 codec_index = MM_AUDIO_CODEC_MIDI;
2457 else if (!strcmp(name, "IMELODY"))
2458 codec_index = MM_AUDIO_CODEC_IMELODY;
2459 else if (!strcmp(name, "VORBIS"))
2460 codec_index = MM_AUDIO_CODEC_VORBIS;
2462 MMCAM_LOG_DEBUG("audio codec index %d", codec_index);
2469 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2471 int codec_index = MM_VIDEO_CODEC_INVALID;
2474 MMCAM_LOG_ERROR("name is NULL");
2475 return MM_VIDEO_CODEC_INVALID;
2478 if (!strcmp(name, "H263"))
2479 codec_index = MM_VIDEO_CODEC_H263;
2480 else if (!strcmp(name, "H264"))
2481 codec_index = MM_VIDEO_CODEC_H264;
2482 else if (!strcmp(name, "H26L"))
2483 codec_index = MM_VIDEO_CODEC_H26L;
2484 else if (!strcmp(name, "MPEG4"))
2485 codec_index = MM_VIDEO_CODEC_MPEG4;
2486 else if (!strcmp(name, "MPEG1"))
2487 codec_index = MM_VIDEO_CODEC_MPEG1;
2488 else if (!strcmp(name, "THEORA"))
2489 codec_index = MM_VIDEO_CODEC_THEORA;
2491 MMCAM_LOG_DEBUG("video codec index %d", codec_index);
2498 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2500 int codec_index = MM_IMAGE_CODEC_INVALID;
2503 MMCAM_LOG_ERROR("name is NULL");
2504 return MM_IMAGE_CODEC_INVALID;
2507 if (!strcmp(name, "JPEG"))
2508 codec_index = MM_IMAGE_CODEC_JPEG;
2509 else if (!strcmp(name, "PNG"))
2510 codec_index = MM_IMAGE_CODEC_PNG;
2511 else if (!strcmp(name, "BMP"))
2512 codec_index = MM_IMAGE_CODEC_BMP;
2513 else if (!strcmp(name, "WBMP"))
2514 codec_index = MM_IMAGE_CODEC_WBMP;
2515 else if (!strcmp(name, "TIFF"))
2516 codec_index = MM_IMAGE_CODEC_TIFF;
2517 else if (!strcmp(name, "PCX"))
2518 codec_index = MM_IMAGE_CODEC_PCX;
2519 else if (!strcmp(name, "GIF"))
2520 codec_index = MM_IMAGE_CODEC_GIF;
2521 else if (!strcmp(name, "ICO"))
2522 codec_index = MM_IMAGE_CODEC_ICO;
2523 else if (!strcmp(name, "RAS"))
2524 codec_index = MM_IMAGE_CODEC_RAS;
2525 else if (!strcmp(name, "TGA"))
2526 codec_index = MM_IMAGE_CODEC_TGA;
2527 else if (!strcmp(name, "XBM"))
2528 codec_index = MM_IMAGE_CODEC_XBM;
2529 else if (!strcmp(name, "XPM"))
2530 codec_index = MM_IMAGE_CODEC_XPM;
2532 MMCAM_LOG_DEBUG("image codec index %d", codec_index);
2538 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2540 int mux_index = MM_FILE_FORMAT_INVALID;
2543 MMCAM_LOG_ERROR("name is NULL");
2544 return MM_FILE_FORMAT_INVALID;
2547 if (!strcmp(name, "3GP"))
2548 mux_index = MM_FILE_FORMAT_3GP;
2549 else if (!strcmp(name, "AMR"))
2550 mux_index = MM_FILE_FORMAT_AMR;
2551 else if (!strcmp(name, "MP4"))
2552 mux_index = MM_FILE_FORMAT_MP4;
2553 else if (!strcmp(name, "AAC"))
2554 mux_index = MM_FILE_FORMAT_AAC;
2555 else if (!strcmp(name, "MP3"))
2556 mux_index = MM_FILE_FORMAT_MP3;
2557 else if (!strcmp(name, "OGG"))
2558 mux_index = MM_FILE_FORMAT_OGG;
2559 else if (!strcmp(name, "WAV"))
2560 mux_index = MM_FILE_FORMAT_WAV;
2561 else if (!strcmp(name, "AVI"))
2562 mux_index = MM_FILE_FORMAT_AVI;
2563 else if (!strcmp(name, "WMA"))
2564 mux_index = MM_FILE_FORMAT_WMA;
2565 else if (!strcmp(name, "WMV"))
2566 mux_index = MM_FILE_FORMAT_WMV;
2567 else if (!strcmp(name, "MID"))
2568 mux_index = MM_FILE_FORMAT_MID;
2569 else if (!strcmp(name, "MMF"))
2570 mux_index = MM_FILE_FORMAT_MMF;
2571 else if (!strcmp(name, "MATROSKA"))
2572 mux_index = MM_FILE_FORMAT_MATROSKA;
2573 else if (!strcmp(name, "M2TS"))
2574 mux_index = MM_FILE_FORMAT_M2TS;
2576 MMCAM_LOG_DEBUG("mux index %d", mux_index);
2582 int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2586 mmf_return_val_if_fail(name, -1);
2588 switch (conf_category) {
2589 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2590 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2592 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2593 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2595 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2596 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2598 case CONFIGURE_CATEGORY_MAIN_MUX:
2599 fmt = _mmcamcorder_get_mux_format(handle, name);
2602 MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category);
2608 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format)
2610 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2611 camera_conf* configure_info = NULL;
2613 int total_count = 0;
2615 mmf_return_val_if_fail(hcamcorder, 0);
2617 configure_info = hcamcorder->conf_main;
2619 if (configure_info->info[conf_category]) {
2622 const char *name = NULL;
2623 int count = configure_info->info[conf_category]->count;
2624 conf_detail *info = configure_info->info[conf_category];
2626 MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]",
2627 conf_category, count, info);
2629 if (count <= 0 || !info)
2632 arr = (int*)g_malloc0(count * sizeof(int));
2634 for (i = 0 ; i < count ; i++) {
2635 if (info->detail_info[i] == NULL)
2638 name = ((type_element*)(info->detail_info[i]))->name;
2639 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2641 arr[total_count++] = fmt;
2643 MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt);