1 /* 2 Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. 3 4 Redistribution and use in source and binary forms, with or without 5 modification, are permitted provided that the following conditions are 6 met: 7 * Redistributions of source code must retain the above copyright 8 notice, this list of conditions and the following disclaimer. 9 * Redistributions in binary form must reproduce the above 10 copyright notice, this list of conditions and the following 11 disclaimer in the documentation and/or other materials provided 12 with the distribution. 13 * Neither the name of The Linux Foundation nor the names of its 14 contributors may be used to endorse or promote products derived 15 from this software without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef __MM_QCAMERA_MAIN_MENU_H__ 31 #define __MM_QCAMERA_MAIN_MENU_H__ 32 33 #include "camera.h" 34 #include "mm_camera_interface.h" 35 36 37 #define VIDEO_BUFFER_SIZE (PREVIEW_WIDTH * PREVIEW_HEIGHT * 3/2) 38 #define THUMBNAIL_BUFFER_SIZE (THUMBNAIL_WIDTH * THUMBNAIL_HEIGHT * 3/2) 39 #define SNAPSHOT_BUFFER_SIZE (PICTURE_WIDTH * PICTURE_HEIGHT * 3/2) 40 41 /*=========================================================================== 42 * Macro 43 *===========================================================================*/ 44 #define PREVIEW_FRAMES_NUM 4 45 #define VIDEO_FRAMES_NUM 4 46 #define THUMBNAIL_FRAMES_NUM 1 47 #define SNAPSHOT_FRAMES_NUM 1 48 #define MAX_NUM_FORMAT 32 49 50 typedef enum 51 { 52 STOP_CAMERA = 1, 53 PREVIEW_VIDEO_RESOLUTION = 2, 54 TAKE_YUV_SNAPSHOT = 3, 55 TAKE_RAW_SNAPSHOT = 4, 56 TAKE_ZSL_SNAPSHOT = 5, 57 //TAKE_LIVE_SNAPSHOT = 17, 58 START_RECORDING = 6, 59 START_RDI = 7, 60 STOP_RDI = 8, 61 SWITCH_CAMERA = 9, 62 //STOP_RECORDING = 7, 63 //SET_WHITE_BALANCE = 3, 64 //SET_EXP_METERING = 4, 65 //GET_CTRL_VALUE = 5, 66 //TOGGLE_AFR = 6, 67 //SET_ISO = 7, 68 //BRIGHTNESS_GOTO_SUBMENU = 8, 69 //CONTRAST_GOTO_SUBMENU = 9, 70 //EV_GOTO_SUBMENU = 10, 71 //SATURATION_GOTO_SUBMENU = 11, 72 //SET_ZOOM = 12, 73 //SET_SHARPNESS = 13, 74 } Camera_main_menu_t; 75 76 typedef enum 77 { 78 ACTION_NO_ACTION, 79 ACTION_STOP_CAMERA, 80 ACTION_PREVIEW_VIDEO_RESOLUTION, 81 ACTION_TAKE_YUV_SNAPSHOT, 82 ACTION_TAKE_RAW_SNAPSHOT, 83 ACTION_TAKE_ZSL_SNAPSHOT, 84 ACTION_TAKE_LIVE_SNAPSHOT, 85 ACTION_START_RECORDING, 86 ACTION_STOP_RECORDING, 87 ACTION_START_RDI, 88 ACTION_STOP_RDI, 89 ACTION_SWITCH_CAMERA, 90 ACTION_SET_WHITE_BALANCE, 91 ACTION_SET_EXP_METERING, 92 ACTION_GET_CTRL_VALUE, 93 ACTION_TOGGLE_AFR, 94 ACTION_SET_ISO, 95 ACTION_BRIGHTNESS_INCREASE, 96 ACTION_BRIGHTNESS_DECREASE, 97 ACTION_CONTRAST_INCREASE, 98 ACTION_CONTRAST_DECREASE, 99 ACTION_EV_INCREASE, 100 ACTION_EV_DECREASE, 101 ACTION_SATURATION_INCREASE, 102 ACTION_SATURATION_DECREASE, 103 ACTION_SET_ZOOM, 104 ACTION_SHARPNESS_INCREASE, 105 ACTION_SHARPNESS_DECREASE, 106 } camera_action_t; 107 108 #define INVALID_KEY_PRESS 0 109 #define BASE_OFFSET ('Z' - 'A' + 1) 110 #define BASE_OFFSET_NUM ('Z' - 'A' + 2) 111 #define PAD_TO_WORD(a) (((a)+3)&~3) 112 113 114 #define SQCIF_WIDTH 128 115 #define SQCIF_HEIGHT 96 116 #define QCIF_WIDTH 176 117 #define QCIF_HEIGHT 144 118 #define QVGA_WIDTH 320 119 #define QVGA_HEIGHT 240 120 #define HD_THUMBNAIL_WIDTH 256 121 #define HD_THUMBNAIL_HEIGHT 144 122 #define CIF_WIDTH 352 123 #define CIF_HEIGHT 288 124 #define VGA_WIDTH 640 125 #define VGA_HEIGHT 480 126 #define WVGA_WIDTH 800 127 #define WVGA_HEIGHT 480 128 129 #define MP1_WIDTH 1280 130 #define MP1_HEIGHT 960 131 #define MP2_WIDTH 1600 132 #define MP2_HEIGHT 1200 133 #define MP3_WIDTH 2048 134 #define MP3_HEIGHT 1536 135 #define MP5_WIDTH 2592 136 #define MP5_HEIGHT 1944 137 138 #define SVGA_WIDTH 800 139 #define SVGA_HEIGHT 600 140 #define XGA_WIDTH 1024 141 #define XGA_HEIGHT 768 142 #define HD720_WIDTH 1280 143 #define HD720_HEIGHT 720 144 #define WXGA_WIDTH 1280 145 #define WXGA_HEIGHT 768 146 #define HD1080_WIDTH 1920 147 #define HD1080_HEIGHT 1080 148 149 typedef enum 150 { 151 RESOLUTION_MIN = 1, 152 SQCIF = RESOLUTION_MIN, 153 QCIF = 2, 154 QVGA = 3, 155 CIF = 4, 156 VGA = 5, 157 WVGA = 6, 158 SVGA = 7, 159 XGA = 8, 160 HD720 = 9, 161 RESOLUTION_PREVIEW_VIDEO_MAX = HD720, 162 WXGA = 10, 163 MP1 = 11, 164 MP2 = 12, 165 HD1080 = 13, 166 MP3 = 14, 167 MP5 = 15, 168 RESOLUTION_MAX = MP5, 169 } Camera_Resolution; 170 171 172 typedef enum { 173 WHITE_BALANCE_STATE = 1, 174 WHITE_BALANCE_TEMPERATURE = 2, 175 BRIGHTNESS_CTRL = 3, 176 EV = 4, 177 CONTRAST_CTRL = 5, 178 SATURATION_CTRL = 6, 179 SHARPNESS_CTRL = 7, 180 } Get_Ctrl_modes; 181 182 typedef enum { 183 EXP_METERING_FRAME_AVERAGE = 1, 184 EXP_METERING_CENTER_WEIGHTED = 2, 185 EXP_METERING_SPOT_METERING = 3, 186 } Exp_Metering_modes; 187 188 typedef enum { 189 ISO_AUTO = 1, 190 ISO_DEBLUR = 2, 191 ISO_100 = 3, 192 ISO_200 = 4, 193 ISO_400 = 5, 194 ISO_800 = 6, 195 ISO_1600 = 7, 196 } ISO_modes; 197 198 typedef enum 199 { 200 MENU_ID_MAIN, 201 MENU_ID_PREVIEWVIDEORESOLUTIONCHANGE, 202 MENU_ID_WHITEBALANCECHANGE, 203 MENU_ID_EXPMETERINGCHANGE, 204 MENU_ID_GET_CTRL_VALUE, 205 MENU_ID_TOGGLEAFR, 206 MENU_ID_ISOCHANGE, 207 MENU_ID_BRIGHTNESSCHANGE, 208 MENU_ID_CONTRASTCHANGE, 209 MENU_ID_EVCHANGE, 210 MENU_ID_SATURATIONCHANGE, 211 MENU_ID_ZOOMCHANGE, 212 MENU_ID_SHARPNESSCHANGE, 213 MENU_ID_SWITCHCAMERA, 214 MENU_ID_RECORD, 215 MENU_ID_INVALID, 216 } menu_id_change_t; 217 218 typedef enum 219 { 220 INCREASE_ZOOM = 1, 221 DECREASE_ZOOM = 2, 222 INCREASE_STEP_ZOOM = 3, 223 DECREASE_STEP_ZOOM = 4, 224 } Camera_Zoom; 225 226 typedef enum 227 { 228 INC_CONTRAST = 1, 229 DEC_CONTRAST = 2, 230 } Camera_Contrast_changes; 231 232 typedef enum 233 { 234 INC_BRIGHTNESS = 1, 235 DEC_BRIGHTNESS = 2, 236 } Camera_Brightness_changes; 237 238 typedef enum 239 { 240 INCREASE_EV = 1, 241 DECREASE_EV = 2, 242 } Camera_EV_changes; 243 244 typedef enum { 245 INC_SATURATION = 1, 246 DEC_SATURATION = 2, 247 } Camera_Saturation_changes; 248 249 typedef enum 250 { 251 INC_ISO = 1, 252 DEC_ISO = 2, 253 } Camera_ISO_changes; 254 255 typedef enum 256 { 257 INC_SHARPNESS = 1, 258 DEC_SHARPNESS = 2, 259 } Camera_Sharpness_changes; 260 261 typedef enum { 262 ZOOM_IN = 1, 263 ZOOM_OUT = 2, 264 } Zoom_direction; 265 266 typedef enum 267 { 268 LIVE_SNAPSHOT_MENU = 1, 269 STOP_RECORDING_MENU = 2, 270 } Record_changes; 271 272 typedef struct{ 273 Camera_main_menu_t main_menu; 274 char * menu_name; 275 } CAMERA_MAIN_MENU_TBL_T; 276 277 typedef struct{ 278 Camera_Resolution cs_id; 279 uint16_t width; 280 uint16_t height; 281 char * name; 282 char * str_name; 283 } PREVIEW_DIMENSION_TBL_T; 284 285 typedef struct { 286 config3a_wb_t wb_id; 287 char * wb_name; 288 } WHITE_BALANCE_TBL_T; 289 290 typedef struct { 291 int cam_id; 292 char * cam_name; 293 } CAMERA_TBL_T; 294 295 typedef struct { 296 int act_id; 297 char * act_name; 298 } RECORD_TBL_T; 299 300 typedef struct { 301 Get_Ctrl_modes get_ctrl_id; 302 char * get_ctrl_name; 303 } GET_CTRL_TBL_T; 304 305 typedef struct{ 306 Exp_Metering_modes exp_metering_id; 307 char * exp_metering_name; 308 } EXP_METERING_TBL_T; 309 310 typedef struct { 311 ISO_modes iso_modes; 312 char *iso_modes_name; 313 } ISO_TBL_T; 314 315 typedef struct { 316 Zoom_direction zoom_direction; 317 char * zoom_direction_name; 318 } ZOOM_TBL_T; 319 320 typedef struct { 321 Camera_Sharpness_changes sharpness_change; 322 char *sharpness_change_name; 323 } SHARPNESS_TBL_T; 324 325 typedef struct { 326 Camera_Brightness_changes bc_id; 327 char * brightness_name; 328 } CAMERA_BRIGHTNESS_TBL_T; 329 330 typedef struct { 331 Camera_Contrast_changes cc_id; 332 char * contrast_name; 333 } CAMERA_CONTRST_TBL_T; 334 335 typedef struct { 336 Camera_EV_changes ec_id; 337 char * EV_name; 338 } CAMERA_EV_TBL_T; 339 340 typedef struct { 341 Camera_Saturation_changes sc_id; 342 char * saturation_name; 343 } CAMERA_SATURATION_TBL_T; 344 345 typedef struct { 346 Camera_Sharpness_changes bc_id; 347 char * sharpness_name; 348 } CAMERA_SHARPNESS_TBL_T; 349 350 351 typedef struct { 352 void *frameThread; 353 int8_t (*setDimension)(int , void *); 354 int8_t (*setDefaultParams)(int ); 355 int8_t (*registerPreviewBuf)(int , void *, uint32_t, struct msm_frame *, int8_t ); 356 int8_t (*unregisterPreviewBuf)(int , void *, uint32_t, int , unsigned char *); 357 int8_t (*registerVideoBuf)(int , void *, uint32_t, struct msm_frame *, int8_t ); 358 int8_t (*unregisterVideoBuf)(int , void *, uint32_t, int , unsigned char *); 359 int8_t (*startPreview)(int ); 360 int8_t (*stopPreview)(int ); 361 int8_t (*startVideo)(int ); 362 int8_t (*stopVideo)(int ); 363 int8_t (*startRecording)(int ); 364 int8_t (*stopRecording)(int ); 365 int8_t (*startSnapshot)(int ); 366 int8_t (*startRawSnapshot)(int ); 367 368 int8_t (*registerSnapshotBuf)(int , void *, int , int , 369 unsigned char *, unsigned char *); 370 371 int8_t (*registerRawSnapshotBuf)(int , void *, int , unsigned char *); 372 373 int8_t (*unregisterSnapshotBuf)(int , void *, int , int , 374 unsigned char *, unsigned char *); 375 376 int8_t (*unregisterRawSnapshotBuf)(int , void *, int , unsigned char *); 377 int8_t (*getPicture)(int fd, struct crop_info *cropInfo ); 378 int8_t (*stopSnapshot)(int ); 379 int8_t (*jpegEncode)(const char *path, void *, int, int , unsigned char *, 380 unsigned char *, void *, camera_encoding_rotate_t rotate); 381 int8_t (*setZoom)(int , void *); 382 int8_t (*getMaxZoom)(int fd, void *pZm); 383 int8_t (*setSpecialEffect)(int, int effect); 384 int8_t (*setBrightness)(int, int); 385 int8_t (*setContrast)(int, int); 386 int8_t (*setSaturation)(int, int); 387 int8_t (*setEV)(int , int ); 388 int8_t (*setAntiBanding)(int , int32_t antibanding); 389 int8_t (*setWhiteBalance)(int , int32_t ); 390 int8_t (*setAecMode)(int , camera_auto_exposure_mode_type ); 391 int8_t (*setIso)(int , camera_iso_mode_type ); 392 int8_t (*setSharpness)(int , int ); 393 int8_t (*setAutoFocus)(int , isp3a_af_mode_t, cam_af_ctrl_t *); 394 int8_t (*sethjr) (int fd, int8_t hjr_status); 395 int8_t (*setLensShading) (int fd, int8_t rolloff_status); 396 int8_t (*setLedMode) (int fd, led_mode_t led_mode); 397 int8_t (*getSharpness_AF) (int fd, int32_t *sharpness); 398 int8_t (*setMotionIso) (int fd, motion_iso_t motion_iso); 399 int8_t (*setHue) (int fd, int32_t hue); 400 int8_t (*cancelAF) (int fd); 401 int8_t (*getAfStep) (int fd, int32_t *afStep); 402 int8_t (*setAfStep) (int fd, int32_t afStep); 403 int8_t (*enableAFD) (int fd); 404 int8_t (*prepareSnapshot) (int fd); 405 int8_t (*setFpsMode) (int fd, fps_mode_t fps_mode); 406 int8_t (*setFps) (int fd, uint16_t fps); 407 int8_t (*setAFFocusRect) (int fd, cam_af_focusrect_t af_focus_rect); 408 } interface_ctrl_t; 409 410 int8_t native_interface_init(interface_ctrl_t *intrfcCtrl, int *camfd); 411 int8_t v4l2_interface_init(interface_ctrl_t *intrfcCtrl, int *videofd); 412 413 int set_zoom (int zoom_action_param); 414 int set_hjr (void); 415 int LensShading (void); 416 int decrease_contrast (void); 417 int increase_contrast (void); 418 int decrease_saturation (void); 419 int increase_saturation (void); 420 int decrease_brightness (void); 421 int increase_brightness (void); 422 int decrease_EV (void); 423 int increase_EV (void); 424 int set_iso (int iso_action_param); 425 int decrease_sharpness (void); 426 int increase_sharpness (void); 427 int SpecialEffect (void); 428 int set_exp_metering (int exp_metering_action_param); 429 int LED_mode_change (void); 430 int set_sharpness_AF (void); 431 int set_auto_focus (void); 432 int set_antibanding (void); 433 int set_whitebalance (int wb_action_param); 434 int print_current_menu (); 435 int set_MotionIso (void); 436 int start_preview (void); 437 int stop_preview (void); 438 static int start_video (void); 439 static int stop_video (void); 440 int start_recording (void); 441 int stop_recording (void); 442 int snapshot_resolution (int); 443 int preview_video_resolution (int); 444 int system_init(void); 445 int system_destroy(void); 446 int toggle_hue(void); 447 int cancel_af(void); 448 int get_af_step(); 449 int set_af_step(); 450 int enable_afd(); 451 int prepare_snapshot(); 452 int set_fps_mode(void); 453 int get_ctrl_value (int ctrl_value_mode_param); 454 int toggle_afr (); 455 int take_yuv_snapshot(int cam_id); 456 int take_raw_snapshot(); 457 #endif /* __MM_QCAMERA_MAIN_MENU_H__ */ 458