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 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
659 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
660 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
663 /* [Capture] matching table */
664 static conf_info_table conf_main_capture_table[] = {
665 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
668 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
671 /* [Record] matching table */
672 static conf_info_table conf_main_record_table[] = {
673 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
674 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
675 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
676 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
677 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
678 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
679 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
680 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
681 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
682 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
683 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
684 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
685 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
686 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
687 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
688 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
689 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
690 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
691 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
694 /* [VideoEncoder] matching table */
695 static conf_info_table conf_main_video_encoder_table[] = {
696 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
697 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
698 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
699 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
700 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
701 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
704 /* [AudioEncoder] matching table */
705 static conf_info_table conf_main_audio_encoder_table[] = {
706 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
707 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
708 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
709 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
710 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
711 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
712 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
713 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
714 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
715 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
718 /* [ImageEncoder] matching table */
719 static conf_info_table conf_main_image_encoder_table[] = {
720 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
721 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
722 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
723 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
724 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
725 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
726 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
727 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
728 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
729 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
730 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
731 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
734 /* [Mux] matching table */
735 static conf_info_table conf_main_mux_table[] = {
736 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
737 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
738 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
739 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
740 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
741 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
742 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
743 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
744 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
745 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
746 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
747 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
748 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
749 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
757 /* [Camera] matching table */
758 static conf_info_table conf_ctrl_camera_table[] = {
759 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
760 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
761 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
762 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
763 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
764 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
765 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
766 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
767 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
768 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
769 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
770 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
771 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
776 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
777 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
778 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
779 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
780 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
783 /* [Strobe] matching table */
784 static conf_info_table conf_ctrl_strobe_table[] = {
785 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
786 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
790 /* [Effect] matching table */
791 static conf_info_table conf_ctrl_effect_table[] = {
792 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
793 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
794 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
795 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
796 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
797 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
798 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
800 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
801 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
802 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
806 /* [Photograph] matching table */
807 static conf_info_table conf_ctrl_photograph_table[] = {
808 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
810 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
813 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
814 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
815 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
816 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
817 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
819 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
820 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
821 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
822 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
823 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
824 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
825 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
826 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
829 /* [Capture] matching table */
830 static conf_info_table conf_ctrl_capture_table[] = {
831 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
832 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
833 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
834 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
835 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
836 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
839 /* [Detect] matching table */
840 static conf_info_table conf_ctrl_detect_table[] = {
841 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
842 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
843 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
844 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
847 if (hcamcorder == NULL) {
848 _mmcam_dbg_err("handle is NULL");
852 _mmcam_dbg_log("Entered...");
854 if (type == CONFIGURE_TYPE_MAIN) {
855 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
856 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
857 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
858 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
859 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
860 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
861 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
862 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
863 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
864 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
866 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
867 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
868 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
869 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
870 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
871 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
872 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
873 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
874 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
875 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
877 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
879 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
880 (*configure_info)->info[i] = NULL;
883 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
884 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
885 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
886 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
887 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
888 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
890 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
891 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
892 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
893 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
894 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
895 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
897 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
899 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
900 (*configure_info)->info[i] = NULL;
904 _mmcam_dbg_log("Done.");
910 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
912 int ret = MM_ERROR_NONE;
914 char conf_path[60] = {'\0',};
916 _mmcam_dbg_log("Opening...[%s]", ConfFile);
918 mmf_return_val_if_fail(ConfFile, FALSE);
920 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
921 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
923 fd = fopen(conf_path, "r");
925 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
927 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
928 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
929 fd = fopen(conf_path, "r");
931 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
936 ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
939 if (errno == ENOENT) {
940 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
942 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
946 _mmcam_dbg_log("Leave...");
952 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
954 const unsigned int BUFFER_NUM_DETAILS = 256;
955 const unsigned int BUFFER_NUM_TOKEN = 20;
956 size_t BUFFER_LENGTH_STRING = 256;
957 const char* delimiters = " |=,\t\n";
960 int count_main_category = 0;
961 int count_details = 0;
966 char *buffer_string = NULL;
967 char *buffer_details[BUFFER_NUM_DETAILS];
968 char *buffer_token[BUFFER_NUM_TOKEN];
970 char *category_name = NULL;
971 char *detail_string = NULL;
972 char *user_ptr = NULL;
974 _mmcam_dbg_log( "" );
976 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
977 if (new_conf == NULL) {
978 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
979 *configure_info = NULL;
980 return MM_ERROR_CAMCORDER_LOW_MEMORY;
983 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
984 if (buffer_string == NULL) {
985 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
986 *configure_info = NULL;
987 SAFE_G_FREE(new_conf);
988 return MM_ERROR_CAMCORDER_LOW_MEMORY;
991 new_conf->type = type;
992 *configure_info = new_conf;
994 _mmcamcorder_conf_init(handle, type, &new_conf);
997 _mmcam_dbg_err("failed file descriptor fail");
998 *configure_info = NULL;
999 SAFE_G_FREE(buffer_string);
1000 SAFE_G_FREE(new_conf);
1001 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1005 count_main_category = 0;
1007 while( !feof( fd ) )
1009 if( read_main == 0 )
1011 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1012 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1015 token = strtok_r( buffer_string, delimiters, &user_ptr );
1017 if ((token) && (token[0] == ';') && (length_read > -1))
1019 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1025 /*_mmcam_dbg_log( "token : [%s]", token );*/
1026 buffer_token[count_token] = token;
1028 token = strtok_r( NULL, delimiters, &user_ptr );
1031 if( count_token == 0 )
1040 if( *buffer_token[0] == ';' )
1042 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1045 else if( *buffer_token[0] == '[' )
1047 category_name = get_new_string( buffer_token[0] );
1048 if (category_name == NULL) {
1049 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1053 count_main_category++;
1056 while( !feof( fd ) )
1058 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1059 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1061 detail_string = get_new_string( buffer_string );
1063 token = strtok_r( buffer_string, delimiters, &user_ptr );
1065 if( token && token[0] != ';' && length_read > -1 )
1067 /*_mmcam_dbg_log( "token : [%s]", token );*/
1068 if( token[0] == '[' )
1071 buffer_token[0] = token;
1072 SAFE_G_FREE( detail_string );
1076 buffer_details[count_details++] = detail_string;
1080 SAFE_G_FREE( detail_string );
1084 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1086 if( count_details == 0 )
1088 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1089 SAFE_G_FREE(category_name);
1096 if( type == CONFIGURE_TYPE_MAIN )
1098 if( !strcmp( "[General]", category_name ) )
1100 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1102 else if( !strcmp( "[VideoInput]", category_name ) )
1104 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1106 else if( !strcmp( "[AudioInput]", category_name ) )
1108 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1110 else if( !strcmp( "[VideoOutput]", category_name ) )
1112 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1114 else if( !strcmp( "[Capture]", category_name ) )
1116 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1118 else if( !strcmp( "[Record]", category_name ) )
1120 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1122 else if( !strcmp( "[VideoEncoder]", category_name ) )
1124 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1126 else if( !strcmp( "[AudioEncoder]", category_name ) )
1128 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1130 else if( !strcmp( "[ImageEncoder]", category_name ) )
1132 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1134 else if( !strcmp( "[Mux]", category_name ) )
1136 category = CONFIGURE_CATEGORY_MAIN_MUX;
1141 if( !strcmp( "[Camera]", category_name ) )
1143 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1145 else if( !strcmp( "[Strobe]", category_name ) )
1147 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1149 else if( !strcmp( "[Effect]", category_name ) )
1151 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1153 else if( !strcmp( "[Photograph]", category_name ) )
1155 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1157 else if( !strcmp( "[Capture]", category_name ) )
1159 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1161 else if( !strcmp( "[Detect]", category_name ) )
1163 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1167 if( category != -1 )
1169 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1170 buffer_details, category, count_details );
1174 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1181 for( i = 0 ; i < count_details ; i++ )
1183 SAFE_G_FREE( buffer_details[i] );
1188 SAFE_G_FREE(category_name);
1191 //(*configure_info) = new_conf;
1193 SAFE_G_FREE( buffer_string );
1195 /*_mmcam_dbg_log( "Done." );*/
1197 return MM_ERROR_NONE;
1201 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1206 int type = CONFIGURE_VALUE_INT;
1208 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1209 camera_conf *temp_conf = (*configure_info);
1211 type_int2 *temp_int = NULL;
1212 type_int_range *temp_int_range = NULL;
1213 type_int_array *temp_int_array = NULL;
1214 type_int_pair_array *temp_int_pair_array = NULL;
1215 type_string2 *temp_string = NULL;
1216 type_string_array *temp_string_array = NULL;
1217 type_element2 *temp_element = NULL;
1219 _mmcam_dbg_log("Entered...");
1221 mmf_return_if_fail(temp_conf);
1223 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1224 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1226 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1229 for (i = 0 ; i < category_num ; i++) {
1230 if (temp_conf->info[i]) {
1231 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1232 if (temp_conf->info[i]->detail_info[j] == NULL) {
1236 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1238 case CONFIGURE_VALUE_INT:
1239 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1240 SAFE_G_FREE(temp_int->name);
1242 case CONFIGURE_VALUE_INT_RANGE:
1243 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1244 SAFE_G_FREE(temp_int_range->name);
1246 case CONFIGURE_VALUE_INT_ARRAY:
1247 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1248 SAFE_G_FREE(temp_int_array->name);
1249 SAFE_G_FREE(temp_int_array->value);
1251 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1252 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1253 SAFE_G_FREE(temp_int_pair_array->name);
1254 SAFE_G_FREE(temp_int_pair_array->value[0]);
1255 SAFE_G_FREE(temp_int_pair_array->value[1]);
1257 case CONFIGURE_VALUE_STRING:
1258 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1259 SAFE_G_FREE(temp_string->name);
1260 SAFE_G_FREE(temp_string->value);
1262 case CONFIGURE_VALUE_STRING_ARRAY:
1263 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1264 SAFE_G_FREE(temp_string_array->name);
1265 if (temp_string_array->value) {
1266 count = temp_string_array->count;
1267 for (k = 0 ; k < count ; k++) {
1268 SAFE_G_FREE(temp_string_array->value[k]);
1270 SAFE_G_FREE(temp_string_array->value);
1272 SAFE_G_FREE(temp_string_array->default_value);
1274 case CONFIGURE_VALUE_ELEMENT:
1275 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1276 SAFE_G_FREE(temp_element->name);
1277 SAFE_G_FREE(temp_element->element_name);
1279 if (temp_element->value_int) {
1280 count = temp_element->count_int;
1281 for (k = 0 ; k < count ; k++) {
1282 SAFE_G_FREE(temp_element->value_int[k]->name);
1283 SAFE_G_FREE(temp_element->value_int[k]);
1285 SAFE_G_FREE(temp_element->value_int);
1288 if (temp_element->value_string) {
1289 count = temp_element->count_string;
1290 for (k = 0 ; k < count ; k++) {
1291 SAFE_G_FREE(temp_element->value_string[k]->name);
1292 SAFE_G_FREE(temp_element->value_string[k]->value);
1293 SAFE_G_FREE(temp_element->value_string[k]);
1295 SAFE_G_FREE(temp_element->value_string);
1299 _mmcam_dbg_warn("unknown type %d", type);
1304 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1307 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1309 SAFE_G_FREE(temp_conf->info[i]);
1310 temp_conf->info[i] = NULL;
1314 SAFE_G_FREE((*configure_info)->info);
1315 SAFE_G_FREE((*configure_info));
1317 _mmcam_dbg_log("Done.");
1320 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1323 int count_value = 0;
1325 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1327 if (hcamcorder == NULL) {
1328 _mmcam_dbg_err("handle is NULL");
1332 /*_mmcam_dbg_log( "Entered..." );*/
1334 mmf_return_val_if_fail( name, FALSE );
1336 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1338 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1342 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1344 if( type == CONFIGURE_TYPE_MAIN )
1346 for( i = 0 ; i < count_value ; i++ )
1348 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1350 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1351 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1358 for( i = 0 ; i < count_value ; i++ )
1360 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1362 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1363 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1373 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1375 const int BUFFER_NUM_TOKEN = 256;
1382 char *buffer_token[BUFFER_NUM_TOKEN];
1383 char *user_ptr = NULL;
1385 const char *delimiters = " |=,\t\n";
1386 const char *delimiters_sub = " |\t\n";
1387 const char *delimiters_3rd = "|\n";
1389 mmf_return_val_if_fail( buffer_details, FALSE );
1391 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1392 if (*info == NULL) {
1393 _mmcam_dbg_err("allocation failed");
1396 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1397 (*info)->count = count_details;
1399 for ( i = 0 ; i < count_details ; i++ ) {
1400 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1402 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1405 buffer_token[count_token] = token;
1408 (*info)->detail_info[i] = NULL;
1409 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1413 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1414 (*info)->detail_info[i] = NULL;
1415 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1419 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1420 token = strtok_r( NULL, delimiters, &user_ptr );
1422 buffer_token[count_token] = token;
1423 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1425 token = strtok_r( NULL, delimiters, &user_ptr );
1428 if (count_token < 2) {
1429 (*info)->detail_info[i] = NULL;
1430 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1433 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1435 strtok_r( NULL, delimiters_sub, &user_ptr );
1437 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1438 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1440 buffer_token[count_token] = token;
1441 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1443 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1445 } else { /* CONFIGURE_VALUE_STRING */
1446 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1449 buffer_token[count_token] = token;
1450 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1455 if (count_token < 2) {
1456 (*info)->detail_info[i] = NULL;
1457 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1464 case CONFIGURE_VALUE_INT:
1468 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1469 if ( new_int == NULL ) {
1470 _mmcam_dbg_err("allocation failed");
1473 new_int->name = get_new_string( buffer_token[0] );
1474 new_int->value = atoi( buffer_token[1] );
1475 (*info)->detail_info[i] = (void*)new_int;
1476 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1479 case CONFIGURE_VALUE_INT_RANGE:
1481 type_int_range* new_int_range;
1483 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1484 if ( new_int_range == NULL ) {
1485 _mmcam_dbg_err("allocation failed");
1488 new_int_range->name = get_new_string( buffer_token[0] );
1489 new_int_range->min = atoi( buffer_token[1] );
1490 new_int_range->max = atoi( buffer_token[2] );
1491 new_int_range->default_value = atoi( buffer_token[3] );
1492 (*info)->detail_info[i] = (void*)new_int_range;
1494 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1495 new_int_range->name,
1498 new_int_range->default_value);
1502 case CONFIGURE_VALUE_INT_ARRAY:
1504 int count_value = count_token - 2;
1505 type_int_array* new_int_array;
1507 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1508 if (new_int_array == NULL) {
1509 _mmcam_dbg_err("allocation failed");
1512 new_int_array->name = get_new_string( buffer_token[0] );
1513 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1514 if (new_int_array->value == NULL) {
1515 SAFE_G_FREE(new_int_array->name);
1516 SAFE_G_FREE(new_int_array);
1517 _mmcam_dbg_err("allocation failed");
1520 new_int_array->count = count_value;
1522 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1523 for ( j = 0 ; j < count_value ; j++ ) {
1524 new_int_array->value[j] = atoi( buffer_token[j+1] );
1525 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1528 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1529 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1531 (*info)->detail_info[i] = (void*)new_int_array;
1534 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1536 int count_value = ( count_token - 3 ) >> 1;
1537 type_int_pair_array* new_int_pair_array;
1539 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1540 if ( new_int_pair_array == NULL ) {
1541 _mmcam_dbg_err("allocation failed");
1544 new_int_pair_array->name = get_new_string( buffer_token[0] );
1545 new_int_pair_array->value[0] = (int*)g_malloc0( sizeof(int)*(count_value) );
1546 if ( new_int_pair_array->value[0] == NULL ) {
1547 SAFE_G_FREE(new_int_pair_array->name);
1548 SAFE_G_FREE(new_int_pair_array);
1549 _mmcam_dbg_err("allocation failed");
1552 new_int_pair_array->value[1] = (int*)g_malloc0( sizeof(int)*(count_value) );
1553 if ( new_int_pair_array->value[1] == NULL ) {
1554 SAFE_G_FREE(new_int_pair_array->value[0]);
1555 SAFE_G_FREE(new_int_pair_array->name);
1556 SAFE_G_FREE(new_int_pair_array);
1557 _mmcam_dbg_err("allocation failed");
1560 new_int_pair_array->count = count_value;
1562 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1563 for ( j = 0 ; j < count_value ; j++ ) {
1564 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1565 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1567 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1568 new_int_pair_array->value[0][j],
1569 new_int_pair_array->value[1][j]);
1573 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1574 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1576 _mmcam_dbg_log(" default value[%d,%d]",
1577 new_int_pair_array->default_value[0],
1578 new_int_pair_array->default_value[1]);
1580 (*info)->detail_info[i] = (void*)new_int_pair_array;
1583 case CONFIGURE_VALUE_STRING:
1585 type_string2* new_string;
1587 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1588 if (new_string == NULL) {
1589 _mmcam_dbg_err("allocation failed");
1592 new_string->name = get_new_string( buffer_token[0] );
1593 new_string->value = get_new_string( buffer_token[1] );
1594 (*info)->detail_info[i] = (void*)new_string;
1596 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1599 case CONFIGURE_VALUE_STRING_ARRAY:
1601 int count_value = count_token - 2;
1602 type_string_array* new_string_array;
1604 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1605 if ( new_string_array == NULL ) {
1608 new_string_array->name = get_new_string( buffer_token[0] );
1609 new_string_array->count = count_value;
1610 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1611 if ( new_string_array->value == NULL ) {
1612 SAFE_G_FREE(new_string_array->name);
1613 SAFE_G_FREE(new_string_array);
1614 _mmcam_dbg_err("allocation failed");
1617 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1618 for ( j = 0 ; j < count_value ; j++ ) {
1619 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1620 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1623 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1624 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1625 (*info)->detail_info[i] = (void*)new_string_array;
1628 case CONFIGURE_VALUE_ELEMENT:
1630 type_element2* new_element;
1632 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1633 if ( new_element == NULL ) {
1634 _mmcam_dbg_err("allocation failed");
1637 new_element->name = get_new_string( buffer_token[0] );
1638 new_element->element_name = get_new_string( buffer_token[1] );
1639 new_element->count_int = atoi( buffer_token[2] );
1640 new_element->value_int = NULL;
1641 new_element->count_string = atoi( buffer_token[3] );
1642 new_element->value_string = NULL;
1644 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1645 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1648 /* add int values */
1649 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1650 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1651 if ( new_element->value_int) {
1652 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1653 new_element->value_int[j] = (type_int2*)g_malloc0( sizeof(type_int2) );
1654 if ( new_element->value_int[j] ) {
1655 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1656 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1658 _mmcam_dbg_err("allocation failed");
1661 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1662 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1666 _mmcam_dbg_err("allocation failed");
1669 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1670 new_element->value_int = NULL;
1673 /* add string values */
1674 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1675 new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1676 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1677 if (new_element->value_string) {
1678 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1679 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1680 if(new_element->value_string[j-new_element->count_int]) {
1681 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1682 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1684 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1685 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);
1688 _mmcam_dbg_err("allocation failed");
1692 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1695 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1696 new_element->value_string = NULL;
1699 (*info)->detail_info[i] = (void*)new_element;
1711 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1716 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1718 mmf_return_val_if_fail( configure_info, FALSE );
1719 mmf_return_val_if_fail( name, FALSE );
1721 if( configure_info->info[category] )
1723 count = configure_info->info[category]->count;
1724 info = configure_info->info[category];
1726 for( i = 0 ; i < count ; i++ )
1728 if( info->detail_info[i] == NULL )
1733 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1735 *value = ((type_int*)(info->detail_info[i]))->value;
1736 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1742 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1744 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1748 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1754 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1759 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1761 mmf_return_val_if_fail( configure_info, FALSE );
1762 mmf_return_val_if_fail( name, FALSE );
1764 if( configure_info->info[category] )
1766 count = configure_info->info[category]->count;
1767 info = configure_info->info[category];
1769 for( i = 0 ; i < count ; i++ )
1771 if( info->detail_info[i] == NULL )
1776 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1778 *value = (type_int_range*)(info->detail_info[i]);
1780 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1781 name, (*value)->min, (*value)->max, (*value)->default_value );
1790 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1796 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1801 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1803 mmf_return_val_if_fail( configure_info, FALSE );
1804 mmf_return_val_if_fail( name, FALSE );
1806 if( configure_info->info[category] )
1808 count = configure_info->info[category]->count;
1809 info = configure_info->info[category];
1811 for( i = 0 ; i < count ; i++ )
1813 if( info->detail_info[i] == NULL )
1818 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1820 *value = (type_int_array*)(info->detail_info[i]);
1822 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1823 name, (*value)->value, (*value)->count, (*value)->default_value );
1832 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1838 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1843 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1845 mmf_return_val_if_fail( configure_info, FALSE );
1846 mmf_return_val_if_fail( name, FALSE );
1848 if( configure_info->info[category] )
1850 count = configure_info->info[category]->count;
1851 info = configure_info->info[category];
1853 for( i = 0 ; i < count ; i++ )
1855 if( info->detail_info[i] == NULL )
1860 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1862 *value = (type_int_pair_array*)(info->detail_info[i]);
1864 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1865 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1866 (*value)->default_value[0], (*value)->default_value[1] );
1875 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1880 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1885 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1887 mmf_return_val_if_fail( configure_info, FALSE );
1888 mmf_return_val_if_fail( name, FALSE );
1890 if( configure_info->info[category] )
1892 count = configure_info->info[category]->count;
1893 info = configure_info->info[category];
1895 for( i = 0 ; i < count ; i++ )
1897 if( info->detail_info[i] == NULL )
1902 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1904 *value = ((type_string*)(info->detail_info[i]))->value;
1905 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1911 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1913 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1917 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1923 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1928 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1930 mmf_return_val_if_fail( configure_info, FALSE );
1931 mmf_return_val_if_fail( name, FALSE );
1933 if( configure_info->info[category] )
1935 count = configure_info->info[category]->count;
1936 info = configure_info->info[category];
1938 for( i = 0 ; i < count ; i++ )
1940 if( info->detail_info[i] == NULL )
1945 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1947 *value = (type_string_array*)(info->detail_info[i]);
1949 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1950 name, (*value)->value, (*value)->count, (*value)->default_value );
1959 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1964 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1969 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1971 mmf_return_val_if_fail( configure_info, FALSE );
1972 mmf_return_val_if_fail( name, FALSE );
1974 if( configure_info->info[category] )
1976 count = configure_info->info[category]->count;
1977 info = configure_info->info[category];
1979 for( i = 0 ; i < count ; i++ )
1981 if( info->detail_info[i] == NULL )
1986 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1988 *element = (type_element*)(info->detail_info[i]);
1989 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1995 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1997 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2001 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2007 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2009 //_mmcam_dbg_log( "Entered..." );
2011 mmf_return_val_if_fail( element, FALSE );
2013 *value = element->element_name;
2015 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2021 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2025 //_mmcam_dbg_log( "Entered..." );
2027 mmf_return_val_if_fail( element, FALSE );
2028 mmf_return_val_if_fail( name, FALSE );
2030 for( i = 0 ; i < element->count_int ; i++ )
2032 if( !strcmp( element->value_int[i]->name , name ) )
2034 *value = element->value_int[i]->value;
2035 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2040 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2041 element->name, name, element->count_int );
2047 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2051 //_mmcam_dbg_log( "Entered..." );
2053 mmf_return_val_if_fail( element, FALSE );
2054 mmf_return_val_if_fail( name, FALSE );
2056 for( i = 0 ; i < element->count_string ; i++ )
2058 if( !strcmp( element->value_string[i]->name , name ) )
2060 *value = element->value_string[i]->value;
2061 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2066 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2067 element->name, name, element->count_string );
2073 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2077 //_mmcam_dbg_log( "Entered..." );
2079 mmf_return_val_if_fail( gst, FALSE );
2080 mmf_return_val_if_fail( element, FALSE );
2082 if( element->count_int == 0 )
2084 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2088 if( element->value_int == NULL )
2090 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2094 for( i = 0 ; i < element->count_int ; i++ )
2096 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2099 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2100 element->element_name,
2101 element->value_int[i]->name,
2102 element->value_int[i]->value );
2107 if( element->count_string == 0 )
2109 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2113 if( element->value_string == NULL )
2115 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2119 for( i = 0 ; i < element->count_string ; i++ )
2121 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2123 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2124 element->element_name,
2125 element->value_string[i]->name,
2126 element->value_string[i]->value );
2130 //_mmcam_dbg_log( "Done." );
2136 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2139 int count_value = 0;
2141 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2143 if (hcamcorder == NULL) {
2144 _mmcam_dbg_err("handle is NULL");
2148 //_mmcam_dbg_log( "Entered..." );
2150 mmf_return_val_if_fail( name, FALSE );
2152 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2154 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2158 if( type == CONFIGURE_TYPE_MAIN )
2160 for( i = 0 ; i < count_value ; i++ )
2162 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2164 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2171 for( i = 0 ; i < count_value ; i++ )
2173 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2175 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2181 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2186 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2189 int count_value = 0;
2191 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2193 if (hcamcorder == NULL) {
2194 _mmcam_dbg_err("handle is NULL");
2198 //_mmcam_dbg_log( "Entered..." );
2200 mmf_return_val_if_fail( name, FALSE );
2202 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2204 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2208 if( type == CONFIGURE_TYPE_MAIN )
2210 for( i = 0 ; i < count_value ; i++ )
2212 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2214 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2215 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2222 for( i = 0 ; i < count_value ; i++ )
2224 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2226 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2227 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2233 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2238 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2241 int count_value = 0;
2243 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2245 if (hcamcorder == NULL) {
2246 _mmcam_dbg_err("handle is NULL");
2250 //_mmcam_dbg_log( "Entered..." );
2252 mmf_return_val_if_fail( name, FALSE );
2254 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2256 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2260 if( type == CONFIGURE_TYPE_MAIN )
2262 for( i = 0 ; i < count_value ; i++ )
2264 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2266 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2267 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2274 for( i = 0 ; i < count_value ; i++ )
2276 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2278 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2279 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2285 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2290 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2292 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2294 if (hcamcorder == NULL) {
2295 _mmcam_dbg_err("handle is NULL");
2299 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2300 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2302 if( type == CONFIGURE_TYPE_MAIN )
2304 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2306 *size = (int)hcamcorder->conf_main_category_size[category];
2310 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2312 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2319 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2321 int i, j, k, type, category_type;
2324 type_int_range *temp_int_range;
2325 type_int_array *temp_int_array;
2326 type_int_pair_array *temp_int_pair_array;
2327 type_string *temp_string;
2328 type_element *temp_element;
2330 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2332 mmf_return_if_fail( *configure_info );
2334 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2336 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2340 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2343 for( i = 0 ; i < category_type ; i++ )
2345 if( (*configure_info)->info[i] )
2347 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2348 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2350 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2354 case CONFIGURE_VALUE_INT:
2355 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2356 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2358 case CONFIGURE_VALUE_INT_RANGE:
2359 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2360 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2361 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2363 case CONFIGURE_VALUE_INT_ARRAY:
2364 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2365 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2366 temp_int_array->name, temp_int_array->default_value );
2367 for( k = 0 ; k < temp_int_array->count ; k++ )
2369 g_print( "[%d] ", temp_int_array->value[k] );
2373 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2374 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2375 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2376 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2377 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2379 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2383 case CONFIGURE_VALUE_STRING:
2384 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2385 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2387 case CONFIGURE_VALUE_ELEMENT:
2388 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2389 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2390 for( k = 0 ; k < temp_element->count_int ; k++ )
2392 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2394 for( k = 0 ; k < temp_element->count_string ; k++ )
2396 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2400 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 );
2406 g_print( "[ConfigureInfo] : Failed to get value type." );
2412 g_print( "[ConfigureInfoPrint] : Done.\n" );
2416 static type_element *
2417 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2419 type_element *telement = NULL;
2420 const char *codec_type_str = NULL;
2421 int codec_type = MM_AUDIO_CODEC_INVALID;
2422 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2423 _MMCamcorderSubContext *sc = NULL;
2425 mmf_return_val_if_fail(hcamcorder, NULL);
2426 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2428 mmf_return_val_if_fail(sc, NULL);
2432 /* Check element availability */
2433 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2435 switch( codec_type )
2437 case MM_AUDIO_CODEC_AMR:
2438 codec_type_str = "AMR";
2440 case MM_AUDIO_CODEC_G723_1:
2441 codec_type_str = "G723_1";
2443 case MM_AUDIO_CODEC_MP3:
2444 codec_type_str = "MP3";
2446 case MM_AUDIO_CODEC_AAC:
2447 codec_type_str = "AAC";
2449 case MM_AUDIO_CODEC_MMF:
2450 codec_type_str = "MMF";
2452 case MM_AUDIO_CODEC_ADPCM:
2453 codec_type_str = "ADPCM";
2455 case MM_AUDIO_CODEC_WAVE:
2456 codec_type_str = "WAVE";
2458 case MM_AUDIO_CODEC_MIDI:
2459 codec_type_str = "MIDI";
2461 case MM_AUDIO_CODEC_IMELODY:
2462 codec_type_str = "IMELODY";
2464 case MM_AUDIO_CODEC_VORBIS:
2465 codec_type_str = "VORBIS";
2468 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2472 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2473 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2481 static type_element *
2482 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2484 type_element *telement = NULL;
2485 const char *codec_type_str = NULL;
2486 int codec_type = MM_VIDEO_CODEC_INVALID;
2487 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2488 _MMCamcorderSubContext *sc = NULL;
2490 mmf_return_val_if_fail(hcamcorder, NULL);
2491 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2493 mmf_return_val_if_fail(sc, NULL);
2497 /* Check element availability */
2498 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2500 switch( codec_type )
2502 case MM_VIDEO_CODEC_H263:
2503 codec_type_str = "H263";
2505 case MM_VIDEO_CODEC_H264:
2506 codec_type_str = "H264";
2508 case MM_VIDEO_CODEC_H26L:
2509 codec_type_str = "H26L";
2511 case MM_VIDEO_CODEC_MPEG4:
2512 codec_type_str = "MPEG4";
2514 case MM_VIDEO_CODEC_MPEG1:
2515 codec_type_str = "MPEG1";
2517 case MM_VIDEO_CODEC_THEORA:
2518 codec_type_str = "THEORA";
2521 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2525 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2526 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2534 static type_element *
2535 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2537 type_element *telement = NULL;
2538 const char *codec_type_str = NULL;
2539 int codec_type = MM_IMAGE_CODEC_INVALID;
2540 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2541 _MMCamcorderSubContext *sc = NULL;
2543 mmf_return_val_if_fail(hcamcorder, NULL);
2544 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2546 mmf_return_val_if_fail(sc, NULL);
2550 /* Check element availability */
2551 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2553 switch( codec_type )
2555 case MM_IMAGE_CODEC_JPEG:
2556 codec_type_str = "JPEG";
2558 case MM_IMAGE_CODEC_SRW:
2559 codec_type_str = "SRW";
2561 case MM_IMAGE_CODEC_JPEG_SRW:
2562 codec_type_str = "JPEG_SRW";
2564 case MM_IMAGE_CODEC_PNG:
2565 codec_type_str = "PNG";
2567 case MM_IMAGE_CODEC_BMP:
2568 codec_type_str = "BMP";
2570 case MM_IMAGE_CODEC_WBMP:
2571 codec_type_str = "WBMP";
2573 case MM_IMAGE_CODEC_TIFF:
2574 codec_type_str = "TIFF";
2576 case MM_IMAGE_CODEC_PCX:
2577 codec_type_str = "PCX";
2579 case MM_IMAGE_CODEC_GIF:
2580 codec_type_str = "GIF";
2582 case MM_IMAGE_CODEC_ICO:
2583 codec_type_str = "ICO";
2585 case MM_IMAGE_CODEC_RAS:
2586 codec_type_str = "RAS";
2588 case MM_IMAGE_CODEC_TGA:
2589 codec_type_str = "TGA";
2591 case MM_IMAGE_CODEC_XBM:
2592 codec_type_str = "XBM";
2594 case MM_IMAGE_CODEC_XPM:
2595 codec_type_str = "XPM";
2598 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2602 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2603 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2611 static type_element *
2612 __mmcamcorder_get_file_format_element(MMHandleType handle)
2614 type_element *telement = NULL;
2615 const char *mux_type_str = NULL;
2616 int file_type = MM_FILE_FORMAT_INVALID;
2617 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2618 _MMCamcorderSubContext *sc = NULL;
2620 mmf_return_val_if_fail(hcamcorder, NULL);
2621 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2623 mmf_return_val_if_fail(sc, NULL);
2627 /* Check element availability */
2628 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2632 case MM_FILE_FORMAT_3GP:
2633 mux_type_str = "3GP";
2635 case MM_FILE_FORMAT_AMR:
2636 mux_type_str = "AMR";
2638 case MM_FILE_FORMAT_MP4:
2639 mux_type_str = "MP4";
2641 case MM_FILE_FORMAT_AAC:
2642 mux_type_str = "AAC";
2644 case MM_FILE_FORMAT_MP3:
2645 mux_type_str = "MP3";
2647 case MM_FILE_FORMAT_OGG:
2648 mux_type_str = "OGG";
2650 case MM_FILE_FORMAT_WAV:
2651 mux_type_str = "WAV";
2653 case MM_FILE_FORMAT_AVI:
2654 mux_type_str = "AVI";
2656 case MM_FILE_FORMAT_WMA:
2657 mux_type_str = "WMA";
2659 case MM_FILE_FORMAT_WMV:
2660 mux_type_str = "WMV";
2662 case MM_FILE_FORMAT_MID:
2663 mux_type_str = "MID";
2665 case MM_FILE_FORMAT_MMF:
2666 mux_type_str = "MMF";
2668 case MM_FILE_FORMAT_MATROSKA:
2669 mux_type_str = "MATROSKA";
2671 case MM_FILE_FORMAT_M2TS:
2672 mux_type_str = "M2TS";
2675 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2679 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2680 CONFIGURE_CATEGORY_MAIN_MUX,
2689 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2691 type_element *telement = NULL;
2693 _mmcam_dbg_log("type:%d", type);
2697 case MM_CAM_AUDIO_ENCODER:
2698 telement = __mmcamcorder_get_audio_codec_element(handle);
2700 case MM_CAM_VIDEO_ENCODER:
2701 telement = __mmcamcorder_get_video_codec_element(handle);
2703 case MM_CAM_IMAGE_ENCODER:
2704 telement = __mmcamcorder_get_image_codec_element(handle);
2706 case MM_CAM_FILE_FORMAT:
2707 telement = __mmcamcorder_get_file_format_element(handle);
2710 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2717 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2719 int codec_index = MM_AUDIO_CODEC_INVALID;
2722 _mmcam_dbg_err("name is NULL");
2723 return MM_AUDIO_CODEC_INVALID;
2726 if (!strcmp(name, "AMR")) {
2727 codec_index = MM_AUDIO_CODEC_AMR;
2728 } else if (!strcmp(name, "G723_1")) {
2729 codec_index = MM_AUDIO_CODEC_G723_1;
2730 } else if (!strcmp(name, "MP3")) {
2731 codec_index = MM_AUDIO_CODEC_MP3;
2732 } else if (!strcmp(name, "AAC")) {
2733 codec_index = MM_AUDIO_CODEC_AAC;
2734 } else if (!strcmp(name, "MMF")) {
2735 codec_index = MM_AUDIO_CODEC_MMF;
2736 } else if (!strcmp(name, "ADPCM")) {
2737 codec_index = MM_AUDIO_CODEC_ADPCM;
2738 } else if (!strcmp(name, "WAVE")) {
2739 codec_index = MM_AUDIO_CODEC_WAVE;
2740 } else if (!strcmp(name, "MIDI")) {
2741 codec_index = MM_AUDIO_CODEC_MIDI;
2742 } else if (!strcmp(name, "IMELODY")) {
2743 codec_index = MM_AUDIO_CODEC_IMELODY;
2744 } else if (!strcmp(name, "VORBIS")) {
2745 codec_index = MM_AUDIO_CODEC_VORBIS;
2748 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2755 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2757 int codec_index = MM_VIDEO_CODEC_INVALID;
2760 _mmcam_dbg_err("name is NULL");
2761 return MM_VIDEO_CODEC_INVALID;
2764 if (!strcmp(name, "H263")) {
2765 codec_index = MM_VIDEO_CODEC_H263;
2766 } else if (!strcmp(name, "H264")) {
2767 codec_index = MM_VIDEO_CODEC_H264;
2768 } else if (!strcmp(name, "H26L")) {
2769 codec_index = MM_VIDEO_CODEC_H26L;
2770 } else if (!strcmp(name, "MPEG4")) {
2771 codec_index = MM_VIDEO_CODEC_MPEG4;
2772 } else if (!strcmp(name, "MPEG1")) {
2773 codec_index = MM_VIDEO_CODEC_MPEG1;
2774 } else if (!strcmp(name, "THEORA")) {
2775 codec_index = MM_VIDEO_CODEC_THEORA;
2778 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2785 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2787 int codec_index = MM_IMAGE_CODEC_INVALID;
2790 _mmcam_dbg_err("name is NULL");
2791 return MM_IMAGE_CODEC_INVALID;
2794 if (!strcmp(name, "JPEG")) {
2795 codec_index = MM_IMAGE_CODEC_JPEG;
2796 } else if (!strcmp(name, "PNG")) {
2797 codec_index = MM_IMAGE_CODEC_PNG;
2798 } else if (!strcmp(name, "BMP")) {
2799 codec_index = MM_IMAGE_CODEC_BMP;
2800 } else if (!strcmp(name, "WBMP")) {
2801 codec_index = MM_IMAGE_CODEC_WBMP;
2802 } else if (!strcmp(name, "TIFF")) {
2803 codec_index = MM_IMAGE_CODEC_TIFF;
2804 } else if (!strcmp(name, "PCX")) {
2805 codec_index = MM_IMAGE_CODEC_PCX;
2806 } else if (!strcmp(name, "GIF")) {
2807 codec_index = MM_IMAGE_CODEC_GIF;
2808 } else if (!strcmp(name, "ICO")) {
2809 codec_index = MM_IMAGE_CODEC_ICO;
2810 } else if (!strcmp(name, "RAS")) {
2811 codec_index = MM_IMAGE_CODEC_RAS;
2812 } else if (!strcmp(name, "TGA")) {
2813 codec_index = MM_IMAGE_CODEC_TGA;
2814 } else if (!strcmp(name, "XBM")) {
2815 codec_index = MM_IMAGE_CODEC_XBM;
2816 } else if (!strcmp(name, "XPM")) {
2817 codec_index = MM_IMAGE_CODEC_XPM;
2820 _mmcam_dbg_log("image codec index %d", codec_index);
2826 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2828 int mux_index = MM_FILE_FORMAT_INVALID;
2831 _mmcam_dbg_err("name is NULL");
2832 return MM_FILE_FORMAT_INVALID;
2835 if (!strcmp(name, "3GP")) {
2836 mux_index = MM_FILE_FORMAT_3GP;
2837 } else if (!strcmp(name, "AMR")) {
2838 mux_index = MM_FILE_FORMAT_AMR;
2839 } else if (!strcmp(name, "MP4")) {
2840 mux_index = MM_FILE_FORMAT_MP4;
2841 } else if (!strcmp(name, "AAC")) {
2842 mux_index = MM_FILE_FORMAT_AAC;
2843 } else if (!strcmp(name, "MP3")) {
2844 mux_index = MM_FILE_FORMAT_MP3;
2845 } else if (!strcmp(name, "OGG")) {
2846 mux_index = MM_FILE_FORMAT_OGG;
2847 } else if (!strcmp(name, "WAV")) {
2848 mux_index = MM_FILE_FORMAT_WAV;
2849 } else if (!strcmp(name, "AVI")) {
2850 mux_index = MM_FILE_FORMAT_AVI;
2851 } else if (!strcmp(name, "WMA")) {
2852 mux_index = MM_FILE_FORMAT_WMA;
2853 } else if (!strcmp(name, "WMV")) {
2854 mux_index = MM_FILE_FORMAT_WMV;
2855 } else if (!strcmp(name, "MID")) {
2856 mux_index = MM_FILE_FORMAT_MID;
2857 } else if (!strcmp(name, "MMF")) {
2858 mux_index = MM_FILE_FORMAT_MMF;
2859 } else if (!strcmp(name, "MATROSKA")) {
2860 mux_index = MM_FILE_FORMAT_MATROSKA;
2861 } else if (!strcmp(name, "M2TS")) {
2862 mux_index = MM_FILE_FORMAT_M2TS;
2866 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2873 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2877 mmf_return_val_if_fail(name, -1);
2879 switch(conf_category)
2881 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2882 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2884 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2885 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2887 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2888 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2890 case CONFIGURE_CATEGORY_MAIN_MUX:
2891 fmt = _mmcamcorder_get_mux_format(handle, name);
2894 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2901 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2903 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2904 camera_conf* configure_info = NULL;
2906 int total_count = 0;
2908 mmf_return_val_if_fail(hcamcorder, 0);
2910 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2912 configure_info = hcamcorder->conf_main;
2914 if (configure_info->info[conf_category]) {
2917 const char *name = NULL;
2918 int count = configure_info->info[conf_category]->count;
2919 conf_detail *info = configure_info->info[conf_category];
2921 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2923 if (count <= 0 || !info) {
2927 arr = (int*) g_malloc0(count * sizeof(int));
2929 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2933 for (i = 0 ; i < count ; i++) {
2934 if (info->detail_info[i] == NULL) {
2938 name = ((type_element*)(info->detail_info[i]))->name;
2939 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2941 arr[total_count++] = fmt;
2944 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/