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) \
40 #define SAFE_G_FREE(x) \
48 #define CONFIGURE_MAIN_FILE "mmfw_camcorder.ini"
49 #define CONFIGURE_CTRL_FILE_PREFIX "mmfw_camcorder_camera"
51 /*=======================================================================================
53 ========================================================================================*/
59 enum ConfigureValueType {
61 CONFIGURE_VALUE_INT_RANGE,
62 CONFIGURE_VALUE_INT_ARRAY,
63 CONFIGURE_VALUE_INT_PAIR_ARRAY,
64 CONFIGURE_VALUE_STRING,
65 CONFIGURE_VALUE_STRING_ARRAY,
66 CONFIGURE_VALUE_ELEMENT,
70 enum ConfigureCategoryMain {
71 CONFIGURE_CATEGORY_MAIN_GENERAL,
72 CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
73 CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
74 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
75 CONFIGURE_CATEGORY_MAIN_CAPTURE,
76 CONFIGURE_CATEGORY_MAIN_RECORD,
77 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
78 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
79 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
80 CONFIGURE_CATEGORY_MAIN_MUX,
81 CONFIGURE_CATEGORY_MAIN_NUM,
84 enum ConfigureCategoryCtrl {
85 CONFIGURE_CATEGORY_CTRL_CAMERA,
86 CONFIGURE_CATEGORY_CTRL_STROBE,
87 CONFIGURE_CATEGORY_CTRL_EFFECT,
88 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
89 CONFIGURE_CATEGORY_CTRL_CAPTURE,
90 CONFIGURE_CATEGORY_CTRL_DETECT,
91 CONFIGURE_CATEGORY_CTRL_NUM,
94 /*=======================================================================================
95 | STRUCTURE DEFINITIONS |
96 ========================================================================================*/
97 typedef struct _type_int type_int;
103 typedef struct _type_int2 type_int2;
109 typedef struct _type_int_range type_int_range;
110 struct _type_int_range {
117 typedef struct _type_int_array type_int_array;
118 struct _type_int_array {
125 typedef struct _type_int_pair_array type_int_pair_array;
126 struct _type_int_pair_array {
130 int default_value[2];
133 typedef struct _type_string type_string;
134 struct _type_string {
139 typedef struct _type_string2 type_string2;
140 struct _type_string2 {
145 typedef struct _type_string_array type_string_array;
146 struct _type_string_array {
153 typedef struct _type_element type_element;
154 struct _type_element {
156 const char *element_name;
157 type_int **value_int;
159 type_string **value_string;
163 typedef struct _type_element2 type_element2;
164 struct _type_element2 {
167 type_int2 **value_int;
169 type_string2 **value_string;
173 typedef struct _conf_detail conf_detail;
174 struct _conf_detail {
179 typedef struct _conf_info_table conf_info_table;
180 struct _conf_info_table {
184 type_element *value_element;
190 typedef struct _camera_conf camera_conf;
191 struct _camera_conf {
196 /*=======================================================================================
197 | MODULE FUNCTION PROTOTYPES |
198 ========================================================================================*/
201 * This function creates configure info structure from ini file.
203 * @param[in] handle Handle of camcorder.
204 * @param[in] type configure type(MAIN or CTRL).
205 * @param[in] ConfFile ini file path.
206 * @param[out] configure_info configure structure to be got.
207 * @return This function returns MM_ERROR_NONE on success, or others on failure.
209 * @see _mmcamcorder_conf_release_info()
212 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info);
215 * This function releases configure info.
217 * @param[in] handle Handle of camcorder.
218 * @param[in] configure_info configure structure to be released.
221 * @see _mmcamcorder_conf_get_info()
224 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info);
227 * This function gets integer type value from configure info.
229 * @param[in] handle Handle of camcorder.
230 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
231 * @param[in] category configure category.
232 * @param[in] name detail name in category.
233 * @param[out] value value to be got.
234 * @return This function returns TRUE on success, or FALSE on failure.
239 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf *configure_info, int category, const char *name, int *value);
242 * This function gets integer-range type value from configure info.
244 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
245 * @param[in] category configure category.
246 * @param[in] name detail name in category.
247 * @param[out] value value to be got.
248 * @return This function returns TRUE on success, or FALSE on failure.
253 int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, const char *name, type_int_range **value);
256 * This function gets integer-array type value from configure info.
258 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
259 * @param[in] category configure category.
260 * @param[in] name detail name in category.
261 * @param[out] value value to be got.
262 * @return This function returns TRUE on success, or FALSE on failure.
267 int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, const char *name, type_int_array **value);
270 * This function gets integer-pair-array type value from configure info.
272 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
273 * @param[in] category configure category.
274 * @param[in] name detail name in category.
275 * @param[out] value value to be got.
276 * @return This function returns TRUE on success, or FALSE on failure.
281 int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, const char *name, type_int_pair_array **value);
284 * This function gets string type value from configure info.
286 * @param[in] handle Handle of camcorder.
287 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
288 * @param[in] category configure category.
289 * @param[in] name detail name in category.
290 * @param[out] value value to be got.
291 * @return This function returns TRUE on success, or FALSE on failure.
296 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf *configure_info, int category, const char *name, const char **value);
299 * This function gets string-array type value from configure info.
301 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
302 * @param[in] category configure category.
303 * @param[in] name detail name in category.
304 * @param[out] value value to be got.
305 * @return This function returns TRUE on success, or FALSE on failure.
310 int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, const char *name, type_string_array **value);
313 * This function gets element info from configure info.
315 * @param[in] handle Handle of camcorder.
316 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
317 * @param[in] category configure category.
318 * @param[in] name detail name in category.
319 * @param[out] element element info to be got.
320 * @return This function returns TRUE on success, or FALSE on failure.
325 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf *configure_info, int category, const char *name, type_element **element);
328 * This function gets element name from element info.
330 * @param[in] element element info.
331 * @param[out] name element name to be got.
332 * @return This function returns TRUE on success, or FALSE on failure.
337 int _mmcamcorder_conf_get_value_element_name(type_element *element, const char **value);
340 * This function gets integer value of element's named property from element info.
342 * @param[in] element element info.
343 * @param[in] name property name.
344 * @param[out] value value to be got.
345 * @return This function returns TRUE on success, or FALSE on failure.
350 int _mmcamcorder_conf_get_value_element_int(type_element *element, const char *name, int *value);
353 * This function gets string value of element's named property from element info.
355 * @param[in] element element info.
356 * @param[in] name property name.
357 * @param[out] value value to be got.
358 * @return This function returns TRUE on success, or FALSE on failure.
363 int _mmcamcorder_conf_get_value_element_string(type_element *element, const char *name, const char **value);
366 * This function sets all property of element info.
368 * @param[in] gst gstreamer element.
369 * @param[in] element element info.
370 * @return This function returns TRUE on success, or FALSE on failure.
375 int _mmcamcorder_conf_set_value_element_property(GstElement *gst, type_element *element);
378 * This function prints all values of configure info.
380 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
381 * @return This function returns TRUE on success, or FALSE on failure.
386 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf **configure_info);
388 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type);
389 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format);
391 /* Internal function */
392 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info);
393 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fd, camera_conf **configure_info);
394 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char *name, int *value_type);
395 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details);
396 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char *name, int *value);
397 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
398 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
399 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
404 #endif /* __MM_CAMCORDER_CONFIGURE_H__ */