c2196e6f9f25c6f82dc673119e15189b177f0354
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_platform.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_PLATFORM_H__
23 #define __MM_CAMCORDER_PLATFORM_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <gst/gst.h>
29 #include <mm_types.h>
30
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /*=======================================================================================
38 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
39 ========================================================================================*/
40
41 /*=======================================================================================
42 | MACRO DEFINITIONS                                                                     |
43 ========================================================================================*/
44 /* CAMERA DEFINED VALUE */
45 /* WQSXGA (5M) */
46 #define MMF_CAM_W2560           2560
47 #define MMF_CAM_H1920           1920
48
49 /* QXGA (3M) */
50 #define MMF_CAM_W2048           2048
51 #define MMF_CAM_H1536           1536
52
53 /* UXGA (2M) */
54 #define MMF_CAM_W1600           1600
55 #define MMF_CAM_H1200           1200
56
57 /* WSXGA (1M) */
58 #define MMF_CAM_W1280           1280
59 #define MMF_CAM_H960            960
60
61 /* SVGA */
62 #define MMF_CAM_W800            800
63 #define MMF_CAM_H600            600
64
65 /* WVGA */
66 #define MMF_CAM_W800            800
67 #define MMF_CAM_H480            480
68
69 /* VGA */
70 #define MMF_CAM_W640            640
71 #define MMF_CAM_H480            480
72
73 /* CIF */
74 #define MMF_CAM_W352            352
75 #define MMF_CAM_H288            288
76
77 /* QVGA */
78 #define MMF_CAM_W320            320
79 #define MMF_CAM_H240            240
80
81 /* QCIF */
82 #define MMF_CAM_W176            176
83 #define MMF_CAM_H144            144
84
85 /* QQVGA */
86 #define MMF_CAM_W160            160
87 #define MMF_CAM_H120            120
88
89 /* QQCIF */
90 #define MMF_CAM_W88             88
91 #define MMF_CAM_H72             72
92
93 /* WQVGA */
94 #define MMF_CAM_W400            400
95 #define MMF_CAM_H240            240
96
97 /* RQVGA */
98 #define MMF_CAM_W240            240
99 #define MMF_CAM_H320            320
100
101 /* RWQVGA */
102 #define MMF_CAM_W240            240
103 #define MMF_CAM_H400            400
104
105 /* Non-specified */
106 #define MMF_CAM_W400            400
107 #define MMF_CAM_H300            300
108
109 /* HD */
110 #define MMF_CAM_W1280           1280
111 #define MMF_CAM_H720            720
112
113 //Zero
114 #define MMF_CAM_W0              0
115 #define MMF_CAM_H0              0
116
117
118 /* Capture related */
119 /* High quality resolution */
120 #define MMFCAMCORDER_HIGHQUALITY_WIDTH          MMF_CAM_W0      /* High quality resolution is not needed, */
121 #define MMFCAMCORDER_HIGHQUALITY_HEIGHT         MMF_CAM_H0      /* because camsensor has a JPEG encoder inside */
122
123 /* VGA (1 : 0.75) */
124 #define MMF_CROP_VGA_LEFT                       0
125 #define MMF_CROP_VGA_RIGHT                      0
126 #define MMF_CROP_VGA_TOP                        0
127 #define MMF_CROP_VGA_BOTTOM                     0
128
129 /* QCIF (1 : 0.818) */
130 #define MMF_CROP_CIF_LEFT                       68              /* little bit confusing */
131 #define MMF_CROP_CIF_RIGHT                      68
132 #define MMF_CROP_CIF_TOP                        0
133 #define MMF_CROP_CIF_BOTTOM                     0
134
135 /* Camera etc */
136 #define _MMCAMCORDER_CAMSTABLE_COUNT            0               /* stablize count of camsensor */
137 #define _MMCAMCORDER_MINIMUM_SPACE              (512*1024)      /* byte */
138 #define _MMCAMCORDER_MMS_MARGIN_SPACE           (512)           /* byte */
139
140 /**
141  * Default None value for camera sensor enumeration.
142  */
143 #define _MMCAMCORDER_SENSOR_ENUM_NONE   -255
144
145 /* camera information related */
146 #define CAMINFO_CONVERT_NUM             40
147
148
149 /*=======================================================================================
150 | ENUM DEFINITIONS                                                                      |
151 ========================================================================================*/
152 /**
153  * Enumerations for attribute converting.
154  */
155 typedef enum {
156         MM_CAMCONVERT_TYPE_INT,
157         MM_CAMCONVERT_TYPE_INT_RANGE,
158         MM_CAMCONVERT_TYPE_INT_ARRAY,
159         MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
160         MM_CAMCONVERT_TYPE_STRING,
161 /*
162         MM_CAMCONVERT_TYPE_DOUBLE,
163         MM_CAMCONVERT_TYPE_DOUBLE_PAIR,
164 */
165         MM_CAMCONVERT_TYPE_USER,        /* user define */
166 } MMCamConvertingType;
167
168 typedef enum {
169         ENUM_CONVERT_WHITE_BALANCE = 0,
170         ENUM_CONVERT_COLOR_TONE,
171         ENUM_CONVERT_ISO,
172         ENUM_CONVERT_PROGRAM_MODE,
173         ENUM_CONVERT_FOCUS_MODE,
174         ENUM_CONVERT_AF_RANGE,
175         ENUM_CONVERT_EXPOSURE_MODE,
176         ENUM_CONVERT_STROBE_MODE,
177         ENUM_CONVERT_WDR,
178         ENUM_CONVERT_FLIP,
179         ENUM_CONVERT_ROTATION,
180         ENUM_CONVERT_ANTI_HAND_SHAKE,
181         ENUM_CONVERT_VIDEO_STABILIZATION,
182         ENUM_CONVERT_NUM
183 } MMCamConvertingEnum;
184
185 /*=======================================================================================
186 | STRUCTURE DEFINITIONS                                                                 |
187 ========================================================================================*/
188 /**
189  * Structure for enumeration converting.
190  */
191 typedef struct {
192         int total_enum_num;             /**< total enumeration count */
193         int *enum_arr;                  /**< enumeration array */
194         int category;                   /**< category */
195         const char *keyword;                    /**< keyword array */
196 } _MMCamcorderEnumConvert;
197
198
199 /**
200  * Converting table of camera configuration.
201  */
202 typedef struct {
203         int type;                               /**< type of configuration */
204         int category;                           /**< category of configuration */
205         int attr_idx;                           /**< attribute index */
206         int attr_idx_pair;                      /**< attribute index (only for 'pair' type) */
207         const char *keyword;
208         MMCamConvertingType conv_type;
209         _MMCamcorderEnumConvert *enum_convert;  /**< converting value table */
210 } _MMCamcorderInfoConverting;
211
212 /*=======================================================================================
213 | CONSTANT DEFINITIONS                                                                  |
214 ========================================================================================*/
215
216 /*=======================================================================================
217 | STATIC VARIABLES                                                                      |
218 ========================================================================================*/
219
220 /*=======================================================================================
221 | EXTERN GLOBAL VARIABLE                                                                |
222 ========================================================================================*/
223
224 /*=======================================================================================
225 | GLOBAL FUNCTION PROTOTYPES                                                            |
226 ========================================================================================*/
227 int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int mslval);
228 int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int sensval);
229 int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int height,  MMCamAttrsInfo* fps_info);
230
231 int _mmcamcorder_set_converted_value(MMHandleType handle, _MMCamcorderEnumConvert *convert);
232 int _mmcamcorder_init_convert_table(MMHandleType handle);
233 int _mmcamcorder_init_attr_from_configure(MMHandleType handle, int type);
234
235 int _mmcamcorder_convert_brightness(int mslVal);
236 int _mmcamcorder_convert_whitebalance(int mslVal);
237 int _mmcamcorder_convert_colortone(int mslVal);
238 double _mmcamcorder_convert_volume(int mslVal);
239
240 #ifdef __cplusplus
241 }
242 #endif
243
244 #endif /* __MM_CAMCORDER_PLATFORM_H__ */