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
47 char *get_new_string(char* src_string)
49 return g_strdup(src_string);
52 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info)
55 int info_table_size = sizeof(conf_info_table);
57 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
59 mmf_return_val_if_fail(hcamcorder && configure_info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
61 /* Videosrc element default value */
62 static type_element _videosrc_element_default = {
71 /* Audiosrc element default value */
72 static type_int ___audiosrc_default_channel = {"Channel", 1};
73 static type_int ___audiosrc_default_bitrate = {"BitRate", 8000};
74 static type_int ___audiosrc_default_depth = {"Depth", 16};
75 static type_int ___audiosrc_default_blocksize = {"BlockSize", 1280};
76 static type_int* __audiosrc_default_int_array[] = {
77 &___audiosrc_default_channel,
78 &___audiosrc_default_bitrate,
79 &___audiosrc_default_depth,
80 &___audiosrc_default_blocksize,
82 static type_string ___audiosrc_default_device = {"Device", "default"};
83 static type_string* __audiosrc_default_string_array[] = {
84 &___audiosrc_default_device,
86 static type_element _audiosrc_element_default = {
89 __audiosrc_default_int_array,
90 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
91 __audiosrc_default_string_array,
92 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
95 static type_element _audiomodemsrc_element_default = {
96 "AudiomodemsrcElement",
98 __audiosrc_default_int_array,
99 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
100 __audiosrc_default_string_array,
101 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
105 /* Videosink element default value */
106 static type_int ___videosink_default_display_id = {"display-id", 3};
107 static type_int ___videosink_default_x = {"x", 0};
108 static type_int ___videosink_default_y = {"y", 0};
109 static type_int ___videosink_default_width = {"width", 800};
110 static type_int ___videosink_default_height = {"height", 480};
111 static type_int ___videosink_default_rotation = {"rotation", 1};
112 static type_int* __videosink_default_int_array[] = {
113 &___videosink_default_display_id,
114 &___videosink_default_x,
115 &___videosink_default_y,
116 &___videosink_default_width,
117 &___videosink_default_height,
118 &___videosink_default_rotation,
120 static type_string* __videosink_default_string_array[] = {NULL};
121 static type_element _videosink_element_overlay_default = {
122 "VideosinkElementOverlay",
124 __videosink_default_int_array,
125 sizeof(__videosink_default_int_array) / sizeof(type_int*),
126 __videosink_default_string_array,
127 sizeof(__videosink_default_string_array) / sizeof(type_string*),
129 static type_element _videosink_element_evas_default = {
130 "VideosinkElementEvas",
132 __videosink_default_int_array,
133 sizeof(__videosink_default_int_array) / sizeof(type_int*),
134 __videosink_default_string_array,
135 sizeof(__videosink_default_string_array) / sizeof(type_string*),
137 static type_element _videosink_element_gl_default = {
138 "VideosinkElementGL",
140 __videosink_default_int_array,
141 sizeof(__videosink_default_int_array) / sizeof(type_int*),
142 __videosink_default_string_array,
143 sizeof(__videosink_default_string_array) / sizeof(type_string*),
145 static type_element _videosink_element_remote_default = {
146 "VideosinkElementRemote",
148 __videosink_default_int_array,
149 sizeof(__videosink_default_int_array) / sizeof(type_int*),
150 __videosink_default_string_array,
151 sizeof(__videosink_default_string_array) / sizeof(type_string*),
153 static type_element _videosink_element_null_default = {
154 "VideosinkElementNull",
156 __videosink_default_int_array,
157 sizeof(__videosink_default_int_array) / sizeof(type_int*),
158 __videosink_default_string_array,
159 sizeof(__videosink_default_string_array) / sizeof(type_string*),
162 /* Videoscale element default value */
163 static type_element _videoscale_element_default = {
172 /* Videoconvert element default value */
173 static type_element _videoconvert_element_default = {
174 "VideoconvertElement",
182 /* H.264 decoder element default value */
183 static type_element _videodecoder_element_h264_default = {
184 "VideodecoderElementH264",
192 /* Record sink element default value */
193 static type_element _recordsink_element_default = {
202 /* H263 element default value */
203 static type_element _h263_element_default = {
212 /* H264 element default value */
213 static type_element _h264_element_default = {
222 /* H26L element default value */
223 static type_element _h26l_element_default = {
232 /* MPEG4 element default value */
233 static type_element _mpeg4_element_default = {
242 /* MPEG1 element default value */
243 static type_element _mpeg1_element_default = {
252 /* THEORA element default value */
253 static type_element _theora_element_default = {
262 /* AMR element default value */
263 static type_element _amr_element_default = {
272 /* G723_1 element default value */
273 static type_element _g723_1_element_default = {
282 /* MP3 element default value */
283 static type_element _mp3_element_default = {
292 /* AAC element default value */
293 static type_element _aac_element_default = {
302 /* MMF element default value */
303 static type_element _mmf_element_default = {
312 /* ADPCM element default value */
313 static type_element _adpcm_element_default = {
315 "avenc_adpcm_ima_qt",
322 /* WAVE element default value */
323 static type_element _wave_element_default = {
332 /* VORBIS element default value */
333 static type_element _vorbis_element_default = {
342 /* MIDI element default value */
343 static type_element _midi_element_default = {
352 /* IMELODY element default value */
353 static type_element _imelody_element_default = {
362 /* JPEG element default value */
363 static type_element _jpeg_element_default = {
372 /* PNG element default value */
373 static type_element _png_element_default = {
382 /* BMP element default value */
383 static type_element _bmp_element_default = {
392 /* WBMP element default value */
393 static type_element _wbmp_element_default = {
402 /* TIFF element default value */
403 static type_element _tiff_element_default = {
412 /* PCX element default value */
413 static type_element _pcx_element_default = {
422 /* GIF element default value */
423 static type_element _gif_element_default = {
432 /* ICO element default value */
433 static type_element _ico_element_default = {
442 /* RAS element default value */
443 static type_element _ras_element_default = {
452 /* TGA element default value */
453 static type_element _tga_element_default = {
462 /* XBM element default value */
463 static type_element _xbm_element_default = {
472 /* XPM element default value */
473 static type_element _xpm_element_default = {
482 /* 3GP element default value */
483 static type_element _3gp_element_default = {
492 /* AMR mux element default value */
493 static type_element _amrmux_element_default = {
502 /* MP4 element default value */
503 static type_element _mp4_element_default = {
512 /* AAC mux element default value */
513 static type_element _aacmux_element_default = {
522 /* MP3 mux element default value */
523 static type_element _mp3mux_element_default = {
532 /* OGG element default value */
533 static type_element _ogg_element_default = {
542 /* WAV element default value */
543 static type_element _wav_element_default = {
552 /* AVI element default value */
553 static type_element _avi_element_default = {
562 /* WMA element default value */
563 static type_element _wma_element_default = {
572 /* WMV element default value */
573 static type_element _wmv_element_default = {
582 /* MID element default value */
583 static type_element _mid_element_default = {
592 /* MMF mux element default value */
593 static type_element _mmfmux_element_default = {
602 /* MATROSKA element default value */
603 static type_element _matroska_element_default = {
612 /* M2TS element default value */
613 static type_element _m2ts_element_default = {
622 /* [General] matching table */
623 static conf_info_table conf_main_general_table[] = {
624 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
625 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
626 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
627 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
630 /* [VideoInput] matching table */
631 static conf_info_table conf_main_video_input_table[] = {
632 { "UseConfCtrl", CONFIGURE_VALUE_INT, {.value_int = 1} },
633 { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {NULL} },
634 { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {NULL} },
635 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
636 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
637 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
638 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
639 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
640 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
643 /* [AudioInput] matching table */
644 static conf_info_table conf_main_audio_input_table[] = {
645 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
646 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
647 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
648 { "AudioBufferInterval", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_AUDIO_BUFFER_INTERVAL} },
651 /* [VideoOutput] matching table */
652 static conf_info_table conf_main_video_output_table[] = {
653 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
654 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
655 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
656 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
657 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
658 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
659 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
660 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
661 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
662 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
663 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
664 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
665 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
666 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
669 /* [Capture] matching table */
670 static conf_info_table conf_main_capture_table[] = {
671 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
673 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
674 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
677 /* [Record] matching table */
678 static conf_info_table conf_main_record_table[] = {
679 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
680 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
681 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
682 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
683 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
684 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
685 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
686 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
688 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
689 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
692 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
693 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
694 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
695 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
696 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
697 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
700 /* [VideoEncoder] matching table */
701 static conf_info_table conf_main_video_encoder_table[] = {
702 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
703 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
704 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
705 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
706 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
707 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
710 /* [AudioEncoder] matching table */
711 static conf_info_table conf_main_audio_encoder_table[] = {
712 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
713 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
714 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
715 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
716 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
717 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
718 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
719 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
720 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
721 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
724 /* [ImageEncoder] matching table */
725 static conf_info_table conf_main_image_encoder_table[] = {
726 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
727 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
728 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
729 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
730 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
731 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
732 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
733 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
734 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
735 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
736 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
737 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
740 /* [Mux] matching table */
741 static conf_info_table conf_main_mux_table[] = {
742 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
743 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
744 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
745 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
746 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
747 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
748 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
749 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
750 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
751 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
752 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
753 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
754 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
755 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
763 /* [Camera] matching table */
764 static conf_info_table conf_ctrl_camera_table[] = {
765 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
766 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
767 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
768 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
769 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
770 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
771 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
776 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
777 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
778 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
779 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
781 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
782 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
783 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
784 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
785 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
786 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
789 /* [Strobe] matching table */
790 static conf_info_table conf_ctrl_strobe_table[] = {
791 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
792 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
793 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
796 /* [Effect] matching table */
797 static conf_info_table conf_ctrl_effect_table[] = {
798 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
799 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
800 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
801 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
802 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
803 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
804 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
805 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
806 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
807 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
808 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 /* [Photograph] matching table */
813 static conf_info_table conf_ctrl_photograph_table[] = {
814 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
816 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
817 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
819 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
820 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
821 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
823 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
824 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
825 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
826 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
827 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
828 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
829 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
830 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
831 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
832 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
835 /* [Capture] matching table */
836 static conf_info_table conf_ctrl_capture_table[] = {
837 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
838 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
839 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
840 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
841 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
842 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
845 /* [Detect] matching table */
846 static conf_info_table conf_ctrl_detect_table[] = {
847 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
848 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
849 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
850 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
853 _mmcam_dbg_log("Entered...");
855 if (type == CONFIGURE_TYPE_MAIN) {
856 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
857 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
858 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
859 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
860 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
861 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
862 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
863 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
864 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
865 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
867 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
868 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
869 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
870 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
871 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
872 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
873 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
874 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
875 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
876 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
878 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
880 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
881 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
882 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
883 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
884 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
885 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
887 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
888 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
889 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
890 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
891 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
892 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
894 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
897 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
898 if (configure_info->info == NULL) {
899 _mmcam_dbg_err("category info alloc failed : type %d", type);
900 return MM_ERROR_CAMCORDER_LOW_MEMORY;
903 _mmcam_dbg_log("Done.");
905 return MM_ERROR_NONE;
909 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
911 int ret = MM_ERROR_NONE;
913 char conf_path[60] = {'\0',};
915 _mmcam_dbg_log("Opening...[%s]", ConfFile);
917 mmf_return_val_if_fail(ConfFile, FALSE);
919 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
920 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
922 fp = fopen(conf_path, "r");
924 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
926 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
927 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
928 fp = fopen(conf_path, "r");
930 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
934 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
938 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
940 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
943 _mmcam_dbg_log("Leave...");
949 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
951 const unsigned int BUFFER_NUM_DETAILS = 256;
952 const unsigned int BUFFER_NUM_TOKEN = 20;
953 size_t BUFFER_LENGTH_STRING = 256;
954 const char* delimiters = " |=,\t\n";
956 int ret = MM_ERROR_NONE;
958 int count_main_category = 0;
959 int count_details = 0;
964 char *buffer_string = NULL;
965 char *buffer_details[BUFFER_NUM_DETAILS];
966 char *buffer_token[BUFFER_NUM_TOKEN];
968 char *category_name = NULL;
969 char *detail_string = NULL;
970 char *user_ptr = NULL;
972 camera_conf *new_conf = NULL;
976 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
978 *configure_info = NULL;
980 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
981 if (new_conf == NULL) {
982 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
983 return MM_ERROR_CAMCORDER_LOW_MEMORY;
986 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
987 if (buffer_string == NULL) {
988 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
990 return MM_ERROR_CAMCORDER_LOW_MEMORY;
993 new_conf->type = type;
995 ret = _mmcamcorder_conf_init(handle, type, new_conf);
996 if (ret != MM_ERROR_NONE) {
997 _mmcam_dbg_err("conf init failed 0x%x", ret);
999 g_free(buffer_string);
1003 *configure_info = new_conf;
1006 count_main_category = 0;
1009 if (read_main == 0) {
1010 length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
1011 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1014 token = strtok_r(buffer_string, delimiters, &user_ptr);
1016 if ((token) && (token[0] == ';') && (length_read > -1)) {
1017 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1022 /*_mmcam_dbg_log("token : [%s]", token);*/
1023 buffer_token[count_token] = token;
1025 token = strtok_r(NULL, delimiters, &user_ptr);
1028 if (count_token == 0)
1035 if (*buffer_token[0] == ';') {
1036 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1039 else if (*buffer_token[0] == '[') {
1040 category_name = get_new_string(buffer_token[0]);
1041 if (category_name == NULL) {
1042 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1046 count_main_category++;
1050 length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp);
1051 /*_mmcam_dbg_log("Read Detail Line : [%s], read length : [%d]", buffer_string, length_read);*/
1053 detail_string = get_new_string(buffer_string);
1055 token = strtok_r(buffer_string, delimiters, &user_ptr);
1057 if (token && token[0] != ';' && length_read > -1) {
1058 /*_mmcam_dbg_log("token : [%s]", token);*/
1059 if (token[0] == '[') {
1061 buffer_token[0] = token;
1062 SAFE_G_FREE(detail_string);
1066 buffer_details[count_details++] = detail_string;
1068 SAFE_G_FREE(detail_string);
1072 /*_mmcam_dbg_log("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);*/
1074 if (count_details == 0) {
1075 _mmcam_dbg_warn("category %s has no detail value... skip this category...", category_name);
1076 SAFE_G_FREE(category_name);
1083 if (type == CONFIGURE_TYPE_MAIN) {
1084 if (!strcmp("[General]", category_name)) {
1085 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1086 } else if (!strcmp("[VideoInput]", category_name)) {
1087 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1088 } else if (!strcmp("[AudioInput]", category_name)) {
1089 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1090 } else if (!strcmp("[VideoOutput]", category_name)) {
1091 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1092 } else if (!strcmp("[Capture]", category_name)) {
1093 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1094 } else if (!strcmp("[Record]", category_name)) {
1095 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1096 } else if (!strcmp("[VideoEncoder]", category_name)) {
1097 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1098 } else if (!strcmp("[AudioEncoder]", category_name)) {
1099 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1100 } else if (!strcmp("[ImageEncoder]", category_name)) {
1101 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1102 } else if (!strcmp("[Mux]", category_name)) {
1103 category = CONFIGURE_CATEGORY_MAIN_MUX;
1106 if (!strcmp("[Camera]", category_name)) {
1107 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1108 } else if (!strcmp("[Strobe]", category_name)) {
1109 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1110 } else if (!strcmp("[Effect]", category_name)) {
1111 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1112 } else if (!strcmp("[Photograph]", category_name)) {
1113 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1114 } else if (!strcmp("[Capture]", category_name)) {
1115 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1116 } else if (!strcmp("[Detect]", category_name)) {
1117 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);
1132 for (i = 0 ; i < count_details ; i++) {
1133 SAFE_G_FREE(buffer_details[i]);
1138 SAFE_G_FREE(category_name);
1141 /* (*configure_info) = new_conf; */
1143 SAFE_G_FREE(buffer_string);
1145 /*_mmcam_dbg_log("Done.");*/
1147 return MM_ERROR_NONE;
1151 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1156 int type = CONFIGURE_VALUE_INT;
1158 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1159 camera_conf *temp_conf = (*configure_info);
1161 type_int2 *temp_int = NULL;
1162 type_int_range *temp_int_range = NULL;
1163 type_int_array *temp_int_array = NULL;
1164 type_int_pair_array *temp_int_pair_array = NULL;
1165 type_string2 *temp_string = NULL;
1166 type_string_array *temp_string_array = NULL;
1167 type_element2 *temp_element = NULL;
1169 _mmcam_dbg_log("Entered...");
1171 mmf_return_if_fail(temp_conf);
1173 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1174 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1176 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1178 for (i = 0 ; i < category_num ; i++) {
1179 if (temp_conf->info[i]) {
1180 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1181 if (temp_conf->info[i]->detail_info[j] == NULL)
1184 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1186 case CONFIGURE_VALUE_INT:
1187 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1188 SAFE_G_FREE(temp_int->name);
1190 case CONFIGURE_VALUE_INT_RANGE:
1191 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1192 SAFE_G_FREE(temp_int_range->name);
1194 case CONFIGURE_VALUE_INT_ARRAY:
1195 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1196 SAFE_G_FREE(temp_int_array->name);
1197 SAFE_G_FREE(temp_int_array->value);
1199 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1200 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1201 SAFE_G_FREE(temp_int_pair_array->name);
1202 SAFE_G_FREE(temp_int_pair_array->value[0]);
1203 SAFE_G_FREE(temp_int_pair_array->value[1]);
1205 case CONFIGURE_VALUE_STRING:
1206 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1207 SAFE_G_FREE(temp_string->name);
1208 SAFE_G_FREE(temp_string->value);
1210 case CONFIGURE_VALUE_STRING_ARRAY:
1211 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1212 SAFE_G_FREE(temp_string_array->name);
1213 if (temp_string_array->value) {
1214 count = temp_string_array->count;
1215 for (k = 0 ; k < count ; k++) {
1216 SAFE_G_FREE(temp_string_array->value[k]);
1219 SAFE_G_FREE(temp_string_array->value);
1221 SAFE_G_FREE(temp_string_array->default_value);
1223 case CONFIGURE_VALUE_ELEMENT:
1224 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1225 SAFE_G_FREE(temp_element->name);
1226 SAFE_G_FREE(temp_element->element_name);
1228 if (temp_element->value_int) {
1229 count = temp_element->count_int;
1230 for (k = 0 ; k < count ; k++) {
1231 SAFE_G_FREE(temp_element->value_int[k]->name);
1232 SAFE_G_FREE(temp_element->value_int[k]);
1234 SAFE_G_FREE(temp_element->value_int);
1237 if (temp_element->value_string) {
1238 count = temp_element->count_string;
1239 for (k = 0 ; k < count ; k++) {
1240 SAFE_G_FREE(temp_element->value_string[k]->name);
1241 SAFE_G_FREE(temp_element->value_string[k]->value);
1242 SAFE_G_FREE(temp_element->value_string[k]);
1244 SAFE_G_FREE(temp_element->value_string);
1248 _mmcam_dbg_warn("unknown type %d", type);
1253 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1256 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1258 SAFE_G_FREE(temp_conf->info[i]);
1259 temp_conf->info[i] = NULL;
1263 SAFE_G_FREE((*configure_info)->info);
1264 SAFE_G_FREE((*configure_info));
1266 _mmcam_dbg_log("Done.");
1269 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1272 int count_value = 0;
1274 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1276 if (hcamcorder == NULL) {
1277 _mmcam_dbg_err("handle is NULL");
1281 /*_mmcam_dbg_log("Entered...");*/
1283 mmf_return_val_if_fail(name, FALSE);
1285 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1286 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
1290 /*_mmcam_dbg_log("Number of value : [%d]", count_value);*/
1292 if (type == CONFIGURE_TYPE_MAIN) {
1293 for (i = 0 ; i < count_value ; i++) {
1294 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1295 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1296 /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1301 for (i = 0 ; i < count_value ; i++) {
1302 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1303 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1304 /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1314 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1316 const int BUFFER_NUM_TOKEN = 256;
1323 char *buffer_token[BUFFER_NUM_TOKEN];
1324 char *user_ptr = NULL;
1326 const char *delimiters = " |=,\t\n";
1327 const char *delimiters_sub = " |\t\n";
1328 const char *delimiters_3rd = "|\n";
1330 mmf_return_val_if_fail(info && buffer_details, FALSE);
1332 (*info) = (conf_detail*)g_malloc0(sizeof(conf_detail));
1333 if (*info == NULL) {
1334 _mmcam_dbg_err("info allo failed");
1337 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1338 (*info)->count = count_details;
1340 if ((*info)->detail_info == NULL) {
1341 _mmcam_dbg_err("detail_info alloc failed");
1347 for (i = 0 ; i < count_details ; i++) {
1348 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1350 token = strtok_r(buffer_details[i], delimiters, &user_ptr);
1353 buffer_token[count_token] = token;
1356 (*info)->detail_info[i] = NULL;
1357 _mmcam_dbg_warn("No token... check it.[%s]", buffer_details[i]);
1361 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1362 (*info)->detail_info[i] = NULL;
1363 _mmcam_dbg_warn("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]);
1367 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1368 token = strtok_r(NULL, delimiters, &user_ptr);
1370 buffer_token[count_token] = token;
1371 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1373 token = strtok_r(NULL, delimiters, &user_ptr);
1376 if (count_token < 2) {
1377 (*info)->detail_info[i] = NULL;
1378 _mmcam_dbg_warn("Number of token is too small... check it.[%s]", buffer_details[i]);
1381 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1383 strtok_r(NULL, delimiters_sub, &user_ptr);
1385 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1386 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1388 buffer_token[count_token] = token;
1389 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1391 token = strtok_r(NULL, delimiters_sub, &user_ptr);
1393 } else { /* CONFIGURE_VALUE_STRING */
1394 token = strtok_r(NULL, delimiters_3rd, &user_ptr);
1397 buffer_token[count_token] = token;
1398 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1403 if (count_token < 2) {
1404 (*info)->detail_info[i] = NULL;
1405 _mmcam_dbg_warn("No string value... check it.[%s]", buffer_details[i]);
1410 switch (value_type) {
1411 case CONFIGURE_VALUE_INT:
1415 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1416 if (new_int == NULL) {
1417 _mmcam_dbg_err("allocation failed");
1420 new_int->name = get_new_string(buffer_token[0]);
1421 new_int->value = atoi(buffer_token[1]);
1422 (*info)->detail_info[i] = (void*)new_int;
1423 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1426 case CONFIGURE_VALUE_INT_RANGE:
1428 type_int_range* new_int_range;
1430 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1431 if (new_int_range == NULL) {
1432 _mmcam_dbg_err("allocation failed");
1435 new_int_range->name = get_new_string(buffer_token[0]);
1436 new_int_range->min = atoi(buffer_token[1]);
1437 new_int_range->max = atoi(buffer_token[2]);
1438 new_int_range->default_value = atoi(buffer_token[3]);
1439 (*info)->detail_info[i] = (void*)new_int_range;
1441 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1442 new_int_range->name,
1445 new_int_range->default_value);
1449 case CONFIGURE_VALUE_INT_ARRAY:
1451 int count_value = count_token - 2;
1452 type_int_array* new_int_array;
1454 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1455 if (new_int_array == NULL) {
1456 _mmcam_dbg_err("allocation failed");
1459 new_int_array->name = get_new_string(buffer_token[0]);
1460 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1461 if (new_int_array->value == NULL) {
1462 SAFE_G_FREE(new_int_array->name);
1463 SAFE_G_FREE(new_int_array);
1464 _mmcam_dbg_err("allocation failed");
1467 new_int_array->count = count_value;
1469 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1470 for (j = 0 ; j < count_value ; j++) {
1471 new_int_array->value[j] = atoi(buffer_token[j+1]);
1472 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1475 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1476 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1478 (*info)->detail_info[i] = (void*)new_int_array;
1481 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1483 int count_value = (count_token - 3) >> 1;
1484 type_int_pair_array* new_int_pair_array;
1486 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1487 if (new_int_pair_array == NULL) {
1488 _mmcam_dbg_err("allocation failed");
1491 new_int_pair_array->name = get_new_string(buffer_token[0]);
1492 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1493 if (new_int_pair_array->value[0] == NULL) {
1494 SAFE_G_FREE(new_int_pair_array->name);
1495 SAFE_G_FREE(new_int_pair_array);
1496 _mmcam_dbg_err("allocation failed");
1499 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1500 if (new_int_pair_array->value[1] == NULL) {
1501 SAFE_G_FREE(new_int_pair_array->value[0]);
1502 SAFE_G_FREE(new_int_pair_array->name);
1503 SAFE_G_FREE(new_int_pair_array);
1504 _mmcam_dbg_err("allocation failed");
1507 new_int_pair_array->count = count_value;
1509 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1510 for (j = 0 ; j < count_value ; j++) {
1511 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1512 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1514 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1515 new_int_pair_array->value[0][j],
1516 new_int_pair_array->value[1][j]);
1520 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1521 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1523 _mmcam_dbg_log(" default value[%d,%d]",
1524 new_int_pair_array->default_value[0],
1525 new_int_pair_array->default_value[1]);
1527 (*info)->detail_info[i] = (void*)new_int_pair_array;
1530 case CONFIGURE_VALUE_STRING:
1532 type_string2* new_string;
1534 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1535 if (new_string == NULL) {
1536 _mmcam_dbg_err("allocation failed");
1539 new_string->name = get_new_string(buffer_token[0]);
1540 new_string->value = get_new_string(buffer_token[1]);
1541 (*info)->detail_info[i] = (void*)new_string;
1543 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1546 case CONFIGURE_VALUE_STRING_ARRAY:
1548 int count_value = count_token - 2;
1549 type_string_array* new_string_array;
1551 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1552 if (new_string_array == NULL)
1555 new_string_array->name = get_new_string(buffer_token[0]);
1556 new_string_array->count = count_value;
1557 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1558 if (new_string_array->value == NULL) {
1559 SAFE_G_FREE(new_string_array->name);
1560 SAFE_G_FREE(new_string_array);
1561 _mmcam_dbg_err("allocation failed");
1564 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1565 for (j = 0 ; j < count_value ; j++) {
1566 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1567 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1570 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1571 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1572 (*info)->detail_info[i] = (void*)new_string_array;
1575 case CONFIGURE_VALUE_ELEMENT:
1577 type_element2* new_element;
1579 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1580 if (new_element == NULL) {
1581 _mmcam_dbg_err("allocation failed");
1584 new_element->name = get_new_string(buffer_token[0]);
1585 new_element->element_name = get_new_string(buffer_token[1]);
1586 new_element->count_int = atoi(buffer_token[2]);
1587 new_element->value_int = NULL;
1588 new_element->count_string = atoi(buffer_token[3]);
1589 new_element->value_string = NULL;
1591 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1592 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1595 /* add int values */
1596 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1597 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1598 if (new_element->value_int) {
1599 for (j = 0 ; j < new_element->count_int ; j++) {
1600 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1601 if (new_element->value_int[j]) {
1602 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1603 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1605 _mmcam_dbg_err("allocation failed");
1608 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1609 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1613 _mmcam_dbg_err("allocation failed");
1616 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1617 new_element->value_int = NULL;
1620 /* add string values */
1621 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1622 new_element->count_int >= 0 && new_element->count_int <= 30) {
1623 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1624 if (new_element->value_string) {
1625 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1626 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1627 if (new_element->value_string[j-new_element->count_int]) {
1628 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1629 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1631 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1632 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);
1635 _mmcam_dbg_err("allocation failed");
1639 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1642 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1643 new_element->value_string = NULL;
1646 (*info)->detail_info[i] = (void*)new_element;
1658 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1663 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1665 mmf_return_val_if_fail(configure_info, FALSE);
1666 mmf_return_val_if_fail(name, FALSE);
1668 if (configure_info->info[category]) {
1669 count = configure_info->info[category]->count;
1670 info = configure_info->info[category];
1672 for (i = 0 ; i < count ; i++) {
1673 if (info->detail_info[i] == NULL)
1676 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1677 *value = ((type_int*)(info->detail_info[i]))->value;
1678 /* _mmcam_dbg_log("Get[%s] int[%d]", name, *value); */
1684 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1685 /*_mmcam_dbg_log("Get[%s] int[%d]", name, *value);*/
1689 _mmcam_dbg_err("Faild to get int... check it...Category[%d],Name[%s]", category, name);
1695 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1700 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1702 mmf_return_val_if_fail(configure_info, FALSE);
1703 mmf_return_val_if_fail(name, FALSE);
1705 if (configure_info->info[category]) {
1706 count = configure_info->info[category]->count;
1707 info = configure_info->info[category];
1709 for (i = 0 ; i < count ; i++) {
1710 if (info->detail_info[i] == NULL)
1713 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1714 *value = (type_int_range*)(info->detail_info[i]);
1716 _mmcam_dbg_log("Get[%s] int range - min[%d],max[%d],default[%d]",
1717 name, (*value)->min, (*value)->max, (*value)->default_value);
1726 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1732 _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1737 /*_mmcam_dbg_log("Entered... category[%d],name[%s]", category, name);*/
1739 mmf_return_val_if_fail(configure_info, FALSE);
1740 mmf_return_val_if_fail(name, FALSE);
1742 if (configure_info->info[category]) {
1743 count = configure_info->info[category]->count;
1744 info = configure_info->info[category];
1746 for (i = 0 ; i < count ; i++) {
1747 if (info->detail_info[i] == NULL)
1750 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1751 *value = (type_int_array*)(info->detail_info[i]);
1753 _mmcam_dbg_log("Get[%s] int array - [%x],count[%d],default[%d]",
1754 name, (*value)->value, (*value)->count, (*value)->default_value);
1763 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1769 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1774 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1776 mmf_return_val_if_fail(configure_info, FALSE);
1777 mmf_return_val_if_fail(name, FALSE);
1779 if (configure_info->info[category]) {
1780 count = configure_info->info[category]->count;
1781 info = configure_info->info[category];
1783 for (i = 0 ; i < count ; i++) {
1784 if (info->detail_info[i] == NULL)
1787 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1788 *value = (type_int_pair_array*)(info->detail_info[i]);
1790 _mmcam_dbg_log("Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1791 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1792 (*value)->default_value[0], (*value)->default_value[1]);
1801 /*_mmcam_dbg_warn("Faild to get int pair array... check it...Category[%d],Name[%s]", category, name);*/
1806 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1811 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1813 mmf_return_val_if_fail(configure_info, FALSE);
1814 mmf_return_val_if_fail(name, FALSE);
1816 if (configure_info->info[category]) {
1817 count = configure_info->info[category]->count;
1818 info = configure_info->info[category];
1820 for (i = 0 ; i < count ; i++) {
1821 if (info->detail_info[i] == NULL)
1824 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1825 *value = ((type_string*)(info->detail_info[i]))->value;
1826 /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
1832 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1833 /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/
1837 _mmcam_dbg_err("Faild to get string... check it...Category[%d],Name[%s]", category, name);
1843 _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1848 /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */
1850 mmf_return_val_if_fail(configure_info, FALSE);
1851 mmf_return_val_if_fail(name, FALSE);
1853 if (configure_info->info[category]) {
1854 count = configure_info->info[category]->count;
1855 info = configure_info->info[category];
1857 for (i = 0 ; i < count ; i++) {
1858 if (info->detail_info[i] == NULL)
1861 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1862 *value = (type_string_array*)(info->detail_info[i]);
1864 _mmcam_dbg_log("Get[%s] string array - [%x],count[%d],default[%s]",
1865 name, (*value)->value, (*value)->count, (*value)->default_value);
1874 /*_mmcam_dbg_warn("Faild to get string array... check it...Category[%d],Name[%s]", category, name);*/
1879 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1884 /* _mmcam_dbg_log("Entered... category[%d], ame[%s]", category, name); */
1886 mmf_return_val_if_fail(configure_info, FALSE);
1887 mmf_return_val_if_fail(name, FALSE);
1889 if (configure_info->info[category]) {
1890 count = configure_info->info[category]->count;
1891 info = configure_info->info[category];
1893 for (i = 0 ; i < count ; i++) {
1894 if (info->detail_info[i] == NULL)
1897 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1898 *element = (type_element*)(info->detail_info[i]);
1899 /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
1905 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1906 /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */
1910 _mmcam_dbg_warn("Faild to get element name... check it...Category[%d],Name[%s]", category, name);
1916 _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1918 /* _mmcam_dbg_log("Entered..."); */
1920 mmf_return_val_if_fail(element, FALSE);
1922 *value = element->element_name;
1924 /* _mmcam_dbg_log("Get element name : [%s]", *value); */
1930 _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1934 /* _mmcam_dbg_log( "Entered..." ); */
1936 mmf_return_val_if_fail(element, FALSE);
1937 mmf_return_val_if_fail(name, FALSE);
1939 for (i = 0 ; i < element->count_int ; i++) {
1940 if (!strcmp(element->value_int[i]->name, name)) {
1941 *value = element->value_int[i]->value;
1942 /* _mmcam_dbg_log("Get[%s] element int[%d]", name, *value); */
1947 _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
1948 element->name, name, element->count_int);
1954 _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1958 /* _mmcam_dbg_log("Entered..."); */
1960 mmf_return_val_if_fail(element, FALSE);
1961 mmf_return_val_if_fail(name, FALSE);
1963 for (i = 0 ; i < element->count_string ; i++) {
1964 if (!strcmp(element->value_string[i]->name, name)) {
1965 *value = element->value_string[i]->value;
1966 /*_mmcam_dbg_log("Get[%s] element string[%s]", name, *value);*/
1971 _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
1972 element->name, name, element->count_string);
1978 _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1982 /* _mmcam_dbg_log("Entered..."); */
1984 mmf_return_val_if_fail(gst, FALSE);
1985 mmf_return_val_if_fail(element, FALSE);
1987 if (element->count_int == 0) {
1988 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
1990 if (element->value_int == NULL) {
1991 _mmcam_dbg_warn("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1995 for (i = 0 ; i < element->count_int ; i++) {
1996 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1999 _mmcam_dbg_log("Element[%s] Set[%s] -> integer[%d]",
2000 element->element_name,
2001 element->value_int[i]->name,
2002 element->value_int[i]->value);
2007 if (element->count_string == 0) {
2008 _mmcam_dbg_log("There is no string property to set in INI file[%s].", element->name);
2010 if (element->value_string == NULL) {
2011 _mmcam_dbg_warn("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
2015 for (i = 0 ; i < element->count_string ; i++) {
2016 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
2018 _mmcam_dbg_log("Element[%s] Set[%s] -> string[%s]",
2019 element->element_name,
2020 element->value_string[i]->name,
2021 element->value_string[i]->value);
2025 /* _mmcam_dbg_log( "Done." ); */
2031 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
2034 int count_value = 0;
2036 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2038 if (hcamcorder == NULL) {
2039 _mmcam_dbg_err("handle is NULL");
2043 /* _mmcam_dbg_log("Entered..."); */
2045 mmf_return_val_if_fail(name, FALSE);
2047 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2048 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2052 if (type == CONFIGURE_TYPE_MAIN) {
2053 for (i = 0 ; i < count_value ; i++) {
2054 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2055 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2060 for (i = 0 ; i < count_value ; i++) {
2061 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2062 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2068 _mmcam_dbg_err("Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2073 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2076 int count_value = 0;
2078 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2080 if (hcamcorder == NULL) {
2081 _mmcam_dbg_err("handle is NULL");
2085 /* _mmcam_dbg_log("Entered..."); */
2087 mmf_return_val_if_fail(name, FALSE);
2089 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2090 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2094 if (type == CONFIGURE_TYPE_MAIN) {
2095 for (i = 0 ; i < count_value ; i++) {
2096 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2097 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2098 /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
2103 for (i = 0 ; i < count_value ; i++) {
2104 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2105 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2106 /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/
2112 _mmcam_dbg_warn("Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2117 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2120 int count_value = 0;
2122 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2124 if (hcamcorder == NULL) {
2125 _mmcam_dbg_err("handle is NULL");
2129 /* _mmcam_dbg_log("Entered..."); */
2131 mmf_return_val_if_fail(name, FALSE);
2133 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2134 _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category);
2138 if (type == CONFIGURE_TYPE_MAIN) {
2139 for (i = 0 ; i < count_value ; i++) {
2140 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2141 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2142 _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
2147 for (i = 0 ; i < count_value ; i++) {
2148 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2149 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2150 _mmcam_dbg_log("Get[%s] element[%p]", name, *element);
2156 _mmcam_dbg_warn("Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name);
2161 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2163 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2165 if (hcamcorder == NULL) {
2166 _mmcam_dbg_err("handle is NULL");
2171 mmf_return_val_if_fail(conf_main_category_size, FALSE);
2172 mmf_return_val_if_fail(conf_ctrl_category_size, FALSE);
2175 if (type == CONFIGURE_TYPE_MAIN) {
2176 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2178 *size = (int)hcamcorder->conf_main_category_size[category];
2180 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2182 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2189 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2191 int i, j, k, type, category_type;
2194 type_int_range *temp_int_range;
2195 type_int_array *temp_int_array;
2196 type_int_pair_array *temp_int_pair_array;
2197 type_string *temp_string;
2198 type_element *temp_element;
2200 g_print("[ConfigureInfoPrint] : Entered.\n");
2202 mmf_return_if_fail(*configure_info);
2204 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2205 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2207 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2209 for (i = 0 ; i < category_type ; i++) {
2211 if ((*configure_info)->info[i]) {
2212 g_print("[ConfigureInfo] : Category [%d]\n", i);
2214 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2216 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2218 case CONFIGURE_VALUE_INT:
2219 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2220 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2222 case CONFIGURE_VALUE_INT_RANGE:
2223 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2224 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2225 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2227 case CONFIGURE_VALUE_INT_ARRAY:
2228 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2229 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2230 temp_int_array->name, temp_int_array->default_value);
2232 for (k = 0 ; k < temp_int_array->count ; k++)
2233 g_print("[%d] ", temp_int_array->value[k]);
2237 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2238 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2239 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2240 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2242 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2243 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2247 case CONFIGURE_VALUE_STRING:
2248 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2249 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2251 case CONFIGURE_VALUE_ELEMENT:
2252 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2253 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2255 for (k = 0 ; k < temp_element->count_int ; k++)
2256 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2258 for (k = 0 ; k < temp_element->count_string ; k++)
2259 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2263 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);
2267 g_print("[ConfigureInfo] : Failed to get value type.");
2273 g_print("[ConfigureInfoPrint] : Done.\n");
2277 static type_element *
2278 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2280 type_element *telement = NULL;
2281 const char *codec_type_str = NULL;
2282 int codec_type = MM_AUDIO_CODEC_INVALID;
2283 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2284 _MMCamcorderSubContext *sc = NULL;
2286 mmf_return_val_if_fail(hcamcorder, NULL);
2287 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2289 mmf_return_val_if_fail(sc, NULL);
2293 /* Check element availability */
2294 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2296 switch (codec_type) {
2297 case MM_AUDIO_CODEC_AMR:
2298 codec_type_str = "AMR";
2300 case MM_AUDIO_CODEC_G723_1:
2301 codec_type_str = "G723_1";
2303 case MM_AUDIO_CODEC_MP3:
2304 codec_type_str = "MP3";
2306 case MM_AUDIO_CODEC_AAC:
2307 codec_type_str = "AAC";
2309 case MM_AUDIO_CODEC_MMF:
2310 codec_type_str = "MMF";
2312 case MM_AUDIO_CODEC_ADPCM:
2313 codec_type_str = "ADPCM";
2315 case MM_AUDIO_CODEC_WAVE:
2316 codec_type_str = "WAVE";
2318 case MM_AUDIO_CODEC_MIDI:
2319 codec_type_str = "MIDI";
2321 case MM_AUDIO_CODEC_IMELODY:
2322 codec_type_str = "IMELODY";
2324 case MM_AUDIO_CODEC_VORBIS:
2325 codec_type_str = "VORBIS";
2328 _mmcam_dbg_err("Not supported audio codec[%d]", codec_type);
2332 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2333 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2341 static type_element *
2342 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2344 type_element *telement = NULL;
2345 const char *codec_type_str = NULL;
2346 int codec_type = MM_VIDEO_CODEC_INVALID;
2347 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2348 _MMCamcorderSubContext *sc = NULL;
2350 mmf_return_val_if_fail(hcamcorder, NULL);
2351 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2353 mmf_return_val_if_fail(sc, NULL);
2357 /* Check element availability */
2358 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2360 switch (codec_type) {
2361 case MM_VIDEO_CODEC_H263:
2362 codec_type_str = "H263";
2364 case MM_VIDEO_CODEC_H264:
2365 codec_type_str = "H264";
2367 case MM_VIDEO_CODEC_H26L:
2368 codec_type_str = "H26L";
2370 case MM_VIDEO_CODEC_MPEG4:
2371 codec_type_str = "MPEG4";
2373 case MM_VIDEO_CODEC_MPEG1:
2374 codec_type_str = "MPEG1";
2376 case MM_VIDEO_CODEC_THEORA:
2377 codec_type_str = "THEORA";
2380 _mmcam_dbg_err("Not supported video codec[%d]", codec_type);
2384 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2385 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2393 static type_element *
2394 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2396 type_element *telement = NULL;
2397 const char *codec_type_str = NULL;
2398 int codec_type = MM_IMAGE_CODEC_INVALID;
2399 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2400 _MMCamcorderSubContext *sc = NULL;
2402 mmf_return_val_if_fail(hcamcorder, NULL);
2403 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2405 mmf_return_val_if_fail(sc, NULL);
2409 /* Check element availability */
2410 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2412 switch (codec_type) {
2413 case MM_IMAGE_CODEC_JPEG:
2414 codec_type_str = "JPEG";
2416 case MM_IMAGE_CODEC_SRW:
2417 codec_type_str = "SRW";
2419 case MM_IMAGE_CODEC_JPEG_SRW:
2420 codec_type_str = "JPEG_SRW";
2422 case MM_IMAGE_CODEC_PNG:
2423 codec_type_str = "PNG";
2425 case MM_IMAGE_CODEC_BMP:
2426 codec_type_str = "BMP";
2428 case MM_IMAGE_CODEC_WBMP:
2429 codec_type_str = "WBMP";
2431 case MM_IMAGE_CODEC_TIFF:
2432 codec_type_str = "TIFF";
2434 case MM_IMAGE_CODEC_PCX:
2435 codec_type_str = "PCX";
2437 case MM_IMAGE_CODEC_GIF:
2438 codec_type_str = "GIF";
2440 case MM_IMAGE_CODEC_ICO:
2441 codec_type_str = "ICO";
2443 case MM_IMAGE_CODEC_RAS:
2444 codec_type_str = "RAS";
2446 case MM_IMAGE_CODEC_TGA:
2447 codec_type_str = "TGA";
2449 case MM_IMAGE_CODEC_XBM:
2450 codec_type_str = "XBM";
2452 case MM_IMAGE_CODEC_XPM:
2453 codec_type_str = "XPM";
2456 _mmcam_dbg_err("Not supported image codec[%d]", codec_type);
2460 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2461 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2469 static type_element *
2470 __mmcamcorder_get_file_format_element(MMHandleType handle)
2472 type_element *telement = NULL;
2473 const char *mux_type_str = NULL;
2474 int file_type = MM_FILE_FORMAT_INVALID;
2475 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2476 _MMCamcorderSubContext *sc = NULL;
2478 mmf_return_val_if_fail(hcamcorder, NULL);
2479 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2481 mmf_return_val_if_fail(sc, NULL);
2485 /* Check element availability */
2486 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2488 switch (file_type) {
2489 case MM_FILE_FORMAT_3GP:
2490 mux_type_str = "3GP";
2492 case MM_FILE_FORMAT_AMR:
2493 mux_type_str = "AMR";
2495 case MM_FILE_FORMAT_MP4:
2496 mux_type_str = "MP4";
2498 case MM_FILE_FORMAT_AAC:
2499 mux_type_str = "AAC";
2501 case MM_FILE_FORMAT_MP3:
2502 mux_type_str = "MP3";
2504 case MM_FILE_FORMAT_OGG:
2505 mux_type_str = "OGG";
2507 case MM_FILE_FORMAT_WAV:
2508 mux_type_str = "WAV";
2510 case MM_FILE_FORMAT_AVI:
2511 mux_type_str = "AVI";
2513 case MM_FILE_FORMAT_WMA:
2514 mux_type_str = "WMA";
2516 case MM_FILE_FORMAT_WMV:
2517 mux_type_str = "WMV";
2519 case MM_FILE_FORMAT_MID:
2520 mux_type_str = "MID";
2522 case MM_FILE_FORMAT_MMF:
2523 mux_type_str = "MMF";
2525 case MM_FILE_FORMAT_MATROSKA:
2526 mux_type_str = "MATROSKA";
2528 case MM_FILE_FORMAT_M2TS:
2529 mux_type_str = "M2TS";
2532 _mmcam_dbg_err("Not supported file format[%d]", file_type);
2536 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2537 CONFIGURE_CATEGORY_MAIN_MUX,
2546 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2548 type_element *telement = NULL;
2550 _mmcam_dbg_log("type:%d", type);
2553 case MM_CAM_AUDIO_ENCODER:
2554 telement = __mmcamcorder_get_audio_codec_element(handle);
2556 case MM_CAM_VIDEO_ENCODER:
2557 telement = __mmcamcorder_get_video_codec_element(handle);
2559 case MM_CAM_IMAGE_ENCODER:
2560 telement = __mmcamcorder_get_image_codec_element(handle);
2562 case MM_CAM_FILE_FORMAT:
2563 telement = __mmcamcorder_get_file_format_element(handle);
2566 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2573 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2575 int codec_index = MM_AUDIO_CODEC_INVALID;
2578 _mmcam_dbg_err("name is NULL");
2579 return MM_AUDIO_CODEC_INVALID;
2582 if (!strcmp(name, "AMR")) {
2583 codec_index = MM_AUDIO_CODEC_AMR;
2584 } else if (!strcmp(name, "G723_1")) {
2585 codec_index = MM_AUDIO_CODEC_G723_1;
2586 } else if (!strcmp(name, "MP3")) {
2587 codec_index = MM_AUDIO_CODEC_MP3;
2588 } else if (!strcmp(name, "AAC")) {
2589 codec_index = MM_AUDIO_CODEC_AAC;
2590 } else if (!strcmp(name, "MMF")) {
2591 codec_index = MM_AUDIO_CODEC_MMF;
2592 } else if (!strcmp(name, "ADPCM")) {
2593 codec_index = MM_AUDIO_CODEC_ADPCM;
2594 } else if (!strcmp(name, "WAVE")) {
2595 codec_index = MM_AUDIO_CODEC_WAVE;
2596 } else if (!strcmp(name, "MIDI")) {
2597 codec_index = MM_AUDIO_CODEC_MIDI;
2598 } else if (!strcmp(name, "IMELODY")) {
2599 codec_index = MM_AUDIO_CODEC_IMELODY;
2600 } else if (!strcmp(name, "VORBIS")) {
2601 codec_index = MM_AUDIO_CODEC_VORBIS;
2604 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2611 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2613 int codec_index = MM_VIDEO_CODEC_INVALID;
2616 _mmcam_dbg_err("name is NULL");
2617 return MM_VIDEO_CODEC_INVALID;
2620 if (!strcmp(name, "H263")) {
2621 codec_index = MM_VIDEO_CODEC_H263;
2622 } else if (!strcmp(name, "H264")) {
2623 codec_index = MM_VIDEO_CODEC_H264;
2624 } else if (!strcmp(name, "H26L")) {
2625 codec_index = MM_VIDEO_CODEC_H26L;
2626 } else if (!strcmp(name, "MPEG4")) {
2627 codec_index = MM_VIDEO_CODEC_MPEG4;
2628 } else if (!strcmp(name, "MPEG1")) {
2629 codec_index = MM_VIDEO_CODEC_MPEG1;
2630 } else if (!strcmp(name, "THEORA")) {
2631 codec_index = MM_VIDEO_CODEC_THEORA;
2634 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2641 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2643 int codec_index = MM_IMAGE_CODEC_INVALID;
2646 _mmcam_dbg_err("name is NULL");
2647 return MM_IMAGE_CODEC_INVALID;
2650 if (!strcmp(name, "JPEG")) {
2651 codec_index = MM_IMAGE_CODEC_JPEG;
2652 } else if (!strcmp(name, "PNG")) {
2653 codec_index = MM_IMAGE_CODEC_PNG;
2654 } else if (!strcmp(name, "BMP")) {
2655 codec_index = MM_IMAGE_CODEC_BMP;
2656 } else if (!strcmp(name, "WBMP")) {
2657 codec_index = MM_IMAGE_CODEC_WBMP;
2658 } else if (!strcmp(name, "TIFF")) {
2659 codec_index = MM_IMAGE_CODEC_TIFF;
2660 } else if (!strcmp(name, "PCX")) {
2661 codec_index = MM_IMAGE_CODEC_PCX;
2662 } else if (!strcmp(name, "GIF")) {
2663 codec_index = MM_IMAGE_CODEC_GIF;
2664 } else if (!strcmp(name, "ICO")) {
2665 codec_index = MM_IMAGE_CODEC_ICO;
2666 } else if (!strcmp(name, "RAS")) {
2667 codec_index = MM_IMAGE_CODEC_RAS;
2668 } else if (!strcmp(name, "TGA")) {
2669 codec_index = MM_IMAGE_CODEC_TGA;
2670 } else if (!strcmp(name, "XBM")) {
2671 codec_index = MM_IMAGE_CODEC_XBM;
2672 } else if (!strcmp(name, "XPM")) {
2673 codec_index = MM_IMAGE_CODEC_XPM;
2676 _mmcam_dbg_log("image codec index %d", codec_index);
2682 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2684 int mux_index = MM_FILE_FORMAT_INVALID;
2687 _mmcam_dbg_err("name is NULL");
2688 return MM_FILE_FORMAT_INVALID;
2691 if (!strcmp(name, "3GP")) {
2692 mux_index = MM_FILE_FORMAT_3GP;
2693 } else if (!strcmp(name, "AMR")) {
2694 mux_index = MM_FILE_FORMAT_AMR;
2695 } else if (!strcmp(name, "MP4")) {
2696 mux_index = MM_FILE_FORMAT_MP4;
2697 } else if (!strcmp(name, "AAC")) {
2698 mux_index = MM_FILE_FORMAT_AAC;
2699 } else if (!strcmp(name, "MP3")) {
2700 mux_index = MM_FILE_FORMAT_MP3;
2701 } else if (!strcmp(name, "OGG")) {
2702 mux_index = MM_FILE_FORMAT_OGG;
2703 } else if (!strcmp(name, "WAV")) {
2704 mux_index = MM_FILE_FORMAT_WAV;
2705 } else if (!strcmp(name, "AVI")) {
2706 mux_index = MM_FILE_FORMAT_AVI;
2707 } else if (!strcmp(name, "WMA")) {
2708 mux_index = MM_FILE_FORMAT_WMA;
2709 } else if (!strcmp(name, "WMV")) {
2710 mux_index = MM_FILE_FORMAT_WMV;
2711 } else if (!strcmp(name, "MID")) {
2712 mux_index = MM_FILE_FORMAT_MID;
2713 } else if (!strcmp(name, "MMF")) {
2714 mux_index = MM_FILE_FORMAT_MMF;
2715 } else if (!strcmp(name, "MATROSKA")) {
2716 mux_index = MM_FILE_FORMAT_MATROSKA;
2717 } else if (!strcmp(name, "M2TS")) {
2718 mux_index = MM_FILE_FORMAT_M2TS;
2721 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2728 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2732 mmf_return_val_if_fail(name, -1);
2734 switch (conf_category) {
2735 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2736 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2738 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2739 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2741 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2742 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2744 case CONFIGURE_CATEGORY_MAIN_MUX:
2745 fmt = _mmcamcorder_get_mux_format(handle, name);
2748 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2755 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2757 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2758 camera_conf* configure_info = NULL;
2760 int total_count = 0;
2762 mmf_return_val_if_fail(hcamcorder, 0);
2764 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2766 configure_info = hcamcorder->conf_main;
2768 if (configure_info->info[conf_category]) {
2771 const char *name = NULL;
2772 int count = configure_info->info[conf_category]->count;
2773 conf_detail *info = configure_info->info[conf_category];
2775 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2777 if (count <= 0 || !info)
2780 arr = (int*) g_malloc0(count * sizeof(int));
2782 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2786 for (i = 0 ; i < count ; i++) {
2787 if (info->detail_info[i] == NULL)
2790 name = ((type_element*)(info->detail_info[i]))->name;
2791 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2793 arr[total_count++] = fmt;
2795 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/