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