4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 /*=======================================================================================
24 =======================================================================================*/
30 #include "mm_camcorder_internal.h"
31 #include "mm_camcorder_configure.h"
33 /*-----------------------------------------------------------------------
34 | MACRO DEFINITIONS: |
35 -----------------------------------------------------------------------*/
37 /*-----------------------------------------------------------------------
38 | GLOBAL VARIABLE DEFINITIONS |
39 -----------------------------------------------------------------------*/
41 /*-----------------------------------------------------------------------
42 | LOCAL VARIABLE DEFINITIONS |
43 -----------------------------------------------------------------------*/
44 #define DEFAULT_AUDIO_BUFFER_INTERVAL 50
45 #define DEFAULT_ENCODED_PREVIEW_BITRATE (1024*1024*4)
47 #define MMCAMCORDER_CONF_FILEPATH_LENGTH 128
48 #define MMCAMCORDER_BUFFER_LINE_MAX 256
50 char *get_new_string(char* src_string)
52 return g_strdup(src_string);
55 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info)
58 int info_table_size = sizeof(conf_info_table);
60 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
62 mmf_return_val_if_fail(hcamcorder && configure_info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
64 /* Videosrc element default value */
65 static type_element _videosrc_element_default = {
74 /* Audiosrc element default value */
75 static type_int ___audiosrc_default_channel = {"Channel", 1};
76 static type_int ___audiosrc_default_bitrate = {"BitRate", 8000};
77 static type_int ___audiosrc_default_depth = {"Depth", 16};
78 static type_int ___audiosrc_default_blocksize = {"BlockSize", 1280};
79 static type_int* __audiosrc_default_int_array[] = {
80 &___audiosrc_default_channel,
81 &___audiosrc_default_bitrate,
82 &___audiosrc_default_depth,
83 &___audiosrc_default_blocksize,
85 static type_string ___audiosrc_default_device = {"Device", "default"};
86 static type_string* __audiosrc_default_string_array[] = {
87 &___audiosrc_default_device,
89 static type_element _audiosrc_element_default = {
92 __audiosrc_default_int_array,
93 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
94 __audiosrc_default_string_array,
95 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
98 static type_element _audiomodemsrc_element_default = {
99 "AudiomodemsrcElement",
101 __audiosrc_default_int_array,
102 sizeof(__audiosrc_default_int_array) / sizeof(type_int*),
103 __audiosrc_default_string_array,
104 sizeof(__audiosrc_default_string_array) / sizeof(type_string*),
108 /* Videosink element default value */
109 static type_int ___videosink_default_display_id = {"display-id", 3};
110 static type_int ___videosink_default_x = {"x", 0};
111 static type_int ___videosink_default_y = {"y", 0};
112 static type_int ___videosink_default_width = {"width", 800};
113 static type_int ___videosink_default_height = {"height", 480};
114 static type_int ___videosink_default_rotation = {"rotation", 1};
115 static type_int* __videosink_default_int_array[] = {
116 &___videosink_default_display_id,
117 &___videosink_default_x,
118 &___videosink_default_y,
119 &___videosink_default_width,
120 &___videosink_default_height,
121 &___videosink_default_rotation,
123 static type_string* __videosink_default_string_array[] = {NULL};
124 static type_element _videosink_element_overlay_default = {
125 "VideosinkElementOverlay",
127 __videosink_default_int_array,
128 sizeof(__videosink_default_int_array) / sizeof(type_int*),
129 __videosink_default_string_array,
130 sizeof(__videosink_default_string_array) / sizeof(type_string*),
132 static type_element _videosink_element_evas_default = {
133 "VideosinkElementEvas",
135 __videosink_default_int_array,
136 sizeof(__videosink_default_int_array) / sizeof(type_int*),
137 __videosink_default_string_array,
138 sizeof(__videosink_default_string_array) / sizeof(type_string*),
140 static type_element _videosink_element_gl_default = {
141 "VideosinkElementGL",
143 __videosink_default_int_array,
144 sizeof(__videosink_default_int_array) / sizeof(type_int*),
145 __videosink_default_string_array,
146 sizeof(__videosink_default_string_array) / sizeof(type_string*),
148 static type_element _videosink_element_remote_default = {
149 "VideosinkElementRemote",
151 __videosink_default_int_array,
152 sizeof(__videosink_default_int_array) / sizeof(type_int*),
153 __videosink_default_string_array,
154 sizeof(__videosink_default_string_array) / sizeof(type_string*),
156 static type_element _videosink_element_null_default = {
157 "VideosinkElementNull",
159 __videosink_default_int_array,
160 sizeof(__videosink_default_int_array) / sizeof(type_int*),
161 __videosink_default_string_array,
162 sizeof(__videosink_default_string_array) / sizeof(type_string*),
165 /* Videoscale element default value */
166 static type_element _videoscale_element_default = {
175 /* Videoconvert element default value */
176 static type_element _videoconvert_element_default = {
177 "VideoconvertElement",
185 /* H.264 decoder element default value */
186 static type_element _videodecoder_element_h264_default = {
187 "VideodecoderElementH264",
195 /* MJPEG decoder element default value */
196 static type_element _videodecoder_element_mjpeg_default = {
197 "VideodecoderElementMJPEG",
205 /* VP8 decoder element default value */
206 static type_element _videodecoder_element_vp8_default = {
207 "VideodecoderElementVP8",
215 /* VP9 decoder element default value */
216 static type_element _videodecoder_element_vp9_default = {
217 "VideodecoderElementVP9",
225 /* Record sink element default value */
226 static type_element _recordsink_element_default = {
235 /* H263 element default value */
236 static type_element _h263_element_default = {
245 /* H264 element default value */
246 static type_element _h264_element_default = {
255 /* H26L element default value */
256 static type_element _h26l_element_default = {
265 /* MPEG4 element default value */
266 static type_element _mpeg4_element_default = {
275 /* MPEG1 element default value */
276 static type_element _mpeg1_element_default = {
285 /* THEORA element default value */
286 static type_element _theora_element_default = {
295 /* AMR element default value */
296 static type_element _amr_element_default = {
305 /* G723_1 element default value */
306 static type_element _g723_1_element_default = {
315 /* MP3 element default value */
316 static type_element _mp3_element_default = {
325 /* AAC element default value */
326 static type_element _aac_element_default = {
335 /* MMF element default value */
336 static type_element _mmf_element_default = {
345 /* ADPCM element default value */
346 static type_element _adpcm_element_default = {
348 "avenc_adpcm_ima_qt",
355 /* WAVE element default value */
356 static type_element _wave_element_default = {
365 /* VORBIS element default value */
366 static type_element _vorbis_element_default = {
375 /* MIDI element default value */
376 static type_element _midi_element_default = {
385 /* IMELODY element default value */
386 static type_element _imelody_element_default = {
395 /* JPEG element default value */
396 static type_element _jpeg_element_default = {
405 /* PNG element default value */
406 static type_element _png_element_default = {
415 /* BMP element default value */
416 static type_element _bmp_element_default = {
425 /* WBMP element default value */
426 static type_element _wbmp_element_default = {
435 /* TIFF element default value */
436 static type_element _tiff_element_default = {
445 /* PCX element default value */
446 static type_element _pcx_element_default = {
455 /* GIF element default value */
456 static type_element _gif_element_default = {
465 /* ICO element default value */
466 static type_element _ico_element_default = {
475 /* RAS element default value */
476 static type_element _ras_element_default = {
485 /* TGA element default value */
486 static type_element _tga_element_default = {
495 /* XBM element default value */
496 static type_element _xbm_element_default = {
505 /* XPM element default value */
506 static type_element _xpm_element_default = {
515 /* 3GP element default value */
516 static type_element _3gp_element_default = {
525 /* AMR mux element default value */
526 static type_element _amrmux_element_default = {
535 /* MP4 element default value */
536 static type_element _mp4_element_default = {
545 /* AAC mux element default value */
546 static type_element _aacmux_element_default = {
555 /* MP3 mux element default value */
556 static type_element _mp3mux_element_default = {
565 /* OGG element default value */
566 static type_element _ogg_element_default = {
575 /* WAV element default value */
576 static type_element _wav_element_default = {
585 /* AVI element default value */
586 static type_element _avi_element_default = {
595 /* WMA element default value */
596 static type_element _wma_element_default = {
605 /* WMV element default value */
606 static type_element _wmv_element_default = {
615 /* MID element default value */
616 static type_element _mid_element_default = {
625 /* MMF mux element default value */
626 static type_element _mmfmux_element_default = {
635 /* MATROSKA element default value */
636 static type_element _matroska_element_default = {
645 /* M2TS element default value */
646 static type_element _m2ts_element_default = {
655 /* [General] matching table */
656 static conf_info_table conf_main_general_table[] = {
657 { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
658 { "PlatformPrivilegeCamera", CONFIGURE_VALUE_STRING, {NULL} },
659 { "LogLevel", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_LOG_LEVEL_INFO} },
660 { "NetworkCameraHALName", CONFIGURE_VALUE_STRING, {NULL} },
663 /* [VideoInput] matching table */
664 static conf_info_table conf_main_video_input_table[] = {
665 { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
666 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
667 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
668 { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
669 { "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
670 { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
671 { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
672 { "MeasurePreviewFPS", CONFIGURE_VALUE_INT, {.value_int = 0} },
673 { "DefaultEncodedPreviewBitrate", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_ENCODED_PREVIEW_BITRATE} },
676 /* [AudioInput] matching table */
677 static conf_info_table conf_main_audio_input_table[] = {
678 { "AudioDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
679 { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
680 { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
681 { "AudioBufferInterval", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_AUDIO_BUFFER_INTERVAL} },
684 /* [VideoOutput] matching table */
685 static conf_info_table conf_main_video_output_table[] = {
686 { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
687 { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
688 { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
689 { "VideosinkElementOverlay", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_overlay_default} },
690 { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
691 { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
692 { "VideosinkElementRemote", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_remote_default} },
693 { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
694 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
695 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
696 { "UseVideoconvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
697 { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
698 { "VideodecoderElementH264", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_h264_default} },
699 { "VideodecoderElementMJPEG",CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_mjpeg_default} },
700 { "VideodecoderElementVP8", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_vp8_default} },
701 { "VideodecoderElementVP9", CONFIGURE_VALUE_ELEMENT, {&_videodecoder_element_vp9_default} },
702 { "RecreateDecoder", CONFIGURE_VALUE_INT, {.value_int = 0} }
705 /* [Capture] matching table */
706 static conf_info_table conf_main_capture_table[] = {
707 { "CaptureMode", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAPTURE_MODE_ENCODEBIN} },
708 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
709 { "PlayCaptureSound", CONFIGURE_VALUE_INT, {.value_int = 1} },
712 /* [Record] matching table */
713 static conf_info_table conf_main_record_table[] = {
714 { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
715 { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {.value_int = 1} },
716 { "VideoProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
717 { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
718 { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
719 { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
720 { "AudioProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
721 { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
722 { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
723 { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
724 { "ImageProfile", CONFIGURE_VALUE_INT, {.value_int = 0} },
725 { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {.value_int = 0} },
726 { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {.value_int = 0} },
727 { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {.value_int = 0} },
728 { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
729 { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {.value_int = 0} },
730 { "DropVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
731 { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {.value_int = 0} },
732 { "SupportDualStream", CONFIGURE_VALUE_INT, {.value_int = 0} },
733 { "UseVideoscale", CONFIGURE_VALUE_INT, {.value_int = 0} },
734 { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} }
737 /* [VideoEncoder] matching table */
738 static conf_info_table conf_main_video_encoder_table[] = {
739 { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
740 { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
741 { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
742 { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
743 { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
744 { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
747 /* [AudioEncoder] matching table */
748 static conf_info_table conf_main_audio_encoder_table[] = {
749 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
750 { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
751 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
752 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
753 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
754 { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
755 { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
756 { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
757 { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
758 { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
761 /* [ImageEncoder] matching table */
762 static conf_info_table conf_main_image_encoder_table[] = {
763 { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
764 { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
765 { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
766 { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
767 { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
768 { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
769 { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
770 { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
771 { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
772 { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
773 { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
774 { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
777 /* [Mux] matching table */
778 static conf_info_table conf_main_mux_table[] = {
779 { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
780 { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
781 { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
782 { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
783 { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
784 { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
785 { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
786 { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
787 { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
788 { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
789 { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
790 { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
791 { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
792 { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
800 /* [Camera] matching table */
801 static conf_info_table conf_ctrl_camera_table[] = {
802 { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
803 { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
804 { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
805 { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
806 { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
807 { "FPS0", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
808 { "FPS1", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
809 { "FPS2", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
810 { "FPS3", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
811 { "FPS4", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
812 { "FPS5", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
813 { "FPS6", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
814 { "FPS7", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
815 { "FPS8", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
816 { "FPS9", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
817 { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
818 { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
819 { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {.value_int = 3} },
820 { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_YUYV} },
821 { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {.value_int = MM_PIXEL_FORMAT_NV12} },
822 { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
823 { "FacingDirection", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
824 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
825 { "SupportExtraPreview", CONFIGURE_VALUE_INT, {.value_int = 0} },
826 { "ExtraPreviewMode", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_EXTRA_PREVIEW_MODE_CAMERA_CONTROL} },
827 { "AltVideosrcElement", CONFIGURE_VALUE_ELEMENT, {NULL} }, /* The alternative of videosrc element, it will be used instead of "VideosrcElement" if exists. */
828 { "AltUseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = -1} }, /* The alternative of "UseZeroCopyFormat", it will be used if it's not default(-1) value. */
829 { "VideoFilterElement", CONFIGURE_VALUE_ELEMENT, {NULL} }, /* The video filter element which is placed between videosrc and videosink elements. */
830 { "VideoFilterCropX", CONFIGURE_VALUE_INT, {.value_int = 0} }, /* The VideoFilterElement is existed and these values are valid, they will be set to "crop" property. */
831 { "VideoFilterCropY", CONFIGURE_VALUE_INT, {.value_int = 0} },
832 { "VideoFilterCropW", CONFIGURE_VALUE_INT, {.value_int = 0} },
833 { "VideoFilterCropH", CONFIGURE_VALUE_INT, {.value_int = 0} }
836 /* [Strobe] matching table */
837 static conf_info_table conf_ctrl_strobe_table[] = {
838 { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
839 { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
840 { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
841 { "StrobeBrightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
844 /* [Effect] matching table */
845 static conf_info_table conf_ctrl_effect_table[] = {
846 { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
847 { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {.value_int = 2} },
848 { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
849 { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
850 { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
851 { "Hue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
852 { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
853 { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
854 { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
855 { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
856 { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
857 { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
858 { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
861 /* [Photograph] matching table */
862 static conf_info_table conf_ctrl_photograph_table[] = {
863 { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
864 { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
865 { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
866 { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
867 { "FocusLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
868 { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
869 { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
870 { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
871 { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
872 { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
873 { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
874 { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
875 { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
876 { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
877 { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
878 { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
879 { "PtzType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
880 { "PanMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
881 { "PanElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
882 { "TiltMecha", CONFIGURE_VALUE_INT_RANGE, {NULL} },
883 { "TiltElec", CONFIGURE_VALUE_INT_RANGE, {NULL} },
886 /* [Capture] matching table */
887 static conf_info_table conf_ctrl_capture_table[] = {
888 { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
889 { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
890 { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
891 { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {.value_int = 1} },
892 { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
893 { "SupportZSL", CONFIGURE_VALUE_INT, {.value_int = FALSE} },
894 { "FrameStabilityCount", CONFIGURE_VALUE_INT, {.value_int = 0} },
897 /* [Detect] matching table */
898 static conf_info_table conf_ctrl_detect_table[] = {
899 { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
900 { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
901 { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
902 { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
905 MMCAM_LOG_INFO("Entered...");
907 if (type == CONFIGURE_TYPE_MAIN) {
908 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
909 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
910 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
911 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
912 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
913 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
914 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
915 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
916 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
917 hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
919 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof(conf_main_general_table) / info_table_size;
920 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof(conf_main_video_input_table) / info_table_size;
921 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof(conf_main_audio_input_table) / info_table_size;
922 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof(conf_main_video_output_table) / info_table_size;
923 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof(conf_main_capture_table) / info_table_size;
924 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof(conf_main_record_table) / info_table_size;
925 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof(conf_main_video_encoder_table) / info_table_size;
926 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof(conf_main_audio_encoder_table) / info_table_size;
927 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof(conf_main_image_encoder_table) / info_table_size;
928 hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof(conf_main_mux_table) / info_table_size;
930 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
932 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
933 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
934 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
935 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
936 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
937 hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
939 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof(conf_ctrl_camera_table) / info_table_size;
940 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof(conf_ctrl_strobe_table) / info_table_size;
941 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof(conf_ctrl_effect_table) / info_table_size;
942 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof(conf_ctrl_photograph_table) / info_table_size;
943 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof(conf_ctrl_capture_table) / info_table_size;
944 hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof(conf_ctrl_detect_table) / info_table_size;
946 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
949 configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num);
951 MMCAM_LOG_INFO("Done.");
953 return MM_ERROR_NONE;
957 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info)
959 int ret = MM_ERROR_NONE;
961 char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',};
963 MMCAM_LOG_INFO("Opening...[%s]", ConfFile);
965 mmf_return_val_if_fail(ConfFile, FALSE);
967 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile);
968 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
970 fp = fopen(conf_path, "r");
972 MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path);
974 snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile);
975 MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path);
976 fp = fopen(conf_path, "r");
978 MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno);
979 return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
983 ret = _mmcamcorder_conf_parse_info(handle, type, fp, configure_info);
987 MMCAM_LOG_INFO("Leave [0x%x]", ret);
993 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera_conf **configure_info)
995 const unsigned int BUFFER_NUM_DETAILS = 256;
996 const unsigned int BUFFER_NUM_TOKEN = 20;
997 size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
998 const char* delimiters = " |=,\t\r\n";
1001 int ret = MM_ERROR_NONE;
1003 int count_main_category = 0;
1004 int count_details = 0;
1005 int length_read = 0;
1006 int count_token = 0;
1009 char *buffer_string = NULL;
1010 char *buffer_details[BUFFER_NUM_DETAILS];
1011 char *buffer_token[BUFFER_NUM_TOKEN];
1013 char *category_name = NULL;
1014 char *detail_string = NULL;
1015 char *user_ptr = NULL;
1017 camera_conf *new_conf = NULL;
1021 mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT);
1023 *configure_info = NULL;
1025 new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf));
1026 buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size);
1028 new_conf->type = type;
1030 ret = _mmcamcorder_conf_init(handle, type, new_conf);
1031 if (ret != MM_ERROR_NONE) {
1032 MMCAM_LOG_ERROR("conf init failed 0x%x", ret);
1034 g_free(buffer_string);
1038 *configure_info = new_conf;
1041 count_main_category = 0;
1044 if (read_main == 0) {
1045 buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX;
1046 length_read = getline(&buffer_string, &buffer_line_size, fp);
1047 if (length_read < 1) {
1048 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1052 buffer_string[--length_read] = '\0'; /* remove new line character */
1054 MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string);
1057 token = strtok_r(buffer_string, delimiters, &user_ptr);
1059 if ((token) && (token[0] == ';') && (length_read > -1)) {
1060 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1065 MMCAM_LOG_VERBOSE("token : \"%s\"", token);
1066 buffer_token[count_token] = token;
1068 token = strtok_r(NULL, delimiters, &user_ptr);
1071 if (count_token == 0)
1077 if (*buffer_token[0] == ';') {
1079 MMCAM_LOG_VERBOSE( "Comment - Nothing to do" );
1080 } else if (*buffer_token[0] == '[') {
1082 category_name = get_new_string(buffer_token[0]);
1083 if (category_name == NULL) {
1084 MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]);
1088 count_main_category++;
1092 length_read = getline(&buffer_string, &buffer_line_size, fp);
1093 if (length_read < 1) {
1094 MMCAM_LOG_DEBUG("skip this case - length read[%d]", length_read);
1098 buffer_string[--length_read] = '\0'; /* remove new line character */
1100 MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read);
1102 detail_string = get_new_string(buffer_string);
1104 token = strtok_r(buffer_string, delimiters, &user_ptr);
1106 if (token && token[0] != ';' && length_read > -1) {
1107 MMCAM_LOG_VERBOSE("token : [%s]", token);
1108 if (token[0] == '[') {
1110 buffer_token[0] = token;
1111 SAFE_G_FREE(detail_string);
1115 buffer_details[count_details++] = detail_string;
1117 SAFE_G_FREE(detail_string);
1121 MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);
1123 if (count_details == 0) {
1124 MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name);
1125 SAFE_G_FREE(category_name);
1132 if (type == CONFIGURE_TYPE_MAIN) {
1133 if (!strcmp("[General]", category_name))
1134 category = CONFIGURE_CATEGORY_MAIN_GENERAL;
1135 else if (!strcmp("[VideoInput]", category_name))
1136 category = CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT;
1137 else if (!strcmp("[AudioInput]", category_name))
1138 category = CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT;
1139 else if (!strcmp("[VideoOutput]", category_name))
1140 category = CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT;
1141 else if (!strcmp("[Capture]", category_name))
1142 category = CONFIGURE_CATEGORY_MAIN_CAPTURE;
1143 else if (!strcmp("[Record]", category_name))
1144 category = CONFIGURE_CATEGORY_MAIN_RECORD;
1145 else if (!strcmp("[VideoEncoder]", category_name))
1146 category = CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER;
1147 else if (!strcmp("[AudioEncoder]", category_name))
1148 category = CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER;
1149 else if (!strcmp("[ImageEncoder]", category_name))
1150 category = CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER;
1151 else if (!strcmp("[Mux]", category_name))
1152 category = CONFIGURE_CATEGORY_MAIN_MUX;
1154 if (!strcmp("[Camera]", category_name))
1155 category = CONFIGURE_CATEGORY_CTRL_CAMERA;
1156 else if (!strcmp("[Strobe]", category_name))
1157 category = CONFIGURE_CATEGORY_CTRL_STROBE;
1158 else if (!strcmp("[Effect]", category_name))
1159 category = CONFIGURE_CATEGORY_CTRL_EFFECT;
1160 else if (!strcmp("[Photograph]", category_name))
1161 category = CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH;
1162 else if (!strcmp("[Capture]", category_name))
1163 category = CONFIGURE_CATEGORY_CTRL_CAPTURE;
1164 else if (!strcmp("[Detect]", category_name))
1165 category = CONFIGURE_CATEGORY_CTRL_DETECT;
1168 if (category != -1) {
1169 _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]),
1170 buffer_details, category, count_details);
1172 MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type);
1176 for (i = 0 ; i < count_details ; i++)
1177 SAFE_G_FREE(buffer_details[i]);
1180 SAFE_G_FREE(category_name);
1183 /* (*configure_info) = new_conf; */
1185 SAFE_G_FREE(buffer_string);
1187 /*MMCAM_LOG_INFO("Done.");*/
1189 return MM_ERROR_NONE;
1193 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info)
1198 int type = CONFIGURE_VALUE_INT;
1200 int category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1201 camera_conf *temp_conf = (*configure_info);
1203 type_int2 *temp_int = NULL;
1204 type_int_range *temp_int_range = NULL;
1205 type_int_array *temp_int_array = NULL;
1206 type_int_pair_array *temp_int_pair_array = NULL;
1207 type_string2 *temp_string = NULL;
1208 type_string_array *temp_string_array = NULL;
1209 type_element2 *temp_element = NULL;
1211 MMCAM_LOG_INFO("Entered...");
1213 mmf_return_if_fail(temp_conf);
1215 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
1216 category_num = CONFIGURE_CATEGORY_MAIN_NUM;
1218 category_num = CONFIGURE_CATEGORY_CTRL_NUM;
1220 for (i = 0 ; i < category_num ; i++) {
1221 if (temp_conf->info[i]) {
1222 for (j = 0 ; j < temp_conf->info[i]->count ; j++) {
1223 if (temp_conf->info[i]->detail_info[j] == NULL)
1226 if (_mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type)) {
1228 case CONFIGURE_VALUE_INT:
1229 temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
1230 SAFE_G_FREE(temp_int->name);
1232 case CONFIGURE_VALUE_INT_RANGE:
1233 temp_int_range = (type_int_range*)(temp_conf->info[i]->detail_info[j]);
1234 SAFE_G_FREE(temp_int_range->name);
1236 case CONFIGURE_VALUE_INT_ARRAY:
1237 temp_int_array = (type_int_array*)(temp_conf->info[i]->detail_info[j]);
1238 SAFE_G_FREE(temp_int_array->name);
1239 SAFE_G_FREE(temp_int_array->value);
1241 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1242 temp_int_pair_array = (type_int_pair_array*)(temp_conf->info[i]->detail_info[j]);
1243 SAFE_G_FREE(temp_int_pair_array->name);
1244 SAFE_G_FREE(temp_int_pair_array->value[0]);
1245 SAFE_G_FREE(temp_int_pair_array->value[1]);
1247 case CONFIGURE_VALUE_STRING:
1248 temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
1249 SAFE_G_FREE(temp_string->name);
1250 SAFE_G_FREE(temp_string->value);
1252 case CONFIGURE_VALUE_STRING_ARRAY:
1253 temp_string_array = (type_string_array*)(temp_conf->info[i]->detail_info[j]);
1254 SAFE_G_FREE(temp_string_array->name);
1255 if (temp_string_array->value) {
1256 count = temp_string_array->count;
1258 for (k = 0 ; k < count ; k++)
1259 SAFE_G_FREE(temp_string_array->value[k]);
1261 SAFE_G_FREE(temp_string_array->value);
1263 SAFE_G_FREE(temp_string_array->default_value);
1265 case CONFIGURE_VALUE_ELEMENT:
1266 temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
1267 SAFE_G_FREE(temp_element->name);
1268 SAFE_G_FREE(temp_element->element_name);
1270 if (temp_element->value_int) {
1271 count = temp_element->count_int;
1272 for (k = 0 ; k < count ; k++) {
1273 SAFE_G_FREE(temp_element->value_int[k]->name);
1274 SAFE_G_FREE(temp_element->value_int[k]);
1276 SAFE_G_FREE(temp_element->value_int);
1279 if (temp_element->value_string) {
1280 count = temp_element->count_string;
1281 for (k = 0 ; k < count ; k++) {
1282 SAFE_G_FREE(temp_element->value_string[k]->name);
1283 SAFE_G_FREE(temp_element->value_string[k]->value);
1284 SAFE_G_FREE(temp_element->value_string[k]);
1286 SAFE_G_FREE(temp_element->value_string);
1290 MMCAM_LOG_WARNING("unknown type %d", type);
1295 SAFE_G_FREE(temp_conf->info[i]->detail_info[j]);
1298 SAFE_G_FREE(temp_conf->info[i]->detail_info);
1300 SAFE_G_FREE(temp_conf->info[i]);
1301 temp_conf->info[i] = NULL;
1305 SAFE_G_FREE((*configure_info)->info);
1306 SAFE_G_FREE((*configure_info));
1308 MMCAM_LOG_INFO("Done.");
1311 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
1314 int count_value = 0;
1316 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1318 if (hcamcorder == NULL) {
1319 MMCAM_LOG_ERROR("handle is NULL");
1323 /*MMCAM_LOG_INFO("Entered...");*/
1325 mmf_return_val_if_fail(name, FALSE);
1327 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1328 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
1332 /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/
1334 if (type == CONFIGURE_TYPE_MAIN) {
1335 for (i = 0 ; i < count_value ; i++) {
1336 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1337 *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
1338 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1343 for (i = 0 ; i < count_value ; i++) {
1344 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1345 *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
1346 /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/
1356 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details)
1358 const int BUFFER_NUM_TOKEN = 256;
1365 char *buffer_token[BUFFER_NUM_TOKEN];
1366 char *user_ptr = NULL;
1368 const char *delimiters = " |=,\t\r\n";
1369 const char *delimiters_sub = " |\t\r\n";
1370 const char *delimiters_3rd = "|\r\n";
1372 mmf_return_val_if_fail(info && buffer_details, FALSE);
1374 (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail));
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_LOG_VERBOSE("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_LOG_WARNING("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_LOG_WARNING("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_LOG_VERBOSE("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_LOG_WARNING("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_LOG_VERBOSE("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_LOG_VERBOSE("token : [%s]", buffer_token[count_token]);
1434 if (count_token < 2) {
1435 (*info)->detail_info[i] = NULL;
1436 MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]);
1441 switch (value_type) {
1442 case CONFIGURE_VALUE_INT:
1446 new_int = (type_int2*)g_malloc0(sizeof(type_int2));
1447 new_int->name = get_new_string(buffer_token[0]);
1448 new_int->value = atoi(buffer_token[1]);
1449 (*info)->detail_info[i] = (void*)new_int;
1450 MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value);
1453 case CONFIGURE_VALUE_INT_RANGE:
1455 type_int_range* new_int_range;
1457 new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range));
1458 new_int_range->name = get_new_string(buffer_token[0]);
1459 new_int_range->min = atoi(buffer_token[1]);
1460 new_int_range->max = atoi(buffer_token[2]);
1461 new_int_range->default_value = atoi(buffer_token[3]);
1462 (*info)->detail_info[i] = (void*)new_int_range;
1464 MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
1465 new_int_range->name,
1468 new_int_range->default_value);
1471 case CONFIGURE_VALUE_INT_ARRAY:
1473 int count_value = count_token - 2;
1474 type_int_array* new_int_array;
1476 new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array));
1477 new_int_array->name = get_new_string(buffer_token[0]);
1478 new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value);
1479 new_int_array->count = count_value;
1481 MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name);
1482 for (j = 0 ; j < count_value ; j++) {
1483 new_int_array->value[j] = atoi(buffer_token[j+1]);
1484 MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]);
1487 new_int_array->default_value = atoi(buffer_token[count_token-1]);
1488 MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value);
1490 (*info)->detail_info[i] = (void*)new_int_array;
1493 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
1495 int count_value = (count_token - 3) >> 1;
1496 type_int_pair_array* new_int_pair_array;
1498 new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array));
1499 new_int_pair_array->name = get_new_string(buffer_token[0]);
1500 new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value));
1501 new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value));
1502 new_int_pair_array->count = count_value;
1504 MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);
1505 for (j = 0 ; j < count_value ; j++) {
1506 new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]);
1507 new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]);
1509 MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j,
1510 new_int_pair_array->value[0][j],
1511 new_int_pair_array->value[1][j]);
1514 new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]);
1515 new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]);
1517 MMCAM_LOG_VERBOSE(" default value[%d,%d]",
1518 new_int_pair_array->default_value[0],
1519 new_int_pair_array->default_value[1]);
1521 (*info)->detail_info[i] = (void*)new_int_pair_array;
1524 case CONFIGURE_VALUE_STRING:
1526 type_string2* new_string;
1528 new_string = (type_string2*)g_malloc0(sizeof(type_string2));
1529 new_string->name = get_new_string(buffer_token[0]);
1530 new_string->value = get_new_string(buffer_token[1]);
1531 (*info)->detail_info[i] = (void*)new_string;
1533 MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value);
1536 case CONFIGURE_VALUE_STRING_ARRAY:
1538 int count_value = count_token - 2;
1539 type_string_array* new_string_array;
1541 new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array));
1542 new_string_array->name = get_new_string(buffer_token[0]);
1543 new_string_array->count = count_value;
1544 new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value);
1546 MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name);
1548 for (j = 0 ; j < count_value ; j++) {
1549 new_string_array->value[j] = get_new_string(buffer_token[j+1]);
1550 MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]);
1553 new_string_array->default_value = get_new_string(buffer_token[count_token-1]);
1555 MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value);
1557 (*info)->detail_info[i] = (void*)new_string_array;
1560 case CONFIGURE_VALUE_ELEMENT:
1562 type_element2* new_element;
1565 new_element = (type_element2*)g_malloc0(sizeof(type_element2));
1566 new_element->name = get_new_string(buffer_token[0]);
1567 new_element->element_name = get_new_string(buffer_token[1]);
1568 new_element->count_int = atoi(buffer_token[2]);
1569 new_element->value_int = NULL;
1570 new_element->count_string = atoi(buffer_token[3]);
1571 new_element->value_string = NULL;
1573 MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]",
1574 new_element->name, new_element->element_name, new_element->count_int, new_element->count_string);
1576 /* add int values */
1577 if (new_element->count_int > 0 && new_element->count_int <= 30) {
1578 new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int));
1579 for ( ; j < new_element->count_int ; j++) {
1580 new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2));
1581 new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]);
1582 new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]);
1584 MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]",
1585 j, new_element->value_int[j]->name, new_element->value_int[j]->value);
1589 /* add string values */
1590 if (new_element->count_string > 0 && new_element->count_string <= 30 &&
1591 new_element->count_int >= 0 && new_element->count_int <= 30) {
1592 new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string));
1593 for ( ; j < new_element->count_string + new_element->count_int ; j++) {
1594 new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2));
1595 new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]);
1596 new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]);
1598 MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]",
1599 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);
1603 (*info)->detail_info[i] = (void*)new_element;
1615 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
1620 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1622 mmf_return_val_if_fail(configure_info, FALSE);
1623 mmf_return_val_if_fail(name, FALSE);
1625 if (configure_info->info[category]) {
1626 count = configure_info->info[category]->count;
1627 info = configure_info->info[category];
1629 for (i = 0 ; i < count ; i++) {
1630 if (info->detail_info[i] == NULL)
1633 if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) {
1634 *value = ((type_int*)(info->detail_info[i]))->value;
1635 MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value);
1641 if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) {
1642 MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value);
1646 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1652 _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, const char* name, type_int_range** value)
1657 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1659 mmf_return_val_if_fail(configure_info, FALSE);
1660 mmf_return_val_if_fail(name, FALSE);
1662 if (configure_info->info[category]) {
1663 count = configure_info->info[category]->count;
1664 info = configure_info->info[category];
1666 for (i = 0 ; i < count ; i++) {
1667 if (info->detail_info[i] == NULL)
1670 if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) {
1671 *value = (type_int_range*)(info->detail_info[i]);
1672 MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]",
1673 name, (*value)->min, (*value)->max, (*value)->default_value);
1681 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1686 int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value)
1691 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1693 mmf_return_val_if_fail(configure_info, FALSE);
1694 mmf_return_val_if_fail(name, FALSE);
1696 if (configure_info->info[category]) {
1697 count = configure_info->info[category]->count;
1698 info = configure_info->info[category];
1700 for (i = 0 ; i < count ; i++) {
1701 if (info->detail_info[i] == NULL)
1704 if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) {
1705 *value = (type_int_array*)(info->detail_info[i]);
1706 MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]",
1707 name, (*value)->value, (*value)->count, (*value)->default_value);
1715 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1721 _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int category, const char* name, type_int_pair_array** value)
1726 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1728 mmf_return_val_if_fail(configure_info, FALSE);
1729 mmf_return_val_if_fail(name, FALSE);
1731 if (configure_info->info[category]) {
1732 count = configure_info->info[category]->count;
1733 info = configure_info->info[category];
1735 for (i = 0 ; i < count ; i++) {
1736 if (info->detail_info[i] == NULL)
1739 if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) {
1740 *value = (type_int_pair_array*)(info->detail_info[i]);
1741 MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]",
1742 name, (*value)->value[0], (*value)->value[1], (*value)->count,
1743 (*value)->default_value[0], (*value)->default_value[1]);
1751 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1756 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
1761 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1763 mmf_return_val_if_fail(configure_info, FALSE);
1764 mmf_return_val_if_fail(name, FALSE);
1766 if (configure_info->info[category]) {
1767 count = configure_info->info[category]->count;
1768 info = configure_info->info[category];
1770 for (i = 0 ; i < count ; i++) {
1771 if (info->detail_info[i] == NULL)
1774 if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) {
1775 *value = ((type_string*)(info->detail_info[i]))->value;
1776 MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL");
1782 if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) {
1783 MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL");
1787 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1792 int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value)
1797 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1799 mmf_return_val_if_fail(configure_info, FALSE);
1800 mmf_return_val_if_fail(name, FALSE);
1802 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++) {
1807 if (info->detail_info[i] == NULL)
1810 if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) {
1811 *value = (type_string_array*)(info->detail_info[i]);
1812 MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]",
1813 name, (*value)->value, (*value)->count, (*value)->default_value);
1821 MMCAM_LOG_DEBUG("Failed to get [%s]", name);
1826 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
1831 MMCAM_LOG_VERBOSE("category[%d], name[%s]", category, name);
1833 mmf_return_val_if_fail(configure_info, FALSE);
1834 mmf_return_val_if_fail(name, FALSE);
1836 if (configure_info->info[category]) {
1837 count = configure_info->info[category]->count;
1838 info = configure_info->info[category];
1840 for (i = 0 ; i < count ; i++) {
1841 if (info->detail_info[i] == NULL)
1844 if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) {
1845 *element = (type_element*)(info->detail_info[i]);
1846 MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element);
1852 if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) {
1853 MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element);
1857 MMCAM_LOG_ERROR("Failed to get [%s]", name);
1862 int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value)
1864 mmf_return_val_if_fail(element, FALSE);
1866 *value = element->element_name;
1868 MMCAM_LOG_DEBUG("Get element name : [%s]", *value);
1873 int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value)
1877 mmf_return_val_if_fail(element, FALSE);
1878 mmf_return_val_if_fail(name, FALSE);
1880 for (i = 0 ; i < element->count_int ; i++) {
1881 if (!strcmp(element->value_int[i]->name, name)) {
1882 *value = element->value_int[i]->value;
1883 MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value);
1888 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1889 element->name, name, element->count_int);
1894 int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value)
1898 mmf_return_val_if_fail(element, FALSE);
1899 mmf_return_val_if_fail(name, FALSE);
1901 for (i = 0 ; i < element->count_string ; i++) {
1902 if (!strcmp(element->value_string[i]->name, name)) {
1903 *value = element->value_string[i]->value;
1904 MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value);
1909 MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]",
1910 element->name, name, element->count_string);
1915 int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element)
1919 mmf_return_val_if_fail(gst, FALSE);
1920 mmf_return_val_if_fail(element, FALSE);
1922 if (element->count_int == 0) {
1923 MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name );
1925 if (element->value_int == NULL) {
1926 MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int);
1930 for (i = 0 ; i < element->count_int ; i++) {
1931 MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value);
1933 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [i:%d]",
1934 element->element_name,
1935 element->value_int[i]->name,
1936 element->value_int[i]->value);
1940 if (element->count_string == 0) {
1941 MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name);
1943 if (element->value_string == NULL) {
1944 MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string);
1948 for (i = 0 ; i < element->count_string ; i++) {
1949 MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value);
1951 MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> [s:%s]",
1952 element->element_name,
1953 element->value_string[i]->name,
1954 element->value_string[i]->value);
1961 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value)
1964 int count_value = 0;
1966 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1968 if (hcamcorder == NULL) {
1969 MMCAM_LOG_ERROR("handle is NULL");
1973 mmf_return_val_if_fail(name, FALSE);
1975 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
1976 MMCAM_LOG_WARNING("No matched category. categoty[%d]", category);
1980 if (type == CONFIGURE_TYPE_MAIN) {
1981 for (i = 0 ; i < count_value ; i++) {
1982 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
1983 *value = hcamcorder->conf_main_info_table[category][i].value_int;
1988 for (i = 0 ; i < count_value ; i++) {
1989 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
1990 *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
1996 MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name);
2001 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
2004 int count_value = 0;
2006 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2008 if (hcamcorder == NULL) {
2009 MMCAM_LOG_ERROR("handle is NULL");
2013 mmf_return_val_if_fail(name, FALSE);
2015 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2016 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
2020 if (type == CONFIGURE_TYPE_MAIN) {
2021 for (i = 0 ; i < count_value ; i++) {
2022 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2023 *value = hcamcorder->conf_main_info_table[category][i].value_string;
2028 for (i = 0 ; i < count_value ; i++) {
2029 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2030 *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
2036 MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name);
2041 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
2044 int count_value = 0;
2046 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2048 if (hcamcorder == NULL) {
2049 MMCAM_LOG_ERROR("handle is NULL");
2053 mmf_return_val_if_fail(name, FALSE);
2055 if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) {
2056 MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category);
2060 if (type == CONFIGURE_TYPE_MAIN) {
2061 for (i = 0 ; i < count_value ; i++) {
2062 if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) {
2063 *element = hcamcorder->conf_main_info_table[category][i].value_element;
2068 for (i = 0 ; i < count_value ; i++) {
2069 if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) {
2070 *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
2076 MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name);
2081 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
2083 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2085 if (hcamcorder == NULL) {
2086 MMCAM_LOG_ERROR("handle is NULL");
2090 if (type == CONFIGURE_TYPE_MAIN) {
2091 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE);
2092 *size = (int)hcamcorder->conf_main_category_size[category];
2094 mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE);
2095 *size = (int)hcamcorder->conf_ctrl_category_size[category];
2101 void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, camera_conf *conf, int category,
2102 const char *name, type_element **element, const char **element_name)
2104 type_element *_element = NULL;
2105 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2108 MMCAM_LOG_ERROR("NULL handle");
2112 if (!_mmcamcorder_conf_get_element(handle, conf,
2113 category, name, &_element)) {
2114 MMCAM_LOG_WARNING("get [%s] failed", name);
2119 *element = _element;
2122 _mmcamcorder_conf_get_value_element_name(_element, element_name);
2123 MMCAM_LOG_INFO("[%s] -> [%s]", name, *element_name);
2127 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info)
2129 int i, j, k, type, category_type;
2132 type_int_range *temp_int_range;
2133 type_int_array *temp_int_array;
2134 type_int_pair_array *temp_int_pair_array;
2135 type_string *temp_string;
2136 type_element *temp_element;
2138 g_print("[ConfigureInfoPrint] : Entered.\n");
2140 mmf_return_if_fail(*configure_info);
2142 if ((*configure_info)->type == CONFIGURE_TYPE_MAIN)
2143 category_type = CONFIGURE_CATEGORY_MAIN_NUM;
2145 category_type = CONFIGURE_CATEGORY_CTRL_NUM;
2147 for (i = 0 ; i < category_type ; i++) {
2149 if ((*configure_info)->info[i]) {
2150 g_print("[ConfigureInfo] : Category [%d]\n", i);
2152 for (j = 0 ; j < (*configure_info)->info[i]->count ; j++) {
2154 if (_mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type)) {
2156 case CONFIGURE_VALUE_INT:
2157 temp_int = (type_int*)((*configure_info)->info[i]->detail_info[j]);
2158 g_print("[ConfigureInfo] : INT - Name[%s],Value [%d]\n", temp_int->name, temp_int->value);
2160 case CONFIGURE_VALUE_INT_RANGE:
2161 temp_int_range = (type_int_range*)((*configure_info)->info[i]->detail_info[j]);
2162 g_print("[ConfigureInfo] : INT_RANGE - Name[%s],Value [%d]~[%d], default [%d]\n",
2163 temp_int_range->name, temp_int_range->min, temp_int_range->max, temp_int_range->default_value);
2165 case CONFIGURE_VALUE_INT_ARRAY:
2166 temp_int_array = (type_int_array*)((*configure_info)->info[i]->detail_info[j]);
2167 g_print("[ConfigureInfo] : INT_ARRAY - Name[%s], default [%d]\n - ",
2168 temp_int_array->name, temp_int_array->default_value);
2170 for (k = 0 ; k < temp_int_array->count ; k++)
2171 g_print("[%d] ", temp_int_array->value[k]);
2175 case CONFIGURE_VALUE_INT_PAIR_ARRAY:
2176 temp_int_pair_array = (type_int_pair_array*)((*configure_info)->info[i]->detail_info[j]);
2177 g_print("[ConfigureInfo] : INT_PAIR_ARRAY - Name[%s], default [%d][%d]\n - ",
2178 temp_int_pair_array->name, temp_int_pair_array->default_value[0], temp_int_pair_array->default_value[0]);
2180 for (k = 0 ; k < temp_int_pair_array->count ; k++)
2181 g_print("[%d,%d] ", temp_int_pair_array->value[0][k], temp_int_pair_array->value[1][k]);
2185 case CONFIGURE_VALUE_STRING:
2186 temp_string = (type_string*)((*configure_info)->info[i]->detail_info[j]);
2187 g_print("[ConfigureInfo] : STRING - Name[%s],Value[%s]\n", temp_string->name, temp_string->value);
2189 case CONFIGURE_VALUE_ELEMENT:
2190 temp_element = (type_element*)((*configure_info)->info[i]->detail_info[j]);
2191 g_print("[ConfigureInfo] : Element - Name[%s],Element_Name[%s]\n", temp_element->name, temp_element->element_name);
2193 for (k = 0 ; k < temp_element->count_int ; k++)
2194 g_print(" - INT[%d] Name[%s],Value[%d]\n", k, temp_element->value_int[k]->name, temp_element->value_int[k]->value);
2196 for (k = 0 ; k < temp_element->count_string ; k++)
2197 g_print(" - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value);
2201 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);
2205 g_print("[ConfigureInfo] : Failed to get value type.");
2211 g_print("[ConfigureInfoPrint] : Done.\n");
2215 static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle)
2217 type_element *telement = NULL;
2218 const char *codec_type_str = NULL;
2219 int codec_type = MM_AUDIO_CODEC_INVALID;
2220 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2221 _MMCamcorderSubContext *sc = NULL;
2223 mmf_return_val_if_fail(hcamcorder, NULL);
2224 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2226 mmf_return_val_if_fail(sc, NULL);
2230 /* Check element availability */
2231 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL);
2233 switch (codec_type) {
2234 case MM_AUDIO_CODEC_AMR:
2235 codec_type_str = "AMR";
2237 case MM_AUDIO_CODEC_G723_1:
2238 codec_type_str = "G723_1";
2240 case MM_AUDIO_CODEC_MP3:
2241 codec_type_str = "MP3";
2243 case MM_AUDIO_CODEC_AAC:
2244 codec_type_str = "AAC";
2246 case MM_AUDIO_CODEC_MMF:
2247 codec_type_str = "MMF";
2249 case MM_AUDIO_CODEC_ADPCM:
2250 codec_type_str = "ADPCM";
2252 case MM_AUDIO_CODEC_WAVE:
2253 codec_type_str = "WAVE";
2255 case MM_AUDIO_CODEC_MIDI:
2256 codec_type_str = "MIDI";
2258 case MM_AUDIO_CODEC_IMELODY:
2259 codec_type_str = "IMELODY";
2261 case MM_AUDIO_CODEC_VORBIS:
2262 codec_type_str = "VORBIS";
2265 MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type);
2269 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2270 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
2278 static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle)
2280 type_element *telement = NULL;
2281 const char *codec_type_str = NULL;
2282 int codec_type = MM_VIDEO_CODEC_INVALID;
2283 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2284 _MMCamcorderSubContext *sc = NULL;
2286 mmf_return_val_if_fail(hcamcorder, NULL);
2287 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2289 mmf_return_val_if_fail(sc, NULL);
2291 /* Check element availability */
2292 mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL);
2294 switch (codec_type) {
2295 case MM_VIDEO_CODEC_H263:
2296 codec_type_str = "H263";
2298 case MM_VIDEO_CODEC_H264:
2299 codec_type_str = "H264";
2301 case MM_VIDEO_CODEC_H26L:
2302 codec_type_str = "H26L";
2304 case MM_VIDEO_CODEC_MPEG4:
2305 codec_type_str = "MPEG4";
2307 case MM_VIDEO_CODEC_MPEG1:
2308 codec_type_str = "MPEG1";
2310 case MM_VIDEO_CODEC_THEORA:
2311 codec_type_str = "THEORA";
2314 MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type);
2318 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2319 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
2327 static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle)
2329 type_element *telement = NULL;
2330 const char *codec_type_str = NULL;
2331 int codec_type = MM_IMAGE_CODEC_INVALID;
2332 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2333 _MMCamcorderSubContext *sc = NULL;
2335 mmf_return_val_if_fail(hcamcorder, NULL);
2336 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2338 mmf_return_val_if_fail(sc, NULL);
2340 /* Check element availability */
2341 mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL);
2343 switch (codec_type) {
2344 case MM_IMAGE_CODEC_JPEG:
2345 codec_type_str = "JPEG";
2347 case MM_IMAGE_CODEC_SRW:
2348 codec_type_str = "SRW";
2350 case MM_IMAGE_CODEC_JPEG_SRW:
2351 codec_type_str = "JPEG_SRW";
2353 case MM_IMAGE_CODEC_PNG:
2354 codec_type_str = "PNG";
2356 case MM_IMAGE_CODEC_BMP:
2357 codec_type_str = "BMP";
2359 case MM_IMAGE_CODEC_WBMP:
2360 codec_type_str = "WBMP";
2362 case MM_IMAGE_CODEC_TIFF:
2363 codec_type_str = "TIFF";
2365 case MM_IMAGE_CODEC_PCX:
2366 codec_type_str = "PCX";
2368 case MM_IMAGE_CODEC_GIF:
2369 codec_type_str = "GIF";
2371 case MM_IMAGE_CODEC_ICO:
2372 codec_type_str = "ICO";
2374 case MM_IMAGE_CODEC_RAS:
2375 codec_type_str = "RAS";
2377 case MM_IMAGE_CODEC_TGA:
2378 codec_type_str = "TGA";
2380 case MM_IMAGE_CODEC_XBM:
2381 codec_type_str = "XBM";
2383 case MM_IMAGE_CODEC_XPM:
2384 codec_type_str = "XPM";
2387 MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type);
2391 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2392 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
2400 static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle)
2402 type_element *telement = NULL;
2403 const char *mux_type_str = NULL;
2404 int file_type = MM_FILE_FORMAT_INVALID;
2405 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2406 _MMCamcorderSubContext *sc = NULL;
2408 mmf_return_val_if_fail(hcamcorder, NULL);
2409 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2411 mmf_return_val_if_fail(sc, NULL);
2413 /* Check element availability */
2414 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL);
2416 switch (file_type) {
2417 case MM_FILE_FORMAT_3GP:
2418 mux_type_str = "3GP";
2420 case MM_FILE_FORMAT_AMR:
2421 mux_type_str = "AMR";
2423 case MM_FILE_FORMAT_MP4:
2424 mux_type_str = "MP4";
2426 case MM_FILE_FORMAT_AAC:
2427 mux_type_str = "AAC";
2429 case MM_FILE_FORMAT_MP3:
2430 mux_type_str = "MP3";
2432 case MM_FILE_FORMAT_OGG:
2433 mux_type_str = "OGG";
2435 case MM_FILE_FORMAT_WAV:
2436 mux_type_str = "WAV";
2438 case MM_FILE_FORMAT_AVI:
2439 mux_type_str = "AVI";
2441 case MM_FILE_FORMAT_WMA:
2442 mux_type_str = "WMA";
2444 case MM_FILE_FORMAT_WMV:
2445 mux_type_str = "WMV";
2447 case MM_FILE_FORMAT_MID:
2448 mux_type_str = "MID";
2450 case MM_FILE_FORMAT_MMF:
2451 mux_type_str = "MMF";
2453 case MM_FILE_FORMAT_MATROSKA:
2454 mux_type_str = "MATROSKA";
2456 case MM_FILE_FORMAT_M2TS:
2457 mux_type_str = "M2TS";
2460 MMCAM_LOG_ERROR("Not supported file format[%d]", file_type);
2464 _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
2465 CONFIGURE_CATEGORY_MAIN_MUX,
2473 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type)
2475 type_element *telement = NULL;
2478 case MM_CAM_AUDIO_ENCODER:
2479 telement = __mmcamcorder_get_audio_codec_element(handle);
2481 case MM_CAM_VIDEO_ENCODER:
2482 telement = __mmcamcorder_get_video_codec_element(handle);
2484 case MM_CAM_IMAGE_ENCODER:
2485 telement = __mmcamcorder_get_image_codec_element(handle);
2487 case MM_CAM_FILE_FORMAT:
2488 telement = __mmcamcorder_get_file_format_element(handle);
2491 MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type);
2498 int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
2500 int codec_index = MM_AUDIO_CODEC_INVALID;
2503 MMCAM_LOG_ERROR("name is NULL");
2504 return MM_AUDIO_CODEC_INVALID;
2507 if (!strcmp(name, "AMR"))
2508 codec_index = MM_AUDIO_CODEC_AMR;
2509 else if (!strcmp(name, "G723_1"))
2510 codec_index = MM_AUDIO_CODEC_G723_1;
2511 else if (!strcmp(name, "MP3"))
2512 codec_index = MM_AUDIO_CODEC_MP3;
2513 else if (!strcmp(name, "AAC"))
2514 codec_index = MM_AUDIO_CODEC_AAC;
2515 else if (!strcmp(name, "MMF"))
2516 codec_index = MM_AUDIO_CODEC_MMF;
2517 else if (!strcmp(name, "ADPCM"))
2518 codec_index = MM_AUDIO_CODEC_ADPCM;
2519 else if (!strcmp(name, "WAVE"))
2520 codec_index = MM_AUDIO_CODEC_WAVE;
2521 else if (!strcmp(name, "MIDI"))
2522 codec_index = MM_AUDIO_CODEC_MIDI;
2523 else if (!strcmp(name, "IMELODY"))
2524 codec_index = MM_AUDIO_CODEC_IMELODY;
2525 else if (!strcmp(name, "VORBIS"))
2526 codec_index = MM_AUDIO_CODEC_VORBIS;
2528 MMCAM_LOG_DEBUG("audio codec index %d", codec_index);
2535 int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
2537 int codec_index = MM_VIDEO_CODEC_INVALID;
2540 MMCAM_LOG_ERROR("name is NULL");
2541 return MM_VIDEO_CODEC_INVALID;
2544 if (!strcmp(name, "H263"))
2545 codec_index = MM_VIDEO_CODEC_H263;
2546 else if (!strcmp(name, "H264"))
2547 codec_index = MM_VIDEO_CODEC_H264;
2548 else if (!strcmp(name, "H26L"))
2549 codec_index = MM_VIDEO_CODEC_H26L;
2550 else if (!strcmp(name, "MPEG4"))
2551 codec_index = MM_VIDEO_CODEC_MPEG4;
2552 else if (!strcmp(name, "MPEG1"))
2553 codec_index = MM_VIDEO_CODEC_MPEG1;
2554 else if (!strcmp(name, "THEORA"))
2555 codec_index = MM_VIDEO_CODEC_THEORA;
2557 MMCAM_LOG_DEBUG("video codec index %d", codec_index);
2564 int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
2566 int codec_index = MM_IMAGE_CODEC_INVALID;
2569 MMCAM_LOG_ERROR("name is NULL");
2570 return MM_IMAGE_CODEC_INVALID;
2573 if (!strcmp(name, "JPEG"))
2574 codec_index = MM_IMAGE_CODEC_JPEG;
2575 else if (!strcmp(name, "PNG"))
2576 codec_index = MM_IMAGE_CODEC_PNG;
2577 else if (!strcmp(name, "BMP"))
2578 codec_index = MM_IMAGE_CODEC_BMP;
2579 else if (!strcmp(name, "WBMP"))
2580 codec_index = MM_IMAGE_CODEC_WBMP;
2581 else if (!strcmp(name, "TIFF"))
2582 codec_index = MM_IMAGE_CODEC_TIFF;
2583 else if (!strcmp(name, "PCX"))
2584 codec_index = MM_IMAGE_CODEC_PCX;
2585 else if (!strcmp(name, "GIF"))
2586 codec_index = MM_IMAGE_CODEC_GIF;
2587 else if (!strcmp(name, "ICO"))
2588 codec_index = MM_IMAGE_CODEC_ICO;
2589 else if (!strcmp(name, "RAS"))
2590 codec_index = MM_IMAGE_CODEC_RAS;
2591 else if (!strcmp(name, "TGA"))
2592 codec_index = MM_IMAGE_CODEC_TGA;
2593 else if (!strcmp(name, "XBM"))
2594 codec_index = MM_IMAGE_CODEC_XBM;
2595 else if (!strcmp(name, "XPM"))
2596 codec_index = MM_IMAGE_CODEC_XPM;
2598 MMCAM_LOG_DEBUG("image codec index %d", codec_index);
2604 int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
2606 int mux_index = MM_FILE_FORMAT_INVALID;
2609 MMCAM_LOG_ERROR("name is NULL");
2610 return MM_FILE_FORMAT_INVALID;
2613 if (!strcmp(name, "3GP"))
2614 mux_index = MM_FILE_FORMAT_3GP;
2615 else if (!strcmp(name, "AMR"))
2616 mux_index = MM_FILE_FORMAT_AMR;
2617 else if (!strcmp(name, "MP4"))
2618 mux_index = MM_FILE_FORMAT_MP4;
2619 else if (!strcmp(name, "AAC"))
2620 mux_index = MM_FILE_FORMAT_AAC;
2621 else if (!strcmp(name, "MP3"))
2622 mux_index = MM_FILE_FORMAT_MP3;
2623 else if (!strcmp(name, "OGG"))
2624 mux_index = MM_FILE_FORMAT_OGG;
2625 else if (!strcmp(name, "WAV"))
2626 mux_index = MM_FILE_FORMAT_WAV;
2627 else if (!strcmp(name, "AVI"))
2628 mux_index = MM_FILE_FORMAT_AVI;
2629 else if (!strcmp(name, "WMA"))
2630 mux_index = MM_FILE_FORMAT_WMA;
2631 else if (!strcmp(name, "WMV"))
2632 mux_index = MM_FILE_FORMAT_WMV;
2633 else if (!strcmp(name, "MID"))
2634 mux_index = MM_FILE_FORMAT_MID;
2635 else if (!strcmp(name, "MMF"))
2636 mux_index = MM_FILE_FORMAT_MMF;
2637 else if (!strcmp(name, "MATROSKA"))
2638 mux_index = MM_FILE_FORMAT_MATROSKA;
2639 else if (!strcmp(name, "M2TS"))
2640 mux_index = MM_FILE_FORMAT_M2TS;
2642 MMCAM_LOG_DEBUG("mux index %d", mux_index);
2648 int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
2652 mmf_return_val_if_fail(name, -1);
2654 switch (conf_category) {
2655 case CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER:
2656 fmt = _mmcamcorder_get_audio_codec_format(handle, name);
2658 case CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER:
2659 fmt = _mmcamcorder_get_video_codec_format(handle, name);
2661 case CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER:
2662 fmt = _mmcamcorder_get_image_codec_format(handle, name);
2664 case CONFIGURE_CATEGORY_MAIN_MUX:
2665 fmt = _mmcamcorder_get_mux_format(handle, name);
2668 MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category);
2674 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format)
2676 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2677 camera_conf* configure_info = NULL;
2679 int total_count = 0;
2681 mmf_return_val_if_fail(hcamcorder, 0);
2683 configure_info = hcamcorder->conf_main;
2685 if (configure_info->info[conf_category]) {
2688 const char *name = NULL;
2689 int count = configure_info->info[conf_category]->count;
2690 conf_detail *info = configure_info->info[conf_category];
2692 MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]",
2693 conf_category, count, info);
2695 if (count <= 0 || !info)
2698 arr = (int*)g_malloc0(count * sizeof(int));
2700 for (i = 0 ; i < count ; i++) {
2701 if (info->detail_info[i] == NULL)
2704 name = ((type_element*)(info->detail_info[i]))->name;
2705 fmt = _mmcamcorder_get_format(handle, conf_category, name);
2707 arr[total_count++] = fmt;
2709 MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt);