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 -----------------------------------------------------------------------*/
45 char *get_new_string(char* src_string)
47 return g_strdup(src_string);
50 void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
53 int info_table_size = sizeof(conf_info_table);
55 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
57 /* Videosrc element default value */
58 static type_element _videosrc_element_default = {
67 /* Audiosrc element default value */
68 static type_int ___audiosrc_default_channel = { "Channel", 1 };
69 static type_int ___audiosrc_default_bitrate = { "BitRate", 8000 };
70 static type_int ___audiosrc_default_depth = { "Depth", 16 };
71 static type_int ___audiosrc_default_blocksize = { "BlockSize", 1280 };
72 static type_int* __audiosrc_default_int_array[] = {
73 &___audiosrc_default_channel,
74 &___audiosrc_default_bitrate,
75 &___audiosrc_default_depth,
76 &___audiosrc_default_blocksize,
78 static type_string ___audiosrc_default_device = { "Device", "default" };
79 static type_string* __audiosrc_default_string_array[] = {
80 &___audiosrc_default_device,
82 static type_element _audiosrc_element_default = {
85 __audiosrc_default_int_array,
86 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
87 __audiosrc_default_string_array,
88 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
91 static type_element _audiomodemsrc_element_default = {
92 "AudiomodemsrcElement",
94 __audiosrc_default_int_array,
95 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
96 __audiosrc_default_string_array,
97 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
101 /* Videosink element default value */
102 static type_int ___videosink_default_display_id = { "display-id", 3 };
103 static type_int ___videosink_default_x = { "x", 0 };
104 static type_int ___videosink_default_y = { "y", 0 };
105 static type_int ___videosink_default_width = { "width", 800 };
106 static type_int ___videosink_default_height = { "height", 480 };
107 static type_int ___videosink_default_rotation = { "rotation", 1 };
108 static type_int* __videosink_default_int_array[] = {
109 &___videosink_default_display_id,
110 &___videosink_default_x,
111 &___videosink_default_y,
112 &___videosink_default_width,
113 &___videosink_default_height,
114 &___videosink_default_rotation,
116 static type_string* __videosink_default_string_array[] = { NULL };
117 static type_element _videosink_element_overlay_default = {
118 "VideosinkElementOverlay",
120 __videosink_default_int_array,
121 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
122 __videosink_default_string_array,
123 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
125 static type_element _videosink_element_evas_default = {
126 "VideosinkElementEvas",
128 __videosink_default_int_array,
129 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
130 __videosink_default_string_array,
131 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
133 static type_element _videosink_element_gl_default = {
134 "VideosinkElementGL",
136 __videosink_default_int_array,
137 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
138 __videosink_default_string_array,
139 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
141 static type_element _videosink_element_remote_default = {
142 "VideosinkElementRemote",
144 __videosink_default_int_array,
145 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
146 __videosink_default_string_array,
147 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
149 static type_element _videosink_element_null_default = {
150 "VideosinkElementNull",
152 __videosink_default_int_array,
153 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
154 __videosink_default_string_array,
155 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
158 /* Videoscale element default value */
159 static type_element _videoscale_element_default = {
168 /* Videoconvert element default value */
169 static type_element _videoconvert_element_default = {
170 "VideoconvertElement",
178 /* H.264 decoder element default value */
179 static type_element _videodecoder_element_h264_default = {
180 "VideodecoderElementH264",
188 /* Record sink element default value */
189 static type_element _recordsink_element_default = {
198 /* H263 element default value */
199 static type_element _h263_element_default = {
208 /* H264 element default value */
209 static type_element _h264_element_default = {
218 /* H26L element default value */
219 static type_element _h26l_element_default = {
228 /* MPEG4 element default value */
229 static type_element _mpeg4_element_default = {
238 /* MPEG1 element default value */
239 static type_element _mpeg1_element_default = {
248 /* THEORA element default value */
249 static type_element _theora_element_default = {
258 /* AMR element default value */
259 static type_element _amr_element_default = {
268 /* G723_1 element default value */
269 static type_element _g723_1_element_default = {
278 /* MP3 element default value */
279 static type_element _mp3_element_default = {
288 /* AAC element default value */
289 static type_element _aac_element_default = {
298 /* MMF element default value */
299 static type_element _mmf_element_default = {
308 /* ADPCM element default value */
309 static type_element _adpcm_element_default = {
311 "avenc_adpcm_ima_qt",
318 /* WAVE element default value */
319 static type_element _wave_element_default = {
328 /* VORBIS element default value */
329 static type_element _vorbis_element_default = {
338 /* MIDI element default value */
339 static type_element _midi_element_default = {
348 /* IMELODY element default value */
349 static type_element _imelody_element_default = {
358 /* JPEG element default value */
359 static type_element _jpeg_element_default = {
368 /* PNG element default value */
369 static type_element _png_element_default = {
378 /* BMP element default value */
379 static type_element _bmp_element_default = {
388 /* WBMP element default value */
389 static type_element _wbmp_element_default = {
398 /* TIFF element default value */
399 static type_element _tiff_element_default = {
408 /* PCX element default value */
409 static type_element _pcx_element_default = {
418 /* GIF element default value */
419 static type_element _gif_element_default = {
428 /* ICO element default value */
429 static type_element _ico_element_default = {
438 /* RAS element default value */
439 static type_element _ras_element_default = {
448 /* TGA element default value */
449 static type_element _tga_element_default = {
458 /* XBM element default value */
459 static type_element _xbm_element_default = {
468 /* XPM element default value */
469 static type_element _xpm_element_default = {
478 /* 3GP element default value */
479 static type_element _3gp_element_default = {
488 /* AMR mux element default value */
489 static type_element _amrmux_element_default = {
498 /* MP4 element default value */
499 static type_element _mp4_element_default = {
508 /* AAC mux element default value */
509 static type_element _aacmux_element_default = {
518 /* MP3 mux element default value */
519 static type_element _mp3mux_element_default = {
528 /* OGG element default value */
529 static type_element _ogg_element_default = {
538 /* WAV element default value */
539 static type_element _wav_element_default = {
548 /* AVI element default value */
549 static type_element _avi_element_default = {
558 /* WMA element default value */
559 static type_element _wma_element_default = {
568 /* WMV element default value */
569 static type_element _wmv_element_default = {
578 /* MID element default value */
579 static type_element _mid_element_default = {
588 /* MMF mux element default value */
589 static type_element _mmfmux_element_default = {
598 /* MATROSKA element default value */
599 static type_element _matroska_element_default = {
608 /* M2TS element default value */
609 static type_element _m2ts_element_default = {
618 /* [General] matching table */
619 static conf_info_table conf_main_general_table[] = {
620 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
621 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
622 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
623 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
626 /* [VideoInput] matching table */
627 static conf_info_table conf_main_video_input_table[] = {
628 { "UseConfCtrl", CONFIGURE_VALUE_INT, {.value_int = 1} },
629 { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {NULL} },
630 { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {NULL} },
631 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
632 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
633 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
634 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
635 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
636 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
639 /* [AudioInput] matching table */
640 static conf_info_table conf_main_audio_input_table[] = {
641 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
642 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
643 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
646 /* [VideoOutput] matching table */
647 static conf_info_table conf_main_video_output_table[] = {
648 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
649 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
650 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
651 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
652 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
653 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
654 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
655 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
656 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
657 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
658 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
659 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
660 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
661 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
664 /* [Capture] matching table */
665 static conf_info_table conf_main_capture_table[] = {
666 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
668 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
669 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
672 /* [Record] matching table */
673 static conf_info_table conf_main_record_table[] = {
674 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
675 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
676 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
677 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
678 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
679 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
680 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
681 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
682 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
683 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
684 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
685 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
686 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
688 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
689 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
692 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
695 /* [VideoEncoder] matching table */
696 static conf_info_table conf_main_video_encoder_table[] = {
697 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
698 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
699 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
700 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
701 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
702 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
705 /* [AudioEncoder] matching table */
706 static conf_info_table conf_main_audio_encoder_table[] = {
707 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
708 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
709 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
710 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
711 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
712 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
713 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
714 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
715 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
716 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
719 /* [ImageEncoder] matching table */
720 static conf_info_table conf_main_image_encoder_table[] = {
721 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
722 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
723 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
724 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
725 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
726 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
727 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
728 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
729 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
730 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
731 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
732 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
735 /* [Mux] matching table */
736 static conf_info_table conf_main_mux_table[] = {
737 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
738 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
739 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
740 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
741 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
742 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
743 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
744 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
745 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
746 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
747 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
748 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
749 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
750 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
758 /* [Camera] matching table */
759 static conf_info_table conf_ctrl_camera_table[] = {
760 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
761 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
762 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
763 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
764 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
765 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
766 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
767 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
768 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
769 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
770 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
771 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
776 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
777 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
778 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
779 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
780 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
781 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
784 /* [Strobe] matching table */
785 static conf_info_table conf_ctrl_strobe_table[] = {
786 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
791 /* [Effect] matching table */
792 static conf_info_table conf_ctrl_effect_table[] = {
793 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
794 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
795 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
796 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
797 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
798 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
800 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
801 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
802 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
804 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
807 /* [Photograph] matching table */
808 static conf_info_table conf_ctrl_photograph_table[] = {
809 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
812 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
813 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
814 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
816 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
817 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
819 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
820 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
821 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
823 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
824 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
825 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
826 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
827 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
830 /* [Capture] matching table */
831 static conf_info_table conf_ctrl_capture_table[] = {
832 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
833 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
834 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
835 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
836 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
837 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
840 /* [Detect] matching table */
841 static conf_info_table conf_ctrl_detect_table[] = {
842 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
843 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
844 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
845 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
848 if (hcamcorder == NULL) {
849 _mmcam_dbg_err("handle is 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 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
880 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
881 (*configure_info)->info[i] = NULL;
884 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
885 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
886 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
887 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
888 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
889 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
891 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
892 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
893 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
894 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
895 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
896 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
898 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
900 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
901 (*configure_info)->info[i] = NULL;
905 _mmcam_dbg_log("Done.");
911 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
913 int ret = MM_ERROR_NONE;
915 char conf_path[60] = {'\0',};
917 _mmcam_dbg_log("Opening...[%s]", ConfFile);
919 mmf_return_val_if_fail(ConfFile, FALSE);
921 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
922 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
924 fd = fopen(conf_path, "r");
926 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
928 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
929 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
930 fd = fopen(conf_path, "r");
932 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
937 ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
940 if (errno == ENOENT) {
941 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
943 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
947 _mmcam_dbg_log("Leave...");
953 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
955 const unsigned int BUFFER_NUM_DETAILS = 256;
956 const unsigned int BUFFER_NUM_TOKEN = 20;
957 size_t BUFFER_LENGTH_STRING = 256;
958 const char* delimiters = " |=,\t\n";
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 _mmcam_dbg_log( "" );
977 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
978 if (new_conf == NULL) {
979 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
980 *configure_info = NULL;
981 return MM_ERROR_CAMCORDER_LOW_MEMORY;
984 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
985 if (buffer_string == NULL) {
986 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
987 *configure_info = NULL;
988 SAFE_G_FREE(new_conf);
989 return MM_ERROR_CAMCORDER_LOW_MEMORY;
992 new_conf->type = type;
993 *configure_info = new_conf;
995 _mmcamcorder_conf_init(handle, type, &new_conf);
998 _mmcam_dbg_err("failed file descriptor fail");
999 *configure_info = NULL;
1000 SAFE_G_FREE(buffer_string);
1001 SAFE_G_FREE(new_conf);
1002 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1006 count_main_category = 0;
1008 while( !feof( fd ) )
1010 if( read_main == 0 )
1012 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1013 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1016 token = strtok_r( buffer_string, delimiters, &user_ptr );
1018 if ((token) && (token[0] == ';') && (length_read > -1))
1020 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1026 /*_mmcam_dbg_log( "token : [%s]", token );*/
1027 buffer_token[count_token] = token;
1029 token = strtok_r( NULL, delimiters, &user_ptr );
1032 if( count_token == 0 )
1041 if( *buffer_token[0] == ';' )
1043 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1046 else if( *buffer_token[0] == '[' )
1048 category_name = get_new_string( buffer_token[0] );
1049 if (category_name == NULL) {
1050 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1054 count_main_category++;
1057 while( !feof( fd ) )
1059 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1060 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1062 detail_string = get_new_string( buffer_string );
1064 token = strtok_r( buffer_string, delimiters, &user_ptr );
1066 if( token && token[0] != ';' && length_read > -1 )
1068 /*_mmcam_dbg_log( "token : [%s]", token );*/
1069 if( token[0] == '[' )
1072 buffer_token[0] = token;
1073 SAFE_G_FREE( detail_string );
1077 buffer_details[count_details++] = detail_string;
1081 SAFE_G_FREE( detail_string );
1085 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1087 if( count_details == 0 )
1089 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1090 SAFE_G_FREE(category_name);
1097 if( type == CONFIGURE_TYPE_MAIN )
1099 if( !strcmp( "[General]", category_name ) )
1101 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1103 else if( !strcmp( "[VideoInput]", category_name ) )
1105 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1107 else if( !strcmp( "[AudioInput]", category_name ) )
1109 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1111 else if( !strcmp( "[VideoOutput]", category_name ) )
1113 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1115 else if( !strcmp( "[Capture]", category_name ) )
1117 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1119 else if( !strcmp( "[Record]", category_name ) )
1121 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1123 else if( !strcmp( "[VideoEncoder]", category_name ) )
1125 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1127 else if( !strcmp( "[AudioEncoder]", category_name ) )
1129 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1131 else if( !strcmp( "[ImageEncoder]", category_name ) )
1133 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1135 else if( !strcmp( "[Mux]", category_name ) )
1137 category = CONFIGURE_CATEGORY_MAIN_MUX;
1142 if( !strcmp( "[Camera]", category_name ) )
1144 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1146 else if( !strcmp( "[Strobe]", category_name ) )
1148 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1150 else if( !strcmp( "[Effect]", category_name ) )
1152 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1154 else if( !strcmp( "[Photograph]", category_name ) )
1156 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1158 else if( !strcmp( "[Capture]", category_name ) )
1160 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1162 else if( !strcmp( "[Detect]", category_name ) )
1164 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1168 if( category != -1 )
1170 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1171 buffer_details, category, count_details );
1175 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1182 for( i = 0 ; i < count_details ; i++ )
1184 SAFE_G_FREE( buffer_details[i] );
1189 SAFE_G_FREE(category_name);
1192 //(*configure_info) = new_conf;
1194 SAFE_G_FREE( buffer_string );
1196 /*_mmcam_dbg_log( "Done." );*/
1198 return MM_ERROR_NONE;
1202 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1207 int type = CONFIGURE_VALUE_INT;
1209 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1210 camera_conf *temp_conf = (*configure_info);
1212 type_int2 *temp_int = NULL;
1213 type_int_range *temp_int_range = NULL;
1214 type_int_array *temp_int_array = NULL;
1215 type_int_pair_array *temp_int_pair_array = NULL;
1216 type_string2 *temp_string = NULL;
1217 type_string_array *temp_string_array = NULL;
1218 type_element2 *temp_element = NULL;
1220 _mmcam_dbg_log("Entered...");
1222 mmf_return_if_fail(temp_conf);
1224 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1225 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1227 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1230 for (i = 0 ; i < category_num ; i++) {
1231 if (temp_conf->info[i]) {
1232 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1233 if (temp_conf->info[i]->detail_info[j] == NULL) {
1237 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1239 case CONFIGURE_VALUE_INT:
1240 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1241 SAFE_G_FREE(temp_int->name);
1243 case CONFIGURE_VALUE_INT_RANGE:
1244 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1245 SAFE_G_FREE(temp_int_range->name);
1247 case CONFIGURE_VALUE_INT_ARRAY:
1248 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1249 SAFE_G_FREE(temp_int_array->name);
1250 SAFE_G_FREE(temp_int_array->value);
1252 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1253 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1254 SAFE_G_FREE(temp_int_pair_array->name);
1255 SAFE_G_FREE(temp_int_pair_array->value[0]);
1256 SAFE_G_FREE(temp_int_pair_array->value[1]);
1258 case CONFIGURE_VALUE_STRING:
1259 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1260 SAFE_G_FREE(temp_string->name);
1261 SAFE_G_FREE(temp_string->value);
1263 case CONFIGURE_VALUE_STRING_ARRAY:
1264 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1265 SAFE_G_FREE(temp_string_array->name);
1266 if (temp_string_array->value) {
1267 count = temp_string_array->count;
1268 for (k = 0 ; k < count ; k++) {
1269 SAFE_G_FREE(temp_string_array->value[k]);
1271 SAFE_G_FREE(temp_string_array->value);
1273 SAFE_G_FREE(temp_string_array->default_value);
1275 case CONFIGURE_VALUE_ELEMENT:
1276 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1277 SAFE_G_FREE(temp_element->name);
1278 SAFE_G_FREE(temp_element->element_name);
1280 if (temp_element->value_int) {
1281 count = temp_element->count_int;
1282 for (k = 0 ; k < count ; k++) {
1283 SAFE_G_FREE(temp_element->value_int[k]->name);
1284 SAFE_G_FREE(temp_element->value_int[k]);
1286 SAFE_G_FREE(temp_element->value_int);
1289 if (temp_element->value_string) {
1290 count = temp_element->count_string;
1291 for (k = 0 ; k < count ; k++) {
1292 SAFE_G_FREE(temp_element->value_string[k]->name);
1293 SAFE_G_FREE(temp_element->value_string[k]->value);
1294 SAFE_G_FREE(temp_element->value_string[k]);
1296 SAFE_G_FREE(temp_element->value_string);
1300 _mmcam_dbg_warn("unknown type %d", type);
1305 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1308 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1310 SAFE_G_FREE(temp_conf->info[i]);
1311 temp_conf->info[i] = NULL;
1315 SAFE_G_FREE((*configure_info)->info);
1316 SAFE_G_FREE((*configure_info));
1318 _mmcam_dbg_log("Done.");
1321 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1324 int count_value = 0;
1326 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1328 if (hcamcorder == NULL) {
1329 _mmcam_dbg_err("handle is NULL");
1333 /*_mmcam_dbg_log( "Entered..." );*/
1335 mmf_return_val_if_fail( name, FALSE );
1337 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1339 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1343 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1345 if( type == CONFIGURE_TYPE_MAIN )
1347 for( i = 0 ; i < count_value ; i++ )
1349 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1351 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1352 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1359 for( i = 0 ; i < count_value ; i++ )
1361 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1363 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1364 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1374 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1376 const int BUFFER_NUM_TOKEN = 256;
1383 char *buffer_token[BUFFER_NUM_TOKEN];
1384 char *user_ptr = NULL;
1386 const char *delimiters = " |=,\t\n";
1387 const char *delimiters_sub = " |\t\n";
1388 const char *delimiters_3rd = "|\n";
1390 mmf_return_val_if_fail( buffer_details, FALSE );
1392 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1393 if (*info == NULL) {
1394 _mmcam_dbg_err("allocation failed");
1397 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1398 (*info)->count = count_details;
1400 for ( i = 0 ; i < count_details ; i++ ) {
1401 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1403 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1406 buffer_token[count_token] = token;
1409 (*info)->detail_info[i] = NULL;
1410 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1414 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1415 (*info)->detail_info[i] = NULL;
1416 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1420 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1421 token = strtok_r( NULL, delimiters, &user_ptr );
1423 buffer_token[count_token] = token;
1424 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1426 token = strtok_r( NULL, delimiters, &user_ptr );
1429 if (count_token < 2) {
1430 (*info)->detail_info[i] = NULL;
1431 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1434 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1436 strtok_r( NULL, delimiters_sub, &user_ptr );
1438 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1439 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1441 buffer_token[count_token] = token;
1442 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1444 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1446 } else { /* CONFIGURE_VALUE_STRING */
1447 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1450 buffer_token[count_token] = token;
1451 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1456 if (count_token < 2) {
1457 (*info)->detail_info[i] = NULL;
1458 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1465 case CONFIGURE_VALUE_INT:
1469 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1470 if ( new_int == NULL ) {
1471 _mmcam_dbg_err("allocation failed");
1474 new_int->name = get_new_string( buffer_token[0] );
1475 new_int->value = atoi( buffer_token[1] );
1476 (*info)->detail_info[i] = (void*)new_int;
1477 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1480 case CONFIGURE_VALUE_INT_RANGE:
1482 type_int_range* new_int_range;
1484 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1485 if ( new_int_range == NULL ) {
1486 _mmcam_dbg_err("allocation failed");
1489 new_int_range->name = get_new_string( buffer_token[0] );
1490 new_int_range->min = atoi( buffer_token[1] );
1491 new_int_range->max = atoi( buffer_token[2] );
1492 new_int_range->default_value = atoi( buffer_token[3] );
1493 (*info)->detail_info[i] = (void*)new_int_range;
1495 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1496 new_int_range->name,
1499 new_int_range->default_value);
1503 case CONFIGURE_VALUE_INT_ARRAY:
1505 int count_value = count_token - 2;
1506 type_int_array* new_int_array;
1508 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1509 if (new_int_array == NULL) {
1510 _mmcam_dbg_err("allocation failed");
1513 new_int_array->name = get_new_string( buffer_token[0] );
1514 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1515 if (new_int_array->value == NULL) {
1516 SAFE_G_FREE(new_int_array->name);
1517 SAFE_G_FREE(new_int_array);
1518 _mmcam_dbg_err("allocation failed");
1521 new_int_array->count = count_value;
1523 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1524 for ( j = 0 ; j < count_value ; j++ ) {
1525 new_int_array->value[j] = atoi( buffer_token[j+1] );
1526 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1529 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1530 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1532 (*info)->detail_info[i] = (void*)new_int_array;
1535 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1537 int count_value = ( count_token - 3 ) >> 1;
1538 type_int_pair_array* new_int_pair_array;
1540 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1541 if ( new_int_pair_array == NULL ) {
1542 _mmcam_dbg_err("allocation failed");
1545 new_int_pair_array->name = get_new_string( buffer_token[0] );
1546 new_int_pair_array->value[0] = (int*)g_malloc0( sizeof(int)*(count_value) );
1547 if ( new_int_pair_array->value[0] == NULL ) {
1548 SAFE_G_FREE(new_int_pair_array->name);
1549 SAFE_G_FREE(new_int_pair_array);
1550 _mmcam_dbg_err("allocation failed");
1553 new_int_pair_array->value[1] = (int*)g_malloc0( sizeof(int)*(count_value) );
1554 if ( new_int_pair_array->value[1] == NULL ) {
1555 SAFE_G_FREE(new_int_pair_array->value[0]);
1556 SAFE_G_FREE(new_int_pair_array->name);
1557 SAFE_G_FREE(new_int_pair_array);
1558 _mmcam_dbg_err("allocation failed");
1561 new_int_pair_array->count = count_value;
1563 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1564 for ( j = 0 ; j < count_value ; j++ ) {
1565 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1566 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1568 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1569 new_int_pair_array->value[0][j],
1570 new_int_pair_array->value[1][j]);
1574 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1575 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1577 _mmcam_dbg_log(" default value[%d,%d]",
1578 new_int_pair_array->default_value[0],
1579 new_int_pair_array->default_value[1]);
1581 (*info)->detail_info[i] = (void*)new_int_pair_array;
1584 case CONFIGURE_VALUE_STRING:
1586 type_string2* new_string;
1588 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1589 if (new_string == NULL) {
1590 _mmcam_dbg_err("allocation failed");
1593 new_string->name = get_new_string( buffer_token[0] );
1594 new_string->value = get_new_string( buffer_token[1] );
1595 (*info)->detail_info[i] = (void*)new_string;
1597 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1600 case CONFIGURE_VALUE_STRING_ARRAY:
1602 int count_value = count_token - 2;
1603 type_string_array* new_string_array;
1605 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1606 if ( new_string_array == NULL ) {
1609 new_string_array->name = get_new_string( buffer_token[0] );
1610 new_string_array->count = count_value;
1611 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1612 if ( new_string_array->value == NULL ) {
1613 SAFE_G_FREE(new_string_array->name);
1614 SAFE_G_FREE(new_string_array);
1615 _mmcam_dbg_err("allocation failed");
1618 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1619 for ( j = 0 ; j < count_value ; j++ ) {
1620 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1621 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1624 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1625 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1626 (*info)->detail_info[i] = (void*)new_string_array;
1629 case CONFIGURE_VALUE_ELEMENT:
1631 type_element2* new_element;
1633 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1634 if ( new_element == NULL ) {
1635 _mmcam_dbg_err("allocation failed");
1638 new_element->name = get_new_string( buffer_token[0] );
1639 new_element->element_name = get_new_string( buffer_token[1] );
1640 new_element->count_int = atoi( buffer_token[2] );
1641 new_element->value_int = NULL;
1642 new_element->count_string = atoi( buffer_token[3] );
1643 new_element->value_string = NULL;
1645 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1646 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1649 /* add int values */
1650 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1651 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1652 if ( new_element->value_int) {
1653 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1654 new_element->value_int[j] = (type_int2*)g_malloc0( sizeof(type_int2) );
1655 if ( new_element->value_int[j] ) {
1656 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1657 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1659 _mmcam_dbg_err("allocation failed");
1662 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1663 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1667 _mmcam_dbg_err("allocation failed");
1670 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1671 new_element->value_int = NULL;
1674 /* add string values */
1675 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1676 new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1677 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1678 if (new_element->value_string) {
1679 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1680 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1681 if(new_element->value_string[j-new_element->count_int]) {
1682 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1683 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1685 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1686 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);
1689 _mmcam_dbg_err("allocation failed");
1693 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1696 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1697 new_element->value_string = NULL;
1700 (*info)->detail_info[i] = (void*)new_element;
1712 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1717 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1719 mmf_return_val_if_fail( configure_info, FALSE );
1720 mmf_return_val_if_fail( name, FALSE );
1722 if( configure_info->info[category] )
1724 count = configure_info->info[category]->count;
1725 info = configure_info->info[category];
1727 for( i = 0 ; i < count ; i++ )
1729 if( info->detail_info[i] == NULL )
1734 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1736 *value = ((type_int*)(info->detail_info[i]))->value;
1737 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1743 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1745 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1749 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1755 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1760 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1762 mmf_return_val_if_fail( configure_info, FALSE );
1763 mmf_return_val_if_fail( name, FALSE );
1765 if( configure_info->info[category] )
1767 count = configure_info->info[category]->count;
1768 info = configure_info->info[category];
1770 for( i = 0 ; i < count ; i++ )
1772 if( info->detail_info[i] == NULL )
1777 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1779 *value = (type_int_range*)(info->detail_info[i]);
1781 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1782 name, (*value)->min, (*value)->max, (*value)->default_value );
1791 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1797 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1802 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1804 mmf_return_val_if_fail( configure_info, FALSE );
1805 mmf_return_val_if_fail( name, FALSE );
1807 if( configure_info->info[category] )
1809 count = configure_info->info[category]->count;
1810 info = configure_info->info[category];
1812 for( i = 0 ; i < count ; i++ )
1814 if( info->detail_info[i] == NULL )
1819 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1821 *value = (type_int_array*)(info->detail_info[i]);
1823 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1824 name, (*value)->value, (*value)->count, (*value)->default_value );
1833 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1839 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1844 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1846 mmf_return_val_if_fail( configure_info, FALSE );
1847 mmf_return_val_if_fail( name, FALSE );
1849 if( configure_info->info[category] )
1851 count = configure_info->info[category]->count;
1852 info = configure_info->info[category];
1854 for( i = 0 ; i < count ; i++ )
1856 if( info->detail_info[i] == NULL )
1861 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1863 *value = (type_int_pair_array*)(info->detail_info[i]);
1865 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1866 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1867 (*value)->default_value[0], (*value)->default_value[1] );
1876 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1881 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1886 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1888 mmf_return_val_if_fail( configure_info, FALSE );
1889 mmf_return_val_if_fail( name, FALSE );
1891 if( configure_info->info[category] )
1893 count = configure_info->info[category]->count;
1894 info = configure_info->info[category];
1896 for( i = 0 ; i < count ; i++ )
1898 if( info->detail_info[i] == NULL )
1903 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1905 *value = ((type_string*)(info->detail_info[i]))->value;
1906 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1912 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1914 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1918 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1924 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1929 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1931 mmf_return_val_if_fail( configure_info, FALSE );
1932 mmf_return_val_if_fail( name, FALSE );
1934 if( configure_info->info[category] )
1936 count = configure_info->info[category]->count;
1937 info = configure_info->info[category];
1939 for( i = 0 ; i < count ; i++ )
1941 if( info->detail_info[i] == NULL )
1946 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1948 *value = (type_string_array*)(info->detail_info[i]);
1950 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1951 name, (*value)->value, (*value)->count, (*value)->default_value );
1960 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1965 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1970 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1972 mmf_return_val_if_fail( configure_info, FALSE );
1973 mmf_return_val_if_fail( name, FALSE );
1975 if( configure_info->info[category] )
1977 count = configure_info->info[category]->count;
1978 info = configure_info->info[category];
1980 for( i = 0 ; i < count ; i++ )
1982 if( info->detail_info[i] == NULL )
1987 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1989 *element = (type_element*)(info->detail_info[i]);
1990 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1996 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1998 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2002 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2008 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2010 //_mmcam_dbg_log( "Entered..." );
2012 mmf_return_val_if_fail( element, FALSE );
2014 *value = element->element_name;
2016 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2022 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2026 //_mmcam_dbg_log( "Entered..." );
2028 mmf_return_val_if_fail( element, FALSE );
2029 mmf_return_val_if_fail( name, FALSE );
2031 for( i = 0 ; i < element->count_int ; i++ )
2033 if( !strcmp( element->value_int[i]->name , name ) )
2035 *value = element->value_int[i]->value;
2036 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2041 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2042 element->name, name, element->count_int );
2048 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2052 //_mmcam_dbg_log( "Entered..." );
2054 mmf_return_val_if_fail( element, FALSE );
2055 mmf_return_val_if_fail( name, FALSE );
2057 for( i = 0 ; i < element->count_string ; i++ )
2059 if( !strcmp( element->value_string[i]->name , name ) )
2061 *value = element->value_string[i]->value;
2062 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2067 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2068 element->name, name, element->count_string );
2074 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2078 //_mmcam_dbg_log( "Entered..." );
2080 mmf_return_val_if_fail( gst, FALSE );
2081 mmf_return_val_if_fail( element, FALSE );
2083 if( element->count_int == 0 )
2085 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2089 if( element->value_int == NULL )
2091 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2095 for( i = 0 ; i < element->count_int ; i++ )
2097 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2100 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2101 element->element_name,
2102 element->value_int[i]->name,
2103 element->value_int[i]->value );
2108 if( element->count_string == 0 )
2110 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2114 if( element->value_string == NULL )
2116 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2120 for( i = 0 ; i < element->count_string ; i++ )
2122 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2124 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2125 element->element_name,
2126 element->value_string[i]->name,
2127 element->value_string[i]->value );
2131 //_mmcam_dbg_log( "Done." );
2137 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2140 int count_value = 0;
2142 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2144 if (hcamcorder == NULL) {
2145 _mmcam_dbg_err("handle is NULL");
2149 //_mmcam_dbg_log( "Entered..." );
2151 mmf_return_val_if_fail( name, FALSE );
2153 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2155 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2159 if( type == CONFIGURE_TYPE_MAIN )
2161 for( i = 0 ; i < count_value ; i++ )
2163 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2165 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2172 for( i = 0 ; i < count_value ; i++ )
2174 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2176 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2182 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2187 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2190 int count_value = 0;
2192 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2194 if (hcamcorder == NULL) {
2195 _mmcam_dbg_err("handle is NULL");
2199 //_mmcam_dbg_log( "Entered..." );
2201 mmf_return_val_if_fail( name, FALSE );
2203 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2205 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2209 if( type == CONFIGURE_TYPE_MAIN )
2211 for( i = 0 ; i < count_value ; i++ )
2213 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2215 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2216 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2223 for( i = 0 ; i < count_value ; i++ )
2225 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2227 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2228 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2234 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2239 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2242 int count_value = 0;
2244 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2246 if (hcamcorder == NULL) {
2247 _mmcam_dbg_err("handle is NULL");
2251 //_mmcam_dbg_log( "Entered..." );
2253 mmf_return_val_if_fail( name, FALSE );
2255 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2257 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2261 if( type == CONFIGURE_TYPE_MAIN )
2263 for( i = 0 ; i < count_value ; i++ )
2265 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2267 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2268 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2275 for( i = 0 ; i < count_value ; i++ )
2277 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2279 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2280 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2286 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2291 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2293 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2295 if (hcamcorder == NULL) {
2296 _mmcam_dbg_err("handle is NULL");
2300 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2301 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2303 if( type == CONFIGURE_TYPE_MAIN )
2305 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2307 *size = (int)hcamcorder->conf_main_category_size[category];
2311 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2313 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2320 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2322 int i, j, k, type, category_type;
2325 type_int_range *temp_int_range;
2326 type_int_array *temp_int_array;
2327 type_int_pair_array *temp_int_pair_array;
2328 type_string *temp_string;
2329 type_element *temp_element;
2331 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2333 mmf_return_if_fail( *configure_info );
2335 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2337 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2341 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2344 for( i = 0 ; i < category_type ; i++ )
2346 if( (*configure_info)->info[i] )
2348 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2349 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2351 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2355 case CONFIGURE_VALUE_INT:
2356 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2357 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2359 case CONFIGURE_VALUE_INT_RANGE:
2360 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2361 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2362 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2364 case CONFIGURE_VALUE_INT_ARRAY:
2365 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2366 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2367 temp_int_array->name, temp_int_array->default_value );
2368 for( k = 0 ; k < temp_int_array->count ; k++ )
2370 g_print( "[%d] ", temp_int_array->value[k] );
2374 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2375 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2376 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2377 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2378 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2380 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2384 case CONFIGURE_VALUE_STRING:
2385 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2386 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2388 case CONFIGURE_VALUE_ELEMENT:
2389 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2390 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2391 for( k = 0 ; k < temp_element->count_int ; k++ )
2393 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2395 for( k = 0 ; k < temp_element->count_string ; k++ )
2397 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2401 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 );
2407 g_print( "[ConfigureInfo] : Failed to get value type." );
2413 g_print( "[ConfigureInfoPrint] : Done.\n" );
2417 static type_element *
2418 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2420 type_element *telement = NULL;
2421 const char *codec_type_str = NULL;
2422 int codec_type = MM_AUDIO_CODEC_INVALID;
2423 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2424 _MMCamcorderSubContext *sc = NULL;
2426 mmf_return_val_if_fail(hcamcorder, NULL);
2427 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2429 mmf_return_val_if_fail(sc, NULL);
2433 /* Check element availability */
2434 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2436 switch( codec_type )
2438 case MM_AUDIO_CODEC_AMR:
2439 codec_type_str = "AMR";
2441 case MM_AUDIO_CODEC_G723_1:
2442 codec_type_str = "G723_1";
2444 case MM_AUDIO_CODEC_MP3:
2445 codec_type_str = "MP3";
2447 case MM_AUDIO_CODEC_AAC:
2448 codec_type_str = "AAC";
2450 case MM_AUDIO_CODEC_MMF:
2451 codec_type_str = "MMF";
2453 case MM_AUDIO_CODEC_ADPCM:
2454 codec_type_str = "ADPCM";
2456 case MM_AUDIO_CODEC_WAVE:
2457 codec_type_str = "WAVE";
2459 case MM_AUDIO_CODEC_MIDI:
2460 codec_type_str = "MIDI";
2462 case MM_AUDIO_CODEC_IMELODY:
2463 codec_type_str = "IMELODY";
2465 case MM_AUDIO_CODEC_VORBIS:
2466 codec_type_str = "VORBIS";
2469 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2473 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2474 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2482 static type_element *
2483 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2485 type_element *telement = NULL;
2486 const char *codec_type_str = NULL;
2487 int codec_type = MM_VIDEO_CODEC_INVALID;
2488 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2489 _MMCamcorderSubContext *sc = NULL;
2491 mmf_return_val_if_fail(hcamcorder, NULL);
2492 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2494 mmf_return_val_if_fail(sc, NULL);
2498 /* Check element availability */
2499 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2501 switch( codec_type )
2503 case MM_VIDEO_CODEC_H263:
2504 codec_type_str = "H263";
2506 case MM_VIDEO_CODEC_H264:
2507 codec_type_str = "H264";
2509 case MM_VIDEO_CODEC_H26L:
2510 codec_type_str = "H26L";
2512 case MM_VIDEO_CODEC_MPEG4:
2513 codec_type_str = "MPEG4";
2515 case MM_VIDEO_CODEC_MPEG1:
2516 codec_type_str = "MPEG1";
2518 case MM_VIDEO_CODEC_THEORA:
2519 codec_type_str = "THEORA";
2522 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2526 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2527 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2535 static type_element *
2536 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2538 type_element *telement = NULL;
2539 const char *codec_type_str = NULL;
2540 int codec_type = MM_IMAGE_CODEC_INVALID;
2541 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2542 _MMCamcorderSubContext *sc = NULL;
2544 mmf_return_val_if_fail(hcamcorder, NULL);
2545 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2547 mmf_return_val_if_fail(sc, NULL);
2551 /* Check element availability */
2552 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2554 switch( codec_type )
2556 case MM_IMAGE_CODEC_JPEG:
2557 codec_type_str = "JPEG";
2559 case MM_IMAGE_CODEC_SRW:
2560 codec_type_str = "SRW";
2562 case MM_IMAGE_CODEC_JPEG_SRW:
2563 codec_type_str = "JPEG_SRW";
2565 case MM_IMAGE_CODEC_PNG:
2566 codec_type_str = "PNG";
2568 case MM_IMAGE_CODEC_BMP:
2569 codec_type_str = "BMP";
2571 case MM_IMAGE_CODEC_WBMP:
2572 codec_type_str = "WBMP";
2574 case MM_IMAGE_CODEC_TIFF:
2575 codec_type_str = "TIFF";
2577 case MM_IMAGE_CODEC_PCX:
2578 codec_type_str = "PCX";
2580 case MM_IMAGE_CODEC_GIF:
2581 codec_type_str = "GIF";
2583 case MM_IMAGE_CODEC_ICO:
2584 codec_type_str = "ICO";
2586 case MM_IMAGE_CODEC_RAS:
2587 codec_type_str = "RAS";
2589 case MM_IMAGE_CODEC_TGA:
2590 codec_type_str = "TGA";
2592 case MM_IMAGE_CODEC_XBM:
2593 codec_type_str = "XBM";
2595 case MM_IMAGE_CODEC_XPM:
2596 codec_type_str = "XPM";
2599 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2603 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2604 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2612 static type_element *
2613 __mmcamcorder_get_file_format_element(MMHandleType handle)
2615 type_element *telement = NULL;
2616 const char *mux_type_str = NULL;
2617 int file_type = MM_FILE_FORMAT_INVALID;
2618 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2619 _MMCamcorderSubContext *sc = NULL;
2621 mmf_return_val_if_fail(hcamcorder, NULL);
2622 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2624 mmf_return_val_if_fail(sc, NULL);
2628 /* Check element availability */
2629 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2633 case MM_FILE_FORMAT_3GP:
2634 mux_type_str = "3GP";
2636 case MM_FILE_FORMAT_AMR:
2637 mux_type_str = "AMR";
2639 case MM_FILE_FORMAT_MP4:
2640 mux_type_str = "MP4";
2642 case MM_FILE_FORMAT_AAC:
2643 mux_type_str = "AAC";
2645 case MM_FILE_FORMAT_MP3:
2646 mux_type_str = "MP3";
2648 case MM_FILE_FORMAT_OGG:
2649 mux_type_str = "OGG";
2651 case MM_FILE_FORMAT_WAV:
2652 mux_type_str = "WAV";
2654 case MM_FILE_FORMAT_AVI:
2655 mux_type_str = "AVI";
2657 case MM_FILE_FORMAT_WMA:
2658 mux_type_str = "WMA";
2660 case MM_FILE_FORMAT_WMV:
2661 mux_type_str = "WMV";
2663 case MM_FILE_FORMAT_MID:
2664 mux_type_str = "MID";
2666 case MM_FILE_FORMAT_MMF:
2667 mux_type_str = "MMF";
2669 case MM_FILE_FORMAT_MATROSKA:
2670 mux_type_str = "MATROSKA";
2672 case MM_FILE_FORMAT_M2TS:
2673 mux_type_str = "M2TS";
2676 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2680 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2681 CONFIGURE_CATEGORY_MAIN_MUX,
2690 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2692 type_element *telement = NULL;
2694 _mmcam_dbg_log("type:%d", type);
2698 case MM_CAM_AUDIO_ENCODER:
2699 telement = __mmcamcorder_get_audio_codec_element(handle);
2701 case MM_CAM_VIDEO_ENCODER:
2702 telement = __mmcamcorder_get_video_codec_element(handle);
2704 case MM_CAM_IMAGE_ENCODER:
2705 telement = __mmcamcorder_get_image_codec_element(handle);
2707 case MM_CAM_FILE_FORMAT:
2708 telement = __mmcamcorder_get_file_format_element(handle);
2711 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2718 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2720 int codec_index = MM_AUDIO_CODEC_INVALID;
2723 _mmcam_dbg_err("name is NULL");
2724 return MM_AUDIO_CODEC_INVALID;
2727 if (!strcmp(name, "AMR")) {
2728 codec_index = MM_AUDIO_CODEC_AMR;
2729 } else if (!strcmp(name, "G723_1")) {
2730 codec_index = MM_AUDIO_CODEC_G723_1;
2731 } else if (!strcmp(name, "MP3")) {
2732 codec_index = MM_AUDIO_CODEC_MP3;
2733 } else if (!strcmp(name, "AAC")) {
2734 codec_index = MM_AUDIO_CODEC_AAC;
2735 } else if (!strcmp(name, "MMF")) {
2736 codec_index = MM_AUDIO_CODEC_MMF;
2737 } else if (!strcmp(name, "ADPCM")) {
2738 codec_index = MM_AUDIO_CODEC_ADPCM;
2739 } else if (!strcmp(name, "WAVE")) {
2740 codec_index = MM_AUDIO_CODEC_WAVE;
2741 } else if (!strcmp(name, "MIDI")) {
2742 codec_index = MM_AUDIO_CODEC_MIDI;
2743 } else if (!strcmp(name, "IMELODY")) {
2744 codec_index = MM_AUDIO_CODEC_IMELODY;
2745 } else if (!strcmp(name, "VORBIS")) {
2746 codec_index = MM_AUDIO_CODEC_VORBIS;
2749 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2756 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2758 int codec_index = MM_VIDEO_CODEC_INVALID;
2761 _mmcam_dbg_err("name is NULL");
2762 return MM_VIDEO_CODEC_INVALID;
2765 if (!strcmp(name, "H263")) {
2766 codec_index = MM_VIDEO_CODEC_H263;
2767 } else if (!strcmp(name, "H264")) {
2768 codec_index = MM_VIDEO_CODEC_H264;
2769 } else if (!strcmp(name, "H26L")) {
2770 codec_index = MM_VIDEO_CODEC_H26L;
2771 } else if (!strcmp(name, "MPEG4")) {
2772 codec_index = MM_VIDEO_CODEC_MPEG4;
2773 } else if (!strcmp(name, "MPEG1")) {
2774 codec_index = MM_VIDEO_CODEC_MPEG1;
2775 } else if (!strcmp(name, "THEORA")) {
2776 codec_index = MM_VIDEO_CODEC_THEORA;
2779 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2786 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2788 int codec_index = MM_IMAGE_CODEC_INVALID;
2791 _mmcam_dbg_err("name is NULL");
2792 return MM_IMAGE_CODEC_INVALID;
2795 if (!strcmp(name, "JPEG")) {
2796 codec_index = MM_IMAGE_CODEC_JPEG;
2797 } else if (!strcmp(name, "PNG")) {
2798 codec_index = MM_IMAGE_CODEC_PNG;
2799 } else if (!strcmp(name, "BMP")) {
2800 codec_index = MM_IMAGE_CODEC_BMP;
2801 } else if (!strcmp(name, "WBMP")) {
2802 codec_index = MM_IMAGE_CODEC_WBMP;
2803 } else if (!strcmp(name, "TIFF")) {
2804 codec_index = MM_IMAGE_CODEC_TIFF;
2805 } else if (!strcmp(name, "PCX")) {
2806 codec_index = MM_IMAGE_CODEC_PCX;
2807 } else if (!strcmp(name, "GIF")) {
2808 codec_index = MM_IMAGE_CODEC_GIF;
2809 } else if (!strcmp(name, "ICO")) {
2810 codec_index = MM_IMAGE_CODEC_ICO;
2811 } else if (!strcmp(name, "RAS")) {
2812 codec_index = MM_IMAGE_CODEC_RAS;
2813 } else if (!strcmp(name, "TGA")) {
2814 codec_index = MM_IMAGE_CODEC_TGA;
2815 } else if (!strcmp(name, "XBM")) {
2816 codec_index = MM_IMAGE_CODEC_XBM;
2817 } else if (!strcmp(name, "XPM")) {
2818 codec_index = MM_IMAGE_CODEC_XPM;
2821 _mmcam_dbg_log("image codec index %d", codec_index);
2827 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2829 int mux_index = MM_FILE_FORMAT_INVALID;
2832 _mmcam_dbg_err("name is NULL");
2833 return MM_FILE_FORMAT_INVALID;
2836 if (!strcmp(name, "3GP")) {
2837 mux_index = MM_FILE_FORMAT_3GP;
2838 } else if (!strcmp(name, "AMR")) {
2839 mux_index = MM_FILE_FORMAT_AMR;
2840 } else if (!strcmp(name, "MP4")) {
2841 mux_index = MM_FILE_FORMAT_MP4;
2842 } else if (!strcmp(name, "AAC")) {
2843 mux_index = MM_FILE_FORMAT_AAC;
2844 } else if (!strcmp(name, "MP3")) {
2845 mux_index = MM_FILE_FORMAT_MP3;
2846 } else if (!strcmp(name, "OGG")) {
2847 mux_index = MM_FILE_FORMAT_OGG;
2848 } else if (!strcmp(name, "WAV")) {
2849 mux_index = MM_FILE_FORMAT_WAV;
2850 } else if (!strcmp(name, "AVI")) {
2851 mux_index = MM_FILE_FORMAT_AVI;
2852 } else if (!strcmp(name, "WMA")) {
2853 mux_index = MM_FILE_FORMAT_WMA;
2854 } else if (!strcmp(name, "WMV")) {
2855 mux_index = MM_FILE_FORMAT_WMV;
2856 } else if (!strcmp(name, "MID")) {
2857 mux_index = MM_FILE_FORMAT_MID;
2858 } else if (!strcmp(name, "MMF")) {
2859 mux_index = MM_FILE_FORMAT_MMF;
2860 } else if (!strcmp(name, "MATROSKA")) {
2861 mux_index = MM_FILE_FORMAT_MATROSKA;
2862 } else if (!strcmp(name, "M2TS")) {
2863 mux_index = MM_FILE_FORMAT_M2TS;
2867 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2874 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2878 mmf_return_val_if_fail(name, -1);
2880 switch(conf_category)
2882 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2883 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2885 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2886 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2888 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2889 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2891 case CONFIGURE_CATEGORY_MAIN_MUX:
2892 fmt = _mmcamcorder_get_mux_format(handle, name);
2895 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2902 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2904 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2905 camera_conf* configure_info = NULL;
2907 int total_count = 0;
2909 mmf_return_val_if_fail(hcamcorder, 0);
2911 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2913 configure_info = hcamcorder->conf_main;
2915 if (configure_info->info[conf_category]) {
2918 const char *name = NULL;
2919 int count = configure_info->info[conf_category]->count;
2920 conf_detail *info = configure_info->info[conf_category];
2922 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2924 if (count <= 0 || !info) {
2928 arr = (int*) g_malloc0(count * sizeof(int));
2930 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2934 for (i = 0 ; i < count ; i++) {
2935 if (info->detail_info[i] == NULL) {
2939 name = ((type_element*)(info->detail_info[i]))->name;
2940 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2942 arr[total_count++] = fmt;
2945 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/