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"
50 /*=======================================================================================
52 ========================================================================================*/
58 enum ConfigureValueType {
60 CONFIGURE_VALUE_INT_RANGE,
61 CONFIGURE_VALUE_INT_ARRAY,
62 CONFIGURE_VALUE_INT_PAIR_ARRAY,
63 CONFIGURE_VALUE_STRING,
64 CONFIGURE_VALUE_STRING_ARRAY,
65 CONFIGURE_VALUE_ELEMENT,
69 enum ConfigureCategoryMain {
70 CONFIGURE_CATEGORY_MAIN_GENERAL,
71 CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
72 CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
73 CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
74 CONFIGURE_CATEGORY_MAIN_CAPTURE,
75 CONFIGURE_CATEGORY_MAIN_RECORD,
76 CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
77 CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
78 CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
79 CONFIGURE_CATEGORY_MAIN_MUX,
80 CONFIGURE_CATEGORY_MAIN_NUM,
83 enum ConfigureCategoryCtrl {
84 CONFIGURE_CATEGORY_CTRL_CAMERA,
85 CONFIGURE_CATEGORY_CTRL_STROBE,
86 CONFIGURE_CATEGORY_CTRL_EFFECT,
87 CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
88 CONFIGURE_CATEGORY_CTRL_CAPTURE,
89 CONFIGURE_CATEGORY_CTRL_DETECT,
90 CONFIGURE_CATEGORY_CTRL_NUM,
93 /*=======================================================================================
94 | STRUCTURE DEFINITIONS |
95 ========================================================================================*/
96 typedef struct _type_int type_int;
102 typedef struct _type_int2 type_int2;
108 typedef struct _type_int_range type_int_range;
109 struct _type_int_range {
116 typedef struct _type_int_array type_int_array;
117 struct _type_int_array {
124 typedef struct _type_int_pair_array type_int_pair_array;
125 struct _type_int_pair_array {
129 int default_value[2];
132 typedef struct _type_string type_string;
133 struct _type_string {
138 typedef struct _type_string2 type_string2;
139 struct _type_string2 {
144 typedef struct _type_string_array type_string_array;
145 struct _type_string_array {
152 typedef struct _type_element type_element;
153 struct _type_element {
155 const char *element_name;
156 type_int **value_int;
158 type_string **value_string;
162 typedef struct _type_element2 type_element2;
163 struct _type_element2 {
166 type_int2 **value_int;
168 type_string2 **value_string;
172 typedef struct _conf_detail conf_detail;
173 struct _conf_detail {
178 typedef struct _conf_info_table conf_info_table;
179 struct _conf_info_table {
183 type_element *value_element;
189 typedef struct _camera_conf camera_conf;
190 struct _camera_conf {
195 /*=======================================================================================
196 | MODULE FUNCTION PROTOTYPES |
197 ========================================================================================*/
200 * This function creates configure info structure from ini file.
202 * @param[in] handle Handle of camcorder.
203 * @param[in] type configure type(MAIN or CTRL).
204 * @param[in] ConfFile ini file path.
205 * @param[out] configure_info configure structure to be got.
206 * @return This function returns MM_ERROR_NONE on success, or others on failure.
208 * @see _mmcamcorder_conf_release_info()
211 int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info);
214 * This function releases configure info.
216 * @param[in] handle Handle of camcorder.
217 * @param[in] configure_info configure structure to be released.
220 * @see _mmcamcorder_conf_get_info()
223 void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info);
226 * This function gets integer type value from configure info.
228 * @param[in] handle Handle of camcorder.
229 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
230 * @param[in] category configure category.
231 * @param[in] name detail name in category.
232 * @param[out] value value to be got.
233 * @return This function returns TRUE on success, or FALSE on failure.
238 int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf *configure_info, int category, const char *name, int *value);
241 * This function gets integer-range type value from configure info.
243 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
244 * @param[in] category configure category.
245 * @param[in] name detail name in category.
246 * @param[out] value value to be got.
247 * @return This function returns TRUE on success, or FALSE on failure.
252 int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, const char *name, type_int_range **value);
255 * This function gets integer-array type value from configure info.
257 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
258 * @param[in] category configure category.
259 * @param[in] name detail name in category.
260 * @param[out] value value to be got.
261 * @return This function returns TRUE on success, or FALSE on failure.
266 int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, const char *name, type_int_array **value);
269 * This function gets integer-pair-array type value from configure info.
271 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
272 * @param[in] category configure category.
273 * @param[in] name detail name in category.
274 * @param[out] value value to be got.
275 * @return This function returns TRUE on success, or FALSE on failure.
280 int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, const char *name, type_int_pair_array **value);
283 * This function gets string type value from configure info.
285 * @param[in] handle Handle of camcorder.
286 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
287 * @param[in] category configure category.
288 * @param[in] name detail name in category.
289 * @param[out] value value to be got.
290 * @return This function returns TRUE on success, or FALSE on failure.
295 int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf *configure_info, int category, const char *name, const char **value);
298 * This function gets string-array type value from configure info.
300 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
301 * @param[in] category configure category.
302 * @param[in] name detail name in category.
303 * @param[out] value value to be got.
304 * @return This function returns TRUE on success, or FALSE on failure.
309 int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, const char *name, type_string_array **value);
312 * This function gets element info from configure info.
314 * @param[in] handle Handle of camcorder.
315 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
316 * @param[in] category configure category.
317 * @param[in] name detail name in category.
318 * @param[out] element element info to be got.
319 * @return This function returns TRUE on success, or FALSE on failure.
324 int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf *configure_info, int category, const char *name, type_element **element);
327 * This function gets element name from element info.
329 * @param[in] element element info.
330 * @param[out] name element name to be got.
331 * @return This function returns TRUE on success, or FALSE on failure.
336 int _mmcamcorder_conf_get_value_element_name(type_element *element, const char **value);
339 * This function gets integer value of element's named property from element info.
341 * @param[in] element element info.
342 * @param[in] name property name.
343 * @param[out] value value to be got.
344 * @return This function returns TRUE on success, or FALSE on failure.
349 int _mmcamcorder_conf_get_value_element_int(type_element *element, const char *name, int *value);
352 * This function gets string value of element's named property from element info.
354 * @param[in] element element info.
355 * @param[in] name property name.
356 * @param[out] value value to be got.
357 * @return This function returns TRUE on success, or FALSE on failure.
362 int _mmcamcorder_conf_get_value_element_string(type_element *element, const char *name, const char **value);
365 * This function sets all property of element info.
367 * @param[in] gst gstreamer element.
368 * @param[in] element element info.
369 * @return This function returns TRUE on success, or FALSE on failure.
374 int _mmcamcorder_conf_set_value_element_property(GstElement *gst, type_element *element);
377 * This function prints all values of configure info.
379 * @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
380 * @return This function returns TRUE on success, or FALSE on failure.
385 void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf **configure_info);
387 type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type);
388 int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format);
390 /* Internal function */
391 int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure_info);
392 int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fd, camera_conf **configure_info);
393 int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char *name, int *value_type);
394 int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details);
395 int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char *name, int *value);
396 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
397 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
398 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
403 #endif /* __MM_CAMCORDER_CONFIGURE_H__ */