fc639749e4abf43a8f333a6227fd824fd4d232d6
[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 <gst/gst.h>
29 #include <mm_types.h>
30 #include <stdarg.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /*=======================================================================================
37 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
38 ========================================================================================*/
39 /* Disabled
40 #define GET_AND_STORE_ATTRS_AFTER_SCENE_MODE
41 */
42
43 /*=======================================================================================
44 | MACRO DEFINITIONS                                                                     |
45 ========================================================================================*/
46 /**
47  * Caster of attributes handle
48  */
49 #define MMF_CAMCORDER_ATTRS(h) (((mmf_camcorder_t *)(h))->attributes)
50
51 /*=======================================================================================
52 | ENUM DEFINITIONS                                                                      |
53 ========================================================================================*/
54 /**
55  * Enumerations for camcorder attribute ID.
56  */
57 typedef enum
58 {
59         MM_CAM_MODE,                                    /* 0 */
60         MM_CAM_AUDIO_DEVICE,
61         MM_CAM_CAMERA_DEVICE_COUNT,
62         MM_CAM_AUDIO_ENCODER,
63         MM_CAM_VIDEO_ENCODER,
64         MM_CAM_IMAGE_ENCODER,
65         MM_CAM_FILE_FORMAT,
66         MM_CAM_CAMERA_DEVICE_NAME,
67         MM_CAM_AUDIO_SAMPLERATE,
68         MM_CAM_AUDIO_FORMAT,
69         MM_CAM_AUDIO_CHANNEL,                           /* 10 */
70         MM_CAM_AUDIO_VOLUME,
71         MM_CAM_AUDIO_INPUT_ROUTE,
72         MM_CAM_FILTER_SCENE_MODE,
73         MM_CAM_FILTER_BRIGHTNESS,
74         MM_CAM_FILTER_CONTRAST,
75         MM_CAM_FILTER_WB,
76         MM_CAM_FILTER_COLOR_TONE,
77         MM_CAM_FILTER_SATURATION,
78         MM_CAM_FILTER_HUE,
79         MM_CAM_FILTER_SHARPNESS,                        /* 20 */
80         MM_CAM_CAMERA_FORMAT,
81         MM_CAM_CAMERA_RECORDING_MOTION_RATE,
82         MM_CAM_CAMERA_FPS,
83         MM_CAM_CAMERA_WIDTH,
84         MM_CAM_CAMERA_HEIGHT,
85         MM_CAM_CAMERA_DIGITAL_ZOOM,
86         MM_CAM_CAMERA_OPTICAL_ZOOM,
87         MM_CAM_CAMERA_FOCUS_MODE,
88         MM_CAM_CAMERA_AF_SCAN_RANGE,
89         MM_CAM_CAMERA_EXPOSURE_MODE,                    /* 30 */
90         MM_CAM_CAMERA_EXPOSURE_VALUE,
91         MM_CAM_CAMERA_F_NUMBER,
92         MM_CAM_CAMERA_SHUTTER_SPEED,
93         MM_CAM_CAMERA_ISO,
94         MM_CAM_CAMERA_WDR,
95         MM_CAM_CAMERA_ANTI_HANDSHAKE,
96         MM_CAM_CAMERA_FPS_AUTO,
97         MM_CAM_CAMERA_DELAY_ATTR_SETTING,
98         MM_CAM_AUDIO_ENCODER_BITRATE,
99         MM_CAM_VIDEO_ENCODER_BITRATE,                   /* 40 */
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,
109         MM_CAM_DISPLAY_SURFACE,                         /* 50 */
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,
119         MM_CAM_DISPLAY_VISIBLE,                         /* 60 */
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,
129         MM_CAM_TAG_LATITUDE,                            /* 70 */
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,
139         MM_CAM_DETECT_STATUS,                           /* 80 */
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_TAG_GPS_ENABLE,
149         MM_CAM_TAG_GPS_TIME_STAMP,                      /* 90 */
150         MM_CAM_TAG_GPS_DATE_STAMP,
151         MM_CAM_TAG_GPS_PROCESSING_METHOD,
152         MM_CAM_CAMERA_ROTATION,
153         MM_CAM_CAPTURED_SCREENNAIL,
154         MM_CAM_CAPTURE_SOUND_ENABLE,
155         MM_CAM_RECOMMEND_DISPLAY_ROTATION,
156         MM_CAM_CAMERA_FLIP,
157         MM_CAM_CAMERA_HDR_CAPTURE,
158         MM_CAM_DISPLAY_MODE,
159         MM_CAM_AUDIO_DISABLE,                           /* 100 */
160         MM_CAM_RECOMMEND_CAMERA_WIDTH,
161         MM_CAM_RECOMMEND_CAMERA_HEIGHT,
162         MM_CAM_CAPTURED_EXIF_RAW_DATA,
163         MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
164         MM_CAM_DISPLAY_EVAS_DO_SCALING,
165         MM_CAM_CAMERA_FACING_DIRECTION,
166         MM_CAM_DISPLAY_FLIP,
167         MM_CAM_CAMERA_VIDEO_STABILIZATION,
168         MM_CAM_TAG_VIDEO_ORIENTATION,
169         MM_CAM_CAMERA_PAN_MECHA,                        /* 110 */
170         MM_CAM_CAMERA_PAN_ELEC,
171         MM_CAM_CAMERA_TILT_MECHA,
172         MM_CAM_CAMERA_TILT_ELEC,
173         MM_CAM_CAMERA_PTZ_TYPE,
174         MM_CAM_VIDEO_WIDTH,
175         MM_CAM_VIDEO_HEIGHT,
176         MM_CAM_SUPPORT_ZSL_CAPTURE,
177         MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
178         MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
179         MM_CAM_ENCODED_PREVIEW_BITRATE,         /* 120 */
180         MM_CAM_ENCODED_PREVIEW_GOP_INTERVAL,
181         MM_CAM_RECORDER_TAG_ENABLE,
182         MM_CAM_DISPLAY_SOCKET_PATH,
183         MM_CAM_PID_FOR_SOUND_FOCUS,
184         MM_CAM_ROOT_DIRECTORY,
185         MM_CAM_SOUND_STREAM_TYPE,
186         MM_CAM_SOUND_STREAM_INDEX,
187         MM_CAM_ATTRIBUTE_NUM
188 }MMCamcorderAttrsID;
189
190 /*=======================================================================================
191 | TYPE DEFINITIONS                                                                      |
192 ========================================================================================*/
193 typedef bool (*mmf_cam_commit_func_t)(MMHandleType handle, int attr_idx, const mmf_value_t *value);
194
195 /*=======================================================================================
196 | STRUCTURE DEFINITIONS                                                                 |
197 ========================================================================================*/
198 typedef struct {
199         MMCamcorderAttrsID attrid;
200         char *name;
201         int value_type;
202         int flags;
203         union {
204                 void *value_void;
205                 char *value_string;
206                 int value_int;
207                 double value_double;
208         } default_value;              /* default value */
209         MMCamAttrsValidType validity_type;
210         union {
211                 int *int_array;
212                 int int_min;
213                 double *double_array;
214                 double double_min;
215         } validity_value_1;
216         union {
217                 int int_max;
218                 double double_max;
219                 int count;
220         } validity_value_2;
221         mmf_cam_commit_func_t attr_commit;
222 } mm_cam_attr_construct_info;
223
224 /*=======================================================================================
225 | CONSTANT DEFINITIONS                                                                  |
226 ========================================================================================*/
227
228 /*=======================================================================================
229 | STATIC VARIABLES                                                                      |
230 ========================================================================================*/
231
232 /*=======================================================================================
233 | EXTERN GLOBAL VARIABLE                                                                |
234 ========================================================================================*/
235
236 /*=======================================================================================
237 | GLOBAL FUNCTION PROTOTYPES                                                            |
238 ========================================================================================*/
239 /**
240  * This function allocates structure of attributes and sets initial values.
241  *
242  * @param[in]   handle          Handle of camcorder.
243  * @param[in]   info            Preset information of camcorder.
244  * @return      This function returns allocated structure of attributes.
245  * @remarks
246  * @see         _mmcamcorder_dealloc_attribute()
247  *
248  */
249 MMHandleType _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info);
250
251 /**
252  * This function release structure of attributes.
253  *
254  * @param[in]   handle          Handle of camcorder.
255  * @param[in]   attrs           Handle of camcorder attribute.
256  * @return      void
257  * @remarks
258  * @see         _mmcamcorder_alloc_attribute()
259  *
260  */
261 void _mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs);
262
263 /**
264  * This is a meta  function to get attributes of camcorder with given attribute names.
265  *
266  * @param[in]   handle          Handle of camcorder.
267  * @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.
268  * @param[in]   attribute_name  attribute name that user want to get.
269  * @param[in]   var_args        Specifies variable arguments.
270  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
271  * @remarks     You can retrieve multiple attributes at the same time.  @n
272  * @see         _mmcamcorder_set_attributes
273  */
274 int _mmcamcorder_get_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
275
276
277 /**
278  * This is a meta  function to set attributes of camcorder with given attribute names.
279  *
280  * @param[in]   handle          Handle of camcorder.
281  * @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.
282  * @param[in]   attribute_name  attribute name that user want to set.
283  * @param[in]   var_args        Specifies variable arguments.
284  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
285  * @remarks     You can put multiple attributes to camcorder at the same time.  @n
286  * @see         _mmcamcorder_get_attributes
287  */
288 int _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
289
290
291 /**
292  * This is a meta  function to get detail information of the attribute.
293  *
294  * @param[in]   handle          Handle of camcorder.
295  * @param[in]   attr_name       attribute name that user want to get information.
296  * @param[out]  info            a structure that holds information related with the attribute.
297  * @return      This function returns MM_ERROR_NONE on Success, minus on Failure.
298  * @remarks     If the function succeeds, 'info' holds detail information about the attribute, such as type, flag, validity_type, validity_values  @n
299  * @see         _mmcamcorder_get_attributes, _mmcamcorder_set_attributes
300  */
301 int _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCamAttrsInfo *info);
302
303 /*=======================================================================================
304 | CAMCORDER INTERNAL LOCAL                                                              |
305 ========================================================================================*/
306 /**
307  * A commit function to set camcorder attributes
308  * If the attribute needs actual setting, this function handles that activity.
309  * When application sets an attribute, setting function in MSL common calls this function.
310  * If this function fails, original value will not change.
311  *
312  * @param[in]   attr_idx        Attribute index of subcategory.
313  * @param[in]   attr_name       Attribute name.
314  * @param[in]   value           Handle of camcorder.
315  * @param[in]   commit_param    Allocation type of camcorder context.
316  * @return      This function returns TRUE on success, or FALSE on failure
317  * @remarks
318  * @see
319  *
320  */
321 bool _mmcamcorder_commit_camcorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param);
322
323 /**
324  * A commit function to set videosource attribute
325  * If the attribute needs actual setting, this function handles that activity.
326  * When application sets an attribute, setting function in MSL common calls this function.
327  * If this function fails, original value will not change.
328  *
329  * @param[in]   attr_idx        Attribute index of subcategory.
330  * @param[in]   attr_name       Attribute name.
331  * @param[in]   value           Handle of camcorder.
332  * @param[in]   commit_param    Allocation type of camcorder context.
333  * @return      This function returns TRUE on success, or FALSE on failure
334  * @remarks
335  * @see
336  *
337  */
338 bool _mmcamcorder_commit_capture_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
339 bool _mmcamcorder_commit_capture_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
340 bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_idx, const mmf_value_t *value);
341 bool _mmcamcorder_commit_capture_count(MMHandleType handle, int attr_idx, const mmf_value_t *value);
342 bool _mmcamcorder_commit_capture_sound_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
343 bool _mmcamcorder_commit_audio_volume(MMHandleType handle, int attr_idx, const mmf_value_t *value);
344 bool _mmcamcorder_commit_audio_input_route(MMHandleType handle, int attr_idx, const mmf_value_t *value);
345 bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
346 bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const mmf_value_t *value);
347 bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
348 bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
349 bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
350 bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const mmf_value_t *value);
351 bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
352 bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, const mmf_value_t *value);
353 bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const mmf_value_t *value);
354 bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const mmf_value_t *value);
355 bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
356 bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, const mmf_value_t *value);
357 bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, const mmf_value_t *value);
358 bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
359 bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const mmf_value_t *value);
360 bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value);
361 bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int attr_idx, const mmf_value_t *value);
362 bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
363 bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const mmf_value_t *value);
364 bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value);
365 bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const mmf_value_t *value);
366 bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
367 bool _mmcamcorder_commit_filter_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
368 bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value);
369 bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
370 bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, const mmf_value_t *value);
371 bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
372 bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const mmf_value_t *value);
373 bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_idx, const mmf_value_t *value);
374 bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const mmf_value_t *value);
375 bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const mmf_value_t *value);
376 bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_idx, const mmf_value_t *value);
377 bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const mmf_value_t *value);
378 bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const mmf_value_t *value);
379 bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value);
380 bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value);
381 bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
382 bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int attr_idx, const mmf_value_t *value);
383 bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value);
384 bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value);
385
386
387 /**
388  * This function initialize effect setting.
389  *
390  * @param[in]   handle          Handle of camcorder.
391  * @return      bool            Success on TRUE or return FALSE
392  */
393 bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle);
394
395 /**
396  * This function removes writable flag from pre-defined attributes.
397  *
398  * @param[in]   handle          Handle of camcorder.
399  * @return      int             Success on MM_ERROR_NONE or return ERROR with error code
400  */
401 int _mmcamcorder_lock_readonly_attributes(MMHandleType handle);
402
403 /**
404  * This function disable pre-defined attributes.
405  *
406  * @param[in]   handle          Handle of camcorder.
407  * @return      int             Success on MM_ERROR_NONE or return ERROR with error code
408  */
409 int _mmcamcorder_set_disabled_attributes(MMHandleType handle);
410
411 /**
412  * check whether supported or not
413  *
414  * @param[in]   handle          Handle of camcorder.
415  * @param[in]   attr_index      index of attribute to check.
416  * @return      bool            TRUE if supported or FALSE
417  */
418 bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index);
419
420 #ifdef __cplusplus
421 }
422 #endif
423
424 #endif /* __MM_CAMCORDER_ATTRIBUTE_H__ */