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 #ifndef __MM_CAMCORDER_CONFIGURE_H__
23 #define __MM_CAMCORDER_CONFIGURE_H__
29 /*=======================================================================================
31 ========================================================================================*/
32 #define SAFE_FREE(x) \
38 #define SAFE_G_FREE(x) \
44 #define CONFIGURE_MAIN_FILE "mmfw_camcorder.ini"
46 /*=======================================================================================
48 ========================================================================================*/
54 enum ConfigureValueType {
56 CONFIGURE_VALUE_INT_RANGE,
57 CONFIGURE_VALUE_INT_ARRAY,
58 CONFIGURE_VALUE_INT_PAIR_ARRAY,
59 CONFIGURE_VALUE_STRING,
60 CONFIGURE_VALUE_STRING_ARRAY,
61 CONFIGURE_VALUE_ELEMENT,
65 enum ConfigureCategoryMain {
66 CONFIGURE_CATEGORY_MAIN_GENERAL,
67 CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
68 CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
69 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
70 CONFIGURE_CATEGORY_MAIN_CAPTURE,
71 CONFIGURE_CATEGORY_MAIN_RECORD,
72 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
73 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
74 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
75 CONFIGURE_CATEGORY_MAIN_MUX,
76 CONFIGURE_CATEGORY_MAIN_NUM,
79 enum ConfigureCategoryCtrl {
80 CONFIGURE_CATEGORY_CTRL_CAMERA,
81 CONFIGURE_CATEGORY_CTRL_STROBE,
82 CONFIGURE_CATEGORY_CTRL_EFFECT,
83 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
84 CONFIGURE_CATEGORY_CTRL_CAPTURE,
85 CONFIGURE_CATEGORY_CTRL_DETECT,
86 CONFIGURE_CATEGORY_CTRL_NUM,
89 /*=======================================================================================
90 | STRUCTURE DEFINITIONS |
91 ========================================================================================*/
92 typedef struct _type_int type_int;
98 typedef struct _type_int2 type_int2;
104 typedef struct _type_int_range type_int_range;
105 struct _type_int_range {
112 typedef struct _type_int_array type_int_array;
113 struct _type_int_array {
120 typedef struct _type_int_pair_array type_int_pair_array;
121 struct _type_int_pair_array {
125 int default_value[2];
128 typedef struct _type_string type_string;
129 struct _type_string {
134 typedef struct _type_string2 type_string2;
135 struct _type_string2 {
140 typedef struct _type_string_array type_string_array;
141 struct _type_string_array {
148 typedef struct _type_element type_element;
149 struct _type_element {
151 const char *element_name;
152 type_int **value_int;
154 type_string **value_string;
158 typedef struct _type_element2 type_element2;
159 struct _type_element2 {
162 type_int2 **value_int;
164 type_string2 **value_string;
168 typedef struct _conf_detail conf_detail;
169 struct _conf_detail {
174 typedef struct _conf_info_table conf_info_table;
175 struct _conf_info_table {
179 type_element *value_element;
185 typedef struct _camera_conf camera_conf;
186 struct _camera_conf {
191 /*=======================================================================================
192 | MODULE FUNCTION PROTOTYPES |
193 ========================================================================================*/
196 * This function creates configure info structure from ini file.
198 * @param[in] handle Handle of camcorder.
199 * @param[in] type configure type(MAIN or CTRL).
200 * @param[in] ConfFile ini file path.
201 * @param[out] configure_info configure structure to be got.
202 * @return This function returns MM_ERROR_NONE on success, or others on failure.
204 * @see _mmcamcorder_conf_release_info()
207 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info);
210 * This function releases configure info.
212 * @param[in] handle Handle of camcorder.
213 * @param[in] configure_info configure structure to be released.
216 * @see _mmcamcorder_conf_get_info()
219 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info);
222 * This function gets integer type value from configure info.
224 * @param[in] handle Handle of camcorder.
225 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
226 * @param[in] category configure category.
227 * @param[in] name detail name in category.
228 * @param[out] value value to be got.
229 * @return This function returns TRUE on success, or FALSE on failure.
234 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf *configure_info, int category, const char *name, int *value);
237 * This function gets integer-range type value from configure info.
239 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
240 * @param[in] category configure category.
241 * @param[in] name detail name in category.
242 * @param[out] value value to be got.
243 * @return This function returns TRUE on success, or FALSE on failure.
248 int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, const char *name, type_int_range **value);
251 * This function gets integer-array type value from configure info.
253 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
254 * @param[in] category configure category.
255 * @param[in] name detail name in category.
256 * @param[out] value value to be got.
257 * @return This function returns TRUE on success, or FALSE on failure.
262 int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, const char *name, type_int_array **value);
265 * This function gets integer-pair-array type value from configure info.
267 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
268 * @param[in] category configure category.
269 * @param[in] name detail name in category.
270 * @param[out] value value to be got.
271 * @return This function returns TRUE on success, or FALSE on failure.
276 int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, const char *name, type_int_pair_array **value);
279 * This function gets string type value from configure info.
281 * @param[in] handle Handle of camcorder.
282 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
283 * @param[in] category configure category.
284 * @param[in] name detail name in category.
285 * @param[out] value value to be got.
286 * @return This function returns TRUE on success, or FALSE on failure.
291 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf *configure_info, int category, const char *name, const char **value);
294 * This function gets string-array type value from configure info.
296 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
297 * @param[in] category configure category.
298 * @param[in] name detail name in category.
299 * @param[out] value value to be got.
300 * @return This function returns TRUE on success, or FALSE on failure.
305 int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, const char *name, type_string_array **value);
308 * This function gets element info from configure info.
310 * @param[in] handle Handle of camcorder.
311 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
312 * @param[in] category configure category.
313 * @param[in] name detail name in category.
314 * @param[out] element element info to be got.
315 * @return This function returns TRUE on success, or FALSE on failure.
320 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf *configure_info, int category, const char *name, type_element **element);
323 * This function gets element name from element info.
325 * @param[in] element element info.
326 * @param[out] name element name to be got.
327 * @return This function returns TRUE on success, or FALSE on failure.
332 int _mmcamcorder_conf_get_value_element_name(type_element *element, const char **value);
335 * This function gets integer value of element's named property from element info.
337 * @param[in] element element info.
338 * @param[in] name property name.
339 * @param[out] value value to be got.
340 * @return This function returns TRUE on success, or FALSE on failure.
345 int _mmcamcorder_conf_get_value_element_int(type_element *element, const char *name, int *value);
348 * This function gets string value of element's named property from element info.
350 * @param[in] element element info.
351 * @param[in] name property name.
352 * @param[out] value value to be got.
353 * @return This function returns TRUE on success, or FALSE on failure.
358 int _mmcamcorder_conf_get_value_element_string(type_element *element, const char *name, const char **value);
361 * This function sets all property of element info.
363 * @param[in] gst gstreamer element.
364 * @param[in] element element info.
365 * @return This function returns TRUE on success, or FALSE on failure.
370 int _mmcamcorder_conf_set_value_element_property(GstElement *gst, type_element *element);
373 * This function prints all values of configure info.
375 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
376 * @return This function returns TRUE on success, or FALSE on failure.
381 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf **configure_info);
383 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type);
384 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format);
386 /* Internal function */
387 void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf **configure_info);
388 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fd, camera_conf **configure_info);
389 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char *name, int *value_type);
390 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details);
391 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char *name, int *value);
392 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
393 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
394 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
399 #endif /* __MM_CAMCORDER_CONFIGURE_H__ */