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 -----------------------------------------------------------------------*/
36 #define CONFIGURE_PATH "/usr/etc"
37 #define CONFIGURE_PATH_RETRY "/opt/etc"
39 /*-----------------------------------------------------------------------
40 | GLOBAL VARIABLE DEFINITIONS |
41 -----------------------------------------------------------------------*/
43 /*-----------------------------------------------------------------------
44 | LOCAL VARIABLE DEFINITIONS |
45 -----------------------------------------------------------------------*/
47 char *get_new_string(char* src_string)
49 return strdup(src_string);
52 void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
55 int info_table_size = sizeof(conf_info_table);
57 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
59 /* Videosrc element default value */
60 static type_element _videosrc_element_default = {
69 /* Audiosrc element default value */
70 static type_int ___audiosrc_default_channel = { "Channel", 1 };
71 static type_int ___audiosrc_default_bitrate = { "BitRate", 8000 };
72 static type_int ___audiosrc_default_depth = { "Depth", 16 };
73 static type_int ___audiosrc_default_blocksize = { "BlockSize", 1280 };
74 static type_int* __audiosrc_default_int_array[] = {
75 &___audiosrc_default_channel,
76 &___audiosrc_default_bitrate,
77 &___audiosrc_default_depth,
78 &___audiosrc_default_blocksize,
80 static type_string ___audiosrc_default_device = { "Device", "default" };
81 static type_string* __audiosrc_default_string_array[] = {
82 &___audiosrc_default_device,
84 static type_element _audiosrc_element_default = {
87 __audiosrc_default_int_array,
88 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
89 __audiosrc_default_string_array,
90 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
93 static type_element _audiomodemsrc_element_default = {
94 "AudiomodemsrcElement",
96 __audiosrc_default_int_array,
97 sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
98 __audiosrc_default_string_array,
99 sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
103 /* Videosink element default value */
104 static type_int ___videosink_default_display_id = { "display-id", 3 };
105 static type_int ___videosink_default_x = { "x", 0 };
106 static type_int ___videosink_default_y = { "y", 0 };
107 static type_int ___videosink_default_width = { "width", 800 };
108 static type_int ___videosink_default_height = { "height", 480 };
109 static type_int ___videosink_default_rotation = { "rotation", 1 };
110 static type_int* __videosink_default_int_array[] = {
111 &___videosink_default_display_id,
112 &___videosink_default_x,
113 &___videosink_default_y,
114 &___videosink_default_width,
115 &___videosink_default_height,
116 &___videosink_default_rotation,
118 static type_string* __videosink_default_string_array[] = { NULL };
119 static type_element _videosink_element_x_default = {
122 __videosink_default_int_array,
123 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
124 __videosink_default_string_array,
125 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
127 static type_element _videosink_element_evas_default = {
128 "VideosinkElementEvas",
130 __videosink_default_int_array,
131 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
132 __videosink_default_string_array,
133 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
135 static type_element _videosink_element_gl_default = {
136 "VideosinkElementGL",
138 __videosink_default_int_array,
139 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
140 __videosink_default_string_array,
141 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
143 static type_element _videosink_element_null_default = {
144 "VideosinkElementNull",
146 __videosink_default_int_array,
147 sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
148 __videosink_default_string_array,
149 sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
152 /* Videoscale element default value */
153 static type_element _videoscale_element_default = {
162 /* Videoconvert element default value */
163 static type_element _videoconvert_element_default = {
164 "VideoconvertElement",
172 /* Record sink element default value */
173 static type_element _recordsink_element_default = {
182 /* H263 element default value */
183 static type_element _h263_element_default = {
192 /* H264 element default value */
193 static type_element _h264_element_default = {
202 /* H26L element default value */
203 static type_element _h26l_element_default = {
212 /* MPEG4 element default value */
213 static type_element _mpeg4_element_default = {
222 /* MPEG1 element default value */
223 static type_element _mpeg1_element_default = {
232 /* THEORA element default value */
233 static type_element _theora_element_default = {
242 /* AMR element default value */
243 static type_element _amr_element_default = {
252 /* G723_1 element default value */
253 static type_element _g723_1_element_default = {
262 /* MP3 element default value */
263 static type_element _mp3_element_default = {
272 /* AAC element default value */
273 static type_element _aac_element_default = {
282 /* MMF element default value */
283 static type_element _mmf_element_default = {
292 /* ADPCM element default value */
293 static type_element _adpcm_element_default = {
295 "avenc_adpcm_ima_qt",
302 /* WAVE element default value */
303 static type_element _wave_element_default = {
312 /* VORBIS element default value */
313 static type_element _vorbis_element_default = {
322 /* MIDI element default value */
323 static type_element _midi_element_default = {
332 /* IMELODY element default value */
333 static type_element _imelody_element_default = {
342 /* JPEG element default value */
343 static type_element _jpeg_element_default = {
352 /* PNG element default value */
353 static type_element _png_element_default = {
362 /* BMP element default value */
363 static type_element _bmp_element_default = {
372 /* WBMP element default value */
373 static type_element _wbmp_element_default = {
382 /* TIFF element default value */
383 static type_element _tiff_element_default = {
392 /* PCX element default value */
393 static type_element _pcx_element_default = {
402 /* GIF element default value */
403 static type_element _gif_element_default = {
412 /* ICO element default value */
413 static type_element _ico_element_default = {
422 /* RAS element default value */
423 static type_element _ras_element_default = {
432 /* TGA element default value */
433 static type_element _tga_element_default = {
442 /* XBM element default value */
443 static type_element _xbm_element_default = {
452 /* XPM element default value */
453 static type_element _xpm_element_default = {
462 /* 3GP element default value */
463 static type_element _3gp_element_default = {
472 /* AMR mux element default value */
473 static type_element _amrmux_element_default = {
482 /* MP4 element default value */
483 static type_element _mp4_element_default = {
492 /* AAC mux element default value */
493 static type_element _aacmux_element_default = {
502 /* MP3 mux element default value */
503 static type_element _mp3mux_element_default = {
512 /* OGG element default value */
513 static type_element _ogg_element_default = {
522 /* WAV element default value */
523 static type_element _wav_element_default = {
532 /* AVI element default value */
533 static type_element _avi_element_default = {
542 /* WMA element default value */
543 static type_element _wma_element_default = {
552 /* WMV element default value */
553 static type_element _wmv_element_default = {
562 /* MID element default value */
563 static type_element _mid_element_default = {
572 /* MMF mux element default value */
573 static type_element _mmfmux_element_default = {
582 /* MATROSKA element default value */
583 static type_element _matroska_element_default = {
592 /* M2TS element default value */
593 static type_element _m2ts_element_default = {
602 /* [General] matching table */
603 static conf_info_table conf_main_general_table[] = {
604 { "SyncStateChange", CONFIGURE_VALUE_INT, {.value_int = 1} },
605 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
606 { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
607 { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
610 /* [VideoInput] matching table */
611 static conf_info_table conf_main_video_input_table[] = {
612 { "UseConfCtrl", CONFIGURE_VALUE_INT, {.value_int = 1} },
613 { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {NULL} },
614 { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {NULL} },
615 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
616 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
617 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
618 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
619 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
620 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
623 /* [AudioInput] matching table */
624 static conf_info_table conf_main_audio_input_table[] = {
625 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
626 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
627 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
630 /* [VideoOutput] matching table */
631 static conf_info_table conf_main_video_output_table[] = {
632 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
633 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
634 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
635 { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_x_default} },
636 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
637 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
638 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
639 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
640 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
641 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
644 /* [Capture] matching table */
645 static conf_info_table conf_main_capture_table[] = {
646 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
647 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
648 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
649 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
652 /* [Record] matching table */
653 static conf_info_table conf_main_record_table[] = {
654 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
655 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
656 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
657 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
658 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
659 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
660 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
661 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
662 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
663 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
664 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
665 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
668 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
669 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
670 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
675 /* [VideoEncoder] matching table */
676 static conf_info_table conf_main_video_encoder_table[] = {
677 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
678 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
679 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
680 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
681 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
682 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
685 /* [AudioEncoder] matching table */
686 static conf_info_table conf_main_audio_encoder_table[] = {
687 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
688 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
689 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
690 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
691 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
692 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
693 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
694 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
695 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
696 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
699 /* [ImageEncoder] matching table */
700 static conf_info_table conf_main_image_encoder_table[] = {
701 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
702 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
703 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
704 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
705 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
706 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
707 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
708 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
709 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
710 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
711 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
712 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
715 /* [Mux] matching table */
716 static conf_info_table conf_main_mux_table[] = {
717 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
718 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
719 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
720 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
721 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
722 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
723 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
724 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
725 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
726 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
727 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
728 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
729 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
730 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
738 /* [Camera] matching table */
739 static conf_info_table conf_ctrl_camera_table[] = {
740 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
741 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
742 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
743 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
744 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
745 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
746 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
747 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
748 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
749 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
750 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
751 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
752 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
753 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
754 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
755 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
756 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
757 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
758 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
759 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
760 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
761 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
764 /* [Strobe] matching table */
765 static conf_info_table conf_ctrl_strobe_table[] = {
766 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
767 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
768 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
771 /* [Effect] matching table */
772 static conf_info_table conf_ctrl_effect_table[] = {
773 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
774 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
775 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
776 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
777 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
778 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
779 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
781 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
782 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
783 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
784 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 /* [Photograph] matching table */
788 static conf_info_table conf_ctrl_photograph_table[] = {
789 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
790 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
791 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
792 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
793 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
794 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
795 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
796 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
797 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
798 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
800 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
801 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
802 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
806 /* [Capture] matching table */
807 static conf_info_table conf_ctrl_capture_table[] = {
808 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
810 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
812 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
813 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
816 /* [Detect] matching table */
817 static conf_info_table conf_ctrl_detect_table[] = {
818 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
819 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
820 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
821 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
824 if (hcamcorder == NULL) {
825 _mmcam_dbg_err("handle is NULL");
829 _mmcam_dbg_log("Entered...");
831 if (type == CONFIGURE_TYPE_MAIN) {
832 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
833 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
834 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
835 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
836 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
837 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
838 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
839 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
840 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
841 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
843 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
844 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
845 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
846 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
847 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
848 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
849 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
850 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
851 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
852 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
854 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
856 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
857 (*configure_info)->info[i] = NULL;
860 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
861 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
862 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
863 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
864 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
865 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
867 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
868 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
869 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
870 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
871 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
872 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
874 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
876 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
877 (*configure_info)->info[i] = NULL;
881 _mmcam_dbg_log("Done.");
887 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
889 int ret = MM_ERROR_NONE;
891 char* conf_path = NULL;
893 _mmcam_dbg_log( "Opening...[%s]", ConfFile );
895 mmf_return_val_if_fail( ConfFile, FALSE );
897 conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
899 if( conf_path == NULL )
901 _mmcam_dbg_err( "malloc failed." );
902 return MM_ERROR_CAMCORDER_LOW_MEMORY;
905 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
906 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
908 fd = fopen( conf_path, "r" );
911 _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
912 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
913 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
914 fd = fopen( conf_path, "r" );
917 _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
923 ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
928 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
931 if( conf_path != NULL )
937 _mmcam_dbg_log( "Leave..." );
942 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
944 const unsigned int BUFFER_NUM_DETAILS = 256;
945 const unsigned int BUFFER_NUM_TOKEN = 20;
946 size_t BUFFER_LENGTH_STRING = 256;
947 const char* delimiters = " |=,\t\n";
950 int count_main_category = 0;
951 int count_details = 0;
956 char *buffer_string = NULL;
957 char *buffer_details[BUFFER_NUM_DETAILS];
958 char *buffer_token[BUFFER_NUM_TOKEN];
960 char *category_name = NULL;
961 char *detail_string = NULL;
962 char *user_ptr = NULL;
964 _mmcam_dbg_log( "" );
966 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
967 if (new_conf == NULL) {
968 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
969 *configure_info = NULL;
970 return MM_ERROR_CAMCORDER_LOW_MEMORY;
973 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
974 if (buffer_string == NULL) {
975 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
976 *configure_info = NULL;
978 return MM_ERROR_CAMCORDER_LOW_MEMORY;
981 new_conf->type = type;
982 *configure_info = new_conf;
984 _mmcamcorder_conf_init(handle, type, &new_conf);
987 _mmcam_dbg_err("failed file descriptor fail");
988 *configure_info = NULL;
989 g_free(buffer_string);
991 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
995 count_main_category = 0;
1001 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1002 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
1005 token = strtok_r( buffer_string, delimiters, &user_ptr );
1007 if ((token) && (token[0] == ';') && (length_read > -1))
1009 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1015 /*_mmcam_dbg_log( "token : [%s]", token );*/
1016 buffer_token[count_token] = token;
1018 token = strtok_r( NULL, delimiters, &user_ptr );
1021 if( count_token == 0 )
1030 if( *buffer_token[0] == ';' )
1032 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1035 else if( *buffer_token[0] == '[' )
1037 category_name = get_new_string( buffer_token[0] );
1039 count_main_category++;
1042 while( !feof( fd ) )
1044 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1045 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1047 detail_string = get_new_string( buffer_string );
1049 token = strtok_r( buffer_string, delimiters, &user_ptr );
1051 if( token && token[0] != ';' && length_read > -1 )
1053 /*_mmcam_dbg_log( "token : [%s]", token );*/
1054 if( token[0] == '[' )
1057 buffer_token[0] = token;
1058 SAFE_FREE( detail_string );
1062 buffer_details[count_details++] = detail_string;
1066 SAFE_FREE( detail_string );
1070 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1072 if( count_details == 0 )
1074 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1075 SAFE_FREE(category_name);
1082 if( type == CONFIGURE_TYPE_MAIN )
1084 if( !strcmp( "[General]", category_name ) )
1086 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1088 else if( !strcmp( "[VideoInput]", category_name ) )
1090 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1092 else if( !strcmp( "[AudioInput]", category_name ) )
1094 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1096 else if( !strcmp( "[VideoOutput]", category_name ) )
1098 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1100 else if( !strcmp( "[Capture]", category_name ) )
1102 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1104 else if( !strcmp( "[Record]", category_name ) )
1106 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1108 else if( !strcmp( "[VideoEncoder]", category_name ) )
1110 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1112 else if( !strcmp( "[AudioEncoder]", category_name ) )
1114 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1116 else if( !strcmp( "[ImageEncoder]", category_name ) )
1118 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1120 else if( !strcmp( "[Mux]", category_name ) )
1122 category = CONFIGURE_CATEGORY_MAIN_MUX;
1127 if( !strcmp( "[Camera]", category_name ) )
1129 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1131 else if( !strcmp( "[Strobe]", category_name ) )
1133 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1135 else if( !strcmp( "[Effect]", category_name ) )
1137 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1139 else if( !strcmp( "[Photograph]", category_name ) )
1141 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1143 else if( !strcmp( "[Capture]", category_name ) )
1145 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1147 else if( !strcmp( "[Detect]", category_name ) )
1149 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1153 if( category != -1 )
1155 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1156 buffer_details, category, count_details );
1160 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1167 for( i = 0 ; i < count_details ; i++ )
1169 SAFE_FREE( buffer_details[i] );
1174 SAFE_FREE(category_name);
1177 //(*configure_info) = new_conf;
1179 SAFE_FREE( buffer_string );
1181 /*_mmcam_dbg_log( "Done." );*/
1183 return MM_ERROR_NONE;
1187 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1192 int type = CONFIGURE_VALUE_INT;
1194 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1195 camera_conf *temp_conf = (*configure_info);
1197 type_int2 *temp_int = NULL;
1198 type_int_range *temp_int_range = NULL;
1199 type_int_array *temp_int_array = NULL;
1200 type_int_pair_array *temp_int_pair_array = NULL;
1201 type_string2 *temp_string = NULL;
1202 type_string_array *temp_string_array = NULL;
1203 type_element2 *temp_element = NULL;
1205 _mmcam_dbg_log("Entered...");
1207 mmf_return_if_fail(temp_conf);
1209 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1210 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1212 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1215 for (i = 0 ; i < category_num ; i++) {
1216 if (temp_conf->info[i]) {
1217 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1218 if (temp_conf->info[i]->detail_info[j] == NULL) {
1222 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1224 case CONFIGURE_VALUE_INT:
1225 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1226 SAFE_FREE(temp_int->name);
1228 case CONFIGURE_VALUE_INT_RANGE:
1229 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1230 SAFE_FREE(temp_int_range->name);
1232 case CONFIGURE_VALUE_INT_ARRAY:
1233 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1234 SAFE_FREE(temp_int_array->name);
1235 SAFE_FREE(temp_int_array->value);
1237 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1238 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1239 SAFE_FREE(temp_int_pair_array->name);
1240 SAFE_FREE(temp_int_pair_array->value[0]);
1241 SAFE_FREE(temp_int_pair_array->value[1]);
1243 case CONFIGURE_VALUE_STRING:
1244 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1245 SAFE_FREE(temp_string->name);
1246 SAFE_FREE(temp_string->value);
1248 case CONFIGURE_VALUE_STRING_ARRAY:
1249 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1250 SAFE_FREE(temp_string_array->name);
1251 if (temp_string_array->value) {
1252 count = temp_string_array->count;
1253 for (k = 0 ; k < count ; k++) {
1254 SAFE_FREE(temp_string_array->value[k]);
1256 g_free(temp_string_array->value);
1257 temp_string_array->value = NULL;
1259 SAFE_FREE(temp_string_array->default_value);
1261 case CONFIGURE_VALUE_ELEMENT:
1262 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1263 SAFE_FREE(temp_element->name);
1264 SAFE_FREE(temp_element->element_name);
1266 if (temp_element->value_int) {
1267 count = temp_element->count_int;
1268 for (k = 0 ; k < count ; k++) {
1269 SAFE_FREE(temp_element->value_int[k]->name);
1270 SAFE_FREE(temp_element->value_int[k]);
1272 g_free(temp_element->value_int);
1275 if (temp_element->value_string) {
1276 count = temp_element->count_string;
1277 for (k = 0 ; k < count ; k++) {
1278 SAFE_FREE(temp_element->value_string[k]->name);
1279 SAFE_FREE(temp_element->value_string[k]->value);
1280 SAFE_FREE(temp_element->value_string[k]);
1282 g_free(temp_element->value_string);
1286 _mmcam_dbg_warn("unknown type %d", type);
1291 SAFE_FREE(temp_conf->info[i]->detail_info[j]);
1292 temp_conf->info[i]->detail_info[j] = NULL;
1295 SAFE_FREE(temp_conf->info[i]->detail_info);
1296 temp_conf->info[i]->detail_info = NULL;
1298 SAFE_FREE(temp_conf->info[i]);
1299 temp_conf->info[i] = NULL;
1303 SAFE_FREE((*configure_info)->info);
1304 SAFE_FREE((*configure_info));
1306 _mmcam_dbg_log("Done.");
1309 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1312 int count_value = 0;
1314 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1316 if (hcamcorder == NULL) {
1317 _mmcam_dbg_err("handle is NULL");
1321 /*_mmcam_dbg_log( "Entered..." );*/
1323 mmf_return_val_if_fail( name, FALSE );
1325 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1327 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1331 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1333 if( type == CONFIGURE_TYPE_MAIN )
1335 for( i = 0 ; i < count_value ; i++ )
1337 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1339 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1340 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1347 for( i = 0 ; i < count_value ; i++ )
1349 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1351 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1352 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1362 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1364 const int BUFFER_NUM_TOKEN = 256;
1371 char *buffer_token[BUFFER_NUM_TOKEN];
1372 char *user_ptr = NULL;
1374 const char *delimiters = " |=,\t\n";
1375 const char *delimiters_sub = " |\t\n";
1376 const char *delimiters_3rd = "|\n";
1378 mmf_return_val_if_fail( buffer_details, FALSE );
1380 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1381 if (*info == NULL) {
1382 _mmcam_dbg_err("allocation failed");
1385 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1386 (*info)->count = count_details;
1388 for ( i = 0 ; i < count_details ; i++ ) {
1389 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1391 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1394 buffer_token[count_token] = token;
1397 (*info)->detail_info[i] = NULL;
1398 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1402 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1403 (*info)->detail_info[i] = NULL;
1404 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1408 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1409 token = strtok_r( NULL, delimiters, &user_ptr );
1411 buffer_token[count_token] = token;
1412 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1414 token = strtok_r( NULL, delimiters, &user_ptr );
1417 if (count_token < 2) {
1418 (*info)->detail_info[i] = NULL;
1419 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1422 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1424 strtok_r( NULL, delimiters_sub, &user_ptr );
1426 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1427 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1429 buffer_token[count_token] = token;
1430 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1432 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1434 } else { /* CONFIGURE_VALUE_STRING */
1435 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1438 buffer_token[count_token] = token;
1439 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1444 if (count_token < 2) {
1445 (*info)->detail_info[i] = NULL;
1446 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1453 case CONFIGURE_VALUE_INT:
1457 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1458 if ( new_int == NULL ) {
1459 _mmcam_dbg_err("allocation failed");
1462 new_int->name = get_new_string( buffer_token[0] );
1463 new_int->value = atoi( buffer_token[1] );
1464 (*info)->detail_info[i] = (void*)new_int;
1465 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1468 case CONFIGURE_VALUE_INT_RANGE:
1470 type_int_range* new_int_range;
1472 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1473 if ( new_int_range == NULL ) {
1474 _mmcam_dbg_err("allocation failed");
1477 new_int_range->name = get_new_string( buffer_token[0] );
1478 new_int_range->min = atoi( buffer_token[1] );
1479 new_int_range->max = atoi( buffer_token[2] );
1480 new_int_range->default_value = atoi( buffer_token[3] );
1481 (*info)->detail_info[i] = (void*)new_int_range;
1483 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1484 new_int_range->name,
1487 new_int_range->default_value);
1491 case CONFIGURE_VALUE_INT_ARRAY:
1493 int count_value = count_token - 2;
1494 type_int_array* new_int_array;
1496 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1497 if (new_int_array == NULL) {
1498 _mmcam_dbg_err("allocation failed");
1501 new_int_array->name = get_new_string( buffer_token[0] );
1502 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1503 if (new_int_array->value == NULL) {
1504 if (new_int_array->name) {
1505 free(new_int_array->name);
1506 new_int_array->name = NULL;
1508 free(new_int_array);
1509 new_int_array = NULL;
1510 _mmcam_dbg_err("allocation failed");
1513 new_int_array->count = count_value;
1515 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1516 for ( j = 0 ; j < count_value ; j++ ) {
1517 new_int_array->value[j] = atoi( buffer_token[j+1] );
1518 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1521 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1522 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1524 (*info)->detail_info[i] = (void*)new_int_array;
1527 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1529 int count_value = ( count_token - 3 ) >> 1;
1530 type_int_pair_array* new_int_pair_array;
1532 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1533 if ( new_int_pair_array == NULL ) {
1534 _mmcam_dbg_err("allocation failed");
1537 new_int_pair_array->name = get_new_string( buffer_token[0] );
1538 new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
1539 if ( new_int_pair_array->value[0] == NULL ) {
1540 if (new_int_pair_array->name) {
1541 free( new_int_pair_array->name );
1542 new_int_pair_array->name = NULL;
1544 free( new_int_pair_array );
1545 new_int_pair_array = NULL;
1546 _mmcam_dbg_err("allocation failed");
1549 new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) );
1550 if ( new_int_pair_array->value[1] == NULL ) {
1551 free( new_int_pair_array->value[0] );
1552 new_int_pair_array->value[0] = NULL;
1553 if (new_int_pair_array->name) {
1554 free( new_int_pair_array->name );
1555 new_int_pair_array->name = NULL;
1557 free( new_int_pair_array );
1558 new_int_pair_array = NULL;
1559 _mmcam_dbg_err("allocation failed");
1562 new_int_pair_array->count = count_value;
1564 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1565 for ( j = 0 ; j < count_value ; j++ ) {
1566 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1567 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1569 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1570 new_int_pair_array->value[0][j],
1571 new_int_pair_array->value[1][j]);
1575 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1576 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1578 _mmcam_dbg_log(" default value[%d,%d]",
1579 new_int_pair_array->default_value[0],
1580 new_int_pair_array->default_value[1]);
1582 (*info)->detail_info[i] = (void*)new_int_pair_array;
1585 case CONFIGURE_VALUE_STRING:
1587 type_string2* new_string;
1589 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1590 if (new_string == NULL) {
1591 _mmcam_dbg_err("allocation failed");
1594 new_string->name = get_new_string( buffer_token[0] );
1595 new_string->value = get_new_string( buffer_token[1] );
1596 (*info)->detail_info[i] = (void*)new_string;
1598 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1601 case CONFIGURE_VALUE_STRING_ARRAY:
1603 int count_value = count_token - 2;
1604 type_string_array* new_string_array;
1606 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1607 if ( new_string_array == NULL ) {
1610 new_string_array->name = get_new_string( buffer_token[0] );
1611 new_string_array->count = count_value;
1612 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1613 if ( new_string_array->value == NULL ) {
1614 if (new_string_array->name) {
1615 free(new_string_array->name);
1616 new_string_array->name = NULL;
1618 free(new_string_array);
1619 new_string_array = NULL;
1620 _mmcam_dbg_err("allocation failed");
1623 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1624 for ( j = 0 ; j < count_value ; j++ ) {
1625 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1626 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1629 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1630 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1631 (*info)->detail_info[i] = (void*)new_string_array;
1634 case CONFIGURE_VALUE_ELEMENT:
1636 type_element2* new_element;
1638 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1639 if ( new_element == NULL ) {
1640 _mmcam_dbg_err("allocation failed");
1643 new_element->name = get_new_string( buffer_token[0] );
1644 new_element->element_name = get_new_string( buffer_token[1] );
1645 new_element->count_int = atoi( buffer_token[2] );
1646 new_element->value_int = NULL;
1647 new_element->count_string = atoi( buffer_token[3] );
1648 new_element->value_string = NULL;
1650 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1651 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1654 /* add int values */
1655 if ( new_element->count_int > 0 ) {
1656 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1657 if ( new_element->value_int) {
1658 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1659 new_element->value_int[j] = (type_int2*)g_malloc( sizeof(type_int2) );
1660 if ( new_element->value_int[j] ) {
1661 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1662 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1664 _mmcam_dbg_err("allocation failed");
1667 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1668 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1672 _mmcam_dbg_err("allocation failed");
1677 new_element->value_int = NULL;
1680 /* add string values */
1681 if ( new_element->count_string > 0 ) {
1682 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1683 if (new_element->value_string) {
1684 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1685 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1686 if(new_element->value_string[j-new_element->count_int]) {
1687 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1688 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1690 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1691 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);
1694 _mmcam_dbg_err("allocation failed");
1698 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1701 new_element->value_string = NULL;
1704 (*info)->detail_info[i] = (void*)new_element;
1716 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1721 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1723 mmf_return_val_if_fail( configure_info, FALSE );
1724 mmf_return_val_if_fail( name, FALSE );
1726 if( configure_info->info[category] )
1728 count = configure_info->info[category]->count;
1729 info = configure_info->info[category];
1731 for( i = 0 ; i < count ; i++ )
1733 if( info->detail_info[i] == NULL )
1738 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1740 *value = ((type_int*)(info->detail_info[i]))->value;
1741 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1747 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1749 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1753 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1759 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1764 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1766 mmf_return_val_if_fail( configure_info, FALSE );
1767 mmf_return_val_if_fail( name, FALSE );
1769 if( configure_info->info[category] )
1771 count = configure_info->info[category]->count;
1772 info = configure_info->info[category];
1774 for( i = 0 ; i < count ; i++ )
1776 if( info->detail_info[i] == NULL )
1781 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1783 *value = (type_int_range*)(info->detail_info[i]);
1785 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1786 name, (*value)->min, (*value)->max, (*value)->default_value );
1795 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1801 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1806 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1808 mmf_return_val_if_fail( configure_info, FALSE );
1809 mmf_return_val_if_fail( name, FALSE );
1811 if( configure_info->info[category] )
1813 count = configure_info->info[category]->count;
1814 info = configure_info->info[category];
1816 for( i = 0 ; i < count ; i++ )
1818 if( info->detail_info[i] == NULL )
1823 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1825 *value = (type_int_array*)(info->detail_info[i]);
1827 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1828 name, (*value)->value, (*value)->count, (*value)->default_value );
1837 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1843 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1848 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1850 mmf_return_val_if_fail( configure_info, FALSE );
1851 mmf_return_val_if_fail( name, FALSE );
1853 if( configure_info->info[category] )
1855 count = configure_info->info[category]->count;
1856 info = configure_info->info[category];
1858 for( i = 0 ; i < count ; i++ )
1860 if( info->detail_info[i] == NULL )
1865 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1867 *value = (type_int_pair_array*)(info->detail_info[i]);
1869 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1870 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1871 (*value)->default_value[0], (*value)->default_value[1] );
1880 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1885 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1890 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1892 mmf_return_val_if_fail( configure_info, FALSE );
1893 mmf_return_val_if_fail( name, FALSE );
1895 if( configure_info->info[category] )
1897 count = configure_info->info[category]->count;
1898 info = configure_info->info[category];
1900 for( i = 0 ; i < count ; i++ )
1902 if( info->detail_info[i] == NULL )
1907 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1909 *value = ((type_string*)(info->detail_info[i]))->value;
1910 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1916 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1918 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1922 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1928 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1933 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1935 mmf_return_val_if_fail( configure_info, FALSE );
1936 mmf_return_val_if_fail( name, FALSE );
1938 if( configure_info->info[category] )
1940 count = configure_info->info[category]->count;
1941 info = configure_info->info[category];
1943 for( i = 0 ; i < count ; i++ )
1945 if( info->detail_info[i] == NULL )
1950 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1952 *value = (type_string_array*)(info->detail_info[i]);
1954 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1955 name, (*value)->value, (*value)->count, (*value)->default_value );
1964 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1969 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1974 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1976 mmf_return_val_if_fail( configure_info, FALSE );
1977 mmf_return_val_if_fail( name, FALSE );
1979 if( configure_info->info[category] )
1981 count = configure_info->info[category]->count;
1982 info = configure_info->info[category];
1984 for( i = 0 ; i < count ; i++ )
1986 if( info->detail_info[i] == NULL )
1991 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1993 *element = (type_element*)(info->detail_info[i]);
1994 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2000 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
2002 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
2006 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2012 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2014 //_mmcam_dbg_log( "Entered..." );
2016 mmf_return_val_if_fail( element, FALSE );
2018 *value = element->element_name;
2020 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2026 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2030 //_mmcam_dbg_log( "Entered..." );
2032 mmf_return_val_if_fail( element, FALSE );
2033 mmf_return_val_if_fail( name, FALSE );
2035 for( i = 0 ; i < element->count_int ; i++ )
2037 if( !strcmp( element->value_int[i]->name , name ) )
2039 *value = element->value_int[i]->value;
2040 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2045 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2046 element->name, name, element->count_int );
2052 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2056 //_mmcam_dbg_log( "Entered..." );
2058 mmf_return_val_if_fail( element, FALSE );
2059 mmf_return_val_if_fail( name, FALSE );
2061 for( i = 0 ; i < element->count_string ; i++ )
2063 if( !strcmp( element->value_string[i]->name , name ) )
2065 *value = element->value_string[i]->value;
2066 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2071 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2072 element->name, name, element->count_string );
2078 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2082 //_mmcam_dbg_log( "Entered..." );
2084 mmf_return_val_if_fail( gst, FALSE );
2085 mmf_return_val_if_fail( element, FALSE );
2087 if( element->count_int == 0 )
2089 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2093 if( element->value_int == NULL )
2095 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2099 for( i = 0 ; i < element->count_int ; i++ )
2101 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2104 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2105 element->element_name,
2106 element->value_int[i]->name,
2107 element->value_int[i]->value );
2112 if( element->count_string == 0 )
2114 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2118 if( element->value_string == NULL )
2120 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2124 for( i = 0 ; i < element->count_string ; i++ )
2126 MMCAMCORDER_G_OBJECT_SET_POINTER( gst, element->value_string[i]->name, element->value_string[i]->value );
2128 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2129 element->element_name,
2130 element->value_string[i]->name,
2131 element->value_string[i]->value );
2135 //_mmcam_dbg_log( "Done." );
2141 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2144 int count_value = 0;
2146 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2148 if (hcamcorder == NULL) {
2149 _mmcam_dbg_err("handle is NULL");
2153 //_mmcam_dbg_log( "Entered..." );
2155 mmf_return_val_if_fail( name, FALSE );
2157 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2159 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2163 if( type == CONFIGURE_TYPE_MAIN )
2165 for( i = 0 ; i < count_value ; i++ )
2167 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2169 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2176 for( i = 0 ; i < count_value ; i++ )
2178 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2180 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2186 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2191 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2194 int count_value = 0;
2196 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2198 if (hcamcorder == NULL) {
2199 _mmcam_dbg_err("handle is NULL");
2203 //_mmcam_dbg_log( "Entered..." );
2205 mmf_return_val_if_fail( name, FALSE );
2207 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2209 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2213 if( type == CONFIGURE_TYPE_MAIN )
2215 for( i = 0 ; i < count_value ; i++ )
2217 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2219 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2220 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2227 for( i = 0 ; i < count_value ; i++ )
2229 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2231 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2232 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2238 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2243 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2246 int count_value = 0;
2248 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2250 if (hcamcorder == NULL) {
2251 _mmcam_dbg_err("handle is NULL");
2255 //_mmcam_dbg_log( "Entered..." );
2257 mmf_return_val_if_fail( name, FALSE );
2259 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2261 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2265 if( type == CONFIGURE_TYPE_MAIN )
2267 for( i = 0 ; i < count_value ; i++ )
2269 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2271 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2272 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2279 for( i = 0 ; i < count_value ; i++ )
2281 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2283 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2284 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2290 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2295 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2297 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2299 if (hcamcorder == NULL) {
2300 _mmcam_dbg_err("handle is NULL");
2304 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2305 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2307 if( type == CONFIGURE_TYPE_MAIN )
2309 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2311 *size = (int)hcamcorder->conf_main_category_size[category];
2315 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2317 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2324 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2326 int i, j, k, type, category_type;
2329 type_int_range *temp_int_range;
2330 type_int_array *temp_int_array;
2331 type_int_pair_array *temp_int_pair_array;
2332 type_string *temp_string;
2333 type_element *temp_element;
2335 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2337 mmf_return_if_fail( *configure_info );
2339 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2341 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2345 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2348 for( i = 0 ; i < category_type ; i++ )
2350 if( (*configure_info)->info[i] )
2352 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2353 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2355 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2359 case CONFIGURE_VALUE_INT:
2360 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2361 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2363 case CONFIGURE_VALUE_INT_RANGE:
2364 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2365 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2366 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2368 case CONFIGURE_VALUE_INT_ARRAY:
2369 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2370 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2371 temp_int_array->name, temp_int_array->default_value );
2372 for( k = 0 ; k < temp_int_array->count ; k++ )
2374 g_print( "[%d] ", temp_int_array->value[k] );
2378 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2379 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2380 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2381 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2382 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2384 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2388 case CONFIGURE_VALUE_STRING:
2389 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2390 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2392 case CONFIGURE_VALUE_ELEMENT:
2393 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2394 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2395 for( k = 0 ; k < temp_element->count_int ; k++ )
2397 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2399 for( k = 0 ; k < temp_element->count_string ; k++ )
2401 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2405 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 );
2411 g_print( "[ConfigureInfo] : Failed to get value type." );
2417 g_print( "[ConfigureInfoPrint] : Done.\n" );
2421 static type_element *
2422 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2424 type_element *telement = NULL;
2425 const char *codec_type_str = NULL;
2426 int codec_type = MM_AUDIO_CODEC_INVALID;
2427 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2428 _MMCamcorderSubContext *sc = NULL;
2430 mmf_return_val_if_fail(hcamcorder, NULL);
2431 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2433 mmf_return_val_if_fail(sc, NULL);
2437 /* Check element availability */
2438 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2440 switch( codec_type )
2442 case MM_AUDIO_CODEC_AMR:
2443 codec_type_str = "AMR";
2445 case MM_AUDIO_CODEC_G723_1:
2446 codec_type_str = "G723_1";
2448 case MM_AUDIO_CODEC_MP3:
2449 codec_type_str = "MP3";
2451 case MM_AUDIO_CODEC_AAC:
2452 codec_type_str = "AAC";
2454 case MM_AUDIO_CODEC_MMF:
2455 codec_type_str = "MMF";
2457 case MM_AUDIO_CODEC_ADPCM:
2458 codec_type_str = "ADPCM";
2460 case MM_AUDIO_CODEC_WAVE:
2461 codec_type_str = "WAVE";
2463 case MM_AUDIO_CODEC_MIDI:
2464 codec_type_str = "MIDI";
2466 case MM_AUDIO_CODEC_IMELODY:
2467 codec_type_str = "IMELODY";
2469 case MM_AUDIO_CODEC_VORBIS:
2470 codec_type_str = "VORBIS";
2473 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2477 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2478 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2486 static type_element *
2487 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2489 type_element *telement = NULL;
2490 const char *codec_type_str = NULL;
2491 int codec_type = MM_VIDEO_CODEC_INVALID;
2492 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2493 _MMCamcorderSubContext *sc = NULL;
2495 mmf_return_val_if_fail(hcamcorder, NULL);
2496 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2498 mmf_return_val_if_fail(sc, NULL);
2502 /* Check element availability */
2503 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2505 switch( codec_type )
2507 case MM_VIDEO_CODEC_H263:
2508 codec_type_str = "H263";
2510 case MM_VIDEO_CODEC_H264:
2511 codec_type_str = "H264";
2513 case MM_VIDEO_CODEC_H26L:
2514 codec_type_str = "H26L";
2516 case MM_VIDEO_CODEC_MPEG4:
2517 codec_type_str = "MPEG4";
2519 case MM_VIDEO_CODEC_MPEG1:
2520 codec_type_str = "MPEG1";
2522 case MM_VIDEO_CODEC_THEORA:
2523 codec_type_str = "THEORA";
2526 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2530 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2531 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2539 static type_element *
2540 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2542 type_element *telement = NULL;
2543 const char *codec_type_str = NULL;
2544 int codec_type = MM_IMAGE_CODEC_INVALID;
2545 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2546 _MMCamcorderSubContext *sc = NULL;
2548 mmf_return_val_if_fail(hcamcorder, NULL);
2549 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2551 mmf_return_val_if_fail(sc, NULL);
2555 /* Check element availability */
2556 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2558 switch( codec_type )
2560 case MM_IMAGE_CODEC_JPEG:
2561 codec_type_str = "JPEG";
2563 case MM_IMAGE_CODEC_SRW:
2564 codec_type_str = "SRW";
2566 case MM_IMAGE_CODEC_JPEG_SRW:
2567 codec_type_str = "JPEG_SRW";
2569 case MM_IMAGE_CODEC_PNG:
2570 codec_type_str = "PNG";
2572 case MM_IMAGE_CODEC_BMP:
2573 codec_type_str = "BMP";
2575 case MM_IMAGE_CODEC_WBMP:
2576 codec_type_str = "WBMP";
2578 case MM_IMAGE_CODEC_TIFF:
2579 codec_type_str = "TIFF";
2581 case MM_IMAGE_CODEC_PCX:
2582 codec_type_str = "PCX";
2584 case MM_IMAGE_CODEC_GIF:
2585 codec_type_str = "GIF";
2587 case MM_IMAGE_CODEC_ICO:
2588 codec_type_str = "ICO";
2590 case MM_IMAGE_CODEC_RAS:
2591 codec_type_str = "RAS";
2593 case MM_IMAGE_CODEC_TGA:
2594 codec_type_str = "TGA";
2596 case MM_IMAGE_CODEC_XBM:
2597 codec_type_str = "XBM";
2599 case MM_IMAGE_CODEC_XPM:
2600 codec_type_str = "XPM";
2603 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2607 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2608 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2616 static type_element *
2617 __mmcamcorder_get_file_format_element(MMHandleType handle)
2619 type_element *telement = NULL;
2620 const char *mux_type_str = NULL;
2621 int file_type = MM_FILE_FORMAT_INVALID;
2622 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2623 _MMCamcorderSubContext *sc = NULL;
2625 mmf_return_val_if_fail(hcamcorder, NULL);
2626 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2628 mmf_return_val_if_fail(sc, NULL);
2632 /* Check element availability */
2633 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2637 case MM_FILE_FORMAT_3GP:
2638 mux_type_str = "3GP";
2640 case MM_FILE_FORMAT_AMR:
2641 mux_type_str = "AMR";
2643 case MM_FILE_FORMAT_MP4:
2644 mux_type_str = "MP4";
2646 case MM_FILE_FORMAT_AAC:
2647 mux_type_str = "AAC";
2649 case MM_FILE_FORMAT_MP3:
2650 mux_type_str = "MP3";
2652 case MM_FILE_FORMAT_OGG:
2653 mux_type_str = "OGG";
2655 case MM_FILE_FORMAT_WAV:
2656 mux_type_str = "WAV";
2658 case MM_FILE_FORMAT_AVI:
2659 mux_type_str = "AVI";
2661 case MM_FILE_FORMAT_WMA:
2662 mux_type_str = "WMA";
2664 case MM_FILE_FORMAT_WMV:
2665 mux_type_str = "WMV";
2667 case MM_FILE_FORMAT_MID:
2668 mux_type_str = "MID";
2670 case MM_FILE_FORMAT_MMF:
2671 mux_type_str = "MMF";
2673 case MM_FILE_FORMAT_MATROSKA:
2674 mux_type_str = "MATROSKA";
2676 case MM_FILE_FORMAT_M2TS:
2677 mux_type_str = "M2TS";
2680 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2684 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2685 CONFIGURE_CATEGORY_MAIN_MUX,
2694 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2696 type_element *telement = NULL;
2698 _mmcam_dbg_log("type:%d", type);
2702 case MM_CAM_AUDIO_ENCODER:
2703 telement = __mmcamcorder_get_audio_codec_element(handle);
2705 case MM_CAM_VIDEO_ENCODER:
2706 telement = __mmcamcorder_get_video_codec_element(handle);
2708 case MM_CAM_IMAGE_ENCODER:
2709 telement = __mmcamcorder_get_image_codec_element(handle);
2711 case MM_CAM_FILE_FORMAT:
2712 telement = __mmcamcorder_get_file_format_element(handle);
2715 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2722 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2724 int codec_index = MM_AUDIO_CODEC_INVALID;
2727 _mmcam_dbg_err("name is NULL");
2728 return MM_AUDIO_CODEC_INVALID;
2731 if (!strcmp(name, "AMR")) {
2732 codec_index = MM_AUDIO_CODEC_AMR;
2733 } else if (!strcmp(name, "G723_1")) {
2734 codec_index = MM_AUDIO_CODEC_G723_1;
2735 } else if (!strcmp(name, "MP3")) {
2736 codec_index = MM_AUDIO_CODEC_MP3;
2737 } else if (!strcmp(name, "AAC")) {
2738 codec_index = MM_AUDIO_CODEC_AAC;
2739 } else if (!strcmp(name, "MMF")) {
2740 codec_index = MM_AUDIO_CODEC_MMF;
2741 } else if (!strcmp(name, "ADPCM")) {
2742 codec_index = MM_AUDIO_CODEC_ADPCM;
2743 } else if (!strcmp(name, "WAVE")) {
2744 codec_index = MM_AUDIO_CODEC_WAVE;
2745 } else if (!strcmp(name, "MIDI")) {
2746 codec_index = MM_AUDIO_CODEC_MIDI;
2747 } else if (!strcmp(name, "IMELODY")) {
2748 codec_index = MM_AUDIO_CODEC_IMELODY;
2749 } else if (!strcmp(name, "VORBIS")) {
2750 codec_index = MM_AUDIO_CODEC_VORBIS;
2753 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2760 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2762 int codec_index = MM_VIDEO_CODEC_INVALID;
2765 _mmcam_dbg_err("name is NULL");
2766 return MM_VIDEO_CODEC_INVALID;
2769 if (!strcmp(name, "H263")) {
2770 codec_index = MM_VIDEO_CODEC_H263;
2771 } else if (!strcmp(name, "H264")) {
2772 codec_index = MM_VIDEO_CODEC_H264;
2773 } else if (!strcmp(name, "H26L")) {
2774 codec_index = MM_VIDEO_CODEC_H26L;
2775 } else if (!strcmp(name, "MPEG4")) {
2776 codec_index = MM_VIDEO_CODEC_MPEG4;
2777 } else if (!strcmp(name, "MPEG1")) {
2778 codec_index = MM_VIDEO_CODEC_MPEG1;
2779 } else if (!strcmp(name, "THEORA")) {
2780 codec_index = MM_VIDEO_CODEC_THEORA;
2783 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2790 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2792 int codec_index = MM_IMAGE_CODEC_INVALID;
2795 _mmcam_dbg_err("name is NULL");
2796 return MM_IMAGE_CODEC_INVALID;
2799 if (!strcmp(name, "JPEG")) {
2800 codec_index = MM_IMAGE_CODEC_JPEG;
2801 } else if (!strcmp(name, "PNG")) {
2802 codec_index = MM_IMAGE_CODEC_PNG;
2803 } else if (!strcmp(name, "BMP")) {
2804 codec_index = MM_IMAGE_CODEC_BMP;
2805 } else if (!strcmp(name, "WBMP")) {
2806 codec_index = MM_IMAGE_CODEC_WBMP;
2807 } else if (!strcmp(name, "TIFF")) {
2808 codec_index = MM_IMAGE_CODEC_TIFF;
2809 } else if (!strcmp(name, "PCX")) {
2810 codec_index = MM_IMAGE_CODEC_PCX;
2811 } else if (!strcmp(name, "GIF")) {
2812 codec_index = MM_IMAGE_CODEC_GIF;
2813 } else if (!strcmp(name, "ICO")) {
2814 codec_index = MM_IMAGE_CODEC_ICO;
2815 } else if (!strcmp(name, "RAS")) {
2816 codec_index = MM_IMAGE_CODEC_RAS;
2817 } else if (!strcmp(name, "TGA")) {
2818 codec_index = MM_IMAGE_CODEC_TGA;
2819 } else if (!strcmp(name, "XBM")) {
2820 codec_index = MM_IMAGE_CODEC_XBM;
2821 } else if (!strcmp(name, "XPM")) {
2822 codec_index = MM_IMAGE_CODEC_XPM;
2825 _mmcam_dbg_log("image codec index %d", codec_index);
2831 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2833 int mux_index = MM_FILE_FORMAT_INVALID;
2836 _mmcam_dbg_err("name is NULL");
2837 return MM_FILE_FORMAT_INVALID;
2840 if (!strcmp(name, "3GP")) {
2841 mux_index = MM_FILE_FORMAT_3GP;
2842 } else if (!strcmp(name, "AMR")) {
2843 mux_index = MM_FILE_FORMAT_AMR;
2844 } else if (!strcmp(name, "MP4")) {
2845 mux_index = MM_FILE_FORMAT_MP4;
2846 } else if (!strcmp(name, "AAC")) {
2847 mux_index = MM_FILE_FORMAT_AAC;
2848 } else if (!strcmp(name, "MP3")) {
2849 mux_index = MM_FILE_FORMAT_MP3;
2850 } else if (!strcmp(name, "OGG")) {
2851 mux_index = MM_FILE_FORMAT_OGG;
2852 } else if (!strcmp(name, "WAV")) {
2853 mux_index = MM_FILE_FORMAT_WAV;
2854 } else if (!strcmp(name, "AVI")) {
2855 mux_index = MM_FILE_FORMAT_AVI;
2856 } else if (!strcmp(name, "WMA")) {
2857 mux_index = MM_FILE_FORMAT_WMA;
2858 } else if (!strcmp(name, "WMV")) {
2859 mux_index = MM_FILE_FORMAT_WMV;
2860 } else if (!strcmp(name, "MID")) {
2861 mux_index = MM_FILE_FORMAT_MID;
2862 } else if (!strcmp(name, "MMF")) {
2863 mux_index = MM_FILE_FORMAT_MMF;
2864 } else if (!strcmp(name, "MATROSKA")) {
2865 mux_index = MM_FILE_FORMAT_MATROSKA;
2866 } else if (!strcmp(name, "M2TS")) {
2867 mux_index = MM_FILE_FORMAT_M2TS;
2871 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2878 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2882 mmf_return_val_if_fail(name, -1);
2884 switch(conf_category)
2886 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2887 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2889 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2890 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2892 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2893 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2895 case CONFIGURE_CATEGORY_MAIN_MUX:
2896 fmt = _mmcamcorder_get_mux_format(handle, name);
2899 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2906 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2908 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2909 camera_conf* configure_info = NULL;
2911 int total_count = 0;
2913 mmf_return_val_if_fail(hcamcorder, 0);
2915 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2917 configure_info = hcamcorder->conf_main;
2919 if (configure_info->info[conf_category]) {
2922 const char *name = NULL;
2923 int count = configure_info->info[conf_category]->count;
2924 conf_detail *info = configure_info->info[conf_category];
2926 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2928 if (count <= 0 || !info) {
2932 arr = (int*) g_malloc0(count * sizeof(int));
2934 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2938 for (i = 0 ; i < count ; i++) {
2939 if (info->detail_info[i] == NULL) {
2943 name = ((type_element*)(info->detail_info[i]))->name;
2944 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2946 arr[total_count++] = fmt;
2949 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/