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 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
626 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
629 /* [VideoOutput] matching table */
630 static conf_info_table conf_main_video_output_table[] = {
631 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
632 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
633 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
634 { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_x_default} },
635 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
636 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
637 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
638 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
639 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
640 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
643 /* [Capture] matching table */
644 static conf_info_table conf_main_capture_table[] = {
645 { "UseEncodebin", CONFIGURE_VALUE_INT, {.value_int = 0} },
646 { "UseCaptureMode", CONFIGURE_VALUE_INT, {.value_int = 0} },
647 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
648 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
651 /* [Record] matching table */
652 static conf_info_table conf_main_record_table[] = {
653 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
654 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
655 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
656 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
657 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
658 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
659 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
660 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
661 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
662 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
663 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
664 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
665 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
666 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
668 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
669 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
670 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
674 /* [VideoEncoder] matching table */
675 static conf_info_table conf_main_video_encoder_table[] = {
676 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
677 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
678 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
679 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
680 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
681 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
684 /* [AudioEncoder] matching table */
685 static conf_info_table conf_main_audio_encoder_table[] = {
686 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
687 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
688 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
689 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
690 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
691 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
692 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
693 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
694 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
695 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
698 /* [ImageEncoder] matching table */
699 static conf_info_table conf_main_image_encoder_table[] = {
700 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
701 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
702 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
703 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
704 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
705 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
706 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
707 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
708 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
709 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
710 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
711 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
714 /* [Mux] matching table */
715 static conf_info_table conf_main_mux_table[] = {
716 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
717 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
718 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
719 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
720 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
721 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
722 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
723 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
724 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
725 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
726 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
727 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
728 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
729 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
737 /* [Camera] matching table */
738 static conf_info_table conf_ctrl_camera_table[] = {
739 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
740 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
741 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
742 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
743 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
744 { "FPS", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
745 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
746 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
747 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
748 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
749 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
750 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
751 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
754 /* [Strobe] matching table */
755 static conf_info_table conf_ctrl_strobe_table[] = {
756 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
757 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
758 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
761 /* [Effect] matching table */
762 static conf_info_table conf_ctrl_effect_table[] = {
763 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
764 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
765 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
766 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
767 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
768 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
769 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
770 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
771 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
772 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
773 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
774 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
777 /* [Photograph] matching table */
778 static conf_info_table conf_ctrl_photograph_table[] = {
779 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
780 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
781 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
782 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
783 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
784 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
785 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
786 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
787 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
788 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
789 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
790 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
791 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
792 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
793 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
796 /* [Capture] matching table */
797 static conf_info_table conf_ctrl_capture_table[] = {
798 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
799 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
800 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
801 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
802 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
806 /* [Detect] matching table */
807 static conf_info_table conf_ctrl_detect_table[] = {
808 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
810 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
811 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
814 if (hcamcorder == NULL) {
815 _mmcam_dbg_err("handle is NULL");
819 _mmcam_dbg_log("Entered...");
821 if (type == CONFIGURE_TYPE_MAIN) {
822 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
823 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
824 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
825 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
826 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
827 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
828 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
829 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
830 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
831 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
833 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
834 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
835 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
836 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
837 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
838 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
839 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
840 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
841 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
842 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
844 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
846 for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
847 (*configure_info)->info[i] = NULL;
850 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
851 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
852 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
853 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
854 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
855 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
857 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
858 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
859 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
860 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
861 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
862 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
864 (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
866 for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
867 (*configure_info)->info[i] = NULL;
871 _mmcam_dbg_log("Done.");
877 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
879 int ret = MM_ERROR_NONE;
881 char* conf_path = NULL;
883 _mmcam_dbg_log( "Opening...[%s]", ConfFile );
885 mmf_return_val_if_fail( ConfFile, FALSE );
887 conf_path = (char*)malloc( strlen(ConfFile)+strlen(CONFIGURE_PATH)+3 );
889 if( conf_path == NULL )
891 _mmcam_dbg_err( "malloc failed." );
892 return MM_ERROR_CAMCORDER_LOW_MEMORY;
895 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH)+2, "%s/%s", CONFIGURE_PATH, ConfFile );
896 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
898 fd = fopen( conf_path, "r" );
901 _mmcam_dbg_warn( "File open failed.[%s] retry...", conf_path );
902 snprintf( conf_path, strlen(ConfFile)+strlen(CONFIGURE_PATH_RETRY)+2, "%s/%s", CONFIGURE_PATH_RETRY, ConfFile );
903 _mmcam_dbg_log( "Try open Configure File[%s]", conf_path );
904 fd = fopen( conf_path, "r" );
907 _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
913 ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
918 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
921 if( conf_path != NULL )
927 _mmcam_dbg_log( "Leave..." );
932 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
934 const unsigned int BUFFER_NUM_DETAILS = 256;
935 const unsigned int BUFFER_NUM_TOKEN = 20;
936 size_t BUFFER_LENGTH_STRING = 256;
937 const char* delimiters = " |=,\t\n";
940 int count_main_category = 0;
941 int count_details = 0;
946 char *buffer_string = NULL;
947 char *buffer_details[BUFFER_NUM_DETAILS];
948 char *buffer_token[BUFFER_NUM_TOKEN];
950 char *category_name = NULL;
951 char *detail_string = NULL;
952 char *user_ptr = NULL;
954 _mmcam_dbg_log( "" );
956 camera_conf* new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
957 if (new_conf == NULL) {
958 _mmcam_dbg_err("new_conf alloc failed : %d", sizeof(camera_conf));
959 *configure_info = NULL;
960 return MM_ERROR_CAMCORDER_LOW_MEMORY;
963 buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING);
964 if (buffer_string == NULL) {
965 _mmcam_dbg_err("buffer_string alloc failed : %d", sizeof(char) * BUFFER_LENGTH_STRING);
966 *configure_info = NULL;
968 return MM_ERROR_CAMCORDER_LOW_MEMORY;
971 new_conf->type = type;
972 *configure_info = new_conf;
974 _mmcamcorder_conf_init(handle, type, &new_conf);
977 _mmcam_dbg_err("failed file descriptor fail");
978 *configure_info = NULL;
979 g_free(buffer_string);
981 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
985 count_main_category = 0;
991 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
992 /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/
995 token = strtok_r( buffer_string, delimiters, &user_ptr );
997 if ((token) && (token[0] == ';') && (length_read > -1))
999 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1005 /*_mmcam_dbg_log( "token : [%s]", token );*/
1006 buffer_token[count_token] = token;
1008 token = strtok_r( NULL, delimiters, &user_ptr );
1011 if( count_token == 0 )
1020 if( *buffer_token[0] == ';' )
1022 /*_mmcam_dbg_log( "Comment - Nothing to do" );*/
1025 else if( *buffer_token[0] == '[' )
1027 category_name = get_new_string( buffer_token[0] );
1029 count_main_category++;
1032 while( !feof( fd ) )
1034 length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
1035 /*_mmcam_dbg_log( "Read Detail Line : [%s], read length : [%d]", buffer_string, length_read );*/
1037 detail_string = get_new_string( buffer_string );
1039 token = strtok_r( buffer_string, delimiters, &user_ptr );
1041 if( token && token[0] != ';' && length_read > -1 )
1043 /*_mmcam_dbg_log( "token : [%s]", token );*/
1044 if( token[0] == '[' )
1047 buffer_token[0] = token;
1048 SAFE_FREE( detail_string );
1052 buffer_details[count_details++] = detail_string;
1056 SAFE_FREE( detail_string );
1060 /*_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );*/
1062 if( count_details == 0 )
1064 _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name );
1065 SAFE_FREE(category_name);
1072 if( type == CONFIGURE_TYPE_MAIN )
1074 if( !strcmp( "[General]", category_name ) )
1076 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1078 else if( !strcmp( "[VideoInput]", category_name ) )
1080 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1082 else if( !strcmp( "[AudioInput]", category_name ) )
1084 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1086 else if( !strcmp( "[VideoOutput]", category_name ) )
1088 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1090 else if( !strcmp( "[Capture]", category_name ) )
1092 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1094 else if( !strcmp( "[Record]", category_name ) )
1096 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1098 else if( !strcmp( "[VideoEncoder]", category_name ) )
1100 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1102 else if( !strcmp( "[AudioEncoder]", category_name ) )
1104 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1106 else if( !strcmp( "[ImageEncoder]", category_name ) )
1108 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1110 else if( !strcmp( "[Mux]", category_name ) )
1112 category = CONFIGURE_CATEGORY_MAIN_MUX;
1117 if( !strcmp( "[Camera]", category_name ) )
1119 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1121 else if( !strcmp( "[Strobe]", category_name ) )
1123 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1125 else if( !strcmp( "[Effect]", category_name ) )
1127 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1129 else if( !strcmp( "[Photograph]", category_name ) )
1131 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1133 else if( !strcmp( "[Capture]", category_name ) )
1135 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1137 else if( !strcmp( "[Detect]", category_name ) )
1139 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1143 if( category != -1 )
1145 _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
1146 buffer_details, category, count_details );
1150 _mmcam_dbg_warn( "No matched category[%s],type[%d]... check it.", category_name, type );
1157 for( i = 0 ; i < count_details ; i++ )
1159 SAFE_FREE( buffer_details[i] );
1164 SAFE_FREE(category_name);
1167 //(*configure_info) = new_conf;
1169 SAFE_FREE( buffer_string );
1171 /*_mmcam_dbg_log( "Done." );*/
1173 return MM_ERROR_NONE;
1177 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1182 int type = CONFIGURE_VALUE_INT;
1184 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1185 camera_conf *temp_conf = (*configure_info);
1187 type_int2 *temp_int = NULL;
1188 type_int_range *temp_int_range = NULL;
1189 type_int_array *temp_int_array = NULL;
1190 type_int_pair_array *temp_int_pair_array = NULL;
1191 type_string2 *temp_string = NULL;
1192 type_string_array *temp_string_array = NULL;
1193 type_element2 *temp_element = NULL;
1195 _mmcam_dbg_log("Entered...");
1197 mmf_return_if_fail(temp_conf);
1199 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN) {
1200 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1202 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1205 for (i = 0 ; i < category_num ; i++) {
1206 if (temp_conf->info[i]) {
1207 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1208 if (temp_conf->info[i]->detail_info[j] == NULL) {
1212 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1214 case CONFIGURE_VALUE_INT:
1215 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1216 SAFE_FREE(temp_int->name);
1218 case CONFIGURE_VALUE_INT_RANGE:
1219 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1220 SAFE_FREE(temp_int_range->name);
1222 case CONFIGURE_VALUE_INT_ARRAY:
1223 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1224 SAFE_FREE(temp_int_array->name);
1225 SAFE_FREE(temp_int_array->value);
1227 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1228 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1229 SAFE_FREE(temp_int_pair_array->name);
1230 SAFE_FREE(temp_int_pair_array->value[0]);
1231 SAFE_FREE(temp_int_pair_array->value[1]);
1233 case CONFIGURE_VALUE_STRING:
1234 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1235 SAFE_FREE(temp_string->name);
1236 SAFE_FREE(temp_string->value);
1238 case CONFIGURE_VALUE_STRING_ARRAY:
1239 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1240 SAFE_FREE(temp_string_array->name);
1241 if (temp_string_array->value) {
1242 count = temp_string_array->count;
1243 for (k = 0 ; k < count ; k++) {
1244 SAFE_FREE(temp_string_array->value[k]);
1246 g_free(temp_string_array->value);
1247 temp_string_array->value = NULL;
1249 SAFE_FREE(temp_string_array->default_value);
1251 case CONFIGURE_VALUE_ELEMENT:
1252 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1253 SAFE_FREE(temp_element->name);
1254 SAFE_FREE(temp_element->element_name);
1256 if (temp_element->value_int) {
1257 count = temp_element->count_int;
1258 for (k = 0 ; k < count ; k++) {
1259 SAFE_FREE(temp_element->value_int[k]->name);
1260 SAFE_FREE(temp_element->value_int[k]);
1262 g_free(temp_element->value_int);
1265 if (temp_element->value_string) {
1266 count = temp_element->count_string;
1267 for (k = 0 ; k < count ; k++) {
1268 SAFE_FREE(temp_element->value_string[k]->name);
1269 SAFE_FREE(temp_element->value_string[k]->value);
1270 SAFE_FREE(temp_element->value_string[k]);
1272 g_free(temp_element->value_string);
1276 _mmcam_dbg_warn("unknown type %d", type);
1281 SAFE_FREE(temp_conf->info[i]->detail_info[j]);
1282 temp_conf->info[i]->detail_info[j] = NULL;
1285 SAFE_FREE(temp_conf->info[i]->detail_info);
1286 temp_conf->info[i]->detail_info = NULL;
1288 SAFE_FREE(temp_conf->info[i]);
1289 temp_conf->info[i] = NULL;
1293 SAFE_FREE((*configure_info)->info);
1294 SAFE_FREE((*configure_info));
1296 _mmcam_dbg_log("Done.");
1299 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1302 int count_value = 0;
1304 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1306 if (hcamcorder == NULL) {
1307 _mmcam_dbg_err("handle is NULL");
1311 /*_mmcam_dbg_log( "Entered..." );*/
1313 mmf_return_val_if_fail( name, FALSE );
1315 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
1317 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
1321 /*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
1323 if( type == CONFIGURE_TYPE_MAIN )
1325 for( i = 0 ; i < count_value ; i++ )
1327 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
1329 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1330 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1337 for( i = 0 ; i < count_value ; i++ )
1339 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
1341 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1342 /*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
1352 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
1354 const int BUFFER_NUM_TOKEN = 256;
1361 char *buffer_token[BUFFER_NUM_TOKEN];
1362 char *user_ptr = NULL;
1364 const char *delimiters = " |=,\t\n";
1365 const char *delimiters_sub = " |\t\n";
1366 const char *delimiters_3rd = "|\n";
1368 mmf_return_val_if_fail( buffer_details, FALSE );
1370 (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
1371 if (*info == NULL) {
1372 _mmcam_dbg_err("allocation failed");
1375 (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
1376 (*info)->count = count_details;
1378 for ( i = 0 ; i < count_details ; i++ ) {
1379 /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/
1381 token = strtok_r( buffer_details[i], delimiters, &user_ptr );
1384 buffer_token[count_token] = token;
1387 (*info)->detail_info[i] = NULL;
1388 _mmcam_dbg_warn( "No token... check it.[%s]", buffer_details[i] );
1392 if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
1393 (*info)->detail_info[i] = NULL;
1394 _mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
1398 if (value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY) {
1399 token = strtok_r( NULL, delimiters, &user_ptr );
1401 buffer_token[count_token] = token;
1402 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1404 token = strtok_r( NULL, delimiters, &user_ptr );
1407 if (count_token < 2) {
1408 (*info)->detail_info[i] = NULL;
1409 _mmcam_dbg_warn( "Number of token is too small... check it.[%s]", buffer_details[i] );
1412 } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */
1414 strtok_r( NULL, delimiters_sub, &user_ptr );
1416 if (value_type == CONFIGURE_VALUE_STRING_ARRAY) {
1417 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1419 buffer_token[count_token] = token;
1420 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1422 token = strtok_r( NULL, delimiters_sub, &user_ptr );
1424 } else { /* CONFIGURE_VALUE_STRING */
1425 token = strtok_r( NULL, delimiters_3rd, &user_ptr );
1428 buffer_token[count_token] = token;
1429 /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/
1434 if (count_token < 2) {
1435 (*info)->detail_info[i] = NULL;
1436 _mmcam_dbg_warn( "No string value... check it.[%s]", buffer_details[i] );
1443 case CONFIGURE_VALUE_INT:
1447 new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
1448 if ( new_int == NULL ) {
1449 _mmcam_dbg_err("allocation failed");
1452 new_int->name = get_new_string( buffer_token[0] );
1453 new_int->value = atoi( buffer_token[1] );
1454 (*info)->detail_info[i] = (void*)new_int;
1455 /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/
1458 case CONFIGURE_VALUE_INT_RANGE:
1460 type_int_range* new_int_range;
1462 new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
1463 if ( new_int_range == NULL ) {
1464 _mmcam_dbg_err("allocation failed");
1467 new_int_range->name = get_new_string( buffer_token[0] );
1468 new_int_range->min = atoi( buffer_token[1] );
1469 new_int_range->max = atoi( buffer_token[2] );
1470 new_int_range->default_value = atoi( buffer_token[3] );
1471 (*info)->detail_info[i] = (void*)new_int_range;
1473 _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1474 new_int_range->name,
1477 new_int_range->default_value);
1481 case CONFIGURE_VALUE_INT_ARRAY:
1483 int count_value = count_token - 2;
1484 type_int_array* new_int_array;
1486 new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
1487 if (new_int_array == NULL) {
1488 _mmcam_dbg_err("allocation failed");
1491 new_int_array->name = get_new_string( buffer_token[0] );
1492 new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
1493 if (new_int_array->value == NULL) {
1494 if (new_int_array->name) {
1495 free(new_int_array->name);
1496 new_int_array->name = NULL;
1498 free(new_int_array);
1499 new_int_array = NULL;
1500 _mmcam_dbg_err("allocation failed");
1503 new_int_array->count = count_value;
1505 /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/
1506 for ( j = 0 ; j < count_value ; j++ ) {
1507 new_int_array->value[j] = atoi( buffer_token[j+1] );
1508 /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/
1511 new_int_array->default_value = atoi( buffer_token[count_token-1] );
1512 /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
1514 (*info)->detail_info[i] = (void*)new_int_array;
1517 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1519 int count_value = ( count_token - 3 ) >> 1;
1520 type_int_pair_array* new_int_pair_array;
1522 new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
1523 if ( new_int_pair_array == NULL ) {
1524 _mmcam_dbg_err("allocation failed");
1527 new_int_pair_array->name = get_new_string( buffer_token[0] );
1528 new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
1529 if ( new_int_pair_array->value[0] == NULL ) {
1530 if (new_int_pair_array->name) {
1531 free( new_int_pair_array->name );
1532 new_int_pair_array->name = NULL;
1534 free( new_int_pair_array );
1535 new_int_pair_array = NULL;
1536 _mmcam_dbg_err("allocation failed");
1539 new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) );
1540 if ( new_int_pair_array->value[1] == NULL ) {
1541 free( new_int_pair_array->value[0] );
1542 new_int_pair_array->value[0] = NULL;
1543 if (new_int_pair_array->name) {
1544 free( new_int_pair_array->name );
1545 new_int_pair_array->name = NULL;
1547 free( new_int_pair_array );
1548 new_int_pair_array = NULL;
1549 _mmcam_dbg_err("allocation failed");
1552 new_int_pair_array->count = count_value;
1554 /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/
1555 for ( j = 0 ; j < count_value ; j++ ) {
1556 new_int_pair_array->value[0][j] = atoi( buffer_token[(j<<1)+1] );
1557 new_int_pair_array->value[1][j] = atoi( buffer_token[(j<<1)+2] );
1559 _mmcam_dbg_log(" index[%d] - value[%d,%d]", j,
1560 new_int_pair_array->value[0][j],
1561 new_int_pair_array->value[1][j]);
1565 new_int_pair_array->default_value[0] = atoi( buffer_token[count_token-2] );
1566 new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
1568 _mmcam_dbg_log(" default value[%d,%d]",
1569 new_int_pair_array->default_value[0],
1570 new_int_pair_array->default_value[1]);
1572 (*info)->detail_info[i] = (void*)new_int_pair_array;
1575 case CONFIGURE_VALUE_STRING:
1577 type_string2* new_string;
1579 new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
1580 if (new_string == NULL) {
1581 _mmcam_dbg_err("allocation failed");
1584 new_string->name = get_new_string( buffer_token[0] );
1585 new_string->value = get_new_string( buffer_token[1] );
1586 (*info)->detail_info[i] = (void*)new_string;
1588 /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
1591 case CONFIGURE_VALUE_STRING_ARRAY:
1593 int count_value = count_token - 2;
1594 type_string_array* new_string_array;
1596 new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
1597 if ( new_string_array == NULL ) {
1600 new_string_array->name = get_new_string( buffer_token[0] );
1601 new_string_array->count = count_value;
1602 new_string_array->value = (char**)g_malloc0( sizeof(char*)*count_value );
1603 if ( new_string_array->value == NULL ) {
1604 if (new_string_array->name) {
1605 free(new_string_array->name);
1606 new_string_array->name = NULL;
1608 free(new_string_array);
1609 new_string_array = NULL;
1610 _mmcam_dbg_err("allocation failed");
1613 /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/
1614 for ( j = 0 ; j < count_value ; j++ ) {
1615 new_string_array->value[j] = get_new_string( buffer_token[j+1] );
1616 /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/
1619 new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
1620 /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/
1621 (*info)->detail_info[i] = (void*)new_string_array;
1624 case CONFIGURE_VALUE_ELEMENT:
1626 type_element2* new_element;
1628 new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
1629 if ( new_element == NULL ) {
1630 _mmcam_dbg_err("allocation failed");
1633 new_element->name = get_new_string( buffer_token[0] );
1634 new_element->element_name = get_new_string( buffer_token[1] );
1635 new_element->count_int = atoi( buffer_token[2] );
1636 new_element->value_int = NULL;
1637 new_element->count_string = atoi( buffer_token[3] );
1638 new_element->value_string = NULL;
1640 _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1641 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1644 /* add int values */
1645 if ( new_element->count_int > 0 ) {
1646 new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
1647 if ( new_element->value_int) {
1648 for ( j = 0 ; j < new_element->count_int ; j++ ) {
1649 new_element->value_int[j] = (type_int2*)g_malloc( sizeof(type_int2) );
1650 if ( new_element->value_int[j] ) {
1651 new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
1652 new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
1654 _mmcam_dbg_err("allocation failed");
1657 _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]",
1658 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1662 _mmcam_dbg_err("allocation failed");
1667 new_element->value_int = NULL;
1670 /* add string values */
1671 if ( new_element->count_string > 0 ) {
1672 new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
1673 if (new_element->value_string) {
1674 for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
1675 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
1676 if(new_element->value_string[j-new_element->count_int]) {
1677 new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
1678 new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
1680 _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]",
1681 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);
1684 _mmcam_dbg_err("allocation failed");
1688 _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
1691 new_element->value_string = NULL;
1694 (*info)->detail_info[i] = (void*)new_element;
1706 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1711 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1713 mmf_return_val_if_fail( configure_info, FALSE );
1714 mmf_return_val_if_fail( name, FALSE );
1716 if( configure_info->info[category] )
1718 count = configure_info->info[category]->count;
1719 info = configure_info->info[category];
1721 for( i = 0 ; i < count ; i++ )
1723 if( info->detail_info[i] == NULL )
1728 if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
1730 *value = ((type_int*)(info->detail_info[i]))->value;
1731 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1737 if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
1739 //_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
1743 _mmcam_dbg_warn( "Faild to get int... check it...Category[%d],Name[%s]", category, name );
1749 _mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
1754 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1756 mmf_return_val_if_fail( configure_info, FALSE );
1757 mmf_return_val_if_fail( name, FALSE );
1759 if( configure_info->info[category] )
1761 count = configure_info->info[category]->count;
1762 info = configure_info->info[category];
1764 for( i = 0 ; i < count ; i++ )
1766 if( info->detail_info[i] == NULL )
1771 if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
1773 *value = (type_int_range*)(info->detail_info[i]);
1775 _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
1776 name, (*value)->min, (*value)->max, (*value)->default_value );
1785 /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/
1791 _mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
1796 /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
1798 mmf_return_val_if_fail( configure_info, FALSE );
1799 mmf_return_val_if_fail( name, FALSE );
1801 if( configure_info->info[category] )
1803 count = configure_info->info[category]->count;
1804 info = configure_info->info[category];
1806 for( i = 0 ; i < count ; i++ )
1808 if( info->detail_info[i] == NULL )
1813 if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
1815 *value = (type_int_array*)(info->detail_info[i]);
1817 _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
1818 name, (*value)->value, (*value)->count, (*value)->default_value );
1827 /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/
1833 _mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
1838 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1840 mmf_return_val_if_fail( configure_info, FALSE );
1841 mmf_return_val_if_fail( name, FALSE );
1843 if( configure_info->info[category] )
1845 count = configure_info->info[category]->count;
1846 info = configure_info->info[category];
1848 for( i = 0 ; i < count ; i++ )
1850 if( info->detail_info[i] == NULL )
1855 if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
1857 *value = (type_int_pair_array*)(info->detail_info[i]);
1859 _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
1860 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1861 (*value)->default_value[0], (*value)->default_value[1] );
1870 _mmcam_dbg_warn( "Faild to get int pair array... check it...Category[%d],Name[%s]", category, name );
1875 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1880 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1882 mmf_return_val_if_fail( configure_info, FALSE );
1883 mmf_return_val_if_fail( name, FALSE );
1885 if( configure_info->info[category] )
1887 count = configure_info->info[category]->count;
1888 info = configure_info->info[category];
1890 for( i = 0 ; i < count ; i++ )
1892 if( info->detail_info[i] == NULL )
1897 if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
1899 *value = ((type_string*)(info->detail_info[i]))->value;
1900 //_mmcam_dbg_log( "Get[%s] string[%s]", name, *value );
1906 if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
1908 //_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
1912 _mmcam_dbg_warn( "Faild to get string... check it...Category[%d],Name[%s]", category, name );
1918 _mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
1923 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1925 mmf_return_val_if_fail( configure_info, FALSE );
1926 mmf_return_val_if_fail( name, FALSE );
1928 if( configure_info->info[category] )
1930 count = configure_info->info[category]->count;
1931 info = configure_info->info[category];
1933 for( i = 0 ; i < count ; i++ )
1935 if( info->detail_info[i] == NULL )
1940 if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
1942 *value = (type_string_array*)(info->detail_info[i]);
1944 _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
1945 name, (*value)->value, (*value)->count, (*value)->default_value );
1954 /*_mmcam_dbg_warn( "Faild to get string array... check it...Category[%d],Name[%s]", category, name );*/
1959 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1964 //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
1966 mmf_return_val_if_fail( configure_info, FALSE );
1967 mmf_return_val_if_fail( name, FALSE );
1969 if( configure_info->info[category] )
1971 count = configure_info->info[category]->count;
1972 info = configure_info->info[category];
1974 for( i = 0 ; i < count ; i++ )
1976 if( info->detail_info[i] == NULL )
1981 if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
1983 *element = (type_element*)(info->detail_info[i]);
1984 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1990 if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
1992 //_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
1996 _mmcam_dbg_warn( "Faild to get element name... check it...Category[%d],Name[%s]", category, name );
2002 _mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
2004 //_mmcam_dbg_log( "Entered..." );
2006 mmf_return_val_if_fail( element, FALSE );
2008 *value = element->element_name;
2010 //_mmcam_dbg_log( "Get element name : [%s]", *value );
2016 _mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
2020 //_mmcam_dbg_log( "Entered..." );
2022 mmf_return_val_if_fail( element, FALSE );
2023 mmf_return_val_if_fail( name, FALSE );
2025 for( i = 0 ; i < element->count_int ; i++ )
2027 if( !strcmp( element->value_int[i]->name , name ) )
2029 *value = element->value_int[i]->value;
2030 //_mmcam_dbg_log( "Get[%s] element int[%d]", name, *value );
2035 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2036 element->name, name, element->count_int );
2042 _mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
2046 //_mmcam_dbg_log( "Entered..." );
2048 mmf_return_val_if_fail( element, FALSE );
2049 mmf_return_val_if_fail( name, FALSE );
2051 for( i = 0 ; i < element->count_string ; i++ )
2053 if( !strcmp( element->value_string[i]->name , name ) )
2055 *value = element->value_string[i]->value;
2056 //_mmcam_dbg_log( "Get[%s] element string[%s]", name, *value );
2061 _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
2062 element->name, name, element->count_string );
2068 _mmcamcorder_conf_set_value_element_property( GstElement* gst, type_element* element )
2072 //_mmcam_dbg_log( "Entered..." );
2074 mmf_return_val_if_fail( gst, FALSE );
2075 mmf_return_val_if_fail( element, FALSE );
2077 if( element->count_int == 0 )
2079 /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/
2083 if( element->value_int == NULL )
2085 _mmcam_dbg_warn( "count_int[%d] is NOT zero, but value_int is NULL", element->count_int );
2089 for( i = 0 ; i < element->count_int ; i++ )
2091 MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
2094 _mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
2095 element->element_name,
2096 element->value_int[i]->name,
2097 element->value_int[i]->value );
2102 if( element->count_string == 0 )
2104 _mmcam_dbg_log( "There is no string property to set in INI file[%s].", element->name );
2108 if( element->value_string == NULL )
2110 _mmcam_dbg_warn( "count_string[%d] is NOT zero, but value_string is NULL", element->count_string );
2114 for( i = 0 ; i < element->count_string ; i++ )
2116 MMCAMCORDER_G_OBJECT_SET( gst, element->value_string[i]->name, element->value_string[i]->value );
2118 _mmcam_dbg_log( "Element[%s] Set[%s] -> string[%s]",
2119 element->element_name,
2120 element->value_string[i]->name,
2121 element->value_string[i]->value );
2125 //_mmcam_dbg_log( "Done." );
2131 _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
2134 int count_value = 0;
2136 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2138 if (hcamcorder == NULL) {
2139 _mmcam_dbg_err("handle is NULL");
2143 //_mmcam_dbg_log( "Entered..." );
2145 mmf_return_val_if_fail( name, FALSE );
2147 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2149 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2153 if( type == CONFIGURE_TYPE_MAIN )
2155 for( i = 0 ; i < count_value ; i++ )
2157 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2159 *value = hcamcorder->conf_main_info_table[category][i].value_int;
2166 for( i = 0 ; i < count_value ; i++ )
2168 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2170 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
2176 _mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2181 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2184 int count_value = 0;
2186 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2188 if (hcamcorder == NULL) {
2189 _mmcam_dbg_err("handle is NULL");
2193 //_mmcam_dbg_log( "Entered..." );
2195 mmf_return_val_if_fail( name, FALSE );
2197 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2199 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2203 if( type == CONFIGURE_TYPE_MAIN )
2205 for( i = 0 ; i < count_value ; i++ )
2207 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2209 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2210 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2217 for( i = 0 ; i < count_value ; i++ )
2219 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2221 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2222 _mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
2228 _mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2233 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2236 int count_value = 0;
2238 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2240 if (hcamcorder == NULL) {
2241 _mmcam_dbg_err("handle is NULL");
2245 //_mmcam_dbg_log( "Entered..." );
2247 mmf_return_val_if_fail( name, FALSE );
2249 if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
2251 _mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
2255 if( type == CONFIGURE_TYPE_MAIN )
2257 for( i = 0 ; i < count_value ; i++ )
2259 if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
2261 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2262 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2269 for( i = 0 ; i < count_value ; i++ )
2271 if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
2273 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2274 _mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
2280 _mmcam_dbg_warn( "Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
2285 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2287 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2289 if (hcamcorder == NULL) {
2290 _mmcam_dbg_err("handle is NULL");
2294 // mmf_return_val_if_fail( conf_main_category_size, FALSE );
2295 // mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
2297 if( type == CONFIGURE_TYPE_MAIN )
2299 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
2301 *size = (int)hcamcorder->conf_main_category_size[category];
2305 mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
2307 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2314 _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
2316 int i, j, k, type, category_type;
2319 type_int_range *temp_int_range;
2320 type_int_array *temp_int_array;
2321 type_int_pair_array *temp_int_pair_array;
2322 type_string *temp_string;
2323 type_element *temp_element;
2325 g_print( "[ConfigureInfoPrint] : Entered.\n" );
2327 mmf_return_if_fail( *configure_info );
2329 if( (*configure_info)->type == CONFIGURE_TYPE_MAIN )
2331 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2335 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2338 for( i = 0 ; i < category_type ; i++ )
2340 if( (*configure_info)->info[i] )
2342 g_print( "[ConfigureInfo] : Category [%d]\n", i );
2343 for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
2345 if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
2349 case CONFIGURE_VALUE_INT:
2350 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2351 g_print( "[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value );
2353 case CONFIGURE_VALUE_INT_RANGE:
2354 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2355 g_print( "[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2356 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value );
2358 case CONFIGURE_VALUE_INT_ARRAY:
2359 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2360 g_print( "[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2361 temp_int_array->name, temp_int_array->default_value );
2362 for( k = 0 ; k < temp_int_array->count ; k++ )
2364 g_print( "[%d] ", temp_int_array->value[k] );
2368 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2369 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2370 g_print( "[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2371 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0] );
2372 for( k = 0 ; k < temp_int_pair_array->count ; k++ )
2374 g_print( "[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k] );
2378 case CONFIGURE_VALUE_STRING:
2379 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2380 g_print( "[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value );
2382 case CONFIGURE_VALUE_ELEMENT:
2383 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2384 g_print( "[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name );
2385 for( k = 0 ; k < temp_element->count_int ; k++ )
2387 g_print( " - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value );
2389 for( k = 0 ; k < temp_element->count_string ; k++ )
2391 g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
2395 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 );
2401 g_print( "[ConfigureInfo] : Failed to get value type." );
2407 g_print( "[ConfigureInfoPrint] : Done.\n" );
2411 static type_element *
2412 __mmcamcorder_get_audio_codec_element(MMHandleType handle)
2414 type_element *telement = NULL;
2415 const char *codec_type_str = NULL;
2416 int codec_type = MM_AUDIO_CODEC_INVALID;
2417 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2418 _MMCamcorderSubContext *sc = NULL;
2420 mmf_return_val_if_fail(hcamcorder, NULL);
2421 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2423 mmf_return_val_if_fail(sc, NULL);
2427 /* Check element availability */
2428 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2430 switch( codec_type )
2432 case MM_AUDIO_CODEC_AMR:
2433 codec_type_str = "AMR";
2435 case MM_AUDIO_CODEC_G723_1:
2436 codec_type_str = "G723_1";
2438 case MM_AUDIO_CODEC_MP3:
2439 codec_type_str = "MP3";
2441 case MM_AUDIO_CODEC_AAC:
2442 codec_type_str = "AAC";
2444 case MM_AUDIO_CODEC_MMF:
2445 codec_type_str = "MMF";
2447 case MM_AUDIO_CODEC_ADPCM:
2448 codec_type_str = "ADPCM";
2450 case MM_AUDIO_CODEC_WAVE:
2451 codec_type_str = "WAVE";
2453 case MM_AUDIO_CODEC_MIDI:
2454 codec_type_str = "MIDI";
2456 case MM_AUDIO_CODEC_IMELODY:
2457 codec_type_str = "IMELODY";
2459 case MM_AUDIO_CODEC_VORBIS:
2460 codec_type_str = "VORBIS";
2463 _mmcam_dbg_err( "Not supported audio codec[%d]", codec_type );
2467 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2468 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2476 static type_element *
2477 __mmcamcorder_get_video_codec_element(MMHandleType handle)
2479 type_element *telement = NULL;
2480 const char *codec_type_str = NULL;
2481 int codec_type = MM_VIDEO_CODEC_INVALID;
2482 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2483 _MMCamcorderSubContext *sc = NULL;
2485 mmf_return_val_if_fail(hcamcorder, NULL);
2486 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2488 mmf_return_val_if_fail(sc, NULL);
2492 /* Check element availability */
2493 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2495 switch( codec_type )
2497 case MM_VIDEO_CODEC_H263:
2498 codec_type_str = "H263";
2500 case MM_VIDEO_CODEC_H264:
2501 codec_type_str = "H264";
2503 case MM_VIDEO_CODEC_H26L:
2504 codec_type_str = "H26L";
2506 case MM_VIDEO_CODEC_MPEG4:
2507 codec_type_str = "MPEG4";
2509 case MM_VIDEO_CODEC_MPEG1:
2510 codec_type_str = "MPEG1";
2512 case MM_VIDEO_CODEC_THEORA:
2513 codec_type_str = "THEORA";
2516 _mmcam_dbg_err( "Not supported video codec[%d]", codec_type );
2520 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2521 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2529 static type_element *
2530 __mmcamcorder_get_image_codec_element(MMHandleType handle)
2532 type_element *telement = NULL;
2533 const char *codec_type_str = NULL;
2534 int codec_type = MM_IMAGE_CODEC_INVALID;
2535 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2536 _MMCamcorderSubContext *sc = NULL;
2538 mmf_return_val_if_fail(hcamcorder, NULL);
2539 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2541 mmf_return_val_if_fail(sc, NULL);
2545 /* Check element availability */
2546 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2548 switch( codec_type )
2550 case MM_IMAGE_CODEC_JPEG:
2551 codec_type_str = "JPEG";
2553 case MM_IMAGE_CODEC_SRW:
2554 codec_type_str = "SRW";
2556 case MM_IMAGE_CODEC_JPEG_SRW:
2557 codec_type_str = "JPEG_SRW";
2559 case MM_IMAGE_CODEC_PNG:
2560 codec_type_str = "PNG";
2562 case MM_IMAGE_CODEC_BMP:
2563 codec_type_str = "BMP";
2565 case MM_IMAGE_CODEC_WBMP:
2566 codec_type_str = "WBMP";
2568 case MM_IMAGE_CODEC_TIFF:
2569 codec_type_str = "TIFF";
2571 case MM_IMAGE_CODEC_PCX:
2572 codec_type_str = "PCX";
2574 case MM_IMAGE_CODEC_GIF:
2575 codec_type_str = "GIF";
2577 case MM_IMAGE_CODEC_ICO:
2578 codec_type_str = "ICO";
2580 case MM_IMAGE_CODEC_RAS:
2581 codec_type_str = "RAS";
2583 case MM_IMAGE_CODEC_TGA:
2584 codec_type_str = "TGA";
2586 case MM_IMAGE_CODEC_XBM:
2587 codec_type_str = "XBM";
2589 case MM_IMAGE_CODEC_XPM:
2590 codec_type_str = "XPM";
2593 _mmcam_dbg_err( "Not supported image codec[%d]", codec_type );
2597 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2598 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2606 static type_element *
2607 __mmcamcorder_get_file_format_element(MMHandleType handle)
2609 type_element *telement = NULL;
2610 const char *mux_type_str = NULL;
2611 int file_type = MM_FILE_FORMAT_INVALID;
2612 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2613 _MMCamcorderSubContext *sc = NULL;
2615 mmf_return_val_if_fail(hcamcorder, NULL);
2616 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2618 mmf_return_val_if_fail(sc, NULL);
2622 /* Check element availability */
2623 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2627 case MM_FILE_FORMAT_3GP:
2628 mux_type_str = "3GP";
2630 case MM_FILE_FORMAT_AMR:
2631 mux_type_str = "AMR";
2633 case MM_FILE_FORMAT_MP4:
2634 mux_type_str = "MP4";
2636 case MM_FILE_FORMAT_AAC:
2637 mux_type_str = "AAC";
2639 case MM_FILE_FORMAT_MP3:
2640 mux_type_str = "MP3";
2642 case MM_FILE_FORMAT_OGG:
2643 mux_type_str = "OGG";
2645 case MM_FILE_FORMAT_WAV:
2646 mux_type_str = "WAV";
2648 case MM_FILE_FORMAT_AVI:
2649 mux_type_str = "AVI";
2651 case MM_FILE_FORMAT_WMA:
2652 mux_type_str = "WMA";
2654 case MM_FILE_FORMAT_WMV:
2655 mux_type_str = "WMV";
2657 case MM_FILE_FORMAT_MID:
2658 mux_type_str = "MID";
2660 case MM_FILE_FORMAT_MMF:
2661 mux_type_str = "MMF";
2663 case MM_FILE_FORMAT_MATROSKA:
2664 mux_type_str = "MATROSKA";
2666 case MM_FILE_FORMAT_M2TS:
2667 mux_type_str = "M2TS";
2670 _mmcam_dbg_err( "Not supported file format[%d]", file_type );
2674 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2675 CONFIGURE_CATEGORY_MAIN_MUX,
2684 _mmcamcorder_get_type_element(MMHandleType handle, int type)
2686 type_element *telement = NULL;
2688 _mmcam_dbg_log("type:%d", type);
2692 case MM_CAM_AUDIO_ENCODER:
2693 telement = __mmcamcorder_get_audio_codec_element(handle);
2695 case MM_CAM_VIDEO_ENCODER:
2696 telement = __mmcamcorder_get_video_codec_element(handle);
2698 case MM_CAM_IMAGE_ENCODER:
2699 telement = __mmcamcorder_get_image_codec_element(handle);
2701 case MM_CAM_FILE_FORMAT:
2702 telement = __mmcamcorder_get_file_format_element(handle);
2705 _mmcam_dbg_log("Can't get element type form this profile.(%d)", type);
2712 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2714 int codec_index = MM_AUDIO_CODEC_INVALID;
2717 _mmcam_dbg_err("name is NULL");
2718 return MM_AUDIO_CODEC_INVALID;
2721 if (!strcmp(name, "AMR")) {
2722 codec_index = MM_AUDIO_CODEC_AMR;
2723 } else if (!strcmp(name, "G723_1")) {
2724 codec_index = MM_AUDIO_CODEC_G723_1;
2725 } else if (!strcmp(name, "MP3")) {
2726 codec_index = MM_AUDIO_CODEC_MP3;
2727 } else if (!strcmp(name, "AAC")) {
2728 codec_index = MM_AUDIO_CODEC_AAC;
2729 } else if (!strcmp(name, "MMF")) {
2730 codec_index = MM_AUDIO_CODEC_MMF;
2731 } else if (!strcmp(name, "ADPCM")) {
2732 codec_index = MM_AUDIO_CODEC_ADPCM;
2733 } else if (!strcmp(name, "WAVE")) {
2734 codec_index = MM_AUDIO_CODEC_WAVE;
2735 } else if (!strcmp(name, "MIDI")) {
2736 codec_index = MM_AUDIO_CODEC_MIDI;
2737 } else if (!strcmp(name, "IMELODY")) {
2738 codec_index = MM_AUDIO_CODEC_IMELODY;
2739 } else if (!strcmp(name, "VORBIS")) {
2740 codec_index = MM_AUDIO_CODEC_VORBIS;
2743 /*_mmcam_dbg_log("audio codec index %d", codec_index);*/
2750 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2752 int codec_index = MM_VIDEO_CODEC_INVALID;
2755 _mmcam_dbg_err("name is NULL");
2756 return MM_VIDEO_CODEC_INVALID;
2759 if (!strcmp(name, "H263")) {
2760 codec_index = MM_VIDEO_CODEC_H263;
2761 } else if (!strcmp(name, "H264")) {
2762 codec_index = MM_VIDEO_CODEC_H264;
2763 } else if (!strcmp(name, "H26L")) {
2764 codec_index = MM_VIDEO_CODEC_H26L;
2765 } else if (!strcmp(name, "MPEG4")) {
2766 codec_index = MM_VIDEO_CODEC_MPEG4;
2767 } else if (!strcmp(name, "MPEG1")) {
2768 codec_index = MM_VIDEO_CODEC_MPEG1;
2769 } else if (!strcmp(name, "THEORA")) {
2770 codec_index = MM_VIDEO_CODEC_THEORA;
2773 /*_mmcam_dbg_log("video codec index %d", codec_index);*/
2780 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2782 int codec_index = MM_IMAGE_CODEC_INVALID;
2785 _mmcam_dbg_err("name is NULL");
2786 return MM_IMAGE_CODEC_INVALID;
2789 if (!strcmp(name, "JPEG")) {
2790 codec_index = MM_IMAGE_CODEC_JPEG;
2791 } else if (!strcmp(name, "PNG")) {
2792 codec_index = MM_IMAGE_CODEC_PNG;
2793 } else if (!strcmp(name, "BMP")) {
2794 codec_index = MM_IMAGE_CODEC_BMP;
2795 } else if (!strcmp(name, "WBMP")) {
2796 codec_index = MM_IMAGE_CODEC_WBMP;
2797 } else if (!strcmp(name, "TIFF")) {
2798 codec_index = MM_IMAGE_CODEC_TIFF;
2799 } else if (!strcmp(name, "PCX")) {
2800 codec_index = MM_IMAGE_CODEC_PCX;
2801 } else if (!strcmp(name, "GIF")) {
2802 codec_index = MM_IMAGE_CODEC_GIF;
2803 } else if (!strcmp(name, "ICO")) {
2804 codec_index = MM_IMAGE_CODEC_ICO;
2805 } else if (!strcmp(name, "RAS")) {
2806 codec_index = MM_IMAGE_CODEC_RAS;
2807 } else if (!strcmp(name, "TGA")) {
2808 codec_index = MM_IMAGE_CODEC_TGA;
2809 } else if (!strcmp(name, "XBM")) {
2810 codec_index = MM_IMAGE_CODEC_XBM;
2811 } else if (!strcmp(name, "XPM")) {
2812 codec_index = MM_IMAGE_CODEC_XPM;
2815 _mmcam_dbg_log("image codec index %d", codec_index);
2821 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2823 int mux_index = MM_FILE_FORMAT_INVALID;
2826 _mmcam_dbg_err("name is NULL");
2827 return MM_FILE_FORMAT_INVALID;
2830 if (!strcmp(name, "3GP")) {
2831 mux_index = MM_FILE_FORMAT_3GP;
2832 } else if (!strcmp(name, "AMR")) {
2833 mux_index = MM_FILE_FORMAT_AMR;
2834 } else if (!strcmp(name, "MP4")) {
2835 mux_index = MM_FILE_FORMAT_MP4;
2836 } else if (!strcmp(name, "AAC")) {
2837 mux_index = MM_FILE_FORMAT_AAC;
2838 } else if (!strcmp(name, "MP3")) {
2839 mux_index = MM_FILE_FORMAT_MP3;
2840 } else if (!strcmp(name, "OGG")) {
2841 mux_index = MM_FILE_FORMAT_OGG;
2842 } else if (!strcmp(name, "WAV")) {
2843 mux_index = MM_FILE_FORMAT_WAV;
2844 } else if (!strcmp(name, "AVI")) {
2845 mux_index = MM_FILE_FORMAT_AVI;
2846 } else if (!strcmp(name, "WMA")) {
2847 mux_index = MM_FILE_FORMAT_WMA;
2848 } else if (!strcmp(name, "WMV")) {
2849 mux_index = MM_FILE_FORMAT_WMV;
2850 } else if (!strcmp(name, "MID")) {
2851 mux_index = MM_FILE_FORMAT_MID;
2852 } else if (!strcmp(name, "MMF")) {
2853 mux_index = MM_FILE_FORMAT_MMF;
2854 } else if (!strcmp(name, "MATROSKA")) {
2855 mux_index = MM_FILE_FORMAT_MATROSKA;
2856 } else if (!strcmp(name, "M2TS")) {
2857 mux_index = MM_FILE_FORMAT_M2TS;
2861 /*_mmcam_dbg_log("mux index %d", mux_index);*/
2868 _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2872 mmf_return_val_if_fail(name, -1);
2874 switch(conf_category)
2876 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2877 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2879 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2880 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2882 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2883 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2885 case CONFIGURE_CATEGORY_MAIN_MUX:
2886 fmt = _mmcamcorder_get_mux_format(handle, name);
2889 _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category);
2896 _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format)
2898 mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
2899 camera_conf* configure_info = NULL;
2901 int total_count = 0;
2903 mmf_return_val_if_fail(hcamcorder, 0);
2905 /*_mmcam_dbg_log("conf_category:%d", conf_category);*/
2907 configure_info = hcamcorder->conf_main;
2909 if (configure_info->info[conf_category]) {
2912 const char *name = NULL;
2913 int count = configure_info->info[conf_category]->count;
2914 conf_detail *info = configure_info->info[conf_category];
2916 /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/
2918 if (count <= 0 || !info) {
2922 arr = (int*) g_malloc0(count * sizeof(int));
2924 _mmcam_dbg_err("malloc failed : %d", count * sizeof(int));
2928 for (i = 0 ; i < count ; i++) {
2929 if (info->detail_info[i] == NULL) {
2933 name = ((type_element*)(info->detail_info[i]))->name;
2934 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2936 arr[total_count++] = fmt;
2939 /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/