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 /* Record sink element default value */
179 static type_element _recordsink_element_default = {
188 /* H263 element default value */
189 static type_element _h263_element_default = {
198 /* H264 element default value */
199 static type_element _h264_element_default = {
208 /* H26L element default value */
209 static type_element _h26l_element_default = {
218 /* MPEG4 element default value */
219 static type_element _mpeg4_element_default = {
228 /* MPEG1 element default value */
229 static type_element _mpeg1_element_default = {
238 /* THEORA element default value */
239 static type_element _theora_element_default = {
248 /* AMR element default value */
249 static type_element _amr_element_default = {
258 /* G723_1 element default value */
259 static type_element _g723_1_element_default = {
268 /* MP3 element default value */
269 static type_element _mp3_element_default = {
278 /* AAC element default value */
279 static type_element _aac_element_default = {
288 /* MMF element default value */
289 static type_element _mmf_element_default = {
298 /* ADPCM element default value */
299 static type_element _adpcm_element_default = {
301 "avenc_adpcm_ima_qt",
308 /* WAVE element default value */
309 static type_element _wave_element_default = {
318 /* VORBIS element default value */
319 static type_element _vorbis_element_default = {
328 /* MIDI element default value */
329 static type_element _midi_element_default = {
338 /* IMELODY element default value */
339 static type_element _imelody_element_default = {
348 /* JPEG element default value */
349 static type_element _jpeg_element_default = {
358 /* PNG element default value */
359 static type_element _png_element_default = {
368 /* BMP element default value */
369 static type_element _bmp_element_default = {
378 /* WBMP element default value */
379 static type_element _wbmp_element_default = {
388 /* TIFF element default value */
389 static type_element _tiff_element_default = {
398 /* PCX element default value */
399 static type_element _pcx_element_default = {
408 /* GIF element default value */
409 static type_element _gif_element_default = {
418 /* ICO element default value */
419 static type_element _ico_element_default = {
428 /* RAS element default value */
429 static type_element _ras_element_default = {
438 /* TGA element default value */
439 static type_element _tga_element_default = {
448 /* XBM element default value */
449 static type_element _xbm_element_default = {
458 /* XPM element default value */
459 static type_element _xpm_element_default = {
468 /* 3GP element default value */
469 static type_element _3gp_element_default = {
478 /* AMR mux element default value */
479 static type_element _amrmux_element_default = {
488 /* MP4 element default value */
489 static type_element _mp4_element_default = {
498 /* AAC mux element default value */
499 static type_element _aacmux_element_default = {
508 /* MP3 mux element default value */
509 static type_element _mp3mux_element_default = {
518 /* OGG element default value */
519 static type_element _ogg_element_default = {
528 /* WAV element default value */
529 static type_element _wav_element_default = {
538 /* AVI element default value */
539 static type_element _avi_element_default = {
548 /* WMA element default value */
549 static type_element _wma_element_default = {
558 /* WMV element default value */
559 static type_element _wmv_element_default = {
568 /* MID element default value */
569 static type_element _mid_element_default = {
578 /* MMF mux element default value */
579 static type_element _mmfmux_element_default = {
588 /* MATROSKA element default value */
589 static type_element _matroska_element_default = {
598 /* M2TS element default value */
599 static type_element _m2ts_element_default = {
608 /* [General] matching table */
609 static conf_info_table conf_main_general_table[] = {
610 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
611 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
612 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
613 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
616 /* [VideoInput] matching table */
617 static conf_info_table conf_main_video_input_table[] = {
618 { "UseConfCtrl", CONFIGURE_VALUE_INT, {.value_int = 1} },
619 { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {NULL} },
620 { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {NULL} },
621 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
622 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
623 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
624 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
625 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
626 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
629 /* [AudioInput] matching table */
630 static conf_info_table conf_main_audio_input_table[] = {
631 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
632 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
633 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
636 /* [VideoOutput] matching table */
637 static conf_info_table conf_main_video_output_table[] = {
638 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
639 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
640 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
641 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
642 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
643 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
644 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
645 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
646 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
647 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
648 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
651 /* [Capture] matching table */
652 static conf_info_table conf_main_capture_table[] = {
653 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
654 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
655 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
656 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
659 /* [Record] matching table */
660 static conf_info_table conf_main_record_table[] = {
661 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
662 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
663 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
664 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
665 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
668 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
669 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
670 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
673 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
674 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
675 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
676 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
677 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
678 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
679 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
682 /* [VideoEncoder] matching table */
683 static conf_info_table conf_main_video_encoder_table[] = {
684 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
685 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
686 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
687 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
688 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
689 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
692 /* [AudioEncoder] matching table */
693 static conf_info_table conf_main_audio_encoder_table[] = {
694 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
695 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
696 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
697 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
698 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
699 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
700 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
701 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
702 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
703 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
706 /* [ImageEncoder] matching table */
707 static conf_info_table conf_main_image_encoder_table[] = {
708 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
709 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
710 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
711 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
712 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
713 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
714 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
715 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
716 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
717 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
718 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
719 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
722 /* [Mux] matching table */
723 static conf_info_table conf_main_mux_table[] = {
724 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
725 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
726 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
727 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
728 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
729 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
730 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
731 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
732 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
733 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
734 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
735 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
736 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
737 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
745 /* [Camera] matching table */
746 static conf_info_table conf_ctrl_camera_table[] = {
747 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
748 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
749 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
750 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
751 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
752 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
753 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
754 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
755 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
756 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
757 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
758 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
759 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
760 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
761 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
762 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
763 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
764 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
765 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
766 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
767 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
768 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
771 /* [Strobe] matching table */
772 static conf_info_table conf_ctrl_strobe_table[] = {
773 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
775 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
778 /* [Effect] matching table */
779 static conf_info_table conf_ctrl_effect_table[] = {
780 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
781 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
782 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
783 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
784 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
785 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
786 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
789 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
790 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
791 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
794 /* [Photograph] matching table */
795 static conf_info_table conf_ctrl_photograph_table[] = {
796 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
797 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
798 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
799 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
800 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
801 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
802 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
803 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
804 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
805 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
806 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
807 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
808 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
812 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
813 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
814 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
817 /* [Capture] matching table */
818 static conf_info_table conf_ctrl_capture_table[] = {
819 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
820 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
821 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
822 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
823 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
824 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
827 /* [Detect] matching table */
828 static conf_info_table conf_ctrl_detect_table[] = {
829 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
830 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
831 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
832 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
835 if (hcamcorder == NULL) {
836 _mmcam_dbg_err("handle is NULL");
840 _mmcam_dbg_log("Entered...");
842 if (type == CONFIGURE_TYPE_MAIN) {
843 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
844 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
845 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
846 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
847 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
848 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
849 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
850 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
851 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
852 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
854 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
855 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
856 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
857 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
858 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
859 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
860 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
861 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
862 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
863 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
865 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
867 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
868 (*configure_info)->info[i] = NULL;
871 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
872 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
873 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
874 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
875 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
876 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
878 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
879 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
880 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
881 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
882 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
883 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
885 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
887 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
888 (*configure_info)->info[i] = NULL;
892 _mmcam_dbg_log("Done.");
898 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
900 int ret = MM_ERROR_NONE;
902 char conf_path[60] = {'\0',};
904 _mmcam_dbg_log("Opening...[%s]", ConfFile);
906 mmf_return_val_if_fail(ConfFile, FALSE);
908 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
909 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
911 fd = fopen(conf_path, "r");
913 _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path);
915 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
916 _mmcam_dbg_log("Try open Configure File[%s]", conf_path);
917 fd = fopen(conf_path, "r");
919 _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno);
924 ret = _mmcamcorder_conf_parse_info(handle, type, fd, configure_info);
927 if (errno == ENOENT) {
928 ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
930 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
934 _mmcam_dbg_log("Leave...");
940 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
942 const unsigned int BUFFER_NUM_DETAILS = 256;
943 const unsigned int BUFFER_NUM_TOKEN = 20;
944 size_t BUFFER_LENGTH_STRING = 256;
945 const char* delimiters = " |=,\t\n";
948 int count_main_category = 0;
949 int count_details = 0;
954 char *buffer_string = NULL;
955 char *buffer_details[BUFFER_NUM_DETAILS];
956 char *buffer_token[BUFFER_NUM_TOKEN];
958 char *category_name = NULL;
959 char *detail_string = NULL;
960 char *user_ptr = NULL;
962 _mmcam_dbg_log( "" );
964 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
965 if (new_conf == NULL) {
966 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
967 *configure_info = NULL;
968 return MM_ERROR_CAMCORDER_LOW_MEMORY;
971 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
972 if (buffer_string == NULL) {
973 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
974 *configure_info = NULL;
975 SAFE_G_FREE(new_conf);
976 return MM_ERROR_CAMCORDER_LOW_MEMORY;
979 new_conf->type = type;
980 *configure_info = new_conf;
982 _mmcamcorder_conf_init(handle, type, &new_conf);
985 _mmcam_dbg_err("failed file descriptor fail");
986 *configure_info = NULL;
987 SAFE_G_FREE(buffer_string);
988 SAFE_G_FREE(new_conf);
989 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
993 count_main_category = 0;
999 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1000 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1003 token = strtok_r( buffer_string, delimiters, &user_ptr );
1005 if ((token) && (token[0] == ';') && (length_read > -1))
1007 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1013 /*_mmcam_dbg_log( "token : [%s]", token );*/
1014 buffer_token[count_token] = token;
1016 token = strtok_r( NULL, delimiters, &user_ptr );
1019 if( count_token == 0 )
1028 if( *buffer_token[0] == ';' )
1030 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1033 else if( *buffer_token[0] == '[' )
1035 category_name = get_new_string( buffer_token[0] );
1036 if (category_name == NULL) {
1037 _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
1041 count_main_category++;
1044 while( !feof( fd ) )
1046 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1047 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1049 detail_string = get_new_string( buffer_string );
1051 token = strtok_r( buffer_string, delimiters, &user_ptr );
1053 if( token && token[0] != ';' && length_read > -1 )
1055 /*_mmcam_dbg_log( "token : [%s]", token );*/
1056 if( token[0] == '[' )
1059 buffer_token[0] = token;
1060 SAFE_G_FREE( detail_string );
1064 buffer_details[count_details++] = detail_string;
1068 SAFE_G_FREE( detail_string );
1072 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1074 if( count_details == 0 )
1076 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1077 SAFE_G_FREE(category_name);
1084 if( type == CONFIGURE_TYPE_MAIN )
1086 if( !strcmp( "[General]", category_name ) )
1088 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1090 else if( !strcmp( "[VideoInput]", category_name ) )
1092 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1094 else if( !strcmp( "[AudioInput]", category_name ) )
1096 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1098 else if( !strcmp( "[VideoOutput]", category_name ) )
1100 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1102 else if( !strcmp( "[Capture]", category_name ) )
1104 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1106 else if( !strcmp( "[Record]", category_name ) )
1108 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1110 else if( !strcmp( "[VideoEncoder]", category_name ) )
1112 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1114 else if( !strcmp( "[AudioEncoder]", category_name ) )
1116 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1118 else if( !strcmp( "[ImageEncoder]", category_name ) )
1120 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1122 else if( !strcmp( "[Mux]", category_name ) )
1124 category = CONFIGURE_CATEGORY_MAIN_MUX;
1129 if( !strcmp( "[Camera]", category_name ) )
1131 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1133 else if( !strcmp( "[Strobe]", category_name ) )
1135 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1137 else if( !strcmp( "[Effect]", category_name ) )
1139 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1141 else if( !strcmp( "[Photograph]", category_name ) )
1143 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1145 else if( !strcmp( "[Capture]", category_name ) )
1147 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1149 else if( !strcmp( "[Detect]", category_name ) )
1151 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1155 if( category != -1 )
1157 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1158 buffer_details, category, count_details );
1162 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1169 for( i = 0 ; i < count_details ; i++ )
1171 SAFE_G_FREE( buffer_details[i] );
1176 SAFE_G_FREE(category_name);
1179 //(*configure_info) = new_conf;
1181 SAFE_G_FREE( buffer_string );
1183 /*_mmcam_dbg_log( "Done." );*/
1185 return MM_ERROR_NONE;
1189 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1194 int type = CONFIGURE_VALUE_INT;
1196 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1197 camera_conf *temp_conf = (*configure_info);
1199 type_int2 *temp_int = NULL;
1200 type_int_range *temp_int_range = NULL;
1201 type_int_array *temp_int_array = NULL;
1202 type_int_pair_array *temp_int_pair_array = NULL;
1203 type_string2 *temp_string = NULL;
1204 type_string_array *temp_string_array = NULL;
1205 type_element2 *temp_element = NULL;
1207 _mmcam_dbg_log("Entered...");
1209 mmf_return_if_fail(temp_conf);
1211 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1212 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1214 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1217 for (i = 0 ; i < category_num ; i++) {
1218 if (temp_conf->info[i]) {
1219 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1220 if (temp_conf->info[i]->detail_info[j] == NULL) {
1224 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1226 case CONFIGURE_VALUE_INT:
1227 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1228 SAFE_G_FREE(temp_int->name);
1230 case CONFIGURE_VALUE_INT_RANGE:
1231 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1232 SAFE_G_FREE(temp_int_range->name);
1234 case CONFIGURE_VALUE_INT_ARRAY:
1235 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1236 SAFE_G_FREE(temp_int_array->name);
1237 SAFE_G_FREE(temp_int_array->value);
1239 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1240 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1241 SAFE_G_FREE(temp_int_pair_array->name);
1242 SAFE_G_FREE(temp_int_pair_array->value[0]);
1243 SAFE_G_FREE(temp_int_pair_array->value[1]);
1245 case CONFIGURE_VALUE_STRING:
1246 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1247 SAFE_G_FREE(temp_string->name);
1248 SAFE_G_FREE(temp_string->value);
1250 case CONFIGURE_VALUE_STRING_ARRAY:
1251 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1252 SAFE_G_FREE(temp_string_array->name);
1253 if (temp_string_array->value) {
1254 count = temp_string_array->count;
1255 for (k = 0 ; k < count ; k++) {
1256 SAFE_G_FREE(temp_string_array->value[k]);
1258 SAFE_G_FREE(temp_string_array->value);
1260 SAFE_G_FREE(temp_string_array->default_value);
1262 case CONFIGURE_VALUE_ELEMENT:
1263 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1264 SAFE_G_FREE(temp_element->name);
1265 SAFE_G_FREE(temp_element->element_name);
1267 if (temp_element->value_int) {
1268 count = temp_element->count_int;
1269 for (k = 0 ; k < count ; k++) {
1270 SAFE_G_FREE(temp_element->value_int[k]->name);
1271 SAFE_G_FREE(temp_element->value_int[k]);
1273 SAFE_G_FREE(temp_element->value_int);
1276 if (temp_element->value_string) {
1277 count = temp_element->count_string;
1278 for (k = 0 ; k < count ; k++) {
1279 SAFE_G_FREE(temp_element->value_string[k]->name);
1280 SAFE_G_FREE(temp_element->value_string[k]->value);
1281 SAFE_G_FREE(temp_element->value_string[k]);
1283 SAFE_G_FREE(temp_element->value_string);
1287 _mmcam_dbg_warn("unknown type %d", type);
1292 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1295 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1297 SAFE_G_FREE(temp_conf->info[i]);
1298 temp_conf->info[i] = NULL;
1302 SAFE_G_FREE((*configure_info)->info);
1303 SAFE_G_FREE((*configure_info));
1305 _mmcam_dbg_log("Done.");
1308 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1311 int count_value = 0;
1313 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1315 if (hcamcorder == NULL) {
1316 _mmcam_dbg_err("handle is NULL");
1320 /*_mmcam_dbg_log( "Entered..." );*/
1322 mmf_return_val_if_fail( name, FALSE );
1324 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1326 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1330 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1332 if( type == CONFIGURE_TYPE_MAIN )
1334 for( i = 0 ; i < count_value ; i++ )
1336 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1338 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1339 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1346 for( i = 0 ; i < count_value ; i++ )
1348 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1350 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1351 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1361 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1363 const int BUFFER_NUM_TOKEN = 256;
1370 char *buffer_token[BUFFER_NUM_TOKEN];
1371 char *user_ptr = NULL;
1373 const char *delimiters = " |=,\t\n";
1374 const char *delimiters_sub = " |\t\n";
1375 const char *delimiters_3rd = "|\n";
1377 mmf_return_val_if_fail( buffer_details, FALSE );
1379 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1380 if (*info == NULL) {
1381 _mmcam_dbg_err("allocation failed");
1384 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1385 (*info)->count = count_details;
1387 for ( i = 0 ; i < count_details ; i++ ) {
1388 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1390 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1393 buffer_token[count_token] = token;
1396 (*info)->detail_info[i] = NULL;
1397 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1401 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1402 (*info)->detail_info[i] = NULL;
1403 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1407 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1408 token = strtok_r( NULL, delimiters, &user_ptr );
1410 buffer_token[count_token] = token;
1411 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1413 token = strtok_r( NULL, delimiters, &user_ptr );
1416 if (count_token < 2) {
1417 (*info)->detail_info[i] = NULL;
1418 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1421 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1423 strtok_r( NULL, delimiters_sub, &user_ptr );
1425 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1426 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1428 buffer_token[count_token] = token;
1429 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1431 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1433 } else { /* CONFIGURE_VALUE_STRING */
1434 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1437 buffer_token[count_token] = token;
1438 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1443 if (count_token < 2) {
1444 (*info)->detail_info[i] = NULL;
1445 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1452 case CONFIGURE_VALUE_INT:
1456 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1457 if ( new_int == NULL ) {
1458 _mmcam_dbg_err("allocation failed");
1461 new_int->name = get_new_string( buffer_token[0] );
1462 new_int->value = atoi( buffer_token[1] );
1463 (*info)->detail_info[i] = (void*)new_int;
1464 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1467 case CONFIGURE_VALUE_INT_RANGE:
1469 type_int_range* new_int_range;
1471 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1472 if ( new_int_range == NULL ) {
1473 _mmcam_dbg_err("allocation failed");
1476 new_int_range->name = get_new_string( buffer_token[0] );
1477 new_int_range->min = atoi( buffer_token[1] );
1478 new_int_range->max = atoi( buffer_token[2] );
1479 new_int_range->default_value = atoi( buffer_token[3] );
1480 (*info)->detail_info[i] = (void*)new_int_range;
1482 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1483 new_int_range->name,
1486 new_int_range->default_value);
1490 case CONFIGURE_VALUE_INT_ARRAY:
1492 int count_value = count_token - 2;
1493 type_int_array* new_int_array;
1495 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1496 if (new_int_array == NULL) {
1497 _mmcam_dbg_err("allocation failed");
1500 new_int_array->name = get_new_string( buffer_token[0] );
1501 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1502 if (new_int_array->value == NULL) {
1503 SAFE_G_FREE(new_int_array->name);
1504 SAFE_G_FREE(new_int_array);
1505 _mmcam_dbg_err("allocation failed");
1508 new_int_array->count = count_value;
1510 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1511 for ( j = 0 ; j < count_value ; j++ ) {
1512 new_int_array->value[j] = atoi( buffer_token[j+1] );
1513 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1516 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1517 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1519 (*info)->detail_info[i] = (void*)new_int_array;
1522 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1524 int count_value = ( count_token - 3 ) >> 1;
1525 type_int_pair_array* new_int_pair_array;
1527 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1528 if ( new_int_pair_array == NULL ) {
1529 _mmcam_dbg_err("allocation failed");
1532 new_int_pair_array->name = get_new_string( buffer_token[0] );
1533 new_int_pair_array->value[0] = (int*)g_malloc0( sizeof(int)*(count_value) );
1534 if ( new_int_pair_array->value[0] == NULL ) {
1535 SAFE_G_FREE(new_int_pair_array->name);
1536 SAFE_G_FREE(new_int_pair_array);
1537 _mmcam_dbg_err("allocation failed");
1540 new_int_pair_array->value[1] = (int*)g_malloc0( sizeof(int)*(count_value) );
1541 if ( new_int_pair_array->value[1] == NULL ) {
1542 SAFE_G_FREE(new_int_pair_array->value[0]);
1543 SAFE_G_FREE(new_int_pair_array->name);
1544 SAFE_G_FREE(new_int_pair_array);
1545 _mmcam_dbg_err("allocation failed");
1548 new_int_pair_array->count = count_value;
1550 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1551 for ( j = 0 ; j < count_value ; j++ ) {
1552 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1553 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1555 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1556 new_int_pair_array->value[0][j],
1557 new_int_pair_array->value[1][j]);
1561 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1562 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1564 _mmcam_dbg_log(" default value[%d,%d]",
1565 new_int_pair_array->default_value[0],
1566 new_int_pair_array->default_value[1]);
1568 (*info)->detail_info[i] = (void*)new_int_pair_array;
1571 case CONFIGURE_VALUE_STRING:
1573 type_string2* new_string;
1575 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1576 if (new_string == NULL) {
1577 _mmcam_dbg_err("allocation failed");
1580 new_string->name = get_new_string( buffer_token[0] );
1581 new_string->value = get_new_string( buffer_token[1] );
1582 (*info)->detail_info[i] = (void*)new_string;
1584 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1587 case CONFIGURE_VALUE_STRING_ARRAY:
1589 int count_value = count_token - 2;
1590 type_string_array* new_string_array;
1592 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1593 if ( new_string_array == NULL ) {
1596 new_string_array->name = get_new_string( buffer_token[0] );
1597 new_string_array->count = count_value;
1598 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1599 if ( new_string_array->value == NULL ) {
1600 SAFE_G_FREE(new_string_array->name);
1601 SAFE_G_FREE(new_string_array);
1602 _mmcam_dbg_err("allocation failed");
1605 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1606 for ( j = 0 ; j < count_value ; j++ ) {
1607 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1608 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1611 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1612 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1613 (*info)->detail_info[i] = (void*)new_string_array;
1616 case CONFIGURE_VALUE_ELEMENT:
1618 type_element2* new_element;
1620 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1621 if ( new_element == NULL ) {
1622 _mmcam_dbg_err("allocation failed");
1625 new_element->name = get_new_string( buffer_token[0] );
1626 new_element->element_name = get_new_string( buffer_token[1] );
1627 new_element->count_int = atoi( buffer_token[2] );
1628 new_element->value_int = NULL;
1629 new_element->count_string = atoi( buffer_token[3] );
1630 new_element->value_string = NULL;
1632 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1633 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1636 /* add int values */
1637 if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
1638 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1639 if ( new_element->value_int) {
1640 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1641 new_element->value_int[j] = (type_int2*)g_malloc0( sizeof(type_int2) );
1642 if ( new_element->value_int[j] ) {
1643 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1644 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1646 _mmcam_dbg_err("allocation failed");
1649 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1650 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1654 _mmcam_dbg_err("allocation failed");
1657 /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/
1658 new_element->value_int = NULL;
1661 /* add string values */
1662 if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
1663 new_element->count_int >= 0 && new_element->count_int <= 30 ) {
1664 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1665 if (new_element->value_string) {
1666 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1667 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1668 if(new_element->value_string[j-new_element->count_int]) {
1669 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1670 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1672 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1673 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);
1676 _mmcam_dbg_err("allocation failed");
1680 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1683 /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/
1684 new_element->value_string = NULL;
1687 (*info)->detail_info[i] = (void*)new_element;
1699 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1704 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1706 mmf_return_val_if_fail( configure_info, FALSE );
1707 mmf_return_val_if_fail( name, FALSE );
1709 if( configure_info->info[category] )
1711 count = configure_info->info[category]->count;
1712 info = configure_info->info[category];
1714 for( i = 0 ; i < count ; i++ )
1716 if( info->detail_info[i] == NULL )
1721 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1723 *value = ((type_int*)(info->detail_info[i]))->value;
1724 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1730 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1732 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1736 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1742 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1747 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1749 mmf_return_val_if_fail( configure_info, FALSE );
1750 mmf_return_val_if_fail( name, FALSE );
1752 if( configure_info->info[category] )
1754 count = configure_info->info[category]->count;
1755 info = configure_info->info[category];
1757 for( i = 0 ; i < count ; i++ )
1759 if( info->detail_info[i] == NULL )
1764 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1766 *value = (type_int_range*)(info->detail_info[i]);
1768 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1769 name, (*value)->min, (*value)->max, (*value)->default_value );
1778 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1784 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1789 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1791 mmf_return_val_if_fail( configure_info, FALSE );
1792 mmf_return_val_if_fail( name, FALSE );
1794 if( configure_info->info[category] )
1796 count = configure_info->info[category]->count;
1797 info = configure_info->info[category];
1799 for( i = 0 ; i < count ; i++ )
1801 if( info->detail_info[i] == NULL )
1806 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1808 *value = (type_int_array*)(info->detail_info[i]);
1810 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1811 name, (*value)->value, (*value)->count, (*value)->default_value );
1820 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1826 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1831 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1833 mmf_return_val_if_fail( configure_info, FALSE );
1834 mmf_return_val_if_fail( name, FALSE );
1836 if( configure_info->info[category] )
1838 count = configure_info->info[category]->count;
1839 info = configure_info->info[category];
1841 for( i = 0 ; i < count ; i++ )
1843 if( info->detail_info[i] == NULL )
1848 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1850 *value = (type_int_pair_array*)(info->detail_info[i]);
1852 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1853 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1854 (*value)->default_value[0], (*value)->default_value[1] );
1863 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1868 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1873 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1875 mmf_return_val_if_fail( configure_info, FALSE );
1876 mmf_return_val_if_fail( name, FALSE );
1878 if( configure_info->info[category] )
1880 count = configure_info->info[category]->count;
1881 info = configure_info->info[category];
1883 for( i = 0 ; i < count ; i++ )
1885 if( info->detail_info[i] == NULL )
1890 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1892 *value = ((type_string*)(info->detail_info[i]))->value;
1893 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1899 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1901 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1905 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1911 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1916 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1918 mmf_return_val_if_fail( configure_info, FALSE );
1919 mmf_return_val_if_fail( name, FALSE );
1921 if( configure_info->info[category] )
1923 count = configure_info->info[category]->count;
1924 info = configure_info->info[category];
1926 for( i = 0 ; i < count ; i++ )
1928 if( info->detail_info[i] == NULL )
1933 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1935 *value = (type_string_array*)(info->detail_info[i]);
1937 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1938 name, (*value)->value, (*value)->count, (*value)->default_value );
1947 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1952 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1957 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1959 mmf_return_val_if_fail( configure_info, FALSE );
1960 mmf_return_val_if_fail( name, FALSE );
1962 if( configure_info->info[category] )
1964 count = configure_info->info[category]->count;
1965 info = configure_info->info[category];
1967 for( i = 0 ; i < count ; i++ )
1969 if( info->detail_info[i] == NULL )
1974 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1976 *element = (type_element*)(info->detail_info[i]);
1977 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1983 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1985 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1989 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
1995 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
1997 //_mmcam_dbg_log( "Entered..." );
1999 mmf_return_val_if_fail( element, FALSE );
2001 *value = element->element_name;
2003 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2009 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2013 //_mmcam_dbg_log( "Entered..." );
2015 mmf_return_val_if_fail( element, FALSE );
2016 mmf_return_val_if_fail( name, FALSE );
2018 for( i = 0 ; i < element->count_int ; i++ )
2020 if( !strcmp( element->value_int[i]->name , name ) )
2022 *value = element->value_int[i]->value;
2023 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2028 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2029 element->name, name, element->count_int );
2035 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2039 //_mmcam_dbg_log( "Entered..." );
2041 mmf_return_val_if_fail( element, FALSE );
2042 mmf_return_val_if_fail( name, FALSE );
2044 for( i = 0 ; i < element->count_string ; i++ )
2046 if( !strcmp( element->value_string[i]->name , name ) )
2048 *value = element->value_string[i]->value;
2049 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2054 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2055 element->name, name, element->count_string );
2061 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2065 //_mmcam_dbg_log( "Entered..." );
2067 mmf_return_val_if_fail( gst, FALSE );
2068 mmf_return_val_if_fail( element, FALSE );
2070 if( element->count_int == 0 )
2072 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2076 if( element->value_int == NULL )
2078 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2082 for( i = 0 ; i < element->count_int ; i++ )
2084 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2087 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2088 element->element_name,
2089 element->value_int[i]->name,
2090 element->value_int[i]->value );
2095 if( element->count_string == 0 )
2097 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2101 if( element->value_string == NULL )
2103 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2107 for( i = 0 ; i < element->count_string ; i++ )
2109 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2111 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2112 element->element_name,
2113 element->value_string[i]->name,
2114 element->value_string[i]->value );
2118 //_mmcam_dbg_log( "Done." );
2124 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2127 int count_value = 0;
2129 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2131 if (hcamcorder == NULL) {
2132 _mmcam_dbg_err("handle is NULL");
2136 //_mmcam_dbg_log( "Entered..." );
2138 mmf_return_val_if_fail( name, FALSE );
2140 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2142 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2146 if( type == CONFIGURE_TYPE_MAIN )
2148 for( i = 0 ; i < count_value ; i++ )
2150 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2152 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2159 for( i = 0 ; i < count_value ; i++ )
2161 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2163 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2169 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2174 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2177 int count_value = 0;
2179 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2181 if (hcamcorder == NULL) {
2182 _mmcam_dbg_err("handle is NULL");
2186 //_mmcam_dbg_log( "Entered..." );
2188 mmf_return_val_if_fail( name, FALSE );
2190 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2192 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2196 if( type == CONFIGURE_TYPE_MAIN )
2198 for( i = 0 ; i < count_value ; i++ )
2200 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2202 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2203 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2210 for( i = 0 ; i < count_value ; i++ )
2212 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2214 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2215 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2221 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2226 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2229 int count_value = 0;
2231 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2233 if (hcamcorder == NULL) {
2234 _mmcam_dbg_err("handle is NULL");
2238 //_mmcam_dbg_log( "Entered..." );
2240 mmf_return_val_if_fail( name, FALSE );
2242 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2244 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2248 if( type == CONFIGURE_TYPE_MAIN )
2250 for( i = 0 ; i < count_value ; i++ )
2252 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2254 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2255 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2262 for( i = 0 ; i < count_value ; i++ )
2264 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2266 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2267 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2273 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2278 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2280 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2282 if (hcamcorder == NULL) {
2283 _mmcam_dbg_err("handle is NULL");
2287 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2288 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2290 if( type == CONFIGURE_TYPE_MAIN )
2292 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2294 *size = (int)hcamcorder->conf_main_category_size[category];
2298 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2300 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2307 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2309 int i, j, k, type, category_type;
2312 type_int_range *temp_int_range;
2313 type_int_array *temp_int_array;
2314 type_int_pair_array *temp_int_pair_array;
2315 type_string *temp_string;
2316 type_element *temp_element;
2318 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2320 mmf_return_if_fail( *configure_info );
2322 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2324 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2328 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2331 for( i = 0 ; i < category_type ; i++ )
2333 if( (*configure_info)->info[i] )
2335 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2336 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2338 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2342 case CONFIGURE_VALUE_INT:
2343 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2344 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2346 case CONFIGURE_VALUE_INT_RANGE:
2347 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2348 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2349 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2351 case CONFIGURE_VALUE_INT_ARRAY:
2352 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2353 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2354 temp_int_array->name, temp_int_array->default_value );
2355 for( k = 0 ; k < temp_int_array->count ; k++ )
2357 g_print( "[%d] ", temp_int_array->value[k] );
2361 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2362 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2363 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2364 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2365 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2367 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2371 case CONFIGURE_VALUE_STRING:
2372 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2373 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2375 case CONFIGURE_VALUE_ELEMENT:
2376 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2377 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2378 for( k = 0 ; k < temp_element->count_int ; k++ )
2380 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2382 for( k = 0 ; k < temp_element->count_string ; k++ )
2384 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2388 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 );
2394 g_print( "[ConfigureInfo] : Failed to get value type." );
2400 g_print( "[ConfigureInfoPrint] : Done.\n" );
2404 static type_element *
2405 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2407 type_element *telement = NULL;
2408 const char *codec_type_str = NULL;
2409 int codec_type = MM_AUDIO_CODEC_INVALID;
2410 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2411 _MMCamcorderSubContext *sc = NULL;
2413 mmf_return_val_if_fail(hcamcorder, NULL);
2414 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2416 mmf_return_val_if_fail(sc, NULL);
2420 /* Check element availability */
2421 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2423 switch( codec_type )
2425 case MM_AUDIO_CODEC_AMR:
2426 codec_type_str = "AMR";
2428 case MM_AUDIO_CODEC_G723_1:
2429 codec_type_str = "G723_1";
2431 case MM_AUDIO_CODEC_MP3:
2432 codec_type_str = "MP3";
2434 case MM_AUDIO_CODEC_AAC:
2435 codec_type_str = "AAC";
2437 case MM_AUDIO_CODEC_MMF:
2438 codec_type_str = "MMF";
2440 case MM_AUDIO_CODEC_ADPCM:
2441 codec_type_str = "ADPCM";
2443 case MM_AUDIO_CODEC_WAVE:
2444 codec_type_str = "WAVE";
2446 case MM_AUDIO_CODEC_MIDI:
2447 codec_type_str = "MIDI";
2449 case MM_AUDIO_CODEC_IMELODY:
2450 codec_type_str = "IMELODY";
2452 case MM_AUDIO_CODEC_VORBIS:
2453 codec_type_str = "VORBIS";
2456 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2460 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2461 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2469 static type_element *
2470 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2472 type_element *telement = NULL;
2473 const char *codec_type_str = NULL;
2474 int codec_type = MM_VIDEO_CODEC_INVALID;
2475 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2476 _MMCamcorderSubContext *sc = NULL;
2478 mmf_return_val_if_fail(hcamcorder, NULL);
2479 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2481 mmf_return_val_if_fail(sc, NULL);
2485 /* Check element availability */
2486 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2488 switch( codec_type )
2490 case MM_VIDEO_CODEC_H263:
2491 codec_type_str = "H263";
2493 case MM_VIDEO_CODEC_H264:
2494 codec_type_str = "H264";
2496 case MM_VIDEO_CODEC_H26L:
2497 codec_type_str = "H26L";
2499 case MM_VIDEO_CODEC_MPEG4:
2500 codec_type_str = "MPEG4";
2502 case MM_VIDEO_CODEC_MPEG1:
2503 codec_type_str = "MPEG1";
2505 case MM_VIDEO_CODEC_THEORA:
2506 codec_type_str = "THEORA";
2509 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2513 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2514 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2522 static type_element *
2523 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2525 type_element *telement = NULL;
2526 const char *codec_type_str = NULL;
2527 int codec_type = MM_IMAGE_CODEC_INVALID;
2528 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2529 _MMCamcorderSubContext *sc = NULL;
2531 mmf_return_val_if_fail(hcamcorder, NULL);
2532 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2534 mmf_return_val_if_fail(sc, NULL);
2538 /* Check element availability */
2539 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2541 switch( codec_type )
2543 case MM_IMAGE_CODEC_JPEG:
2544 codec_type_str = "JPEG";
2546 case MM_IMAGE_CODEC_SRW:
2547 codec_type_str = "SRW";
2549 case MM_IMAGE_CODEC_JPEG_SRW:
2550 codec_type_str = "JPEG_SRW";
2552 case MM_IMAGE_CODEC_PNG:
2553 codec_type_str = "PNG";
2555 case MM_IMAGE_CODEC_BMP:
2556 codec_type_str = "BMP";
2558 case MM_IMAGE_CODEC_WBMP:
2559 codec_type_str = "WBMP";
2561 case MM_IMAGE_CODEC_TIFF:
2562 codec_type_str = "TIFF";
2564 case MM_IMAGE_CODEC_PCX:
2565 codec_type_str = "PCX";
2567 case MM_IMAGE_CODEC_GIF:
2568 codec_type_str = "GIF";
2570 case MM_IMAGE_CODEC_ICO:
2571 codec_type_str = "ICO";
2573 case MM_IMAGE_CODEC_RAS:
2574 codec_type_str = "RAS";
2576 case MM_IMAGE_CODEC_TGA:
2577 codec_type_str = "TGA";
2579 case MM_IMAGE_CODEC_XBM:
2580 codec_type_str = "XBM";
2582 case MM_IMAGE_CODEC_XPM:
2583 codec_type_str = "XPM";
2586 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2590 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2591 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2599 static type_element *
2600 __mmcamcorder_get_file_format_element(MMHandleType handle)
2602 type_element *telement = NULL;
2603 const char *mux_type_str = NULL;
2604 int file_type = MM_FILE_FORMAT_INVALID;
2605 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2606 _MMCamcorderSubContext *sc = NULL;
2608 mmf_return_val_if_fail(hcamcorder, NULL);
2609 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2611 mmf_return_val_if_fail(sc, NULL);
2615 /* Check element availability */
2616 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2620 case MM_FILE_FORMAT_3GP:
2621 mux_type_str = "3GP";
2623 case MM_FILE_FORMAT_AMR:
2624 mux_type_str = "AMR";
2626 case MM_FILE_FORMAT_MP4:
2627 mux_type_str = "MP4";
2629 case MM_FILE_FORMAT_AAC:
2630 mux_type_str = "AAC";
2632 case MM_FILE_FORMAT_MP3:
2633 mux_type_str = "MP3";
2635 case MM_FILE_FORMAT_OGG:
2636 mux_type_str = "OGG";
2638 case MM_FILE_FORMAT_WAV:
2639 mux_type_str = "WAV";
2641 case MM_FILE_FORMAT_AVI:
2642 mux_type_str = "AVI";
2644 case MM_FILE_FORMAT_WMA:
2645 mux_type_str = "WMA";
2647 case MM_FILE_FORMAT_WMV:
2648 mux_type_str = "WMV";
2650 case MM_FILE_FORMAT_MID:
2651 mux_type_str = "MID";
2653 case MM_FILE_FORMAT_MMF:
2654 mux_type_str = "MMF";
2656 case MM_FILE_FORMAT_MATROSKA:
2657 mux_type_str = "MATROSKA";
2659 case MM_FILE_FORMAT_M2TS:
2660 mux_type_str = "M2TS";
2663 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2667 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2668 CONFIGURE_CATEGORY_MAIN_MUX,
2677 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2679 type_element *telement = NULL;
2681 _mmcam_dbg_log("type:%d", type);
2685 case MM_CAM_AUDIO_ENCODER:
2686 telement = __mmcamcorder_get_audio_codec_element(handle);
2688 case MM_CAM_VIDEO_ENCODER:
2689 telement = __mmcamcorder_get_video_codec_element(handle);
2691 case MM_CAM_IMAGE_ENCODER:
2692 telement = __mmcamcorder_get_image_codec_element(handle);
2694 case MM_CAM_FILE_FORMAT:
2695 telement = __mmcamcorder_get_file_format_element(handle);
2698 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2705 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2707 int codec_index = MM_AUDIO_CODEC_INVALID;
2710 _mmcam_dbg_err("name is NULL");
2711 return MM_AUDIO_CODEC_INVALID;
2714 if (!strcmp(name, "AMR")) {
2715 codec_index = MM_AUDIO_CODEC_AMR;
2716 } else if (!strcmp(name, "G723_1")) {
2717 codec_index = MM_AUDIO_CODEC_G723_1;
2718 } else if (!strcmp(name, "MP3")) {
2719 codec_index = MM_AUDIO_CODEC_MP3;
2720 } else if (!strcmp(name, "AAC")) {
2721 codec_index = MM_AUDIO_CODEC_AAC;
2722 } else if (!strcmp(name, "MMF")) {
2723 codec_index = MM_AUDIO_CODEC_MMF;
2724 } else if (!strcmp(name, "ADPCM")) {
2725 codec_index = MM_AUDIO_CODEC_ADPCM;
2726 } else if (!strcmp(name, "WAVE")) {
2727 codec_index = MM_AUDIO_CODEC_WAVE;
2728 } else if (!strcmp(name, "MIDI")) {
2729 codec_index = MM_AUDIO_CODEC_MIDI;
2730 } else if (!strcmp(name, "IMELODY")) {
2731 codec_index = MM_AUDIO_CODEC_IMELODY;
2732 } else if (!strcmp(name, "VORBIS")) {
2733 codec_index = MM_AUDIO_CODEC_VORBIS;
2736 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2743 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2745 int codec_index = MM_VIDEO_CODEC_INVALID;
2748 _mmcam_dbg_err("name is NULL");
2749 return MM_VIDEO_CODEC_INVALID;
2752 if (!strcmp(name, "H263")) {
2753 codec_index = MM_VIDEO_CODEC_H263;
2754 } else if (!strcmp(name, "H264")) {
2755 codec_index = MM_VIDEO_CODEC_H264;
2756 } else if (!strcmp(name, "H26L")) {
2757 codec_index = MM_VIDEO_CODEC_H26L;
2758 } else if (!strcmp(name, "MPEG4")) {
2759 codec_index = MM_VIDEO_CODEC_MPEG4;
2760 } else if (!strcmp(name, "MPEG1")) {
2761 codec_index = MM_VIDEO_CODEC_MPEG1;
2762 } else if (!strcmp(name, "THEORA")) {
2763 codec_index = MM_VIDEO_CODEC_THEORA;
2766 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2773 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2775 int codec_index = MM_IMAGE_CODEC_INVALID;
2778 _mmcam_dbg_err("name is NULL");
2779 return MM_IMAGE_CODEC_INVALID;
2782 if (!strcmp(name, "JPEG")) {
2783 codec_index = MM_IMAGE_CODEC_JPEG;
2784 } else if (!strcmp(name, "PNG")) {
2785 codec_index = MM_IMAGE_CODEC_PNG;
2786 } else if (!strcmp(name, "BMP")) {
2787 codec_index = MM_IMAGE_CODEC_BMP;
2788 } else if (!strcmp(name, "WBMP")) {
2789 codec_index = MM_IMAGE_CODEC_WBMP;
2790 } else if (!strcmp(name, "TIFF")) {
2791 codec_index = MM_IMAGE_CODEC_TIFF;
2792 } else if (!strcmp(name, "PCX")) {
2793 codec_index = MM_IMAGE_CODEC_PCX;
2794 } else if (!strcmp(name, "GIF")) {
2795 codec_index = MM_IMAGE_CODEC_GIF;
2796 } else if (!strcmp(name, "ICO")) {
2797 codec_index = MM_IMAGE_CODEC_ICO;
2798 } else if (!strcmp(name, "RAS")) {
2799 codec_index = MM_IMAGE_CODEC_RAS;
2800 } else if (!strcmp(name, "TGA")) {
2801 codec_index = MM_IMAGE_CODEC_TGA;
2802 } else if (!strcmp(name, "XBM")) {
2803 codec_index = MM_IMAGE_CODEC_XBM;
2804 } else if (!strcmp(name, "XPM")) {
2805 codec_index = MM_IMAGE_CODEC_XPM;
2808 _mmcam_dbg_log("image codec index %d", codec_index);
2814 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2816 int mux_index = MM_FILE_FORMAT_INVALID;
2819 _mmcam_dbg_err("name is NULL");
2820 return MM_FILE_FORMAT_INVALID;
2823 if (!strcmp(name, "3GP")) {
2824 mux_index = MM_FILE_FORMAT_3GP;
2825 } else if (!strcmp(name, "AMR")) {
2826 mux_index = MM_FILE_FORMAT_AMR;
2827 } else if (!strcmp(name, "MP4")) {
2828 mux_index = MM_FILE_FORMAT_MP4;
2829 } else if (!strcmp(name, "AAC")) {
2830 mux_index = MM_FILE_FORMAT_AAC;
2831 } else if (!strcmp(name, "MP3")) {
2832 mux_index = MM_FILE_FORMAT_MP3;
2833 } else if (!strcmp(name, "OGG")) {
2834 mux_index = MM_FILE_FORMAT_OGG;
2835 } else if (!strcmp(name, "WAV")) {
2836 mux_index = MM_FILE_FORMAT_WAV;
2837 } else if (!strcmp(name, "AVI")) {
2838 mux_index = MM_FILE_FORMAT_AVI;
2839 } else if (!strcmp(name, "WMA")) {
2840 mux_index = MM_FILE_FORMAT_WMA;
2841 } else if (!strcmp(name, "WMV")) {
2842 mux_index = MM_FILE_FORMAT_WMV;
2843 } else if (!strcmp(name, "MID")) {
2844 mux_index = MM_FILE_FORMAT_MID;
2845 } else if (!strcmp(name, "MMF")) {
2846 mux_index = MM_FILE_FORMAT_MMF;
2847 } else if (!strcmp(name, "MATROSKA")) {
2848 mux_index = MM_FILE_FORMAT_MATROSKA;
2849 } else if (!strcmp(name, "M2TS")) {
2850 mux_index = MM_FILE_FORMAT_M2TS;
2854 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2861 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2865 mmf_return_val_if_fail(name, -1);
2867 switch(conf_category)
2869 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2870 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2872 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2873 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2875 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2876 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2878 case CONFIGURE_CATEGORY_MAIN_MUX:
2879 fmt = _mmcamcorder_get_mux_format(handle, name);
2882 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2889 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2891 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2892 camera_conf* configure_info = NULL;
2894 int total_count = 0;
2896 mmf_return_val_if_fail(hcamcorder, 0);
2898 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2900 configure_info = hcamcorder->conf_main;
2902 if (configure_info->info[conf_category]) {
2905 const char *name = NULL;
2906 int count = configure_info->info[conf_category]->count;
2907 conf_detail *info = configure_info->info[conf_category];
2909 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2911 if (count <= 0 || !info) {
2915 arr = (int*) g_malloc0(count * sizeof(int));
2917 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2921 for (i = 0 ; i < count ; i++) {
2922 if (info->detail_info[i] == NULL) {
2926 name = ((type_element*)(info->detail_info[i]))->name;
2927 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2929 arr[total_count++] = fmt;
2932 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/