406dece43f151e8517dd60556a5eeeab8990408d
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_attribute.h
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 #ifndef __MM_CAMCORDER_ATTRIBUTE_H__
23 #define __MM_CAMCORDER_ATTRIBUTE_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <mm_types.h>
29 #include <stdarg.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*=======================================================================================
36 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
37 ========================================================================================*/
38 /* Disabled
39 #define GET_AND_STORE_ATTRS_AFTER_SCENE_MODE
40 */
41
42 /*=======================================================================================
43 | MACRO DEFINITIONS                                                                     |
44 ========================================================================================*/
45 /**
46  * Caster of attributes handle
47  */
48 #define MMF_CAMCORDER_ATTRS(h) (((mmf_camcorder_t *)(h))->attributes)
49
50 /*=======================================================================================
51 | ENUM DEFINITIONS                                                                      |
52 ========================================================================================*/
53 /**
54  * Enumerations for camcorder attribute ID.
55  */
56 typedef enum
57 {
58         MM_CAM_MODE,                                    /* 0 */
59         MM_CAM_AUDIO_DEVICE,
60         MM_CAM_CAMERA_DEVICE_COUNT,
61         MM_CAM_AUDIO_ENCODER,
62         MM_CAM_VIDEO_ENCODER,
63         MM_CAM_IMAGE_ENCODER,
64         MM_CAM_FILE_FORMAT,
65         MM_CAM_CAMERA_DEVICE_NAME,
66         MM_CAM_AUDIO_SAMPLERATE,
67         MM_CAM_AUDIO_FORMAT,
68         MM_CAM_AUDIO_CHANNEL,                           /* 10 */
69         MM_CAM_AUDIO_VOLUME,
70         MM_CAM_AUDIO_INPUT_ROUTE,
71         MM_CAM_FILTER_SCENE_MODE,
72         MM_CAM_FILTER_BRIGHTNESS,
73         MM_CAM_FILTER_CONTRAST,
74         MM_CAM_FILTER_WB,
75         MM_CAM_FILTER_COLOR_TONE,
76         MM_CAM_FILTER_SATURATION,
77         MM_CAM_FILTER_HUE,
78         MM_CAM_FILTER_SHARPNESS,                        /* 20 */
79         MM_CAM_CAMERA_FORMAT,
80         MM_CAM_CAMERA_RECORDING_MOTION_RATE,
81         MM_CAM_CAMERA_FPS,
82         MM_CAM_CAMERA_WIDTH,
83         MM_CAM_CAMERA_HEIGHT,
84         MM_CAM_CAMERA_DIGITAL_ZOOM,
85         MM_CAM_CAMERA_OPTICAL_ZOOM,
86         MM_CAM_CAMERA_FOCUS_MODE,
87         MM_CAM_CAMERA_AF_SCAN_RANGE,
88         MM_CAM_CAMERA_EXPOSURE_MODE,                    /* 30 */
89         MM_CAM_CAMERA_EXPOSURE_VALUE,
90         MM_CAM_CAMERA_F_NUMBER,
91         MM_CAM_CAMERA_SHUTTER_SPEED,
92         MM_CAM_CAMERA_ISO,
93         MM_CAM_CAMERA_WDR,
94         MM_CAM_CAMERA_ANTI_HANDSHAKE,
95         MM_CAM_CAMERA_FPS_AUTO,
96         MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING,
97         MM_CAM_CAMERA_DELAY_ATTR_SETTING,
98         MM_CAM_AUDIO_ENCODER_BITRATE,                   /* 40 */
99         MM_CAM_VIDEO_ENCODER_BITRATE,
100         MM_CAM_IMAGE_ENCODER_QUALITY,
101         MM_CAM_CAPTURE_FORMAT,
102         MM_CAM_CAPTURE_WIDTH,
103         MM_CAM_CAPTURE_HEIGHT,
104         MM_CAM_CAPTURE_COUNT,
105         MM_CAM_CAPTURE_INTERVAL,
106         MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
107         MM_CAM_DISPLAY_HANDLE,
108         MM_CAM_DISPLAY_DEVICE,                          /* 50 */
109         MM_CAM_DISPLAY_SURFACE,
110         MM_CAM_DISPLAY_RECT_X,
111         MM_CAM_DISPLAY_RECT_Y,
112         MM_CAM_DISPLAY_RECT_WIDTH,
113         MM_CAM_DISPLAY_RECT_HEIGHT,
114         MM_CAM_DISPLAY_SOURCE_X,
115         MM_CAM_DISPLAY_SOURCE_Y,
116         MM_CAM_DISPLAY_SOURCE_WIDTH,
117         MM_CAM_DISPLAY_SOURCE_HEIGHT,
118         MM_CAM_DISPLAY_ROTATION,                        /* 60 */
119         MM_CAM_DISPLAY_VISIBLE,
120         MM_CAM_DISPLAY_SCALE,
121         MM_CAM_DISPLAY_GEOMETRY_METHOD,
122         MM_CAM_TARGET_FILENAME,
123         MM_CAM_TARGET_MAX_SIZE,
124         MM_CAM_TARGET_TIME_LIMIT,
125         MM_CAM_TAG_ENABLE,
126         MM_CAM_TAG_IMAGE_DESCRIPTION,
127         MM_CAM_TAG_ORIENTATION,
128         MM_CAM_TAG_SOFTWARE,                            /* 70 */
129         MM_CAM_TAG_LATITUDE,
130         MM_CAM_TAG_LONGITUDE,
131         MM_CAM_TAG_ALTITUDE,
132         MM_CAM_STROBE_CONTROL,
133         MM_CAM_STROBE_CAPABILITIES,
134         MM_CAM_STROBE_MODE,
135         MM_CAM_DETECT_MODE,
136         MM_CAM_DETECT_NUMBER,
137         MM_CAM_DETECT_FOCUS_SELECT,
138         MM_CAM_DETECT_SELECT_NUMBER,                    /* 80 */
139         MM_CAM_DETECT_STATUS,
140         MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
141         MM_CAM_CAMERA_AF_TOUCH_X,
142         MM_CAM_CAMERA_AF_TOUCH_Y,
143         MM_CAM_CAMERA_AF_TOUCH_WIDTH,
144         MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
145         MM_CAM_CAMERA_FOCAL_LENGTH,
146         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
147         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
148         MM_CAM_CAPTURE_THUMBNAIL,                       /* 90 */
149         MM_CAM_TAG_GPS_ENABLE,
150         MM_CAM_TAG_GPS_TIME_STAMP,
151         MM_CAM_TAG_GPS_DATE_STAMP,
152         MM_CAM_TAG_GPS_PROCESSING_METHOD,
153         MM_CAM_CAMERA_ROTATION,
154         MM_CAM_ENABLE_CONVERTED_STREAM_CALLBACK,
155         MM_CAM_CAPTURED_SCREENNAIL,
156         MM_CAM_CAPTURE_SOUND_ENABLE,
157         MM_CAM_RECOMMEND_DISPLAY_ROTATION,
158         MM_CAM_CAMERA_FLIP,                             /* 100 */
159         MM_CAM_CAMERA_HDR_CAPTURE,
160         MM_CAM_DISPLAY_MODE,
161         MM_CAM_CAMERA_FACE_ZOOM_X,
162         MM_CAM_CAMERA_FACE_ZOOM_Y,
163         MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
164         MM_CAM_CAMERA_FACE_ZOOM_MODE,
165         MM_CAM_AUDIO_DISABLE,
166         MM_CAM_RECOMMEND_CAMERA_WIDTH,
167         MM_CAM_RECOMMEND_CAMERA_HEIGHT,
168         MM_CAM_CAPTURED_EXIF_RAW_DATA,                  /* 110 */
169         MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
170         MM_CAM_DISPLAY_EVAS_DO_SCALING,
171         MM_CAM_CAMERA_FACING_DIRECTION,
172         MM_CAM_DISPLAY_FLIP,
173         MM_CAM_CAMERA_VIDEO_STABILIZATION,
174         MM_CAM_TAG_VIDEO_ORIENTATION,
175         MM_CAM_NUM
176 }MMCamcorderAttrsID;
177
178 /*=======================================================================================
179 | TYPE DEFINITIONS                                                                      |
180 ========================================================================================*/
181 typedef bool (*mmf_cam_commit_func_t)(MMHandleType handle, int attr_idx, const mmf_value_t *value);
182
183 /*=======================================================================================
184 | STRUCTURE DEFINITIONS                                                                 |
185 ========================================================================================*/
186 typedef struct {
187         MMCamcorderAttrsID attrid;
188         char *name;
189         int value_type;
190         int flags;
191         union {
192                 void *value_void;
193                 char *value_string;
194                 int value_int;
195                 double value_double;
196         } default_value;              /* default value */
197         MMCamAttrsValidType validity_type;
198         int validity_value1;    /* can be int min, int *array, double *array, or cast to double min. */
199         int validity_value2;    /* can be int max, int count, int count, or cast to double max. */
200         mmf_cam_commit_func_t attr_commit;
201 } mm_cam_attr_construct_info;
202
203 /*=======================================================================================
204 | CONSTANT DEFINITIONS                                                                  |
205 ========================================================================================*/
206
207 /*=======================================================================================
208 | STATIC VARIABLES                                                                      |
209 ========================================================================================*/
210
211 /*=======================================================================================
212 | EXTERN GLOBAL VARIABLE                                                                |
213 ========================================================================================*/
214
215 /*=======================================================================================
216 | GLOBAL FUNCTION PROTOTYPES                                                            |
217 ========================================================================================*/
218 /**
219  * This function allocates structure of attributes and sets initial values.
220  *
221  * @param[in]   handle          Handle of camcorder.
222  * @param[in]   info            Preset information of camcorder.
223  * @return      This function returns allocated structure of attributes.
224  * @remarks
225  * @see         _mmcamcorder_dealloc_attribute()
226  *
227  */
228 MMHandleType _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info);
229
230 /**
231  * This function release structure of attributes.
232  *
233  * @param[in]   attrs           Handle of camcorder attribute.
234  * @return      void
235  * @remarks
236  * @see         _mmcamcorder_alloc_attribute()
237  *
238  */
239 void _mmcamcorder_dealloc_attribute(MMHandleType attrs);
240
241 /**
242  * This is a meta  function to get attributes of camcorder with given attribute names.
243  *
244  * @param[in]   handle          Handle of camcorder.
245  * @param[out]  err_attr_name   Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null.
246  * @param[in]   attribute_name  attribute name that user want to get.
247  * @param[in]   var_args        Specifies variable arguments.
248  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
249  * @remarks     You can retrieve multiple attributes at the same time.  @n
250  * @see         _mmcamcorder_set_attributes
251  */
252 int _mmcamcorder_get_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
253
254
255 /**
256  * This is a meta  function to set attributes of camcorder with given attribute names.
257  *
258  * @param[in]   handle          Handle of camcorder.
259  * @param[out]  err_attr_name   Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null.
260  * @param[in]   attribute_name  attribute name that user want to set.
261  * @param[in]   var_args        Specifies variable arguments.
262  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
263  * @remarks     You can put multiple attributes to camcorder at the same time.  @n
264  * @see         _mmcamcorder_get_attributes
265  */
266 int _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
267
268
269 /**
270  * This is a meta  function to get detail information of the attribute.
271  *
272  * @param[in]   handle          Handle of camcorder.
273  * @param[in]   attr_name       attribute name that user want to get information.
274  * @param[out]  info            a structure that holds information related with the attribute.
275  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
276  * @remarks     If the function succeeds, 'info' holds detail information about the attribute, such as type, flag, validity_type, validity_values  @n
277  * @see         _mmcamcorder_get_attributes, _mmcamcorder_set_attributes
278  */
279 int _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCamAttrsInfo *info);
280
281 /*=======================================================================================
282 | CAMCORDER INTERNAL LOCAL                                                              |
283 ========================================================================================*/
284 /**
285  * A commit function to set camcorder attributes
286  * If the attribute needs actual setting, this function handles that activity.
287  * When application sets an attribute, setting function in MSL common calls this function.
288  * If this function fails, original value will not change.
289  *
290  * @param[in]   attr_idx        Attribute index of subcategory.
291  * @param[in]   attr_name       Attribute name.
292  * @param[in]   value           Handle of camcorder.
293  * @param[in]   commit_param    Allocation type of camcorder context.
294  * @return      This function returns TRUE on success, or FALSE on failure
295  * @remarks
296  * @see
297  *
298  */
299 bool _mmcamcorder_commit_camcorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param);
300
301 /**
302  * A commit function to set videosource attribute
303  * If the attribute needs actual setting, this function handles that activity.
304  * When application sets an attribute, setting function in MSL common calls this function.
305  * If this function fails, original value will not change.
306  *
307  * @param[in]   attr_idx        Attribute index of subcategory.
308  * @param[in]   attr_name       Attribute name.
309  * @param[in]   value           Handle of camcorder.
310  * @param[in]   commit_param    Allocation type of camcorder context.
311  * @return      This function returns TRUE on success, or FALSE on failure
312  * @remarks
313  * @see
314  *
315  */
316 bool _mmcamcorder_commit_capture_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
317 bool _mmcamcorder_commit_capture_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
318 bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_idx, const mmf_value_t *value);
319 bool _mmcamcorder_commit_capture_count(MMHandleType handle, int attr_idx, const mmf_value_t *value);
320 bool _mmcamcorder_commit_capture_sound_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
321 bool _mmcamcorder_commit_audio_volume(MMHandleType handle, int attr_idx, const mmf_value_t *value);
322 bool _mmcamcorder_commit_audio_input_route(MMHandleType handle, int attr_idx, const mmf_value_t *value);
323 bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
324 bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const mmf_value_t *value);
325 bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
326 bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
327 bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
328 bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
329 bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
330 bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, const mmf_value_t *value);
331 bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, const mmf_value_t *value);
332 bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
333 bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const mmf_value_t *value);
334 bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value);
335 bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int attr_idx, const mmf_value_t *value);
336 bool _mmcamcorder_commit_camera_hold_af_after_capturing(MMHandleType handle, int attr_idx, const mmf_value_t *value);
337 bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
338 bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
339 bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const mmf_value_t *value);
340 bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value);
341 bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const mmf_value_t *value);
342 bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
343 bool _mmcamcorder_commit_filter_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
344 bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value);
345 bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
346 bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, const mmf_value_t *value);
347 bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
348 bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const mmf_value_t *value);
349 bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_idx, const mmf_value_t *value);
350 bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const mmf_value_t *value);
351 bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const mmf_value_t *value);
352 bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_idx, const mmf_value_t *value);
353 bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const mmf_value_t *value);
354 bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const mmf_value_t *value);
355 bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
356 bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value);
357
358 /**
359  * This function initialize effect setting.
360  *
361  * @param[in]   handle          Handle of camcorder.
362  * @return      bool            Success on TRUE or return FALSE
363  */
364 bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle);
365
366 /**
367  * This function removes writable flag from pre-defined attributes.
368  *
369  * @param[in]   handle          Handle of camcorder.
370  * @return      int             Success on MM_ERROR_NONE or return ERROR with error code
371  */
372 int _mmcamcorder_lock_readonly_attributes(MMHandleType handle);
373
374 /**
375  * This function disable pre-defined attributes.
376  *
377  * @param[in]   handle          Handle of camcorder.
378  * @return      int             Success on MM_ERROR_NONE or return ERROR with error code
379  */
380 int _mmcamcorder_set_disabled_attributes(MMHandleType handle);
381
382 /**
383  * check whether supported or not
384  *
385  * @param[in]   handle          Handle of camcorder.
386  * @param[in]   attr_index      index of attribute to check.
387  * @return      bool            TRUE if supported or FALSE
388  */
389 bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index);
390
391 #ifdef __cplusplus
392 }
393 #endif
394
395 #endif /* __MM_CAMCORDER_ATTRIBUTE_H__ */