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
48 char *get_new_string(char* src_string)
50 return g_strdup(src_string);
53 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info)
56 int info_table_size = sizeof(conf_info_table);
58 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
60 mmf_return_val_if_fail(hcamcorder && configure_info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
62 /* Videosrc element default value */
63 static type_element _videosrc_element_default = {
72 /* Audiosrc element default value */
73 static type_int ___audiosrc_default_channel = {"Channel", 1};
74 static type_int ___audiosrc_default_bitrate = {"BitRate", 8000};
75 static type_int ___audiosrc_default_depth = {"Depth", 16};
76 static type_int ___audiosrc_default_blocksize = {"BlockSize", 1280};
77 static type_int* __audiosrc_default_int_array[] = {
78 &___audiosrc_default_channel,
79 &___audiosrc_default_bitrate,
80 &___audiosrc_default_depth,
81 &___audiosrc_default_blocksize,
83 static type_string ___audiosrc_default_device = {"Device", "default"};
84 static type_string* __audiosrc_default_string_array[] = {
85 &___audiosrc_default_device,
87 static type_element _audiosrc_element_default = {
90 __audiosrc_default_int_array,
91 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
92 __audiosrc_default_string_array,
93 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
96 static type_element _audiomodemsrc_element_default = {
97 "AudiomodemsrcElement",
99 __audiosrc_default_int_array,
100 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
101 __audiosrc_default_string_array,
102 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
106 /* Videosink element default value */
107 static type_int ___videosink_default_display_id = {"display-id", 3};
108 static type_int ___videosink_default_x = {"x", 0};
109 static type_int ___videosink_default_y = {"y", 0};
110 static type_int ___videosink_default_width = {"width", 800};
111 static type_int ___videosink_default_height = {"height", 480};
112 static type_int ___videosink_default_rotation = {"rotation", 1};
113 static type_int* __videosink_default_int_array[] = {
114 &___videosink_default_display_id,
115 &___videosink_default_x,
116 &___videosink_default_y,
117 &___videosink_default_width,
118 &___videosink_default_height,
119 &___videosink_default_rotation,
121 static type_string* __videosink_default_string_array[] = {NULL};
122 static type_element _videosink_element_overlay_default = {
123 "VideosinkElementOverlay",
125 __videosink_default_int_array,
126 sizeof(__videosink_default_int_array) / sizeof(type_int*),
127 __videosink_default_string_array,
128 sizeof(__videosink_default_string_array) / sizeof(type_string*),
130 static type_element _videosink_element_evas_default = {
131 "VideosinkElementEvas",
133 __videosink_default_int_array,
134 sizeof(__videosink_default_int_array) / sizeof(type_int*),
135 __videosink_default_string_array,
136 sizeof(__videosink_default_string_array) / sizeof(type_string*),
138 static type_element _videosink_element_gl_default = {
139 "VideosinkElementGL",
141 __videosink_default_int_array,
142 sizeof(__videosink_default_int_array) / sizeof(type_int*),
143 __videosink_default_string_array,
144 sizeof(__videosink_default_string_array) / sizeof(type_string*),
146 static type_element _videosink_element_remote_default = {
147 "VideosinkElementRemote",
149 __videosink_default_int_array,
150 sizeof(__videosink_default_int_array) / sizeof(type_int*),
151 __videosink_default_string_array,
152 sizeof(__videosink_default_string_array) / sizeof(type_string*),
154 static type_element _videosink_element_null_default = {
155 "VideosinkElementNull",
157 __videosink_default_int_array,
158 sizeof(__videosink_default_int_array) / sizeof(type_int*),
159 __videosink_default_string_array,
160 sizeof(__videosink_default_string_array) / sizeof(type_string*),
163 /* Videoscale element default value */
164 static type_element _videoscale_element_default = {
173 /* Videoconvert element default value */
174 static type_element _videoconvert_element_default = {
175 "VideoconvertElement",
183 /* H.264 decoder element default value */
184 static type_element _videodecoder_element_h264_default = {
185 "VideodecoderElementH264",
193 /* Record sink element default value */
194 static type_element _recordsink_element_default = {
203 /* H263 element default value */
204 static type_element _h263_element_default = {
213 /* H264 element default value */
214 static type_element _h264_element_default = {
223 /* H26L element default value */
224 static type_element _h26l_element_default = {
233 /* MPEG4 element default value */
234 static type_element _mpeg4_element_default = {
243 /* MPEG1 element default value */
244 static type_element _mpeg1_element_default = {
253 /* THEORA element default value */
254 static type_element _theora_element_default = {
263 /* AMR element default value */
264 static type_element _amr_element_default = {
273 /* G723_1 element default value */
274 static type_element _g723_1_element_default = {
283 /* MP3 element default value */
284 static type_element _mp3_element_default = {
293 /* AAC element default value */
294 static type_element _aac_element_default = {
303 /* MMF element default value */
304 static type_element _mmf_element_default = {
313 /* ADPCM element default value */
314 static type_element _adpcm_element_default = {
316 "avenc_adpcm_ima_qt",
323 /* WAVE element default value */
324 static type_element _wave_element_default = {
333 /* VORBIS element default value */
334 static type_element _vorbis_element_default = {
343 /* MIDI element default value */
344 static type_element _midi_element_default = {
353 /* IMELODY element default value */
354 static type_element _imelody_element_default = {
363 /* JPEG element default value */
364 static type_element _jpeg_element_default = {
373 /* PNG element default value */
374 static type_element _png_element_default = {
383 /* BMP element default value */
384 static type_element _bmp_element_default = {
393 /* WBMP element default value */
394 static type_element _wbmp_element_default = {
403 /* TIFF element default value */
404 static type_element _tiff_element_default = {
413 /* PCX element default value */
414 static type_element _pcx_element_default = {
423 /* GIF element default value */
424 static type_element _gif_element_default = {
433 /* ICO element default value */
434 static type_element _ico_element_default = {
443 /* RAS element default value */
444 static type_element _ras_element_default = {
453 /* TGA element default value */
454 static type_element _tga_element_default = {
463 /* XBM element default value */
464 static type_element _xbm_element_default = {
473 /* XPM element default value */
474 static type_element _xpm_element_default = {
483 /* 3GP element default value */
484 static type_element _3gp_element_default = {
493 /* AMR mux element default value */
494 static type_element _amrmux_element_default = {
503 /* MP4 element default value */
504 static type_element _mp4_element_default = {
513 /* AAC mux element default value */
514 static type_element _aacmux_element_default = {
523 /* MP3 mux element default value */
524 static type_element _mp3mux_element_default = {
533 /* OGG element default value */
534 static type_element _ogg_element_default = {
543 /* WAV element default value */
544 static type_element _wav_element_default = {
553 /* AVI element default value */
554 static type_element _avi_element_default = {
563 /* WMA element default value */
564 static type_element _wma_element_default = {
573 /* WMV element default value */
574 static type_element _wmv_element_default = {
583 /* MID element default value */
584 static type_element _mid_element_default = {
593 /* MMF mux element default value */
594 static type_element _mmfmux_element_default = {
603 /* MATROSKA element default value */
604 static type_element _matroska_element_default = {
613 /* M2TS element default value */
614 static type_element _m2ts_element_default = {
623 /* [General] matching table */
624 static conf_info_table conf_main_general_table[] = {
625 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
626 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
627 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
628 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
631 /* [VideoInput] matching table */
632 static conf_info_table conf_main_video_input_table[] = {
633 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
634 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
635 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
636 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
637 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
638 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
639 { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
642 /* [AudioInput] matching table */
643 static conf_info_table conf_main_audio_input_table[] = {
644 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
645 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
646 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
647 { "AudioBufferInterval", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_AUDIO_BUFFER_INTERVAL} },
650 /* [VideoOutput] matching table */
651 static conf_info_table conf_main_video_output_table[] = {
652 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
653 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
654 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
655 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
656 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
657 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
658 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
659 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
660 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
661 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
662 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
663 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
664 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
665 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
668 /* [Capture] matching table */
669 static conf_info_table conf_main_capture_table[] = {
670 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
673 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
676 /* [Record] matching table */
677 static conf_info_table conf_main_record_table[] = {
678 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
679 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
680 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
681 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
682 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
683 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
684 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
685 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
686 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
688 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
689 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
692 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
693 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
694 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
695 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
696 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = 0} },
697 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
698 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} }
701 /* [VideoEncoder] matching table */
702 static conf_info_table conf_main_video_encoder_table[] = {
703 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
704 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
705 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
706 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
707 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
708 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
711 /* [AudioEncoder] matching table */
712 static conf_info_table conf_main_audio_encoder_table[] = {
713 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
714 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
715 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
716 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
717 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
718 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
719 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
720 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
721 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
722 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
725 /* [ImageEncoder] matching table */
726 static conf_info_table conf_main_image_encoder_table[] = {
727 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
728 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
729 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
730 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
731 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
732 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
733 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
734 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
735 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
736 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
737 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
738 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
741 /* [Mux] matching table */
742 static conf_info_table conf_main_mux_table[] = {
743 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
744 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
745 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
746 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
747 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
748 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
749 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
750 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
751 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
752 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
753 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
754 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
755 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
756 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
764 /* [Camera] matching table */
765 static conf_info_table conf_ctrl_camera_table[] = {
766 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
767 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
768 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
769 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
770 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
771 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
776 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
777 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
778 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
779 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
781 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
782 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
783 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
784 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
785 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
786 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
787 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
788 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
791 /* [Strobe] matching table */
792 static conf_info_table conf_ctrl_strobe_table[] = {
793 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
794 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
795 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
798 /* [Effect] matching table */
799 static conf_info_table conf_ctrl_effect_table[] = {
800 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
801 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
802 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
803 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
804 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
805 { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
806 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
807 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
808 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
811 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 /* [Photograph] matching table */
816 static conf_info_table conf_ctrl_photograph_table[] = {
817 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
819 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
820 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
821 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
823 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
824 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
825 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
826 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
827 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
828 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
829 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
831 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
832 { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
833 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
834 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
835 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
836 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
839 /* [Capture] matching table */
840 static conf_info_table conf_ctrl_capture_table[] = {
841 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
842 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
843 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
844 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
845 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
846 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
847 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
850 /* [Detect] matching table */
851 static conf_info_table conf_ctrl_detect_table[] = {
852 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
853 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
854 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
855 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
858 _mmcam_dbg_log("Entered...");
860 if (type == CONFIGURE_TYPE_MAIN) {
861 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
862 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
863 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
864 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
865 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
866 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
867 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
868 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
869 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
870 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
872 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
873 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
874 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
875 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
876 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
877 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
878 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
879 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
880 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
881 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
883 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
885 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
886 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
887 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
888 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
889 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
890 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
892 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
893 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
894 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
895 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
896 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
897 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
899 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
902 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
903 if (configure_info->info == NULL) {
904 _mmcam_dbg_err("category info alloc failed : type %d", type);
905 return MM_ERROR_CAMCORDER_LOW_MEMORY;
908 _mmcam_dbg_log("Done.");
910 return MM_ERROR_NONE;
914 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
916 int ret = MM_ERROR_NONE;
918 char conf_path[__MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
920 _mmcam_dbg_log("Opening...[%s]", ConfFile);
922 mmf_return_val_if_fail(ConfFile, FALSE);
924 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
925 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
927 fp = fopen(conf_path, "r");
929 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
931 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
932 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
933 fp = fopen(conf_path, "r");
935 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
936 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
941 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
945 _mmcam_dbg_log("Leave [0x%x]", ret);
951 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
953 const unsigned int BUFFER_NUM_DETAILS = 256;
954 const unsigned int BUFFER_NUM_TOKEN = 20;
955 size_t BUFFER_LENGTH_STRING = 256;
956 const char* delimiters = " |=,\t\n";
959 int ret = MM_ERROR_NONE;
961 int count_main_category = 0;
962 int count_details = 0;
967 char *buffer_string = NULL;
968 char *buffer_details[BUFFER_NUM_DETAILS];
969 char *buffer_token[BUFFER_NUM_TOKEN];
971 char *category_name = NULL;
972 char *detail_string = NULL;
973 char *user_ptr = NULL;
975 camera_conf *new_conf = NULL;
979 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
981 *configure_info = NULL;
983 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
984 if (new_conf == NULL) {
985 _mmcam_dbg_err("new_conf alloc failed : %zu", sizeof(camera_conf));
986 return MM_ERROR_CAMCORDER_LOW_MEMORY;
989 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
990 if (buffer_string == NULL) {
991 _mmcam_dbg_err("buffer_string alloc failed : %zu", sizeof(char) * BUFFER_LENGTH_STRING);
993 return MM_ERROR_CAMCORDER_LOW_MEMORY;
996 new_conf->type = type;
998 ret = _mmcamcorder_conf_init(handle, type, new_conf);
999 if (ret != MM_ERROR_NONE) {
1000 _mmcam_dbg_err("conf init failed 0x%x", ret);
1002 g_free(buffer_string);
1006 *configure_info = new_conf;
1009 count_main_category = 0;
1012 if (read_main == 0) {
1013 length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
1014 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1017 token = strtok_r(buffer_string, delimiters, &user_ptr);
1019 if ((token) && (token[0] == ';') && (length_read > -1)) {
1020 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1025 /*_mmcam_dbg_log("token : [%s]", token);*/
1026 buffer_token[count_token] = token;
1028 token = strtok_r(NULL, delimiters, &user_ptr);
1031 if (count_token == 0)
1037 if (*buffer_token[0] == ';') {
1039 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1040 } else if (*buffer_token[0] == '[') {
1042 category_name = get_new_string(buffer_token[0]);
1043 if (category_name == NULL) {
1044 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1048 count_main_category++;
1052 length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
1053 /*_mmcam_dbg_log("Read Detail Line : [%s], read length : [%d]", buffer_string, length_read);*/
1055 detail_string = get_new_string(buffer_string);
1057 token = strtok_r(buffer_string, delimiters, &user_ptr);
1059 if (token && token[0] != ';' && length_read > -1) {
1060 /*_mmcam_dbg_log("token : [%s]", token);*/
1061 if (token[0] == '[') {
1063 buffer_token[0] = token;
1064 SAFE_G_FREE(detail_string);
1068 buffer_details[count_details++] = detail_string;
1070 SAFE_G_FREE(detail_string);
1074 /*_mmcam_dbg_log("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);*/
1076 if (count_details == 0) {
1077 _mmcam_dbg_warn("category %s has no detail value... skip this category...", category_name);
1078 SAFE_G_FREE(category_name);
1085 if (type == CONFIGURE_TYPE_MAIN) {
1086 if (!strcmp("[General]", category_name))
1087 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1088 else if (!strcmp("[VideoInput]", category_name))
1089 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1090 else if (!strcmp("[AudioInput]", category_name))
1091 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1092 else if (!strcmp("[VideoOutput]", category_name))
1093 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1094 else if (!strcmp("[Capture]", category_name))
1095 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1096 else if (!strcmp("[Record]", category_name))
1097 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1098 else if (!strcmp("[VideoEncoder]", category_name))
1099 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1100 else if (!strcmp("[AudioEncoder]", category_name))
1101 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1102 else if (!strcmp("[ImageEncoder]", category_name))
1103 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1104 else if (!strcmp("[Mux]", category_name))
1105 category = CONFIGURE_CATEGORY_MAIN_MUX;
1107 if (!strcmp("[Camera]", category_name))
1108 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1109 else if (!strcmp("[Strobe]", category_name))
1110 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1111 else if (!strcmp("[Effect]", category_name))
1112 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1113 else if (!strcmp("[Photograph]", category_name))
1114 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1115 else if (!strcmp("[Capture]", category_name))
1116 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1117 else if (!strcmp("[Detect]", category_name))
1118 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1121 if (category != -1) {
1122 _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
1123 buffer_details, category, count_details);
1125 _mmcam_dbg_warn("No matched category[%s],type[%d]... check it.", category_name, type);
1129 for (i = 0 ; i < count_details ; i++)
1130 SAFE_G_FREE(buffer_details[i]);
1133 SAFE_G_FREE(category_name);
1136 /* (*configure_info) = new_conf; */
1138 SAFE_G_FREE(buffer_string);
1140 /*_mmcam_dbg_log("Done.");*/
1142 return MM_ERROR_NONE;
1146 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1151 int type = CONFIGURE_VALUE_INT;
1153 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1154 camera_conf *temp_conf = (*configure_info);
1156 type_int2 *temp_int = NULL;
1157 type_int_range *temp_int_range = NULL;
1158 type_int_array *temp_int_array = NULL;
1159 type_int_pair_array *temp_int_pair_array = NULL;
1160 type_string2 *temp_string = NULL;
1161 type_string_array *temp_string_array = NULL;
1162 type_element2 *temp_element = NULL;
1164 _mmcam_dbg_log("Entered...");
1166 mmf_return_if_fail(temp_conf);
1168 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1169 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1171 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1173 for (i = 0 ; i < category_num ; i++) {
1174 if (temp_conf->info[i]) {
1175 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1176 if (temp_conf->info[i]->detail_info[j] == NULL)
1179 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1181 case CONFIGURE_VALUE_INT:
1182 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1183 SAFE_G_FREE(temp_int->name);
1185 case CONFIGURE_VALUE_INT_RANGE:
1186 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1187 SAFE_G_FREE(temp_int_range->name);
1189 case CONFIGURE_VALUE_INT_ARRAY:
1190 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1191 SAFE_G_FREE(temp_int_array->name);
1192 SAFE_G_FREE(temp_int_array->value);
1194 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1195 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1196 SAFE_G_FREE(temp_int_pair_array->name);
1197 SAFE_G_FREE(temp_int_pair_array->value[0]);
1198 SAFE_G_FREE(temp_int_pair_array->value[1]);
1200 case CONFIGURE_VALUE_STRING:
1201 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1202 SAFE_G_FREE(temp_string->name);
1203 SAFE_G_FREE(temp_string->value);
1205 case CONFIGURE_VALUE_STRING_ARRAY:
1206 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1207 SAFE_G_FREE(temp_string_array->name);
1208 if (temp_string_array->value) {
1209 count = temp_string_array->count;
1211 for (k = 0 ; k < count ; k++)
1212 SAFE_G_FREE(temp_string_array->value[k]);
1214 SAFE_G_FREE(temp_string_array->value);
1216 SAFE_G_FREE(temp_string_array->default_value);
1218 case CONFIGURE_VALUE_ELEMENT:
1219 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1220 SAFE_G_FREE(temp_element->name);
1221 SAFE_G_FREE(temp_element->element_name);
1223 if (temp_element->value_int) {
1224 count = temp_element->count_int;
1225 for (k = 0 ; k < count ; k++) {
1226 SAFE_G_FREE(temp_element->value_int[k]->name);
1227 SAFE_G_FREE(temp_element->value_int[k]);
1229 SAFE_G_FREE(temp_element->value_int);
1232 if (temp_element->value_string) {
1233 count = temp_element->count_string;
1234 for (k = 0 ; k < count ; k++) {
1235 SAFE_G_FREE(temp_element->value_string[k]->name);
1236 SAFE_G_FREE(temp_element->value_string[k]->value);
1237 SAFE_G_FREE(temp_element->value_string[k]);
1239 SAFE_G_FREE(temp_element->value_string);
1243 _mmcam_dbg_warn("unknown type %d", type);
1248 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1251 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1253 SAFE_G_FREE(temp_conf->info[i]);
1254 temp_conf->info[i] = NULL;
1258 SAFE_G_FREE((*configure_info)->info);
1259 SAFE_G_FREE((*configure_info));
1261 _mmcam_dbg_log("Done.");
1264 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1267 int count_value = 0;
1269 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1271 if (hcamcorder == NULL) {
1272 _mmcam_dbg_err("handle is NULL");
1276 /*_mmcam_dbg_log("Entered...");*/
1278 mmf_return_val_if_fail(name, FALSE);
1280 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1281 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
1285 /*_mmcam_dbg_log("Number of value : [%d]", count_value);*/
1287 if (type == CONFIGURE_TYPE_MAIN) {
1288 for (i = 0 ; i < count_value ; i++) {
1289 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1290 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1291 /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1296 for (i = 0 ; i < count_value ; i++) {
1297 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1298 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1299 /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1309 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1311 const int BUFFER_NUM_TOKEN = 256;
1318 char *buffer_token[BUFFER_NUM_TOKEN];
1319 char *user_ptr = NULL;
1321 const char *delimiters = " |=,\t\n";
1322 const char *delimiters_sub = " |\t\n";
1323 const char *delimiters_3rd = "|\n";
1325 mmf_return_val_if_fail(info && buffer_details, FALSE);
1327 (*info) = (conf_detail*)g_malloc0(sizeof(conf_detail));
1328 if (*info == NULL) {
1329 _mmcam_dbg_err("info allo failed");
1332 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1333 (*info)->count = count_details;
1335 if ((*info)->detail_info == NULL) {
1336 _mmcam_dbg_err("detail_info alloc failed");
1342 for (i = 0 ; i < count_details ; i++) {
1343 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1345 token = strtok_r(buffer_details[i], delimiters, &user_ptr);
1348 buffer_token[count_token] = token;
1351 (*info)->detail_info[i] = NULL;
1352 _mmcam_dbg_warn("No token... check it.[%s]", buffer_details[i]);
1356 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1357 (*info)->detail_info[i] = NULL;
1358 _mmcam_dbg_warn("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
1362 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1363 token = strtok_r(NULL, delimiters, &user_ptr);
1365 buffer_token[count_token] = token;
1366 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1368 token = strtok_r(NULL, delimiters, &user_ptr);
1371 if (count_token < 2) {
1372 (*info)->detail_info[i] = NULL;
1373 _mmcam_dbg_warn("Number of token is too small... check it.[%s]", buffer_details[i]);
1376 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1378 strtok_r(NULL, delimiters_sub, &user_ptr);
1380 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1381 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1383 buffer_token[count_token] = token;
1384 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1386 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1388 } else { /* CONFIGURE_VALUE_STRING */
1389 token = strtok_r(NULL, delimiters_3rd, &user_ptr);
1392 buffer_token[count_token] = token;
1393 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1398 if (count_token < 2) {
1399 (*info)->detail_info[i] = NULL;
1400 _mmcam_dbg_warn("No string value... check it.[%s]", buffer_details[i]);
1405 switch (value_type) {
1406 case CONFIGURE_VALUE_INT:
1410 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1411 if (new_int == NULL) {
1412 _mmcam_dbg_err("allocation failed");
1415 new_int->name = get_new_string(buffer_token[0]);
1416 new_int->value = atoi(buffer_token[1]);
1417 (*info)->detail_info[i] = (void*)new_int;
1418 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1421 case CONFIGURE_VALUE_INT_RANGE:
1423 type_int_range* new_int_range;
1425 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1426 if (new_int_range == NULL) {
1427 _mmcam_dbg_err("allocation failed");
1430 new_int_range->name = get_new_string(buffer_token[0]);
1431 new_int_range->min = atoi(buffer_token[1]);
1432 new_int_range->max = atoi(buffer_token[2]);
1433 new_int_range->default_value = atoi(buffer_token[3]);
1434 (*info)->detail_info[i] = (void*)new_int_range;
1436 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1437 new_int_range->name,
1440 new_int_range->default_value);
1444 case CONFIGURE_VALUE_INT_ARRAY:
1446 int count_value = count_token - 2;
1447 type_int_array* new_int_array;
1449 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1450 if (new_int_array == NULL) {
1451 _mmcam_dbg_err("allocation failed");
1454 new_int_array->name = get_new_string(buffer_token[0]);
1455 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1456 if (new_int_array->value == NULL) {
1457 SAFE_G_FREE(new_int_array->name);
1458 SAFE_G_FREE(new_int_array);
1459 _mmcam_dbg_err("allocation failed");
1462 new_int_array->count = count_value;
1464 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1465 for (j = 0 ; j < count_value ; j++) {
1466 new_int_array->value[j] = atoi(buffer_token[j+1]);
1467 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1470 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1471 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1473 (*info)->detail_info[i] = (void*)new_int_array;
1476 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1478 int count_value = (count_token - 3) >> 1;
1479 type_int_pair_array* new_int_pair_array;
1481 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1482 if (new_int_pair_array == NULL) {
1483 _mmcam_dbg_err("allocation failed");
1486 new_int_pair_array->name = get_new_string(buffer_token[0]);
1487 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1488 if (new_int_pair_array->value[0] == NULL) {
1489 SAFE_G_FREE(new_int_pair_array->name);
1490 SAFE_G_FREE(new_int_pair_array);
1491 _mmcam_dbg_err("allocation failed");
1494 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1495 if (new_int_pair_array->value[1] == NULL) {
1496 SAFE_G_FREE(new_int_pair_array->value[0]);
1497 SAFE_G_FREE(new_int_pair_array->name);
1498 SAFE_G_FREE(new_int_pair_array);
1499 _mmcam_dbg_err("allocation failed");
1502 new_int_pair_array->count = count_value;
1504 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1505 for (j = 0 ; j < count_value ; j++) {
1506 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1507 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1509 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1510 new_int_pair_array->value[0][j],
1511 new_int_pair_array->value[1][j]);
1515 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1516 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1518 _mmcam_dbg_log(" default value[%d,%d]",
1519 new_int_pair_array->default_value[0],
1520 new_int_pair_array->default_value[1]);
1522 (*info)->detail_info[i] = (void*)new_int_pair_array;
1525 case CONFIGURE_VALUE_STRING:
1527 type_string2* new_string;
1529 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1530 if (new_string == NULL) {
1531 _mmcam_dbg_err("allocation failed");
1534 new_string->name = get_new_string(buffer_token[0]);
1535 new_string->value = get_new_string(buffer_token[1]);
1536 (*info)->detail_info[i] = (void*)new_string;
1538 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1541 case CONFIGURE_VALUE_STRING_ARRAY:
1543 int count_value = count_token - 2;
1544 type_string_array* new_string_array;
1546 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1547 if (new_string_array == NULL)
1550 new_string_array->name = get_new_string(buffer_token[0]);
1551 new_string_array->count = count_value;
1552 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1553 if (new_string_array->value == NULL) {
1554 SAFE_G_FREE(new_string_array->name);
1555 SAFE_G_FREE(new_string_array);
1556 _mmcam_dbg_err("allocation failed");
1559 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1560 for (j = 0 ; j < count_value ; j++) {
1561 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1562 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1565 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1566 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1567 (*info)->detail_info[i] = (void*)new_string_array;
1570 case CONFIGURE_VALUE_ELEMENT:
1572 type_element2* new_element;
1574 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1575 if (new_element == NULL) {
1576 _mmcam_dbg_err("allocation failed");
1579 new_element->name = get_new_string(buffer_token[0]);
1580 new_element->element_name = get_new_string(buffer_token[1]);
1581 new_element->count_int = atoi(buffer_token[2]);
1582 new_element->value_int = NULL;
1583 new_element->count_string = atoi(buffer_token[3]);
1584 new_element->value_string = NULL;
1586 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1587 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1590 /* add int values */
1591 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1592 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1593 if (new_element->value_int) {
1594 for (j = 0 ; j < new_element->count_int ; j++) {
1595 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1596 if (new_element->value_int[j]) {
1597 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1598 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1600 _mmcam_dbg_err("allocation failed");
1603 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1604 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1608 _mmcam_dbg_err("allocation failed");
1611 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1612 new_element->value_int = NULL;
1615 /* add string values */
1616 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1617 new_element->count_int >= 0 && new_element->count_int <= 30) {
1618 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1619 if (new_element->value_string) {
1620 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1621 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1622 if (new_element->value_string[j-new_element->count_int]) {
1623 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1624 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1626 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1627 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);
1630 _mmcam_dbg_err("allocation failed");
1634 _mmcam_dbg_err("malloc failed : %zu", sizeof(type_string2*)*(new_element->count_string));
1637 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1638 new_element->value_string = NULL;
1641 (*info)->detail_info[i] = (void*)new_element;
1653 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1658 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1660 mmf_return_val_if_fail(configure_info, FALSE);
1661 mmf_return_val_if_fail(name, FALSE);
1663 if (configure_info->info[category]) {
1664 count = configure_info->info[category]->count;
1665 info = configure_info->info[category];
1667 for (i = 0 ; i < count ; i++) {
1668 if (info->detail_info[i] == NULL)
1671 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1672 *value = ((type_int*)(info->detail_info[i]))->value;
1673 /* _mmcam_dbg_log("Get[%s] int[%d]", name, *value); */
1679 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1680 /*_mmcam_dbg_log("Get[%s] int[%d]", name, *value);*/
1684 _mmcam_dbg_err("Faild to get int... check it...Category[%d],Name[%s]", category, name);
1690 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1695 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1697 mmf_return_val_if_fail(configure_info, FALSE);
1698 mmf_return_val_if_fail(name, FALSE);
1700 if (configure_info->info[category]) {
1701 count = configure_info->info[category]->count;
1702 info = configure_info->info[category];
1704 for (i = 0 ; i < count ; i++) {
1705 if (info->detail_info[i] == NULL)
1708 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1709 *value = (type_int_range*)(info->detail_info[i]);
1711 _mmcam_dbg_log("Get[%s] int range - min[%d],max[%d],default[%d]",
1712 name, (*value)->min, (*value)->max, (*value)->default_value);
1721 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1727 _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1732 /*_mmcam_dbg_log("Entered... category[%d],name[%s]", category, name);*/
1734 mmf_return_val_if_fail(configure_info, FALSE);
1735 mmf_return_val_if_fail(name, FALSE);
1737 if (configure_info->info[category]) {
1738 count = configure_info->info[category]->count;
1739 info = configure_info->info[category];
1741 for (i = 0 ; i < count ; i++) {
1742 if (info->detail_info[i] == NULL)
1745 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1746 *value = (type_int_array*)(info->detail_info[i]);
1748 _mmcam_dbg_log("Get[%s] int array - [%x],count[%d],default[%d]",
1749 name, (*value)->value, (*value)->count, (*value)->default_value);
1758 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1764 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1769 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1771 mmf_return_val_if_fail(configure_info, FALSE);
1772 mmf_return_val_if_fail(name, FALSE);
1774 if (configure_info->info[category]) {
1775 count = configure_info->info[category]->count;
1776 info = configure_info->info[category];
1778 for (i = 0 ; i < count ; i++) {
1779 if (info->detail_info[i] == NULL)
1782 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1783 *value = (type_int_pair_array*)(info->detail_info[i]);
1785 _mmcam_dbg_log("Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1786 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1787 (*value)->default_value[0], (*value)->default_value[1]);
1796 /*_mmcam_dbg_warn("Faild to get int pair array... check it...Category[%d],Name[%s]", category, name);*/
1801 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1806 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1808 mmf_return_val_if_fail(configure_info, FALSE);
1809 mmf_return_val_if_fail(name, FALSE);
1811 if (configure_info->info[category]) {
1812 count = configure_info->info[category]->count;
1813 info = configure_info->info[category];
1815 for (i = 0 ; i < count ; i++) {
1816 if (info->detail_info[i] == NULL)
1819 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1820 *value = ((type_string*)(info->detail_info[i]))->value;
1821 /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
1827 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1828 /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
1832 _mmcam_dbg_err("Faild to get string... check it...Category[%d],Name[%s]", category, name);
1838 _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1843 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1845 mmf_return_val_if_fail(configure_info, FALSE);
1846 mmf_return_val_if_fail(name, FALSE);
1848 if (configure_info->info[category]) {
1849 count = configure_info->info[category]->count;
1850 info = configure_info->info[category];
1852 for (i = 0 ; i < count ; i++) {
1853 if (info->detail_info[i] == NULL)
1856 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1857 *value = (type_string_array*)(info->detail_info[i]);
1859 _mmcam_dbg_log("Get[%s] string array - [%x],count[%d],default[%s]",
1860 name, (*value)->value, (*value)->count, (*value)->default_value);
1869 /*_mmcam_dbg_warn("Faild to get string array... check it...Category[%d],Name[%s]", category, name);*/
1874 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1879 /* _mmcam_dbg_log("Entered... category[%d], ame[%s]", category, name); */
1881 mmf_return_val_if_fail(configure_info, FALSE);
1882 mmf_return_val_if_fail(name, FALSE);
1884 if (configure_info->info[category]) {
1885 count = configure_info->info[category]->count;
1886 info = configure_info->info[category];
1888 for (i = 0 ; i < count ; i++) {
1889 if (info->detail_info[i] == NULL)
1892 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1893 *element = (type_element*)(info->detail_info[i]);
1894 /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
1900 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1901 /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
1905 _mmcam_dbg_warn("Faild to get element name... check it...Category[%d],Name[%s]", category, name);
1911 _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1913 /* _mmcam_dbg_log("Entered..."); */
1915 mmf_return_val_if_fail(element, FALSE);
1917 *value = element->element_name;
1919 /* _mmcam_dbg_log("Get element name : [%s]", *value); */
1925 _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1929 /* _mmcam_dbg_log( "Entered..." ); */
1931 mmf_return_val_if_fail(element, FALSE);
1932 mmf_return_val_if_fail(name, FALSE);
1934 for (i = 0 ; i < element->count_int ; i++) {
1935 if (!strcmp(element->value_int[i]->name, name)) {
1936 *value = element->value_int[i]->value;
1937 /* _mmcam_dbg_log("Get[%s] element int[%d]", name, *value); */
1942 _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
1943 element->name, name, element->count_int);
1949 _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1953 /* _mmcam_dbg_log("Entered..."); */
1955 mmf_return_val_if_fail(element, FALSE);
1956 mmf_return_val_if_fail(name, FALSE);
1958 for (i = 0 ; i < element->count_string ; i++) {
1959 if (!strcmp(element->value_string[i]->name, name)) {
1960 *value = element->value_string[i]->value;
1961 /*_mmcam_dbg_log("Get[%s] element string[%s]", name, *value);*/
1966 _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
1967 element->name, name, element->count_string);
1973 _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1977 /* _mmcam_dbg_log("Entered..."); */
1979 mmf_return_val_if_fail(gst, FALSE);
1980 mmf_return_val_if_fail(element, FALSE);
1982 if (element->count_int == 0) {
1983 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
1985 if (element->value_int == NULL) {
1986 _mmcam_dbg_warn("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1990 for (i = 0 ; i < element->count_int ; i++) {
1991 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1994 _mmcam_dbg_log("Element[%s] Set[%s] -> integer[%d]",
1995 element->element_name,
1996 element->value_int[i]->name,
1997 element->value_int[i]->value);
2002 if (element->count_string == 0) {
2003 _mmcam_dbg_log("There is no string property to set in INI file[%s].", element->name);
2005 if (element->value_string == NULL) {
2006 _mmcam_dbg_warn("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
2010 for (i = 0 ; i < element->count_string ; i++) {
2011 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
2013 _mmcam_dbg_log("Element[%s] Set[%s] -> string[%s]",
2014 element->element_name,
2015 element->value_string[i]->name,
2016 element->value_string[i]->value);
2020 /* _mmcam_dbg_log( "Done." ); */
2026 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
2029 int count_value = 0;
2031 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2033 if (hcamcorder == NULL) {
2034 _mmcam_dbg_err("handle is NULL");
2038 /* _mmcam_dbg_log("Entered..."); */
2040 mmf_return_val_if_fail(name, FALSE);
2042 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2043 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2047 if (type == CONFIGURE_TYPE_MAIN) {
2048 for (i = 0 ; i < count_value ; i++) {
2049 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2050 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2055 for (i = 0 ; i < count_value ; i++) {
2056 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2057 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2063 _mmcam_dbg_err("Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2068 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2071 int count_value = 0;
2073 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2075 if (hcamcorder == NULL) {
2076 _mmcam_dbg_err("handle is NULL");
2080 /* _mmcam_dbg_log("Entered..."); */
2082 mmf_return_val_if_fail(name, FALSE);
2084 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2085 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2089 if (type == CONFIGURE_TYPE_MAIN) {
2090 for (i = 0 ; i < count_value ; i++) {
2091 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2092 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2093 /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
2098 for (i = 0 ; i < count_value ; i++) {
2099 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2100 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2101 /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
2107 _mmcam_dbg_warn("Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2112 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2115 int count_value = 0;
2117 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2119 if (hcamcorder == NULL) {
2120 _mmcam_dbg_err("handle is NULL");
2124 /* _mmcam_dbg_log("Entered..."); */
2126 mmf_return_val_if_fail(name, FALSE);
2128 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2129 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2133 if (type == CONFIGURE_TYPE_MAIN) {
2134 for (i = 0 ; i < count_value ; i++) {
2135 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2136 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2137 _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
2142 for (i = 0 ; i < count_value ; i++) {
2143 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2144 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2145 _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
2151 _mmcam_dbg_warn("Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2156 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2158 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2160 if (hcamcorder == NULL) {
2161 _mmcam_dbg_err("handle is NULL");
2166 mmf_return_val_if_fail(conf_main_category_size, FALSE);
2167 mmf_return_val_if_fail(conf_ctrl_category_size, FALSE);
2170 if (type == CONFIGURE_TYPE_MAIN) {
2171 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2173 *size = (int)hcamcorder->conf_main_category_size[category];
2175 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2177 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2184 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2186 int i, j, k, type, category_type;
2189 type_int_range *temp_int_range;
2190 type_int_array *temp_int_array;
2191 type_int_pair_array *temp_int_pair_array;
2192 type_string *temp_string;
2193 type_element *temp_element;
2195 g_print("[ConfigureInfoPrint] : Entered.\n");
2197 mmf_return_if_fail(*configure_info);
2199 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2200 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2202 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2204 for (i = 0 ; i < category_type ; i++) {
2206 if ((*configure_info)->info[i]) {
2207 g_print("[ConfigureInfo] : Category [%d]\n", i);
2209 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2211 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2213 case CONFIGURE_VALUE_INT:
2214 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2215 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2217 case CONFIGURE_VALUE_INT_RANGE:
2218 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2219 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2220 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2222 case CONFIGURE_VALUE_INT_ARRAY:
2223 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2224 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2225 temp_int_array->name, temp_int_array->default_value);
2227 for (k = 0 ; k < temp_int_array->count ; k++)
2228 g_print("[%d] ", temp_int_array->value[k]);
2232 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2233 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2234 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2235 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2237 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2238 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2242 case CONFIGURE_VALUE_STRING:
2243 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2244 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2246 case CONFIGURE_VALUE_ELEMENT:
2247 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2248 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2250 for (k = 0 ; k < temp_element->count_int ; k++)
2251 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2253 for (k = 0 ; k < temp_element->count_string ; k++)
2254 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2258 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);
2262 g_print("[ConfigureInfo] : Failed to get value type.");
2268 g_print("[ConfigureInfoPrint] : Done.\n");
2272 static type_element *
2273 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2275 type_element *telement = NULL;
2276 const char *codec_type_str = NULL;
2277 int codec_type = MM_AUDIO_CODEC_INVALID;
2278 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2279 _MMCamcorderSubContext *sc = NULL;
2281 mmf_return_val_if_fail(hcamcorder, NULL);
2282 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2284 mmf_return_val_if_fail(sc, NULL);
2288 /* Check element availability */
2289 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2291 switch (codec_type) {
2292 case MM_AUDIO_CODEC_AMR:
2293 codec_type_str = "AMR";
2295 case MM_AUDIO_CODEC_G723_1:
2296 codec_type_str = "G723_1";
2298 case MM_AUDIO_CODEC_MP3:
2299 codec_type_str = "MP3";
2301 case MM_AUDIO_CODEC_AAC:
2302 codec_type_str = "AAC";
2304 case MM_AUDIO_CODEC_MMF:
2305 codec_type_str = "MMF";
2307 case MM_AUDIO_CODEC_ADPCM:
2308 codec_type_str = "ADPCM";
2310 case MM_AUDIO_CODEC_WAVE:
2311 codec_type_str = "WAVE";
2313 case MM_AUDIO_CODEC_MIDI:
2314 codec_type_str = "MIDI";
2316 case MM_AUDIO_CODEC_IMELODY:
2317 codec_type_str = "IMELODY";
2319 case MM_AUDIO_CODEC_VORBIS:
2320 codec_type_str = "VORBIS";
2323 _mmcam_dbg_err("Not supported audio codec[%d]", codec_type);
2327 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2328 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2336 static type_element *
2337 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2339 type_element *telement = NULL;
2340 const char *codec_type_str = NULL;
2341 int codec_type = MM_VIDEO_CODEC_INVALID;
2342 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2343 _MMCamcorderSubContext *sc = NULL;
2345 mmf_return_val_if_fail(hcamcorder, NULL);
2346 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2348 mmf_return_val_if_fail(sc, NULL);
2352 /* Check element availability */
2353 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2355 switch (codec_type) {
2356 case MM_VIDEO_CODEC_H263:
2357 codec_type_str = "H263";
2359 case MM_VIDEO_CODEC_H264:
2360 codec_type_str = "H264";
2362 case MM_VIDEO_CODEC_H26L:
2363 codec_type_str = "H26L";
2365 case MM_VIDEO_CODEC_MPEG4:
2366 codec_type_str = "MPEG4";
2368 case MM_VIDEO_CODEC_MPEG1:
2369 codec_type_str = "MPEG1";
2371 case MM_VIDEO_CODEC_THEORA:
2372 codec_type_str = "THEORA";
2375 _mmcam_dbg_err("Not supported video codec[%d]", codec_type);
2379 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2380 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2388 static type_element *
2389 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2391 type_element *telement = NULL;
2392 const char *codec_type_str = NULL;
2393 int codec_type = MM_IMAGE_CODEC_INVALID;
2394 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2395 _MMCamcorderSubContext *sc = NULL;
2397 mmf_return_val_if_fail(hcamcorder, NULL);
2398 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2400 mmf_return_val_if_fail(sc, NULL);
2404 /* Check element availability */
2405 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2407 switch (codec_type) {
2408 case MM_IMAGE_CODEC_JPEG:
2409 codec_type_str = "JPEG";
2411 case MM_IMAGE_CODEC_SRW:
2412 codec_type_str = "SRW";
2414 case MM_IMAGE_CODEC_JPEG_SRW:
2415 codec_type_str = "JPEG_SRW";
2417 case MM_IMAGE_CODEC_PNG:
2418 codec_type_str = "PNG";
2420 case MM_IMAGE_CODEC_BMP:
2421 codec_type_str = "BMP";
2423 case MM_IMAGE_CODEC_WBMP:
2424 codec_type_str = "WBMP";
2426 case MM_IMAGE_CODEC_TIFF:
2427 codec_type_str = "TIFF";
2429 case MM_IMAGE_CODEC_PCX:
2430 codec_type_str = "PCX";
2432 case MM_IMAGE_CODEC_GIF:
2433 codec_type_str = "GIF";
2435 case MM_IMAGE_CODEC_ICO:
2436 codec_type_str = "ICO";
2438 case MM_IMAGE_CODEC_RAS:
2439 codec_type_str = "RAS";
2441 case MM_IMAGE_CODEC_TGA:
2442 codec_type_str = "TGA";
2444 case MM_IMAGE_CODEC_XBM:
2445 codec_type_str = "XBM";
2447 case MM_IMAGE_CODEC_XPM:
2448 codec_type_str = "XPM";
2451 _mmcam_dbg_err("Not supported image codec[%d]", codec_type);
2455 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2456 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2464 static type_element *
2465 __mmcamcorder_get_file_format_element(MMHandleType handle)
2467 type_element *telement = NULL;
2468 const char *mux_type_str = NULL;
2469 int file_type = MM_FILE_FORMAT_INVALID;
2470 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2471 _MMCamcorderSubContext *sc = NULL;
2473 mmf_return_val_if_fail(hcamcorder, NULL);
2474 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2476 mmf_return_val_if_fail(sc, NULL);
2480 /* Check element availability */
2481 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2483 switch (file_type) {
2484 case MM_FILE_FORMAT_3GP:
2485 mux_type_str = "3GP";
2487 case MM_FILE_FORMAT_AMR:
2488 mux_type_str = "AMR";
2490 case MM_FILE_FORMAT_MP4:
2491 mux_type_str = "MP4";
2493 case MM_FILE_FORMAT_AAC:
2494 mux_type_str = "AAC";
2496 case MM_FILE_FORMAT_MP3:
2497 mux_type_str = "MP3";
2499 case MM_FILE_FORMAT_OGG:
2500 mux_type_str = "OGG";
2502 case MM_FILE_FORMAT_WAV:
2503 mux_type_str = "WAV";
2505 case MM_FILE_FORMAT_AVI:
2506 mux_type_str = "AVI";
2508 case MM_FILE_FORMAT_WMA:
2509 mux_type_str = "WMA";
2511 case MM_FILE_FORMAT_WMV:
2512 mux_type_str = "WMV";
2514 case MM_FILE_FORMAT_MID:
2515 mux_type_str = "MID";
2517 case MM_FILE_FORMAT_MMF:
2518 mux_type_str = "MMF";
2520 case MM_FILE_FORMAT_MATROSKA:
2521 mux_type_str = "MATROSKA";
2523 case MM_FILE_FORMAT_M2TS:
2524 mux_type_str = "M2TS";
2527 _mmcam_dbg_err("Not supported file format[%d]", file_type);
2531 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2532 CONFIGURE_CATEGORY_MAIN_MUX,
2541 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2543 type_element *telement = NULL;
2545 _mmcam_dbg_log("type:%d", type);
2548 case MM_CAM_AUDIO_ENCODER:
2549 telement = __mmcamcorder_get_audio_codec_element(handle);
2551 case MM_CAM_VIDEO_ENCODER:
2552 telement = __mmcamcorder_get_video_codec_element(handle);
2554 case MM_CAM_IMAGE_ENCODER:
2555 telement = __mmcamcorder_get_image_codec_element(handle);
2557 case MM_CAM_FILE_FORMAT:
2558 telement = __mmcamcorder_get_file_format_element(handle);
2561 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2568 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2570 int codec_index = MM_AUDIO_CODEC_INVALID;
2573 _mmcam_dbg_err("name is NULL");
2574 return MM_AUDIO_CODEC_INVALID;
2577 if (!strcmp(name, "AMR"))
2578 codec_index = MM_AUDIO_CODEC_AMR;
2579 else if (!strcmp(name, "G723_1"))
2580 codec_index = MM_AUDIO_CODEC_G723_1;
2581 else if (!strcmp(name, "MP3"))
2582 codec_index = MM_AUDIO_CODEC_MP3;
2583 else if (!strcmp(name, "AAC"))
2584 codec_index = MM_AUDIO_CODEC_AAC;
2585 else if (!strcmp(name, "MMF"))
2586 codec_index = MM_AUDIO_CODEC_MMF;
2587 else if (!strcmp(name, "ADPCM"))
2588 codec_index = MM_AUDIO_CODEC_ADPCM;
2589 else if (!strcmp(name, "WAVE"))
2590 codec_index = MM_AUDIO_CODEC_WAVE;
2591 else if (!strcmp(name, "MIDI"))
2592 codec_index = MM_AUDIO_CODEC_MIDI;
2593 else if (!strcmp(name, "IMELODY"))
2594 codec_index = MM_AUDIO_CODEC_IMELODY;
2595 else if (!strcmp(name, "VORBIS"))
2596 codec_index = MM_AUDIO_CODEC_VORBIS;
2598 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2605 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2607 int codec_index = MM_VIDEO_CODEC_INVALID;
2610 _mmcam_dbg_err("name is NULL");
2611 return MM_VIDEO_CODEC_INVALID;
2614 if (!strcmp(name, "H263"))
2615 codec_index = MM_VIDEO_CODEC_H263;
2616 else if (!strcmp(name, "H264"))
2617 codec_index = MM_VIDEO_CODEC_H264;
2618 else if (!strcmp(name, "H26L"))
2619 codec_index = MM_VIDEO_CODEC_H26L;
2620 else if (!strcmp(name, "MPEG4"))
2621 codec_index = MM_VIDEO_CODEC_MPEG4;
2622 else if (!strcmp(name, "MPEG1"))
2623 codec_index = MM_VIDEO_CODEC_MPEG1;
2624 else if (!strcmp(name, "THEORA"))
2625 codec_index = MM_VIDEO_CODEC_THEORA;
2627 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2634 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2636 int codec_index = MM_IMAGE_CODEC_INVALID;
2639 _mmcam_dbg_err("name is NULL");
2640 return MM_IMAGE_CODEC_INVALID;
2643 if (!strcmp(name, "JPEG"))
2644 codec_index = MM_IMAGE_CODEC_JPEG;
2645 else if (!strcmp(name, "PNG"))
2646 codec_index = MM_IMAGE_CODEC_PNG;
2647 else if (!strcmp(name, "BMP"))
2648 codec_index = MM_IMAGE_CODEC_BMP;
2649 else if (!strcmp(name, "WBMP"))
2650 codec_index = MM_IMAGE_CODEC_WBMP;
2651 else if (!strcmp(name, "TIFF"))
2652 codec_index = MM_IMAGE_CODEC_TIFF;
2653 else if (!strcmp(name, "PCX"))
2654 codec_index = MM_IMAGE_CODEC_PCX;
2655 else if (!strcmp(name, "GIF"))
2656 codec_index = MM_IMAGE_CODEC_GIF;
2657 else if (!strcmp(name, "ICO"))
2658 codec_index = MM_IMAGE_CODEC_ICO;
2659 else if (!strcmp(name, "RAS"))
2660 codec_index = MM_IMAGE_CODEC_RAS;
2661 else if (!strcmp(name, "TGA"))
2662 codec_index = MM_IMAGE_CODEC_TGA;
2663 else if (!strcmp(name, "XBM"))
2664 codec_index = MM_IMAGE_CODEC_XBM;
2665 else if (!strcmp(name, "XPM"))
2666 codec_index = MM_IMAGE_CODEC_XPM;
2668 _mmcam_dbg_log("image codec index %d", codec_index);
2674 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2676 int mux_index = MM_FILE_FORMAT_INVALID;
2679 _mmcam_dbg_err("name is NULL");
2680 return MM_FILE_FORMAT_INVALID;
2683 if (!strcmp(name, "3GP"))
2684 mux_index = MM_FILE_FORMAT_3GP;
2685 else if (!strcmp(name, "AMR"))
2686 mux_index = MM_FILE_FORMAT_AMR;
2687 else if (!strcmp(name, "MP4"))
2688 mux_index = MM_FILE_FORMAT_MP4;
2689 else if (!strcmp(name, "AAC"))
2690 mux_index = MM_FILE_FORMAT_AAC;
2691 else if (!strcmp(name, "MP3"))
2692 mux_index = MM_FILE_FORMAT_MP3;
2693 else if (!strcmp(name, "OGG"))
2694 mux_index = MM_FILE_FORMAT_OGG;
2695 else if (!strcmp(name, "WAV"))
2696 mux_index = MM_FILE_FORMAT_WAV;
2697 else if (!strcmp(name, "AVI"))
2698 mux_index = MM_FILE_FORMAT_AVI;
2699 else if (!strcmp(name, "WMA"))
2700 mux_index = MM_FILE_FORMAT_WMA;
2701 else if (!strcmp(name, "WMV"))
2702 mux_index = MM_FILE_FORMAT_WMV;
2703 else if (!strcmp(name, "MID"))
2704 mux_index = MM_FILE_FORMAT_MID;
2705 else if (!strcmp(name, "MMF"))
2706 mux_index = MM_FILE_FORMAT_MMF;
2707 else if (!strcmp(name, "MATROSKA"))
2708 mux_index = MM_FILE_FORMAT_MATROSKA;
2709 else if (!strcmp(name, "M2TS"))
2710 mux_index = MM_FILE_FORMAT_M2TS;
2712 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2719 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2723 mmf_return_val_if_fail(name, -1);
2725 switch (conf_category) {
2726 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2727 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2729 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2730 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2732 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2733 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2735 case CONFIGURE_CATEGORY_MAIN_MUX:
2736 fmt = _mmcamcorder_get_mux_format(handle, name);
2739 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2746 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2748 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2749 camera_conf* configure_info = NULL;
2751 int total_count = 0;
2753 mmf_return_val_if_fail(hcamcorder, 0);
2755 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2757 configure_info = hcamcorder->conf_main;
2759 if (configure_info->info[conf_category]) {
2762 const char *name = NULL;
2763 int count = configure_info->info[conf_category]->count;
2764 conf_detail *info = configure_info->info[conf_category];
2766 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2768 if (count <= 0 || !info)
2771 arr = (int*) g_malloc0(count * sizeof(int));
2773 _mmcam_dbg_err("malloc failed : %zu", count * sizeof(int));
2777 for (i = 0 ; i < count ; i++) {
2778 if (info->detail_info[i] == NULL)
2781 name = ((type_element*)(info->detail_info[i]))->name;
2782 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2784 arr[total_count++] = fmt;
2786 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/